207 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
ee4ff424ea Merge "Restart accessibility services after they update." into nyc-mr1-dev 2016-08-17 20:52:06 +00:00
Phil Weaver
1e6695bbd4 Restart accessibility services after they update.
In ag/1273924, we stopped restarting services that were
still bound. When the package changes, however, the system
unbinds from a service and has no way to tell us that it is
not going to restart it (as it would if the service
crashed.)

Now we listen for package updates and unbind affected
services. The services will then be restarted as there will
be enabled services that are no longer bound.

Bug: 30866905
Change-Id: I375edfd6a37ed25f959ec354930cec8f288deb6b
2016-08-16 16:51:45 -07:00
Chong Zhang
f925b8df92 Merge "Add new window type TYPE_DRAWN_APPLICATION" into nyc-mr1-dev 2016-08-16 19:49:29 +00:00
Phil Weaver
2a0e48aaf5 Add null check to KeyEventDispatcher.
Make sure we don't try to dispatch key events to services
that have died. Doing so crashes the device.

Bug: 30866905
Change-Id: I1cc0515cca8924b0c2744de98ac75a901b94246d
2016-08-15 17:49:55 -07:00
Chong Zhang
fea963edee Add new window type TYPE_DRAWN_APPLICATION
This type behaves like a normal TYPE_APPLICATION, except that WM
will always wait for it to be drawn before starting a transition.

WM always waits for TYPE_BASE_APPLICATION (main window), but for
TYPE_APPLICATION, it only waits if the window relayouts to visible
and gets a surface before the main window is drawn. If main window
itself is ready very fast, transition could start without the other
window.

bug: 30830849
Change-Id: Ife71a9812db7c8eba6ee4ead10ce4f31d9e93b40
2016-08-15 17:36:40 -07:00
Phil Weaver
364580d20a Merge "Limit capabilities of a11y gesture dispatch." into nyc-mr1-dev 2016-08-11 20:35:12 +00: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
f861b916e4 Merge "Improve handling of crashing a11y services." into nyc-mr1-dev 2016-08-05 23:28:48 +00:00
Phil Weaver
dc5dedeaa2 Only filter a11y motion events if needed.
We've seen some jitter in motion events with accessibility
enabled. We can eliminate it by not passing motion events
through the filter if we know they won't be affected.

Bug: 30183085

Change-Id: I0ecc8d5a39c8e370fc3a8ab85c6357251a31f8ad
2016-08-04 15:58:44 -07:00
Phil Weaver
a8cfb3733d Improve handling of crashing a11y services.
We were confusing handling of services that were unbound with
those that had crashed. We would lose track of services that
has crashed, start new ones, and then when the system restarted
a killed services we would have multiple instances running. It
was possible for this to get very out of hand.

Bug: 30306689
Change-Id: I4e63d25b6d2fec3ec68f450a4602898c43a2b2ad
2016-08-04 15:45:13 -07:00
Justin Klaassen
22eb19939d Refactor display color transforms
- Removed Secure.ACCESSIBILITY_DISPLAY_COLOR_MATRIX, it's not desirable
  to persist the actual color transformation matrix.
- Refactored all SurfaceFlinger transforms to DisplayTransformManager,
  which allows color transforms to be set independently from the a11y
  manager service.

Bug: 30042357
Change-Id: Iefa477dedb66aac90e1218e327802a3fab6899ed
2016-07-14 11:28:07 -07:00
Phil Weaver
ee77b881a4 Report all content changes to a11y services.
Changes were discarded if they arrived too quickly in
A11yManagerService. Excuse content change events from
throttling at this level.

Bug: 29355115
Change-Id: Ifd9da07315ce0c18f59c1dad6a621110ad48343b
2016-06-22 12:35:26 -07:00
Zachary Kuznia
ec1783828e Ensure MotionEvent.split() won't be given an invalid value.
b/27496784

Change-Id: I28bb4ac5bb8a705e7af9b22b2b56cd4061aa06a0
2016-05-25 12:38:58 -07:00
Phil Weaver
37fc1c1ce4 Don't disrupt a11y state when user is unlocked.
AccessibilityManagerService#unlockUser was assuming that we should
switch to the unlocked user's state. If that user is a new work
profile, this transition disables all accessibility features.

Bug: 28726050
Change-Id: I3797d34b580d00642b204fff3fc9a07b720738e0
2016-05-11 16:24:13 -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
0f36545bb8 Re-enable accessibility when UiAutomation closed.
We need to read the settings when UiAutomation closes in order to
configure other accessibility features from settings.

Bug: 28461805
Bug: 28460671
Change-Id: I030761922ec4acfa2d916e171c39e9dc2deb85a2
2016-05-02 11:36:00 -07:00
Jeff Sharkey
ce18c81677 Introduce "unlocking" vs "unlocked" nuance.
There is a narrow window of time during user unlock where we're
reconciling user storage and dispatching the "unlock" status to
various internal system services.  While in this "unlocking" state,
apps need to be told that the user still isn't actually "unlocked"
so they don't try making calls to AccountManager, etc.

The majority of internal services are interested in merging together
both the "unlocking" and "unlocked" state, so update them.

Clarify naming in AccountManagerService to make it clear that a local
list is being used, which mirrors the naming in MountService.

To match UX/PM requested behavior, move PRE_BOOT_COMPLETED dispatch
after the user is unlocked, but block BOOT_COMPLETED dispatch until
after all PRE_BOOT receivers are finished to avoid ANRs.

Bug: 28040947, 28164677
Change-Id: I57af2351633d9159f4483f19657ce0b62118d1ce
2016-04-28 10:51:39 -06: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
4b88bddb12 Merge "Fix a11y key event handling from multiple devices." into nyc-dev 2016-04-21 01:38:49 +00:00
Phil Weaver
698c96dbd2 Fix a11y key event handling from multiple devices.
For M, we ignored device type entirely, but with ag/760625 we started
paying attention to it, which rejects events when keys from different
devices are pressed simultaneously. Since the volume keys show up as
different devices, the new behavior disrupted the event stream when
both volume keys were pressed.

Now tracking each device separately, which restores the old behavior
but still takes the device id into account. Holding down two keys
when enabling an accessibility service, however, always has and still
can produce an invalid event stream. It doesn't seem worth the
overhead, however, to track each key separately.

Bug: 28091773
Change-Id: I8d30de1f5e05f779b6fe305856d42f209ff8b038
2016-04-20 13:08:35 -07:00
Phil Weaver
b72c30653d Merge "Clear calling identity when binding a11y services" into nyc-dev 2016-04-20 16:33:28 +00:00
Phil Weaver
13ce4693d3 Clear calling identity when binding a11y services
When a UiAutomation is destroyed, accessibility services may get
enabled as a side effect. That was causing these services to be
enabled in a binder thread, which threw a SecurityException.

Bug: 28268310
Bug: 28163652
Change-Id: Ie25ab05569b5b21b5f30e7d7eed24ef73b7ba159
2016-04-19 17:07:20 -07:00
Adrian Roos
f2efdd8c7c Fix unprotected StatusBarManagerService calls
Some Binder calls in StatusBarManagerService were
left unprotected. They had no business being binder
calls in the first place, so they got moved to
StatusBarManagerInternal.

Bug: 28222649
Change-Id: Ib26dcca413eb642ba8cd6a4482bf13071f8bd3ab
2016-04-18 13:36:40 -07:00
Svetoslav Ganov
7d477d4845 Properly notify magnification listener
bug:28088856

Change-Id: Iffd848082f035319aab3af177921bb3085844ab0
2016-04-15 14:30:47 -07:00
Svetoslav Ganov
33f576b9e9 Merge "Ensure injected gestures respect magnification" into nyc-dev 2016-04-13 22:09:18 +00:00
Svetoslav Ganov
416bba7b46 Ensure injected gestures respect magnification
Change-Id: Ie828f4be4eb1ec620549c1346ec7cc335908612f
2016-04-13 15:03:51 -07:00
Svetoslav Ganov
0a59531581 Fix a regression in magnification center x,y
bug:28133561

Change-Id: If37baa5f2ebe5840b50ca845bf81ce70cedf0412
2016-04-12 18:02:54 -07:00
Phil Weaver
af93306a3d Merge "Reduce unnecessary accessibility cache clearing." into nyc-dev 2016-04-08 22:33:33 +00:00
Phil Weaver
e37cfab6c6 Reduce unnecessary accessibility cache clearing.
Tracking if accessibility focus is being cleared because it is being
set to another view in the same window. In this case, leave
accessibility focus on the window.

This change greatly reduces the amount of cache re-indexing.
Previously we flushed the cache every time accessibility focus moved.

Bug: 28077283
Change-Id: If80899d36e7f58b22635f844bdd4ea37a55b875e
2016-04-08 13:06:44 -07:00
Anna Galusza
21cafcd662 Merge "Fix issue where (accessibility) keyboard mode callbacks were not always called. Bug: 28007101" into nyc-dev 2016-04-08 17:06:10 +00:00
Phil Weaver
fb6dd3bbc1 Merge "Treat accessibility gestures like physical ones." into nyc-dev 2016-04-07 20:34:34 +00:00
Phil Weaver
155dda1e43 Treat accessibility gestures like physical ones.
Gestures now operate on the screen as the user sees it, so they are
affected by magnification. This makes gesture coordinates consistent
with the node bounds in screen and makes an eye or head tracking service
work much more easily.

Bug: 27747314
Change-Id: Idee60398d49d8c9af7405d974893c796b034c974
2016-04-07 12:20:27 -07:00
Phil Weaver
445fd2afe9 Eliminate deadlock in magnification.
Use the lock from AccessibilityManagerService in
MagnificationController, since the two services call each other with
locks held.

Bug: 27725795
Change-Id: Iaed6749bf217210457325c3912da0f7aa0f6319a
2016-04-06 16:43:44 +00:00
Anna Galusza
c9eab5fa90 Fix issue where (accessibility) keyboard mode callbacks were not always called.
Bug: 28007101

Change-Id: Ie7f992243e5a71bc6fed74cbc0d242d652d7fc12
2016-04-06 09:31:40 -07:00
Anna Galusza
cd1e9ad83c Merge "Fix bug where service disabled with disableSelf() would not reset soft keyboard behavior. Bug: 27947344" into nyc-dev 2016-04-04 19:19:32 +00:00
Anna Galusza
8a12f640fc Fix bug where service disabled with disableSelf() would not reset soft keyboard
behavior.
Bug: 27947344

Change-Id: I19583cad14616416be3582c30653d244a27aa366
2016-04-04 09:59:27 -07:00
Phil Weaver
d4a1932608 Merge "Add accessibility window title and anchor." into nyc-dev 2016-04-04 16:36:01 +00:00
Jeff Sharkey
b5e89c6deb Support direct-boot tests.
Add shell commands to check on current FBE status and system ready
status.  Mark variables without first-class locking as volatile.

Fix bug where UI automation would crash while device was locked by
marking it as forced direct-boot aware.

Bug: 26498834
Change-Id: Ib4dfb9350925e5413f93a09baacf84c62f2ba0ea
2016-04-02 19:31:19 -06:00
Anna Galusza
c71485abaf If the AccessibilityService requesting the soft keyboard to be hidden is
stopped, make sure the keyboard is hidden.
Bug: 27886621

Change-Id: I63ecc0c9506a60cd07660208d37cd6a0bfd5752d
2016-03-29 18:43:49 -07:00
Phil Weaver
396d549113 Add accessibility window title and anchor.
Plumbing through the title of windows so support multiwindow
accessibility.

Adding ability to determine the anchor of a pop-up window so the pop-up
can be traversed as part of its anchor.

Bug: 27687627
Bug: 8449376

Change-Id: I59e98a29fb90029407a26de5bf3d900fed5dd627
2016-03-29 08:41:09 -07:00