264 Commits

Author SHA1 Message Date
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
Phil Weaver
9a14b56b60 Merge "Add null check to a11y interrupt." 2016-12-14 18:49:30 +00:00
Phil Weaver
867ad35d9c 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
2016-12-05 14:57:48 -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
2585033100 Add check for null manger for a11y recents action
Bug: 31986988

Test: Ran A11y cts
Change-Id: Ia6a1e1b921d8b0008edbcf1f1a8d1d3d0eb969c6
(cherry picked from commit 3cdd6c7654ff688b2dbd638e388bc56db7a020e2)
2016-11-04 21:12:25 +00:00
Phil Weaver
02ea9b7587 Merge "Add check for null manger for a11y recents action" 2016-11-04 19:37:40 +00:00
Phil Weaver
a46f009bbf Merge "Add tests for MagnificationController." 2016-11-03 23:11:55 +00: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
89e3ffc66c Add tests for MagnificationController.
Also refactoring the class to make it easier to test and
chaning behavior where the current behavior seemed poorly
defined.

Refactoring:
- Combined all handlers into one.
- Simplified animation to use a ValueAnimator.
- Eliminated ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE
  setting. Move rest of settings reading into mockable class.
- Move callbacks from WindowManager into the main class.
- Pulled out my instrumented Handler from the
  MotionEventInjectorTest into its own class so I can reuse
  it.

Behavior changes:
- Always constraining out-of-bounds values rather than
  refusing to change them.
- Constraining offsets on bounds changes. We previously
  left them alone, even if they were out of bounds.
- Keeping track of the animation starting point. We were
  interpolating between the current magnification spec
  and the final one. This change means the magnification
  animates to a different profile.

Test: This CL adds tests. I've also run a11y CTS.

Bugs: 31855954, 30325691

Change-Id: Ie00e29ae88b75d9fe1016f9d107257c9cf6425bb
2016-11-03 13:00:47 -07:00
Wale Ogunwale
ac2561e820 Make window token add/remove APIs require displayId
Window tokens can now only be on one display, so we now require clients
that want to add/remove window tokens to specify the display they would
like the token to be created on. This simplifies the token handling code
in WM and will be useful moving forward for clients that want to add
windows to external displays.

Test: Existing tests pass
Change-Id: I6b2d8d58a913b3624f1a9a7bebbb99315613f103
2016-11-02 10:28:45 -07:00
Fyodor Kupolov
c413f7078d Switch UM to internal isUserUnlockingOrUnlocked
Internal version of UMS maintains a self-locking data-structure of user
states that  is pushed from ActivityManager. Previously there could
be discrepancies between UMS.isUserUnlockingOrUnlocked and
UM.isUserUnlockingOrUnlocked, which is calling a blocking version
in ActivityManager.

Test: manual + UserManagerTests

Bug: 31995235
Bug: 31833240
Change-Id: Ibafe403f57cd32d9052bb55fe7273a861be1d037
2016-10-13 10:07:20 -07:00
Phil Weaver
65097bf83f Move a11y event dispatch back to ui thread.
Test: Ran CTS

Bug: 31753900
Change-Id: I0ba096cb99dd8347a7e9d6c41ff0aa8293dc5d15
2016-10-05 11:08:20 -07:00
chchao
6286496f1e In AccessibilityGestureDetector.clear(), dispatch a MotionEvent.ACTION_CLEAR event to mGestureDetector to cancel the ongoing gesture. am: 37ee5c796e am: 60948808a8
am: e613d10837

Change-Id: I3dde2a0a3a21830b08611c642725e5477c35a8f4
2016-09-20 20:09:07 +00:00
chchao
60948808a8 In AccessibilityGestureDetector.clear(), dispatch a MotionEvent.ACTION_CLEAR event to mGestureDetector to cancel the ongoing gesture.
am: 37ee5c796e

Change-Id: I0f76484c70e08435494f9e9ff1223082c9a3ceac
2016-09-20 04:12:02 +00:00
Phil Weaver
151e88568f Fix bug in magnification coordinate calculation. am: 87d96992ea am: 77b279df94
am: 2967412d36

Change-Id: I964dbe0f850d3e7da23d1a07b9f65fa54043986b
2016-09-17 00:53:30 +00:00
chchao
37ee5c796e In AccessibilityGestureDetector.clear(), dispatch a MotionEvent.ACTION_CLEAR event to mGestureDetector to cancel the ongoing gesture.
b/30706806

Change-Id: I78954e5484d8deda2dadb7c0ae7e05d5c6b734f2
2016-09-14 17:15:35 -07:00
Phil Weaver
af5d0765db Change users without crashing a11y services.
Accessibility services crash when changing users for several
reasons. we were looking up permissions for the current
user, which wasn't the user who created the service. We also
end up resetting the accessibility state, which reads user-
specific settings and thus must be done with the calling
identity cleared.

Bug: 27594523
Change-Id: I2b910d77704a6054b3a591c38f54d3ed3a2dc427
2016-09-14 19:21:20 +00:00
Phil Weaver
87d96992ea Fix bug in magnification coordinate calculation.
We were checking if a coordinate was inside its window before
compensating for magnification.

Bug: 31054088
Change-Id: I4993d84e877fcf3d01382b3cf1c10e2fab58dbba
2016-09-13 14:34:22 -07:00
Phil Weaver
b0f9f77768 Fix crash when user changes after a11yservice dies am: e797b84ed2 am: 575e714616
am: ecf0962a64

Change-Id: I138041bd7f6781fd4ceaec52dff5e2bb9125574a
2016-08-29 21:52:48 +00:00
Phil Weaver
1bb2cc8cc3 Merge "Revert "Dispatch a11y events in separate thread."" into nyc-mr1-dev 2016-08-25 18:05:36 +00:00
Phil Weaver
5de2feab26 Revert "Dispatch a11y events in separate thread."
This reverts commit c34649411d053185b3572c4cd924e6f14295d8cd.

Dispatching accessibility events in their own thread is causing Chrome and gmail to crash. We've identified two issues: Chrome is allocating strings natively using references that aren't valid outside of their thread, and the text is being set to values that are changed in the UI thread. 

I'm going to resolve these issues on master by making deep copies of the strings, but that change will have its own performance implications.

Since we were bit almost immediately by an unexpected result of this change, and I need to erode its benefit by making deep copies, I think it's a bad bet to push it into MR1.

Bug: 31042124
Change-Id: I6f5c225a9197036db43fd0ac6008447b22617525
2016-08-25 16:31:25 +00:00
Phil Weaver
e797b84ed2 Fix crash when user changes after a11yservice dies
We were failing to create a death link for the service that
replaces the crashed a11y service. Adding an invariant that
mService is always linked to death if it is non-null.

Bug: 31044551
Change-Id: I98b6a3969cfacb0309e19938899a51c809249d6b
2016-08-24 17:30:46 -07:00
Phil Weaver
0dbf913d78 Merge ag/1290921 to master.
Original commit:
Dispatch a11y events in separate thread.

Moves the IPCs into a separate thread, where they should affect
jank a lot less.

Bug: 30183085
Change-Id: I7bc8a777fe76dd76f661cc3e3e1d45a2a28df0d2
2016-08-23 09:27:04 -07:00
Phil Weaver
c34649411d Dispatch a11y events in separate thread.
Moves the IPCs into a separate thread, where they should affect
jank a lot less.

Bug: 30183085
Change-Id: Ib76159d158e7a867e76cdd5c8ea3a318949fcc5b
2016-08-19 09:22:10 -07:00
Phil Weaver
669340c785 Merge "Add null check in key event handling." 2016-08-18 15:50:37 +00:00