Commit Graph

150 Commits

Author SHA1 Message Date
Kevin Hufnagle
7c58c116c0 Merge "docs: Added units for AccessibilityServiceInfo#notificationTimeout." into pi-dev am: aba234f4d9
am: d5d4da1d0e

Change-Id: Iac2e0ba443ca7a340dee7a39f203ec01cf2bbf72
2018-08-15 13:29:56 -07:00
Kevin Hufnagle
d5d4da1d0e Merge "docs: Added units for AccessibilityServiceInfo#notificationTimeout." into pi-dev
am: aba234f4d9

Change-Id: I687f65d311b5a44b8b045cfaff7d274798e08ec5
2018-08-15 13:16:57 -07:00
Kevin Hufnagle
65f4293f34 docs: Added units for AccessibilityServiceInfo#notificationTimeout.
This field uses "milliseconds" as the time unit.

Test: make ds-docs -j32

Bug: 36949594
Change-Id: Id2e55ed7c96364913bb7ad028798fad5f976d3ca
2018-08-14 18:08:16 -07:00
Mathew Inwood
db7fd6ee9e resolve merge conflicts of 20fcc2eb4c to stage-aosp-master
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Merged-In: I9437532ae617eda28aa5ae796563e985cc0ddbca
Change-Id: Ifa50d21fb63b7ac73ab2ddaeebb1e01f535595c7
2018-08-02 17:39:43 +01:00
Mathew Inwood
62992f1bb0 Add @UnsupportedAppUsage annotations
For packages:
  android.accessibilityservice

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: Ic677593dc2d206335275ecbad4d4a1020972ef38
Merged-In: I9437532ae617eda28aa5ae796563e985cc0ddbca
2018-08-01 14:28:00 +01:00
Mathew Inwood
29b2e91bd7 Add @UnsupportedAppUsage annotations
For packages:
  android.accessibilityservice

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I9437532ae617eda28aa5ae796563e985cc0ddbca
2018-08-01 14:21:18 +01:00
Phil Weaver
03a65b04d8 Enhance a11y soft keyboard controller
Allow a11y services to request that the soft keyboard be
shown even when the hard keyboard is attached.

Defer to users who override this behavior, and put things
back the way they were when a service requesting this
behavior stops.

Bug: 31012180
Test: Adding CTS tests in linked CL, ran a11y unit tests,
modified TestBack to use the new flag and verified behavior
with a hard keyboard and verfied that settings behave as
expected when overriding and rebooting.
Change-Id: I530481e102ac376a4506b662862ee1ee74815b40
2018-07-27 12:58:18 -07:00
Phil Weaver
466b71e1a2 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
2018-04-20 15:53:58 -07:00
Eugene Susla
bd573236f8 [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 f40da1a884)
2018-04-03 21:36:01 +00:00
Phil Weaver
c09a021987 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
2018-03-13 09:54:28 -07:00
Svetoslav Ganov
24c90450fe 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
2018-02-02 19:34:26 -08:00
Phil Weaver
d0429743fa Add a11y action to take screenshot
Bug: 70392997
Test: Adding unit test for functionality, cts test
for presence of api.

Change-Id: Ib5bc2217e1d29f527db0f0fadb69fd8249d6c279
2018-01-19 15:43:53 -08:00
Jeff Sharkey
ce8db99114 Add more IntDef prefixes for auto-documenting.
Test: builds, boots
Bug: 70177949
Exempt-From-Owner-Approval: annotation-only changes
Change-Id: I76dde6054e06f52240bd4b1a0f196dcb74623608
2017-12-13 20:05:36 -07:00
Svet Ganov
240aed987c 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
2017-12-09 09:04:24 -08:00
Eugene Susla
d4128ec0df Revert "Don't generate irrelevant a11y events - framework"
This reverts commit 8ddfb4794f.

Test: presubmit
Bug: 69975306
Change-Id: I05cb545eb0adc77298dddf2dea2997ef36b58a5f
2017-12-05 13:08:51 -08:00
Svet Ganov
8ddfb4794f 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
2017-11-28 17:58:38 -08:00
Eugene Susla
f9a651d64c Global a11y action to lock screen
Fixes: 25567237
Test: ensure API works using TestBack
Change-Id: I335fd6b44d2c67b53a2c1f6224d16bd798276c8b
2017-11-16 18:41:14 -08:00
Eugene Susla
a55f74e45d Magnification Gestures CTS test
Test: ensure affected CTS tests pass
Change-Id: I2ad9ef57098d1e9343d571e0d59504851ac691eb
2017-10-16 17:31:49 -07:00
Phil Weaver
6f2da205cc 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
2017-09-05 23:35:57 +00:00
Jeff Sharkey
67f9d5070a Fix broken javadocs.
Bug: 64337634
Test: make -j32 doc-comment-check-docs
Change-Id: I20fdd3dcddef09111d35946c41c596c7689effa6
2017-08-06 07:37:08 -06:00
Casey Burkhardt
921384157d Merge "Fix accessibility button CTS test" into oc-dev 2017-05-01 19:49:13 +00:00
Jeff Sharkey
63827ce61b Merge "Change String to CharSequence in #loadSummary." into oc-dev 2017-05-01 17:52:26 +00:00
Saige McVea
cb75b5454b 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
2017-04-28 20:35:06 -07:00
Casey Burkhardt
2402943ae5 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
2017-04-28 17:09:57 -07:00
Phil Weaver
be2922ff34 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
2017-04-28 14:58:35 -07:00
TreeHugger Robot
cfbe105e4b Merge "Rename FingerprintGestureCallback.onGesture" into oc-dev 2017-04-28 03:42:01 +00:00
Casey Burkhardt
a338b51e02 @NonNull on AccessibilityButtonController methods
Make Handler parameter @NonNull and adjust implementation
to always expect non-null Handlers.

Bug: 37709203
Test: Manual
Change-Id: I3937ae1c4e49bfc7652750cc64cac9e78f9d3ce2
2017-04-27 15:19:52 -07:00
Phil Weaver
d7e1fb89d9 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
2017-04-26 15:20:24 -07:00
Phil Weaver
09d4ff8960 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
2017-04-22 01:21:03 +00:00
Phil Weaver
f00cd14f17 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
2017-03-10 15:35:30 -08:00
Saige McVea
08c41bcf5f 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
2017-03-06 15:04:00 -08:00
Phil Weaver
e231986368 Revert "Remove abstract from AccessibilityService methods"
This reverts commit 7c01afdd18.

Change-Id: I08990f4fc695b9323051e05a32c35fb9fe426146
2017-02-23 18:51:34 +00:00
Phil Weaver
7c01afdd18 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
2017-02-22 12:54:40 -08:00
Phil Weaver
7917a2f020 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
2017-02-16 20:21:15 -08:00
Phil Weaver
1e2758256a Merge "Provide text locations to accessibility services." 2017-02-07 19:14:09 +00:00
Phil Weaver
c2e28932d2 Provide text locations to accessibility services.
Bug: 30170631
Test: New CTS tests on linked CL.
Change-Id: I723e3777189c8df71c59dada00abdf339ebc983d
2017-02-06 12:57:17 -08:00
Casey Burkhardt
048c2bc19a 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
2017-02-06 12:56:08 -08:00
Phil Weaver
27fcd9c97a Accessibility can capture fingerprint gestures
Bug: 27148522
Test: Unit tests for two new classes in this CL, CTS in
linked CL.
Change-Id: Icb5113e00b1f8724814263b3cc7f72fe4a6f0b41
2017-01-31 14:27:09 -08:00
Phil Weaver
106fe73205 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
2017-01-18 17:12:54 -08:00
Phil Weaver
4acc16d1b6 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
2017-01-06 09:38:53 -08:00
Eugene Susla
eb1375c091 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
2016-12-29 13:05:58 -08:00
Phil Weaver
2f165944ce 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
2016-12-02 15:52:38 -08:00
Phil Weaver
3cdd6c7654 Add check for null manger for a11y recents action
Bug: 31986988

Test: Ran A11y cts
Change-Id: Ia6a1e1b921d8b0008edbcf1f1a8d1d3d0eb969c6
2016-11-03 15:52:02 -07:00
Phil Weaver
752047dd3d Strengthen language about use of a11y API.
Bug: 30898472
Change-Id: I0c2afde3f750e880cb1ef087d092719ea145756d
2016-09-08 10:35:49 -07:00
Phil Weaver
a8918f23c7 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
2016-08-08 10:23:17 -07:00
Phil Weaver
2fbdd48682 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
2016-05-09 16:21:29 -07:00
Phil Weaver
19557de767 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
2016-05-06 08:57:12 -07:00
Phil Weaver
1f70f0b7d6 Merge "Fix several accessibility magnification issues." into nyc-dev 2016-04-27 22:50:37 +00:00
Phil Weaver
70439244ba 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
2016-04-27 13:57:43 -07:00
Phil Weaver
aa86697b76 Support zero-length paths for a11y gestures.
Allows taps to be made at a single point.

Bug: 28378216
Change-Id: I398882faef77b3200aa9813c8d36c5d806521a22
2016-04-27 13:03:41 -07:00