1 /*
2  * Copyright (C) 2017 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.ComponentName;
20 import android.os.UserHandle;
21 
22 import java.util.List;
23 
24 /**
25  * Helper API for CarService.
26  *
27  * Only for interaction between system server and car service, so it can be changed (without
28  * breaking Car Mainline)
29  *
30  *
31  * @hide
32  */
33 interface ICarServiceHelper {
34     /**
35     * Check
36     * {@link com.android.server.wm.CarLaunchParamsModifier#setDisplayAllowlistForUser(int, int[]).
37     */
setDisplayAllowlistForUser(int userId, in int[] displayIds)38     void setDisplayAllowlistForUser(int userId, in int[] displayIds) = 0;
39 
40     /**
41      * Check
42      * {@link com.android.server.wm.CarLaunchParamsModifier#setPassengerDisplays(int[])}.
43      */
setPassengerDisplays(in int[] displayIds)44     void setPassengerDisplays(in int[] displayIds) = 1;
45 
46     /**
47      * Sets whether it's safe to run operations (like DevicePolicyManager.lockNow()).
48      */
setSafetyMode(boolean safe)49     void setSafetyMode(boolean safe) = 3;
50 
51     /**
52      * Creates the given user, even when it's disallowed by DevicePolicyManager.
53      */
createUserEvenWhenDisallowed(String name, String userType, int flags)54     UserHandle createUserEvenWhenDisallowed(String name, String userType, int flags) = 4;
55 
56     /**
57      * Designates the given {@code activity} to be launched in {@code TaskDisplayArea} of
58      * {@code featureId} in the display of {@code displayId}.
59      */
setPersistentActivity(in ComponentName activity, int displayId, int featureId)60     int setPersistentActivity(in ComponentName activity, int displayId, int featureId) = 5;
61 
62     /**
63      * Saves initial user information in System Server. If car service crashes, Car service helper
64      * service would send back this information.
65      */
66     void sendInitialUser(in UserHandle user) = 6;
67 
68     /** Check {@link android.os.Process#setProcessGroup(int, int)}. */
setProcessGroup(int pid, int group)69     void setProcessGroup(int pid, int group) = 7;
70 
71     /** Check {@link android.os.Process#getProcessGroup(int)}. */
getProcessGroup(int pid)72     int getProcessGroup(int pid) = 8;
73 
74     /** Same as {@code UserManagerInternal#getMainDisplayAssignedToUser()} */
getMainDisplayAssignedToUser(int userId)75     int getMainDisplayAssignedToUser(int userId) = 9;
76 
77     /** Same as {@code UserManagerInternal#getUsersAssignedToDisplay()} */
getUserAssignedToDisplay(int displayId)78     int getUserAssignedToDisplay(int displayId) = 10;
79 
80     /**
81      * Check {@link android.app.AcitivityManager#startUserInBackgroundVisibleOnDisplay(int, int)}
82      */
startUserInBackgroundVisibleOnDisplay(int userId, int displayId)83     boolean startUserInBackgroundVisibleOnDisplay(int userId, int displayId) = 11;
84 
85     /** Check {@link android.os.Process#setProcessProfile(int, int, String)}. */
setProcessProfile(int pid, int uid, in String profile)86     void setProcessProfile(int pid, int uid, in String profile) = 12;
87 
88     /**
89      * Returns the PID for the AIDL VHAL service.
90      *
91      * On error, returns {@link com.android.car.internal.common.CommonConstants#INVALID_PID}.
92      */
fetchAidlVhalPid()93     int fetchAidlVhalPid() = 13;
94 
95     /**
96      * Designates the given {@code activities} to be launched in the root task associated with
97      * {@code rootTaskToken}.
98      */
setPersistentActivitiesOnRootTask(in List<ComponentName> activity, in IBinder rootTaskToken)99     void setPersistentActivitiesOnRootTask(in List<ComponentName> activity,
100         in IBinder rootTaskToken) = 14;
101 
102     /**
103      * Returns true if the given package requires launching in automotive compatibility mode.
104      */
105     boolean requiresDisplayCompat(String packageName) = 15;
106 }
107