Loading services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java +4 −11 Original line number Diff line number Diff line Loading @@ -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() { Loading Loading @@ -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(); Loading services/accessibility/java/com/android/server/accessibility/gestures/GestureMatcher.java +8 −15 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -379,7 +374,6 @@ public abstract class GestureMatcher { } private void recycleEvent() { if (android.view.accessibility.Flags.copyEventsForGestureDetection()) { if (mEvent == null || mRawEvent == null) { return; } Loading @@ -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 { Loading services/tests/servicestests/src/com/android/server/accessibility/magnification/TwoFingersDownOrSwipeTest.java +0 −23 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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)); Loading Loading
services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java +4 −11 Original line number Diff line number Diff line Loading @@ -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() { Loading Loading @@ -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(); Loading
services/accessibility/java/com/android/server/accessibility/gestures/GestureMatcher.java +8 −15 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -379,7 +374,6 @@ public abstract class GestureMatcher { } private void recycleEvent() { if (android.view.accessibility.Flags.copyEventsForGestureDetection()) { if (mEvent == null || mRawEvent == null) { return; } Loading @@ -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 { Loading
services/tests/servicestests/src/com/android/server/accessibility/magnification/TwoFingersDownOrSwipeTest.java +0 −23 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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)); Loading