From 93a98d862fbf90af9e3b5945d2ca613d8ec62fe9 Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Tue, 10 May 2022 08:45:28 +0200 Subject: [PATCH] Change a nullable get to getOrDefault(,false) Implicitly casting from a Map<,Boolean> to a boolean will cause a NullPointerException if the map isn't populated yet. The default should be false because this is more conservative with respect to how users are allowed to unlock their device if the real information isn't available yet (or won't be available because the device doesn't have a keyguard yet still calls this API). Test: adb reboot; adb logcat | grep NullPointerException Fix: 231987867 Change-Id: Ie631286a30eaa1d9db36d8a149b9165df292429d --- .../src/com/android/keyguard/KeyguardUpdateMonitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 121ac299ec5b0..59dc2be8380bf 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -2795,7 +2795,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab * Note: checking fingerprint enrollment directly with the AuthController requires an IPC. */ public boolean getCachedIsUnlockWithFingerprintPossible(int userId) { - return mIsUnlockWithFingerprintPossible.get(userId); + return mIsUnlockWithFingerprintPossible.getOrDefault(userId, false); } private boolean isUnlockWithFacePossible(int userId) {