Merge "Per-profile user restrictions in org-owned managed profile" into rvc-dev am: 155d909a08

Change-Id: I5609d7bdbf078148d0daec5c52bcf267e261c668
This commit is contained in:
Alex Johnston
2020-05-27 13:25:49 +00:00
committed by Automerger Merge Worker
3 changed files with 229 additions and 158 deletions

View File

@@ -230,13 +230,14 @@ public class UserManager {
public static final String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; public static final String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts";
/** /**
* Specifies if a user is disallowed from changing Wi-Fi * Specifies if a user is disallowed from changing Wi-Fi access points via Settings.
* access points. The default value is <code>false</code>. *
* <p> * <p>A device owner and a profile owner can set this restriction, although the restriction has
* Device owner and profile owner can set this restriction, although the restriction has no * no effect in a managed profile. When it is set by a device owner, a profile owner on the
* effect in a managed profile. When it is set by the profile owner of an organization-owned * primary user or by a profile owner of an organization-owned managed profile on the parent
* managed profile on the parent profile, it will disallow the personal user from changing * profile, it disallows the primary user from changing Wi-Fi access points.
* Wi-Fi access points. *
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -285,14 +286,16 @@ public class UserManager {
/** /**
* Specifies if a user is disallowed from turning on location sharing. * Specifies if a user is disallowed from turning on location sharing.
* The default value is <code>false</code>. *
* <p> * <p>In a managed profile, location sharing by default reflects the primary user's setting, but
* 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. * can be overridden and forced off by setting this restriction to true in the managed profile.
* <p> *
* Device owner and profile owner can set this restriction. When it is set by the profile * <p>A device owner and a profile owner can set this restriction. When it is set by a device
* owner of an organization-owned managed profile on the parent profile, it will prevent the * owner, a profile owner on the primary user or by a profile owner of an organization-owned
* user from turning on location sharing in the personal profile. * managed profile on the parent profile, it prevents the primary user from turning on
* location sharing.
*
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -304,12 +307,13 @@ public class UserManager {
/** /**
* Specifies if airplane mode is disallowed on the device. * Specifies if airplane mode is disallowed on the device.
* <p> *
* This restriction can only be set by the device owner, the profile owner on the primary user * <p>This restriction can only be set by a device owner, a profile owner on the primary
* or the profile owner of an organization-owned managed profile on the parent profile, and it * user or a profile owner of an organization-owned managed profile on the parent profile.
* applies globally - i.e. it disables airplane mode on the entire device. * When it is set by any of these owners, it applies globally - i.e., it disables airplane mode
* <p> * on the entire device.
* The default value is <code>false</code>. *
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -397,17 +401,18 @@ public class UserManager {
"no_install_unknown_sources_globally"; "no_install_unknown_sources_globally";
/** /**
* Specifies if a user is disallowed from configuring bluetooth. * Specifies if a user is disallowed from configuring bluetooth via Settings. This does
* This does <em>not</em> restrict the user from turning bluetooth on or off. * <em>not</em> restrict the user from turning bluetooth on or off.
* The default value is <code>false</code>. *
* <p> * <p>This restriction doesn't prevent the user from using bluetooth. For disallowing usage of
* This restriction doesn't prevent the user from using bluetooth. For disallowing usage of
* bluetooth completely on the device, use {@link #DISALLOW_BLUETOOTH}. * bluetooth completely on the device, use {@link #DISALLOW_BLUETOOTH}.
* <p> *
* Device owner and profile owner can set this restriction, although the restriction has no * <p>A device owner and a profile owner can set this restriction, although the restriction has
* effect in a managed profile. When it is set by the profile owner of an organization-owned * no effect in a managed profile. When it is set by a device owner, a profile owner on the
* managed profile on the parent profile, it will disallow the personal user from configuring * primary user or by a profile owner of an organization-owned managed profile on the parent
* bluetooth. * profile, it disallows the primary user from configuring bluetooth.
*
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -418,13 +423,19 @@ public class UserManager {
public static final String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth"; public static final String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth";
/** /**
* Specifies if bluetooth is disallowed on the device. * Specifies if bluetooth is disallowed on the device. If bluetooth is disallowed on the device,
* bluetooth cannot be turned on or configured via Settings.
*
* <p>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.
* *
* <p> This restriction can only be set by the device owner, the profile owner on the
* primary user or the profile owner of an organization-owned managed profile on the
* parent profile and it applies globally - i.e. it disables bluetooth on the entire
* device.
* <p>The default value is <code>false</code>. * <p>The default value is <code>false</code>.
*
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
* @see DevicePolicyManager#addUserRestriction(ComponentName, String) * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
@@ -434,14 +445,17 @@ public class UserManager {
public static final String DISALLOW_BLUETOOTH = "no_bluetooth"; public static final String DISALLOW_BLUETOOTH = "no_bluetooth";
/** /**
* Specifies if outgoing bluetooth sharing is disallowed on the device. Device owner and profile * Specifies if outgoing bluetooth sharing is disallowed.
* owner can set this restriction. When it is set by device owner or the profile owner of an
* organization-owned managed profile on the parent profile, all users on this device will be
* affected.
* *
* <p>Default is <code>true</code> for managed profiles and false for otherwise. When a device * <p>A device owner and a profile owner can set this restriction. When it is set by a device
* upgrades to {@link android.os.Build.VERSION_CODES#O}, the system sets it for all existing * owner, it applies globally. When it is set by a profile owner on the primary user or by a
* managed profiles. * profile owner of an organization-owned managed profile on the parent profile, it disables
* the primary user from any outgoing bluetooth sharing.
*
* <p>Default is <code>true</code> for managed profiles and false otherwise.
*
* <p>When a device upgrades to {@link android.os.Build.VERSION_CODES#O}, the system sets it
* for all existing managed profiles.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -452,10 +466,17 @@ public class UserManager {
public static final String DISALLOW_BLUETOOTH_SHARING = "no_bluetooth_sharing"; public static final String DISALLOW_BLUETOOTH_SHARING = "no_bluetooth_sharing";
/** /**
* Specifies if a user is disallowed from transferring files over * Specifies if a user is disallowed from transferring files over USB.
* USB. This can only be set by device owners, profile owners on the primary user or *
* profile owners of organization-owned managed profiles on the parent profile. * <p>This restriction can only be set by a device owner, a profile owner on the primary
* The default value is <code>false</code>. * 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.
*
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -512,13 +533,16 @@ public class UserManager {
public static final String DISALLOW_REMOVE_MANAGED_PROFILE = "no_remove_managed_profile"; public static final String DISALLOW_REMOVE_MANAGED_PROFILE = "no_remove_managed_profile";
/** /**
* Specifies if a user is disallowed from enabling or accessing debugging features. When set on * Specifies if a user is disallowed from enabling or accessing debugging features.
* the primary user or by the profile owner of an organization-owned managed profile on the *
* parent profile, disables debugging features altogether, including USB debugging. When set on * <p>A device owner and a profile owner can set this restriction. When it is set by a device
* a managed profile or a secondary user, blocks debugging for that user only, including * owner, a profile owner on the primary user or by a profile owner of an organization-owned
* starting activities, making service calls, accessing content providers, sending broadcasts, * managed profile on the parent profile, it disables debugging features altogether, including
* installing/uninstalling packages, clearing user data, etc. * USB debugging. When set on a managed profile or a secondary user, it blocks debugging for
* The default value is <code>false</code>. * that user only, including starting activities, making service calls, accessing content
* providers, sending broadcasts, installing/uninstalling packages, clearing user data, etc.
*
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -546,19 +570,18 @@ public class UserManager {
/** /**
* Specifies if a user is disallowed from enabling or disabling location providers. As a * Specifies if a user is disallowed from enabling or disabling location providers. As a
* result, user is disallowed from turning on or off location. * result, user is disallowed from turning on or off location via Settings.
* *
* <p> * <p>A device owner and a profile owner can set this restriction. When it is set by a device
* In a managed profile, location sharing is forced off when it is turned off on the primary * owner, a profile owner on the primary user or by a profile owner of an organization-owned
* user or by the profile owner of an organization-owned managed profile on the parent profile. * managed profile on the parent profile, it disallows the primary user from turning location
* The user can still turn off location sharing on a managed profile when the restriction is * on or off.
* set by the profile owner on a managed profile. *
* <p> * <p>The default value is <code>false</code>.
* This user restriction is different from {@link #DISALLOW_SHARE_LOCATION}, *
* as the device owner or profile owner can still enable or disable location mode via * <p>This user restriction is different from {@link #DISALLOW_SHARE_LOCATION},
* as a device owner or a profile owner can still enable or disable location mode via
* {@link DevicePolicyManager#setLocationEnabled} when this restriction is on. * {@link DevicePolicyManager#setLocationEnabled} when this restriction is on.
* <p>
* The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -570,15 +593,18 @@ public class UserManager {
public static final String DISALLOW_CONFIG_LOCATION = "no_config_location"; public static final String DISALLOW_CONFIG_LOCATION = "no_config_location";
/** /**
* Specifies if date, time and timezone configuring is disallowed. * Specifies configuring date, time and timezone is disallowed via Settings.
*
* <p>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.
* *
* <p>When restriction is set by device owners or profile owners of organization-owned
* managed profiles on the parent profile, it applies globally - i.e., it disables date,
* time and timezone setting on the entire device and all users will be affected. When it's set
* by profile owners, it's only applied to the managed user.
* <p>The default value is <code>false</code>. * <p>The default value is <code>false</code>.
* *
* <p>This user restriction has no effect on managed profiles.
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
* @see DevicePolicyManager#addUserRestriction(ComponentName, String) * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
@@ -588,10 +614,18 @@ public class UserManager {
public static final String DISALLOW_CONFIG_DATE_TIME = "no_config_date_time"; public static final String DISALLOW_CONFIG_DATE_TIME = "no_config_date_time";
/** /**
* Specifies if a user is disallowed from configuring Tethering * Specifies if a user is disallowed from configuring Tethering and portable hotspots
* & portable hotspots. This can only be set by device owners, profile owners on the * via Settings.
* primary user or profile owners of organization-owned managed profiles on the parent profile. *
* The default value is <code>false</code>. * <p>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.
*
* <p>The default value is <code>false</code>.
*
* <p>In Android 9.0 or higher, if tethering is enabled when this restriction is set, * <p>In Android 9.0 or higher, if tethering is enabled when this restriction is set,
* tethering will be automatically turned off. * tethering will be automatically turned off.
* *
@@ -685,10 +719,16 @@ public class UserManager {
public static final String ENSURE_VERIFY_APPS = "ensure_verify_apps"; public static final String ENSURE_VERIFY_APPS = "ensure_verify_apps";
/** /**
* Specifies if a user is disallowed from configuring cell * Specifies if a user is disallowed from configuring cell broadcasts.
* broadcasts. This can only be set by device owners, profile owners on the primary user or *
* profile owners of organization-owned managed profiles on the parent profile. * <p>This restriction can only be set by a device owner, a profile owner on the primary
* The default value is <code>false</code>. * 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.
*
* <p>The default value is <code>false</code>.
*
* <p>This restriction has no effect on secondary users and managed profiles since only the * <p>This restriction has no effect on secondary users and managed profiles since only the
* primary user can configure cell broadcasts. * primary user can configure cell broadcasts.
* *
@@ -701,10 +741,16 @@ public class UserManager {
public static final String DISALLOW_CONFIG_CELL_BROADCASTS = "no_config_cell_broadcasts"; public static final String DISALLOW_CONFIG_CELL_BROADCASTS = "no_config_cell_broadcasts";
/** /**
* Specifies if a user is disallowed from configuring mobile * Specifies if a user is disallowed from configuring mobile networks.
* networks. This can only be set by device owners, profile owners on the primary user or *
* profile owners of organization-owned managed profiles on the parent profile. * <p>This restriction can only be set by a device owner, a profile owner on the primary
* The default value is <code>false</code>. * 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.
*
* <p>The default value is <code>false</code>.
*
* <p>This restriction has no effect on secondary users and managed profiles since only the * <p>This restriction has no effect on secondary users and managed profiles since only the
* primary user can configure mobile networks. * primary user can configure mobile networks.
* *
@@ -747,11 +793,14 @@ public class UserManager {
/** /**
* Specifies if a user is disallowed from mounting physical external media. * Specifies if a user is disallowed from mounting physical external media.
* <p> *
* This restriction can only be set by the device owner, the profile owner on the primary user * <p>This restriction can only be set by a device owner, a profile owner on the primary
* or the profile owner of an organization-owned managed profile on the parent profile. * user or a profile owner of an organization-owned managed profile on the parent profile.
* <p> * When it is set by a device owner, it applies globally. When it is set by a profile owner
* The default value is <code>false</code>. * 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.
*
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -764,13 +813,14 @@ public class UserManager {
/** /**
* Specifies if a user is disallowed from adjusting microphone volume. If set, the microphone * Specifies if a user is disallowed from adjusting microphone volume. If set, the microphone
* will be muted. * will be muted.
* <p> *
* The default value is <code>false</code>. * <p>A device owner and a profile owner can set this restriction, although the restriction has
* <p> * no effect in a managed profile. When it is set by a device owner, it applies globally. When
* Device owner and profile owner can set this restriction, although the restriction has no * it is set by a profile owner on the primary user or by a profile owner of an
* effect in a managed profile. When it is set by the profile owner of an organization-owned * organization-owned managed profile on the parent profile, it will disallow the primary user
* managed profile on the parent profile, it will disallow the personal user from adjusting the * from adjusting the microphone volume.
* microphone volume. *
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -800,13 +850,13 @@ public class UserManager {
/** /**
* Specifies that the user is not allowed to make outgoing phone calls. Emergency calls are * Specifies that the user is not allowed to make outgoing phone calls. Emergency calls are
* still permitted. * still permitted.
* <p> *
* The default value is <code>false</code>. * <p>A device owner and a profile owner can set this restriction, although the restriction has
* <p> * no effect in a managed profile. When it is set by a device owner, a profile owner on the
* Device owner and profile owner can set this restriction, although the restriction has no * primary user or by a profile owner of an organization-owned managed profile on the parent
* effect in a managed profile. When it is set by the profile owner of an organization-owned * profile, it disallows the primary user from making outgoing phone calls.
* managed profile on the parent profile, it will disallow the personal user from making *
* outgoing phone calls. * <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -817,12 +867,15 @@ public class UserManager {
public static final String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls"; public static final String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls";
/** /**
* Specifies that the user is not allowed to send or receive * Specifies that the user is not allowed to send or receive SMS messages.
* SMS messages. The default value is <code>false</code>. *
* <p> * <p>This restriction can only be set by a device owner, a profile owner on the primary
* Device owner and profile owner can set this restriction. When it is set by the * user or a profile owner of an organization-owned managed profile on the parent profile.
* 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
* it will disable SMS in the personal profile. * 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.
*
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -941,9 +994,15 @@ public class UserManager {
/** /**
* Specifies if the user is not allowed to reboot the device into safe boot mode. * Specifies if the user is not allowed to reboot the device into safe boot mode.
* This can only be set by device owners, profile owners on the primary user or profile *
* owners of organization-owned managed profiles on the parent profile. * <p>This restriction can only be set by a device owner, a profile owner on the primary
* The default value is <code>false</code>. * 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.
*
* <p>The default value is <code>false</code>.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean
@@ -981,12 +1040,14 @@ public class UserManager {
/** /**
* Specifies if a user is not allowed to use the camera. * Specifies if a user is not allowed to use the camera.
* <p> *
* Device owner and profile owner can set this restriction. When the restriction is set by * <p>A device owner and a profile owner can set this restriction. When it is set by a
* the device owner or the profile owner of an organization-owned managed profile on the * device owner, it applies globally - i.e., it disables the use of camera on the entire device
* parent profile, it is applied globally. * and all users are affected. When it is set by a profile owner on the primary user or by a
* <p> * profile owner of an organization-owned managed profile on the parent profile, it disables
* The default value is <code>false</code>. * the primary user from using camera.
*
* <p>The default value is <code>false</code>.
* *
* @see DevicePolicyManager#addUserRestriction(ComponentName, String) * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
* @see DevicePolicyManager#clearUserRestriction(ComponentName, String) * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
@@ -1006,9 +1067,15 @@ public class UserManager {
public static final String DISALLOW_UNMUTE_DEVICE = "disallow_unmute_device"; public static final String DISALLOW_UNMUTE_DEVICE = "disallow_unmute_device";
/** /**
* Specifies if a user is not allowed to use cellular data when roaming. This can only be set by * Specifies if a user is not allowed to use cellular data when roaming.
* device owners or profile owners of organization-owned managed profiles on the parent profile. *
* The default value is <code>false</code>. * <p>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.
*
* <p>The default value is <code>false</code>.
* *
* @see DevicePolicyManager#addUserRestriction(ComponentName, String) * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
* @see DevicePolicyManager#clearUserRestriction(ComponentName, String) * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
@@ -1103,9 +1170,10 @@ public class UserManager {
* Specifies if the contents of a user's screen is not allowed to be captured for artificial * Specifies if the contents of a user's screen is not allowed to be captured for artificial
* intelligence purposes. * intelligence purposes.
* *
* <p>Device owner and profile owner can set this restriction. When it is set by the * <p>A device owner and a profile owner can set this restriction. When it is set by a device
* device owner or the profile owner of an organization-owned managed profile on the parent * owner, a profile owner on the primary user or by a profile owner of an organization-owned
* profile, only the target user will be affected. * managed profile on the parent profile, it disables the primary user's screen from being
* captured for artificial intelligence purposes.
* *
* <p>The default value is <code>false</code>. * <p>The default value is <code>false</code>.
* *
@@ -1119,9 +1187,10 @@ public class UserManager {
* Specifies if the current user is able to receive content suggestions for selections based on * Specifies if the current user is able to receive content suggestions for selections based on
* the contents of their screen. * the contents of their screen.
* *
* <p>Device owner and profile owner can set this restriction. When it is set by the * <p>A device owner and a profile owner can set this restriction. When it is set by a device
* device owner or the profile owner of an organization-owned managed profile on the parent * owner, a profile owner on the primary user or by a profile owner of an organization-owned
* profile, only the target user will be affected. * managed profile on the parent profile, it disables the primary user from receiving content
* suggestions for selections based on the contents of their screen.
* *
* <p>The default value is <code>false</code>. * <p>The default value is <code>false</code>.
* *
@@ -1185,10 +1254,11 @@ public class UserManager {
/** /**
* Specifies whether the user is allowed to modify private DNS settings. * Specifies whether the user is allowed to modify private DNS settings.
* *
* <p>The default value is <code>false</code>. * <p>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.
* *
* <p>This user restriction can only be applied by the device owner or the profile owner * <p>The default value is <code>false</code>.
* of an organization-owned managed profile on the parent profile.
* *
* <p>Key for user restrictions. * <p>Key for user restrictions.
* <p>Type: Boolean * <p>Type: Boolean

View File

@@ -206,21 +206,9 @@ public class UserRestrictionsUtils {
*/ */
private static final Set<String> PROFILE_OWNER_ORGANIZATION_OWNED_GLOBAL_RESTRICTIONS = private static final Set<String> PROFILE_OWNER_ORGANIZATION_OWNED_GLOBAL_RESTRICTIONS =
Sets.newArraySet( Sets.newArraySet(
UserManager.DISALLOW_CONFIG_DATE_TIME,
UserManager.DISALLOW_CAMERA,
UserManager.DISALLOW_BLUETOOTH,
UserManager.DISALLOW_BLUETOOTH_SHARING,
UserManager.DISALLOW_CONFIG_CELL_BROADCASTS,
UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS,
UserManager.DISALLOW_CONFIG_PRIVATE_DNS,
UserManager.DISALLOW_CONFIG_TETHERING,
UserManager.DISALLOW_DATA_ROAMING,
UserManager.DISALLOW_SAFE_BOOT,
UserManager.DISALLOW_SMS,
UserManager.DISALLOW_USB_FILE_TRANSFER,
UserManager.DISALLOW_AIRPLANE_MODE, UserManager.DISALLOW_AIRPLANE_MODE,
UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA, UserManager.DISALLOW_CONFIG_DATE_TIME,
UserManager.DISALLOW_UNMUTE_MICROPHONE UserManager.DISALLOW_CONFIG_PRIVATE_DNS
); );
/** /**
@@ -236,7 +224,19 @@ public class UserRestrictionsUtils {
UserManager.DISALLOW_CONTENT_SUGGESTIONS, UserManager.DISALLOW_CONTENT_SUGGESTIONS,
UserManager.DISALLOW_DEBUGGING_FEATURES, UserManager.DISALLOW_DEBUGGING_FEATURES,
UserManager.DISALLOW_SHARE_LOCATION, UserManager.DISALLOW_SHARE_LOCATION,
UserManager.DISALLOW_OUTGOING_CALLS UserManager.DISALLOW_OUTGOING_CALLS,
UserManager.DISALLOW_CAMERA,
UserManager.DISALLOW_BLUETOOTH,
UserManager.DISALLOW_BLUETOOTH_SHARING,
UserManager.DISALLOW_CONFIG_CELL_BROADCASTS,
UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS,
UserManager.DISALLOW_CONFIG_TETHERING,
UserManager.DISALLOW_DATA_ROAMING,
UserManager.DISALLOW_SAFE_BOOT,
UserManager.DISALLOW_SMS,
UserManager.DISALLOW_USB_FILE_TRANSFER,
UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA,
UserManager.DISALLOW_UNMUTE_MICROPHONE
); );
/** /**

View File

@@ -1997,19 +1997,9 @@ public class DevicePolicyManagerTest extends DpmTestBase {
private static final Set<String> PROFILE_OWNER_ORGANIZATION_OWNED_GLOBAL_RESTRICTIONS = private static final Set<String> PROFILE_OWNER_ORGANIZATION_OWNED_GLOBAL_RESTRICTIONS =
Sets.newSet( Sets.newSet(
UserManager.DISALLOW_CONFIG_DATE_TIME,
UserManager.DISALLOW_BLUETOOTH_SHARING,
UserManager.DISALLOW_CONFIG_CELL_BROADCASTS,
UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS,
UserManager.DISALLOW_CONFIG_PRIVATE_DNS,
UserManager.DISALLOW_CONFIG_TETHERING,
UserManager.DISALLOW_DATA_ROAMING,
UserManager.DISALLOW_SAFE_BOOT,
UserManager.DISALLOW_SMS,
UserManager.DISALLOW_USB_FILE_TRANSFER,
UserManager.DISALLOW_AIRPLANE_MODE, UserManager.DISALLOW_AIRPLANE_MODE,
UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA, UserManager.DISALLOW_CONFIG_DATE_TIME,
UserManager.DISALLOW_UNMUTE_MICROPHONE UserManager.DISALLOW_CONFIG_PRIVATE_DNS
); );
private static final Set<String> PROFILE_OWNER_ORGANIZATION_OWNED_LOCAL_RESTRICTIONS = private static final Set<String> PROFILE_OWNER_ORGANIZATION_OWNED_LOCAL_RESTRICTIONS =
@@ -2021,7 +2011,17 @@ public class DevicePolicyManagerTest extends DpmTestBase {
UserManager.DISALLOW_CONTENT_SUGGESTIONS, UserManager.DISALLOW_CONTENT_SUGGESTIONS,
UserManager.DISALLOW_DEBUGGING_FEATURES, UserManager.DISALLOW_DEBUGGING_FEATURES,
UserManager.DISALLOW_SHARE_LOCATION, UserManager.DISALLOW_SHARE_LOCATION,
UserManager.DISALLOW_OUTGOING_CALLS UserManager.DISALLOW_OUTGOING_CALLS,
UserManager.DISALLOW_BLUETOOTH_SHARING,
UserManager.DISALLOW_CONFIG_CELL_BROADCASTS,
UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS,
UserManager.DISALLOW_CONFIG_TETHERING,
UserManager.DISALLOW_DATA_ROAMING,
UserManager.DISALLOW_SAFE_BOOT,
UserManager.DISALLOW_SMS,
UserManager.DISALLOW_USB_FILE_TRANSFER,
UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA,
UserManager.DISALLOW_UNMUTE_MICROPHONE
); );
public void testSetUserRestriction_asPoOfOrgOwnedDevice() throws Exception { public void testSetUserRestriction_asPoOfOrgOwnedDevice() throws Exception {
@@ -2045,8 +2045,9 @@ public class DevicePolicyManagerTest extends DpmTestBase {
parentDpm.setCameraDisabled(admin1, true); parentDpm.setCameraDisabled(admin1, true);
verify(getServices().userManagerInternal).setDevicePolicyUserRestrictions( verify(getServices().userManagerInternal).setDevicePolicyUserRestrictions(
eq(CALLER_USER_HANDLE), eq(CALLER_USER_HANDLE),
MockUtils.checkUserRestrictions(UserManager.DISALLOW_CAMERA), MockUtils.checkUserRestrictions(),
MockUtils.checkUserRestrictions(CALLER_USER_HANDLE), MockUtils.checkUserRestrictions(UserHandle.USER_SYSTEM,
UserManager.DISALLOW_CAMERA),
eq(false)); eq(false));
DpmTestUtils.assertRestrictions( DpmTestUtils.assertRestrictions(
DpmTestUtils.newRestrictions(UserManager.DISALLOW_CAMERA), DpmTestUtils.newRestrictions(UserManager.DISALLOW_CAMERA),