1 /*
2  * Copyright (C) 2015 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 
17 package android.car;
18 
19 /** @hide */
20 interface ICar {
21     // All oneway methods are called from system server and should be placed in top positions.
22     // Do not change the number of oneway methods as system server make binder calls based on these
23     // numbers - if you change them, you need to change the constants on CarServiceHelperService.
24 
25     /**
26      * IBinder is ICarServiceHelper but passed as IBinder due to aidl hidden.
27      */
28     oneway void setCarServiceHelper(in IBinder helper) = 0;
29 
30     /**
31      * Notify of user lifecycle events.
32      *
33      * @param eventType - type as defined by CarUserManager.UserLifecycleEventType
34      * @param timestampMs - when the event happened
35      * @param fromUserId - user id of previous user when type is SWITCHING (or UserHandle.USER_NULL)
36      * @param toUserId - user id of new user.
37      */
onUserLifecycleEvent(int eventType, long timestampMs, int fromUserId, int toUserId)38     oneway void onUserLifecycleEvent(int eventType, long timestampMs, int fromUserId,
39             int toUserId) = 1;
40 
41     /**
42      * Notify when first user was unlocked, for metrics (and lifecycle) purposes.
43      *
44      * @param userId - id of first non-system user locked
45      * @param timestampMs - when the user was unlocked
46      * @param duration - how long it took to unlock (from SystemServer start)
47      * @param halResponseTime - see CarServiceHelperService.mHalResponseTime
48      */
onFirstUserUnlocked(int userId, long timestampMs, long duration, int halResponseTime)49     oneway void onFirstUserUnlocked(int userId, long timestampMs, long duration,
50             int halResponseTime) = 2;
51 
52     /**
53      * Calls User HAL to get the initial user info.
54      *
55      * @param requestType - as defined by InitialUserInfoRequestType.
56      * @param timeoutMs - how long to wait for HAL's response.
57      * @param receiver - a com.android.internal.os.IResultReceiver callback.
58      */
getInitialUserInfo(int requestType, int timeoutMs, in IBinder receiver)59     oneway void getInitialUserInfo(int requestType, int timeoutMs, in IBinder receiver) = 3;
60 
61     /**
62      * Sets the initial user after boot.
63      *
64      * @param userId - the id of the initial user
65      */
66     // TODO(b/150413515): should pass UserInfo instead, but for some reason passing the whole
67     // UserInfo through a raw binder transaction on CarServiceHelper is not working.
setInitialUser(int userId)68     oneway void setInitialUser(int userId) = 4;
69 
70     // Methods below start on 11 to make it easier to add more oneway methods above
71     IBinder getCarService(in String serviceName) = 11;
getCarConnectionType()72     int getCarConnectionType() = 12;
73     boolean isFeatureEnabled(in String featureName) = 13;
74     int enableFeature(in String featureName) = 14;
75     int disableFeature(in String featureName) = 15;
getAllEnabledFeatures()76     List<String> getAllEnabledFeatures() = 16;
getAllPendingDisabledFeatures()77     List<String> getAllPendingDisabledFeatures() = 17;
getAllPendingEnabledFeatures()78     List<String> getAllPendingEnabledFeatures() = 18;
79     /**
80      * Get class name for experimental feature. Class should have constructor taking (Car, IBinder)
81      * and should inherit CarManagerBase.
82      */
83     String getCarManagerClassForFeature(in String featureName) = 19;
84 }
85