Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0360f4ec authored by Eran Messeri's avatar Eran Messeri Committed by Android (Google) Code Review
Browse files

Merge "COPE: Allow use of password quality API"

parents 23ac0f8f 0be80ff9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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.
     *
+4 −3
Original line number Diff line number Diff line
@@ -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) {
@@ -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");