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

Commit 1383da0c authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas
Browse files

Reset `mShouldClick` on ACTION_CANCEL event so click is not performed

`mShouldClick` is set to true during ACTION_DOWN event. However if
this event is interrupted or cancelled `mShouldClick` remains true so the
click is performed when the ACTION_CANCEL case is caught. Instead we
should rest `mShouldClick` to false if a motion even occurs and is
interrupted. So the click is only performed due to an ACTION_UP event.

Fix: 296921322
Test: manual
Change-Id: I9cac00ad39f1ef589eee116480d293feff4d2a11
parent 22daeee1
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -530,6 +530,11 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
            if (mGestureDetector.onTouchEvent(e)) {
            if (mGestureDetector.onTouchEvent(e)) {
                return true;
                return true;
            }
            }
            if (e.getActionMasked() == MotionEvent.ACTION_CANCEL) {
                // If a motion event is cancelled, reset mShouldClick so a click is not accidentally
                // performed.
                mShouldClick = false;
            }
            switch (e.getActionMasked()) {
            switch (e.getActionMasked()) {
                case MotionEvent.ACTION_DOWN: {
                case MotionEvent.ACTION_DOWN: {
                    mDragPointerId = e.getPointerId(0);
                    mDragPointerId = e.getPointerId(0);