295 Commits

Author SHA1 Message Date
Colin Cross
eb652a47a1 Convert services to Android.bp
See build/soong/README.md for more information.

Test: m checkbuild
Change-Id: I417409281c928ea667d937090d2a0d9d72a449a2
Merged-In: I417409281c928ea667d937090d2a0d9d72a449a2
Exempt-From-Owner-Approval: trivial conversion
(cherry-picked from commit e0b2ee52d2f274a2d46b2e6695e42d2764c39fa7)
2017-12-12 23:22:25 +00:00
Phil Weaver
f7836b985a Merge "Better guarantee a11y service initial state" into oc-mr1-dev
am: c354e02234

Change-Id: I1fcb2898c1081797e2f6068e5ec9d1ea34452dfc
2017-08-31 21:44:19 +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
8fd2e29c41 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.

Bug: 65012944
Test: A11y CTS and unit tests.
Change-Id: I64260ebb72ee95307d777a9e4b70876c14f99e9c
(cherry picked from commit 53b690b5bc72ac5cd34300c9965707edd0b217cd)
2017-08-24 20:43:54 +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
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