Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a5adc3d authored by Austin Delgado's avatar Austin Delgado Committed by Ilya Matyukhin
Browse files

Add tryDismissingKeyguard() to UdfpsController

Moved duplicate code into shared functions.

Bug: 218374828
Test: atest SystemUITests
Change-Id: I690cb0a6e7d319e40cdadaf2003c160356de20c9
parent 96c49780
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -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.