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

Commit 6045107e authored by Jean Chen's avatar Jean Chen
Browse files

Fix the issue of fullscreen and window Magnification using different multi-tap delay times

Consistently utilize the existing magnification API to retrieve the specific delay time.

Bug: 356295479
Test: manual
atest -c WindowMagnificationGestureHandlerTest
atest -c FullScreenMagnificationGestureHandlerTest
Flag: EXEMPT bugfix
Change-Id: Ic8e52d3c4d49d5a1cc5cd981c3e53a2c04b5e707
parent 0add2b34
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -43,12 +43,18 @@ public class MultiTap extends GestureMatcher {

    public MultiTap(Context context, int taps, int gesture,
            GestureMatcher.StateChangeListener listener) {
        this(context, taps, gesture,
                ViewConfiguration.getDoubleTapTimeout(), listener);
    }

    public MultiTap(Context context, int taps, int gesture, int multiTapTimeout,
            GestureMatcher.StateChangeListener listener) {
        super(gesture, new Handler(context.getMainLooper()), listener);
        mTargetTaps = taps;
        mDoubleTapTimeout = multiTapTimeout;
        mDoubleTapSlop = ViewConfiguration.get(context).getScaledDoubleTapSlop();
        mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
        mTapTimeout = ViewConfiguration.getTapTimeout();
        mDoubleTapTimeout = ViewConfiguration.getDoubleTapTimeout();
        clear();
    }

+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,11 @@ public class MultiTapAndHold extends MultiTap {
        super(context, taps, gesture, listener);
    }

    public MultiTapAndHold(Context context, int taps, int gesture, int multiTapTimeout,
            GestureMatcher.StateChangeListener listener) {
        super(context, taps, gesture, multiTapTimeout, listener);
    }

    @Override
    protected void onDown(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
        super.onDown(event, rawEvent, policyFlags);
+2 −3
Original line number Diff line number Diff line
@@ -1168,9 +1168,8 @@ public class FullScreenMagnificationGestureHandler extends MagnificationGestureH

        DetectingState(Context context) {
            mLongTapMinDelay = ViewConfiguration.getLongPressTimeout();
            mMultiTapMaxDelay = ViewConfiguration.getDoubleTapTimeout()
                    + context.getResources().getInteger(
                    R.integer.config_screen_magnification_multi_tap_adjustment);
            mMultiTapMaxDelay =
                    MagnificationGestureMatcher.getMagnificationMultiTapTimeout(context);
            mSwipeMinDistance = ViewConfiguration.get(context).getScaledTouchSlop();
            mMultiTapMaxDistance = ViewConfiguration.get(context).getScaledDoubleTapSlop();
        }
+8 −2
Original line number Diff line number Diff line
@@ -470,12 +470,14 @@ public class WindowMagnificationGestureHandler extends MagnificationGestureHandl
                        mDetectSingleFingerTripleTap
                                ? MagnificationGestureMatcher.GESTURE_TRIPLE_TAP
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP,
                        MagnificationGestureMatcher.getMagnificationMultiTapTimeout(mContext),
                        null));
                mGestureMatchers.add(new MultiTapAndHold(context,
                        mDetectSingleFingerTripleTap ? 3 : 1,
                        mDetectSingleFingerTripleTap
                                ? MagnificationGestureMatcher.GESTURE_TRIPLE_TAP_AND_HOLD
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP_AND_HOLD,
                        MagnificationGestureMatcher.getMagnificationMultiTapTimeout(mContext),
                        null));
                mGestureMatchers.add(new TwoFingersDownOrSwipe(context));

@@ -495,12 +497,16 @@ public class WindowMagnificationGestureHandler extends MagnificationGestureHandl
                        mDetectSingleFingerTripleTap ? 3 : 1,
                        mDetectSingleFingerTripleTap
                                ? MagnificationGestureMatcher.GESTURE_TRIPLE_TAP
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP, null);
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP,
                        MagnificationGestureMatcher.getMagnificationMultiTapTimeout(mContext),
                        null);
                final MultiTapAndHold multiTapAndHold = new MultiTapAndHold(context,
                        mDetectSingleFingerTripleTap ? 3 : 1,
                        mDetectSingleFingerTripleTap
                                ? MagnificationGestureMatcher.GESTURE_TRIPLE_TAP_AND_HOLD
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP_AND_HOLD, null);
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP_AND_HOLD,
                        MagnificationGestureMatcher.getMagnificationMultiTapTimeout(mContext),
                        null);
                mGesturesObserver = new MagnificationGesturesObserver(this,
                        new SimpleSwipe(context),
                        multiTap,
+4 −2
Original line number Diff line number Diff line
@@ -341,7 +341,8 @@ public class WindowMagnificationGestureHandlerTest {
                    twoFingerTap();
                    twoFingerTap();
                    // Wait for two-finger tap gesture completed.
                    SystemClock.sleep(ViewConfiguration.getDoubleTapMinTime() + 500);
                    SystemClock.sleep(MagnificationGestureMatcher
                            .getMagnificationMultiTapTimeout(mContext) + 100);
                    InstrumentationRegistry.getInstrumentation().waitForIdleSync();
                }
                break;
@@ -403,7 +404,8 @@ public class WindowMagnificationGestureHandlerTest {
                twoFingerTap();
                twoFingerTap();
                // Wait for two-finger tap gesture completed.
                SystemClock.sleep(ViewConfiguration.getDoubleTapMinTime() + 500);
                SystemClock.sleep(MagnificationGestureMatcher
                        .getMagnificationMultiTapTimeout(mContext) + 100);
                InstrumentationRegistry.getInstrumentation().waitForIdleSync();
            }
            break;