288 Commits

Author SHA1 Message Date
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
Phil Weaver
22e0d48bbe Match attributes to actions for pip a11y
When we strip and replace actions for UIs inside a picture-
in-picture window, make sure attributes match. For example,
if an node was clickable and exposes ACTION_CLICK, when
removing actions we must clear both the click action and
the clickable attribute.

Bug: 37923645
Test: Updating unit tests
Change-Id: I84de5cae136bccb20b2234aef59bf5e0a7c15949
2017-05-04 16:51:01 -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
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
TreeHugger Robot
c240c9b134 Merge "clear calling identity before calling settings provider" into oc-dev 2017-04-12 22:09:24 +00:00
Tony Mak
35ba7ec539 clear calling identity before calling settings provider
Test: Run a instrumentation test
cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.ManagedProfileTest#testPhoneAccountVisibility

Change-Id: I29b1dc307e9e127b919aebe4d83ab6311ce36f2d
Fix: 34320197
2017-04-12 13:01:34 +01:00
Casey Burkhardt
5d61440564 Improved multiuser support for A11y button/Magnification
- Ensures NavigationBarFragment updates Accessibility button state
  based on the settings of the current user.
- Launches AccessibilityButtonChooserActivity as the current user

Bug: 36652061
Bug: 36699310
Bug: 37103953
Test: Manual
Change-Id: Ieded484d548fb4631ceb8a873d667dd53fd2fd79
2017-04-11 13:40:45 -07:00
Casey Burkhardt
ecb5b5ccc3 Merge "Revise Accessibility button chooser intent/permissions" into oc-dev 2017-04-07 02:40:14 +00:00
Casey Burkhardt
afe3ef1b36 Revise Accessibility button chooser intent/permissions
1) Switch AccessibilityButtonChooserActivity to non-exported
2) Update AccessibilityButtonChooserActivity's intent action to
   be CTS-compliant
3) Switches to correct permission to validate a click of the
   accessibility button originated from the status bar service

Bug: 36866328
Bug: 36976440
Test: Manual / Created app to validate launch protection
Change-Id: Ifcd5e8dbbe683dc99bb900a5870a9ba374fbd5d4
2017-04-06 11:39:26 -07:00
Phil Weaver
5b43fca04d Fix crash when using list of enabled a11y services
AccessibilityManagerService#getEnabledAccessibilityServiceList
had an optimization to always return the same, statically
allocated object. This is almost safe if it's being called
from another process, as Binder will copy it. When called from
the same process, however, it's a lot less safe and seems to
have caused a crash.

I think the optimization was already problematic in Binder
calls as well, though. The method grabs a lock, but I think
it's still possible for another thread to call the method
while Binder is making the copy.

I'm removing the optimization and just allocating a new List
to prevent such crashes.

Bug: 36364829
Test: No repro case, so I just ran a11y CTS and unit tests.
Change-Id: Ib64703a7bbed82c6ca000d8703d23819188b4b9b
2017-04-05 11:27:07 -07:00
Casey Burkhardt
3bf7c7634a Merge "Fix AccessibilityManager returning duplicate services" into oc-dev 2017-04-04 04:29:27 +00:00
Jeff Sharkey
fe9a53bc45 Consistent dump() permission checking.
This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access.  It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
2017-04-02 22:29:07 -06:00
Casey Burkhardt
0dd5b944ef Fix AccessibilityManager returning duplicate services
Prevents AccessibilityManagerService from providing duplicate
accessibility service records to clients calling
getEnabledAccessibilityServiceList if a service contains more
than one feedback flag.

Bug: 36493113
Test: Behavioral CTS test

Change-Id: I2f836e15fdd70543bc8aa9a5602330b0b6846fec
2017-03-28 15:01:01 -07:00
Phil Weaver
f1a9aff962 Fix permission checking for a11y volume.
Adding new permission for changing accessibility volume
to allow system UI to change it. Also providing audio
manager with a whitelist of bound accessibility service
uids so it can allow servics to change the volume.

Bug: 36569297
Test: Adding CTS test in linked CL.
Change-Id: I4f327e3a251fc3780c5957f41217c2ef5bb8b16e
2017-03-27 14:59:26 -07:00
Casey Burkhardt
5e8b980c5d Target selection for Accessibility button
Allows for selecting a single accessibility service or feature
to be triggered by the accessibility button in the navigation bar

Bug: 34720082
Test: Manual
Change-Id: I320febede0398b1eff38a87d4db31fd7dfc53062
2017-03-24 19:17:12 -07:00
Phil Weaver
ce687c5e4a Restructure a11y shortcut settings
Separating the shortcut on/off from the shortcut service.
Enabling the shortcut to work from the lock screen if the
user wants it to.

Bug: 35872328
Bug: 35219988
Bug: 35443593
Test: Adjusted tests for shortcut controller, manually
activated shortcut in a variety of conditions.
Change-Id: Id39d33ec62eb5f11b76b2972089167dc7d4c625b
2017-03-22 16:36:12 -07:00
Casey Burkhardt
74922c63e1 Display magnification via the nav bar Accessibility Button
Adds support for invoking display magnification by first selecting
the Accessibility Button, then touching an area of the screen to
magnify.

Bug: 30960346
Test: Manual
Change-Id: Ifd8a355562f204182e34bd37f71a3637d85cf0e1
2017-03-15 14:12:51 -07:00
Svetoslav Ganov
00de0e644d Merge "fix IndexOutOfBoundsException in AccessibilityManagerService..manageServicesLocked" am: 14c7e67da8 am: 6006d681ab
am: 5cd3bb93ce

Change-Id: Iee29739716cd7a264196d0999ada7d4399b30a3e
2017-03-14 19:18:26 +00:00
Svetoslav Ganov
6006d681ab Merge "fix IndexOutOfBoundsException in AccessibilityManagerService..manageServicesLocked"
am: 14c7e67da8

Change-Id: Icfa9fc501806820545dd9df9d671fcdfe645b73f
2017-03-14 19:07:22 +00:00
Eugene Susla
ef4351cc72 Dont dispatch a11y events that have no subscribers
This allows to avoid A11yManager -> A11yManagerService IPC, when there's no
subscribers to a given event

Test: steps:
  - Enable A11yManager.DEBUG
  - Navigate through a few random activities
  - In logcat, ensure log messages are present, notifying that certain events
  won't be dispatched
Change-Id: Ia019fb66053f10095b3651407d09de8e89cdd227
2017-03-13 17:51:04 -07: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
Phil Weaver
e3bf23bed9 Merge "Verify fingerprint exists before using it" 2017-02-19 04:48:19 +00:00
Phil Weaver
0adfbd33c8 Use accessibility action for touch exploration
Explore-By-Touch has been dispatching touch events to the screen
rather than using the accessibility API. This was intended as a
workaround for apps that did not properly handle accessibility,
but the workaround itself has been causing bugs in corner cases
where properly accessible Views are partially covered by windows.

This CL first tries to dispatch a click action, and falls back on
the touch dispatch only if the click action fails.

Bug: 35200501
Bug: 26216304
Bug: 20665958
Bug: 34949365
Bug: 34844480
Bug: 29535082

Test: Poking around with first party apps and TalkBack works fine.
This behavior isn't covered by automated testing.

Change-Id: I9cc18399d8f40f7381dfcbef91b5991b711bb7f1
2017-02-17 15:07:33 -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
Casey Burkhardt
edb54686c2 Merge "Initial implementation of Nav Bar Accessibility Button" 2017-02-07 00:14:49 +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
Eugene Susla
6ed45d8cd3 CompanionDeviceManager
This introduces an API for apps that support companion devices to provide a
more streamlined flow for pairing and setting up the device

Bug: 30932767
Test: Using a toy app, invoke the newly introduced API (CompanionDeviceManager),
 and go through the flow. Ensure filtering works, and device is returned to
 the calling app. Ensure the calling app can pair to the selected device.
Change-Id: I0aeb653afd65e4adead13ea9c7248ec20971b04a
2017-02-06 12:50:55 -08:00
Wale Ogunwale
5cd907d3d6 Alert Windows behavioral changes
- Introduced TYPE_APPLICATION_OVERLAY window type. Can be used by apps
to display windows on top of other app windows, but below critical
system windows.
- Deprecate alert window types TYPE_PHONE, TYPE_SYSTEM_ALERT,
TYPE_SYSTEM_OVERLAY, TYPE_PRIORITY_PHONE, and TYPE_SYSTEM_ERROR.
Apps should now use TYPE_APP_OVERLAY for this.
- Apps targetting O or greater are not allowed to add the old alert
window types.
Apps targetting less than O can still add the old types.
Apps with permission INTERNAL_SYSTEM_WINDOW (system signature apps) can
still add the old types.
- Z-order old alert windows types below TYPE_APPLICATION_OVERLAY if
they are added by an app without the INTERNAL_SYSTEM_WINDOW permission.

Test: android.server.cts.AlertWindowsTests
Bug: 33256752
Change-Id: I12170955a7a333151d3387c169b51c53c32164fc
2017-02-02 08:20:49 -08:00
Phil Weaver
1f2b03a42a Merge "Correct accessibility check for current user" 2017-02-01 20:17:03 +00:00
Phil Weaver
8e839b6224 Correct accessibility check for current user
This fixes a bug I introduced in ag/1444443 as the result
of missing a comment.

Bug: 34077911
Test: Manually verified that EBT is no longer broken
Change-Id: Iec7484c515f8b08ab2e04b4f513629cb6509ab7a
2017-01-31 17:18:55 -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
Chad Brower
f180a9f56c Merge "Update the accessibility gesture recognition logic, using prior assumptions about allowed gesture set to increase accuracy." 2017-01-30 22:25:28 +00:00
Chad Brower
6029cae555 Update the accessibility gesture recognition logic, using prior
assumptions about allowed gesture set to increase accuracy.

Test: Using gesture data from real users at
https://drive.google.com/corp/drive/folders/0BzgTMSNz7WvCNTExbGwtSTRWTzQ
measured accuracy via standalone app at
https://cs.corp.google.com/piper///depot/google3/java/com/google/android/apps/internal/accessibility/A11yGestures/
Also added unit test to check that synthetic gesture motions are recognized.

Change-Id: I06e61ec814ee52db7441c4998012c2df9910589e
2017-01-27 10:28:43 -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
Eugene Susla
c1facb81e0 Merge "Only send cache event if cache is detected to be used" 2017-01-13 02:26:38 +00: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
08ea4abe23 Only send cache event if cache is detected to be used
Bug: b/32642665
Test: Repeat test of Icbdb91803b646fa06aaf11996d350f6f65c1e809
Change-Id: Ibc09ea5cb25e4ac021baed5b598d6ba7a76295bc
2017-01-04 10:50:58 -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
liangweikang
4606a4ae89 fix IndexOutOfBoundsException in AccessibilityManagerService..manageServicesLocked
https://code.google.com/p/android/issues/detail?id=230754

Test: compile

Change-Id: I9152d56445ab1e3320ae7359a47c82edf8fbeed0
Signed-off-by: liangweikang <liangweikang900911@gmail.com>
2016-12-23 01:21:54 +00:00
Phil Weaver
74f9e1b867 Add null check to a11y interrupt.
Also adding same robustness to interrupt that we have for
sending a11y events.

Bug: 32507871

Test: Ran a11y CTS. Verified manually with sample app
that sends interrupt and accessibility service that
crashes when started. That case used to crash the
app, and doesn't anymore.
Change-Id: I5cf05dcbb54ea23ae876cb3258dd206c55dce775
(cherry picked from commit 867ad35d9c676b5ba2047b0fc9a4006737e5c4aa)
2016-12-15 08:06:15 +00:00