Only filter a11y motion events if needed.
We've seen some jitter in motion events with accessibility enabled. We can eliminate it by not passing motion events through the filter if we know they won't be affected. Bug: 30183085 Change-Id: I0ecc8d5a39c8e370fc3a8ab85c6357251a31f8ad
This commit is contained in:
@@ -77,6 +77,9 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
|
||||
*/
|
||||
static final int FLAG_FEATURE_INJECT_MOTION_EVENTS = 0x00000010;
|
||||
|
||||
static final int FEATURES_AFFECTING_MOTION_EVENTS = FLAG_FEATURE_INJECT_MOTION_EVENTS
|
||||
| FLAG_FEATURE_AUTOCLICK | FLAG_FEATURE_TOUCH_EXPLORATION
|
||||
| FLAG_FEATURE_SCREEN_MAGNIFIER;
|
||||
/**
|
||||
* Flag for enabling the feature to control the screen magnifier. If
|
||||
* {@link #FLAG_FEATURE_SCREEN_MAGNIFIER} is set this flag is ignored
|
||||
@@ -203,8 +206,13 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
|
||||
}
|
||||
|
||||
if (event instanceof MotionEvent) {
|
||||
MotionEvent motionEvent = (MotionEvent) event;
|
||||
processMotionEvent(state, motionEvent, policyFlags);
|
||||
if ((mEnabledFeatures & FEATURES_AFFECTING_MOTION_EVENTS) != 0) {
|
||||
MotionEvent motionEvent = (MotionEvent) event;
|
||||
processMotionEvent(state, motionEvent, policyFlags);
|
||||
return;
|
||||
} else {
|
||||
super.onInputEvent(event, policyFlags);
|
||||
}
|
||||
} else if (event instanceof KeyEvent) {
|
||||
KeyEvent keyEvent = (KeyEvent) event;
|
||||
processKeyEvent(state, keyEvent, policyFlags);
|
||||
|
||||
Reference in New Issue
Block a user