From 3c41539eaab6463ef5796d7025a5f4e028036394 Mon Sep 17 00:00:00 2001 From: Hao Dong Date: Fri, 16 Dec 2022 02:45:11 +0000 Subject: [PATCH] Fix UI bugs for udfps enroll in settings. When the finger is down on the screen and the lighting circle on the sensor is shown, the fingerprint icon is not hidden. - Udfps enroll view needs to get the touch event on sensor. This CL propagates FingerprintManager#onPointerDown and #onPointer to mEnrollmentCallback, which will finally notifies settings. However, when AlternateUdfpsTouchProvider is used in UdfpsController, settings doesn't get #onPointerDown and #onPointer. b/263409677 is tracking this. Test: manually tested on device: Turn this flag on via adb command adb shell setprop sys.fflag.override.settings_show_udfps_enroll_in_settings true Bug: 260617060 Change-Id: I15581ca1c42cd0213910e50bc81d934ceea354a3 --- .../fingerprint/FingerprintManager.java | 27 +++++++++++++++---- .../aidl/FingerprintEnrollClient.java | 8 ++++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java index 04a204a09f5e9..b24b30e33f17a 100644 --- a/core/java/android/hardware/fingerprint/FingerprintManager.java +++ b/core/java/android/hardware/fingerprint/FingerprintManager.java @@ -470,6 +470,16 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing * @param isAcquiredGood whether the fingerprint image was good. */ public void onAcquired(boolean isAcquiredGood){ } + + /** + * Called when a pointer down event has occurred. + */ + public void onPointerDown(int sensorId){ } + + /** + * Called when a pointer up event has occurred. + */ + public void onPointerUp(int sensorId){ } } /** @@ -1398,7 +1408,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing if (mAuthenticationCallback != null) { mAuthenticationCallback.onAuthenticationAcquired(acquireInfo); } - if (mEnrollmentCallback != null) { + if (mEnrollmentCallback != null && acquireInfo != FINGERPRINT_ACQUIRED_START) { mEnrollmentCallback.onAcquired(acquireInfo == FINGERPRINT_ACQUIRED_GOOD); } final String msg = getAcquiredString(mContext, acquireInfo, vendorCode); @@ -1454,17 +1464,24 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing private void sendUdfpsPointerDown(int sensorId) { if (mAuthenticationCallback == null) { Slog.e(TAG, "sendUdfpsPointerDown, callback null"); - return; + } else { + mAuthenticationCallback.onUdfpsPointerDown(sensorId); + } + + if (mEnrollmentCallback != null) { + mEnrollmentCallback.onPointerDown(sensorId); } - mAuthenticationCallback.onUdfpsPointerDown(sensorId); } private void sendUdfpsPointerUp(int sensorId) { if (mAuthenticationCallback == null) { Slog.e(TAG, "sendUdfpsPointerUp, callback null"); - return; + } else { + mAuthenticationCallback.onUdfpsPointerUp(sensorId); + } + if (mEnrollmentCallback != null) { + mEnrollmentCallback.onPointerUp(sensorId); } - mAuthenticationCallback.onUdfpsPointerUp(sensorId); } private void sendPowerPressed() { diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java index 2ac8b433b3af2..513b3e3e6e86c 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java @@ -230,6 +230,10 @@ class FingerprintEnrollClient extends EnrollClient implements Udfps session.getSession().onPointerDown(pc.pointerId, (int) pc.x, (int) pc.y, pc.minor, pc.major); } + + if (getListener() != null) { + getListener().onUdfpsPointerDown(getSensorId()); + } } catch (RemoteException e) { Slog.e(TAG, "Unable to send pointer down", e); } @@ -246,6 +250,10 @@ class FingerprintEnrollClient extends EnrollClient implements Udfps } else { session.getSession().onPointerUp(pc.pointerId); } + + if (getListener() != null) { + getListener().onUdfpsPointerUp(getSensorId()); + } } catch (RemoteException e) { Slog.e(TAG, "Unable to send pointer up", e); }