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 interface ICarServiceHelper { 31 /** 32 * Check 33 * {@link com.android.server.wm.CarLaunchParamsModifier#setDisplayAllowlistForUser(int, int[]). 34 */ setDisplayAllowlistForUser(int userId, in int[] displayIds)35 void setDisplayAllowlistForUser(int userId, in int[] displayIds) = 0; 36 37 /** 38 * Check 39 * {@link com.android.server.wm.CarLaunchParamsModifier#setPassengerDisplays(int[])}. 40 */ setPassengerDisplays(in int[] displayIds)41 void setPassengerDisplays(in int[] displayIds) = 1; 42 43 /** 44 * Sets whether it's safe to run operations (like DevicePolicyManager.lockNow()). 45 */ setSafetyMode(boolean safe)46 void setSafetyMode(boolean safe) = 3; 47 48 /** 49 * Creates the given user, even when it's disallowed by DevicePolicyManager. 50 */ createUserEvenWhenDisallowed(String name, String userType, int flags)51 UserHandle createUserEvenWhenDisallowed(String name, String userType, int flags) = 4; 52 53 /** 54 * Designates the given {@code activity} to be launched in {@code TaskDisplayArea} of 55 * {@code featureId} in the display of {@code displayId}. 56 */ setPersistentActivity(in ComponentName activity, int displayId, int featureId)57 int setPersistentActivity(in ComponentName activity, int displayId, int featureId) = 5; 58 59 /** 60 * Saves initial user information in System Server. If car service crashes, Car service helper 61 * service would send back this information. 62 */ 63 void sendInitialUser(in UserHandle user) = 6; 64 65 /** Check {@link android.os.Process#setProcessGroup(int, int)}. */ setProcessGroup(int pid, int group)66 void setProcessGroup(int pid, int group) = 7; 67 68 /** Check {@link android.os.Process#getProcessGroup(int)}. */ getProcessGroup(int pid)69 int getProcessGroup(int pid) = 8; 70 71 /** Same as {@code UserManagerInternal#getMainDisplayAssignedToUser()} */ getMainDisplayAssignedToUser(int userId)72 int getMainDisplayAssignedToUser(int userId) = 9; 73 74 /** Same as {@code UserManagerInternal#getUsersAssignedToDisplay()} */ getUserAssignedToDisplay(int displayId)75 int getUserAssignedToDisplay(int displayId) = 10; 76 77 /** 78 * Check {@link android.app.AcitivityManager#startUserInBackgroundVisibleOnDisplay(int, int)} 79 */ startUserInBackgroundVisibleOnDisplay(int userId, int displayId)80 boolean startUserInBackgroundVisibleOnDisplay(int userId, int displayId) = 11; 81 82 /** Check {@link android.os.Process#setProcessProfile(int, int, String)}. */ setProcessProfile(int pid, int uid, in String profile)83 void setProcessProfile(int pid, int uid, in String profile) = 12; 84 85 /** 86 * Returns the PID for the AIDL VHAL service. 87 * 88 * On error, returns {@link com.android.car.internal.common.CommonConstants#INVALID_PID}. 89 */ fetchAidlVhalPid()90 int fetchAidlVhalPid() = 13; 91 92 /** 93 * Designates the given {@code activities} to be launched in the root task associated with 94 * {@code rootTaskToken}. 95 */ setPersistentActivitiesOnRootTask(in List<ComponentName> activity, in IBinder rootTaskToken)96 void setPersistentActivitiesOnRootTask(in List<ComponentName> activity, 97 in IBinder rootTaskToken) = 14; 98 99 /** 100 * Returns true if the given package requires launching in automotive compatibility mode. 101 */ 102 boolean requiresDisplayCompat(String packageName) = 15; 103 104 /** 105 * See {@link com.android.server.pm.UserManagerInternal#assignUserToExtraDisplay(int, int)}. 106 */ assignUserToExtraDisplay(int userId, int displayId)107 boolean assignUserToExtraDisplay(int userId, int displayId) = 16; 108 109 /** 110 * See {@link com.android.server.pm.UserManagerInternal#unassignUserFromExtraDisplay(int, int)}. 111 */ unassignUserFromExtraDisplay(int userId, int displayId)112 boolean unassignUserFromExtraDisplay(int userId, int displayId) = 17; 113 114 /** 115 * Returns true if the given package requires launching in automotive compatibility mode for the 116 * given user id. 117 */ requiresDisplayCompatForUser(String packageName, int userId)118 boolean requiresDisplayCompatForUser(String packageName, int userId) = 18; 119 120 /** 121 * Reports that a Root Task is created. 122 */ onRootTaskAppeared(String name, in IBinder rootTaskToken)123 void onRootTaskAppeared(String name, in IBinder rootTaskToken) = 19; 124 125 /** 126 * Reports that a Root Task has vanished. 127 */ 128 void onRootTaskVanished(String name) = 20; 129 } 130