Commit Graph

265 Commits

Author SHA1 Message Date
sallyyuen
ab76090f4b Add GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS
This will allow a11y services to identify the all apps system actions by
id.

Bug: 157078174
Test: manual with all apps and talkback
Change-Id: Ice0969753d6ed789dca762f49859b17ea1de85e9
2020-06-01 20:15:15 -07:00
sallyyuen
40dd559f9e Add triggering the accessibility shortcut as a system action
Holding down the volume keys triggers the shortcut, making it a
system-level action.

Bug: 154950547
Test: Tested with TalkBack
Change-Id: I2aac0162047f7900103eab472ff649d77836ca93
2020-05-01 15:01:55 -07:00
sallyyuen
93edd11724 Fix system action API issues in SystemActions
1) Actions are only registered when the service starts. If the locale
changes, the labels need to be translated, so re-register the actions
when this happens.

2) When its shortcut isn't visible the a11y menu action is a no-op. The
list should be an accurate representation of what actions are available.
Pass SystemActions into NavigationBarFragment, which keeps track of the
shortcut availability,  to unregister/register the action.

To do this, SystemActions exposes register/unregister to the fragment
and makes SYSTEM_ACTION_ID_ACCESSIBILITY_MENU public.

3) Remove Toggle Split Screen from SystemActions. The trigger isn't
system-level but is rather buried in the Recents UI in a button for each
app, and the a11y user can access this like everyone else.
SystemActionPerformer will still handle the legacy action call in
performSystemAction.

4) Rename "Accessibility Menu" to "On-screen Accessibility Shortcut"

Bug: 152636060, 152635646, 154833492
Test: Manual TalkBack test
Change-Id: I9b037f91c8d3b6f193fc9aee95ef73b7f3fbf315
2020-04-27 13:05:57 -07:00
Jason Hsu
9e0ada13c8 Merge "Return empty for empty string in AccessibilityShortcutInfro#loadHtmlDescription" into rvc-dev 2020-04-21 09:41:59 +00:00
Jason Hsu
61f191f198 Merge "Allow one of description or htmlDescription attribute provided for AccessibilityShortcutInfo" into rvc-dev 2020-04-21 09:41:14 +00:00
sallyyuen
867c6d2786 Support sending KEYCODE_HEADSETHOOK KeyEvent from an a11y service
Add a private global action to be made public in S. A service can
trigger the event by calling performGlobalAction(10) in R.

Note: Currently 10 is being used by SystemActions for the Accessibility
shortcut. Update ag/10921262 to avoid a conflict.

Bug: 154038741
Test: Tested with modified TalkBack and Youtube play/pause
Change-Id: I3ca5d25948bfb3eb8520030484cb466ec7188784
2020-04-20 12:21:21 -07:00
jasonwshsu
066a544d06 Return empty for empty string in AccessibilityShortcutInfro#loadHtmlDescription
* Follow the behavior to return empty if given string is empty
	- AccessibilityServiceInfo#loadDescription
	- AccessibilityServiceInfo#loadHtmlDescription
	- AccessibilityShortcutInfo#loadDescription
	- AccessibilityShortcutInfo#loadHtmlDescription

Bug: 154092127
Test: manual test
Change-Id: I77f455945c569c81cb00127a7913bae4db1b3d1c
2020-04-20 14:57:40 +00:00
jasonwshsu
72dfaf89d7 Allow one of description or htmlDescription attribute provided for AccessibilityShortcutInfo
* Only two of them are empty should throw parser error

Bug: 154092127
Test: manual test
Change-Id: I038dbb054f4302b9f5e2c3246fb9539c77533339
2020-04-20 21:59:24 +08:00
Sally Yuen
3987ae1ad8 Merge "Make the system action API more clear with documentation" into rvc-dev 2020-04-06 23:54:03 +00:00
sallyyuen
ca5c921416 Make the system action API more clear with documentation
Bug: 149755168
Test: N/A
Change-Id: I2c82ce755d3c94d0514f49da0cc770c83dafbad1
2020-04-03 09:23:29 -07:00
Jacky Kao
316477c399 Supporting multi-display for takeScreenshot()
Creating a new API, screenshotWithoutSecureLayer(), to get the
graphic buffer of screenshot for all displays including non-default
display and virtual one. We can use it to support multi-display
of takeScreenshot() API.

Bug: 145893483
Test: a11y CTS & unit tests
Test: manual testing to take screenshot of second display which is a
monitor with chrome cast

Change-Id: I474c71f7e01d57b5a318b2a5bfb690a2e01c128c
2020-03-25 13:46:11 +08:00
Jacky Kao
6c8bdbb511 Reply error through callback for takeScreenshot()
Passing the error code through callback to the caller.

Bug: 150865445
Test: a11y CTS & unit tests
Change-Id: I8ca75908289a9fbd888689788a982f68cc7392ad
2020-03-20 08:40:55 +08:00
Jacky Kao
0ad1f82733 Throw IllegalArgumentException for takeScreenshot()
Throw IllegalArgumentException for non default display
since it’s unsupported

Bug: 150865445
Test: a11y CTS & unit tests
Change-Id: Iac0602e444d23b28ea05d29dd4605c7a821b641a
2020-03-12 07:56:57 +08:00
Jackal Guo
2d627ec8f3 Merge "Update Javadoc" into rvc-dev 2020-03-05 01:11:23 +00:00
Jason Hsu
6820d68e25 Merge "Support settings activity for accessibility shortcut target" into rvc-dev 2020-03-04 12:13:42 +00:00
Jackal Guo
fd2eab0067 Update Javadoc
Note the limitation on embedded hierarchy.

Bug: 149199973
Test: build pass (m -j docs)
Change-Id: I2be24ecb79f35a7ded913e37d8e8c32511f760f3
2020-03-04 11:51:47 +08:00
Jacky Kao
494960e818 Merge "Drop the hardware buffer" into rvc-dev 2020-03-03 02:50:40 +00:00
Jacky Kao
78afcedf9f Merge "Add a rate limitation of takeScreenshot() API" into rvc-dev 2020-03-03 01:06:40 +00:00
Jacky Kao
4082aa2e19 Drop the hardware buffer
Closing the hardware buffer after sending over to the requesting app,
and adding the document that the app developer has to close the buffer
ASAP.

Bug: 150174095
Test: atest AccessibilityTakeScreenshotTest
Change-Id: I8e759a7d83c0a9adfd1b37d0bbf515c9babde7a4
2020-03-02 08:21:47 +08:00
Jacky Kao
979600dce1 Add a rate limitation of takeScreenshot() API
Adding the rate limitation of takeScreenshot() API is one time
per second to avoid the system health impact.

Bug: 149968870
Test: a11y CTS & unit tests
Change-Id: Iaedafda9b9a5a56941952df54e62d76a92936b1d
2020-03-02 08:21:11 +08:00
Rhed Jao
27c781d917 Support settings activity for accessibility shortcut target
Bug: 150277218
Test: atest AccessibilityShortcutInfoTest
Change-Id: I9afc6b2c917b0abe7bb4f5969dd665ba31157c7c
2020-02-27 12:33:26 +08:00
Peter_Liang
01a592bfd1 Remove the public APIs for allow rich content.
1. Mark @hide for "Drawable loadAnimatedImage(Context)" and "String loadHtmlDescription(PackageManager)".
2. Move common function into util.

Bug: 149516547
Bug: 142532186
Test: maunal test
Change-Id: I4f734a496938f64bcde990268e11a2d1a5be4771
Merged-In: I4f734a496938f64bcde990268e11a2d1a5be4771
(cherry picked from commit a2f7f84938)
2020-02-27 04:19:53 +00:00
Peter_Liang
193da54391 Fine-tune the public APIs of allow rich content in Accessibility Settings for security.
1. Add some checkers and java doc:
  - loadHtmlDescription
    It filters the <img> tag which do not meet the custom specification and the <a> tag.
  - loadAnimatedImage
    It checks the resource whether to exceed the screen size.

Bug: 149516547
Test: atest AccessibilityShortcutInfoTest & manual test
Change-Id: I8ecad186fc9e4bb6799ded296805cdc5353c5010
Merged-In: I8ecad186fc9e4bb6799ded296805cdc5353c5010
(cherry picked from commit c6e3836915)
2020-02-25 09:05:12 +00:00
PETER LIANG
cd94c1871e Merge "Revise the parameter of public API for allow rich content." 2020-02-20 20:30:45 +00:00
Automerger Merge Worker
33b8bf685a Merge "Make me an owner of accessibility frameworks" am: 269d57b7da am: 6374aaf5c5 am: 865c89c5a3
Change-Id: I88fd0443d59c45ad625af9d72f05d8de8e4cb783
2020-02-20 04:29:31 +00:00
Peter_Liang
f532a2351b Revise the parameter of public API for allow rich content.
Change "loadAnimatedImage(PackageManager)" to "loadAnimatedImage(Context)"

Bug: 142532186
Test: manual test
Change-Id: I3a6f61fbcd06e73d17cc20ea60effa6e84f0db7b
2020-02-20 02:46:03 +00:00
PETER LIANG
2187f9e855 Merge "Revise the modifier and naming of public APIs for allow rich content." 2020-02-19 23:51:48 +00:00
Qasid Ahmad Sadiq
88d52e8ca6 Make me an owner of accessibility frameworks
Test: Relying on treehugger. No functional changes.
Change-Id: If0e88345001ec286bd0a9a01314dba53e45dc6ac
2020-02-19 14:02:07 -08:00
Peter_Liang
81332eff4a Revise the modifier and naming of public APIs for allow rich content.
Change "int getAnimatedImageRes()" to "Drawable loadAnimatedImage(PackageManager packageManager)"

Bug: 142532186
Test: atest AccessibilityShortcutInfoTest & manual test
Change-Id: I2583a5c2427449bca68af29a0a40215dd0cb9085
2020-02-19 21:41:10 +08:00
TreeHugger Robot
f348b9f3bf Merge "Increase granularity of gesture dispatch to 60fps" 2020-02-19 13:21:46 +00:00
Ameer Armaly
cc13292c06 Add passthrough functionality for touch exploration and gesture detection.
Bug: 136131815:
Test: atest GestureManifoldTest AccessibilityGestureDetectorTest TouchExplorerTest
Change-Id: I8c6b7a333dcb9a4949387a7a683e2dc229d2b18f
2020-02-18 23:52:44 +00:00
Robert Berry
a8c7d84013 Increase granularity of gesture dispatch to 60fps
This is essential if AccessibilityService instances want to animate the
gestures being dispatched (e.g., displaying an overlay showing where the
virtual "finger" is moving).

Test: manual
Bug: 149753602
Change-Id: Ic508c6bd8b4cefa052be9adcac749859c382147a
2020-02-18 17:37:30 -05:00
PETER LIANG
c0570cf0a8 Merge "Change the attribute format of htmlDescription." 2020-02-14 08:47:47 +00:00
Jacky Kao
075a8094b4 Merge "Improvement for takeScreenshot() API" 2020-02-14 04:35:01 +00:00
Jacky Kao
5519738da5 Improvement for takeScreenshot() API
1. Modify the related documentations.
2. Make the timestamp got from framework side.
3. Use the ParcelableColorSpace class.

Bug: 149271120
Test: a11y CTS & unit tests
Change-Id: I2aedf67f8ed7d949322b23b59eaa383e53ecb594
2020-02-14 09:36:00 +08:00
Ameer Armaly
259daddeea Add multi-finger double tap and hold gestures.
This CL includes two, three and four finger double-tap and hold.

Bug: 136131815
Test: atest GestureManifoldTest TouchExplorerTest AccessibilityGestureDetectorTest
Change-Id: I4c0a95a4ac2d13e0a7e2c7920df619063ec1cfc0
2020-02-13 11:23:36 -08:00
Peter_Liang
515b989fb8 Change the attribute format of htmlDescription.
After the discussion, shouldn't let developers use the general
string which is non resource id. And only support the resource id string.

Bug: 142532186
Test: manual test
Change-Id: I912effc500c72d2ac83cc344f4e4099f6f469652
2020-02-13 21:08:39 +08:00
Rhed Jao
0132d90b3f Merge "Support rich content for accessibility shortcut target" 2020-02-11 00:18:28 +00:00
Rhed Jao
649b2fb00a Support rich content for accessibility shortcut target
Two attributes are added in AccessibilityShortcutInfo:
- animatedImageDrawable
- htmlDescription

Bug: 148929247
Test: atest AccessibilityShortcutInfoTest
Change-Id: Ibf41775cbfee0fdd946541bbae45ac088d11d693
2020-02-07 18:56:56 +08:00
Jacky Kao
76c7f54d15 Merge "Changing the return type of takeScreenshot() (2/n)" 2020-02-07 00:01:49 +00:00
Jacky Kao
2fffd22b76 Changing the return type of takeScreenshot() (2/n)
Implementing the new return type for A11y services to take
the screenshot of the specified display.
boolean takeScreenshot(int displayId,
@NonNull @CallbackExecutor Executor executor,
@NonNull Consumer<ScreenshotResult> callback)
The return type is a new class, ScreenshotResult, including
hardwareBuffer, colorSpace, and timestamp. A11y services could
use the method, Bitmap#wrapHardwareBuffer, to obtain the bitmap.

Bug: 10931661
Test: a11y CTS & unit tests
Change-Id: I03eae10f0970d0e11e02c9d3f4031c4096b7b5b4
2020-02-06 16:29:05 +08:00
Ameer Armaly
ec5eb82a6d Add four-finger gestures.
This CL includes the following gestures:
1) Four-finger single / double / triple tap.
2) Four-finger swipe up / down / left / right.

Bug: 136131815
Test: atest GestureManifoldTest AccessibilityGestureDetectorTest TouchExplorerTest
Change-Id: If5b4bfc680423f0672452b9aa440c8f18333f565
2020-02-05 11:13:12 -08:00
Ameer Armaly
8fa1dd2aad Add one-direction multi-finger swipes.
Bug: 136131815
Bug: 142277518
Bug: 142277280
Test: atest GestureManifoldTest AccessibilityGestureDetectorTest TouchExplorerTest
Change-Id: I3e6997c863d50e3f2d8638ca57b508676f0909a1
2020-02-02 03:56:05 +00:00
Dieter Hsu
3cbd098e7a Implement multi-finger multi-tap gesture matchers for accessibility
This matcher would detect following gestures when accessibility flag
flagRequestMultiFingerGestures enabled:

- 2-finger single tap
- 2-finger double tap
- 2-finger triple tap
- 3-finger single tap
- 3-finger double tap
- 3-finger triple tap

Bug: 142277684
Bug: 142276516
Bug: 136131815
Test: atest AccessibilityGestureDetectorTest TouchExplorerTest GestureManifoldTest

Change-Id: I0aa6e858520d0b36c81df6fe08fd86d7d0803d5a
2020-01-28 13:24:12 -08:00
Ameer Armaly
bb9b8d4d5a Add flag for services to request multi-finger gestures.
Bug: 136131815

Test: atest GestureManifoldTest AccessibilityGestureDetectorTest TouchExplorerTest
Change-Id: Ia6eac44f467963856ca7b8ba561794fa5e49b953
2020-01-24 15:41:52 -08:00
Ameer Armaly
ab60f20fda Add flag for accessibility services to request that double tap gestures be dispatched to the service.
When disabled, double tap and double tap and hold will be handled by the framework. Specifically, they will perform ACTION_CLICK and ACTION_LONG_CLICK on the item with accessibility focus.

Bug: 136131815
Test:  atest GestureManifoldTest TouchExplorerTest  AccessibilityGestureDetectorTest
Change-Id: I19f8f2650e383f136ae9f4d0423d86721c27265b
2020-01-24 15:41:52 -08:00
Hongming Jin
8302c6cd85 API on AccessibilityService side to support customized system actions.
Test: atest AbstractAccessibilityServiceConnectionTest
      atest AccessibilityServiceTest
      atest AccessibilityManagerServiceTest
Bug: 136286274
Change-Id: I6810cc9d2fff3f81f76b63fb075a68973e9757c8
2020-01-17 01:35:27 +00:00
Jacky Kao
09789e4168 Implementing new API : takeScreenshot()
Implementing the new API for A11y services to take the screenshot
of the specified display.
Bitmap takeScreenshot(int displayId)
1. The main codes is moved from the UiAutomationConnection class and
let the UiAutomation change to use this API.
2. Add a capability at metadata to check whether the A11y services could use this
API or not.
3. This API is a async one for A11y services, but is a sync one for
UiAutomation.

Bug: 10931661
Test: a11y CTS & unit tests
Change-Id: I478bd93c60d4742bef20ae0e423ca9de1bda55d2
2020-01-15 16:23:52 +08:00
Jackal Guo
7fd8e937bf Merge "Support accessibility on embedded hierarchies (1/n)" 2020-01-15 05:40:36 +00:00
Jackal Guo
79b182e752 Support accessibility on embedded hierarchies (1/n)
To support embedded hierarchies (leash):
1. Add new APIs for leashed child in AccessibilityNodeInfo.
2. SurfaceView needs to use this API to add such child when
   initializing the AccessibilityNodeInfo.

Bug: 137593247
Test: a11y CTS & unit tests
Change-Id: Ieaa57c6ad65f4c199175d929c3bcba7fb7e6ef26
2020-01-14 10:29:54 +08:00