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); 86 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.MANAGE_USERS)") getUserLogoutability(int userId)87 int getUserLogoutability(int userId); isRestricted(int userId)88 boolean isRestricted(int userId); canHaveRestrictedProfile(int userId)89 boolean canHaveRestrictedProfile(int userId); canAddPrivateProfile(int userId)90 boolean canAddPrivateProfile(int userId); getUserSerialNumber(int userId)91 int getUserSerialNumber(int userId); getUserHandle(int userSerialNumber)92 int getUserHandle(int userSerialNumber); getUserRestrictionSource(String restrictionKey, int userId)93 int getUserRestrictionSource(String restrictionKey, int userId); getUserRestrictionSources(String restrictionKey, int userId)94 List<UserManager.EnforcingUser> getUserRestrictionSources(String restrictionKey, int userId); getUserRestrictions(int userId)95 Bundle getUserRestrictions(int userId); hasBaseUserRestriction(String restrictionKey, int userId)96 boolean hasBaseUserRestriction(String restrictionKey, int userId); hasUserRestriction(in String restrictionKey, int userId)97 boolean hasUserRestriction(in String restrictionKey, int userId); hasUserRestrictionOnAnyUser(in String restrictionKey)98 boolean hasUserRestrictionOnAnyUser(in String restrictionKey); isSettingRestrictedForUser(in String setting, int userId, in String value, int callingUid)99 boolean isSettingRestrictedForUser(in String setting, int userId, in String value, int callingUid); addUserRestrictionsListener(IUserRestrictionsListener listener)100 void addUserRestrictionsListener(IUserRestrictionsListener listener); setUserRestriction(String key, boolean value, int userId)101 void setUserRestriction(String key, boolean value, int userId); setApplicationRestrictions(in String packageName, in Bundle restrictions, int userId)102 void setApplicationRestrictions(in String packageName, in Bundle restrictions, int userId); getApplicationRestrictions(in String packageName)103 Bundle getApplicationRestrictions(in String packageName); getApplicationRestrictionsForUser(in String packageName, int userId)104 Bundle getApplicationRestrictionsForUser(in String packageName, int userId); setDefaultGuestRestrictions(in Bundle restrictions)105 void setDefaultGuestRestrictions(in Bundle restrictions); getDefaultGuestRestrictions()106 Bundle getDefaultGuestRestrictions(); removeUserWhenPossible(int userId, boolean overrideDevicePolicy)107 int removeUserWhenPossible(int userId, boolean overrideDevicePolicy); markGuestForDeletion(int userId)108 boolean markGuestForDeletion(int userId); getGuestUsers()109 List<UserInfo> getGuestUsers(); isQuietModeEnabled(int userId)110 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)111 UserHandle createUserWithAttributes(in String userName, in String userType, int flags, 112 in Bitmap userIcon, 113 in String accountName, in String accountType, in PersistableBundle accountOptions); setSeedAccountData(int userId, in String accountName, in String accountType, in PersistableBundle accountOptions, boolean persist)114 void setSeedAccountData(int userId, in String accountName, 115 in String accountType, in PersistableBundle accountOptions, boolean persist); getSeedAccountName(int userId)116 String getSeedAccountName(int userId); getSeedAccountType(int userId)117 String getSeedAccountType(int userId); getSeedAccountOptions(int userId)118 PersistableBundle getSeedAccountOptions(int userId); clearSeedAccountData(int userId)119 void clearSeedAccountData(int userId); someUserHasSeedAccount(in String accountName, in String accountType)120 boolean someUserHasSeedAccount(in String accountName, in String accountType); someUserHasAccount(in String accountName, in String accountType)121 boolean someUserHasAccount(in String accountName, in String accountType); getProfileType(int userId)122 String getProfileType(int userId); isDemoUser(int userId)123 boolean isDemoUser(int userId); isAdminUser(int userId)124 boolean isAdminUser(int userId); isPreCreated(int userId)125 boolean isPreCreated(int userId); createProfileForUserEvenWhenDisallowedWithThrow(in String name, in String userType, int flags, int userId, in String[] disallowedPackages)126 UserInfo createProfileForUserEvenWhenDisallowedWithThrow(in String name, in String userType, int flags, 127 int userId, in String[] disallowedPackages); isUserUnlockingOrUnlocked(int userId)128 boolean isUserUnlockingOrUnlocked(int userId); getUserIconBadgeResId(int userId)129 int getUserIconBadgeResId(int userId); getUserBadgeResId(int userId)130 int getUserBadgeResId(int userId); getUserBadgeNoBackgroundResId(int userId)131 int getUserBadgeNoBackgroundResId(int userId); getUserBadgeLabelResId(int userId)132 int getUserBadgeLabelResId(int userId); getUserBadgeColorResId(int userId)133 int getUserBadgeColorResId(int userId); getUserBadgeDarkColorResId(int userId)134 int getUserBadgeDarkColorResId(int userId); getUserStatusBarIconResId(int userId)135 int getUserStatusBarIconResId(int userId); hasBadge(int userId)136 boolean hasBadge(int userId); getProfileLabelResId(int userId)137 int getProfileLabelResId(int userId); getProfileAccessibilityLabelResId(int userId)138 int getProfileAccessibilityLabelResId(int userId); isUserUnlocked(int userId)139 boolean isUserUnlocked(int userId); isUserRunning(int userId)140 boolean isUserRunning(int userId); isUserForeground(int userId)141 boolean isUserForeground(int userId); isUserVisible(int userId)142 boolean isUserVisible(int userId); getVisibleUsers()143 int[] getVisibleUsers(); getMainDisplayIdAssignedToUser(int userId)144 int getMainDisplayIdAssignedToUser(int userId); isForegroundUserAdmin()145 boolean isForegroundUserAdmin(); isUserNameSet(int userId)146 boolean isUserNameSet(int userId); hasRestrictedProfiles(int userId)147 boolean hasRestrictedProfiles(int userId); requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags)148 boolean requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags); getUserName()149 String getUserName(); getUserStartRealtime()150 long getUserStartRealtime(); getUserUnlockRealtime()151 long getUserUnlockRealtime(); setUserEphemeral(int userId, boolean enableEphemeral)152 boolean setUserEphemeral(int userId, boolean enableEphemeral); 153 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS})") setBootUser(int userId)154 void setBootUser(int userId); 155 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS})") getBootUser()156 int getBootUser(); getProfileIdsExcludingHidden(int userId, boolean enabledOnly)157 int[] getProfileIdsExcludingHidden(int userId, boolean enabledOnly); 158 } 159