Loading services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java +6 −17 Original line number Diff line number Diff line Loading @@ -69,7 +69,6 @@ import java.util.function.Supplier; class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> implements Udfps, LockoutConsumer, PowerPressHandler { private static final String TAG = "FingerprintAuthenticationClient"; private static final int MESSAGE_IGNORE_AUTH = 1; private static final int MESSAGE_AUTH_SUCCESS = 2; private static final int MESSAGE_FINGER_UP = 3; @NonNull Loading Loading @@ -235,12 +234,6 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> () -> { long delay = 0; if (authenticated && mSensorProps.isAnySidefpsType()) { if (mHandler.hasMessages(MESSAGE_IGNORE_AUTH)) { Slog.i(TAG, "(sideFPS) Ignoring auth due to recent power press"); onErrorInternal(BiometricConstants.BIOMETRIC_ERROR_POWER_PRESSED, 0, true); return; } delay = isKeyguard() ? mWaitForAuthKeyguard : mWaitForAuthBp; if (mSideFpsLastAcquireStartTime != -1) { Loading Loading @@ -497,16 +490,12 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> if (mSensorProps.isAnySidefpsType()) { Slog.i(TAG, "(sideFPS): onPowerPressed"); mHandler.post(() -> { if (mHandler.hasMessages(MESSAGE_AUTH_SUCCESS)) { Slog.i(TAG, "(sideFPS): Ignoring auth in queue"); Slog.i(TAG, "(sideFPS): finishing auth"); // Ignore auths after a power has been detected mHandler.removeMessages(MESSAGE_AUTH_SUCCESS); // Do not call onError() as that will send an additional callback to coex. onErrorInternal(BiometricConstants.BIOMETRIC_ERROR_POWER_PRESSED, 0, true); } mHandler.removeMessages(MESSAGE_IGNORE_AUTH); mHandler.postDelayed(() -> { }, MESSAGE_IGNORE_AUTH, mIgnoreAuthFor); mSensorOverlays.hide(getSensorId()); }); } } Loading services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -616,6 +616,20 @@ public class FingerprintAuthenticationClientTest { verify(mCallback).onClientFinished(any(), eq(true)); } @Test public void sideFpsPowerPressCancelsIsntantly() throws Exception { when(mSensorProps.isAnySidefpsType()).thenReturn(true); final FingerprintAuthenticationClient client = createClient(1); client.start(mCallback); client.onPowerPressed(); mLooper.dispatchAll(); verify(mCallback, never()).onClientFinished(any(), eq(true)); verify(mCallback).onClientFinished(any(), eq(false)); } private FingerprintAuthenticationClient createClient() throws RemoteException { return createClient(100 /* version */, true /* allowBackgroundAuthentication */); } Loading Loading
services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java +6 −17 Original line number Diff line number Diff line Loading @@ -69,7 +69,6 @@ import java.util.function.Supplier; class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> implements Udfps, LockoutConsumer, PowerPressHandler { private static final String TAG = "FingerprintAuthenticationClient"; private static final int MESSAGE_IGNORE_AUTH = 1; private static final int MESSAGE_AUTH_SUCCESS = 2; private static final int MESSAGE_FINGER_UP = 3; @NonNull Loading Loading @@ -235,12 +234,6 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> () -> { long delay = 0; if (authenticated && mSensorProps.isAnySidefpsType()) { if (mHandler.hasMessages(MESSAGE_IGNORE_AUTH)) { Slog.i(TAG, "(sideFPS) Ignoring auth due to recent power press"); onErrorInternal(BiometricConstants.BIOMETRIC_ERROR_POWER_PRESSED, 0, true); return; } delay = isKeyguard() ? mWaitForAuthKeyguard : mWaitForAuthBp; if (mSideFpsLastAcquireStartTime != -1) { Loading Loading @@ -497,16 +490,12 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> if (mSensorProps.isAnySidefpsType()) { Slog.i(TAG, "(sideFPS): onPowerPressed"); mHandler.post(() -> { if (mHandler.hasMessages(MESSAGE_AUTH_SUCCESS)) { Slog.i(TAG, "(sideFPS): Ignoring auth in queue"); Slog.i(TAG, "(sideFPS): finishing auth"); // Ignore auths after a power has been detected mHandler.removeMessages(MESSAGE_AUTH_SUCCESS); // Do not call onError() as that will send an additional callback to coex. onErrorInternal(BiometricConstants.BIOMETRIC_ERROR_POWER_PRESSED, 0, true); } mHandler.removeMessages(MESSAGE_IGNORE_AUTH); mHandler.postDelayed(() -> { }, MESSAGE_IGNORE_AUTH, mIgnoreAuthFor); mSensorOverlays.hide(getSensorId()); }); } } Loading
services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -616,6 +616,20 @@ public class FingerprintAuthenticationClientTest { verify(mCallback).onClientFinished(any(), eq(true)); } @Test public void sideFpsPowerPressCancelsIsntantly() throws Exception { when(mSensorProps.isAnySidefpsType()).thenReturn(true); final FingerprintAuthenticationClient client = createClient(1); client.start(mCallback); client.onPowerPressed(); mLooper.dispatchAll(); verify(mCallback, never()).onClientFinished(any(), eq(true)); verify(mCallback).onClientFinished(any(), eq(false)); } private FingerprintAuthenticationClient createClient() throws RemoteException { return createClient(100 /* version */, true /* allowBackgroundAuthentication */); } Loading