Update profile owner of org-owned device global restrictions

Added user restrictions to the list of user restrictions that are
applied globally when set on the parent profile DPM instance
by the profile owner of an organization-owned device.

Bug: 148437699
Test: atest com.android.server.pm.UserRestrictionsUtilsTest
      atest com.android.server.devicepolicy.DevicePolicyManagerTest
      atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testDevicePolicyManagerParentSupport
      atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testUserRestrictionsSetOnParentAreEnforced

Change-Id: Ic202524d5bc643f9704c98d6c5d60c206d9b663a
This commit is contained in:
Alex Johnston
2020-01-28 16:15:55 +00:00
parent 4e09642d50
commit 9722abe539
3 changed files with 38 additions and 15 deletions

View File

@@ -290,10 +290,12 @@ public class UserManager {
/**
* Specifies if airplane mode is disallowed on the device.
*
* <p> This restriction can only be set by the device owner and the profile owner on the
* primary user and it applies globally - i.e. it disables airplane mode on the entire device.
* <p>The default value is <code>false</code>.
* <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 airplane mode on the entire device.
* <p>
* The default value is <code>false</code>.
*
* <p>Key for user restrictions.
* <p>Type: Boolean
@@ -729,9 +731,12 @@ public class UserManager {
public static final String DISALLOW_APPS_CONTROL = "no_control_apps";
/**
* Specifies if a user is disallowed from mounting
* physical external media. This can only be set by device owners and profile owners on the
* primary user. The default value is <code>false</code>.
* 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
* or the profile owner of an organization-owned managed profile on the parent profile.
* <p>
* The default value is <code>false</code>.
*
* <p>Key for user restrictions.
* <p>Type: Boolean
@@ -743,10 +748,15 @@ public class UserManager {
/**
* Specifies if a user is disallowed from adjusting microphone volume. If set, the microphone
* will be muted. This can be set by device owners and profile owners. The default value is
* <code>false</code>.
* will be muted.
* <p>
* The default value is <code>false</code>.
* <p>
* Device owner and profile owner can set this restriction, although the restriction has no
* effect in a managed profile. When it is set by the profile owner of an organization-owned
* managed profile on the parent profile, it will disallow the personal user from adjusting the
* microphone volume.
*
* <p>This restriction has no effect on managed profiles.
* <p>Key for user restrictions.
* <p>Type: Boolean
* @see DevicePolicyManager#addUserRestriction(ComponentName, String)
@@ -773,10 +783,15 @@ public class UserManager {
public static final String DISALLOW_ADJUST_VOLUME = "no_adjust_volume";
/**
* Specifies that the user is not allowed to make outgoing
* phone calls. Emergency calls are still permitted.
* Specifies that the user is not allowed to make outgoing phone calls. Emergency calls are
* still permitted.
* <p>
* The default value is <code>false</code>.
* <p>This restriction has no effect on managed profiles.
* <p>
* Device owner and profile owner can set this restriction, although the restriction has no
* effect in a managed profile. When it is set by the profile owner of an organization-owned
* managed profile on the parent profile, it will disallow the personal user from making
* outgoing phone calls.
*
* <p>Key for user restrictions.
* <p>Type: Boolean

View File

@@ -223,7 +223,11 @@ public class UserRestrictionsUtils {
UserManager.DISALLOW_SAFE_BOOT,
UserManager.DISALLOW_SHARE_LOCATION,
UserManager.DISALLOW_SMS,
UserManager.DISALLOW_USB_FILE_TRANSFER
UserManager.DISALLOW_USB_FILE_TRANSFER,
UserManager.DISALLOW_AIRPLANE_MODE,
UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA,
UserManager.DISALLOW_OUTGOING_CALLS,
UserManager.DISALLOW_UNMUTE_MICROPHONE
);
/**

View File

@@ -1986,7 +1986,11 @@ public class DevicePolicyManagerTest extends DpmTestBase {
UserManager.DISALLOW_SAFE_BOOT,
UserManager.DISALLOW_SHARE_LOCATION,
UserManager.DISALLOW_SMS,
UserManager.DISALLOW_USB_FILE_TRANSFER
UserManager.DISALLOW_USB_FILE_TRANSFER,
UserManager.DISALLOW_AIRPLANE_MODE,
UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA,
UserManager.DISALLOW_OUTGOING_CALLS,
UserManager.DISALLOW_UNMUTE_MICROPHONE
);
public void testSetUserRestriction_asPoOfOrgOwnedDevice() throws Exception {