public
class
UserManager
extends Object
java.lang.Object | |
↳ | android.os.UserManager |
Manages users and user details on a multi-user system. There are two major categories of users: fully customizable users with their own login, and managed profiles that share a workspace with a related user.
Users are different from accounts, which are managed by
AccountManager
. Each user can have their own set of accounts.
See ACTION_PROVISION_MANAGED_PROFILE
for more on managed profiles.
Constants | |
---|---|
String |
ALLOW_PARENT_PROFILE_APP_LINKING
Allows apps in the parent profile to handle web links from the managed profile. |
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_DATA_ROAMING
Specifies if a user is not allowed to use cellular data when roaming. |
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_FUN
Specifies if the user is not allowed to have fun. |
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, unless they are
|
String |
DISALLOW_MOUNT_PHYSICAL_MEDIA
Specifies if a user is disallowed from mounting physical external media. |
String |
DISALLOW_NETWORK_RESET
Specifies if a user is disallowed from resetting network settings from Settings. |
String |
DISALLOW_OUTGOING_BEAM
Specifies if the user is not allowed to use NFC to beam out data from apps. |
String |
DISALLOW_OUTGOING_CALLS
Specifies that the user is not allowed to make outgoing phone calls. |
String |
DISALLOW_REMOVE_USER
When set on the primary user this specifies if the user can remove other users. |
String |
DISALLOW_SAFE_BOOT
Specifies if the user is not allowed to reboot the device into safe boot mode. |
String |
DISALLOW_SET_USER_ICON
Specifies if a user is not allowed to change their icon. |
String |
DISALLOW_SET_WALLPAPER
User restriction to disallow setting a wallpaper. |
String |
DISALLOW_SHARE_LOCATION
Specifies if a user is disallowed from turning on 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. |
String |
KEY_RESTRICTIONS_PENDING
Application restriction key that is used to indicate the pending arrival of real restrictions for the app. |
int |
USER_CREATION_FAILED_NOT_PERMITTED
Error result indicating that this user is not allowed to add other users on this device. |
int |
USER_CREATION_FAILED_NO_MORE_USERS
Error result indicating that no more users can be created on this device. |
Public methods | |
---|---|
static
Intent
|
createUserCreationIntent(String userName, String accountName, String accountType, PersistableBundle accountOptions)
Returns an intent to create a user for the provided name and account name. |
Bundle
|
getApplicationRestrictions(String packageName)
Returns a |
long
|
getSerialNumberForUser(UserHandle user)
Return the serial number for a user. |
int
|
getUserCount()
Return the number of users currently created on the device. |
long
|
getUserCreationTime(UserHandle userHandle)
Returns creation time of the user or of a managed profile associated with the calling user. |
UserHandle
|
getUserForSerialNumber(long serialNumber)
Return the user associated with a serial number previously
returned by |
String
|
getUserName()
Returns the user name of the user making this call. |
List<UserHandle>
|
getUserProfiles()
Returns a list of UserHandles for profiles associated with the user that the calling process is running on, including the user itself. |
Bundle
|
getUserRestrictions()
Returns the user-wide restrictions imposed on this user. |
Bundle
|
getUserRestrictions(UserHandle userHandle)
Returns the user-wide restrictions imposed on the user specified by |
boolean
|
hasUserRestriction(String restrictionKey)
Returns whether the current user has been disallowed from performing certain actions or setting certain settings. |
boolean
|
isQuietModeEnabled(UserHandle userHandle)
Returns whether the given profile is in quiet mode or not. |
boolean
|
isSystemUser()
Used to check if this process is running under the system user. |
boolean
|
isUserAGoat()
Used to determine whether the user making this call is subject to teleportations. |
boolean
|
isUserRunning(UserHandle user)
Return whether the given user is actively running. |
boolean
|
isUserRunningOrStopping(UserHandle user)
Return whether the given user is actively running or stopping. |
boolean
|
isUserUnlocked(UserHandle user)
Return whether the given user is running in an "unlocked" state. |
boolean
|
isUserUnlocked()
Return whether the calling user is running in an "unlocked" state. |
boolean
|
setRestrictionsChallenge(String newPin)
This method was deprecated in API level 23. The restrictions PIN functionality is no longer provided by the system. This method is preserved for backwards compatibility reasons and always returns false. |
void
|
setUserRestriction(String key, boolean value)
This method was deprecated
in API level 21.
use |
void
|
setUserRestrictions(Bundle restrictions, UserHandle userHandle)
This will no longer work. |
void
|
setUserRestrictions(Bundle restrictions)
This will no longer work. |
static
boolean
|
supportsMultipleUsers()
Returns whether this device supports multiple users with their own login and customizable space. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
String ALLOW_PARENT_PROFILE_APP_LINKING
Allows apps in the parent profile to handle web links from the managed profile.
This user restriction has an effect only in a managed profile.
If set:
Intent filters of activities in the parent profile with action
ACTION_VIEW
,
category CATEGORY_BROWSABLE
, scheme http or https, and which
define a host can handle intents from the managed profile.
The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "allow_parent_profile_app_linking"
String DISALLOW_ADD_USER
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
.
This restriction has no effect on secondary users and managed profiles since only the primary user can add other users.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_add_user"
String DISALLOW_ADJUST_VOLUME
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
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_adjust_volume"
String DISALLOW_APPS_CONTROL
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
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_control_apps"
String DISALLOW_CONFIG_BLUETOOTH
Specifies if a user is disallowed from configuring bluetooth.
This does not restrict the user from turning bluetooth on or off.
The default value is false
.
This restriction has no effect in a managed profile.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_config_bluetooth"
String DISALLOW_CONFIG_CELL_BROADCASTS
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
.
This restriction has no effect on secondary users and managed profiles since only the primary user can configure cell broadcasts.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_config_cell_broadcasts"
String DISALLOW_CONFIG_CREDENTIALS
Specifies if a user is disallowed from configuring user
credentials. The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_config_credentials"
String DISALLOW_CONFIG_MOBILE_NETWORKS
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
.
This restriction has no effect on secondary users and managed profiles since only the primary user can configure mobile networks.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_config_mobile_networks"
String DISALLOW_CONFIG_TETHERING
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
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_config_tethering"
String DISALLOW_CONFIG_VPN
Specifies if a user is disallowed from configuring VPN.
The default value is false
.
This restriction has an effect in a managed profile only from
M
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_config_vpn"
String DISALLOW_CONFIG_WIFI
Specifies if a user is disallowed from changing Wi-Fi
access points. The default value is false
.
This restriction has no effect in a managed profile.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_config_wifi"
String DISALLOW_CREATE_WINDOWS
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
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_create_windows"
String DISALLOW_CROSS_PROFILE_COPY_PASTE
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
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_cross_profile_copy_paste"
String DISALLOW_DATA_ROAMING
Specifies if a user is not allowed to use cellular data when roaming. This can only be set by
device owners. The default value is false
.
See also:
Constant Value: "no_data_roaming"
String DISALLOW_DEBUGGING_FEATURES
Specifies if a user is disallowed from enabling or
accessing debugging features. The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_debugging_features"
String DISALLOW_FACTORY_RESET
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
.
This restriction has no effect on secondary users and managed profiles since only the primary user can factory reset the device.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_factory_reset"
String DISALLOW_FUN
Specifies if the user is not allowed to have fun. In some cases, the
device owner may wish to prevent the user from experiencing amusement or
joy while using the device. The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_fun"
String DISALLOW_INSTALL_APPS
Specifies if a user is disallowed from installing applications.
The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_install_apps"
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.
The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_install_unknown_sources"
String DISALLOW_MODIFY_ACCOUNTS
Specifies if a user is disallowed from adding and removing accounts, unless they are
programmatically
added by
Authenticator.
The default value is false
.
From N
a profile or device owner app can still
use AccountManager
APIs to add or remove accounts when account
management is disallowed.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_modify_accounts"
String DISALLOW_MOUNT_PHYSICAL_MEDIA
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
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_physical_media"
String DISALLOW_NETWORK_RESET
Specifies if a user is disallowed from resetting network settings
from Settings. This can only be set by device owners and profile owners on the primary user.
The default value is false
.
This restriction has no effect on secondary users and managed profiles since only the primary user can reset the network settings of the device.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_network_reset"
String DISALLOW_OUTGOING_BEAM
Specifies if the user is not allowed to use NFC to beam out data from apps.
The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_outgoing_beam"
String DISALLOW_OUTGOING_CALLS
Specifies that the user is not allowed to make outgoing
phone calls. Emergency calls are still permitted.
The default value is false
.
This restriction has no effect on managed profiles.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_outgoing_calls"
String DISALLOW_REMOVE_USER
When set on the primary user this specifies if the user can remove other users.
When set on a secondary user, this specifies if the user can remove itself.
This restriction has no effect on managed profiles.
The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_remove_user"
String DISALLOW_SAFE_BOOT
Specifies if the user is not allowed to reboot the device into safe boot mode.
This can only be set by device owners and profile owners on the primary user.
The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_safe_boot"
String DISALLOW_SET_USER_ICON
Specifies if a user is not allowed to change their icon. Device owner and profile owner
can set this restriction. When it is set by device owner, only the target user will be
affected. The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_set_user_icon"
String DISALLOW_SET_WALLPAPER
User restriction to disallow setting a wallpaper. Profile owner and device owner
are able to set wallpaper regardless of this restriction.
The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_set_wallpaper"
String DISALLOW_SHARE_LOCATION
Specifies if a user is disallowed from turning on location sharing.
The default value is false
.
In a managed profile, location sharing always reflects the primary user's setting, but can be overridden and forced off by setting this restriction to true in the managed profile.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_share_location"
String DISALLOW_SMS
Specifies that the user is not allowed to send or receive
SMS messages. The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_sms"
String DISALLOW_UNINSTALL_APPS
Specifies if a user is disallowed from uninstalling applications.
The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_uninstall_apps"
String DISALLOW_UNMUTE_MICROPHONE
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
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_unmute_microphone"
String DISALLOW_USB_FILE_TRANSFER
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
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "no_usb_file_transfer"
String ENSURE_VERIFY_APPS
Specifies if a user is disallowed from disabling application
verification. The default value is false
.
Key for user restrictions.
Type: Boolean
See also:
Constant Value: "ensure_verify_apps"
String KEY_RESTRICTIONS_PENDING
Application restriction key that is used to indicate the pending arrival of real restrictions for the app.
Applications that support restrictions should check for the presence of this key.
A true
value indicates that restrictions may be applied in the near
future but are not available yet. It is the responsibility of any
management application that sets this flag to update it when the final
restrictions are enforced.
Key for application restrictions.
Type: Boolean
See also:
Constant Value: "restrictions_pending"
int USER_CREATION_FAILED_NOT_PERMITTED
Error result indicating that this user is not allowed to add other users on this device.
This is a result code returned from the activity created by the intent
createUserCreationIntent(String, String, String, PersistableBundle)
.
Constant Value: 1 (0x00000001)
int USER_CREATION_FAILED_NO_MORE_USERS
Error result indicating that no more users can be created on this device.
This is a result code returned from the activity created by the intent
createUserCreationIntent(String, String, String, PersistableBundle)
.
Constant Value: 2 (0x00000002)
Intent createUserCreationIntent (String userName, String accountName, String accountType, PersistableBundle accountOptions)
Returns an intent to create a user for the provided name and account name. The name and account name will be used when the setup process for the new user is started.
The intent should be launched using startActivityForResult and the return result will
indicate if the user consented to adding a new user and if the operation succeeded. Any
errors in creating the user will be returned in the result code. If the user cancels the
request, the return result will be RESULT_CANCELED
. On success, the
result code will be RESULT_OK
.
Use supportsMultipleUsers()
to first check if the device supports this operation
at all.
The new user is created but not initialized. After switching into the user for the first time, the preferred user name and account information are used by the setup process for that user.
Parameters | |
---|---|
userName |
String :
Optional name to assign to the user. |
accountName |
String :
Optional account name that will be used by the setup wizard to initialize
the user. |
accountType |
String :
Optional account type for the account to be created. This is required
if the account name is specified. |
accountOptions |
PersistableBundle :
Optional bundle of data to be passed in during account creation in the
new user via addAccount(String, String, String[], Bundle, android.app.Activity, android.accounts.AccountManagerCallback, Handler) . |
Returns | |
---|---|
Intent |
An Intent that can be launched from an Activity. |
Bundle getApplicationRestrictions (String packageName)
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.
The returned Bundle
consists of key-value pairs, as defined by the application,
where the types of values may be:
boolean
int
String
or String[]
M
, Bundle
or Bundle[]
Parameters | |
---|---|
packageName |
String :
the package name of the calling application |
Returns | |
---|---|
Bundle |
a Bundle with the restrictions for that package, or an empty Bundle
if there are no saved restrictions. |
See also:
long getSerialNumberForUser (UserHandle user)
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.
Parameters | |
---|---|
user |
UserHandle :
The user whose serial number is to be retrieved. |
Returns | |
---|---|
long |
The serial number of the given user; returns -1 if the given UserHandle does not exist. |
See also:
int getUserCount ()
Return the number of users currently created on the device.
Returns | |
---|---|
int |
long getUserCreationTime (UserHandle userHandle)
Returns creation time of the user or of a managed profile associated with the calling user.
Parameters | |
---|---|
userHandle |
UserHandle :
user handle of the user or a managed profile associated with the
calling user. |
Returns | |
---|---|
long |
creation time in milliseconds since Epoch time. |
UserHandle getUserForSerialNumber (long serialNumber)
Return the user associated with a serial number previously
returned by getSerialNumberForUser(UserHandle)
.
Parameters | |
---|---|
serialNumber |
long :
The serial number of the user that is being
retrieved. |
Returns | |
---|---|
UserHandle |
Return the user associated with the serial number, or null if there is not one. |
See also:
String getUserName ()
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 | |
---|---|
String |
the user name |
List<UserHandle> getUserProfiles ()
Returns a list of UserHandles for profiles associated with the user that the calling process is running on, including the user itself.
Returns | |
---|---|
List<UserHandle> |
A non-empty list of UserHandles associated with the calling user. |
Bundle getUserRestrictions ()
Returns the user-wide restrictions imposed on this user.
Returns | |
---|---|
Bundle |
a Bundle containing all the restrictions. |
Bundle getUserRestrictions (UserHandle userHandle)
Returns the user-wide restrictions imposed on the user specified by userHandle
.
Parameters | |
---|---|
userHandle |
UserHandle :
the UserHandle of the user for whom to retrieve the restrictions. |
Returns | |
---|---|
Bundle |
a Bundle containing all the restrictions. |
boolean hasUserRestriction (String restrictionKey)
Returns whether the current user has been disallowed from performing certain actions or setting certain settings.
Parameters | |
---|---|
restrictionKey |
String :
The string key representing the restriction. |
Returns | |
---|---|
boolean |
true if the current user has the given restriction, false otherwise.
|
boolean isQuietModeEnabled (UserHandle userHandle)
Returns whether the given profile is in quiet mode or not. Notes: Quiet mode is only supported for managed profiles.
Parameters | |
---|---|
userHandle |
UserHandle :
The user handle of the profile to be queried. |
Returns | |
---|---|
boolean |
true if the profile is in quiet mode, false otherwise. |
boolean isSystemUser ()
Used to check if this process is running under the system user. The system user is the initial user that is implicitly created on first boot and hosts most of the system services.
Returns | |
---|---|
boolean |
whether this process is running under the system user. |
boolean isUserAGoat ()
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.
Returns | |
---|---|
boolean |
Returns true if the user making this call is a goat. |
boolean isUserRunning (UserHandle user)
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.
Parameters | |
---|---|
user |
UserHandle :
The user to retrieve the running state for.
|
Returns | |
---|---|
boolean |
boolean isUserRunningOrStopping (UserHandle user)
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).
Parameters | |
---|---|
user |
UserHandle :
The user to retrieve the running state for.
|
Returns | |
---|---|
boolean |
boolean isUserUnlocked (UserHandle user)
Return whether the given user is running in an "unlocked" state.
On devices with direct boot, a user is unlocked only after they've entered their credentials (such as a lock pattern or PIN). On devices without direct boot, a user is unlocked as soon as it starts.
When a user is locked, only device-protected data storage is available. When a user is unlocked, both device-protected and credential-protected private app data storage is available.
Parameters | |
---|---|
user |
UserHandle :
to retrieve the unlocked state for. |
Returns | |
---|---|
boolean |
boolean isUserUnlocked ()
Return whether the calling user is running in an "unlocked" state.
On devices with direct boot, a user is unlocked only after they've entered their credentials (such as a lock pattern or PIN). On devices without direct boot, a user is unlocked as soon as it starts.
When a user is locked, only device-protected data storage is available. When a user is unlocked, both device-protected and credential-protected private app data storage is available.
Returns | |
---|---|
boolean |
boolean setRestrictionsChallenge (String newPin)
This method was deprecated
in API level 23.
The restrictions PIN functionality is no longer provided by the system.
This method is preserved for backwards compatibility reasons and always returns false.
Sets a new challenge PIN for restrictions. This is only for use by pre-installed apps and requires the MANAGE_USERS permission.
Parameters | |
---|---|
newPin |
String :
the PIN to use for challenge dialogs. |
Returns | |
---|---|
boolean |
Returns true if the challenge PIN was set successfully. |
void setUserRestriction (String key, boolean value)
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.
Parameters | |
---|---|
key |
String :
the key of the restriction |
value |
boolean :
the value for the restriction |
void setUserRestrictions (Bundle restrictions, UserHandle userHandle)
This will no longer work. Device owners and profile owners should use
addUserRestriction(ComponentName, String)
instead.
Parameters | |
---|---|
restrictions |
Bundle
|
userHandle |
UserHandle
|
void setUserRestrictions (Bundle restrictions)
This will no longer work. Device owners and profile owners should use
addUserRestriction(ComponentName, String)
instead.
Parameters | |
---|---|
restrictions |
Bundle
|
boolean supportsMultipleUsers ()
Returns whether this device supports multiple users with their own login and customizable space.
Returns | |
---|---|
boolean |
whether the device supports multiple users. |