1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package android.car.oem;
17 
18 import android.annotation.Nullable;
19 import android.annotation.SystemApi;
20 
21 import java.io.PrintWriter;
22 
23 /**
24  * Contains life cycle methods for the OEM Service.
25  *
26  * <p>This is to enforce structure on the OEM Service components. {link OemCarService} would call
27  * these methods.
28  *
29  * @hide
30  */
31 @SystemApi
32 @SuppressWarnings("[NotCloseable]")
33 public interface OemCarServiceComponent {
34     /**
35      * Initializes required resources.
36      *
37      * <p>This is called for each service component during {@link OemCarService#onCreate()}
38      * call of OemCarService.
39      */
init()40     void init();
41 
42     /**
43      * Releases required resources.
44      *
45      * <p>This is called for each service component during {@link OemCarService#onDestroy()}
46      * call of OemCarService.
47      */
release()48     void release();
49 
50     /**
51      * Dumps the service component details.
52      *
53      * <p>Each service component should implement a dump command to dump. It is called from
54      * {@link OemCarService#dump(java.io.FileDescriptor, PrintWriter, String[])} call.
55      */
dump(@ullable PrintWriter writer, @Nullable String[] args)56     void dump(@Nullable PrintWriter writer, @Nullable String[] args);
57 
58     /**
59      * Informs if CarService is ready.
60      *
61      * <p> Each service component should do the necessary initialization depending on CarService. It
62      * is called from {@link OemCarService#onCarServiceReady()} call.
63      */
onCarServiceReady()64     void onCarServiceReady();
65 }
66