• Home
  • History
  • Annotate
  • only in /frameworks/base/core/java/android/accessibilityservice/
History log of /frameworks/base/core/java/android/accessibilityservice/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
466b71e1a287bd20560f1bf10db15e5fa7f2c8d1 20-Apr-2018 Phil Weaver <pweaver@google.com> Add config value for fingerprint gesture support

Also correcting docs for using the fingerprint gesture
flag.

Bug: 76419487
Test: Verified with a test a11y service that gestures are
not available. Adding a unit test to verify this case.

Change-Id: I90233613777013e8b117a2d94f767be292c80019
ccessibilityServiceInfo.java
bd573236f8f419161c56be72876a0546f650f947 26-Feb-2018 Eugene Susla <eugenesusla@google.com> [DO NOT MERGE] Sort A11yService#getWindows by layer descending

This is what A11yService#getWindows promises in the javadoc.

Fixes: 71581072
Test: using testback ensure the order is correct
Change-Id: I5038c4de29c60e235b65751f7bd7771ef35eb339
(cherry picked from commit f40da1a884493b6af61e3b978fdf7c7ff059b2dc)
ccessibilityService.java
c09a02198718761e20e351f4bf0ee9e30a716d11 13-Mar-2018 Phil Weaver <pweaver@google.com> Expose if running a11y service has crashed

Using a hidden variable to communicate this for enabled
services. Used in Settings to report the current status.

Fixes: 35219990
Test: Adding unit test to verify that crashed value is
populated correctly. Run a11y unit and cts tests.

Change-Id: Ia47a8bd1d750186c504758df21e05a8a76c285cb
ccessibilityServiceInfo.java
24c90450fe3fe097a7bca51edd6a4cffd8fd13aa 28-Dec-2017 Svetoslav Ganov <svetoslavganov@google.com> Autofill compatibility mode.

Autofill helps users fill credentials, addresses, payment methods,
emails, etc without manually typing. When focus lands on a fillable
element the platform captures a snapshot of the screen content and
sends it to an autofill service for analysis and suggestions. The
screen snapshot is a structured representation of the screen content.
If this content is composed of standard widgets, autofill works
out-of-the-box. However, some apps do their own rendering and
the content in this case looks like a single view to the platform
while it may have semantic structure. For example, a view may render
a login page with two input test fields.

The platform exposes APIs for apps to report virtual view structure
allowing autofill services to handle apps that have virtual content.
As opposed to apps using standard widgets, this case requires the app
developer to implement the new APIs which may require a fair amount
of code and could be seen as a processes that could take some time.
The most prominent typs of apps that fall into this category are
browsers.

Until most apps rendering virtual content and specifically browsers
don't implement the virutal APIs, autofill providers need to fall-
back to using the accessibliity APIs to provide autofill support
for these apps. This requires developers to work against two sets
of APIs - autofill and accessibility - which is incovenient and error
prone. Also, users need to enable two plugins - autofill and
accessibility which is confusing. Additionally, the privacy and
perfomance impact of using the accessibility APIs cannot be addressed
while autofill providers need to use thes APis.

This change adds an autofill compatibility mode that would allow
autofill services to work with apps that don't implement the
virtual structure autofill APIs. The key idea is to locally enable
accessibility for the target package and remap accessibility to
autofill APIs and vise versa. This way an autofill provider codes
against a single set of APIs, the users enable a single plugin,
the privacy/performance implications of using the accessibility
APIs are addressed, the target app only takes a performance hit
since accessibility is enabled locally which is still more efficient
compared to the performance hit it would incur if accessibility is
enabled globally.

To enable compatibility mode an autofill service declares in its
metadata which packages it is interested in and also what is
the max version code of the package for which to enable compat
mode. Targeted versioning allows targeting only older versions of
the package that are known to not support autofill while newer
versions that are known to support autofill would work in normal
mode.

Since compatibility mode should be used only as a fallback we
have a white list setting with the packages for which this mode
can be requested. This allows applying policy to target only
apps that are known to not support autofill.

Test:
cts-tradefed run cts-dev -m CtsAutoFillServiceTestCases
cts-tradefed run cts-dev -m CtsAccessibilityServiceTestCases

bug:72811034

Change-Id: I11f1580ced0f8b4300a10b3a5174a1758a5702a0
ccessibilityServiceInfo.java
d0429743fa6c3a4ce9dd3b1ec903a0c553e76969 17-Jan-2018 Phil Weaver <pweaver@google.com> Add a11y action to take screenshot

Bug: 70392997
Test: Adding unit test for functionality, cts test
for presence of api.

Change-Id: Ib5bc2217e1d29f527db0f0fadb69fd8249d6c279
ccessibilityService.java
ce8db9911494225fcd99711d7df85a130de5a6ce 14-Dec-2017 Jeff Sharkey <jsharkey@android.com> Add more IntDef prefixes for auto-documenting.

Test: builds, boots
Bug: 70177949
Exempt-From-Owner-Approval: annotation-only changes
Change-Id: I76dde6054e06f52240bd4b1a0f196dcb74623608
ccessibilityService.java
240aed987c66fe7ee1a1c4d862c3d57ac03b14b3 02-Dec-2017 Svet Ganov <svetoslavganov@google.com> Prevent reporting fake package name - framework

Test: added AccessibilityEndToEndTest#testPackageNameCannotBeFaked
cts-tradefed run cts -m CtsAccessibilityServiceTestCases
cts-tradefed run cts -m CtsAccessibilityTestCases

bug:69981755

Change-Id: I13304efbee10d1affa087e9c8bc4ec237643283e
AccessibilityServiceConnection.aidl
d4128ec0df2d40d46b4fa0ff6edae393f3bf67b9 04-Dec-2017 Eugene Susla <eugenesusla@google.com> Revert "Don't generate irrelevant a11y events - framework"

This reverts commit 8ddfb4794f128ad6ac10fed72c73fdec61ea7bcb.

Test: presubmit
Bug: 69975306
Change-Id: I05cb545eb0adc77298dddf2dea2997ef36b58a5f
ccessibilityServiceInfo.java
8ddfb4794f128ad6ac10fed72c73fdec61ea7bcb 16-Nov-2017 Svet Ganov <svetoslavganov@google.com> Don't generate irrelevant a11y events - framework

Now before we fire an a11y event we check if this event has an
observer. As a bonus we don't push the state to clients if the
dynamic service config did not change.

Test: cts-tradefed run cts-dev -m CtsAccessibilityServiceTestCases

bug:69427760

Change-Id: Ie208e13b8557bb7a120198a43efcb79c2752f5db
ccessibilityServiceInfo.java
f9a651d64c687297c0739982bedc7a8a34c778cf 11-Oct-2017 Eugene Susla <eugenesusla@google.com> Global a11y action to lock screen

Fixes: 25567237
Test: ensure API works using TestBack
Change-Id: I335fd6b44d2c67b53a2c1f6224d16bd798276c8b
ccessibilityService.java
a55f74e45d30ef9f533c9cf8d47f01df5ed05fec 21-Sep-2017 Eugene Susla <eugenesusla@google.com> Magnification Gestures CTS test

Test: ensure affected CTS tests pass
Change-Id: I2ad9ef57098d1e9343d571e0d59504851ac691eb
estureDescription.java
6f2da205cc9b737356c67c8007f9fa7fbf92a4df 06-Sep-2017 Phil Weaver <pweaver@google.com> Don't call disconnected AccessibilityServices

An AccessibilityService that doesn't have a connection is
not able to access the resources it needs to respond to
callbacks.

Bug: 65367289
Test: Toggle Select to Speak several times, with and
without TalkBack enabled. No longer crashes. A11y unit
tests and A11yService CTS passes.

Change-Id: I03c647cbaf68d5defcc7fbcec1c746af9968bd35
ccessibilityService.java
67f9d5070a74a0bf34f0335899a96dedcac26c96 05-Aug-2017 Jeff Sharkey <jsharkey@android.com> Fix broken javadocs.

Bug: 64337634
Test: make -j32 doc-comment-check-docs
Change-Id: I20fdd3dcddef09111d35946c41c596c7689effa6
ccessibilityService.java
ingerprintGestureController.java
921384157d422dffed91acab1168176e38733ae8 01-May-2017 Casey Burkhardt <caseyburkhardt@google.com> Merge "Fix accessibility button CTS test" into oc-dev
63827ce61b95439d97dfde163cf4423fa638f0be 01-May-2017 Jeff Sharkey <jsharkey@google.com> Merge "Change String to CharSequence in #loadSummary." into oc-dev
cb75b5454b54f7d443f1552adb7813ca139d22e3 29-Apr-2017 Saige McVea <saigem@google.com> Change String to CharSequence in #loadSummary.

Per API council review, localized strings should return CharSequence. Also
updated doc.

Test: ag/1813674

Bug: 37723508

Change-Id: I5ae868c2dda64d3756ad477578c65708242fde8c
ccessibilityServiceInfo.java
2402943ae56dab7ea1387780bfdc565dd9a8e9b2 29-Apr-2017 Casey Burkhardt <caseyburkhardt@google.com> Fix accessibility button CTS test

Ensure accessibility button callbacks are registered with a
Handler that has a valid Looper.

Bug: 37789861
Test: Passing CTS
Change-Id: Idf91547940fe7754bbabe55a729193c4100b8532
ccessibilityButtonController.java
be2922ff34424cfb996d895cde0cb31c724d09dc 28-Apr-2017 Phil Weaver <pweaver@google.com> A11y changes for API council

Bug: 37749679
Bug: 37747749
Bug: 37737948
Bug: 37718183
Bug: 37720667
Bug: 37724600
Bug: 37708057

Test: Updating unit and cts tests, which still pass.
Change-Id: If28bdf985c4314e8e84dcd6510f406dd4e80dd38
ccessibilityService.java
ccessibilityServiceInfo.java
ingerprintGestureController.java
estureDescription.java
cfbe105e4bade5f1143d0f3411b638690bae19ba 28-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Rename FingerprintGestureCallback.onGesture" into oc-dev
a338b51e0232daadbee7fe9dd861cd78e9e6d9a9 27-Apr-2017 Casey Burkhardt <caseyburkhardt@google.com> @NonNull on AccessibilityButtonController methods

Make Handler parameter @NonNull and adjust implementation
to always expect non-null Handlers.

Bug: 37709203
Test: Manual
Change-Id: I3937ae1c4e49bfc7652750cc64cac9e78f9d3ce2
ccessibilityButtonController.java
d7e1fb89d961636bcb98777efbb39c987fad2b7d 27-Apr-2017 Phil Weaver <pweaver@google.com> Rename FingerprintGestureCallback.onGesture

Renaming to onGestureDetected.

Deprecating onGesture. It needs to be removed for release.
Leaving it in to avoid breaking TalkBack, which is using it.

Bug: 37708057
Test: Accessibility unit and CTS tests still pass.
Change-Id: Icd66889216fc978ad6d27aa83a8c8d13869daad3
ingerprintGestureController.java
09d4ff8960cd3d45988b0c3ff0835d281f0e16b5 31-Mar-2017 Phil Weaver <pweaver@google.com> Remove a11y web flags and associated settings

Bug: 35707622
Bug: 28322375
Test: Ran a11y cts. Updated those tests in linked CL to
ignore this feature.

Change-Id: I1dccb3ae4e1f4d6bb832ae1b0edd4dad4a54289e
ccessibilityServiceInfo.java
f00cd14f17c0acd6bffe78947d32ea0a2900d139 03-Mar-2017 Phil Weaver <pweaver@google.com> Basic accessibility support for picture-in-picture

Exposing actions from the PIP InputConsumer to accessibility,
stripping all actions from a covered PIP app, and adding the
InputConsumer's actions on the PIP app's root view.

We were also using an "undefined" accessibility ID to mean
three different things: a root view, a host view of a virtual
view hierarchy, and a truly undefined view. I've introduced
new values for cases where the id could be defined.

Also gathering all window IDs into one place to reduce the
chance of collisions.

Bug: 34773134
Test: In progress. Current cts passes.
Change-Id: I97269741a292cf406272bf02359c76c396f84640
ccessibilityService.java
08c41bcf5fab665cebc820ea813be52f6ecc3154 21-Jan-2017 Saige McVea <saigem@google.com> Accessibility settings refresh.

Categories were added to accessibility service info objects so that they can be grouped
in system Settings. Services can declare a category in their accessibility manifest file,
and if no category is defined, the service is placed under the "Other services" category.

Bug: 30374533

Test: Manually tested with BrailleBack & CTS tests modified to validate proper loading of summary.

Change-Id: I8718556764f2be4a18ce4e80e6bbd4950a41e387
ccessibilityServiceInfo.java
e231986368ea9f6e634cc1fc8d40dae0103ca8eb 23-Feb-2017 Phil Weaver <pweaver@google.com> Revert "Remove abstract from AccessibilityService methods"

This reverts commit 7c01afdd18fd4e81c0bfff2f9062b752a13576a5.

Change-Id: I08990f4fc695b9323051e05a32c35fb9fe426146
ccessibilityService.java
7c01afdd18fd4e81c0bfff2f9062b752a13576a5 22-Feb-2017 Phil Weaver <pweaver@google.com> Remove abstract from AccessibilityService methods

Two methods on AccessibilityService were declared abstract, but
there doesn't seem to be a good reason for them to be abstract, as
it's possible to write an accessibility service that doesn't do
anything useful with the methods. Removing the abstract qualifier
to reduce boilerplate for service developers.

Bug: 31705365
Test: Trivial change, so I just verified that it builds.
Change-Id: I2af39848c8ab343d562361fdc1c3f8ca3ecb5f00
ccessibilityService.java
7917a2f020b95a6372dd3c506183ea345ab5ae24 17-Feb-2017 Phil Weaver <pweaver@google.com> Verify fingerprint exists before using it

The process will crash if we try to obtain a FingerprintManager
on a device that doesn't implement one. Verify that the feature
exists before trying.

Bug: 34923693
Test: Ran A11y unit tests and a11y fingerprint cts.
Change-Id: I48ad1c2c9c0c5739d8b1826c3c53bb817078e6cf
ccessibilityService.java
ccessibilityServiceInfo.java
1e2758256a391be23c537725f0a7785e4fb5b7d0 07-Feb-2017 Phil Weaver <pweaver@google.com> Merge "Provide text locations to accessibility services."
c2e28932d22faece6e7179c78d4e7656dc63052c 08-Dec-2016 Phil Weaver <pweaver@google.com> Provide text locations to accessibility services.

Bug: 30170631
Test: New CTS tests on linked CL.
Change-Id: I723e3777189c8df71c59dada00abdf339ebc983d
AccessibilityServiceConnection.aidl
048c2bc19af4cfcb5e959f1bc07fbfa03a72e330 09-Dec-2016 Casey Burkhardt <caseyburkhardt@google.com> Initial implementation of Nav Bar Accessibility Button

This allows an AccessibilityService to set a flag in its
AccessibilityServiceInfo that triggers the navigation bar to show an
Accessibility Button and observe callbacks when the button is clicked
or there are changes in the visibility of the navigation bar.

Test: Manual (Created a sample AccessibilityService) + CTS
Bug:29231271
Change-Id: I03d653d85bc37df28ed71d8bba94b7c75fe56e43
ccessibilityButtonController.java
ccessibilityService.java
ccessibilityServiceInfo.java
AccessibilityServiceClient.aidl
AccessibilityServiceConnection.aidl
27fcd9c97a2ceb50bab026237390207e5ee9e290 21-Jan-2017 Phil Weaver <pweaver@google.com> Accessibility can capture fingerprint gestures

Bug: 27148522
Test: Unit tests for two new classes in this CL, CTS in
linked CL.
Change-Id: Icb5113e00b1f8724814263b3cc7f72fe4a6f0b41
ccessibilityService.java
ccessibilityServiceInfo.java
ingerprintGestureController.java
AccessibilityServiceClient.aidl
AccessibilityServiceConnection.aidl
106fe732050f3d75a08c3bc48fdbcf84cac20b41 23-Nov-2016 Phil Weaver <pweaver@google.com> New accessibility shortcut.

Removing accessibility gesture from power dialog.

Adding new accessibility shortcut activated by holding both volume
buttons down. This shortcut is configurable by OEMs and users to
work with any installed accessibility service.

Bug: 30160335

Test: Added automated testing for the EnableAccessibilityController.
Manually toggled various services on and off.
Change-Id: I546bd29a2ab1ba64a0cbfd11e2004cdf85ee6cfd
ccessibilityServiceInfo.java
4acc16d1b611074baa9eeb7ec5628350b7eb5fa5 15-Sep-2016 Phil Weaver <pweaver@google.com> Add flag and listener for a11y volume requests.

We're adding a dedicated volume level for accessibility. Services
can use the new flag to request that this volume be activated for
accessibility usages.

To let AudioManager know when the request state changes, adding a
hidden convenience method to check if any active service requests
the a11y volume stream. This method can be used to enable the
stream and to decide when to show the UI to change its volume.

AudioManager wanted a listener for changes to this flag, so rather
than add yet another special-purpose listener, I've added one that
gets called back whenever there are state changes in a11y services.
These changes happen infrequently enough that we shouldn't need
more targeted methods.

Bug: 30448020
Bug: 27899567

Test: Adding CTS in linked CL.
Change-Id: Ifc53314dc7d9a6ee3d50b04ebcc1a87280cafa5e
ccessibilityServiceInfo.java
eb1375c091d9df48b11bc44e34527b52b63d8f96 21-Dec-2016 Eugene Susla <eugenesusla@google.com> Always propagate AccessibilityCache events

Bug: b/32642665
Test: Steps:
- Retrieve root AccessibilityNodeInfo
- Change text on its child TextView
- Wait for a few seconds to let the AccessibilityEvent propagate to
the AccessibilityCache
- Get the child AccessibilityNodeInfo from the root, corresponding to
that TextView, and ensure that it's updated to reflect the text
change
Change-Id: Icbdb91803b646fa06aaf11996d350f6f65c1e809
ccessibilityService.java
AccessibilityServiceClient.aidl
2f165944ce6109134e7285a71da32d1a1647960b 21-Sep-2016 Phil Weaver <pweaver@google.com> Support continuing dispatched a11y gestures.

Test: Ran the tests in this CL, as well as new CTS tests for
the new API.

Bug: 29477207
Change-Id: Ie5aba553286e954f7afe76ccfa97a7e8be9d75af
estureDescription.java
3cdd6c7654ff688b2dbd638e388bc56db7a020e2 03-Nov-2016 Phil Weaver <pweaver@google.com> Add check for null manger for a11y recents action

Bug: 31986988

Test: Ran A11y cts
Change-Id: Ia6a1e1b921d8b0008edbcf1f1a8d1d3d0eb969c6
ccessibilityService.java
752047dd3d04d35d67bfce5c938a584fbd585d49 08-Sep-2016 Phil Weaver <pweaver@google.com> Strengthen language about use of a11y API.

Bug: 30898472
Change-Id: I0c2afde3f750e880cb1ef087d092719ea145756d
ccessibilityService.java
a8918f23c712e97fa1dc4911f64827d64fc906e5 05-Aug-2016 Phil Weaver <pweaver@google.com> Limit capabilities of a11y gesture dispatch.

Changing the service side to accept descriptions of
motion events, not motion events themselves, so we can
control their creation.

Bug: 30647115
Change-Id: Ia6772a1fc05df91818e3f88959d1e2b4a35fe0cc
ccessibilityService.java
estureDescription.java
AccessibilityServiceConnection.aidl
2fbdd48682c32407daff4fd6577c3838c7c7a220 02-May-2016 Phil Weaver <pweaver@google.com> Reduce cost of a11y services with magnification.

Services that declare that they can control magnification,
but never actually make a change or register a listener
waste cycles as we compute magnification data they never use.

Avoid registering for magnification callbacks unless magnification
gestures are enabled, a service is listening for magnification
changes, or a service has changed magnification.

Bug: 28425922
Change-Id: I114a833669bd53b2cd757c94ea52b65a2f838a08
ccessibilityService.java
AccessibilityServiceConnection.aidl
19557de7676441a5e3f972b9dca128a2edb7a036 06-May-2016 Phil Weaver <pweaver@google.com> Make AccessibilityService#disableSelf atomic.

This API was using a oneway aidl call, which meant that the
service was disabled some time after the method returned. That
confused tests that were turning a service off during tearDown
and then turning it back on again in setUp.

Bug: 28621277

Change-Id: I75984df0613bdbb1bc876e2a15caf59106027337
AccessibilityServiceConnection.aidl
1f70f0b7d60ad0b98fe6597162769bce8b85e3ed 28-Apr-2016 Phil Weaver <pweaver@google.com> Merge "Fix several accessibility magnification issues." into nyc-dev
70439244ba1abc4f32357d2ee8ff38f73158fe37 11-Mar-2016 Phil Weaver <pweaver@google.com> Fix several accessibility magnification issues.

Clarifying region used for magnification as "magnificationRegion",
both in the public API and in the code. There's been significant
confusion about what "magnfifiedRegion" means. Removing
"availableRegion" from everywhere except where it's required, as
that region was identical to magnified/magnification region.

Trying to shut down magnification was a complex situation where
animations in progress and new magnification requests were tricky to
handle correctly. It was not possible to guarantee that the
magnification callbacks were unregistered consistently. There were
at least two situations that led to phone restarts:
1. If a triple tap was detected between unregistering the callbacks
and shutting down the input filter. In this case the magnification
request would go through.
2. If an animation had just started when magnification was turned
off, so the current magnification was 1.0 but the animator was
about to change it. In this case the callbacks would be unregistered,
and then the animator would start changing the magnification.

This change makes registering and unregistering magnification atomic.
It also makes MagnificationController stick around indefinitely once it
is created, registering and unregistering as needed to support
magnification gestures and services that control magnification. Services
that merely query the status of magnification no longer register for
callbacks.

One part of shutting down is turning off the animation and guaranteeing
that it won't try to make further changes. Adding a flag to
SpecAnimationBridge and a lock in that class so we can guarantee that
nothing happens when we aren't registered for magnification callbacks.

Also reconfiguring all accessibility options when a service stops to
make sure that only the features required by the current configuration
are enabled.

Bug: 27497138
Bug: 27821103
Change-Id: If697cbd34b117d82c8eee1ba7d0254089ee4241d
ccessibilityService.java
aa86697b764a66ce88650e126ff57e1a85585915 26-Apr-2016 Phil Weaver <pweaver@google.com> Support zero-length paths for a11y gestures.

Allows taps to be made at a single point.

Bug: 28378216
Change-Id: I398882faef77b3200aa9813c8d36c5d806521a22
estureDescription.java
155dda1e433a003f65b1d6a65d54bec107d27db5 07-Apr-2016 Phil Weaver <pweaver@google.com> Treat accessibility gestures like physical ones.

Gestures now operate on the screen as the user sees it, so they are
affected by magnification. This makes gesture coordinates consistent
with the node bounds in screen and makes an eye or head tracking service
work much more easily.

Bug: 27747314
Change-Id: Idee60398d49d8c9af7405d974893c796b034c974
ccessibilityService.java
5af3084049daf76aae1fd3af84c58ee4fa093415 04-Apr-2016 Phil Weaver <pweaver@google.com> Merge "Remove docs for removed a11y gesture methods." into nyc-dev
b5e89c6debca90be92bf5bc2e0e79d109de6d08f 02-Apr-2016 Jeff Sharkey <jsharkey@android.com> Support direct-boot tests.

Add shell commands to check on current FBE status and system ready
status. Mark variables without first-class locking as volatile.

Fix bug where UI automation would crash while device was locked by
marking it as forced direct-boot aware.

Bug: 26498834
Change-Id: Ib4dfb9350925e5413f93a09baacf84c62f2ba0ea
ccessibilityServiceInfo.java
8313881e2855b6057812458d37b2dcd804f54953 30-Mar-2016 Phil Weaver <pweaver@google.com> Remove docs for removed a11y gesture methods.

Bug: 27364143
Change-Id: I853090b7bd27cbb887e49ed6755179b596fa6a74
estureDescription.java
104138198feffc8ef5069c16c210eb8684bf8662 21-Mar-2016 Phil Weaver <pweaver@google.com> Merge "Clarify docs about event recycling." into nyc-dev
96fea022f29f13c296ccf9388966bf0efa805f6e 08-Mar-2016 Phil Weaver <pweaver@google.com> Clarify docs about event recycling.

Bug: 27454838
Change-Id: I65d0ced3198dc6ad45b99e4932a0d6e32306cf10
ccessibilityService.java
b2cc929657926750336b22a9333c3738dfa38e29 18-Mar-2016 Phil Weaver <pweaver@google.com> Merge "Update a11y gesture and magnification APIs." into nyc-dev
8a372a0a280127743ce9a7ce4b6198c7a02d2a4f 16-Mar-2016 Jeff Sharkey <jsharkey@android.com> Refactoring FBE APIs based on council feedback.

Mostly consists of removing the word "encryption" from most APIs,
since we can't actually make promises about the data being encrypted.

Bug: 27531029
Change-Id: Iace9d7c4e64716abf86ed11847c40f3947e1d625
ccessibilityServiceInfo.java
4503fcfa2d26091c2a02d610da591e8b7c7b5a9f 09-Mar-2016 Phil Weaver <pweaver@google.com> Update a11y gesture and magnification APIs.

Making changes requested by API review.

Also rethrowing all RemoveExceptions. Removing one exception thrown
when a service is called before it is connected since no other
method does that.

Bug: 27364143
Change-Id: I9b9b549552565802da36a735fd7e3ff2e148dc34
ccessibilityService.java
estureDescription.java
3204251a4a77789d3ed64cd09fed173aca7be4bc 01-Mar-2016 Anna Galusza <agalusza@google.com> Throw exception from SoftKeyboardController if connection is dead and declare
SHOW_MODE_AUTO and SHOW_MODE_HIDDEN in AccessibilityService class.
Bug: 27364143

Change-Id: I02c23fbfab1eae8b2a155b1d9c3857e4eb6addb1
ccessibilityService.java
8ca583b29f7a06dcd2ccb2da7c4273d4db8bf7fd 26-Feb-2016 Phil Weaver <pweaver@google.com> Merge "Accessibility to toggle multiwindow mode" into nyc-dev
315c34e7d62ce4b609f2d08b18a11a2d44e93aba 20-Feb-2016 Phil Weaver <pweaver@google.com> Accessibility to toggle multiwindow mode

Encapsulating the logic to toggle multiwindow mode from recents,
and plumbing it through to accessibility global actions. Sending
accessibility events when windows bounds change. Exposing the
dock divider window type to accessibility services.

Bug: 27250995
Change-Id: Ib7491f1f853dc7f01bf5c5a4ac1f914f55d0608a
ccessibilityService.java
e88e2665471c7b620fd3b1baca024fc9e705ee32 24-Feb-2016 Jeff Sharkey <jsharkey@android.com> Update accessibility to be encryption-aware.

Look for both EA and non-EA accessibility services, but when the user
is locked only bind to EA services. Once the user is unlocked, we
take another pass and bind to any non-EA services.

We only consider disabling accessibility once the user is unlocked,
since there could be non-EA services waiting in the wings.

Bug: 25860579
Change-Id: I97bd019661457c3577d629ba12290d02f026011a
ccessibilityServiceInfo.java
78d2e2ddf07414eb342094ad8cf9d830b2220528 02-Feb-2016 Phil Weaver <pweaver@google.com> Clean up accessibility gestures.

Closing two small holes in the implementation:
1. The gesture was dispatched before the callback was registered. It
was possible for gestures that failed quickly to fail to report any
status.
2. Gestures could be dispatched before the input filter was
installed. Adding a wait to give the filter a chance to install
before reporting a failure.

Also removing an unused method on the input filter.

Change-Id: I77cd80dcd2cec6c72b3761169aba5eaecf62250b
(cherry picked from commit 03465fb874ccf35ead2228b66ec03afc31d7694e)
ccessibilityService.java
f3e5d1d483231d615f5e77032f787fcd8047488b 29-Jan-2016 Anna Galusza <agalusza@google.com> Merge "Add API for IME control by Accessibility Services."
40ded287c432637158954f84a6d9cdacffc8f181 26-Jan-2016 Phil Weaver <pweaver@google.com> Clean up some accessibility documentation.

Removed and updated some obsolete documentation about window
content. Stated the purpose of accessibility. Updated docs
for getTextSelection to include its ability to get cursor
position. Clarified wording for accessibility overlays.

Change-Id: Iaa11b499c2b7ece12ca182d336376d97b961b54f
ccessibilityService.java
9b278112467581e2b8d99f29cf48b9fbef9cc53f 04-Jan-2016 Anna Galusza <agalusza@google.com> Add API for IME control by Accessibility Services.

Change-Id: I3bb806cf420e0551a2c9ef97d95613f73e362df9
ccessibilityService.java
AccessibilityServiceClient.aidl
AccessibilityServiceConnection.aidl
a9e7a3bbe859a8416e54be28bd1f055df60074e5 15-Dec-2015 Jinsong Mu <jinsong@google.com> Accessibility services can turn themselves off b/22514381
Added disableSelf() method to AccessibilityService
This newly added api used used in
https://googleplex-android-review.git.corp.google.com/#/c/833857/

Change-Id: I5fe60181058ef90dd496318cf270e0825bcc411a
ccessibilityService.java
AccessibilityServiceConnection.aidl
a6b64f5099b7be6e8384958d8bcddb97bb06ec93 05-Dec-2015 Phil Weaver <pweaver@google.com> Gesture dispatch from accessibility services.

Add public APIs to describe gestures and dispatch them from
an accessibility service. Added a new capability that
services must declare to have this capability.

Bug: 22514086

Change-Id: I9bff2d9335f0310115112d14b7ed033a6d6c2393
ccessibilityService.java
ccessibilityServiceInfo.java
estureDescription.java
AccessibilityServiceClient.aidl
AccessibilityServiceConnection.aidl
14ed6cf3e7bada4932314969000d384bed6d3f92 20-Nov-2015 Phil Weaver <pweaver@google.com> Ignore feedbackType in AccessibilityEvent dispatch

Send AccessibilityEvents to all accessibility services
that request them. No longer refuse to send them to
services with the same feedback type.

Change-Id: I137905c24fc75c075ab938175ecb6ea5f39112cf
ccessibilityService.java
214fb68767502f5fede643a062c1dc5975d75b27 17-Nov-2015 Alan Viverette <alanv@google.com> APIs for querying and controlling display magnification

Also separates magnification state and touch event handling. Moves
callbacks for window manager changes and display state changes into
the magnification controller.

Bug: 22718911
Change-Id: I3a8ba060a07d8f1f51856855a5f85601766fd45d
ccessibilityService.java
ccessibilityServiceInfo.java
AccessibilityServiceClient.aidl
AccessibilityServiceConnection.aidl
08c7116ab9cd04ad6dd3c04aa1017237e7f409ac 28-Feb-2015 John Spurlock <jspurlock@google.com> Remove unused imports in frameworks/base.

Change-Id: I031443de83f93eb57a98863001826671b18f3b17
ccessibilityService.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
AccessibilityServiceConnection.aidl
7c9746d4ef8ab3c500b501ab32933c5172a856ab 20-Nov-2014 Alan Viverette <alanv@google.com> Move default token handling into WindowManagerImpl

BUG: 18451795
Change-Id: I1fc6db988ad879fded5318f33d08a4f09da38907
ccessibilityService.java
d2fa5143910c74fd126359f74b08de84b0f7cf2a 05-Nov-2014 Alan Viverette <alanv@google.com> Use default token instead of wrapped window manager

BUG: 18248602
Change-Id: Id7f06c896dc71db3564fa21d3704222557613035
ccessibilityService.java
3a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bb 14-Oct-2014 Svetoslav <svetoslavganov@google.com> APIs for an accessibility service to put interaction tracking overlays.

An accessibility service may register to observe the interactive windows
on the primary display. These windows are the one that has input focus and
ones a sighted user can touch. It is sometimes beneficial for an
accessibility service to overlay a window to intercept user interaction
and based on that introspect and perform an action on the windows that
are on the screen. This is problematic as overlaying a full screen window
that is touchable prevents the accessibility service to introspect the
content under this window.

This change adds a special type of window that only an accessibility service
can place which does not affect what an accessibility service can "see" on
the screen. Hence, even putting such a window full screen the service will
be able to interact with the other interactive windows it covers.

Change-Id: I053ccc3a5c6360a98dc40bdb172b54dab35d8b31
ccessibilityService.java
AccessibilityServiceClient.aidl
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
AccessibilityServiceConnection.aidl
a4725efd0bfa52cbddf6ca587d37fc4ebcbfaf72 24-Jul-2014 Svetoslav <svetoslavganov@google.com> Improve the window query API performamce.

We are caching the window data in the accessibility service process.
When windows change we were sending the dalta of the windows the
service knows about. To make this work when the app asked for all
windows we had to call into the system as new windows may have
appeared. This was slow.

Now we are telling the service some windows change and if it gets
the windows we cache them. We call into the system only on a cache
miss and evict all windows from the cache on window change event.
We do not evict the nodes of the window as the former may have
just moved. If views in a window change they fire accessibility
events that trigger the correct eviction.

Change-Id: I586a72a2497b0d44a75288fa758e7e88817f3300
ccessibilityService.java
AccessibilityServiceClient.aidl
e34560b21989eea54a139a0586d156ba573cc2ea 10-Jul-2014 Alan Viverette <alanv@google.com> Add accessibility action to open power long-press dialog

Also fixes an infinite recursion bug in the WindowManagerService
implementation of WindowManagerInternal.

BUG: 16129909
Change-Id: I4f9d32f4e6c3ad460652c5e5271540fa5032a1f5
ccessibilityService.java
f7174e87b6007000777b0124de9cef70d8618788 12-Jun-2014 Svetoslav <svetoslavganov@google.com> Fix backwards compatibility for introspected windows.

1. The APIs for introspecting interactive windows were reporting only
the touchable windows but were missing the focused window. The user
can interact with the latter by typing, hence it should always be
reported. Also this was breaking backwards compatibility as if the
focused window is covered by a modal one, the focused window was not
reporeted and this was putting the active window in a bad state as
the latter is either the focused window or the one the user is touching.

2. Window change events are too frequent as on window transition things
are chanign a lot. Now we are trottling the windows changed events
at the standard recurring accessibility event interval.

3. Fixed a wrong flag comparison and removed some unneded code.

buy:15434666
bug:15432989

Change-Id: I825b33067e8cbf26396a4d38642bde4907b6427a
ccessibilityService.java
ccessibilityServiceInfo.java
1e0d4af9986c8c2a658769a63bf8b385d25e0435 11-Apr-2014 Svetoslav <svetoslavganov@google.com> Adding system support for a single accessibility focus.

Now that we have APIs to query all interactive windows and allow
an accessibility service to put accessibility focus in each of
them we have to guarantee that there is a single accessibility
focus. This is required for correct operation of the touch
explorer as on double tap in clicks in the center of the focused
area, hence having more that one focus is an issue. Also the
system is maintaining a single input focus so now accessibility
focus behaves consistently with that.

bug:13965563

Change-Id: I0b5c26dadfabbf80dbed8dc4602073aa575ac179
ccessibilityService.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
ccessibilityService.java
ccessibilityServiceInfo.java
AccessibilityServiceClient.aidl
AccessibilityServiceConnection.aidl
23be199171bedb05e81864f8941492af066fa667 03-Oct-2013 Alan Viverette <alanv@google.com> Add importantForAccessibility mode to block entire hierarchy

Since older versions of the platform will crash if the mode is
set to 3, this CL adds an extra bit and uses 4 as the mode. This
will also cleanly default the mode to AUTO on unsupported
platforms.

BUG: 11031947
Change-Id: I48035abbf35523d65cead6f27be10f8087973ceb
ccessibilityServiceInfo.java
00d17f7aab54ef055d35da603dab5a7bae751876 07-Jun-2013 Scott Main <smain@google.com> add attributes to accessibility service info

Change-Id: I3651544164f718003b8eb1235a7d723f1bcee5be
ccessibilityServiceInfo.java
11adf6dc2438260c3e0d79cc189bcb4f6f15e9f4 24-Apr-2013 Svetoslav <svetoslavganov@google.com> The touch exploration capability is dynamically granted pre-JellyBeanMR2.

Since the enable touch exploration capability is dynamically granted by
the user for apps targeting pre-JellybeanMR2 API level, we have to properly
update the accessibility service info for that service and also avoid
caching copies of the service info.

bug:8633951

Change-Id: I83dd1c852706ec55d40cda7209ad842889fb970a
ccessibilityServiceInfo.java
db7da0eb8b7d515c168d5b410764e24c9a0f9431 23-Apr-2013 Svetoslav <svetoslavganov@google.com> Fixing bugs exposed when moving accessibility CTS tests to UiAutomation.

1. UiAutomation#executeAndWaitForEvent method was invoking the passed
runnable while holding the lock which may lead to a deadlock. For
example: a runnable that calls getActivity() gets us into a state
like this.

2. UI automation services did not get all capabilities such a
service can have. Now a UI test service gets all of them.

3. When UiAutomation was exiting for event fired as a result of a
performed action, it was checking whether the received evnet time
is strictly before the time of executing the command that should
fire the event. However, if the execution is fast enough, i.e.
less than one millisecond, then the event time and the execution
time are the same. This was leading to a missed signal in rare
cases.

4. AccessibilityNodeInfoCache was not clearing the relevant state
for accessibility focus clearing event.

5. Accessibility text traversal in TextView was partially using text
and partially content description - broken. Now we are using the
text since for text view and content desc for other views. In other
words, we are using the most precise text we have.

6. AccessibilityManagerService was not granting capabilities of a
UiAutomation service - plainly wrong.

CTS change:https://googleplex-android-review.googlesource.com/#/c/300693/

bug:8695422
bug:8657560

Change-Id: I9afc5c3c69eb51f1c01930959232f44681b15e86
ccessibilityServiceInfo.java
688a6977cf7673ed0542ab3d839053c4e38a4dbd 17-Apr-2013 Svetoslav <svetoslavganov@google.com> Replacing accessibility service permissions with capability attributes.

Accessibility services can perform special operations such as retrieve
the screen content, enable explore by touch, etc. To ensure the user
is aware that the service will perform special operations we were using
permissions. However, the special operations cannot be performed unless
the service is really enabled by the user and it is at this point that
we want to notify the user about the service capabilities.

This change adds capability attributes to the accessibility service's
meta-data XML file. The service has to declare the capability and when
it is enabled we show the user the capabilities in the warining dialog.

bug:8633951

Change-Id: Id3442dc71dad018e606888afdc40834682fdb037
ccessibilityService.java
ccessibilityServiceInfo.java
c4fccd183f1bb47a027bb303af5e65bec2f68b1b 09-Apr-2013 Svetoslav <svetoslavganov@google.com> Adding APIs for an accessibility service to intercept key events.

Now that we have gestures which are detected by the system and
interpreted by an accessibility service, there is an inconsistent
behavior between using the gestures and the keyboard. Some devices
have both. Therefore, an accessibility service should be able to
interpret keys in addition to gestures to provide consistent user
experience. Now an accessibility service can expose shortcuts for
each gestural action.

This change adds APIs for an accessibility service to observe and
intercept at will key events before they are dispatched to the
rest of the system. The service can return true or false from its
onKeyEvent to either consume the event or to let it be delivered
to the rest of the system. However, the service will *not* be
able to inject key events or modify the observed ones.

Previous ideas of allowing the service to say it "tracks" the event
so the latter is not delivered to the system until a subsequent
event is either "handled" or "not handled" will not work. If the
service tracks a key but no other key is pressed essentially this
key is not delivered to the app and at potentially much later point
this stashed event will be delivered in maybe a completely different
context.The correct way of implementing shortcuts is a combination
of modifier keys plus some other key/key sequence. Key events already
contain information about which modifier keys are down as well as
the service can track them as well.

bug:8088812

Change-Id: I81ba9a7de9f19ca6662661f27fdc852323e38c00
ccessibilityService.java
AccessibilityServiceClient.aidl
AccessibilityServiceConnection.aidl
bbfa585d70a6e406ccb59c17eec73ccd55e5c8e0 12-Feb-2013 Svetoslav <svetoslavganov@google.com> Adding new APIs to UiAutomation.

1. Accessibility service may set a flag to request a compressed
view of the node tree representing the screen. The compressed
state does not contain nodes that do to react to user actions
and do not draw content, i.e. they are dumb view managers. This
compressed hierarchy was very beneficial to the test team and
this change is exposing the APIs. The compression has to be
configurable since old tests are written against uncompressed
view tree. Basically we do not hide the fact that UIAutomation
is simply an accessibility service with some other useful APIs.

bug:8051095

2. Accessibility service can perform global actions such as opening
notifications, opening recent apps, etc. These are also needed
for UI testing since there is no other way to do it via the
existing UIAutomation APIs. Basically we do not hide the fact
that UIAutomation is simply an accessibility service with some
other useful APIs.

bug:8117582

Change-Id: I7b6e24b5f7a973fdada0cc199cff9f882b10720b
ccessibilityService.java
57bf88508e0491caced22c4c592d33aba6d88129 08-Feb-2013 Svetoslav <svetoslavganov@google.com> Refactoring of the Accessibility.

1. The accessibility manager service updates its internal state
based on which settings are enabled, what accessibility services
are installed and what features are requested by the enabled
services. It was trying to do the minimal amount of work to
react to contextual changes like these which resulted in missed
cases and complex code. Now there is a single method that reads
the contextual information and single method that reacts to
contextual changes. This makes the code much easier to maintain.

2. The accessibility manager service was not updating its internal
state when requested features from accessibility services change.
It was relying on changing system settings and reacting to the
settings change. This is problematic since the internal state is
not updated atomically which leads to race condition bugs. For
example, if touch exploration is enabled and a service requests
it is disabled, the internal state will not be updated but a
request for a settings change will be made. Now while the settings
change is propagating another request form the same service
comes to enable touch exploration but the system incorrectly
thinks touch exploration is enabled. At the end the feature is
disabled even though it was requested.

3. Fixed a potential NPE if the accessibility input filter's event
handler was nullified between processing two event batches.

4. Fixed a bug where, if magnification is enabled, it does not work
on the settings screen since the magnified bounds are not pushed
from the window manager to the accessibility manager.

Change-Id: Idf629a06480e12f0d88372762df6c024fe0d7856
ccessibilityServiceInfo.java
901309ce5904cbc7b07b01b49ac5cd26b356998a 05-Feb-2013 Svetoslav <svetoslavganov@google.com> Updating AccessibilityNodeInfo JavaDoc

Change-Id: I8f80ed127c73dd4d8bcf9fe81575bb438b3d0f57
ccessibilityServiceInfo.java
447d94684ee73046d769649d8247aacd581bd6e3 01-Feb-2013 Svetoslav Ganov <svetoslavganov@google.com> "Fixing backwards cmpatibility for enabling explore by touch""

This reverts commit d1ed3cea37e4156eab14b7dc8207a520c9eab700

Change-Id: I622ef034526f8f006a5a233e72487b062020e4f6
ccessibilityServiceInfo.java
d1ed3cea37e4156eab14b7dc8207a520c9eab700 01-Feb-2013 Mike Cleron <mcleron@google.com> Revert "Fixing backwards cmpatibility for enabling explore by touch"

This reverts commit 0a9c7c144671f70f5f1af222050bd3ec6b11fe41

Change-Id: I8da530a6d0a57163522d5a63326e787a8d22ecbf
ccessibilityServiceInfo.java
0a9c7c144671f70f5f1af222050bd3ec6b11fe41 01-Feb-2013 Svetoslav <svetoslavganov@google.com> Fixing backwards cmpatibility for enabling explore by touch

Change-Id: I8cbc4f03223d289547e3f3f6d1f528ad5b4f6f72
ccessibilityServiceInfo.java
0ec0418c6eac5076774a74855725d9df53141907 01-Feb-2013 Svetoslav <svetoslavganov@google.com> Update the JavaDoc for the new accessibility permissions

Change-Id: I1d52e848fec6c56cdb1f8ff66d07414dd2518086
ccessibilityServiceInfo.java
3822896e226567c6cd3ef84518d318abd33a7624 29-Jan-2013 Svetoslav <svetoslavganov@google.com> Remove "enhance web scripts" from settings and make it requested by plug-ins.

Currently we have an "enhance web accessibility" setting that has to be
enabled to make sure web content is accessible. We added the setting to
get user consent because we are injecting JavaScript-based screen-reader
pulled from the Google infrastructure. However, many users do not know
that and (as expected) do not read the user documentation, resulting in
critique for lacking accessibility support in WebViews with JavaScript
enabled (Browser, Gmail, etc).

To smoothen the user experience now "enhance web accessibility" is a
feature an accessibility plug-in can request, similarly to explore by
touch. Now a user does not need to know that she has to explicitly
enable the setting and web accessibility will work out-of-the-box.

Before we were showing a dialog when a plug-in tries to put the device
in a touch exploration mode. However, now that we have one more feature
a plug-in can request, showing two dialogs (assume a plug-in wants both
features) will mean that a user should potentially deal with three
dialogs, one for enabling the service, and one for each feature. We
could merge the dialogs but still the user has to poke two dialogs.

It seems that the permission mechanism is a perfect fit for getting
user permission for an app to do something, in this case to enable
an accessibility feature. We need a separate permission for explore
by touch and enhance web accessibility since the former changes the
interaction model and the latter injects JavaScript in web pages. It
is critical to get user consent for the script injection part so we
need a well-documented permission rather a vague umbrella permission
for poking accessibility features. To allow better grouping of the
accessibility permissions this patch adds a permission group as well.

bug:8089372

Change-Id: Ic125514c34f191aea0416a469e4b3481ab3200b9
ccessibilityServiceInfo.java
f7e50993edfbbe4bc84e60cea84d18b935d0ad0d 23-Jan-2013 Svetoslav <svetoslavganov@google.com> AccessibilityNodeINfo cache not cleared when accessibility is disabled.

Change-Id: Ie674e8b2b1ece41a603bc4f39b5ce98e18c3484a
ccessibilityService.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
ccessibilityService.java
ccessibilityServiceInfo.java
AccessibilityServiceConnection.aidl
iTestAutomationBridge.java
d44280e28884085f014806d53413ec5a68d0ac25 11-Dec-2012 Mita Yun <mitayun@google.com> resolved conflicts for merge of ebcbfb3f to master

Change-Id: I0658dd4a1418fbad91d9663e5b52418a979dc683
ed218c706d9e91e75b94c448cee2e6150aaee57f 07-Dec-2012 Mita Yun <mitayun@google.com> Use asynchronous messages for input method events.

Improves the throughput of IME event handling by ensuring that
input events do not get serialized behind UI traversal and
drawing messages such as when the UI is animating.

Added support for creating an asynchronous Handler as part of a
HandlerCaller. It turns out we should be using an asynchronous
Handler not only in IME dispatch but also in accessibility and
wallpaper events where HandlerCaller is used. So fixed those
services to also use an asynchronous Handler.

Change-Id: I0b19140c9d5ca6ee300c1a150c48312fd55ed8eb
ccessibilityService.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
ccessibilityService.java
AccessibilityServiceClient.aidl
AccessibilityServiceConnection.aidl
e20a177d3f147f3011647c3bdab401f90b2c5d1d 26-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding a global accessibility action to open quick settings.

1. Added APIs for opening the quick settings to the StatusBarManagerService
and the local StatausBarManager. The new APIs are protected by the old
EXPAND_STATUS_BAR permission.
Renamed the expand* and collapse* non-public APIs that are expanding
the notifications to expandNotifications* collapseNotifications* to
better convey what they do given that this change adds
expandQuickSettings* and collapseQuickSettings*.
Added a global action to the accessibility layer to expand the quick
settings which is calling into the new status bar manager APIs.

bug:7030487

Change-Id: Ic7b46e1a132f1c0d71355f18e7c5a9a2424171c3
ccessibilityService.java
eb9862fd4c6ba1745a0f6c997e85643a4ded0643 07-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding FEEDBACK_BRAILLE to AccessibilityServiceInfo.

1. The feedback type provided by braille devices differs from all
already predefined types and this change defines braille
feedback type. Braille does not fit in the already predefined
categories.

bug:6998945

Change-Id: Ide6043bed03fdecd6d2ee45a08762f5bd07a2118
ccessibilityServiceInfo.java
53b0fda5fd7c532fc1d93abd5f8a85276821cc6d 06-Aug-2012 Scott Main <smain@google.com> misc doc bugs.
Fix sdk samples path
Fix method signature in fragment doc code snippet
Fix typo in a11y javadoc code snippet
Fix markup error in brands page
Fix markup error on content providers doc
Fix typo on about>start page

Change-Id: Ie2a528dd4fbd19e5cb1c0844f6fc6272669c8ab9
ccessibilityService.java
636fd528f7ad51f565a390226d9f469f8c675ccf 06-Jun-2012 Dianne Hackborn <hackbod@google.com> Docs (mostly): enumerate JELLY_BEAN target SDK changes.

Okay this isn't entirely docs. I have un-hidden the new permission
for binding to accessibility services; we were going to go out with
it hidden since it didn't go into factory ROM, but now that we are
doing other things we might as well expose it.

Also changed a log from E to W, since it is not an error.

Change-Id: I9226c95e3b63e12218fe41dc3f4290d9824a9e5c
ccessibilityService.java
1e7456ba74f93cdf80dc430aa082cc3c271b30b1 17-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixing the build for real.

Change-Id: I792d029c7fff4d96fbe238ff4b3f268cb8603b95
ccessibilityService.java
53e184d34e7c5b1a65c74fac55f9a635d8131dda 17-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility service needs to request permission to be bound to.

1. Every accessibility services targeting JellyBean or higher has
to request a special permission for the system to bind to it.

Change-Id: I6e579326bdf3597f148d6c67317455701ec8af68
ccessibilityService.java
7b1e0c7046abefc0b40884b36197c8a803d9cf6d 13-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Removing default accessibility gesture handling.

1. The initial design was to have some accessibility gestures
being handled by the system if the gesture handling access
service does not consume the gesture. However, we are not
sure what a good default is and once we add a default handler
we cannot remove it since people may rely on it. Thus, we
take the simples approach and let the accessibility service
handle the gestures. If no gestures are handled the system
will work in explore by touch as before.

bug:5932640

Change-Id: I865a83549fa03b0141d27ce9713e9b7bb45a57b4
ccessibilityService.java
AccessibilityServiceClient.aidl
AccessibilityServiceClientCallback.aidl
e4abc512aa6474f0106f407f7b399832da34483f 09-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Remove activation gestures form reported and add a touch explore requesting flag.

1. Delegating activation gestures has several issues that we should
decide how to handle if possible before allowing an accessibility
service to take over them:

A) It is needed that every view than can be clicked or long pressed on
reacts to such as a response to calling performClick and performLongPress
which is not necessary true since the view may watch the touch
events and do its own click long click detection. As a result it may
be possible that there are view a user cannot interact with in
touch exploration mode but can if not in that mode.

B) Clicking or long pressing on a different location in a view may yield
different results, for example NumberPicker. Ideally such views have
to implement AccessibilityNodeProvide which provider handles correctly
the request for click long press on virtual nodes. Some apps however
just fire different hover accessibility events when the user is over
a specific semantic portion of the view but do not provide virtual
nodes. Hence, a user will not be able to interact with such semantic
regions but the system can achieve that by sending the click/long click
at the precise location in the view that was last touch explored.

2. Adding a flag on accessibility service info to request explore by touch
mode. There is no need to put the device in this mode if node of the currently
enabled accessibility services supports it. Now the problem is inverted and
the service has to explicitly state its capability.

3. Fixing a bug where includeImportantViews was ignored for automation
services.

Change-Id: I3b29a19f24ab5e26ee29f974bbac2197614c9e2a
ccessibilityService.java
ccessibilityServiceInfo.java
iTestAutomationBridge.java
df549f83810c6fa76be1845363ef69809a30e569 09-May-2012 Guang Zhu <guangzhu@google.com> Make UiTestAutomationBridge see non-important views again

This problem was introduced in I74df9c24. The intention of the
change was still let UiTestAutomationBridge see the
non-important views, but there were bugs in the implementation:

1. AccessibilityManagerService was not really updating
mIncludeNotImportantViews when mIsAutomation is true

2. Wrong constant is used to set the flag

Change-Id: Ia0a2e9ed9720bd0ea3a563e0b492e870a6ec1586
iTestAutomationBridge.java
2aaa6bbd53319012e5eba107880c68dbc5b2d8db 09-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Renaming the constants for activation and long press." into jb-dev
87bd0dccf7f2558ea1a5e0fce523aea022709834 08-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Renaming the constants for activation and long press.

1. We will have a double tap to activate an item and
tap and hold to perform a long press.

Change-Id: Ibd9d8774e5a4693d8868d1128e55a82ff0c3a80b
ccessibilityService.java
ef5889810c32eca9d874503fdc7df6e2a1575993 08-May-2012 Svetoslav Ganov <svetoslavganov@google.com> DefaultGestureHandlingHelperService should not include non-important views.

1. Since we are using a stateless proxy accessibility service to
perform default accessibility gesture handling it shuld not
operate against not important views.

bug:6422069

Change-Id: I74df9c2415ab3b164d9ac5873f7004c0459e2bfa
iTestAutomationBridge.java
65d98ad5b3f2e5ec03f14cb0538c572a427ae1a8 03-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Remove accessibility gestures for clockwise and counter clock wise circle.

1. The clockwise and counter clockwise circle gestures are difficult to
perform for a blind user. Some user studies have shown that so nuke them.

bug:6435260

Change-Id: I81d23bd3c450239fe17b4b8c60bafab00daa480a
ccessibilityService.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
AccessibilityServiceConnection.aidl
iTestAutomationBridge.java
fefd20e927b7252d63acb7bb1852c5188e3c1b2e 20-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding an opt-in mechanism for gesture detection in AccessibilityService.

1. An accessibility service has to explicitly opt in to be notified
for gestures by the system. There is only one accessibility service
that handles gestures and in case it does not handle a gesture
the system performs default handling. This default handling ensures
that we have gesture navigation even if no accessibility service
would like to participate/customize the interaction model.

bug:5932640

Change-Id: Id8194293bd94097b455e9388b68134a45dc3b8fa
ccessibilityService.java
ccessibilityServiceInfo.java
AccessibilityServiceClient.aidl
AccessibilityServiceClientCallback.aidl
AccessibilityServiceConnection.aidl
iTestAutomationBridge.java
0846e29d0b5640cfad4496c8484fb9aaa2ba4ccf 19-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding API for getting the root node info in the active window.

1. This APIs is useful for accessibility services since very often
they want to get access to the root node in the current window
to determine where accessibility focus is and subsequently find
a next view to take accessibility focus.

Change-Id: Ide5231f832d9ce2e9b14dc411dfd675f753a4edb
ccessibilityService.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
ccessibilityService.java
AccessibilityServiceConnection.aidl
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
ccessibilityService.java
ccessibilityServiceInfo.java
AccessibilityServiceClient.aidl
AccessibilityServiceConnection.aidl
EventListener.aidl
iTestAutomationBridge.java
110414928ae13674b7ec6b816a45cf70ed521683 03-Apr-2012 Joe Fernandez <joefernandez@google.com> am c1a0e54d: am b459b619: am 945b7cb3: Merge "docs: Accessibility Dev Guide (subsumes Accessibility Best Practices)" into ics-mr1

* commit 'c1a0e54de12aee41163b84a25ea8dfc8b64304dc':
docs: Accessibility Dev Guide (subsumes Accessibility Best Practices)
e1302edd40c5cc264f842e17e3796e0a11d6f045 06-Feb-2012 Joe Fernandez <joefernandez@google.com> docs: Accessibility Dev Guide (subsumes Accessibility Best Practices)

Change-Id: Id7e3f647042d2afd390abe851be1c3b561af33ca
ccessibilityService.java
ccessibilityServiceInfo.java
19a07d97478e504a9a52d2b97fcf4e9ddf3820fd 10-Mar-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "AccessibilityServiceInfo does not convert correctly feedback type to string."
c6c25f9e28a4de73261106a80ae098347524dd2a 10-Mar-2012 Svetoslav Ganov <svetoslavganov@google.com> AccessibilityServiceInfo does not convert correctly feedback type to string.

1. When the feedback type is set to TYPES_ALL_MASK the method
feedbackTypeToString was not generating a string with all
feedback types. Also the generated string sometimes could
have a comma appended after the last feedback type name
- this happens if the feedback type contains unknown type
flag.

Change-Id: I848c520cf7dae16dcd882f68275869c7ab656dd7
ccessibilityServiceInfo.java
f76a50ce8fdc6aea22cabc77b2977a1a15a79630 09-Mar-2012 Ken Wakasa <kwakasa@google.com> Fix obvious typos under frameworks/base/core

Change-Id: Ia5fc3db1bb51824e7523885553be926bcc42d736
ccessibilityService.java
ae7a51f14349ac070926b406a5b0ab0738231383 24-Feb-2012 Svetoslav Ganov <svetoslavganov@google.com> UiTestAutomationBridge does not terminate its HandlerThread.

1. Now the thread is terminated in the disconnect() method
and also it is made demon since it has no pupose outside
the context of the bridge client.

bug:6053108

Change-Id: Idc25373fddf501eda4f875fea3e944367e4f04bf
iTestAutomationBridge.java
57c7fd5a43237afc5e8ef31a076e862c0c16c328 24-Feb-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixing issues with the AccessibilityNodeInfo cache.

1. Before there were two caches one in the app process that
kept track only the ids of infos that were given to a
querying client and one in the querying client that
holds the infos. This design requires precise sync
between the caches. Doing that is somehow complicated
since the app has cache for each window and it has
to intercept all accessibility events from that window
to manage the cache. Each app has to have a cache for
each querying client. This approach would guarantee that
no infos are fetched twice but due to its stateful nature
and the two caches is tricky to implement and adds
unnecessary complexity. Now there is only one cache in
the client and the apps are stateless. The client is
passing flags to the app that are a clue what nodes to
prefetch. This approach may occasionally fetch a node
twice but it is considerably simpler and stateless
from the app perspective - there is only one cache.
Fetching a node more than once does not cause much
overhead compared to the IPC.

Change-Id: Ia02f6fe4f82cff9a9c2e21f4a36747de0f414c6f
AccessibilityServiceConnection.aidl
iTestAutomationBridge.java
0d04e245534cf777dfaf16dce3c51553837c14ff 21-Feb-2012 Svetoslav Ganov <svetoslavganov@google.com> Improving accessibility APIs used for UI automation.

1. UiTestAutomationBridge was accessing the root node in the
active window by tracking the accessibility event stream
and keeping the last active window changing event. Now
the bridge is stateless and the root node is fetched by
passing special window and view id with the request to
the system.

2. AccessibilityNodeInfos that are cached were not finished,
i.e. not sealed, causing exception when trying to access
their children or rpedecessors.

3. AccessibilityManagerService was not properly restoring its
state after the UI automation bridge disconnects from it.
I particular the devices was still in explore by touch mode
event if no services are enabled and the sutomation bridge
is disconnected.

4. ViewRootImpl for the focused window now fires accessibility
events when accessibility is enabled to allow accessibility
services to determine the current user location.

5. Several missing null checks in ViewRootImpl are fixed since
there were scenraios in which a NPE can occur.

6. Update the internal window content querying tests.

7. ViewRootImpl was firing one extra focus event.
bug:6009813
bug:6026952

Change-Id: Ib2e058d64538ecc268f9ef7a8f36ead047868a05
AccessibilityServiceConnection.aidl
iTestAutomationBridge.java
b765db590ff824fb5827fb773b14ac4286ae2774 07-Feb-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding a method for retching the root node in UiTestAutomationBridge

bug:5974791

Change-Id: I46a8b6a259ba31f27fcd6a71d06dc34efdb4de76
iTestAutomationBridge.java
79311c4af8b54d3cd47ab37a120c648bfc990511 18-Jan-2012 Svetoslav Ganov <svetoslavganov@google.com> Speedup the accessibility window querying APIs and clean up.

1. Now when an interrogating client requires an AccessibilibtyNodeInfo
we aggressively prefetch all the predecessors of that node and its
descendants. The number of fetched nodes in one call is limited to
keep the APIs responsive. The prefetched nodes infos are cached in
the client process. The node info cache is invalidated partially or
completely based on the fired accessibility events. For example,
TYPE_WINDOW_STATE_CHANGED event clears the cache while
TYPE_VIEW_FOCUSED removed the focused node from the cache, etc.
Note that the cache is only for the currently active window.
The ViewRootImple also keeps track of only the ids of the node
infos it has sent to each querying process to avoid duplicating
work. Usually only one process will query the screen content
but we support the general case. Also all the caches are
automatically invalidated so not additional bookkeeping is
required. This simple strategy leads to 10X improving the
speed of the querying APIs.

2. The Monkey and UI test automation framework were registering a
raw event listener for accessibility events and hence perform
connection and cache management in similar way to an AccessibilityService.
This is fragile and requires the implementer to know internal framework
stuff. Now the functionality required by the Monkey and the UI automation
is encapsulated in a new UiTestAutomationBridge class. To enable this
was requited some refactoring of AccessibilityService.

3. Removed the *doSomethiong*InActiveWindow methods from the
AccessibilityInteractionClient and the AccessibilityInteractionConnection.
The function of these methods is implemented by the not *InActiveWindow
version while passing appropriate constants.

4. Updated the internal window Querying tests to use the new
UiTestAutomationBridge.

5. If the ViewRootImple was not initialized the querying APIs of
the IAccessibilityInteractionConnection implementation were
returning immediately without calling the callback with null.
This was causing the client side to wait until it times out. Now
the client is notified as soon as the call fails.

6. Added a check to guarantee that Views with AccessibilityNodeProvider
do not have children.

bug:5879530

Change-Id: I3ee43718748fec6e570992c7073c8f6f1fc269b3
ccessibilityService.java
AccessibilityServiceConnection.aidl
iTestAutomationBridge.java
3d0edd31d8082b7b8b2cdee5efda216179f677b5 04-Jan-2012 Svetoslav Ganov <svetoslavganov@google.com> AccessibilityService description not internationalized.

1. AccessibilityServiceInfo loading the description string on
creation and using this value. Hence, changing the locale
results in reporting incorrectly localized string. Added a
new loadDescription method to return the localized version.

2. Deprecated the old method.

bug:5807616

Change-Id: Id82bda3c6a90fa6681b035d20da0b8688ed68da3
ccessibilityServiceInfo.java
f3b4f3163b5b4c0a54a2643f07c97c47b14a1eb7 01-Dec-2011 Svetoslav Ganov <svetoslavganov@google.com> resolved conflicts for merge of 26f7a81f to master

Change-Id: I6bf5fd7c0de7945cef84602dbe3a7bbed587700f
d116d7c78a9c53f30a73bf273bd7618312cf3847 22-Nov-2011 Svetoslav Ganov <svetoslavganov@google.com> Fixing memory leaks in the accessiiblity layer.

1. AccessibilityInteractionConnections were removed from the
AccessiiblityManagerService but their DeathRecipents were
not unregistered, thus every removed interaction connection
was essentially leaking. Such connection is registered in
the system for every ViewRootImpl when accessiiblity is
enabled and inregistered when disabled.

2. Every AccessibilityEvent and AccessiilbityEventInfo obtained
from a widnow content querying accessibility service had a
handle to a binder proxy over which to make queries. Hoewever,
holding a proxy to a remote binder prevents the latter from
being garbage collected. Therefore, now the events and infos
have a connection id insteand and the hindden singleton
AccessiiblityInteaction client via which queries are made
has a registry with the connections. This class looks up
the connection given its id before making an IPC. Now the
connection is stored in one place and when an accessibility
service is disconnected the system sets the connection to
null so the binder object in the system process can be GCed.
Note that before this change a bad implemented accessibility
service could cache events or infos causing a leak in the
system process. This should never happen.

3. SparseArray was not clearing the reference to the last moved
element while garbage collecting thus causing a leak.

bug:5664337

Change-Id: Id397f614b026d43bd7b57bb7f8186bca5cdfcff9
ccessibilityService.java
EventListener.aidl
71b4e71c67df79f53b582fabb34b96ddbe23fe0f 25-Oct-2011 Svetoslav Ganov <svetoslavganov@google.com> Minor documentation fixes for the APIs to expose virtual view tree.

Change-Id: I94b74196483fb55ca67e0a50eebab0412c88831c
AccessibilityServiceConnection.aidl
021078554b902179442a345a9d080a165c3b5139 04-Oct-2011 Svetoslav Ganov <svetoslavganov@google.com> Adding APIs to enable reporting virtual view hierarchies to accessibility serivces.

Added an interface that is the contract for a client to expose a virtual
view hierarchy to accessibility services. Clients impement this interface
and set it in the View that is the root of the virtual sub-tree. Adding
this finctionality via compostion as opposed to inheritance enables apps
to maintain backwards compatibility by setting the accessibility virtual
hierarchy provider on the View only if the API version is high enough.

bug:5382859

Change-Id: I7e3927b71a5517943c6cb071be2e87fba23132bf
AccessibilityServiceConnection.aidl
bb1b9ea8a488eec833b0be18c45dae8505876042 20-Oct-2011 Svetoslav Ganov <svetoslavganov@google.com> AccessibilityServiceInfo does not report properly the feedback type.

Since the feedback type is an integer the bits of which correspond to a given
feedback type, the AccessibilityNodeInfo#feedbackTypeToString should return a
string representation of all feedback types. The current implementation
incorrectly assumes that the argument had only one flag set. Note that this
is a new ICS API and we would like to have this fixed.

bug:5486933

Change-Id: I5e461c385e199cce4c3054907ff0acf5e9d92afc
ccessibilityServiceInfo.java
b303d8381d734f48c4e1de4f11bf25950b28adf1 13-Oct-2011 Scott Main <smain@google.com> docs: a couple notes for a11y methods in View and cleanup to the
A11y service HTML to be semantically correct and thus improve its accessibility :)

Change-Id: I483a8a441d802b056f68f82e0e782d86a73298ac
ccessibilityService.java
8bd69610aafc6995126965d1d23b771fe02a9084 23-Aug-2011 Svetoslav Ganov <svetoslavganov@google.com> Intra-process view hierarchy interrogation does not work.

The content retrieval APIs are synchronous from a client's
perspective but internally they are asynchronous. The client thread
calls into the system requesting an action and providing a callback
to receive the result after which it waits up to a timeout for that
result. The system enforces security and then delegates the request
to a given view hierarchy where a message is posted (from a binder
thread) describing what to be performed by the main UI thread the
result of which it delivered via the mentioned callback. However,
the blocked client thread and the main UI thread of the target view
hierarchy can be the same one, for example an accessibility service
and an activity run in the same process, thus they are executed on the
same main thread. In such a case the retrieval will fail since the UI
thread that has to process the message describing the work to be done
is blocked waiting for a result is has to compute! To avoid this scenario
when making a call the client also passes its process and thread ids so
the accessed view hierarchy can detect if the client making the request
is running in its main UI thread. In such a case the view hierarchy,
specifically the binder thread performing the IPC to it, does not post a
message to be run on the UI thread but passes it to the singleton
interaction client through which all interactions occur and the latter is
responsible to execute the message before starting to wait for the
asynchronous result delivered via the callback. In this case the expected
result is already received so no waiting is performed.

bug:5138933

Change-Id: I382e2d8689f5189110226613c2387f553df98bd3
AccessibilityServiceConnection.aidl
4e2a762eae1f6981d32e6098a95498865ad7f795 27-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> Not user generated accessibility events can change the interrogation allowing window.

1. Events not generated by the user can change the interrogation allowing window
unpredicatably. For example when a ListView lays out its children it fires an
accessibility events and changes the currently active window while the user
interaction may be happening in another window say a dialog. Now the interrogation
allowing window is changed when a new window is shown or the user has touch
explored it.

bug:5074116

Change-Id: I8dde12bbec807d32445a781eedced9b95312b3e2
ccessibilityService.java
00aabf7d187bc05408199bd687a538b2e68bdc17 21-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> Touch exploration state set to clients asynchronously and depended on talking service being enabled.

1. Upon registration of an accessibility client the latter received only
the accessiiblity state and waiting for the touch exploration state
to be sent by the system in async manner. This led the very first
check of touch exploration state is checked a wrong value to be reported.
Now a state of the accessibility layer is returned to the client
upon registration.

2. Removing the dependency on talking accessibility service to be enabled
for getting into touch exploration mode. What if the user wants to use
an accessibility service that shows a dialog with the text of the touched
view?

bug:5051546

Change-Id: Ib377babb3f560929ee73bd3d8b0d277341ba23f7
ccessibilityServiceInfo.java
35bfedeaba724aeadc6f6c890269cb6bf7ef42f5 15-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> Touch exploration separate setting and API to poll the latter state.

1. Seperated touch exploration to be a seperate setting rather being
magically enabled by the system of accessiiblity is on the there
is at leas one accessibility service that speaks enabled. Now
there is a setting for requesting touch exploration but still the
system will enabled it only if that makes sense i.e. accessibility
is on and one accessibility service that speaks is enabled.

2. Added public API for checking of touch exploration is enabled.

3. Added description attribute in accessibility service declaration
which will be shown to the user before enabling the service.

4. Added API for quick cloning of AccessibilityNodeInfo.

5. Added clone functionality to SparseArray, SparseIntArray, and
SparseBooleanArray.

bug:5034010
bug:5033928

Change-Id: Ia442edbe55c20309244061cd9d24e0545c01b54f
ccessibilityServiceInfo.java
0f55cc33f658b2793a12d609a0989348077324a4 17-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> AccessibilityNodeInfo does not report checkable coreclty.

1. AccessibilitiyNodeInfo's checkable property was not set.

bug:5039205

Change-Id: I083d1c357c6d9875536e66e355c8a33bd580cee6
ccessibilityServiceInfo.java
38e8b4e5bc3c93affdffbc064fd9db5aeccc3e8e 30-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> Updating accessibility documentation.

Change-Id: Ice8cf9ac6918b3bfa553776c68d4619fa6559cf8
ccessibilityService.java
ccessibilityServiceInfo.java
ackage.html
eeee4d2c01d3c4ed99e4891dbc75c7de69a803fa 11-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> Final polish of the interrogation feature.

1. Added a new event type for notifying client accessibilitiy
services for changes in the layout. The event is fired at
most once for a given time frame and is delivered to clients
only if it originates from the window that can be interrogated.

2. Exposed the findByText functionality in AccessibilityNodeInfo.
This is very useful for an accessibility service since it allows
searching for something the user knows is on the screen thus
avoiding touch exploring the content. Touch exploring is
excellent for learning the apps but knowing them search is
much faster.

3. Fixed a bug causing an accessibiliby service not to receive
the event source in case of more than one service is registered
and one of them does not have paermission to interrogate the window.
The same event was dispatched to multiple services but if one
of them does not have interrogation permission the event is
modified to remove the source causing subsequent serivices not
to get the later.

4. Moved the getSource setSource methods to AccessibilityRecord
instead in AccessibilityEvent.

5. Hiden some protected members in AccessibilityRecod which should
not be made public since getters exist.

6. Added the View absolute coordinates in the screen to AccessibilityNodeInfo.
This is needed for fast computation of relative positions of
views from accessibility - common use case for the later.

7. Fixed a couple of marshalling bugs.

8. Added a test for the object contract of AccessibilityNodeInfo.

Change-Id: Id9dc50c33aff441e4c93d25ea316c9bbc4bd7a35
ccessibilityService.java
AccessibilityServiceConnection.aidl
8643aa0179e598e78d938c59035389054535a229 20-Apr-2011 Svetoslav Ganov <svetoslavganov@google.com> Interrogation of the view hierarchy from an AccessibilityService.

1. Views are represented as AccessibilityNodeInfos to AccessibilityServices.

2. An accessibility service receives AccessibilityEvents and can ask
for its source and gets an AccessibilityNodeInfo which can be used
to get its parent and children infos and so on.

3. AccessibilityNodeInfo contains some attributes and actions that
can be performed on the source.

4. AccessibilityService can request the system to preform an action
on the source of an AccessibilityNodeInfo.

5. ViewAncestor provides an interaction connection to the
AccessibiltyManagerService and an accessibility service uses
its connection to the latter to interact with screen content.

6. AccessibilityService can interact ONLY with the focused window
and all calls are routed through the AccessibilityManagerService
which imposes security.

7. Hidden APIs on AccessibilityService can find AccessibilityNodeInfos
based on some criteria. These API go through the AccessibilityManagerServcie
for security check.

8. Some actions are hidden and are exposes only to eng builds for UI testing.

Change-Id: Ie34fa4219f350eb3f4f6f9f45b24f709bd98783c
ccessibilityService.java
AccessibilityServiceConnection.aidl
cc4053e031371456fe54d51bbad1db721db4ae38 23-May-2011 Svetoslav Ganov <svetoslavganov@google.com> Accessibility serviceconfiguration via meta-data

Note: This is a part of two CL change and contains the
system changes without updates to the settings.

1. Added a mechanism for configuring an accessibility service via
XML file specified in a meta-data tag (similar to IMEs).

2. Added property for specifying a settings activity for an
accessibility service.

3. Refactored the APIs in AccessibilityManager to return
lists of AccessiblityServiceInfo instead ServiceInfo
since the former describes an AccessibilityService in
particular (similar to IMEs).

Change-Id: Ie8781bb7e0cdb329e583b6702a612a507367ad7b
ccessibilityService.java
ccessibilityServiceInfo.java
9b31779eab896bdcc0922473b183c979cc0b874f 18-Feb-2010 Svetoslav Ganov <svetoslavganov@google.com> Fix for bug 2448479
ccessibilityServiceInfo.java
7ed6ee5692c808cf0ebb3ee208fc8ee1314622c2 11-Sep-2009 Dianne Hackborn <hackbod@google.com> Fix issue #1983406: Soft keyboard doesn't show up in an EditText with "digits" attribute set

Also pretend to fix #2054990 (com.android.frameworktest: java.lang.NullPointerException
at android.accessibilityservice.AccessibilityService$IEventListenerWrapper.executeMessage(
AccessibilityService.java:215))... simply by making the variable that apparently was
null final, to assure myself that there is no possible way in the world for it to be
null. :p

Change-Id: I73e337d65b8360721896a0296691257b3e47564b
ccessibilityService.java
85f6fb713feb258197f17a86c45874d542194b71 28-Aug-2009 Charles Chen <clchen@google.com> Fixing bug 2086021. AccessiblityService could sometimes get a null pointer
exception if multiple accessibility services are running and there are
several events all happening within a short period of time.
ccessibilityService.java
7f2054392e9957d3ba8579ef08c29cfb27df564e 28-Jul-2009 Dianne Hackborn <hackbod@google.com> Updates from API review.

* AccessibilityService -- document onBind() to not be implemented.
* GestureLibrary.getLearner() -- needs to be hidden.
* IntentSender -- remove protected constructors, document that it is retrieved from a PendingIntent.
* Hide permissions: SHUTDOWN, STOP_APP_SWITCHES.
* Context -- hide BACKUP_SERVICE.
* ContextWrapper -- hide getSharedPrefs bla h blah
* Intent.parseUri() -- fix docs.
* ApplicationInfo.FLAG_TEST_ONLY?!?
* Hide MockContext.getSharedPrefs blah blah
ccessibilityService.java
75986cf9bc57ef11ad70f36fb77fbbf5d63af6ec 15-May-2009 svetoslavganov <svetoslavganov@google.com> Accessibility feature - framework changes (replacing 698, 699, 700, 701 and merging with the latest Donut)
ccessibilityService.java
ccessibilityServiceInfo.aidl
ccessibilityServiceInfo.java
AccessibilityServiceConnection.aidl
EventListener.aidl