# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Constants | Methods | Inherited Methods

# UserManager

`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 `DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE` for more on managed profiles.

## Summary

### Nested classes
`class` | `UserManager.UserOperationException` Thrown to indicate user operation failed.

### Constants
`String` | `ALLOW_PARENT_PROFILE_APP_LINKING` Allows apps in the parent profile to handle web links from the managed profile.
`String` | `DISALLOW_ADD_MANAGED_PROFILE` This constant is deprecated. As the ability to have a managed profile on a fully-managed device has been removed from the platform, this restriction will be silently ignored when applied by the device owner.
`String` | `DISALLOW_ADD_USER` Specifies if a user is disallowed from adding new users.
`String` | `DISALLOW_ADJUST_VOLUME` Specifies if a user is disallowed from adjusting the master volume.
`String` | `DISALLOW_AIRPLANE_MODE` Specifies if airplane mode is disallowed on the device.
`String` | `DISALLOW_AMBIENT_DISPLAY` Specifies if ambient display is disallowed for the user.
`String` | `DISALLOW_APPS_CONTROL` Specifies if a user is disallowed from modifying applications in Settings or launchers.
`String` | `DISALLOW_AUTOFILL` Specifies if a user is not allowed to use Autofill Services.
`String` | `DISALLOW_BLUETOOTH` Specifies if bluetooth is disallowed on the device.
`String` | `DISALLOW_BLUETOOTH_SHARING` Specifies if outgoing bluetooth sharing is disallowed.
`String` | `DISALLOW_CONFIG_BLUETOOTH` Specifies if a user is disallowed from configuring bluetooth via Settings.
`String` | `DISALLOW_CONFIG_BRIGHTNESS` Specifies if a user is disallowed from configuring brightness.
`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_DATE_TIME` Specifies configuring date, time and timezone is disallowed via Settings.
`String` | `DISALLOW_CONFIG_LOCALE` Specifies if a user is disallowed from changing the device language.
`String` | `DISALLOW_CONFIG_LOCATION` Specifies if a user is disallowed from enabling or disabling location providers.
`String` | `DISALLOW_CONFIG_MOBILE_NETWORKS` Specifies if a user is disallowed from configuring mobile networks.
`String` | `DISALLOW_CONFIG_PRIVATE_DNS` Specifies whether the user is allowed to modify private DNS settings.
`String` | `DISALLOW_CONFIG_SCREEN_TIMEOUT` Specifies if a user is disallowed from changing screen off timeout.
`String` | `DISALLOW_CONFIG_TETHERING` Specifies if a user is disallowed from configuring Tethering and portable hotspots via Settings.
`String` | `DISALLOW_CONFIG_VPN` Specifies if a user is disallowed from configuring a VPN.
`String` | `DISALLOW_CONFIG_WIFI` Specifies if a user is disallowed from changing Wi-Fi access points via Settings.
`String` | `DISALLOW_CONTENT_CAPTURE` Specifies if the contents of a user's screen is not allowed to be captured for artificial intelligence purposes.
`String` | `DISALLOW_CONTENT_SUGGESTIONS` Specifies if the current user is able to receive content suggestions for selections based on the contents of their screen.
`String` | `DISALLOW_CREATE_WINDOWS` Specifies that windows besides app windows should not be created.
`String` | `DISALLOW_CROSS_PROFILE_COPY_PASTE` Specifies if the clipboard contents can be exported by pasting the data into other users or 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_INSTALL_UNKNOWN_SOURCES_GLOBALLY` This restriction is a device-wide version of `DISALLOW_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.
`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_PRINTING` Specifies whether the user is allowed to print.
`String` | `DISALLOW_REMOVE_MANAGED_PROFILE` This constant is deprecated. As the ability to have a managed profile on a fully-managed device has been removed from the platform, this restriction will be silently ignored when applied by the device owner. When the device is provisioned with a managed profile on an organization-owned device, the managed profile could not be removed anyway.
`String` | `DISALLOW_REMOVE_USER` When set on the admin user this specifies if the user can remove 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_INTO_MANAGED_PROFILE` Specifies whether the user can share file / picture / data from the primary user into the managed profile, either by sending them from the primary side, or by picking up data within an app in the managed profile.
`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_SYSTEM_ERROR_DIALOGS` Specifies that system error dialogs for crashed or unresponsive apps should not be shown.
`String` | `DISALLOW_UNIFIED_PASSWORD` Specifies that the managed profile is not allowed to have unified lock screen challenge with the primary user.
`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` | `DISALLOW_USER_SWITCH` Specifies if user switching is blocked on the current user.
`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` | `QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED` Flag passed to `requestQuietModeEnabled(boolean, UserHandle)` to request disabling quiet mode only if there is no need to confirm the user credentials.
`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.
`int` | `USER_OPERATION_ERROR_CURRENT_USER` Indicates user operation failed because the target user is in the foreground.
`int` | `USER_OPERATION_ERROR_LOW_STORAGE` Indicates user operation failed because device has low data storage.
`int` | `USER_OPERATION_ERROR_MANAGED_PROFILE` Indicates user operation failed because target user is a managed profile.
`int` | `USER_OPERATION_ERROR_MAX_RUNNING_USERS` Indicates user operation failed because maximum running user limit has been reached.
`int` | `USER_OPERATION_ERROR_MAX_USERS` Indicates user operation failed because maximum user limit has been reached.
`int` | `USER_OPERATION_ERROR_UNKNOWN` Indicates user operation failed for unknown reason.
`int` | `USER_OPERATION_SUCCESS` Indicates user operation is successful.

### 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 `Bundle` containing any saved application restrictions for this user, for the given package name.
`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 `getSerialNumberForUser(android.os.UserHandle)`.
`String` | `getUserName()` Returns the user name of the context user.
`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(UserHandle userHandle)` Returns the user-wide restrictions imposed on the user specified by `userHandle`.
`Bundle` | `getUserRestrictions()` Returns the user-wide restrictions imposed on this user.
`boolean` | `hasUserRestriction(String restrictionKey)` Returns whether the current user has been disallowed from performing certain actions or setting certain settings.
`boolean` | `isDemoUser()` Checks if the calling app is running in a demo user.
`boolean` | `isManagedProfile()` Checks if the calling app is running in a managed profile.
`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` | `requestQuietModeEnabled(boolean enableQuietMode, UserHandle userHandle, int flags)` Perform the same operation as `requestQuietModeEnabled(boolean, android.os.UserHandle)`, but with a flag to tweak the behavior of the request.
`boolean` | `requestQuietModeEnabled(boolean enableQuietMode, UserHandle userHandle)` Enables or disables quiet mode for a managed profile.
`boolean` | `setRestrictionsChallenge(String newPin)` This method is deprecated. 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 is deprecated. use `DevicePolicyManager.addUserRestriction(android.content.ComponentName, String)` or `DevicePolicyManager.clearUserRestriction(android.content.ComponentName, String)` instead.
`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`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### ALLOW_PARENT_PROFILE_APP_LINKING

    public static final 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 `Intent.ACTION_VIEW`, category `Intent.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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "allow_parent_profile_app_linking"

### DISALLOW_ADD_MANAGED_PROFILE

    public static final String DISALLOW_ADD_MANAGED_PROFILE

This constant is deprecated.
As the ability to have a managed profile on a fully-managed device has been removed from the platform, this restriction will be silently ignored when applied by the device owner.

Specifies if a user is disallowed from adding managed profiles.

The default value for an unmanaged user is `false`. For users with a device owner set, the default is `true`.

This restriction has no effect on managed profiles.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_add_managed_profile"

### DISALLOW_ADD_USER

    public static final String DISALLOW_ADD_USER

Specifies if a user is disallowed from adding new users. This can only be set by device owners or 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.

When the device is an organization-owned device provisioned with a managed profile, this restriction will be set as a base restriction which cannot be removed by any admin.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_add_user"

### DISALLOW_ADJUST_VOLUME

    public static final 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 be set by device owners from API 21 and profile owners from API 24. The default value is `false`.

When the restriction is set by profile owners, then it only applies to relevant profiles.

This restriction has no effect on managed profiles.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_adjust_volume"

### DISALLOW_AIRPLANE_MODE

    public static final String DISALLOW_AIRPLANE_MODE

Specifies if airplane mode is disallowed on the device.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by any of these owners, it applies globally - i.e., it disables airplane mode on the entire device.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_airplane_mode"

### DISALLOW_AMBIENT_DISPLAY

    public static final String DISALLOW_AMBIENT_DISPLAY

Specifies if ambient display is disallowed for the user.

The default value is `false`.

This user restriction has no effect on managed profiles.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_ambient_display"

### DISALLOW_APPS_CONTROL

    public static final 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:

- uninstalling apps
- disabling apps
- clearing app caches
- clearing app data
- force stopping apps
- clearing app defaults

The default value is `false`.

Note: The user will still be able to perform those actions via other means (such as adb). Third party apps will also be able to uninstall apps via the `PackageInstaller`. `DISALLOW_UNINSTALL_APPS` or `DevicePolicyManager#setUninstallBlocked(ComponentName, String, boolean)` should be used to prevent the user from uninstalling apps completely, and `DevicePolicyManager#addPersistentPreferredActivity(ComponentName, IntentFilter, ComponentName)` to add a default intent handler for a given intent filter.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_control_apps"

### DISALLOW_AUTOFILL

    public static final String DISALLOW_AUTOFILL

Specifies if a user is not allowed to use Autofill Services.

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`.

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_autofill"

### DISALLOW_BLUETOOTH

    public static final String DISALLOW_BLUETOOTH

Specifies if bluetooth is disallowed on the device. If bluetooth is disallowed on the device, bluetooth cannot be turned on or configured via Settings.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by a device owner, it applies globally - i.e., it disables bluetooth on the entire device and all users will be affected. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from using bluetooth and configuring bluetooth in Settings.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_bluetooth"

### DISALLOW_BLUETOOTH_SHARING

    public static final String DISALLOW_BLUETOOTH_SHARING

Specifies if outgoing bluetooth sharing is disallowed.

A device owner and a profile owner can set this restriction. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from any outgoing bluetooth sharing.

Default is `true` for managed profiles and false otherwise.

When a device upgrades to `Build.VERSION_CODES.O`, the system sets it for all existing managed profiles.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_bluetooth_sharing"

### DISALLOW_CONFIG_BLUETOOTH

    public static final String DISALLOW_CONFIG_BLUETOOTH

Specifies if a user is disallowed from configuring bluetooth via Settings. This does not restrict the user from turning bluetooth on or off.

This restriction doesn't prevent the user from using bluetooth. For disallowing usage of bluetooth completely on the device, use `DISALLOW_BLUETOOTH`.

A device owner and a profile owner can set this restriction, although the restriction has no effect in a managed profile. When it is set by a device owner, a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disallows the primary user from configuring bluetooth.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_bluetooth"

### DISALLOW_CONFIG_BRIGHTNESS

    public static final String DISALLOW_CONFIG_BRIGHTNESS

Specifies if a user is disallowed from configuring brightness. When device owner sets it, it'll only be applied on the target(system) user.

The default value is `false`.

This user restriction has no effect on managed profiles.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_brightness"

### DISALLOW_CONFIG_CELL_BROADCASTS

    public static final String DISALLOW_CONFIG_CELL_BROADCASTS

Specifies if a user is disallowed from configuring cell broadcasts.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from configuring cell broadcasts.

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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_cell_broadcasts"

### DISALLOW_CONFIG_CREDENTIALS

    public static final 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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_credentials"

### DISALLOW_CONFIG_DATE_TIME

    public static final String DISALLOW_CONFIG_DATE_TIME

Specifies configuring date, time and timezone is disallowed via Settings.

A device owner and a profile owner can set this restriction, although the restriction has no effect in a managed profile. When it is set by a device owner or by a profile owner of an organization-owned managed profile on the parent profile, it applies globally - i.e., it disables date, time and timezone setting on the entire device and all users are affected. When it is set by a profile owner on the primary user, it disables the primary user from configuring date, time and timezone and disables all configuring of date, time and timezone in Settings.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_date_time"

### DISALLOW_CONFIG_LOCALE

    public static final String DISALLOW_CONFIG_LOCALE

Specifies if a user is disallowed from changing the device language. The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_locale"

### DISALLOW_CONFIG_LOCATION

    public static final String DISALLOW_CONFIG_LOCATION

Specifies if a user is disallowed from enabling or disabling location providers. As a result, user is disallowed from turning on or off location via Settings.

A device owner and a profile owner can set this restriction. When it is set by a device owner, a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disallows the primary user from turning location on or off.

The default value is `false`.

This user restriction is different from `DISALLOW_SHARE_LOCATION`, as a device owner or a profile owner can still enable or disable location mode via `DevicePolicyManager#setLocationEnabled` when this restriction is on.

Key for user restrictions.

Type: Boolean

See also:

- `LocationManager.isLocationEnabled()`
- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_location"

### DISALLOW_CONFIG_MOBILE_NETWORKS

    public static final String DISALLOW_CONFIG_MOBILE_NETWORKS

Specifies if a user is disallowed from configuring mobile networks.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from configuring mobile networks.

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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_mobile_networks"

### DISALLOW_CONFIG_PRIVATE_DNS

    public static final String DISALLOW_CONFIG_PRIVATE_DNS

Specifies whether the user is allowed to modify private DNS settings.

This restriction can only be set by a device owner or a profile owner of an organization-owned managed profile on the parent profile. When it is set by either of these owners, it applies globally.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "disallow_config_private_dns"

### DISALLOW_CONFIG_SCREEN_TIMEOUT

    public static final String DISALLOW_CONFIG_SCREEN_TIMEOUT

Specifies if a user is disallowed from changing screen off timeout.

The default value is `false`.

This user restriction has no effect on managed profiles.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_screen_timeout"

### DISALLOW_CONFIG_TETHERING

    public static final String DISALLOW_CONFIG_TETHERING

Specifies if a user is disallowed from configuring Tethering and portable hotspots via Settings.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from using Tethering and hotspots and disables all configuring of Tethering and hotspots in Settings.

The default value is `false`.

In Android 9.0 or higher, if tethering is enabled when this restriction is set, tethering will be automatically turned off.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_tethering"

### DISALLOW_CONFIG_VPN

    public static final String DISALLOW_CONFIG_VPN

Specifies if a user is disallowed from configuring a VPN. The default value is `false`. This restriction has an effect when set by device owners and, in Android 6.0 (API level 23) or higher, profile owners.

This restriction also prevents VPNs from starting. However, in Android 7.0 (API level 24) or higher, the system does start always-on VPNs created by the device or profile owner.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_vpn"

### DISALLOW_CONFIG_WIFI

    public static final String DISALLOW_CONFIG_WIFI

Specifies if a user is disallowed from changing Wi-Fi access points via Settings.

A device owner and a profile owner can set this restriction, although the restriction has no effect in a managed profile. When it is set by a device owner, a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disallows the primary user from changing Wi-Fi access points.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_config_wifi"

### DISALLOW_CONTENT_CAPTURE

    public static final String DISALLOW_CONTENT_CAPTURE

Specifies if the contents of a user's screen is not allowed to be captured for artificial intelligence purposes.

A device owner and a profile owner can set this restriction. When it is set by a device owner, a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user's screen from being captured for artificial intelligence purposes.

The default value is `false`.

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_content_capture"

### DISALLOW_CONTENT_SUGGESTIONS

    public static final String DISALLOW_CONTENT_SUGGESTIONS

Specifies if the current user is able to receive content suggestions for selections based on the contents of their screen.

A device owner and a profile owner can set this restriction. When it is set by a device owner, a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from receiving content suggestions for selections based on the contents of their screen.

The default value is `false`.

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_content_suggestions"

### DISALLOW_CREATE_WINDOWS

    public static final 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.

- `LayoutParams#TYPE_TOAST`
- `LayoutParams#TYPE_PHONE`
- `LayoutParams#TYPE_PRIORITY_PHONE`
- `LayoutParams#TYPE_SYSTEM_ALERT`
- `LayoutParams#TYPE_SYSTEM_ERROR`
- `LayoutParams#TYPE_SYSTEM_OVERLAY`
- `LayoutParams#TYPE_APPLICATION_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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_create_windows"

### DISALLOW_CROSS_PROFILE_COPY_PASTE

    public static final String DISALLOW_CROSS_PROFILE_COPY_PASTE

Specifies if the clipboard contents can be exported by pasting the data into other users or profiles. This restriction doesn't prevent import, such as someone pasting clipboard data from other profiles or users. The default value is `false`.

Note: Because it's possible to extract data from screenshots using optical character recognition (OCR), we strongly recommend combining this user restriction with `DevicePolicyManager#setScreenCaptureDisabled(ComponentName, boolean)`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_cross_profile_copy_paste"

### DISALLOW_DATA_ROAMING

    public static final String DISALLOW_DATA_ROAMING

Specifies if a user is not allowed to use cellular data when roaming.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from using cellular data when roaming.

The default value is `false`.

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_data_roaming"

### DISALLOW_DEBUGGING_FEATURES

    public static final String DISALLOW_DEBUGGING_FEATURES

Specifies if a user is disallowed from enabling or accessing debugging features.

A device owner and a profile owner can set this restriction. When it is set by a device owner, a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables debugging features altogether, including USB debugging. When set on a managed profile or a secondary user, it blocks debugging for that user only, including starting activities, making service calls, accessing content providers, sending broadcasts, installing/uninstalling packages, clearing user data, etc.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_debugging_features"

### DISALLOW_FACTORY_RESET

    public static final 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 an admin user. The default value is `false`.

This restriction has no effect on non-admin users since they cannot factory reset the device.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_factory_reset"

### DISALLOW_FUN

    public static final 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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_fun"

### DISALLOW_INSTALL_APPS

    public static final String DISALLOW_INSTALL_APPS

Specifies if a user is disallowed from installing applications. This user restriction also prevents device owners and profile owners installing apps. The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_install_apps"

### DISALLOW_INSTALL_UNKNOWN_SOURCES

    public static final 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. Unknown sources exclude adb and special apps such as trusted app stores. The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_install_unknown_sources"

### DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY

    public static final String DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY

This restriction is a device-wide version of `DISALLOW_INSTALL_UNKNOWN_SOURCES`. Specifies if all users on the device are disallowed from enabling the "Unknown Sources" setting, that allows installation of apps from unknown sources. This restriction can be enabled by the profile owner, in which case all accounts and profiles will be affected. The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_install_unknown_sources_globally"

### DISALLOW_MODIFY_ACCOUNTS

    public static final 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 `Build.VERSION_CODES.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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_modify_accounts"

### DISALLOW_MOUNT_PHYSICAL_MEDIA

    public static final String DISALLOW_MOUNT_PHYSICAL_MEDIA

Specifies if a user is disallowed from mounting physical external media.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from mounting physical external media.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_physical_media"

### DISALLOW_NETWORK_RESET

    public static final 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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_network_reset"

### DISALLOW_OUTGOING_BEAM

    public static final 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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_outgoing_beam"

### DISALLOW_OUTGOING_CALLS

    public static final String DISALLOW_OUTGOING_CALLS

Specifies that the user is not allowed to make outgoing phone calls. Emergency calls are still permitted.

A device owner and a profile owner can set this restriction, although the restriction has no effect in a managed profile. When it is set by a device owner, a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disallows the primary user from making outgoing phone calls.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_outgoing_calls"

### DISALLOW_PRINTING

    public static final String DISALLOW_PRINTING

Specifies whether the user is allowed to print. This restriction can be set by device or profile owner. The default value is `false`.

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_printing"

### DISALLOW_REMOVE_MANAGED_PROFILE

    public static final String DISALLOW_REMOVE_MANAGED_PROFILE

This constant is deprecated.
As the ability to have a managed profile on a fully-managed device has been removed from the platform, this restriction will be silently ignored when applied by the device owner. When the device is provisioned with a managed profile on an organization-owned device, the managed profile could not be removed anyway.

Specifies if managed profiles of this user can be removed, other than by its profile owner. The default value is `false`.

This restriction has no effect on managed profiles.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_remove_managed_profile"

### DISALLOW_REMOVE_USER

    public static final String DISALLOW_REMOVE_USER

When set on the admin user this specifies if the user can remove users. When set on a non-admin 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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_remove_user"

### DISALLOW_SAFE_BOOT

    public static final String DISALLOW_SAFE_BOOT

Specifies if the user is not allowed to reboot the device into safe boot mode.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from rebooting the device into safe boot mode.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_safe_boot"

### DISALLOW_SET_USER_ICON

    public static final 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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_set_user_icon"

### DISALLOW_SET_WALLPAPER

    public static final 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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_set_wallpaper"

### DISALLOW_SHARE_INTO_MANAGED_PROFILE

    public static final String DISALLOW_SHARE_INTO_MANAGED_PROFILE

Specifies whether the user can share file / picture / data from the primary user into the managed profile, either by sending them from the primary side, or by picking up data within an app in the managed profile.

When a managed profile is created, the system allows the user to send data from the primary side to the profile by setting up certain default cross profile intent filters. If this is undesired, this restriction can be set to disallow it. Note that this restriction will not block any sharing allowed by explicit `DevicePolicyManager#addCrossProfileIntentFilter` calls by the profile owner.

This restriction is only meaningful when set by profile owner. When it is set by device owner, it does not have any effect.

The default value is `false`.

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_sharing_into_profile"

### DISALLOW_SHARE_LOCATION

    public static final String DISALLOW_SHARE_LOCATION

Specifies if a user is disallowed from turning on location sharing.

In a managed profile, location sharing by default reflects the primary user's setting, but can be overridden and forced off by setting this restriction to true in the managed profile.

A device owner and a profile owner can set this restriction. When it is set by a device owner, a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it prevents the primary user from turning on location sharing.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_share_location"

### DISALLOW_SMS

    public static final String DISALLOW_SMS

Specifies that the user is not allowed to send or receive SMS messages.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from sending or receiving SMS messages.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_sms"

### DISALLOW_SYSTEM_ERROR_DIALOGS

    public static final String DISALLOW_SYSTEM_ERROR_DIALOGS

Specifies that system error dialogs for crashed or unresponsive apps should not be shown. In this case, the system will force-stop the app as if the user chooses the "close app" option on the UI. A feedback report isn't collected as there is no way for the user to provide explicit consent. The default value is `false`.

When this user restriction is set by device owners, it's applied to all users. When set by the profile owner of the primary user or a secondary user, the restriction affects only the calling user. This user restriction has no effect on managed profiles.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_system_error_dialogs"

### DISALLOW_UNIFIED_PASSWORD

    public static final String DISALLOW_UNIFIED_PASSWORD

Specifies that the managed profile is not allowed to have unified lock screen challenge with the primary user.

Note: Setting this restriction alone doesn't automatically set a separate challenge. Profile owner can ask the user to set a new password using `DevicePolicyManager#ACTION_SET_NEW_PASSWORD` and verify it using `DevicePolicyManager#isUsingUnifiedPassword(ComponentName)`.

Can be set by profile owners. It only has effect on managed profiles when set by managed profile owner. Has no effect on non-managed profiles or users.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_unified_password"

### DISALLOW_UNINSTALL_APPS

    public static final 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:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_uninstall_apps"

### DISALLOW_UNMUTE_MICROPHONE

    public static final String DISALLOW_UNMUTE_MICROPHONE

Specifies if a user is disallowed from adjusting microphone volume. If set, the microphone will be muted.

A device owner and a profile owner can set this restriction, although the restriction has no effect in a managed profile. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it will disallow the primary user from adjusting the microphone volume.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_unmute_microphone"

### DISALLOW_USB_FILE_TRANSFER

    public static final String DISALLOW_USB_FILE_TRANSFER

Specifies if a user is disallowed from transferring files over USB.

This restriction can only be set by a device owner, a profile owner on the primary user or a profile owner of an organization-owned managed profile on the parent profile. When it is set by a device owner, it applies globally. When it is set by a profile owner on the primary user or by a profile owner of an organization-owned managed profile on the parent profile, it disables the primary user from transferring files over USB. No other user on the device is able to use file transfer over USB because the UI for file transfer is always associated with the primary user.

The default value is `false`.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_usb_file_transfer"

### DISALLOW_USER_SWITCH

    public static final String DISALLOW_USER_SWITCH

Specifies if user switching is blocked on the current user.

This restriction can only be set by the device owner, it will be applied to all users. Device owner can still switch user via `DevicePolicyManager#switchUser(ComponentName, UserHandle)` when this restriction is set.

The default value is `false`.

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "no_user_switch"

### ENSURE_VERIFY_APPS

    public static final String ENSURE_VERIFY_APPS

Specifies if a user is disallowed from disabling application verification. The default value is `false`.

In Android 8.0 (API level 26) and higher, this is a global user restriction. If a device owner or profile owner sets this restriction, the system enforces app verification across all users on the device. Running in earlier Android versions, this restriction affects only the profile that sets it.

Key for user restrictions.

Type: Boolean

See also:

- `DevicePolicyManager.addUserRestriction(ComponentName, String)`
- `DevicePolicyManager.clearUserRestriction(ComponentName, String)`
- `getUserRestrictions()`

Constant Value: "ensure_verify_apps"

### KEY_RESTRICTIONS_PENDING

    public static final 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:

- `DevicePolicyManager.setApplicationRestrictions(android.content.ComponentName, String, Bundle)`
- `DevicePolicyManager.getApplicationRestrictions(android.content.ComponentName, String)`

Constant Value: "restrictions_pending"

### QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED

    public static final int QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED

Flag passed to `requestQuietModeEnabled(boolean, UserHandle)` to request disabling quiet mode only if there is no need to confirm the user credentials. If credentials are required to disable quiet mode, `requestQuietModeEnabled(boolean, UserHandle)` will do nothing and return `false`.

Constant Value: 1 (0x00000001)

### USER_CREATION_FAILED_NOT_PERMITTED

    public static final 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(java.lang.String, java.lang.String, java.lang.String, android.os.PersistableBundle)`.

Constant Value: 1 (0x00000001)

### USER_CREATION_FAILED_NO_MORE_USERS

    public static final 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(java.lang.String, java.lang.String, java.lang.String, android.os.PersistableBundle)`.

Constant Value: 2 (0x00000002)

### USER_OPERATION_ERROR_CURRENT_USER

    public static final int USER_OPERATION_ERROR_CURRENT_USER

Indicates user operation failed because the target user is in the foreground.

Constant Value: 4 (0x00000004)

### USER_OPERATION_ERROR_LOW_STORAGE

    public static final int USER_OPERATION_ERROR_LOW_STORAGE

Indicates user operation failed because device has low data storage.

Constant Value: 5 (0x00000005)

### USER_OPERATION_ERROR_MANAGED_PROFILE

    public static final int USER_OPERATION_ERROR_MANAGED_PROFILE

Indicates user operation failed because target user is a managed profile.

Constant Value: 2 (0x00000002)

### USER_OPERATION_ERROR_MAX_RUNNING_USERS

    public static final int USER_OPERATION_ERROR_MAX_RUNNING_USERS

Indicates user operation failed because maximum running user limit has been reached.

Constant Value: 3 (0x00000003)

### USER_OPERATION_ERROR_MAX_USERS

    public static final int USER_OPERATION_ERROR_MAX_USERS

Indicates user operation failed because maximum user limit has been reached.

Constant Value: 6 (0x00000006)

### USER_OPERATION_ERROR_UNKNOWN

    public static final int USER_OPERATION_ERROR_UNKNOWN

Indicates user operation failed for unknown reason.

Constant Value: 1 (0x00000001)

### USER_OPERATION_SUCCESS

    public static final int USER_OPERATION_SUCCESS

Indicates user operation is successful.

Constant Value: 0 (0x00000000)

## Public methods

### createUserCreationIntent

    public 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. 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 `Activity#RESULT_CANCELED`. On success, the result code will be `Activity#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. This value may be `null`.
`accountName` | `String`: Optional account name that will be used by the setup wizard to initialize the user. This value may be `null`.
`accountType` | `String`: Optional account type for the account to be created. This is required if the account name is specified. This value may be `null`.
`accountOptions` | `PersistableBundle`: Optional bundle of data to be passed in during account creation in the new user via `AccountManager#addAccount(String, String, String[], Bundle, android.app.Activity, android.accounts.AccountManagerCallback, Handler)`. This value may be `null`.

Returns
`Intent` | An Intent that can be launched from an Activity.

See also:

- `USER_CREATION_FAILED_NOT_PERMITTED`
- `USER_CREATION_FAILED_NO_MORE_USERS`
- `supportsMultipleUsers()`

### getApplicationRestrictions

    public 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[]`
- From `Build.VERSION_CODES.M`, `Bundle` or `Bundle[]`

NOTE: The method performs disk I/O and shouldn't be called on the main thread
This method may take several seconds to complete, so it should only be called from a worker thread.

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:

- `KEY_RESTRICTIONS_PENDING`

### getSerialNumberForUser

    public 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:

- `getUserForSerialNumber(long)`

### getUserCount

    public int getUserCount ()

Return the number of users currently created on the device.

This API is not for use by third-party apps. It requires the `MANAGE_USERS` permission.

Requires android.Manifest.permission.MANAGE_USERS

Returns
`int` |

### getUserCreationTime

    public 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.

### getUserForSerialNumber

    public UserHandle getUserForSerialNumber (long serialNumber)

Return the user associated with a serial number previously returned by `getSerialNumberForUser(android.os.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:

- `getSerialNumberForUser(UserHandle)`

### getUserName

    public String getUserName ()

Returns the user name of the context user. This call is only available to applications on the system image; it requires the `android.permission.MANAGE_USERS` or `android.permission.GET_ACCOUNTS_PRIVILEGED` permissions.

Returns
`String` | the user name This value cannot be `null`.

### getUserProfiles

    public 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.

### getUserRestrictions

    public 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. Requires `android.permission.MANAGE_USERS` or `android.permission.INTERACT_ACROSS_USERS`, otherwise specified `UserHandle` must be the calling user or a managed profile associated with it.

### getUserRestrictions

    public Bundle getUserRestrictions ()

Returns the user-wide restrictions imposed on this user.

Returns
`Bundle` | a Bundle containing all the restrictions.

### hasUserRestriction

    public 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. Value is `DISALLOW_MODIFY_ACCOUNTS`, `DISALLOW_CONFIG_WIFI`, `DISALLOW_CONFIG_LOCALE`, `DISALLOW_INSTALL_APPS`, `DISALLOW_UNINSTALL_APPS`, `DISALLOW_SHARE_LOCATION`, `DISALLOW_AIRPLANE_MODE`, `DISALLOW_CONFIG_BRIGHTNESS`, `DISALLOW_AMBIENT_DISPLAY`, `DISALLOW_CONFIG_SCREEN_TIMEOUT`, `DISALLOW_INSTALL_UNKNOWN_SOURCES`, `DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY`, `DISALLOW_CONFIG_BLUETOOTH`, `DISALLOW_BLUETOOTH`, `DISALLOW_BLUETOOTH_SHARING`, `DISALLOW_USB_FILE_TRANSFER`, `DISALLOW_CONFIG_CREDENTIALS`, `DISALLOW_REMOVE_USER`, `DISALLOW_REMOVE_MANAGED_PROFILE`, `DISALLOW_DEBUGGING_FEATURES`, `DISALLOW_CONFIG_VPN`, `DISALLOW_CONFIG_LOCATION`, `DISALLOW_CONFIG_DATE_TIME`, `DISALLOW_CONFIG_TETHERING`, `DISALLOW_NETWORK_RESET`, `DISALLOW_FACTORY_RESET`, `DISALLOW_ADD_USER`, `DISALLOW_ADD_MANAGED_PROFILE`, `ENSURE_VERIFY_APPS`, `DISALLOW_CONFIG_CELL_BROADCASTS`, `DISALLOW_CONFIG_MOBILE_NETWORKS`, `DISALLOW_APPS_CONTROL`, `DISALLOW_MOUNT_PHYSICAL_MEDIA`, `DISALLOW_UNMUTE_MICROPHONE`, `DISALLOW_ADJUST_VOLUME`, `DISALLOW_OUTGOING_CALLS`, `DISALLOW_SMS`, `DISALLOW_FUN`, `DISALLOW_CREATE_WINDOWS`, `DISALLOW_SYSTEM_ERROR_DIALOGS`, `DISALLOW_CROSS_PROFILE_COPY_PASTE`, `DISALLOW_OUTGOING_BEAM`, android.os.UserManager.DISALLOW_WALLPAPER, `DISALLOW_SET_WALLPAPER`, `DISALLOW_SAFE_BOOT`, android.os.UserManager.DISALLOW_RECORD_AUDIO, android.os.UserManager.DISALLOW_RUN_IN_BACKGROUND, android.os.UserManager.DISALLOW_CAMERA, android.os.UserManager.DISALLOW_UNMUTE_DEVICE, `DISALLOW_DATA_ROAMING`, `DISALLOW_SET_USER_ICON`, android.os.UserManager.DISALLOW_OEM_UNLOCK, `DISALLOW_UNIFIED_PASSWORD`, `ALLOW_PARENT_PROFILE_APP_LINKING`, `DISALLOW_AUTOFILL`, `DISALLOW_CONTENT_CAPTURE`, `DISALLOW_CONTENT_SUGGESTIONS`, `DISALLOW_USER_SWITCH`, `DISALLOW_SHARE_INTO_MANAGED_PROFILE`, `DISALLOW_PRINTING`, `DISALLOW_CONFIG_PRIVATE_DNS`, or `KEY_RESTRICTIONS_PENDING`

Returns
`boolean` | `true` if the current user has the given restriction, `false` otherwise.

### isDemoUser

    public boolean isDemoUser ()

Checks if the calling app is running in a demo user. When running in a demo user, apps can be more helpful to the user, or explain their features in more detail.

Returns
`boolean` | whether the caller is a demo user.

### isManagedProfile

    public boolean isManagedProfile ()

Checks if the calling app is running in a managed profile.

Returns
`boolean` | whether the caller is in a managed profile.

### isQuietModeEnabled

    public 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.

### isSystemUser

    public 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.

### isUserAGoat

    public boolean isUserAGoat ()

Used to determine whether the user making this call is subject to teleportations.

As of `Build.VERSION_CODES.LOLLIPOP`, this method can now automatically identify goats using advanced goat recognition technology.

As of `Build.VERSION_CODES.R`, this method always returns `false` in order to protect goat privacy.

Returns
`boolean` | Returns whether the user making this call is a goat.

### isUserRunning

    public 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.

Note prior to Android Nougat MR1 (SDK version <= 24; `Build.VERSION_CODES.N`, this API required a system permission in order to check other profile's status. Since Android Nougat MR1 (SDK version >= 25; `Build.VERSION_CODES.N_MR1`), the restriction has been relaxed, and now it'll accept any `UserHandle` within the same profile group as the caller.

Parameters
`user` | `UserHandle`: The user to retrieve the running state for.

Returns
`boolean` |

### isUserRunningOrStopping

    public boolean isUserRunningOrStopping (UserHandle user)

Return whether the given user is actively running or stopping. This is like `isUserRunning(android.os.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).

Note prior to Android Nougat MR1 (SDK version <= 24; `Build.VERSION_CODES.N`, this API required a system permission in order to check other profile's status. Since Android Nougat MR1 (SDK version >= 25; `Build.VERSION_CODES.N_MR1`), the restriction has been relaxed, and now it'll accept any `UserHandle` within the same profile group as the caller.

Parameters
`user` | `UserHandle`: The user to retrieve the running state for.

Returns
`boolean` |

### isUserUnlocked

    public 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.

Requires `android.permission.MANAGE_USERS` or `android.permission.INTERACT_ACROSS_USERS`, otherwise specified `UserHandle` must be the calling user or a managed profile associated with it.

Parameters
`user` | `UserHandle`: to retrieve the unlocked state for.

Returns
`boolean` |

See also:

- `Intent.ACTION_USER_UNLOCKED`
- `Context.createDeviceProtectedStorageContext()`

### isUserUnlocked

    public 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` |

See also:

- `Intent.ACTION_USER_UNLOCKED`
- `Context.createDeviceProtectedStorageContext()`

### requestQuietModeEnabled

    public boolean requestQuietModeEnabled (boolean enableQuietMode,
                    UserHandle userHandle,
                    int flags)

Perform the same operation as `requestQuietModeEnabled(boolean, android.os.UserHandle)`, but with a flag to tweak the behavior of the request.

Parameters
`enableQuietMode` | `boolean`: whether quiet mode should be enabled or disabled
`userHandle` | `UserHandle`: user handle of the profile This value cannot be `null`.
`flags` | `int`: Can be 0 or `QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED`. Value is either `0` or a combination of `QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED`, and android.os.UserManager.QUIET_MODE_DISABLE_DONT_ASK_CREDENTIAL

Returns
`boolean` | `false` if user's credential is needed in order to turn off quiet mode, `true` otherwise

Throws
`SecurityException` | if the caller is invalid
`IllegalArgumentException` | if `userHandle` is not a managed profile

See also:

- `isQuietModeEnabled(UserHandle)`

### requestQuietModeEnabled

    public boolean requestQuietModeEnabled (boolean enableQuietMode,
                    UserHandle userHandle)

Enables or disables quiet mode for a managed profile. If quiet mode is enabled, apps in a managed profile don't run, generate notifications, or consume data or battery.

If a user's credential is needed to turn off quiet mode, a confirm credential screen will be shown to the user.

The change may not happen instantly, however apps can listen for `Intent#ACTION_MANAGED_PROFILE_AVAILABLE` and `Intent#ACTION_MANAGED_PROFILE_UNAVAILABLE` broadcasts in order to be notified of the change of the quiet mode. Apps can also check the current state of quiet mode by calling `isQuietModeEnabled(android.os.UserHandle)`.

The caller must either be the foreground default launcher or have one of these permissions: `MANAGE_USERS` or `MODIFY_QUIET_MODE`.

Parameters
`enableQuietMode` | `boolean`: whether quiet mode should be enabled or disabled
`userHandle` | `UserHandle`: user handle of the profile This value cannot be `null`.

Returns
`boolean` | `false` if user's credential is needed in order to turn off quiet mode, `true` otherwise

Throws
`SecurityException` | if the caller is invalid
`IllegalArgumentException` | if `userHandle` is not a managed profile

See also:

- `isQuietModeEnabled(UserHandle)`

### setRestrictionsChallenge

    public boolean setRestrictionsChallenge (String newPin)

This method is deprecated.
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.

### setUserRestriction

    public void setUserRestriction (String key,
                    boolean value)

This method is deprecated.
use `DevicePolicyManager.addUserRestriction(android.content.ComponentName, String)` or `DevicePolicyManager.clearUserRestriction(android.content.ComponentName, String)` instead.

Sets the value of a specific restriction. Requires the MANAGE_USERS permission.
Requires android.Manifest.permission.MANAGE_USERS

Parameters
`key` | `String`: the key of the restriction
`value` | `boolean`: the value for the restriction

### setUserRestrictions

    public void setUserRestrictions (Bundle restrictions,
                    UserHandle userHandle)

This will no longer work. Device owners and profile owners should use `DevicePolicyManager#addUserRestriction(ComponentName, String)` instead.

Parameters
`restrictions` | `Bundle`
`userHandle` | `UserHandle`

### setUserRestrictions

    public void setUserRestrictions (Bundle restrictions)

This will no longer work. Device owners and profile owners should use `DevicePolicyManager#addUserRestriction(ComponentName, String)` instead.

Parameters
`restrictions` | `Bundle`

### supportsMultipleUsers

    public static boolean supportsMultipleUsers ()

Returns whether this device supports multiple users with their own login and customizable space.

Returns
`boolean` | whether the device supports multiple users.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*