Loading core/java/android/app/admin/DevicePolicyManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -3025,7 +3025,9 @@ public class DevicePolicyManager { * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the * {@link DevicePolicyManager} instance returned by * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent * profile. Apps targeting {@link android.os.Build.VERSION_CODES#S} and above will get a * profile. Apps targeting {@link android.os.Build.VERSION_CODES#S} and above, with the * exception of a profile owner on an organization-owned device (as can be identified by * {@link #isOrganizationOwnedDeviceWithManagedProfile}), will get a * {@code IllegalArgumentException} when calling this method on the parent * {@link DevicePolicyManager} instance. * Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +4 −3 Original line number Diff line number Diff line Loading @@ -3410,9 +3410,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { getTargetSdk(profileOwner.getPackageName(), userHandle) > Build.VERSION_CODES.M; } private boolean canSetPasswordQualityOnParent(String packageName, int userId) { private boolean canSetPasswordQualityOnParent(String packageName, final CallerIdentity caller) { return !mInjector.isChangeEnabled( PREVENT_SETTING_PASSWORD_QUALITY_ON_PARENT, packageName, userId); PREVENT_SETTING_PASSWORD_QUALITY_ON_PARENT, packageName, caller.getUserId()) || isProfileOwnerOfOrganizationOwnedDevice(caller); } private boolean isPasswordLimitingAdminTargetingP(CallerIdentity caller) { Loading Loading @@ -3441,7 +3442,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { || isPasswordLimitingAdminTargetingP(caller)); final boolean qualityMayApplyToParent = canSetPasswordQualityOnParent(who.getPackageName(), caller.getUserId()); canSetPasswordQualityOnParent(who.getPackageName(), caller); if (!qualityMayApplyToParent) { Preconditions.checkCallAuthorization(!parent, "Profile Owner may not apply password quality requirements device-wide"); Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -3025,7 +3025,9 @@ public class DevicePolicyManager { * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the * {@link DevicePolicyManager} instance returned by * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent * profile. Apps targeting {@link android.os.Build.VERSION_CODES#S} and above will get a * profile. Apps targeting {@link android.os.Build.VERSION_CODES#S} and above, with the * exception of a profile owner on an organization-owned device (as can be identified by * {@link #isOrganizationOwnedDeviceWithManagedProfile}), will get a * {@code IllegalArgumentException} when calling this method on the parent * {@link DevicePolicyManager} instance. * Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +4 −3 Original line number Diff line number Diff line Loading @@ -3410,9 +3410,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { getTargetSdk(profileOwner.getPackageName(), userHandle) > Build.VERSION_CODES.M; } private boolean canSetPasswordQualityOnParent(String packageName, int userId) { private boolean canSetPasswordQualityOnParent(String packageName, final CallerIdentity caller) { return !mInjector.isChangeEnabled( PREVENT_SETTING_PASSWORD_QUALITY_ON_PARENT, packageName, userId); PREVENT_SETTING_PASSWORD_QUALITY_ON_PARENT, packageName, caller.getUserId()) || isProfileOwnerOfOrganizationOwnedDevice(caller); } private boolean isPasswordLimitingAdminTargetingP(CallerIdentity caller) { Loading Loading @@ -3441,7 +3442,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { || isPasswordLimitingAdminTargetingP(caller)); final boolean qualityMayApplyToParent = canSetPasswordQualityOnParent(who.getPackageName(), caller.getUserId()); canSetPasswordQualityOnParent(who.getPackageName(), caller); if (!qualityMayApplyToParent) { Preconditions.checkCallAuthorization(!parent, "Profile Owner may not apply password quality requirements device-wide"); Loading