From ea80d17cb65e69457e169b0595094893ebabd494 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Wed, 3 Apr 2019 14:39:04 -0700 Subject: [PATCH] Fix enumerate corner case Do not post reset runnable when another client is requested while cleanup is happening. The runnable will be "pending" and started once cleanup finishes instead. Fixes: 129534163 Test: Based on logs in the bug, this is reasonable Test: reboot device, fingerprint still works Change-Id: I766cc04be151abaae60a0092f71fd7a3acf3397a --- .../server/biometrics/BiometricServiceBase.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java index c60dd6ca130a9..0809a958a037a 100644 --- a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java +++ b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java @@ -1044,10 +1044,15 @@ public abstract class BiometricServiceBase extends SystemService } } else { currentClient.stop(initiatedByClient); + + // Only post the reset runnable for non-cleanup clients. Cleanup clients should + // never be forcibly stopped since they ensure synchronization between HAL and + // framework. Thus, we should instead just start the pending client once cleanup + // finishes instead of using the reset runnable. + mHandler.removeCallbacks(mResetClientState); + mHandler.postDelayed(mResetClientState, CANCEL_TIMEOUT_LIMIT); } mPendingClient = newClient; - mHandler.removeCallbacks(mResetClientState); - mHandler.postDelayed(mResetClientState, CANCEL_TIMEOUT_LIMIT); } else if (newClient != null) { // For BiometricPrompt clients, do not start until // Service#startPreparedClient is called. BiometricService waits until all @@ -1224,6 +1229,7 @@ public abstract class BiometricServiceBase extends SystemService } else { clearEnumerateState(); if (mPendingClient != null) { + Slog.d(getTag(), "Enumerate finished, starting pending client"); startClient(mPendingClient, false /* initiatedByClient */); } }