summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ameer Armaly <aarmaly@google.com> 2024-01-24 01:11:07 +0000
committer Ameer Armaly <aarmaly@google.com> 2024-01-24 01:19:30 +0000
commita1b51f89448c4a836645b1865f433c0a8bf0dd98 (patch)
tree76f96e97e67d0408644bdbe136493f38ff932a64
parent5e33a738aae0471d9c66daed82ee616e72b81b5f (diff)
Send the correct pointer id when transitioning from dragging to delegating state.
Previously, we used the pointer id ALL_POINTER_ID_BITS which sent the pointers physically present on the screen. The previous event stream only had one pointer. This confused the input layer and could cause any number of weird issues. Bug: 300002193 Bug: 316386865 Test: manual. Perform a gesture that switches from dragging to delegating mid-gesture and inspect logs. Observe no InputEventConsistencyVerifier errors. Change-Id: Ifa5083d452bfe3fe6a303231677e734d546020af
-rw-r--r--services/accessibility/accessibility.aconfig7
-rw-r--r--services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java7
2 files changed, 12 insertions, 2 deletions
diff --git a/services/accessibility/accessibility.aconfig b/services/accessibility/accessibility.aconfig
index 993b2544f110..44682e2088f4 100644
--- a/services/accessibility/accessibility.aconfig
+++ b/services/accessibility/accessibility.aconfig
@@ -45,6 +45,13 @@ flag {
}
flag {
+ name: "fix_drag_pointer_when_ending_drag"
+ namespace: "accessibility"
+ description: "Send the correct pointer id when transitioning from dragging to delegating states."
+ bug: "300002193"
+}
+
+flag {
name: "pinch_zoom_zero_min_span"
namespace: "accessibility"
description: "Whether to set min span of ScaleGestureDetector to zero."
diff --git a/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java
index c4184854e690..3086ce1ceb40 100644
--- a/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java
+++ b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java
@@ -1466,8 +1466,11 @@ public class TouchExplorer extends BaseEventStreamTransformation
int policyFlags = mState.getLastReceivedPolicyFlags();
if (mState.isDragging()) {
// Send an event to the end of the drag gesture.
- mDispatcher.sendMotionEvent(
- event, ACTION_UP, rawEvent, ALL_POINTER_ID_BITS, policyFlags);
+ int pointerIdBits = ALL_POINTER_ID_BITS;
+ if (Flags.fixDragPointerWhenEndingDrag()) {
+ pointerIdBits = 1 << mDraggingPointerId;
+ }
+ mDispatcher.sendMotionEvent(event, ACTION_UP, rawEvent, pointerIdBits, policyFlags);
}
mState.startDelegating();
// Deliver all pointers to the view hierarchy.