Loading services/core/java/com/android/server/pm/UserRestrictionsUtils.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -273,7 +273,8 @@ public class UserRestrictionsUtils { * in settings. So it is handled separately. * in settings. So it is handled separately. */ */ private static final Set<String> DEFAULT_ENABLED_FOR_MANAGED_PROFILES = Sets.newArraySet( private static final Set<String> DEFAULT_ENABLED_FOR_MANAGED_PROFILES = Sets.newArraySet( UserManager.DISALLOW_BLUETOOTH_SHARING UserManager.DISALLOW_BLUETOOTH_SHARING, UserManager.DISALLOW_DEBUGGING_FEATURES ); ); /** /** Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -8872,7 +8872,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { return false; return false; } } if (isAdb(caller)) { boolean isAdb = isAdb(caller); if (isAdb) { // Log profile owner provisioning was started using adb. // Log profile owner provisioning was started using adb. MetricsLogger.action(mContext, PROVISIONING_ENTRY_POINT_ADB, LOG_TAG_PROFILE_OWNER); MetricsLogger.action(mContext, PROVISIONING_ENTRY_POINT_ADB, LOG_TAG_PROFILE_OWNER); DevicePolicyEventLogger DevicePolicyEventLogger Loading @@ -8895,6 +8896,17 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { UserRestrictionsUtils.getDefaultEnabledForManagedProfiles()); UserRestrictionsUtils.getDefaultEnabledForManagedProfiles()); ensureUnknownSourcesRestrictionForProfileOwnerLocked(userHandle, admin, ensureUnknownSourcesRestrictionForProfileOwnerLocked(userHandle, admin, true /* newOwner */); true /* newOwner */); if (isAdb) { // DISALLOW_DEBUGGING_FEATURES is being added to newly-created // work profile by default due to b/382064697 . This would have // impacted certain CTS test flows when they interact with the // work profile via ADB (for example installing an app into the // work profile). Remove DISALLOW_DEBUGGING_FEATURES here to // reduce the potential impact. admin.ensureUserRestrictions().putBoolean( UserManager.DISALLOW_DEBUGGING_FEATURES, false); saveUserRestrictionsLocked(userHandle); } } } sendOwnerChangedBroadcast(DevicePolicyManager.ACTION_PROFILE_OWNER_CHANGED, sendOwnerChangedBroadcast(DevicePolicyManager.ACTION_PROFILE_OWNER_CHANGED, userHandle); userHandle); Loading services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -131,6 +131,7 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { // Check that default restrictions were applied. // Check that default restrictions were applied. DpmTestUtils.assertRestrictions( DpmTestUtils.assertRestrictions( DpmTestUtils.newRestrictions( DpmTestUtils.newRestrictions( UserManager.DISALLOW_DEBUGGING_FEATURES, UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, UserManager.DISALLOW_BLUETOOTH_SHARING UserManager.DISALLOW_BLUETOOTH_SHARING ), ), Loading @@ -138,8 +139,9 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { final Set<String> alreadySet = final Set<String> alreadySet = dpms.getProfileOwnerAdminLocked(10).defaultEnabledRestrictionsAlreadySet; dpms.getProfileOwnerAdminLocked(10).defaultEnabledRestrictionsAlreadySet; assertThat(alreadySet).hasSize(1); assertThat(alreadySet).hasSize(2); assertThat(alreadySet.contains(UserManager.DISALLOW_BLUETOOTH_SHARING)).isTrue(); assertThat(alreadySet.contains(UserManager.DISALLOW_BLUETOOTH_SHARING)).isTrue(); assertThat(alreadySet.contains(UserManager.DISALLOW_DEBUGGING_FEATURES)).isTrue(); } } @SmallTest @SmallTest Loading Loading
services/core/java/com/android/server/pm/UserRestrictionsUtils.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -273,7 +273,8 @@ public class UserRestrictionsUtils { * in settings. So it is handled separately. * in settings. So it is handled separately. */ */ private static final Set<String> DEFAULT_ENABLED_FOR_MANAGED_PROFILES = Sets.newArraySet( private static final Set<String> DEFAULT_ENABLED_FOR_MANAGED_PROFILES = Sets.newArraySet( UserManager.DISALLOW_BLUETOOTH_SHARING UserManager.DISALLOW_BLUETOOTH_SHARING, UserManager.DISALLOW_DEBUGGING_FEATURES ); ); /** /** Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -8872,7 +8872,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { return false; return false; } } if (isAdb(caller)) { boolean isAdb = isAdb(caller); if (isAdb) { // Log profile owner provisioning was started using adb. // Log profile owner provisioning was started using adb. MetricsLogger.action(mContext, PROVISIONING_ENTRY_POINT_ADB, LOG_TAG_PROFILE_OWNER); MetricsLogger.action(mContext, PROVISIONING_ENTRY_POINT_ADB, LOG_TAG_PROFILE_OWNER); DevicePolicyEventLogger DevicePolicyEventLogger Loading @@ -8895,6 +8896,17 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { UserRestrictionsUtils.getDefaultEnabledForManagedProfiles()); UserRestrictionsUtils.getDefaultEnabledForManagedProfiles()); ensureUnknownSourcesRestrictionForProfileOwnerLocked(userHandle, admin, ensureUnknownSourcesRestrictionForProfileOwnerLocked(userHandle, admin, true /* newOwner */); true /* newOwner */); if (isAdb) { // DISALLOW_DEBUGGING_FEATURES is being added to newly-created // work profile by default due to b/382064697 . This would have // impacted certain CTS test flows when they interact with the // work profile via ADB (for example installing an app into the // work profile). Remove DISALLOW_DEBUGGING_FEATURES here to // reduce the potential impact. admin.ensureUserRestrictions().putBoolean( UserManager.DISALLOW_DEBUGGING_FEATURES, false); saveUserRestrictionsLocked(userHandle); } } } sendOwnerChangedBroadcast(DevicePolicyManager.ACTION_PROFILE_OWNER_CHANGED, sendOwnerChangedBroadcast(DevicePolicyManager.ACTION_PROFILE_OWNER_CHANGED, userHandle); userHandle); Loading
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -131,6 +131,7 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { // Check that default restrictions were applied. // Check that default restrictions were applied. DpmTestUtils.assertRestrictions( DpmTestUtils.assertRestrictions( DpmTestUtils.newRestrictions( DpmTestUtils.newRestrictions( UserManager.DISALLOW_DEBUGGING_FEATURES, UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, UserManager.DISALLOW_BLUETOOTH_SHARING UserManager.DISALLOW_BLUETOOTH_SHARING ), ), Loading @@ -138,8 +139,9 @@ public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase { final Set<String> alreadySet = final Set<String> alreadySet = dpms.getProfileOwnerAdminLocked(10).defaultEnabledRestrictionsAlreadySet; dpms.getProfileOwnerAdminLocked(10).defaultEnabledRestrictionsAlreadySet; assertThat(alreadySet).hasSize(1); assertThat(alreadySet).hasSize(2); assertThat(alreadySet.contains(UserManager.DISALLOW_BLUETOOTH_SHARING)).isTrue(); assertThat(alreadySet.contains(UserManager.DISALLOW_BLUETOOTH_SHARING)).isTrue(); assertThat(alreadySet.contains(UserManager.DISALLOW_DEBUGGING_FEATURES)).isTrue(); } } @SmallTest @SmallTest Loading