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

Commit dc8e5268 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Treat ACTION_CANCEL as ACTION_UP for magnification"

parents 34bc2ab9 6cc467e0
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.