public class UserManagerService
extends IUserManager.Stub
UserManager
.
Method naming convention:
mPackagesLock
lock.
mRestrictionsLock
lock.
mUsersLock
lock.
Modifier and Type | Class and Description |
---|---|
static class |
UserManagerService.LifeCycle |
Modifier and Type | Method and Description |
---|---|
boolean |
canAddMoreManagedProfiles(int userId,
boolean allowedToRemoveOne) |
boolean |
canHaveRestrictedProfile(int userId) |
void |
clearSeedAccountData() |
UserInfo |
createProfileForUser(String name,
int flags,
int userId) |
UserInfo |
createRestrictedProfile(String name,
int parentUserId) |
UserInfo |
createUser(String name,
int flags) |
protected void |
dump(FileDescriptor fd,
PrintWriter pw,
String[] args) |
static void |
enforceSerialNumber(File file,
int serialNumber)
Enforce that serial number stored in user directory inode matches the
given expected value.
|
boolean |
exists(int userId)
Called by PackageManagerService
|
Bundle |
getApplicationRestrictions(String packageName) |
Bundle |
getApplicationRestrictionsForUser(String packageName,
int userId) |
int |
getCredentialOwnerProfile(int userHandle) |
Bundle |
getDefaultGuestRestrictions() |
static UserManagerService |
getInstance() |
UserInfo |
getPrimaryUser() |
int[] |
getProfileIds(int userId,
boolean enabledOnly) |
UserInfo |
getProfileParent(int userHandle) |
List<UserInfo> |
getProfiles(int userId,
boolean enabledOnly) |
String |
getSeedAccountName() |
PersistableBundle |
getSeedAccountOptions() |
String |
getSeedAccountType() |
String |
getUserAccount(int userId) |
long |
getUserCreationTime(int userHandle) |
int |
getUserHandle(int userSerialNumber) |
ParcelFileDescriptor |
getUserIcon(int targetUserId) |
int[] |
getUserIds()
Returns an array of user ids.
|
UserInfo |
getUserInfo(int userId) |
Bundle |
getUserRestrictions(int userId) |
int |
getUserRestrictionSource(String restrictionKey,
int userId) |
List<UserInfo> |
getUsers(boolean excludeDying) |
int |
getUserSerialNumber(int userHandle) |
boolean |
hasBaseUserRestriction(String restrictionKey,
int userId) |
boolean |
hasUserRestriction(String restrictionKey,
int userId) |
boolean |
isDemoUser(int userId) |
boolean |
isManagedProfile(int userId) |
boolean |
isQuietModeEnabled(int userHandle) |
boolean |
isRestricted() |
boolean |
isSameProfileGroup(int userId,
int otherUserId) |
void |
makeInitialized(int userId) |
boolean |
markGuestForDeletion(int userHandle)
Mark this guest user for deletion to allow us to create another guest
and switch to that user before actually removing this guest.
|
void |
onBeforeStartUser(int userId)
Called right before a user is started.
|
void |
onBeforeUnlockUser(int userId)
Called right before a user is unlocked.
|
void |
onShellCommand(FileDescriptor in,
FileDescriptor out,
FileDescriptor err,
String[] args,
ResultReceiver resultReceiver) |
void |
onUserLoggedIn(int userId)
Make a note of the last started time of a user and do some cleanup.
|
boolean |
removeUser(int userHandle)
Removes a user and all data directories created for that user.
|
void |
setApplicationRestrictions(String packageName,
Bundle restrictions,
int userId) |
void |
setDefaultGuestRestrictions(Bundle restrictions) |
void |
setQuietModeEnabled(int userHandle,
boolean enableQuietMode) |
void |
setSeedAccountData(int userId,
String accountName,
String accountType,
PersistableBundle accountOptions,
boolean persist) |
void |
setUserAccount(int userId,
String accountName) |
void |
setUserEnabled(int userId) |
void |
setUserIcon(int userId,
Bitmap bitmap) |
void |
setUserName(int userId,
String name) |
void |
setUserRestriction(String key,
boolean value,
int userId) |
boolean |
someUserHasSeedAccount(String accountName,
String accountType) |
boolean |
trySetQuietModeDisabled(int userHandle,
IntentSender target) |
public static UserManagerService getInstance()
public String getUserAccount(int userId)
public void setUserAccount(int userId, String accountName)
public UserInfo getPrimaryUser()
public int[] getProfileIds(int userId, boolean enabledOnly)
public int getCredentialOwnerProfile(int userHandle)
public boolean isSameProfileGroup(int userId, int otherUserId)
public UserInfo getProfileParent(int userHandle)
public void setQuietModeEnabled(int userHandle, boolean enableQuietMode)
public boolean isQuietModeEnabled(int userHandle)
public boolean trySetQuietModeDisabled(int userHandle, IntentSender target)
public void setUserEnabled(int userId)
public UserInfo getUserInfo(int userId)
public boolean isManagedProfile(int userId)
public boolean isDemoUser(int userId)
public boolean isRestricted()
public boolean canHaveRestrictedProfile(int userId)
public boolean exists(int userId)
public void setUserName(int userId, String name)
public void setUserIcon(int userId, Bitmap bitmap)
public ParcelFileDescriptor getUserIcon(int targetUserId)
public void makeInitialized(int userId)
public Bundle getDefaultGuestRestrictions()
public void setDefaultGuestRestrictions(Bundle restrictions)
public boolean hasUserRestriction(String restrictionKey, int userId)
public int getUserRestrictionSource(String restrictionKey, int userId)
restrictionKey
- the string key representing the restrictionuserId
- the id of the user for whom to retrieve the restrictions.UserManager.RESTRICTION_NOT_SET
,
UserManager.RESTRICTION_SOURCE_SYSTEM
,
UserManager.RESTRICTION_SOURCE_DEVICE_OWNER
and UserManager.RESTRICTION_SOURCE_PROFILE_OWNER
public Bundle getUserRestrictions(int userId)
Bundle
.public boolean hasBaseUserRestriction(String restrictionKey, int userId)
public void setUserRestriction(String key, boolean value, int userId)
public boolean canAddMoreManagedProfiles(int userId, boolean allowedToRemoveOne)
public int[] getUserIds()
public boolean markGuestForDeletion(int userHandle)
userHandle
- the userid of the current guestpublic boolean removeUser(int userHandle)
userHandle
- the user's idpublic Bundle getApplicationRestrictionsForUser(String packageName, int userId)
public void setApplicationRestrictions(String packageName, Bundle restrictions, int userId)
public int getUserSerialNumber(int userHandle)
public int getUserHandle(int userSerialNumber)
public long getUserCreationTime(int userHandle)
public void onBeforeStartUser(int userId)
public void onBeforeUnlockUser(int userId)
public void onUserLoggedIn(int userId)
userId
- the user that was just foregroundedpublic static void enforceSerialNumber(File file, int serialNumber) throws IOException
IOException
- when problem extracting serial number, or serial
number is mismatched.public void setSeedAccountData(int userId, String accountName, String accountType, PersistableBundle accountOptions, boolean persist)
public String getSeedAccountName() throws RemoteException
RemoteException
public String getSeedAccountType() throws RemoteException
RemoteException
public PersistableBundle getSeedAccountOptions() throws RemoteException
RemoteException
public void clearSeedAccountData() throws RemoteException
RemoteException
public boolean someUserHasSeedAccount(String accountName, String accountType) throws RemoteException
RemoteException
public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err, String[] args, ResultReceiver resultReceiver)
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args)