From b224622c29679e83ac4b42bc7ae6553456391629 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Thu, 11 Jul 2019 15:01:26 -0700 Subject: Do task stack work on handler to ensure in-order execution The rest of the ClientMonitor work is done on a handler to guarantee in-order execution. e.g. setting to null when auth completes, updating mCurrentClient when new client is requested, etc. Put this work on the same handler. Fixes: 137237140 Test: BiometricPromptDemo, go home while authenticating multiple times; no crash observed Change-Id: I43126ce13fb88d751571d0d52fe594c0293f794c --- .../android/server/biometrics/BiometricServiceBase.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java index 0c4f0bd0edc6..f08423eb2016 100644 --- a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java +++ b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java @@ -497,9 +497,9 @@ public abstract class BiometricServiceBase extends SystemService } } - private final class BiometricTaskStackListener extends TaskStackListener { + private final Runnable mOnTaskStackChangedRunnable = new Runnable() { @Override - public void onTaskStackChanged() { + public void run() { try { if (!(mCurrentClient instanceof AuthenticationClient)) { return; @@ -514,8 +514,8 @@ public abstract class BiometricServiceBase extends SystemService final String topPackage = runningTasks.get(0).topActivity.getPackageName(); if (!topPackage.contentEquals(currentClient) && !mCurrentClient.isAlreadyDone()) { - Slog.e(getTag(), "Stopping background authentication, top: " + topPackage - + " currentClient: " + currentClient); + Slog.e(getTag(), "Stopping background authentication, top: " + + topPackage + " currentClient: " + currentClient); mCurrentClient.stop(false /* initiatedByClient */); } } @@ -523,6 +523,13 @@ public abstract class BiometricServiceBase extends SystemService Slog.e(getTag(), "Unable to get running tasks", e); } } + }; + + private final class BiometricTaskStackListener extends TaskStackListener { + @Override + public void onTaskStackChanged() { + mHandler.post(mOnTaskStackChangedRunnable); + } } private final class ResetClientStateRunnable implements Runnable { -- cgit v1.2.3-59-g8ed1b From d038189709427aecffb84a3e83086f09f46bc714 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Thu, 11 Jul 2019 16:25:36 -0700 Subject: Reset mSecureCameraLaunched when bouncer is shown Whenever the bouncer is shown, face auth should start again. Fixes: 137228869 Test: Install test camera app that's available on lockscreen, double tap power to launch camera on lock screen. Bouncer is shown, and face unlock works Change-Id: Ia33075935c6d8413ab7c9351739cca67bb81c377 --- .../src/com/android/keyguard/KeyguardUpdateMonitor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 05e14a779a17..2eb93d3a6075 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -2203,6 +2203,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { if (DEBUG) Log.d(TAG, "handleKeyguardBouncerChanged(" + bouncer + ")"); boolean isBouncer = (bouncer == 1); mBouncer = isBouncer; + + if (isBouncer) { + // If the bouncer is shown, always clear this flag. This can happen in the following + // situations: 1) Default camera with SHOW_WHEN_LOCKED is not chosen yet. 2) Secure + // camera requests dismiss keyguard (tapping on photos for example). When these happen, + // face auth should resume. + mSecureCameraLaunched = false; + } + for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { @@ -2649,6 +2658,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags)); pw.println(" trustManaged=" + getUserTrustIsManaged(userId)); pw.println(" enabledByUser=" + mFaceSettingEnabledForUser); + pw.println(" mSecureCameraLaunched=" + mSecureCameraLaunched); } } } -- cgit v1.2.3-59-g8ed1b