1 /*
2  * Copyright (C) 2020 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 com.android.car.internal;
18 
19 import android.content.pm.UserInfo;
20 import android.os.UserHandle;
21 
22 import com.android.internal.os.IResultReceiver;
23 
24 /**
25  * API to communicate from CarServiceHelperService to car service.
26  */
27 oneway interface ICarSystemServerClient {
28     /**
29      * Notify of user lifecycle events.
30      *
31      * @param eventType - type as defined by CarUserManager.UserLifecycleEventType
32      * @param fromUserId - user id of previous user when type is SWITCHING (or UserHandle.USER_NULL)
33      * @param toUserId - user id of new user.
34      */
onUserLifecycleEvent(int eventType, int fromUserId, int toUserId)35     void onUserLifecycleEvent(int eventType, int fromUserId, int toUserId);
36 
37     /**
38      * Nofity when a user is removed.
39      *
40      * NOTE: this is different from onUserLifecycleEvent(), whic is used on user switching events.
41      *
42      * @param user info about the user that was removed.
43      */
onUserRemoved(in UserInfo user)44     void onUserRemoved(in UserInfo user);
45 
46     /**
47      * Notify to init boot user.
48      */
initBootUser()49     void initBootUser();
50 
51     /**
52       * Notify that the device must be factory reset, so CarService can ask user to confirm.
53       *
54       * @param callback used to trigger the factory reset.
55       */
onFactoryReset(IResultReceiver callback)56     void onFactoryReset(IResultReceiver callback);
57 
58     /**
59      * Initial user is decided by HAL and information is saved in CarUserService. It is possible
60      * that car service may crash and this information will be lost. To avoid this situation,
61      * initial user information is saved in System Service using
62      * {@link ICarServiceHelper.sendInitialUser}. If car service reconnects after crash, then this
63      * call will set the initial user information in CarUserService.
64      */
setInitialUser(in UserHandle user)65      void setInitialUser(in UserHandle user);
66 }
67