1 /* 2 * Copyright (C) 2021 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 com.android.internal.car; 17 18 import android.annotation.NonNull; 19 import android.annotation.Nullable; 20 import android.annotation.SystemApi; 21 import android.annotation.UserIdInt; 22 import android.os.UserHandle; 23 24 import java.io.File; 25 26 /** 27 * Interface implemented by CarServiceHelperService. 28 * @hide 29 */ 30 @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) 31 public interface CarServiceHelperInterface { 32 33 /** 34 * Sets safety mode 35 */ setSafetyMode(boolean safe)36 void setSafetyMode(boolean safe); 37 38 /** 39 * Creates user even when disallowed 40 */ 41 @Nullable createUserEvenWhenDisallowed(@ullable String name, @NonNull String userType, int flags)42 UserHandle createUserEvenWhenDisallowed(@Nullable String name, @NonNull String userType, 43 int flags); 44 45 /** 46 * Gets the main display assigned to the user. 47 */ getMainDisplayAssignedToUser(@serIdInt int userId)48 int getMainDisplayAssignedToUser(@UserIdInt int userId); 49 50 /** 51 * Gets the full user (i.e., not profile) assigned to the display. 52 */ getUserAssignedToDisplay(int displayId)53 int getUserAssignedToDisplay(int displayId); 54 55 /** 56 * See {@link com.android.server.pm.UserManagerInternal#assignUserToExtraDisplay(int, int)}. 57 */ assignUserToExtraDisplay(@serIdInt int userId, int displayId)58 boolean assignUserToExtraDisplay(@UserIdInt int userId, int displayId); 59 60 /** 61 * See {@link com.android.server.pm.UserManagerInternal#unassignUserFromExtraDisplay(int, int)}. 62 */ unassignUserFromExtraDisplay(@serIdInt int userId, int displayId)63 boolean unassignUserFromExtraDisplay(@UserIdInt int userId, int displayId); 64 65 /** See {@link android.os.UserManager#isVisibleBackgroundUsersEnabled()}. */ isVisibleBackgroundUsersEnabled()66 boolean isVisibleBackgroundUsersEnabled(); 67 68 /** Returns true if the given displayId is OverlayDisplay's.*/ isOverlayDisplay(int displayId)69 boolean isOverlayDisplay(int displayId); 70 71 /** 72 * Dumps service stacks 73 */ 74 @Nullable dumpServiceStacks()75 File dumpServiceStacks(); 76 77 /** Check {@link android.os.Process#setProcessGroup(int, int)}. */ setProcessGroup(int pid, int group)78 void setProcessGroup(int pid, int group); 79 80 /** Check {@link android.os.Process#getProcessGroup(int)}. */ getProcessGroup(int pid)81 int getProcessGroup(int pid); 82 83 /** Check {@link ActivityManager#startUserInBackgroundVisibleOnDisplay(int, int)}. */ startUserInBackgroundVisibleOnDisplay(@serIdInt int userId, int displayId)84 boolean startUserInBackgroundVisibleOnDisplay(@UserIdInt int userId, int displayId); 85 86 /** Check {@link android.os.Process#setProcessProfile(int, int, String)}. */ setProcessProfile(int pid, int uid, @NonNull String profile)87 void setProcessProfile(int pid, int uid, @NonNull String profile); 88 89 /** 90 * Returns the PID for the AIDL VHAL service. 91 * 92 * On error, returns {@link com.android.car.internal.common.CommonConstants#INVALID_PID}. 93 */ fetchAidlVhalPid()94 int fetchAidlVhalPid(); 95 } 96