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

Commit da781ccc authored by Rubin Xu's avatar Rubin Xu Committed by android-build-merger
Browse files

Merge "Merge "Always treat password as sufficient if no password policy is...

Merge "Merge "Always treat password as sufficient if no password policy is set" into oc-mr1-dev am: f72a2f2c" into oc-mr1-dev-plus-aosp
am: 81efd59e

Change-Id: Ib8e1b7df0d85c960f028c9db98554a935d068d27
parents 955c04ed 81efd59e
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -4130,6 +4130,16 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {


    private boolean isActivePasswordSufficientForUserLocked(
    private boolean isActivePasswordSufficientForUserLocked(
            DevicePolicyData policy, int userHandle, boolean parent) {
            DevicePolicyData policy, int userHandle, boolean parent) {
        final int requiredPasswordQuality = getPasswordQuality(null, userHandle, parent);
        if (requiredPasswordQuality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
            // A special case is when there is no required password quality, then we just return
            // true since any password would be sufficient. This is for the scenario when a work
            // profile is first created so there is no information about the current password but
            // it should be considered sufficient as there is no password requirement either.
            // This is useful since it short-circuits the password checkpoint for FDE device below.
            return true;
        }

        if (!mInjector.storageManagerIsFileBasedEncryptionEnabled()
        if (!mInjector.storageManagerIsFileBasedEncryptionEnabled()
                && !policy.mPasswordStateHasBeenSetSinceBoot) {
                && !policy.mPasswordStateHasBeenSetSinceBoot) {
            // Before user enters their password for the first time after a reboot, return the
            // Before user enters their password for the first time after a reboot, return the
@@ -4140,7 +4150,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            return policy.mPasswordValidAtLastCheckpoint;
            return policy.mPasswordValidAtLastCheckpoint;
        }
        }


        final int requiredPasswordQuality = getPasswordQuality(null, userHandle, parent);
        if (policy.mActivePasswordMetrics.quality < requiredPasswordQuality) {
        if (policy.mActivePasswordMetrics.quality < requiredPasswordQuality) {
            return false;
            return false;
        }
        }