• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 import android.car.annotation.ApiRequirements;
21 
22 import java.io.PrintWriter;
23 
24 /**
25  * Contains life cycle methods for the OEM Service.
26  *
27  * <p>This is to enforce structure on the OEM Service components. {link OemCarService} would call
28  * these methods.
29  *
30  * @hide
31  */
32 @SystemApi
33 @SuppressWarnings("[NotCloseable]")
34 public interface OemCarServiceComponent {
35     /**
36      * Initializes required resources.
37      *
38      * <p>This is called for each service component during {@link OemCarService#onCreate()}
39      * call of OemCarService.
40      */
41     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.TIRAMISU_2,
42             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
init()43     void init();
44 
45     /**
46      * Releases required resources.
47      *
48      * <p>This is called for each service component during {@link OemCarService#onDestroy()}
49      * call of OemCarService.
50      */
51     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.TIRAMISU_2,
52             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
release()53     void release();
54 
55     /**
56      * Dumps the service component details.
57      *
58      * <p>Each service component should implement a dump command to dump. It is called from
59      * {@link OemCarService#dump(java.io.FileDescriptor, PrintWriter, String[])} call.
60      */
61     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.TIRAMISU_2,
62             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
dump(@ullable PrintWriter writer, @Nullable String[] args)63     void dump(@Nullable PrintWriter writer, @Nullable String[] args);
64 
65     /**
66      * Informs if CarService is ready.
67      *
68      * <p> Each service component should do the necessary initialization depending on CarService. It
69      * is called from {@link OemCarService#onCarServiceReady()} call.
70      */
71     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.TIRAMISU_2,
72             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
onCarServiceReady()73     void onCarServiceReady();
74 }
75