Add tryDismissingKeyguard() to UdfpsController

Moved duplicate code into shared functions.

Bug: 218374828
Test: atest SystemUITests
Change-Id: I690cb0a6e7d319e40cdadaf2003c160356de20c9
This commit is contained in:
Austin Delgado
2022-08-18 20:58:34 +00:00
committed by Ilya Matyukhin
parent 96c4978054
commit 2a5adc3dfe

View File

@@ -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.