From 2a5adc3dfe82262b821466cabbfdc1bf885dcde6 Mon Sep 17 00:00:00 2001 From: Austin Delgado Date: Thu, 18 Aug 2022 20:58:34 +0000 Subject: [PATCH] Add tryDismissingKeyguard() to UdfpsController Moved duplicate code into shared functions. Bug: 218374828 Test: atest SystemUITests Change-Id: I690cb0a6e7d319e40cdadaf2003c160356de20c9 --- .../systemui/biometrics/UdfpsController.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java index 45595c80d36d3..0ff1ed616715a 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -434,6 +434,14 @@ public class UdfpsController implements DozeReceiver, Dumpable { return portraitTouch; } + private void tryDismissingKeyguard() { + if (!mOnFingerDown) { + playStartHaptic(); + } + mKeyguardViewManager.notifyKeyguardAuthenticated(false /* strongAuth */); + mAttemptedToDismissKeyguard = true; + } + @VisibleForTesting boolean onTouch(long requestId, @NonNull MotionEvent event, boolean fromUdfpsView) { if (mOverlay == null) { @@ -495,11 +503,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { } if ((withinSensorArea || fromUdfpsView) && shouldTryToDismissKeyguard()) { Log.v(TAG, "onTouch | dismiss keyguard ACTION_DOWN"); - if (!mOnFingerDown) { - playStartHaptic(); - } - mKeyguardViewManager.notifyKeyguardAuthenticated(false /* strongAuth */); - mAttemptedToDismissKeyguard = true; + tryDismissingKeyguard(); } Trace.endSection(); @@ -534,11 +538,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { if ((fromUdfpsView || actionMoveWithinSensorArea) && shouldTryToDismissKeyguard()) { Log.v(TAG, "onTouch | dismiss keyguard ACTION_MOVE"); - if (!mOnFingerDown) { - playStartHaptic(); - } - mKeyguardViewManager.notifyKeyguardAuthenticated(false /* strongAuth */); - mAttemptedToDismissKeyguard = true; + tryDismissingKeyguard(); break; } // Map the touch to portrait mode if the device is in landscape mode.