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

Commit 6cc467e0 authored by Eugene Susla's avatar Eugene Susla
Browse files

Treat ACTION_CANCEL as ACTION_UP for magnification

Having an ACTION_CANCEL occur is a way to trigger b/68214834

Bug: 68214834
Test: Magnificastion CTS tests
Change-Id: I9b1ead33de100a18b37cc557c1111749a2bd9073
parent 5a6a5417
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.accessibility;

import static android.view.InputDevice.SOURCE_TOUCHSCREEN;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;
import static android.view.MotionEvent.ACTION_POINTER_DOWN;
@@ -364,7 +365,7 @@ class MagnificationGestureHandler extends BaseEventStreamTransformation {

                persistScaleAndTransitionTo(mViewportDraggingState);

            } else if (action == ACTION_UP) {
            } else if (action == ACTION_UP || action == ACTION_CANCEL) {

                persistScaleAndTransitionTo(mDetectingState);

@@ -496,7 +497,9 @@ class MagnificationGestureHandler extends BaseEventStreamTransformation {
                    }
                }
                break;
                case ACTION_UP: {

                case ACTION_UP:
                case ACTION_CANCEL: {
                    if (!mZoomedInBeforeDrag) zoomOff();
                    clear();
                    transitionTo(mDetectingState);
@@ -533,12 +536,15 @@ class MagnificationGestureHandler extends BaseEventStreamTransformation {

        @Override
        public void onMotionEvent(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
            if (event.getActionMasked() == ACTION_UP) {
            switch (event.getActionMasked()) {
                case ACTION_UP:
                case ACTION_CANCEL: {
                    transitionTo(mDetectingState);
            }
                } break;

            if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                case ACTION_DOWN: {
                    mLastDelegatedDownEventTime = event.getDownTime();
                } break;
            }
            if (getNext() != null) {
                // We cache some events to see if the user wants to trigger magnification.