Commit Graph

329 Commits

Author SHA1 Message Date
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 19eb58959b.

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
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
Phil Weaver
b9f0612ca0 Allow a11y shortcut to toggle framework features
Enabling color inversion and color correction initially.

Not showing toast for the framework features, as both are
instantly visible changes and the extra reminder seems like
it will get in the way.

Moving AccessibilityShortcutController to a place where
it can be seen by Settings, so Settings can learn what
framework features to offer the user. Moving tests for that
class to match.

Currently don't have icons for the two framework features.
They will be added in a future CL once I get them.

Also tweaking the warning dialog to include summary
information, if we have it, for the target service.

Bug: 34621067
Bug: 36368472
Test: Adding unit tests for framework features
Change-Id: I32a10989db1c9ad9bf22aae9ad405771b789bc6f
2017-12-05 09:41:01 -08:00
Adrian Roos
e99bc0501a WM: Move WindowManagerPolicy, DisplayFrames and WindowManagerInternal into services
Splits WindowManagerPolicy into a framework and a services part, preventing concepts that are
internal to the window manager from leaking out into the framework.

Test: make droid
Change-Id: I7b6a54f55f76f6fbb5f27090981b8f1d4d8be88b
2017-11-23 17:23:26 +01: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
6cc467e023 Treat ACTION_CANCEL as ACTION_UP for magnification
Having an ACTION_CANCEL occur is a way to trigger b/68214834

Bug: 68214834
Test: Magnificastion CTS tests
Change-Id: I9b1ead33de100a18b37cc557c1111749a2bd9073
2017-11-13 09:09:15 -08:00
Phil Weaver
96d3f47a7d Fix issue with accessibility when switching users
We need to unbind all services in unbindAllServicesLocked.
I was only unbinding all but one.

Fixes: 68814166
Test: Enabled Select to Speak, switched to guest, then
switched back. Previously S2S didn't restart. Now it does.

Change-Id: Ib6eb8ff7532a0c88faa3f14760dfd58774e3f5c2
2017-11-08 10:17:40 -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
Eugene Susla
728354b151 Various minor magnification improvements
Addressing previous commebnts on MagnificationGestureHandler

Test: ensure magnification still works as expected
Change-Id: I918a2db6549e8cf7e0b0907ce8758bab8abb7307
2017-10-05 12:57:14 -07:00
Phil Weaver
ff7068359b Handle UiAutomation dying before being connected
There was an opportunity for the UiAutomation's binder
to die before it was connected, which caused an
NPE when it tried to connect.

I also moved the message handling to a different handler
to make it easier to test.

Bug: 65474486
Test: UiAutomation CTS passes. I also added a unit test
that failed in the same way as the bug. That test now
passes.

Change-Id: I31036ace114b21fed64227b62212b95267039d9e
2017-09-08 18:04:22 -07:00
Eugene Susla
4f8680bb77 MagnificationGestureHandler refactoring and unit test
This is aimed at making MagnificationGestureHandler easier to understand
and reason about

Test: provided unit test + manual magnification test
Change-Id: I958ef0bdd2e6f857a2fab24962b1a06480685732
2017-08-31 13:03:23 -07:00
Edward Savage-Jones
47386b12b8 Merge "Merge "IllegalArgumentException in MagnificationGestureHandler" am: 7aff46195e am: f124c72600 am: 99317517cb" into oc-mr1-dev-plus-aosp
am: 0583aa8749

Change-Id: I9c30e65127c5148dc58c45f27ddbd4f70a284aa3
2017-08-30 22:18:36 +00:00
Edward Savage-Jones
41ef8e42bb Merge "IllegalArgumentException in MagnificationGestureHandler" am: 7aff46195e am: f124c72600
am: 99317517cb

Change-Id: I0a9dbba6c94e4ef9dd36d7a7d43a0c36005f47c7
2017-08-30 21:32:34 +00:00
Edward Savage-Jones
f124c72600 Merge "IllegalArgumentException in MagnificationGestureHandler"
am: 7aff46195e

Change-Id: I3822533c2d7d01c7d804cfd6ad914d36f5ef482f
2017-08-30 20:57:27 +00:00
Edward Savage-Jones
4d318287ba IllegalArgumentException in MagnificationGestureHandler
When enabling the magnifier feature it is possible to trigger
a system crash.

Problem:
On ACTION_DOWN a MESSAGE_ON_ACTION_TAP_AND_HOLD is sent to the
handler with a delay based on long-press timeout.  If the user
then removes their finger while outside of the magnification area,
(ACTION_UP) this message is not removed.  Then when the message
is handled on long-press timeout, it puts the state into
STATE_VIEWPORT_DRAGGING.  If the user then taps the screen again
it is handled by the StateViewportDraggingHandler resulting in:

 IllegalArgumentException: Unexpected event type: ACTION_DOWN

and a system server crash.

Bug: 65101895
Test: Manual:
1. Enable "Magnify with button" from accessibility settings
2. Tap accessibility button on the right navbar
3. Touch & hold bottom part of application area
4. Quickly drag down to the navbar and release
5. Touch anywhere
With this patch it should not crash

Change-Id: I7df8d2185f6db9d148d24d2b155cb357b3637a71
2017-08-28 15:26:31 +00:00
Phil Weaver
015847aa4f Refactoring A11yService and UiAutomation handling
The driver here is to make UiAutomation work across users.
I decided to take the opportunity to pull Service out of
AccessibilityService, separate the code that is service- or
UiAutomation-specific, and then manage the UiAutomation
independently from the user's state.

Bug: 63115387
Test: Adding a few tests, which is much easier after the
refactor, and running existing A11y unit and cts tests,
including those for UiAutomation. Also running the test
at ag/2593458, a sample multiuser test.

Change-Id: I2c43984d9886cd798458c9bf683c6aaa953c1afd
2017-08-24 15:59:43 -07:00
Phil Weaver
5add014517 Merge "Place focus on window when a11y performs an action" into oc-mr1-dev am: c6c9e089db
am: df79ca699d

Change-Id: I2089f32e0f370378eaf472cfeca5cc829e780e04
2017-08-22 17:07:26 +00:00
Phil Weaver
5dc3ebcec6 Place focus on window when a11y performs an action
Bug: 62344706
Test: Now able to bring up keyboard in split-screen mode.
Also a11y CTS and unit tests pass.

Change-Id: Ic4340425680c89e8fc5e586aa1d363b01fd69763
2017-08-17 16:48:48 -07:00
Phil Weaver
53b690b5bc Better guarantee a11y service initial state
I've see flakiness in the gesture dispatch test with
magnification enabled. It turned out that the state
of the input filter was in flux when onServiceConnected
was called back. Now delaying that call until the
input filter's state is stable.

Also fixing the return value of getCenterX and Y when
a service isn't actively controlling magnification.

Test: A11y CTS and unit tests.
Change-Id: I64260ebb72ee95307d777a9e4b70876c14f99e9c
2017-08-14 17:42:39 -07:00
Phil Weaver
77287ab7d1 Block a11y-changing key events from a11y services
If the volume keys are being pressed to enable or disable
an accessibility service, the key events should not be
dispatched to accessibility services.

Bug: 62653966
Test: A11y CTS and unit tests. Adding a set of unit tests for
the expanded KeyboardInterceptor. Also verified that the
accessibility shortcut now works as designed with TalkBack.

Change-Id: Iaea58a5bfe6748d4b9a033f5b957e78298881c40
2017-07-06 13:32:56 -07:00
Phil Weaver
3c7022a6ff Merge "Don't break key event stream when enabling a11y" into oc-dev am: bb8a7983ff
am: 2bf63f4fde

Change-Id: I5a6fe8947017b7a8b3cfdf41c4b5583dc114bf44
2017-06-28 21:24:42 +00:00
Phil Weaver
6b5cde5f25 Don't break key event stream when enabling a11y
Bug: 62862624
Test: Enable magnification, then enable TalkBack with the
a11y shortcut. Verify that volume keys work.
A11y service CTS, a11y units tests.

Change-Id: I729ab17d24f758b5ce534ffde43d2126a1f9536c
2017-06-28 10:25:58 -07:00
Casey Burkhardt
8cc3fee95c Merge "Resolve 3 inconsistencies in accessibility button API - Unify logic for detecting availability of the accessibility button - Ensure the initial visibility state is propagated to A11yMS - Ensure services only receive availability callbacks for changes" into oc-dev am: 4ab690a50d
am: 8097485c28

Change-Id: I0c21a256e612fd2ecfb2dce6c4d28e3c33e075e2
2017-06-17 01:02:57 +00:00
Casey Burkhardt
469a2087d5 Resolve 3 inconsistencies in accessibility button API
- Unify logic for detecting availability of the accessibility button
- Ensure the initial visibility state is propagated to A11yMS
- Ensure services only receive availability callbacks for changes

Test: Manual, created test accessibility services
      targeting specific breakages
Bug: 38345417

Change-Id: I2250b32830cdfc2ecdc1dff7b7130dced2c1db29
2017-06-15 18:39:27 -07:00
Phil Weaver
194a323963 Merge "Stop populating accessibility nodes with events" 2017-05-26 23:15:01 +00:00
Phil Weaver
651fe9fc2e Stop populating accessibility nodes with events
This mostly rolls back ag/710190, which caused
AccessibilityEvents to contain their source nodes. These
nodes were not completely accurate, and populating them
increases the overhead of AccessibilityEvents, particularly
when large numbers of content changes happen. Having the
service reload the node if it needs the update content
should be sufficient. I have fixed several bugs since this
change went in to address issues with the accessibility
cache containing stale data. I think ensuring that the newly
loaded data is up-to-date will fix whatever issues carrying
the node along was intended to fix.

Bug: 33961523
Test: A11y CTS still passes. I also tried TalkBack on a
couple of switch controls, which is where I have previously
seen the most issues with up-to-date announcements.

Change-Id: Ie5a70bb0e89d49255c6a4c1c83d32b755c06902f
2017-05-24 16:43:46 -07:00
Phil Weaver
95cf170ce9 Merge "Match attributes to actions for pip a11y" into oc-dev 2017-05-17 20:25:48 +00:00
Phil Weaver
a0260a1709 Stop system process crash in TouchExplorer
We need to straighten out this state machine so we can
fix bugs in it without a high risk of creating others
(b/38246304). In the meantime, catching this exception at
least allows the device to keep operating.

Bug: 37338581
Test: Reproduced the conditions of the crash. Verified that
we now print the log message.

Change-Id: I1f4f84b5529b2bf638e225d474808e3d42484e78
2017-05-17 09:10:11 -07:00