am 41daba00: am 060bca74: Merge "Accessibility: Handle a missed case when clicking focused views." into lmp-mr1-dev

* commit '41daba0052f4a9146aad4977da9eccf3c72450ce':
  Accessibility: Handle a missed case when clicking focused views.
This commit is contained in:
Svet Ganov
2015-02-06 23:58:49 +00:00
committed by Android Git Automerger
2 changed files with 12 additions and 2 deletions

View File

@@ -8440,8 +8440,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// If the event should be handled by accessibility focus first. // If the event should be handled by accessibility focus first.
if (event.isTargetAccessibilityFocus()) { if (event.isTargetAccessibilityFocus()) {
// We don't have focus or no virtual descendant has it, do not handle the event. // We don't have focus or no virtual descendant has it, do not handle the event.
if (!isAccessibilityFocused() && !(getViewRootImpl() != null && getViewRootImpl() if (!isAccessibilityFocusedViewOrHost()) {
.getAccessibilityFocusedHost() == this)) {
return false; return false;
} }
// We have focus and got the event, then use normal event dispatch. // We have focus and got the event, then use normal event dispatch.
@@ -8490,6 +8489,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
return result; return result;
} }
boolean isAccessibilityFocusedViewOrHost() {
return isAccessibilityFocused() || (getViewRootImpl() != null && getViewRootImpl()
.getAccessibilityFocusedHost() == this);
}
/** /**
* Filter the touch event to apply security policies. * Filter the touch event to apply security policies.
* *

View File

@@ -1934,6 +1934,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
// Whether this event should be handled by the accessibility focus first. // Whether this event should be handled by the accessibility focus first.
final boolean targetAccessibilityFocus = ev.isTargetAccessibilityFocus(); final boolean targetAccessibilityFocus = ev.isTargetAccessibilityFocus();
// 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.
if (targetAccessibilityFocus && isAccessibilityFocusedViewOrHost()) {
ev.setTargetAccessibilityFocus(false);
}
boolean handled = false; boolean handled = false;
if (onFilterTouchEventForSecurity(ev)) { if (onFilterTouchEventForSecurity(ev)) {
final int action = ev.getAction(); final int action = ev.getAction();