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();
getPreviousFullUserToEnterForeground()63     int getPreviousFullUserToEnterForeground();
getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated)64     List<UserInfo> getUsers(boolean excludePartial, boolean excludeDying, boolean excludePreCreated);
getProfiles(int userId, boolean enabledOnly)65     List<UserInfo> getProfiles(int userId, boolean enabledOnly);
getProfileIds(int userId, boolean enabledOnly)66     int[] getProfileIds(int userId, boolean enabledOnly);
isUserTypeEnabled(in String userType)67     boolean isUserTypeEnabled(in String userType);
canAddMoreUsersOfType(in String userType)68     boolean canAddMoreUsersOfType(in String userType);
getRemainingCreatableUserCount(in String userType)69     int getRemainingCreatableUserCount(in String userType);
getRemainingCreatableProfileCount(in String userType, int userId)70     int getRemainingCreatableProfileCount(in String userType, int userId);
canAddMoreProfilesToUser(in String userType, int userId, boolean allowedToRemoveOne)71     boolean canAddMoreProfilesToUser(in String userType, int userId, boolean allowedToRemoveOne);
canAddMoreManagedProfiles(int userId, boolean allowedToRemoveOne)72     boolean canAddMoreManagedProfiles(int userId, boolean allowedToRemoveOne);
getProfileParent(int userId)73     UserInfo getProfileParent(int userId);
isSameProfileGroup(int userId, int otherUserHandle)74     boolean isSameProfileGroup(int userId, int otherUserHandle);
isHeadlessSystemUserMode()75     boolean isHeadlessSystemUserMode();
isUserOfType(int userId, in String userType)76     boolean isUserOfType(int userId, in String userType);
77     @UnsupportedAppUsage
getUserInfo(int userId)78     UserInfo getUserInfo(int userId);
getUserPropertiesCopy(int userId)79     UserProperties getUserPropertiesCopy(int userId);
getUserAccount(int userId)80     String getUserAccount(int userId);
setUserAccount(int userId, String accountName)81     void setUserAccount(int userId, String accountName);
getUserCreationTime(int userId)82     long getUserCreationTime(int userId);
getUserSwitchability(int userId)83     int getUserSwitchability(int userId);
isUserSwitcherEnabled(boolean showEvenIfNotActionable, int mUserId)84     boolean isUserSwitcherEnabled(boolean showEvenIfNotActionable, int mUserId);
isRestricted(int userId)85     boolean isRestricted(int userId);
canHaveRestrictedProfile(int userId)86     boolean canHaveRestrictedProfile(int userId);
getUserSerialNumber(int userId)87     int getUserSerialNumber(int userId);
getUserHandle(int userSerialNumber)88     int getUserHandle(int userSerialNumber);
getUserRestrictionSource(String restrictionKey, int userId)89     int getUserRestrictionSource(String restrictionKey, int userId);
getUserRestrictionSources(String restrictionKey, int userId)90     List<UserManager.EnforcingUser> getUserRestrictionSources(String restrictionKey, int userId);
getUserRestrictions(int userId)91     Bundle getUserRestrictions(int userId);
hasBaseUserRestriction(String restrictionKey, int userId)92     boolean hasBaseUserRestriction(String restrictionKey, int userId);
hasUserRestriction(in String restrictionKey, int userId)93     boolean hasUserRestriction(in String restrictionKey, int userId);
hasUserRestrictionOnAnyUser(in String restrictionKey)94     boolean hasUserRestrictionOnAnyUser(in String restrictionKey);
isSettingRestrictedForUser(in String setting, int userId, in String value, int callingUid)95     boolean isSettingRestrictedForUser(in String setting, int userId, in String value, int callingUid);
addUserRestrictionsListener(IUserRestrictionsListener listener)96     void addUserRestrictionsListener(IUserRestrictionsListener listener);
setUserRestriction(String key, boolean value, int userId)97     void setUserRestriction(String key, boolean value, int userId);
setApplicationRestrictions(in String packageName, in Bundle restrictions, int userId)98     void setApplicationRestrictions(in String packageName, in Bundle restrictions, int userId);
getApplicationRestrictions(in String packageName)99     Bundle getApplicationRestrictions(in String packageName);
getApplicationRestrictionsForUser(in String packageName, int userId)100     Bundle getApplicationRestrictionsForUser(in String packageName, int userId);
setDefaultGuestRestrictions(in Bundle restrictions)101     void setDefaultGuestRestrictions(in Bundle restrictions);
getDefaultGuestRestrictions()102     Bundle getDefaultGuestRestrictions();
removeUserWhenPossible(int userId, boolean overrideDevicePolicy)103     int removeUserWhenPossible(int userId, boolean overrideDevicePolicy);
markGuestForDeletion(int userId)104     boolean markGuestForDeletion(int userId);
getGuestUsers()105     List<UserInfo> getGuestUsers();
isQuietModeEnabled(int userId)106     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)107     UserHandle createUserWithAttributes(in String userName, in String userType, int flags,
108             in Bitmap userIcon,
109             in String accountName, in String accountType, in PersistableBundle accountOptions);
setSeedAccountData(int userId, in String accountName, in String accountType, in PersistableBundle accountOptions, boolean persist)110     void setSeedAccountData(int userId, in String accountName,
111             in String accountType, in PersistableBundle accountOptions, boolean persist);
getSeedAccountName(int userId)112     String getSeedAccountName(int userId);
getSeedAccountType(int userId)113     String getSeedAccountType(int userId);
getSeedAccountOptions(int userId)114     PersistableBundle getSeedAccountOptions(int userId);
clearSeedAccountData(int userId)115     void clearSeedAccountData(int userId);
someUserHasSeedAccount(in String accountName, in String accountType)116     boolean someUserHasSeedAccount(in String accountName, in String accountType);
someUserHasAccount(in String accountName, in String accountType)117     boolean someUserHasAccount(in String accountName, in String accountType);
getProfileType(int userId)118     String getProfileType(int userId);
isDemoUser(int userId)119     boolean isDemoUser(int userId);
isAdminUser(int userId)120     boolean isAdminUser(int userId);
isPreCreated(int userId)121     boolean isPreCreated(int userId);
createProfileForUserEvenWhenDisallowedWithThrow(in String name, in String userType, int flags, int userId, in String[] disallowedPackages)122     UserInfo createProfileForUserEvenWhenDisallowedWithThrow(in String name, in String userType, int flags,
123             int userId, in String[] disallowedPackages);
isUserUnlockingOrUnlocked(int userId)124     boolean isUserUnlockingOrUnlocked(int userId);
getUserIconBadgeResId(int userId)125     int getUserIconBadgeResId(int userId);
getUserBadgeResId(int userId)126     int getUserBadgeResId(int userId);
getUserBadgeNoBackgroundResId(int userId)127     int getUserBadgeNoBackgroundResId(int userId);
getUserBadgeLabelResId(int userId)128     int getUserBadgeLabelResId(int userId);
getUserBadgeColorResId(int userId)129     int getUserBadgeColorResId(int userId);
getUserBadgeDarkColorResId(int userId)130     int getUserBadgeDarkColorResId(int userId);
hasBadge(int userId)131     boolean hasBadge(int userId);
isUserUnlocked(int userId)132     boolean isUserUnlocked(int userId);
isUserRunning(int userId)133     boolean isUserRunning(int userId);
isUserForeground(int userId)134     boolean isUserForeground(int userId);
isUserVisible(int userId)135     boolean isUserVisible(int userId);
getVisibleUsers()136     int[] getVisibleUsers();
getMainDisplayIdAssignedToUser()137     int getMainDisplayIdAssignedToUser();
isUserNameSet(int userId)138     boolean isUserNameSet(int userId);
hasRestrictedProfiles(int userId)139     boolean hasRestrictedProfiles(int userId);
requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags)140     boolean requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags);
getUserName()141     String getUserName();
getUserStartRealtime()142     long getUserStartRealtime();
getUserUnlockRealtime()143     long getUserUnlockRealtime();
setUserEphemeral(int userId, boolean enableEphemeral)144     boolean setUserEphemeral(int userId, boolean enableEphemeral);
145     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS})")
setBootUser(int userId)146     void setBootUser(int userId);
147     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS})")
getBootUser()148     int getBootUser();
149 }
150