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

Commit 3c26b8f9 authored by Eran Messeri's avatar Eran Messeri
Browse files

Remove unnecessary WTFs from password state check

It is possible to have null PasswordMetrics object for a given user -
if, for example, the user never had a password set.

Do not WTF in that case.

Bug: 78191197
Test: That it compiles.
Change-Id: I807c2755890b0772e295b4cb0095cac1bf2d0aef
parent 519249f4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -3958,8 +3958,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        DevicePolicyData policy = getUserData(credentialOwner);
        PasswordMetrics metrics = getUserPasswordMetricsLocked(credentialOwner);
        if (metrics == null) {
            Slog.wtf(LOG_TAG, "Should have had a valid password metrics for updating checkpoint " +
                    "validity.");
            metrics = new PasswordMetrics();
        }
        policy.mPasswordValidAtLastCheckpoint =
@@ -4508,7 +4506,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
        if (metrics == null) {
            Slog.wtf(LOG_TAG, "FBE device, should have been unlocked and had valid metrics.");
            // This could happen if the user never had a password set, for example, so
            // setActivePasswordState has never been called for it.
            metrics = new PasswordMetrics();
        }
        return isPasswordSufficientForUserWithoutCheckpointLocked(metrics, userHandle, parent);