From 0c00033d4b9b915c2f035f1c01e82183a24842ea Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Thu, 4 Apr 2019 16:02:37 -0700 Subject: [PATCH] notifyEnabledOnKeyguardCallbacks when user switches The setting is per-user and the source of truth is in BiometricService. Keyguard's cache needs to be updated when user switch occurs Fixes: 5268106 Test: Builds Change-Id: I8a5678375989221e5b502fa683697cf4ca664def --- .../server/biometrics/BiometricService.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java index 2fee68ee2dcd5..0576e1d2d42b4 100644 --- a/services/core/java/com/android/server/biometrics/BiometricService.java +++ b/services/core/java/com/android/server/biometrics/BiometricService.java @@ -406,12 +406,7 @@ public class BiometricService extends SystemService { userId) != 0); if (userId == ActivityManager.getCurrentUser()) { - List callbacks = mEnabledOnKeyguardCallbacks; - for (int i = 0; i < callbacks.size(); i++) { - callbacks.get(i).notify(BiometricSourceType.FACE, - mFaceEnabledOnKeyguard.getOrDefault(userId, - DEFAULT_KEYGUARD_ENABLED)); - } + notifyEnabledOnKeyguardCallbacks(userId); } } else if (FACE_UNLOCK_APP_ENABLED.equals(uri)) { mFaceEnabledForApps.put(userId, Settings.Secure.getIntForUser( @@ -441,6 +436,15 @@ public class BiometricService extends SystemService { return mFaceAlwaysRequireConfirmation .getOrDefault(userId, DEFAULT_ALWAYS_REQUIRE_CONFIRMATION); } + + void notifyEnabledOnKeyguardCallbacks(int userId) { + List callbacks = mEnabledOnKeyguardCallbacks; + for (int i = 0; i < callbacks.size(); i++) { + callbacks.get(i).notify(BiometricSourceType.FACE, + mFaceEnabledOnKeyguard.getOrDefault(userId, + DEFAULT_KEYGUARD_ENABLED)); + } + } } private final class EnabledOnKeyguardCallback implements IBinder.DeathRecipient { @@ -809,6 +813,7 @@ public class BiometricService extends SystemService { @Override public void onUserSwitchComplete(int newUserId) { mSettingObserver.updateContentObserver(); + mSettingObserver.notifyEnabledOnKeyguardCallbacks(newUserId); } }, BiometricService.class.getName() );