java.lang.Object | |
↳ | android.os.UserManager |
Manages users and user details on a multi-user system.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DISALLOW_ADD_USER | Specifies if a user is disallowed from adding new users and profiles. | |||||||||
String | DISALLOW_ADJUST_VOLUME | Specifies if a user is disallowed from adjusting the master volume. | |||||||||
String | DISALLOW_APPS_CONTROL | Specifies if a user is disallowed from modifying applications in Settings or launchers. | |||||||||
String | DISALLOW_CONFIG_BLUETOOTH | Specifies if a user is disallowed from configuring bluetooth. | |||||||||
String | DISALLOW_CONFIG_CELL_BROADCASTS | Specifies if a user is disallowed from configuring cell broadcasts. | |||||||||
String | DISALLOW_CONFIG_CREDENTIALS | Specifies if a user is disallowed from configuring user credentials. | |||||||||
String | DISALLOW_CONFIG_MOBILE_NETWORKS | Specifies if a user is disallowed from configuring mobile networks. | |||||||||
String | DISALLOW_CONFIG_TETHERING | Specifies if a user is disallowed from configuring Tethering & portable hotspots. | |||||||||
String | DISALLOW_CONFIG_VPN | Specifies if a user is disallowed from configuring VPN. | |||||||||
String | DISALLOW_CONFIG_WIFI | Specifies if a user is disallowed from changing Wi-Fi access points. | |||||||||
String | DISALLOW_CREATE_WINDOWS | Specifies that windows besides app windows should not be created. | |||||||||
String | DISALLOW_CROSS_PROFILE_COPY_PASTE | Specifies if what is copied in the clipboard of this profile can be pasted in related profiles. | |||||||||
String | DISALLOW_DEBUGGING_FEATURES | Specifies if a user is disallowed from enabling or accessing debugging features. | |||||||||
String | DISALLOW_FACTORY_RESET | Specifies if a user is disallowed from factory resetting from Settings. | |||||||||
String | DISALLOW_INSTALL_APPS | Specifies if a user is disallowed from installing applications. | |||||||||
String | DISALLOW_INSTALL_UNKNOWN_SOURCES | Specifies if a user is disallowed from enabling the "Unknown Sources" setting, that allows installation of apps from unknown sources. | |||||||||
String | DISALLOW_MODIFY_ACCOUNTS | Specifies if a user is disallowed from adding and removing accounts. | |||||||||
String | DISALLOW_MOUNT_PHYSICAL_MEDIA | Specifies if a user is disallowed from mounting physical external media. | |||||||||
String | DISALLOW_OUTGOING_CALLS | Specifies that the user is not allowed to make outgoing phone calls. | |||||||||
String | DISALLOW_REMOVE_USER | Specifies if a user is disallowed from removing itself and other users. | |||||||||
String | DISALLOW_SHARE_LOCATION | Specifies if a user is disallowed from toggling location sharing. | |||||||||
String | DISALLOW_SMS | Specifies that the user is not allowed to send or receive SMS messages. | |||||||||
String | DISALLOW_UNINSTALL_APPS | Specifies if a user is disallowed from uninstalling applications. | |||||||||
String | DISALLOW_UNMUTE_MICROPHONE | Specifies if a user is disallowed from adjusting microphone volume. | |||||||||
String | DISALLOW_USB_FILE_TRANSFER | Specifies if a user is disallowed from transferring files over USB. | |||||||||
String | ENSURE_VERIFY_APPS | Specifies if a user is disallowed from disabling application verification. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a Bundle containing any saved application restrictions for this user, for the
given package name.
| |||||||||||
Return the serial number for a user.
| |||||||||||
Return the number of users currently created on the device.
| |||||||||||
Return the user associated with a serial number previously
returned by
getSerialNumberForUser(UserHandle) .
| |||||||||||
Returns the user name of the user making this call.
| |||||||||||
Returns a list of UserHandles for profiles associated with the user that the calling process
is running on, including the user itself.
| |||||||||||
Returns the user-wide restrictions imposed on this user.
| |||||||||||
Returns the user-wide restrictions imposed on the user specified by
userHandle .
| |||||||||||
Returns whether the current user has been disallowed from performing certain actions
or setting certain settings.
| |||||||||||
Used to determine whether the user making this call is subject to
teleportations.
| |||||||||||
Return whether the given user is actively running.
| |||||||||||
Return whether the given user is actively running or stopping.
| |||||||||||
Sets a new challenge PIN for restrictions.
| |||||||||||
This method was deprecated
in API level 21.
use
addUserRestriction(android.content.ComponentName, String) or
clearUserRestriction(android.content.ComponentName, String) instead.
| |||||||||||
This method was deprecated
in API level 21.
use
addUserRestriction(android.content.ComponentName, String) or
clearUserRestriction(android.content.ComponentName, String) instead.
| |||||||||||
This method was deprecated
in API level 21.
use
addUserRestriction(android.content.ComponentName, String) or
clearUserRestriction(android.content.ComponentName, String) instead.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Specifies if a user is disallowed from adding new users and
profiles. This can only be set by device owners and profile owners on the primary user.
The default value is false
.
Specifies if a user is disallowed from adjusting the master
volume. If set, the master volume will be muted. This can only be set by device owners
and profile owners on the primary user. The default value is false
.
Specifies if a user is disallowed from modifying applications in Settings or launchers. The following actions will not be allowed when this restriction is enabled:
The default value is false
.
Specifies if a user is disallowed from configuring bluetooth.
The default value is false
.
Specifies if a user is disallowed from configuring cell
broadcasts. This can only be set by device owners and profile owners on the primary user.
The default value is false
.
Specifies if a user is disallowed from configuring user
credentials. The default value is false
.
Specifies if a user is disallowed from configuring mobile
networks. This can only be set by device owners and profile owners on the primary user.
The default value is false
.
Specifies if a user is disallowed from configuring Tethering
& portable hotspots. This can only be set by device owners and profile owners on the
primary user. The default value is false
.
Specifies if a user is disallowed from configuring VPN.
The default value is false
.
Specifies if a user is disallowed from changing Wi-Fi
access points. The default value is false
.
Specifies that windows besides app windows should not be created. This will block the creation of the following types of windows.
TYPE_TOAST
TYPE_PHONE
TYPE_PRIORITY_PHONE
TYPE_SYSTEM_ALERT
TYPE_SYSTEM_ERROR
TYPE_SYSTEM_OVERLAY
This can only be set by device owners and profile owners on the primary user.
The default value is false
.
Specifies if what is copied in the clipboard of this profile can
be pasted in related profiles. Does not restrict if the clipboard of related profiles can be
pasted in this profile.
The default value is false
.
Specifies if a user is disallowed from enabling or
accessing debugging features. The default value is false
.
Specifies if a user is disallowed from factory resetting
from Settings. This can only be set by device owners and profile owners on the primary user.
The default value is false
.
Specifies if a user is disallowed from installing applications.
The default value is false
.
Specifies if a user is disallowed from enabling the
"Unknown Sources" setting, that allows installation of apps from unknown sources.
The default value is false
.
Specifies if a user is disallowed from adding and removing accounts.
The default value is false
.
Specifies if a user is disallowed from mounting
physical external media. This can only be set by device owners and profile owners on the
primary user. The default value is false
.
Specifies that the user is not allowed to make outgoing
phone calls. Emergency calls are still permitted.
The default value is false
.
Specifies if a user is disallowed from removing itself and other
users. The default value is false
.
Specifies if a user is disallowed from toggling location sharing.
The default value is false
.
Specifies that the user is not allowed to send or receive
SMS messages. The default value is false
.
Specifies if a user is disallowed from uninstalling applications.
The default value is false
.
Specifies if a user is disallowed from adjusting microphone
volume. If set, the microphone will be muted. This can only be set by device owners
and profile owners on the primary user. The default value is false
.
Specifies if a user is disallowed from transferring files over
USB. This can only be set by device owners and profile owners on the primary user.
The default value is false
.
Specifies if a user is disallowed from disabling application
verification. The default value is false
.
Returns a Bundle containing any saved application restrictions for this user, for the given package name. Only an application with this package name can call this method.
packageName | the package name of the calling application |
---|
Return the serial number for a user. This is a device-unique number assigned to that user; if the user is deleted and then a new user created, the new users will not be given the same serial number.
user | The user whose serial number is to be retrieved. |
---|
Return the number of users currently created on the device.
Return the user associated with a serial number previously
returned by getSerialNumberForUser(UserHandle)
.
serialNumber | The serial number of the user that is being retrieved. |
---|
Returns the user name of the user making this call. This call is only available to applications on the system image; it requires the MANAGE_USERS permission.
Returns a list of UserHandles for profiles associated with the user that the calling process is running on, including the user itself.
Returns the user-wide restrictions imposed on this user.
Returns the user-wide restrictions imposed on the user specified by userHandle
.
userHandle | the UserHandle of the user for whom to retrieve the restrictions. |
---|
Returns whether the current user has been disallowed from performing certain actions or setting certain settings.
restrictionKey | The string key representing the restriction. |
---|
true
if the current user has the given restriction, false
otherwise.
Used to determine whether the user making this call is subject to teleportations.
As of LOLLIPOP
, this method can
now automatically identify goats using advanced goat recognition technology.
Return whether the given user is actively running. This means that the user is in the "started" state, not "stopped" -- it is currently allowed to run code through scheduled alarms, receiving broadcasts, etc. A started user may be either the current foreground user or a background user; the result here does not distinguish between the two.
user | The user to retrieve the running state for. |
---|
Return whether the given user is actively running or stopping.
This is like isUserRunning(UserHandle)
, but will also return
true if the user had been running but is in the process of being stopped
(but is not yet fully stopped, and still running some code).
user | The user to retrieve the running state for. |
---|
Sets a new challenge PIN for restrictions. This is only for use by pre-installed apps and requires the MANAGE_USERS permission.
newPin | the PIN to use for challenge dialogs. |
---|
This method was deprecated
in API level 21.
use addUserRestriction(android.content.ComponentName, String)
or
clearUserRestriction(android.content.ComponentName, String)
instead.
Sets the value of a specific restriction. Requires the MANAGE_USERS permission.
key | the key of the restriction |
---|---|
value | the value for the restriction |
This method was deprecated
in API level 21.
use addUserRestriction(android.content.ComponentName, String)
or
clearUserRestriction(android.content.ComponentName, String)
instead.
Sets all the user-wide restrictions for this user. Requires the MANAGE_USERS permission.
restrictions | the Bundle containing all the restrictions. |
---|
This method was deprecated
in API level 21.
use addUserRestriction(android.content.ComponentName, String)
or
clearUserRestriction(android.content.ComponentName, String)
instead.
Sets all the user-wide restrictions for the specified user. Requires the MANAGE_USERS permission.
restrictions | the Bundle containing all the restrictions. |
---|---|
userHandle | the UserHandle of the user for whom to set the restrictions. |