355 Commits

Author SHA1 Message Date
Phil Weaver
6ac1a60bf1 Add owners for accessibility
Test: Relying on treehugger. No functional changes.
Change-Id: I2511b04e56301bd34a8eaced7be8dd8582cc3cc7
2019-02-07 10:52:13 -08: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
Phil Weaver
985617969f Don't clear a11y focus with lock held
The bug I'm fixing is kind of weird, but in the trace it
showed lock contention with onWindowsForAccessibilityChanged
holding the lock for a long time. So I've cleaned up that
method a bit, looking for trouble. The only concrete thing
I see that's wrong is that I was clearing a11y focus, which
involves calling the app that last reported having focus.
That was done with the lock held. Now doing it through the
handler.

Bug: 77298850
Test: Ran a11y CTS and unit tests.
Change-Id: I667707412a0e3ba98639d0cb43858e8c6b52a5a7
2018-04-04 04:49:12 +00: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 f40da1a884493b6af61e3b978fdf7c7ff059b2dc)
2018-04-03 21:36:01 +00:00
Tony Mak
6f2e97e235 Not allow shell to dump screen by using ui-automator if...
DISALLOW_DEBUGGING_FEATURES is set

(adb unroot first)
Test: Turn on DISALLOW_DEBUGGING_FEATURES in work profile.
      Can dump personal window + Cannot dump work window by using
      adb shell uiautomator dump
Test: Turn off DISALLOW_DEBUGGING_FEATURES in work profile.
      Can dump window in both profiles
Test: atest CtsAccessibilityServiceTestCases
Test: Enable talkback, try launching a few apps and interact with them.

Fixes: 73147467

Change-Id: I044a1546f9b568b0d19714154d6e7e5ab7232d26
2018-03-29 08:20:10 +00:00
TreeHugger Robot
c863d506cf Merge "Expose if running a11y service has crashed" into pi-dev 2018-03-20 20:16:08 +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
Phil Weaver
53454a1c84 Don't let non-touchable windows retain a11y focus
Accessibility services can't see non-touchable windows,
so those windows should not be allowed to have
accessibility focus.

Bug: 70986605
Test: Manually went through bug steps, verified that
double-tapping on the screen has no effect.

Change-Id: I7be72331c5704f7aa99714a01bbb2e336eea15e1
2018-03-09 16:00:24 -08:00
TreeHugger Robot
3a1b5d1867 Merge "Fix bug in clearing a11y focus" 2018-02-27 05:32:53 +00:00
Phil Weaver
7bb765e74d Fix bug in clearing a11y focus
Pooled lambda change dropped the argument.

Fixes: 73889458
Test: Turn on TalkBack, select things in different
windows, observe that focus clears in one window
when it is set in another.

Change-Id: I9755ffbce1b5305a24f5b9ac7b8f59069c917995
2018-02-26 12:54:40 -08:00
Phil Weaver
6343b32ae0 Make equality check more robust for a11y button
Fixes: 72734254
Test: "adb shell settings put secure
accessibility_button_target_component blah" no longer
crashes.

Change-Id: I1c8b56386c135f111a8f5ab3f5b76d2991a6c5a1
2018-02-26 11:28:03 -08:00
Phil Weaver
fde445631a Merge "Stop throwing exceptions in TouchExplorer" 2018-02-24 13:57:09 +00:00
Phil Weaver
9404bea49a Stop throwing exceptions in TouchExplorer
These crash the system. Resetting and trying to muddle
through seems like a better solution than restarting
the device.

Bug: 68269250
Test: make, try TalkBack a bit. The crashes were so rare that
the code I'm changing *almost* never executes.

Change-Id: I7931417832cb2ce39de5c8b00312c12354d76803
2018-02-23 11:26:25 -08:00
Eugene Susla
75fbfc7ec1 Use PooledLambda in A11yManagerService
This replaces the usage of handler messages with PooledLambda

Test: cts tests
Change-Id: I0c9db5deddef7c69444d1fbadc19d10e4071a4d0
2018-02-21 13:38:52 -08:00
TreeHugger Robot
a9e97b0d9e Merge "Couple fixes for M11nGestureHandler" 2018-02-15 06:06:52 +00:00
Eugene Susla
5210e9447c Couple fixes for M11nGestureHandler
1. Added missing defensive copy for a MotionEvent that is posted
asynchronously with delay, and thus might get recycled
2. Fixed transitioning to viewport dragging on 3tap/shortcut+swipe

Test: manually ensure the fix is working
Bug: 73359125
Change-Id: Iae8cd3a83512ee363abe9f0b5702287d7616c092
2018-02-14 17:44:28 -08:00
TreeHugger Robot
8d79feb801 Merge "Fix magnification viewport drifting when scaling" 2018-02-14 20:51:33 +00:00
Eugene Susla
10280a87df Fix magnification viewport drifting when scaling
Fixes: 32255388
Test: Ensure viewport no longer drifts when scaling
Change-Id: I1b12aeaa8e1d0282d6c35a27ee061f6cd7b0a667
2018-02-13 15:11:45 -08:00
TreeHugger Robot
421822ce0f Merge "Clean up usage of COWArrayList in a11y code" 2018-02-09 22:17:41 +00:00
Eugene Susla
b7c8f2dc06 Clean up usage of COWArrayList in a11y code
The single usage we had was already mostly guarded by lock -
replaced with a regular list to prevent confusion

Fixes: 71795155
Test: atest CtsAccessibilityServiceTestCases
Change-Id: I1c3235aadb0db4907cbe92a17cc58d2c8a8b5564
2018-02-09 11:15:18 -08:00
Andreas Gampe
bbab23ff97 Frameworks: Annotate trivial @GuardedBy in services/ misc
Add @GuardedBy for simple functions that require a single lock
and are named XYZLocked.

Derived by errorprone.

Bug: 73000847
Test: m
Test: m javac-check-framework RUN_ERROR_PRONE=true
Change-Id: Id1d9fbe5018250e3b9d1466fc5f670d5ad902fa3
2018-02-08 02:19:42 -08:00
TreeHugger Robot
6af87a9513 Merge "Fix inconsistent MagnificationGestureHandler state after delegation" 2018-01-24 22:09:24 +00:00
Eugene Susla
8f07ee15cb Fix magnification button toggle off
Fixes: b/69307379
Test: Ensure attached bug no longer reproduces.
Ensure magnification using a11y button otherwise works as expected
Change-Id: Ie4e966eb8cfcc9d3f37ae7252b951381ef1fb7c7
2018-01-23 15:03:09 -08:00
Eugene Susla
e6e55b5359 Fix inconsistent MagnificationGestureHandler state after delegation
Fixes: 71863482
Test: ensure attached bug no longer reproduces
Change-Id: I223484caefa01dd15066797e53a2f21607ee162d
2018-01-23 12:16:45 -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
TreeHugger Robot
dc8e52684b Merge "Treat ACTION_CANCEL as ACTION_UP for magnification" 2018-01-13 02:34:55 +00:00
TreeHugger Robot
34bc2ab967 Merge "Prevent race condition when iterating over bound services" 2018-01-13 02:32:04 +00:00
Eugene Susla
5b05f77a12 Prevent race condition when iterating over bound services
Fixes: 71770764
Test: cts
Change-Id: Ifb7457a6b9a88b466bf39a647b92531de6c3c70e
2018-01-10 15:18:11 -08:00
Peter Visontay
7c070b3414 Use the public OPSTR of the BIND_ACCESSIBILITY_SERVICE app op.
Bug: 63907873
Test: manually tested the logging of Talkback.
Change-Id: I8e747d28ce8d10749bf89a43cf6329c854ec5049
2018-01-05 16:03:49 +00:00
Phil Weaver
cbc43ed9df Merge "Make accessibility window events more granular" 2018-01-04 17:09:35 +00:00
TreeHugger Robot
c0fec9c4a9 Merge "[M11n] Add missing defensive copies" 2018-01-04 02:35:06 +00:00
Eugene Susla
7dbd24c154 [M11n] Add missing defensive copies
Fixes: 71502922
Test: Ensure attached bug no longer reproduces
Change-Id: Id0f6e92fab4f2472cc1c22d47249ec5bbba43b3b
2018-01-03 16:29:40 -08:00
Eugene Susla
fe87bceca2 Fix magnification unit test
Fixes: 70682349
Test: Repro steps from b/70682349
Change-Id: I2a9698c1afbf5140dd14797ec90478ae59c2376a
2018-01-03 13:41:10 -08:00
Phil Weaver
bb2f28a776 Make accessibility window events more granular
TYPE_WINDOWS_CHANGED events have meant that "something"
changes with the system windows, so a single event would be
fired for a single small window change or a bunch of window
changes. Services were required to cache the windows and
compare the old ones to the new ones to find out what
changed.

Since AccessibilityEvents are intended to communicate
changes to the UI, this CL sends one TYPE_WINDOWS_CHANGED
for each window that has changed, and provides a way to
get the source of the changing window. It also adds a
windowChangeType field, which contains flags to indicate
what exactly has changed for the window.

Bug: 62231686
Test: Run all a11y unit and cts tests
Change-Id: I6c48e74da26be5ea485ac114a37f3c404a74940e
2018-01-03 08:51:18 -08:00
Svet Ganov
d223db316d Add infrastructure for running a11y tests in instant mode
This change adds a special flag when binding to a service to request
instant apps to be considered as well (assuming the caller has the
permission to see instant apps). This flag is scoped only for the
platform to use and is intended only for development and testing.
Specifically, we have a class of CTS tests that has tests plus service
in the same APK (accessibility, printing, autofill, any other plugin
based sub-system).

Instead of doing the tediuous work split all these into one APK with
tests and one with the services where the latter exposes a remote
interface to the former, we will be adding shell commands to the
dedicated sub-system to allow temporary binding to plugins provided
by instant apps. The goal is not validating the plugin behavious,
rather a working plugin is required to test app side funcionality.

This change adds a shell command to allow the a11y manager serivce
to bind to plugins provided by instant apps. This is required to
be able to run relevant CTS test cases in instant mode.

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

Bug: 70978575

Change-Id: Ifced735a9a6e495747372dd8b00fdd64933a09c7
2017-12-23 02:36:46 +00:00
TreeHugger Robot
2756ddb85d Merge "Communicate relevantEvents=0 for packages excluded from whitelist" 2017-12-20 20:40:57 +00:00
Phil Weaver
348bd7191f Merge "Make accessibility anchor id a long" 2017-12-20 19:02:40 +00:00
Eugene Susla
4b7c919e72 Communicate relevantEvents=0 for packages excluded from whitelist
Together with checking isObservableEventType this will result in a11y events
not being generated for packages that are excluded form a11y-service(s)
package whitelist

Test: cts-tradefed run singleCommand cts -d --module CtsAccessibilityServiceTestCases
Change-Id: Id65607aaccc7af7d870d009d609917ff3c6d0712
2017-12-20 10:41:12 -08:00
TreeHugger Robot
ffed5c82ca Merge "Revert "Log an App Op when an accessibility action is performed."" 2017-12-16 11:57:25 +00:00
Phil Weaver
75dce7c374 Make accessibility anchor id a long
The anchors are, in practice, always Views, but they may end up
being virtual views in the future, so we should have this done
right.

Also cleaning up picture in picture mode. I don't know why I made
it a separate boolean when I already had the boolean properties.

Bug: 70730136
Test: A11y unit tests and CTS
Change-Id: I916ec066dff12fab8b586371452b728af6be1271
2017-12-15 17:48:33 -08:00
Phil Weaver
e8fb83fd62 Revert "Log an App Op when an accessibility action is performed."
CTS tests are now throwing security exceptions for accessibility actions.

This reverts commit 19eb58959b2b9cbf0d082ddc0640a6da99c8a3dc.

Change-Id: I2027ee4cca0fcc2b38bb615a58d992ef309e2d70
2017-12-16 00:55:51 +00:00
Phil Weaver
8f02229866 Merge "Notify system when uiAutomation terminates" 2017-12-16 00:00:12 +00:00
Peter Visontay
19eb58959b Log an App Op when an accessibility action is performed.
Bug: 63907873
Test: manually tested that the app op is being logged for TalkBack and a 3rd party accessibility service. Ran UIAutomator-based tests to check that they work as expected.
Change-Id: I1a40d4ead52ba2258cc7ddc8be594a13895d8340
2017-12-15 12:05:32 +00:00
Tony Mak
371f79cc1e Merge "clearCallingIdentity before calling into getPackageUidAsUser" 2017-12-14 23:29:33 +00:00
Phil Weaver
239677da55 Notify system when uiAutomation terminates
When the binder died, the system wasn't finding out,
so it got into an inconsistent state and told client
apps that accessibility wasn't enabled when it actually
was.

Also fixing dumping of uiautomation, which was failing
with an NPE.

Fixes: 70338333
Fixes: 70227110
Test: Repro case in 70227110 no longer fails.
Ran a11y and UiAutomation CTS.
Ran a11y system server unit tests, and added one to verify
the new behavior.
Change-Id: I4fa6067f8316114a925de86d3fac611e6196da3e
2017-12-14 14:24:04 -08:00
Tony Mak
1232d583bb clearCallingIdentity before calling into getPackageUidAsUser
Fix: 70585244

Test: Enable any accessibility service -> inflate work profile
      -> Tap on any work app -> no longer crash

Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.CrossProfileAppsHostSideTest.testPrimaryUserToManagedProfile
Change-Id: I80d18f4e2ab76a228cb0aa2c8312c323a9b5c84d
2017-12-14 13:37:18 +00:00
Peter Visontay
1195083c0d Log an App Op when an accessibility service is registered.
Bug: 63907873
Test: manually tested that the app op is being logged for TalkBack when it's being registered as an accessibility service.
Change-Id: I10f36a86067950ef57c7afc7bf2f01efff46689c
2017-12-13 14:59:51 +00:00
TreeHugger Robot
b8f2728a78 Merge "Prevent reporting fake package name - framework" 2017-12-09 19:51:00 +00: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
Colin Cross
e0b2ee52d2 Convert services to Android.bp
See build/soong/README.md for more information.

Test: m checkbuild
Exempt-From-Owner-Approval: trivial conversion
Change-Id: I417409281c928ea667d937090d2a0d9d72a449a2
2017-12-08 21:00:15 +00:00