From 3c26b8f92e1de8ce91d867c44423c8397d9c7dd2 Mon Sep 17 00:00:00 2001 From: Eran Messeri Date: Mon, 23 Apr 2018 16:06:04 +0100 Subject: [PATCH] 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 --- .../server/devicepolicy/DevicePolicyManagerService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index e07b89f232b1f..49d44da9e577a 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -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);