1 /*
2  * Copyright (C) 2018 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.app.role;
18 
19 import android.app.role.IOnRoleHoldersChangedListener;
20 import android.os.Bundle;
21 import android.os.RemoteCallback;
22 
23 /**
24  * @hide
25  */
26 interface IRoleManager {
27 
isRoleAvailableAsUser(in String roleName, int userId)28     boolean isRoleAvailableAsUser(in String roleName, int userId);
29 
isRoleHeldAsUser(in String roleName, in String packageName, int userId)30     boolean isRoleHeldAsUser(in String roleName, in String packageName, int userId);
31 
getRoleHoldersAsUser(in String roleName, int userId)32     List<String> getRoleHoldersAsUser(in String roleName, int userId);
33 
addRoleHolderAsUser(in String roleName, in String packageName, int flags, int userId, in RemoteCallback callback)34     void addRoleHolderAsUser(in String roleName, in String packageName, int flags, int userId,
35             in RemoteCallback callback);
36 
removeRoleHolderAsUser(in String roleName, in String packageName, int flags, int userId, in RemoteCallback callback)37     void removeRoleHolderAsUser(in String roleName, in String packageName, int flags, int userId,
38             in RemoteCallback callback);
39 
clearRoleHoldersAsUser(in String roleName, int flags, int userId, in RemoteCallback callback)40     void clearRoleHoldersAsUser(in String roleName, int flags, int userId,
41             in RemoteCallback callback);
42 
getDefaultApplicationAsUser(in String roleName, int userId)43     String getDefaultApplicationAsUser(in String roleName, int userId);
44 
setDefaultApplicationAsUser(in String roleName, in String packageName, int flags, int userId, in RemoteCallback callback)45     void setDefaultApplicationAsUser(in String roleName, in String packageName, int flags,
46 	    int userId, in RemoteCallback callback);
47 
addOnRoleHoldersChangedListenerAsUser(IOnRoleHoldersChangedListener listener, int userId)48     void addOnRoleHoldersChangedListenerAsUser(IOnRoleHoldersChangedListener listener, int userId);
49 
removeOnRoleHoldersChangedListenerAsUser(IOnRoleHoldersChangedListener listener, int userId)50     void removeOnRoleHoldersChangedListenerAsUser(IOnRoleHoldersChangedListener listener,
51             int userId);
52 
isBypassingRoleQualification()53     boolean isBypassingRoleQualification();
54 
setBypassingRoleQualification(boolean bypassRoleQualification)55     void setBypassingRoleQualification(boolean bypassRoleQualification);
56 
isRoleFallbackEnabledAsUser(in String roleName, int userId)57     boolean isRoleFallbackEnabledAsUser(in String roleName, int userId);
58 
setRoleFallbackEnabledAsUser(in String roleName, boolean fallbackEnabled, int userId)59     void setRoleFallbackEnabledAsUser(in String roleName, boolean fallbackEnabled, int userId);
60 
setRoleNamesFromControllerAsUser(in List<String> roleNames, int userId)61     void setRoleNamesFromControllerAsUser(in List<String> roleNames, int userId);
62 
addRoleHolderFromControllerAsUser(in String roleName, in String packageName, int userId)63     boolean addRoleHolderFromControllerAsUser(in String roleName, in String packageName,
64             int userId);
65 
removeRoleHolderFromControllerAsUser(in String roleName, in String packageName, int userId)66     boolean removeRoleHolderFromControllerAsUser(in String roleName, in String packageName,
67             int userId);
68 
getHeldRolesFromControllerAsUser(in String packageName, int userId)69     List<String> getHeldRolesFromControllerAsUser(in String packageName, int userId);
70 
getBrowserRoleHolder(int userId)71     String getBrowserRoleHolder(int userId);
72 
setBrowserRoleHolder(String packageName, int userId)73     boolean setBrowserRoleHolder(String packageName, int userId);
74 
getSmsRoleHolder(int userId)75     String getSmsRoleHolder(int userId);
76 
getEmergencyRoleHolder(int userId)77     String getEmergencyRoleHolder(int userId);
78 
isRoleVisibleAsUser(in String roleName, int userId)79     boolean isRoleVisibleAsUser(in String roleName, int userId);
80 
isApplicationVisibleForRoleAsUser(in String roleName, in String packageName, int userId)81     boolean isApplicationVisibleForRoleAsUser(in String roleName, in String packageName,
82             int userId);
83 }
84