am b2ba6dfc: Merge "Accessibility: Handle a missed case when clicking focused views." into lmp-mr1-dev
* commit 'b2ba6dfc7b33ec9e58d9f556206440a26069e264': Accessibility: Handle a missed case when clicking focused views.
This commit is contained in:
@@ -1931,12 +1931,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
mInputEventConsistencyVerifier.onTouchEvent(ev, 1);
|
mInputEventConsistencyVerifier.onTouchEvent(ev, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Whether this event should be handled by the accessibility focus first.
|
|
||||||
final boolean targetAccessibilityFocus = ev.isTargetAccessibilityFocus();
|
|
||||||
|
|
||||||
// If the event targets the accessibility focused view and this is it, start
|
// If the event targets the accessibility focused view and this is it, start
|
||||||
// normal event dispatch. Maybe a descendant is what will handle the click.
|
// normal event dispatch. Maybe a descendant is what will handle the click.
|
||||||
if (targetAccessibilityFocus && isAccessibilityFocusedViewOrHost()) {
|
if (ev.isTargetAccessibilityFocus() && isAccessibilityFocusedViewOrHost()) {
|
||||||
ev.setTargetAccessibilityFocus(false);
|
ev.setTargetAccessibilityFocus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1956,7 +1953,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
|
|
||||||
// Check for interception.
|
// Check for interception.
|
||||||
final boolean intercepted;
|
final boolean intercepted;
|
||||||
if (!targetAccessibilityFocus) {
|
|
||||||
if (actionMasked == MotionEvent.ACTION_DOWN
|
if (actionMasked == MotionEvent.ACTION_DOWN
|
||||||
|| mFirstTouchTarget != null) {
|
|| mFirstTouchTarget != null) {
|
||||||
final boolean disallowIntercept = (mGroupFlags & FLAG_DISALLOW_INTERCEPT) != 0;
|
final boolean disallowIntercept = (mGroupFlags & FLAG_DISALLOW_INTERCEPT) != 0;
|
||||||
@@ -1971,9 +1967,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
// so this view group continues to intercept touches.
|
// so this view group continues to intercept touches.
|
||||||
intercepted = true;
|
intercepted = true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// If event should reach the accessibility focus first, do not intercept it.
|
// If intercepted, start normal event dispatch. Also if there is already
|
||||||
intercepted = false;
|
// a view that is handling the gesture, do normal event dispatch.
|
||||||
|
if (intercepted || mFirstTouchTarget != null) {
|
||||||
|
ev.setTargetAccessibilityFocus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for cancelation.
|
// Check for cancelation.
|
||||||
@@ -1987,8 +1985,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
if (!canceled && !intercepted) {
|
if (!canceled && !intercepted) {
|
||||||
if (actionMasked == MotionEvent.ACTION_DOWN
|
if (actionMasked == MotionEvent.ACTION_DOWN
|
||||||
|| (split && actionMasked == MotionEvent.ACTION_POINTER_DOWN)
|
|| (split && actionMasked == MotionEvent.ACTION_POINTER_DOWN)
|
||||||
|| actionMasked == MotionEvent.ACTION_HOVER_MOVE
|
|| actionMasked == MotionEvent.ACTION_HOVER_MOVE) {
|
||||||
|| targetAccessibilityFocus) {
|
|
||||||
final int actionIndex = ev.getActionIndex(); // always 0 for down
|
final int actionIndex = ev.getActionIndex(); // always 0 for down
|
||||||
final int idBitsToAssign = split ? 1 << ev.getPointerId(actionIndex)
|
final int idBitsToAssign = split ? 1 << ev.getPointerId(actionIndex)
|
||||||
: TouchTarget.ALL_POINTER_IDS;
|
: TouchTarget.ALL_POINTER_IDS;
|
||||||
|
|||||||
@@ -4121,6 +4121,13 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
|
|
||||||
mAttachInfo.mUnbufferedDispatchRequested = false;
|
mAttachInfo.mUnbufferedDispatchRequested = false;
|
||||||
boolean handled = mView.dispatchPointerEvent(event);
|
boolean handled = mView.dispatchPointerEvent(event);
|
||||||
|
if (!handled && event.isTargetAccessibilityFocus()) {
|
||||||
|
// The event was targeting accessibility focused view and is not handled,
|
||||||
|
// it is very rare but possible that a predecessor of the focused view handles
|
||||||
|
// the event but didn't due to special dispatch, perform normal event dispatch.
|
||||||
|
event.setTargetAccessibilityFocus(false);
|
||||||
|
handled = mView.dispatchPointerEvent(event);
|
||||||
|
}
|
||||||
if (mAttachInfo.mUnbufferedDispatchRequested && !mUnbufferedInputDispatch) {
|
if (mAttachInfo.mUnbufferedDispatchRequested && !mUnbufferedInputDispatch) {
|
||||||
mUnbufferedInputDispatch = true;
|
mUnbufferedInputDispatch = true;
|
||||||
if (mConsumeBatchedInputScheduled) {
|
if (mConsumeBatchedInputScheduled) {
|
||||||
|
|||||||
Reference in New Issue
Block a user