1 /*
2 **
3 ** Copyright 2012, The Android Open Source Project
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 **     http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17 
18 package android.os;
19 
20 import android.os.Bundle;
21 import android.os.IUserRestrictionsListener;
22 import android.os.PersistableBundle;
23 import android.os.UserHandle;
24 import android.os.UserManager;
25 import android.content.pm.UserInfo;
26 import android.content.pm.UserProperties;
27 import android.content.IntentSender;
28 import android.content.RestrictionEntry;
29 import android.graphics.Bitmap;
30 import android.os.ParcelFileDescriptor;
31 
32 /**
33  *  {@hide}
34  */
35 interface IUserManager {
36 
37     /*
38      * DO NOT MOVE - UserManager.h depends on the ordering of this function.
39      */
getCredentialOwnerProfile(int userId)40     int getCredentialOwnerProfile(int userId);
getProfileParentId(int userId)41     int getProfileParentId(int userId);
42     /*
43      * END OF DO NOT MOVE
44      */
45 
createUserWithThrow(in String name, in String userType, int flags)46     UserInfo createUserWithThrow(in String name, in String userType, int flags);
preCreateUserWithThrow(in String userType)47     UserInfo preCreateUserWithThrow(in String userType);
createProfileForUserWithThrow(in String name, in String userType, int flags, int userId, in String[] disallowedPackages)48     UserInfo createProfileForUserWithThrow(in String name, in String userType, int flags, int userId,
49             in String[] disallowedPackages);
createRestrictedProfileWithThrow(String name, int parentUserHandle)50     UserInfo createRestrictedProfileWithThrow(String name, int parentUserHandle);
getPreInstallableSystemPackages(in String userType)51     String[] getPreInstallableSystemPackages(in String userType);
setUserEnabled(int userId)52     void setUserEnabled(int userId);
setUserAdmin(int userId)53     void setUserAdmin(int userId);
revokeUserAdmin(int userId)54     void revokeUserAdmin(int userId);
evictCredentialEncryptionKey(int userId)55     void evictCredentialEncryptionKey(int userId);
removeUser(int userId)56     boolean removeUser(int userId);
removeUserEvenWhenDisallowed(int userId)57     boolean removeUserEvenWhenDisallowed(int userId);
setUserName(int userId, String name)58     void setUserName(int userId, String name);
setUserIcon(int userId, in Bitmap icon)59     void setUserIcon(int userId, in Bitmap icon);
getUserIcon(int userId)60     ParcelFileDescriptor getUserIcon(int userId);
getPrimaryUser()61     UserInfo getPrimaryUser();
getMainUserId()62     int getMainUserId();
getCommunalProfileId()63     int getCommunalProfileId();
getPreviousFullUserToEnterForeground()64     int getPreviousFullUserToEnterForeground();
getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated)65     List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated);
getProfiles(int userId, boolean enabledOnly)66     List<UserInfo> getProfiles(int userId, boolean enabledOnly);
getProfileIds(int userId, boolean enabledOnly)67     int[] getProfileIds(int userId, boolean enabledOnly);
isUserTypeEnabled(in String userType)68     boolean isUserTypeEnabled(in String userType);
canAddMoreUsersOfType(in String userType)69     boolean canAddMoreUsersOfType(in String userType);
getRemainingCreatableUserCount(in String userType)70     int getRemainingCreatableUserCount(in String userType);
getRemainingCreatableProfileCount(in String userType, int userId)71     int getRemainingCreatableProfileCount(in String userType, int userId);
canAddMoreProfilesToUser(in String userType, int userId, boolean allowedToRemoveOne)72     boolean canAddMoreProfilesToUser(in String userType, int userId, boolean allowedToRemoveOne);
canAddMoreManagedProfiles(int userId, boolean allowedToRemoveOne)73     boolean canAddMoreManagedProfiles(int userId, boolean allowedToRemoveOne);
getProfileParent(int userId)74     UserInfo getProfileParent(int userId);
isSameProfileGroup(int userId, int otherUserHandle)75     boolean isSameProfileGroup(int userId, int otherUserHandle);
isHeadlessSystemUserMode()76     boolean isHeadlessSystemUserMode();
isUserOfType(int userId, in String userType)77     boolean isUserOfType(int userId, in String userType);
78     @UnsupportedAppUsage
getUserInfo(int userId)79     UserInfo getUserInfo(int userId);
getUserPropertiesCopy(int userId)80     UserProperties getUserPropertiesCopy(int userId);
getUserAccount(int userId)81     String getUserAccount(int userId);
setUserAccount(int userId, String accountName)82     void setUserAccount(int userId, String accountName);
getUserCreationTime(int userId)83     long getUserCreationTime(int userId);
getUserSwitchability(int userId)84     int getUserSwitchability(int userId);
isUserSwitcherEnabled(boolean showEvenIfNotActionable, int mUserId)85     boolean isUserSwitcherEnabled(boolean showEvenIfNotActionable, int mUserId);
isRestricted(int userId)86     boolean isRestricted(int userId);
canHaveRestrictedProfile(int userId)87     boolean canHaveRestrictedProfile(int userId);
canAddPrivateProfile(int userId)88     boolean canAddPrivateProfile(int userId);
getUserSerialNumber(int userId)89     int getUserSerialNumber(int userId);
getUserHandle(int userSerialNumber)90     int getUserHandle(int userSerialNumber);
getUserRestrictionSource(String restrictionKey, int userId)91     int getUserRestrictionSource(String restrictionKey, int userId);
getUserRestrictionSources(String restrictionKey, int userId)92     List<UserManager.EnforcingUser> getUserRestrictionSources(String restrictionKey, int userId);
getUserRestrictions(int userId)93     Bundle getUserRestrictions(int userId);
hasBaseUserRestriction(String restrictionKey, int userId)94     boolean hasBaseUserRestriction(String restrictionKey, int userId);
hasUserRestriction(in String restrictionKey, int userId)95     boolean hasUserRestriction(in String restrictionKey, int userId);
hasUserRestrictionOnAnyUser(in String restrictionKey)96     boolean hasUserRestrictionOnAnyUser(in String restrictionKey);
isSettingRestrictedForUser(in String setting, int userId, in String value, int callingUid)97     boolean isSettingRestrictedForUser(in String setting, int userId, in String value, int callingUid);
addUserRestrictionsListener(IUserRestrictionsListener listener)98     void addUserRestrictionsListener(IUserRestrictionsListener listener);
setUserRestriction(String key, boolean value, int userId)99     void setUserRestriction(String key, boolean value, int userId);
setApplicationRestrictions(in String packageName, in Bundle restrictions, int userId)100     void setApplicationRestrictions(in String packageName, in Bundle restrictions, int userId);
getApplicationRestrictions(in String packageName)101     Bundle getApplicationRestrictions(in String packageName);
getApplicationRestrictionsForUser(in String packageName, int userId)102     Bundle getApplicationRestrictionsForUser(in String packageName, int userId);
setDefaultGuestRestrictions(in Bundle restrictions)103     void setDefaultGuestRestrictions(in Bundle restrictions);
getDefaultGuestRestrictions()104     Bundle getDefaultGuestRestrictions();
removeUserWhenPossible(int userId, boolean overrideDevicePolicy)105     int removeUserWhenPossible(int userId, boolean overrideDevicePolicy);
markGuestForDeletion(int userId)106     boolean markGuestForDeletion(int userId);
getGuestUsers()107     List<UserInfo> getGuestUsers();
isQuietModeEnabled(int userId)108     boolean isQuietModeEnabled(int userId);
createUserWithAttributes(in String userName, in String userType, int flags, in Bitmap userIcon, in String accountName, in String accountType, in PersistableBundle accountOptions)109     UserHandle createUserWithAttributes(in String userName, in String userType, int flags,
110             in Bitmap userIcon,
111             in String accountName, in String accountType, in PersistableBundle accountOptions);
setSeedAccountData(int userId, in String accountName, in String accountType, in PersistableBundle accountOptions, boolean persist)112     void setSeedAccountData(int userId, in String accountName,
113             in String accountType, in PersistableBundle accountOptions, boolean persist);
getSeedAccountName(int userId)114     String getSeedAccountName(int userId);
getSeedAccountType(int userId)115     String getSeedAccountType(int userId);
getSeedAccountOptions(int userId)116     PersistableBundle getSeedAccountOptions(int userId);
clearSeedAccountData(int userId)117     void clearSeedAccountData(int userId);
someUserHasSeedAccount(in String accountName, in String accountType)118     boolean someUserHasSeedAccount(in String accountName, in String accountType);
someUserHasAccount(in String accountName, in String accountType)119     boolean someUserHasAccount(in String accountName, in String accountType);
getProfileType(int userId)120     String getProfileType(int userId);
isDemoUser(int userId)121     boolean isDemoUser(int userId);
isAdminUser(int userId)122     boolean isAdminUser(int userId);
isPreCreated(int userId)123     boolean isPreCreated(int userId);
createProfileForUserEvenWhenDisallowedWithThrow(in String name, in String userType, int flags, int userId, in String[] disallowedPackages)124     UserInfo createProfileForUserEvenWhenDisallowedWithThrow(in String name, in String userType, int flags,
125             int userId, in String[] disallowedPackages);
isUserUnlockingOrUnlocked(int userId)126     boolean isUserUnlockingOrUnlocked(int userId);
getUserIconBadgeResId(int userId)127     int getUserIconBadgeResId(int userId);
getUserBadgeResId(int userId)128     int getUserBadgeResId(int userId);
getUserBadgeNoBackgroundResId(int userId)129     int getUserBadgeNoBackgroundResId(int userId);
getUserBadgeLabelResId(int userId)130     int getUserBadgeLabelResId(int userId);
getUserBadgeColorResId(int userId)131     int getUserBadgeColorResId(int userId);
getUserBadgeDarkColorResId(int userId)132     int getUserBadgeDarkColorResId(int userId);
getUserStatusBarIconResId(int userId)133     int getUserStatusBarIconResId(int userId);
hasBadge(int userId)134     boolean hasBadge(int userId);
getProfileLabelResId(int userId)135     int getProfileLabelResId(int userId);
getProfileAccessibilityLabelResId(int userId)136     int getProfileAccessibilityLabelResId(int userId);
isUserUnlocked(int userId)137     boolean isUserUnlocked(int userId);
isUserRunning(int userId)138     boolean isUserRunning(int userId);
isUserForeground(int userId)139     boolean isUserForeground(int userId);
isUserVisible(int userId)140     boolean isUserVisible(int userId);
getVisibleUsers()141     int[] getVisibleUsers();
getMainDisplayIdAssignedToUser()142     int getMainDisplayIdAssignedToUser();
isForegroundUserAdmin()143     boolean isForegroundUserAdmin();
isUserNameSet(int userId)144     boolean isUserNameSet(int userId);
hasRestrictedProfiles(int userId)145     boolean hasRestrictedProfiles(int userId);
requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags)146     boolean requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags);
getUserName()147     String getUserName();
getUserStartRealtime()148     long getUserStartRealtime();
getUserUnlockRealtime()149     long getUserUnlockRealtime();
setUserEphemeral(int userId, boolean enableEphemeral)150     boolean setUserEphemeral(int userId, boolean enableEphemeral);
151     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS})")
setBootUser(int userId)152     void setBootUser(int userId);
153     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS})")
getBootUser()154     int getBootUser();
getProfileIdsExcludingHidden(int userId, boolean enabledOnly)155     int[] getProfileIdsExcludingHidden(int userId, boolean enabledOnly);
156 }
157