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

Commit 9ef1fb8c authored by Daniel Norman's avatar Daniel Norman
Browse files

cleanup: Roll out flag copy_events_for_gesture_detection by deleting usage

This flag was incorrectly tagged as non-bugfix, but is guarding a bugfix.
The flag has been in Trunkfood Full for 2 months.

Bug: 377736692
Flag: android.view.accessibility.copy_events_for_gesture_detection
Test: (existing presubmit; change is a no-op)
Change-Id: I9ccb09d0c1f0441cf79c4046802df7e3aac58c73
parent 5434639a
Loading
Loading
Loading
Loading
+4 −11
Original line number Diff line number Diff line
@@ -1942,14 +1942,9 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
    }

    public void notifyGesture(AccessibilityGestureEvent gestureEvent) {
        if (android.view.accessibility.Flags.copyEventsForGestureDetection()) {
        // We will use this event async, so copy it because it contains MotionEvents.
        mInvocationHandler.obtainMessage(InvocationHandler.MSG_ON_GESTURE,
                gestureEvent.copyForAsync()).sendToTarget();
        } else {
            mInvocationHandler.obtainMessage(InvocationHandler.MSG_ON_GESTURE,
                    gestureEvent).sendToTarget();
        }
    }

    public void notifySystemActionsChangedLocked() {
@@ -2426,10 +2421,8 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
                case MSG_ON_GESTURE: {
                    if (message.obj instanceof AccessibilityGestureEvent gesture) {
                        notifyGestureInternal(gesture);
                        if (android.view.accessibility.Flags.copyEventsForGestureDetection()) {
                        gesture.recycle();
                    }
                    }
                } break;
                case MSG_CLEAR_ACCESSIBILITY_CACHE: {
                    notifyClearAccessibilityCacheInternal();
+8 −15
Original line number Diff line number Diff line
@@ -336,13 +336,8 @@ public abstract class GestureMatcher {
            // Recycle the old event first if necessary, to handle duplicate calls to post.
            recycleEvent();
            mTargetState = state;
            if (android.view.accessibility.Flags.copyEventsForGestureDetection()) {
            mEvent = event.copy();
            mRawEvent = rawEvent.copy();
            } else {
                mEvent = event;
                mRawEvent = rawEvent;
            }
            mPolicyFlags = policyFlags;
            mHandler.postDelayed(this, delay);
            if (DEBUG) {
@@ -379,7 +374,6 @@ public abstract class GestureMatcher {
        }

        private void recycleEvent() {
            if (android.view.accessibility.Flags.copyEventsForGestureDetection()) {
            if (mEvent == null || mRawEvent == null) {
                return;
            }
@@ -389,7 +383,6 @@ public abstract class GestureMatcher {
            mRawEvent = null;
        }
    }
    }

    /** Interface to allow a class to listen for state changes in a specific gesture matcher */
    public interface StateChangeListener {
+0 −23
Original line number Diff line number Diff line
@@ -28,10 +28,6 @@ import static org.mockito.Mockito.verify;

import android.content.Context;
import android.graphics.PointF;
import android.platform.test.annotations.RequiresFlagsDisabled;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.view.Display;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
@@ -54,9 +50,6 @@ import java.util.List;
 */
public class TwoFingersDownOrSwipeTest {

    @Rule
    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();

    private static final float DEFAULT_X = 100f;
    private static final float DEFAULT_Y = 100f;

@@ -94,22 +87,6 @@ public class TwoFingersDownOrSwipeTest {
    }

    @Test
    @RequiresFlagsDisabled(android.view.accessibility.Flags.FLAG_COPY_EVENTS_FOR_GESTURE_DETECTION)
    public void sendTwoFingerDownEvent_onGestureCompleted_withoutCopiedEvents() {
        final List<MotionEvent> downEvents = twoPointersDownEvents(Display.DEFAULT_DISPLAY,
                new PointF(DEFAULT_X, DEFAULT_Y), new PointF(DEFAULT_X + 10, DEFAULT_Y + 10));

        for (MotionEvent event : downEvents) {
            mGesturesObserver.onMotionEvent(event, event, 0);
        }

        verify(mListener, timeout(sTimeoutMillis)).onGestureCompleted(
                MagnificationGestureMatcher.GESTURE_TWO_FINGERS_DOWN_OR_SWIPE, downEvents.get(1),
                downEvents.get(1), 0);
    }

    @Test
    @RequiresFlagsEnabled(android.view.accessibility.Flags.FLAG_COPY_EVENTS_FOR_GESTURE_DETECTION)
    public void sendTwoFingerDownEvent_onGestureCompleted() {
        final List<MotionEvent> downEvents = twoPointersDownEvents(Display.DEFAULT_DISPLAY,
                new PointF(DEFAULT_X, DEFAULT_Y), new PointF(DEFAULT_X + 10, DEFAULT_Y + 10));