History log of /frameworks/base/core/java/android/view/AccessibilityInteractionController.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
75e5816102ec417cda1aa95d5d936140cff12aa1 20-Feb-2016 Svet Ganov <svetoslavganov@google.com> Discard prefetched disconnected predecessors of a virtual node.

bug:18247269

Change-Id: I24f1ed1e9aa44fbb847722833fe68a1eef7e92c5
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
b3876474399ae22ccfc8f04d7f9ab577517db370 04-Jun-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Make node retrieval methods in AccessibilityManagerService use separate Region instances to make them thread safe." into mnc-dev
386a824384a0d5795a38d10d1d2c18e4e50f8c30 03-Jun-2015 Nirmal Patel <nirmalpatel@google.com> Make node retrieval methods in AccessibilityManagerService use separate Region instances to make them thread safe.

b/21087793

Change-Id: Ice690e3d7494788fb9e1e234a54f14831bd4e0d3
(cherry picked from commit ebd8eb4610d6bb9322a374f8965a78ba1c39ee63)
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
9607fbe9d70dd350e5f4a5f3862fa95816780c94 29-May-2015 Doris Liu <tianliu@google.com> Fix calls to Rect.intersect() in package android.view

This CL checks for the return value for Rect.intersect() for whether
there is actually an intersection before taking the return intersected
rect. In the case of no intersection (Rect.intersect() returns false),
an empty rect will be used as the intersection.

bug: 7368679
Change-Id: Ib874345210c8f62550627544d717e958d46cfe13
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
41725dedc33906aaafee36b2d6523596e2a8a52e 09-Apr-2015 George Mount <mount@google.com> Disable input during Activity Transition.

Bug 19437530

While the actual Activity Transitions are running,
input is stopped, except for the "back" button.

Change-Id: I112e6252b9de05ece10a6267681fee5487e5ef6b
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
ded133c446fa9d0d23e6bde19a66fb2ce3980491 31-Jan-2015 Svetoslav <svetoslavganov@google.com> 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
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
84feea1185b8f438f9c7153b9e59bb7361b0a17d 05-Nov-2014 Alan Viverette <alanv@google.com> Abort accessibility node prefetch if parent node is null

BUG: 18004444
Change-Id: I80757daeb6b381947c4f3abbd762711cff2a978c
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
ed2fdc6ef560c76ba310a2c4e5bb63f01d08af40 27-Sep-2014 Svetoslav <svetoslavganov@google.com> Accessibility node provider getting invalid virtual view id.

If the virtual child id is not specified we should ask the node
provider to create a node info for the hosting view bu passing
the special host node id.

bug:17664111

Change-Id: Iaf1387acdfe33b50b50729d293adcdf82340a648
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
c569d3594574598d54f69b36239d88f7e0d15b7d 26-Sep-2014 Svetoslav <svetoslavganov@google.com> Using wrong virtual view id When prefetching accessibility nodes.

When getting an accessibility node info we also prefetch its predecessors,
siblings and descendants up to fifty. If a view has a node provider, i.e.
virtual descendants, and the id of the virtual descendant is not specified
we use a speacial constant to refer that the provider should create a node
for its hosting view. The bug was that we were not using the correct constant
when calling into the provider.

bug:17664111

Change-Id: I4f6b2333e1e7e3e2bb6b164c0752613417c60d16
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
7498efdc5e163d6b4a11db941c7d13c169d37284 04-Sep-2014 Svet Ganov <svetoslavganov@google.com> Clicking on partially coverd views by other views or windows.

In touch exploration mode an accessibility service can move
accessibility focus in response to user gestures. In this case
when the user double-taps the system is sending down and up
events at the center of the acessibility focused view. This
works fine until the clicked view's center is covered by another
clickable view. In such a scenario the user thinks he is clicking
on one view but the click is handled by another. Terrible.

This change solves the problem of clicking on the wrong view
and also solves the problem of clicking on the wrong window.
The key idea is that when the system detects a double tap or
a double tap and hold it asks the accessibility focused node
(if such) to compute a point at which a click can be performed.
In respinse to that the node is asking the source view to
compute this.

If a view is partially covered by siblings or siblings of
predecessors that are clickable, the click point will be
properly computed to ensure the click occurs on the desired
view. The click point is also bounded in the interactive
part of the host window.

The current approach has rare edge cases that may produce false
positives or false negatives. For example, a portion of the
view may be covered by an interactive descendant of a
predecessor, which we do not compute (we check only siblings of
predecessors). Also a view may be handling raw touch events
instead of registering click listeners, which we cannot compute.
Despite these limitations this approach will work most of the
time and it is a huge improvement over just blindly sending
the down and up events in the center of the view.

Note that the additional computational complexity is incurred
only when the user wants to click on the accessibility focused
view which is very a rare event and this is a good tradeoff.

bug:15696993

Change-Id: I85927a77d6c24f7550b0d5f9f762722a8230830f
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
9ae9ed24aa252acbc2e6288068b991dd5291967b 03-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix AccessibilityNode's isVisibleToUser behavior.

The isVisibleToUser property of an AccessibilityNodeInfo specifies
whether the user can see the source view. It is used by accessibility
services to figure out whether to focus on a view. This property
was giving a wrong value if the view is covered by another window
such as the keyboard. As a result the user hears one thing but when
double taps interacts with the overlaid window which is another thing.

bug:15938254

Change-Id: Ib9feb20ea422a24a512c47ed1234961ae0386a7f
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
aaa114215bd1e0a2f526e97571fc5fefcd81cb48 28-Mar-2014 Svetoslav <svetoslavganov@google.com> Disable node tree consistency check on user builds.

Change-Id: I6ec8cfc41fefc12e4c8fb6f39715831f072cb074
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
8e3feb15c5aec2c72b0ef120a1da325e1e8f0dda 24-Feb-2014 Svetoslav <svetoslavganov@google.com> Added accessibility APIs for introspecting interactive windows.

1. The old introspection model was allowing querying only the active window
which is the one the user is touching or the focused one if no window is
touched. This was limiting as auto completion drop downs were not inspectable,
there was not way to know when the IME toggles, non-focusable windows were
not inspectable if the user taps them as until a screen-reader starts
introspecting the users finger is up, accessibility focus was limited to
only one window and the user couldn't use gestures to visit the whole UI,
and other things I can't remember right now.

The new APIs allow getting all interactive windows, i.e. ones that a
sighted user can interact with. This prevents an accessibility service
from interacting with content a sighter user cannot. The list of windows
can be obtained from an accessibility service or the host window from an
accessibility node info. Introspecting windows obey the same rules for
introspecting node, i.e. the service has to declare this capability
in its manifest.

When some windows change accessibility services receive a new type
of event. Initially the types of windows is very limited. We provide
the bounds in screen, layer, and some other properties which are
enough for a client to determined the spacial and hierarchical
relationship of the windows.

2. Update the documentation in AccessibilityService for newer event types.

3. LongArray was not removing elements properly.

4. Composite accessibility node ids were not properly constructed as they
are composed of two ints, each taking 32 bits. However, the values for
undefined were -1 so composing a 64 long from -1, -1 prevents from getting
back these values when unpacking.

5. Some apps were generating inconsistent AccessibilityNodeInfo tree. Added
a check that enforces such trees to be well formed on dev builds.

6. Removed an necessary code for piping the touch exploration state to
the policy as it should just use the AccessibilityManager from context.

7. When view's visibility changed it was not firing an event to notify
clients it disappeared/appeared. Also ViewGroup was sending accessibility
events for changes if the view is included for accessibility but this is
wrong as there may be a service that want all nodes, hence events from them.
The accessibility manager service takes care of delivering events from
not important for accessibility nodes only to services that want such.

8. Several places were asking for prefetching of sibling but not predecessor
nodes which resulted in prefetching of unconnected subtrees.

9. The local AccessibilityManager implementation was relying on the backing
service being ready when it is created but it can be fetched from a context
before that. If that happens the local manager was in a broken state forever.
Now it is more robust and starts working properly once the backing service
is up. Several places were lacking locking.

bug:13331285

Change-Id: Ie51166d4875d5f3def8d29d77973da4b9251f5c8
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
6090995951c6e2e4dcf38102f01793f8a94166e1 19-Nov-2013 John Spurlock <jspurlock@google.com> Remove unused imports from frameworks/base.

Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
f0aed09ed8153043e40b3ac99788d47ba0831306 07-Nov-2013 Alan Viverette <alanv@google.com> Add methods for removing children and actions from A11y nodes

BUG: 11421730
Change-Id: Ide396e6a0fec871395a9cadf8880c16d0de08294
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
2e1e081146546a04bc3813dde9c44babbddc0712 30-Sep-2013 Alan Viverette <alanv@google.com> Add findFocus API for AccessibilityNodeProvider

BUG: 9372171
Change-Id: Iea46ce5a4bf25baaabe5c07cd7d0c58bb31f23d9
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
6254f4806dd3db53b7380e77fbb183065685573e 05-Jun-2013 Svetoslav <svetoslavganov@google.com> Optimizing AccessibilityNodeInfo caching.

1. Before we were firing an accessibility event from the common
predecessor of views with accessibility related state changes
every X amount of time. These events designate that the tree
rooted at the source is invalid and should not be cached.
However, some of the state changes do not affect the view tree
structure and we can just refresh the node instead of evicting
and recaching nodes infos for views that did not change. Hence,
we need a way to distinguish between a subtree changed over a
node changed.

Adding a new event type will not work since if say two siblings
have local changes and their predecessor fires a window state
change event, the client will drop the subtree rooted at the
parent including the two views with changes. Subsequent, more
specialized events emitted from the two changed siblings will
be useless since the parent which did not changed is already
evicted from the cache. Conversely, if the specialized events
are fired from the two siblings with local changes and they
are refreshed in the cache the subsequent window state change
event from the common predecessor will force the refreshed
nodes to be evicted.

Hence, to enable distinction between node being changed and
a subtree baing changed while not changing existing behavior,
we will fire only window content change event with an additional
argument specifying what changed - node or a subtree for now.
Also if the changes are local to a view we fire the window
content changed event from the view. So, the two siblings will
fire such an event independently and the client will know that
these are local changes and can just refresh the node. If the
changes are structural, then we fire the window state change
event from the common predecessor.

2. Added the input type of a text view as one of the properties
reported by an AccessibilityNodeInfo. It is nice to prompt the
user what input is expected.

3. Added a bundle for optional information to AccessiiblityNodeInfo.
For example, it will be used for putting web specific properties
that do not map cleanly to Android specific ones in WebView.

4. AccessibilityInteractionController was not taking into account
whether the current accessibility focused node is shown before
returing it. Hence, a disconnected node would be returned and
caching it puts our cahche in an inconsistent state.

Change-Id: I8ed19cfb4a70bdd7597c3f105487f1651cffd9e0
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
a33243eb6491bc5a20ede53db3313f6078e8b694 12-Feb-2013 Svetoslav <svetoslavganov@google.com> Optimize loading of resource name when reported to accessibility.

Loading of the resource id name was unnecessarily complex and
was generating spam in the log as a result.

bug:8153518

Change-Id: Ib2c1118fd36b86ba8ce803ba3190fa01ab06e8c3
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
80943d8daa6ab31ab5c486d57aea406aa0730d58 02-Jan-2013 Svetoslav Ganov <svetoslavganov@google.com> Adding UI test automation APIs.

This change adds APIs support for implementing UI tests. Such tests do
not rely on internal application structure and can span across application
boundaries. UI automation APIs are encapsulated in the UiAutomation object
that is provided by an Instrumentation object. It is initialized by the
system and can be used for both introspecting the screen and performing
interactions simulating a user. UI test are normal instrumentation tests
and are executed on the device.

UiAutomation uses the accessibility APIs to introspect the screen and
a special delegate object to perform privileged operations such as
injecting input events. Since instrumentation tests are invoked by a shell
command, the shell program launching the tests creates a delegate object and
passes it as an argument to started instrumentation. This delegate
allows the APK that runs the tests to access some privileged operations
protected by a signature level permissions which are explicitly granted
to the shell user.

The UiAutomation object also supports running tests in the legacy way
where the tests are run as a Java shell program. This enables existing
UiAutomator tests to keep working while the new ones should be implemented
using the new APIs. The UiAutomation object exposes lower level APIs which
allow simulation of arbitrary user interactions and writing complete UI test
cases. Clients, such as UiAutomator, are encouraged to implement higher-
level APIs which minimize development effort and can be used as a helper
library by the test developer.

The benefit of this change is decoupling UiAutomator from the system
since the former was calling hidden APIs which required that it is
bundled in the system image. This prevented UiAutomator from being
evolved separately from the system. Also UiAutomator was creating
additional API surface in the system image. Another benefit of the new
design is that now test cases have access to a context and can use
public platform APIs in addition to the UiAutomator ones. Further,
third-parties can develop their own higher level test APIs on top
of the lower level ones exposes by UiAutomation.

bug:8028258

Also this change adds the fully qualified resource name of the view's
id in the emitted AccessibilityNodeInfo if a special flag is set while
configuring the accessibility service. Also added is API for looking
up node infos by this id. The id resource name is relatively more stable
compared to the generaed id number which may change from one build to
another. This API facilitate reuing the already defined ids for UI
automation.

bug:7678973

Change-Id: I589ad14790320dec8a33095953926c2a2dd0228b
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
152e9bb81aa5b2ab4637f4b2dae04b3ce89fa891 13-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Refactoring of the screen magnification feature.

1. The screen magnification feature was implemented entirely as a part of the accessibility
manager. To achieve that the window manager had to implement a bunch of hooks for an
external client to observe its internal state. This was problematic since it dilutes
the window manager interface and allows code that is deeply coupled with the window
manager to reside outside of it. Also the observer callbacks were IPCs which cannot
be called with the window manager's lock held. To avoid that the window manager had
to post messages requesting notification of interested parties which makes the code
consuming the callbacks to run asynchronously of the window manager. This causes timing
issues and adds unnecessary complexity.

Now the magnification logic is split in two halves. The first half that is responsible
to track the magnified portion of the screen and serve as a policy which windows can be
magnified and it is a part of the window manager. This part exposes higher level APIs
allowing interested parties with the right permissions to control the magnification
of a given display. The APIs also allow a client to be registered for callbacks on
interesting changes such as resize of the magnified region, etc. This part servers
as a mediator between magnification controllers and the window manager.

The second half is a controller that is responsible to drive the magnification
state based on touch interactions. It also presents a highlight when magnified to
suggest the magnified potion of the screen. The controller is responsible for auto
zooming out in case the user context changes - rotation, new actitivity. The controller
also auto pans if a dialog appears and it does not interesect the magnified frame.

bug:7410464

2. By design screen magnification and touch exploration work separately and together. If
magnification is enabled the user sees a larger version of the widgets and a sub section
of the screen content. Accessibility services use the introspection APIs to "see" what
is on the screen so they can speak it, navigate to the next item in response to a
gesture, etc. Hence, the information returned to accessibility services has to reflect
what a sighted user would see on the screen. Therefore, if the screen is magnified
we need to adjust the bounds and position of the infos describing views in a magnified
window such that the info bounds are equivalent to what the user sees.

To improve performance we keep accessibility node info caches in the client process.
However, when magnification state changes we have to clear these caches since the
bounds of the cached infos no longer reflect the screen content which just got smaller
or larger.

This patch propagates not only the window scale as before but also the X/Y pan and the
bounds of the magnified portion of the screen to the introspected app. This information
is used to adjust the bounds of the node infos coming from this window such that the
reported bounds are the same as the user sees not as the app thinks they are. Note that
if magnification is enabled we zoom the content and pan it along the X and Y axis. Also
recomputed is the isVisibleToUser property of the reported info since in a magnified
state the user sees a subset of the window content and the views not in the magnified
viewport should be reported as not visible to the user.

bug:7344059

Change-Id: I6f7832c7a6a65c5368b390eb1f1518d0c7afd7d2
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
758143ecfedbe08cc6c4fed0ad8ad7a854194ca4 07-Aug-2012 Svetoslav Ganov <svetoslavganov@google.com> Window position not reported if the window is not moved.

1.If a window is shown but never moved the window window
is never notified for its current location. Therefore,
accessibility nodes do not contain correct bounds in
screen coordinates.

bug:6926295

Change-Id: I7df18b095d33ecafffced75aba9e4f4693b0c393
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
c9c9a48e7bafae63cb35a9aa69255e80aba83988 16-Jul-2012 Svetoslav Ganov <svetoslavganov@google.com> Removing a workaround for incorrect window position on window move.

1. The window manager was not notifying a window when the latter
has been moved. This was causing incorrect coordinates of the
nodes reported to accessibility services. To workaround that
we have carried the correct window location when making a
call from the accessibility layer into a window. Now the
window manager notifies the window when it is moved and the
workaround is no longer needed. This change takes it out.

2. The left and right in the attach info were not updated properly
after a report that the window has moved.

3. The accessibility manager service was calling directly methods
on the window manager service without going through the interface
of the latter. This leads to unnecessary coupling and in the
long rung increases system complexity and reduces maintability.

bug:6623031

Change-Id: Iacb734b1bf337a47fad02c827ece45bb2f53a79d
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
fd8d9c4c0a3930c9b2585cd54ea4288fbb15cceb 10-Jul-2012 Svetoslav Ganov <svetoslavganov@google.com> AccessibilityNodeInfo bounds in screen incorrect if application scale not one V2.0.

1. If the application does not accommodate different screen density the
system applies an application scale equal to the device density over
the a default density. The AccessibilityNodeInfo coordinates were not
reported after applying the compatibility scale, therefore the bounds
in parent and screen were not as perceived by the user.

bug:6764586

Change-Id: Id9de3de885210d0725d1f3fde38e769b0cfd12a7
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
27e2da7c171afa39358bbead18fbe3e6b8ea6637 03-Jul-2012 Svetoslav Ganov <svetoslavganov@google.com> Remove the accessibility focus search code.

1. In JellyBean we have added some APIs to search for next accessibility
focus in various directions and set accessibility focus from hover.
However, we have decided that there is not clean answer for how this
should behave and the APIs were hidden. Now the accessibility service
is responsible for that. The unused code is now taken out.

2. This patch also takes out the hidden attribute accessibiligyFocusable
since we moved the responsibility for implementing focus search strategy
to accessibility services and we did not need that for Jellybean which
is a good sign that this is not needed. I general this is one less thing
for an app developer to worry about. We can add this if needed later.

bug:6773816

Change-Id: I0c858d72c93a2b7ff1f8f35a08d33ec4b9eb85fd
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
45a02e0809c14a52aa24658666df0d41ce661857 18-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> API for finding accessibility focus in virtual tree not needed.

1. The function for finding where the accessibility focus in a virtual
node tree presented by an AccessibilityNodeProvider is not needed
API since the framework already keeps track of the accessibility
focused virtual node in order to draw the focus rectangle. This API
adds unnecessary complexity to developers of AccessibilityNodeProviders.

bug:6675330

Change-Id: I84774686b06a995073a39e45b8ef22f2cd04b773
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
86783474fdec98a22bc22e224462767eab13e273 07-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Cannot interact with dialogs when IME is up and on not touch explored popups.

1. If the last touch explored location is within the active window we
used to click on exact location if it is within the accessibility
focus otherwise in the accessibility focus center. If the last touch
explored location is not within the active window we used to just
click there. This breaks in the case were one has touch explored
at a given place in the current window and now a dialog opens *not*
covering the touch explored location. If one uses swipes to move
accessibility focus i.e. to traverse the dialog without touching
it one cannot activate anything because the touch explorer is using
the last touch explored location that is outside of the active
window e.g the dialog.

The solution is to clear the last touch explored location when a
window opens or accessibility focus moves. If the last touch
explored location is null we are clicking in the accessibility
focus location.

bug:6620911

2. There is a bug in the window manager that does not notify a
window that its location has changed (bug:6623031). This breaks
accessibility interaction with dialogs that have input because
when the IME is up the dialog is moved but not notified. Now
the accessibility layer gets incorrect location for the
accessibility focus and the window bounds.

The soluion is when the accessibility manager service calls
into the remove thress to obtain some accessibility node infos
it passes the window left and top which it gets from the
window manager. These values are used to update the attach info
window left and top so all accessibility node infos emitted
from that window had correct bounds in screen coordinates.

bug:6620796

Change-Id: I18914f2095c55cfc826acf5277bd94b776bda0c8
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
30ac645210ecf96ae28fc5cb3b663aeb83dbdec1 01-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> AccessibilityInteractionController crash with IndexOutOfBoundException.

1. The findAccessibilityNodeInfosByTextUiThread was reusing an ArrayList
instance also used by the logic to initialize an AccessibilityNodeInfo.
Hence, if the find method got some view and creates the infos for them
the method creating the info was reusing the same array list and was
nuking its contents.

bug:6556585

Change-Id: I1d013bf7b1f715f8b4c4ba60c677233bec40647c
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
4528b4e882584745f48263fa6626987e63832a2a 16-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Prefetching of accessibility node infos getting incorrect views.

1. The prefetcher of accessibility nodes infos was not folloing
the childForAccessibility relationship when finding the views
whose node infos to prefetch.

2. NumberPicker was not reporting the correct parent.

bug:6471710

Change-Id: Ia7ad5dd031fb4b3816dfe630d5212201cfafa236
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
791fd31a68c59395952005886ba799169f80a29a 15-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility focus traversal in virtual nodes.

1. Finished the implementation of support for maintaining
accessibility focus in view with virtual descendants.

2. Finished the NumberPicker implementation of virtual
subtree such that all requred attributes are reported
and ensuring that it support accessibility focus in
its virtual descentants.

3. Fixed a bug where if a predecessor of the view that is
accessiiblity focused is removed the accessibliity focus
host in ViewRootImpl is not cleared leading to a crash
when trying to draw the accessibility focus highlight.:

bug:6472646
bug:6433864

Change-Id: I3645642b87b4a26025c0b2ba9dfaad92d11a48f1
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
e5dfa47d84668376b84074c04570fb961870adeb 09-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Improving accessibility focus traversal.

1. Now the views considered during the accessibility focus search
are the ones that would get accessibility focus when thovered
over. This way the user will get the same items i.e. feedback
if he touch explores the screen and uses focus traversal. This
is imperative for a good user experience.

2. Updated which focusables are considered when searching for access
focus in ViewGroup. Generally accessibility focus ignores focus
before/after descendants.

3. Implemented focus search strategy in AbsListView that will traverse
the items of the current list (and the stuff withing one item
before moving to the next) before continuing the search if
forward and backward accessibility focus direction.

4. View focus search stops at root namespace. This is not the right
way to prevent some stuff that is not supposed to get a focus in
a container for a specific state. Actually the addFocusables
for that container has to be overriden. Further this approach
leads to focus getting stuck. The accessibility focus ignores
root names space since we want to traverse the entire screen.

5. Fixed an bug in AccessibilityInteractionController which was not
starting to search from the root of a virtual node tree.

6. Fixed a couple of bugs in FocusFinder where it was possible to
get index out of bounds exception if the focusables list is empty.

bug:5932640

Change-Id: Ic3bdd11767a7d40fbb21f35dcd79a4746af784d4
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
57aab755441a28c2e5c78c35a57b940afc2799e0 10-May-2012 alanv <alanv@google.com> Fixed typo in findAccessibilityFocus API.

Change-Id: I3ca1448792a1b712f781c1bfa73823ca08ea3d39
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
0a1bb6dffc358c01e10555c5c833edb7dba69659 07-May-2012 Svetoslav Ganov <svetoslavganov@google.com> AccessibilityNodeInfo for visible views should reported.

1. AccessibilityNodeInfos for visible views should always
be reported and the clients should be able to check
whether that node info is shown to the user. For example,
focus search may return a node that is not on the screen
and the accessibility layer may decide to give it focus
which scroll the source view in the screen.

bug:6421991

Change-Id: Idc1fd8512dda767abe802aacedb0c69582e6fc2a
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
76f287e416ded85734b610f316e38d243d2ddb09 23-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Removing hierarchical accessibility focus directions.

1. The accessibility focus directions are not needed since an
accessibility service just get the root, first child, next
sibling, previous sibling and call execute the action to
give it accessibility focus. Now the accessibility node
info tree is properly ordered taking into account layout
manager directions for both layout manager that we report
and ones that we have determined as not important for
accessibility. Also the position of a node info are ordered
properly based on their coordinates after all transformations
as opposed to child index.

bug:5932640

Change-Id: I994a8297cb1e57c829ecbac73a937c2bcbe0bac7
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
aa780c110922148a6a4ba06734bb2b0bb8c98f93 20-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding support for traversing the content of a node info at granularity.

1. A view that creates an accessibility node info may add to the info
a list of granularity labels. These are granularities by which the
source view can iterate over its content. For example a text view
may support character, word link while a web view may additionally
support buttons, tables, etc. There are actions on accessibility
node info to go to the next/previous at a given granularity which
is passesed as an argument.

2. Added Bundle argument to the APIs for performing accessibility
actions. This is generic and extensible.

bug:5932640

Change-Id: I328cbbb4cddfdee082ab2a8b7ff1bd7477d8d6f9
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
749e796eb3a42e21613a3b360000373601a8f50d 20-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> UI test automation cannot get the root node and gets null children.

1. The AccessibilityInteractionController was using an incorrect
looper i.e. not the UI thread looper which was causing getting
the root node to fail.

2. The AccessibilityNodeInfo was populated by a ViewGroup with the
children for accessibility without checking whether these children
are really displayed.

bug:6362875

Change-Id: I7906d89571eb9d57d10f971639f88632926dd077
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
005b83b0c62d3d0538f0d566b08bd457015ec661 17-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding some more gestures and actions for accessibility.

1. Added more gesture for accessibility. After a meeting
with the access-eng team we have decided that the current
set of gestures may be smaller than needed considering
that we will use four gestures for home, back, recents,
and notifications.

2. Adding actions for going back, home, opening the recents,
and opening the notifications.

3. Added preliminary mapping from some of the new gestures
to the new actions.

4. Fixed a bug in the accessibility interaction controller
which was trying to create a handled on the main looper
thread which may be null if the queried UI is in the
system process. Now the context looper of the root view
is used.

5. Fixed a bug of using an incorrect constant.

6. Added a missing locking in a couple of places.

7. Fixed view comparison for accessibilityt since it was
not anisymmetric.

bug:5932640
bug:5605641

Change-Id: Icc983bf4eafefa42b65920b3782ed8a25518e94f
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
b3830f6737bb17185e2e1c95f4dcde9ce82ac7e4 18-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Views with zero alpha are shown for accessibility.

1. Views that a user cannot see should not be reported for
accessibility. The check for zero alpha was missing.

bug:6291855

Change-Id: I3cb4c19cccf0dc2427677df630d124c36bd4770b
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java
4213804541a8b05cd0587b138a2fd9a3b7fd9350 20-Mar-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility focus - framework

Usefulness: Keep track of the current user location in the screen when
traversing the it. Enabling structural and directional
navigation over all elements on the screen. This enables
blind users that know the application layout to efficiently
locate desired elements as opposed to try touch exploring the
region where the the element should be - very tedious.

Rationale: There are two ways to implement accessibility focus One is
to let accessibility services keep track of it since they
have access to the screen content, and another to let the view
hierarchy keep track of it. While the first approach would
require almost no work on our part it poses several challenges
which make it a sub-optimal choice. Having the accessibility focus
in the accessibility service would require that service to scrape
the window content every time it changes to sync the view tree
state and the accessibility focus location. Pretty much the service
will have to keep an off screen model of the screen content. This
could be quite challenging to get right and would incur performance
cost for the multiple IPCs to repeatedly fetch the screen content.
Further, keeping virtual accessibility focus (i.e. in the service)
would require sync of the input and accessibility focus. This could
be challenging to implement right as well. Also, having an unlimited
number of accessibility services we cannot guarantee that they will
have a proper implementation, if any, to allow users to perform structural
navigation of the screen content. Assuming two accessibility
services implement structural navigation via accessibility focus,
there is not guarantee that they will behave similarly by default,
i.e. provide some standard way to navigate the screen content.
Also feedback from experienced accessibility researchers, specifically
T.V Raman, provides evidence that having virtual accessibility focus
creates many issues and it is very hard to get right.
Therefore, keeping accessibility focus in the system will avoid
keeping an off-screen model in accessibility services, it will always
be in sync with the state of the view hierarchy and the input focus.
Also this will allow having a default behavior for traversing the
screen via this accessibility focus that is consistent in all
accessibility services. We provide accessibility services with APIs to
override this behavior but all of them will perform screen traversal
in a consistent way by default.

Behavior: If accessibility is enabled the accessibility focus is the leading one
and the input follows it. Putting accessibility focus on a view moves
the input focus there. Clearing the accessibility focus of a view, clears
the input focus of this view. If accessibility focus is on a view that
cannot take input focus, then no other view should have input focus.
In accessibility mode we initially give accessibility focus to the topmost
view and no view has input focus. This ensures consistent behavior accross
all apps. Note that accessibility focus can move hierarchically in the
view tree and having it at the root is better than putting it where the
input focus would be - at the first input focusable which could be at
an arbitrary depth in the view tree. By default not all views are reported
for accessibility, only the important ones. A view may be explicitly labeled
as important or not for accessibility, or the system determines which one
is such - default. Important views for accessibility are all views that are
not dumb layout managers used only to arrange their chidren. Since the same
content arrangement can be obtained via different combintation of layout
managers, such managers cannot be used to reliably determine the application
structure. For example, a user should see a list as a list view with several
list items and each list item as a text view and a button as opposed to seeing
all the layout managers used to arrange the list item's content.
By default only important for accessibility views are regared for accessibility
purposes. View not regarded for accessibility neither fire accessibility events,
nor are reported being on the screen. An accessibility service may request the
system to regard all views. If the target SDK of an accessibility services is
less than JellyBean, then all views are regarded for accessibility.
Note that an accessibility service that requires all view to be ragarded for
accessibility may put accessibility focus on any view. Hence, it may implement
any navigational paradigm if desired. Especially considering the fact that
the system is detecting some standard gestures and delegates their processing
to an accessibility service. The default implementation of an accessibility
services performs the defualt navigation.

bug:5932640
bug:5605641

Change-Id: Ieac461d480579d706a847b9325720cb254736ebe
/frameworks/base/core/java/android/view/AccessibilityInteractionController.java