OSDN Git Service

Fix broken activation of the selected view in accessibility mode.
authorSvetoslav <svetoslavganov@google.com>
Sat, 31 Jan 2015 04:28:41 +0000 (20:28 -0800)
committerSvetoslav Ganov <svetoslavganov@google.com>
Mon, 2 Feb 2015 23:17:17 +0000 (23:17 +0000)
commitded133c446fa9d0d23e6bde19a66fb2ce3980491
tree41f26af8f4fce5f667a3c167ff6ddfae503b9663
parent175ddbcf2ed71fdcd44a9b64cdc5d479df496a4d
Fix broken activation of the selected view in accessibility mode.

We were using an approximation to determine where to send a pair of down
and up events to click on the view that has accessibility focus. We were
doing reverse computation to figuring out which portion of the view is
not covered by interactive views and get a point in this region. However,
determining whether a view is interactive is not feasible in general since
for example may override onTouchEvent. This results in views not being
activated or which is worse wrong views being activated.

This change swithes to a new approach to activate views in accessibility
mode which is guaranteed to always work except the very rare case of a
view that overrides dispatchTouchEvent (which developers shouldn't be
doing). The new approach is to flag the down and up events pair sent
by the touch explorer as targeting the accessibility focused view. Such
events are dispatched such that views predecessors of the accessibility
focus do not handle them guaranteeing that these events reach the accessibiliy
focused view. Once the accessibiliy focused view gets such an event it clears
the flag and the event is dispatched following the normal event dispatch
semantics.

The new approach is semantically equivalent to requesting the view to perform
a click accessiblitiy action but is more generic as it is not affected by
views not implementing click action support correctly.

bug:18986806
bug:18889611

Change-Id: Id4b7b886c9fd34f7eb11e606636d8e3bab122869
core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl
core/java/android/view/AccessibilityInteractionController.java
core/java/android/view/MotionEvent.java
core/java/android/view/View.java
core/java/android/view/ViewGroup.java
core/java/android/view/ViewRootImpl.java
core/java/android/view/accessibility/AccessibilityInteractionClient.java
core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
core/java/android/view/accessibility/IAccessibilityInteractionConnectionCallback.aidl
services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
services/accessibility/java/com/android/server/accessibility/TouchExplorer.java