Commit Graph

324 Commits

Author SHA1 Message Date
Sally Yuen
b9c9a4a068 Merge "Refactor A11yInteractionClient so every service has its own cache" 2021-11-23 19:44:19 +00:00
sallyyuen
85cfe63e23 Refactor A11yInteractionClient so every service has its own cache
- Maintain a static collection of caches (sCaches). Lock is
sConnectionCache
- Initialize a cache when a connection is added. (client.addConnection)
- Remove the cache when a connection is removed. (client.removeConnection)
- System server should not have its cache initialized, can remove
parameter in AccessibiltyInteractionClient constructor

I tried to maintain a local reference (mAccessibilityCache) to the
service cache for each client to avoid accessing the static
collection for each request. But since the process is not immediately
killed when the service is turned off, ensuring resources are cleared
correctly is big time investment that can be done later if desired.

Bug: 192489177
Test: Build and use talkback, do the slew of tests.

atest CtsAccessibilityServiceTestCases  CtsAccessibilityTestCases
CtsUiAutomationTestCases
FrameworksServicesTests:com.android.server.accessibility
FrameworksCoreTests:com.android.internal.accessibility
FrameworksCoreTests:android.view.accessibiliity

Change-Id: Ic30f6915c7b3c186a512ed8b410bf6e842eff5fb
2021-11-22 15:54:41 -08:00
mincheli
1a07e0dbe7 MagnificationProcessor uses MagnificationConfig to control the specified magnifier
MagnificationConfig stores the magnification configuration of the
controlling magnifier, such as magnification mode, scale and center
postion.
And MagnificationProcessor uses the config to controll the magnifier for
AccessibilityService.

See
API review doc: go/b200769372
Design doc: go/a11yservice_control_magnification_in_t
   The chapter at Proposal A and  MagnificationConfig
CTS: ag/15824302

Bug: 199732498
Test: atest AbstractAccessibilityServiceConnectionTest,
      atest MagnificationProcessorTest,
      atest WindowMagnificationManagerTest,
      atest MagnificationConfigTest
Change-Id: I20323865d2efe1b40626f0c86767848733856482
2021-11-22 12:28:47 +00:00
Ameer Armaly
582737d363 Rename TouchInteractionController#Listener to Callback per API review.
Bug: 205738584
Test: atest TouchInteractionControllerTest
Change-Id: I99f79fcc7383b2b9a4a2e5f9637ec9a1dfc9f430
2021-11-17 18:00:04 +00:00
Ameer Armaly
a558ed6808 Add TouchInteractionController API to allow gesture detection from the service.
Bug: 159651900
Test: atest TouchExplorationControllerTest
Change-Id: Ie28dccb0ed29e632bcdb057e909093fa5b7065ac
2021-11-05 11:30:58 -07:00
Riley Jones
d3c1afd939 Update list of feedback types on AccessibilityService API reference page
Test: Only changes documentation, does not need testing
Fixes: 204357908

Change-Id: If3807fec5c5502226bf64aa78c0226244f5543de
2021-10-28 21:39:42 +00:00
Automerger Merge Worker
a24f0c6530 Merge "Merge "Fix strictMode violation in Accesibility Service" into sc-v2-dev am: f8a72564cf" into sc-v2-dev-plus-aosp am: 2cdb2f998f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15079518

Change-Id: I22621d8b09529fdeab08d14f65be9b6653c0497e
2021-07-01 18:11:59 +00:00
Ryan Lin
3046951d93 Merge "Fix strictMode violation in Accesibility Service" into sc-v2-dev am: f8a72564cf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15079518

Change-Id: If27990f0fdddf75e42e6ec14f1d98c0b2da5d330
2021-07-01 13:34:38 +00:00
ryanlwlin
bce17f97bc Fix strictMode violation in Accesibility Service
From Android R, using the WindowManager from non-ui context
violates the vm policy. It may cause incorrect window bounds
with the given floating window. AccessibilityService provides
Accesibility overlay usage that needs to set window token to
the windowManager. However, Setting it when the service is bounded
violates the policy.
To fixt it, we set the window token when developers get WindowManager
first time.

Bug: 175785781
Test: atest AccessibilityOverlayTest, use the test apk to check if
the warning message is shown in the log
      manual test to see if SelectToSpeak works well
Change-Id: Ia873488626aa4da111499282d1971f836cf111cd

Change-Id: Ia87df60c393bb0e40d85ced4184c78a09d7b427b
2021-07-01 14:51:03 +08:00
John Wu
07dd451178 Merge "Add attribution tag to checkAccessibilityAccess" 2021-06-17 18:27:52 +00:00
John Wu
cb33d536a4 Add attribution tag to checkAccessibilityAccess
Bug: 190659583
Test: build/flash
Change-Id: Ic6b3e92fb2d064939f83aa6aa7e5747f268e60ab
2021-06-17 16:07:29 +00:00
TreeHugger Robot
ddcd68cd14 Merge "Up limit from 1fps to 3fps for takeScreenshot" into sc-dev am: 8bbb015c7d am: 6396e0c427
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14966736

Change-Id: Id3f5d4dd2f2ef4b87fee1beab913d8af7e0edaa9
2021-06-14 18:51:24 +00:00
TreeHugger Robot
6396e0c427 Merge "Up limit from 1fps to 3fps for takeScreenshot" into sc-dev am: 8bbb015c7d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14966736

Change-Id: I6f6c137f4ac49a93203eb61c1dbd55647987ef73
2021-06-14 18:49:52 +00:00
Robert Berry
3aee3791d3 Up limit from 1fps to 3fps for takeScreenshot
Allow AccessibilityService instances to request screenshots more
frequently (up to three screenshots per second). This used to be capped
at one screenshot per second in Android R.

Test: cts
Bug: 188077373

Change-Id: I880e2d922db3ce2bd075efcb02466ea1f4914792
(cherry picked from commit 113436f49f)
2021-06-14 17:02:28 +00:00
TreeHugger Robot
3dc6a787fb Merge "Up limit from 1fps to 3fps for takeScreenshot" 2021-06-14 01:56:08 +00:00
Thiébaud Weksteen
4e63c40e22 Merge "Fix Javadoc typo" am: 2090502b46 am: 65a7413ba0 am: 3f8ba610bb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1725473

Change-Id: Id49bde559aa449fd9123a129d9bf6c56ce3bb418
2021-06-04 10:56:28 +00:00
Thiébaud Weksteen
3f8ba610bb Merge "Fix Javadoc typo" am: 2090502b46 am: 65a7413ba0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1725473

Change-Id: I8220261da6d3d61f92ce6d3d6acf00a4e3cc4664
2021-06-04 07:38:48 +00:00
Thiébaud Weksteen
90c63acfa0 Fix Javadoc typo
HTML ol element is used to declare an ordered list, not a list item.

Change-Id: I1fac2f236ce40effb54fdead01c99729d4ef15b4
2021-06-03 10:31:15 +02:00
Hongming Jin
a0f9d36647 Add features to allow filtering logging based
on interfaces.

Bug: 157601519
Test: adb shell cmd accessibility start-trace -t IAccessibilityServiceConnection IAccessibilityServiceClient IAccessibilityManager
      adb shell cmd accessibility stop-trace
Change-Id: Iab5ec5ae3d77c893a646cf1ae106ff5fa50d9281
2021-05-26 13:36:55 -07:00
Robert Berry
113436f49f Up limit from 1fps to 3fps for takeScreenshot
Allow AccessibilityService instances to request screenshots more
frequently (up to three screenshots per second). This used to be capped
at one screenshot per second in Android R.

Test: cts
Bug: 188077373

Change-Id: I880e2d922db3ce2bd075efcb02466ea1f4914792
2021-05-24 15:25:07 -04:00
Charles Chen
0adcce60ad Fix Accessibility apps crash when adding view by
... AccessibilityService created WindowContext

In R, we introduce WindowContext to handle non-activity windows. When
developers want to add an accessibility overlay window on secondary
display, it is suggested to call
createDisplayContext(secondaryDisplay)
.createWindowContext(TYPE_ACCESSIBILITY_OVERLAY, null) or call
createWindowContext(secondaryDisplay, TYPE_ACCESSIBILITY_OVERLAY, null)
in S.

However, it doesn't work now because the WindowToken with type
TYPE_ACCESSIBILITY_OVERLAY is managed by system server, and Accessibility
app should obtain the WindowToken to attach the overlay window.

The current mechanism of AccessibilityService is to set default token to
WindowManager for created DisplayContext. This CL follows this mechanism
on WindowContext to set the default token.

Test: atest AccessibilityServiceTest
fixes: 186085801
Change-Id: I2ac2cf1c72adebf33eb6b6883437a7f13993d8a9
2021-05-19 09:06:03 +00:00
Ameer Armaly
39f4c5967c Un-hide passthrough flag
We added a flag to restore the passthrough for multifinger gestures, but left it hidden for the QPR. It should be made public for S so TalkBack doesn't continue to use non-public APIs.
Fix: 187458811
Test: manual
Change-Id: I02fa6b9e4dacec131aac86adc54386ad7b6249ad
2021-05-13 17:40:49 +00:00
Danny Epstein
aafe4edd98 Allow getComponentName() to be used in tests
Add @TestApi annotation to AccessibilityServiceInfo.getComponentName().

Test: manual
Bug: 169601090
Change-Id: I83f1fdfafd49ec7c625ed2ebad399b15df191dcb
2021-04-12 16:07:53 -07:00
Hongming Jin
c49cac7386 Add trace for AccessibilityInteractionClient callback interfaces.
In an effort to reduce unnecessary String operations and Binder calls
from AccessibilityInteractionClient, also add channels to propagate
tracing state to AccessibilityInteractionClient through
AccessibilityManager.

Bug: 157601519
Test: adb shell cmd accessibility start-trace
      adb shell cmd accessibility stop-trace
Change-Id: Idfe220bc64a9c83679201b9a9a36b1c492f9d6cc
2021-04-02 12:15:14 -07:00
Bernardo Rufino
9b182c69f3 Merge "Add DISMISS_NOTIFICATION_SHADE action for a11y" into sc-dev 2021-03-15 15:39:18 +00:00
Bernardo Rufino
2c458b7cf6 Add DISMISS_NOTIFICATION_SHADE action for a11y
As discussed in b/159334261, although the current a11y use-cases for
closing the notification shade are already handled, it makes sense to
add an explicit global action for accessibility services to close the
notification shade (especially given there is one for opening the shade
already).

Added dependency to SystemActions, which required me to change add
SystemActions to SystemUIGoogleBinder (topic). I also added to
CarSystemUIBinder since SystemActions was also in their xml. I don't
know if I need to add to others (eg. Arc), please advise.

Bug: 159334261
Bug: 159105552
Test: With the shade opened, as a11y service send
      GLOBAL_ACTION_DISMISS_NOTIFICATION_SHADE and verify shade is
      closed.
Change-Id: If52a1763170d5a5efd6b4756794206fd8bfb18a0
2021-03-12 14:57:56 +00:00
ryanlwlin
5e3e603bbf Add a property for the declarition of accessibility purpose
AccessibilityService is a powerful service that could view the content
or control the device. However, some apps using it is not for
accessibility. We would like to add "isAccessibilityTool" property in
the xml to distinguish its purpose.
If the Accessibilityservices is not for users with disabilities,
system would inform the user after enabling for a period of time.

Bug: 176960226
Test: atest CtsAccessibilityTestCases#AccessibilityServiceInfoTest
Change-Id: I91327470ce39a28e701fa6841f9edccc1a92ffe4
2021-03-09 12:16:33 +08:00
Xin Li
be473bf819 Merge ab/7061308 into stage.
Bug: 180401296
Merged-In: I4bf82035631ccff6d5a6144d6d9b1d203b076851
Change-Id: I1b5f3a672a55eaabba0f5389bab110b395553559
2021-02-21 09:39:53 -08:00
Ameer Armaly
bc1a2bdc44 Move Gesture ID 43 from two-finger single tap and hold to two-finger triple tap and hold.
Bug: 178849493
Test: atest AccessibilityGestureDetectorTest

Change-Id: Ibb3826ba2afd2b932d8e1491b601157285f9d67a
2021-02-02 22:22:34 +00:00
Treehugger Robot
ea8b0e9eb8 Merge "Make me an owner of accessibility frameworks" am: f79a0fd564 am: b8ec02815b am: d65928539b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553965

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I505c172ee9d683a56abf517a14e31534b58d784c
2021-01-19 22:57:32 +00:00
Treehugger Robot
d65928539b Merge "Make me an owner of accessibility frameworks" am: f79a0fd564 am: b8ec02815b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553965

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic7d1237a3f2b08f6ce6017e29b189f1331b61bba
2021-01-19 22:43:42 +00:00
ryanlwlin
528811e0ef Make me an owner of accessibility frameworks
Test: Relying on treehugger. No functional changes.
Change-Id: Icc51b1b4e752289db1cbf24c2cd8e08a939fefec
2021-01-19 12:49:01 +08:00
Ameer Armaly
aac39ed526 Merge "Make AccessibilityGestureEvent.gestureIdToString public." 2020-12-23 21:21:39 +00:00
Ameer Armaly
97270e803d Make AccessibilityGestureEvent.gestureIdToString public.
This allows for better error reporting in tests and services.
Bug: 159651900
Test: atest GestureManifoldTest TouchExplorerTest AccessibilityGestureDetectorTest FrameworksServicesTests:TouchExplorerTest

Change-Id: Ic65ff7100ade77bbf26d538a033e9e000e6b9bcc
2020-12-22 20:15:45 +00:00
Jacky Kao
ad119d9a78 Keep changed focus data after service disable
Since in reality only one service at a time (and maybe ever) will care
about these focus data, letting services change these parameters and
leaving it alone even that service is disable.

Bug: 175732114
Test: a11y CTS & unit tests
Change-Id: Ic1f9d29c35ebccbabb6b35b9f113920b992af0df
2020-12-22 08:37:30 +08:00
Jacky Kao
9e73bfc2f3 Allow A11yService to customize accessibility focus
1. Define and implement new APIs to set and get the stroke width
and color of the A11y focus rectangle.
2. New an AccessibilityFocusApperanceData variable with the default
value in the A11yUserState class, and it would be used in the A11y
framework.
3. When A11y services sets the stroke width and color of the focus
rectangle, A11yUserState will apply the same value through
A11yServiceConnection and notify this change to A11yManager.
4. When A11y services customized the data is disabled, reseting the
data in the A11yUserState and notifying this change to A11yManager.
5. When the ViewRootImpl gets the A11yFocusDrawable, it changes the
strokewidth and the color of this drawable based on the value from
A11yManager.

Bug: 141144573
Test: a11y CTS & unit tests

Change-Id: I1493f17f7cc25744e1435c9070218c6f7efa8bcf
2020-12-04 09:55:11 +08:00
Ameer Armaly
fbab59f523 Stop setting flag to enable two-finger passthrough swipes.
Bug: 162521649
Test: atest GestureManifoldTest TouchExplorerTest AccessibilityGestureDetectorTest FrameworksServicesTests:TouchExplorerTest
Change-Id: I7718ac2ae86d46aa05d45a1ac3abc556e000e39d
(cherry picked from commit 0295f94356)
2020-11-19 13:00:46 -08:00
Mathew Inwood
5d123b6775 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-11-04 09:45:53 +00:00
Mathew Inwood
5f0edaaaf5 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I8285daa8530260251ecad6f3f38f98e263629ca7
Change-Id: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
2020-11-02 10:30:09 +00:00
Mathew Inwood
8e742f928e Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

This is a resubmit of ag/12929664 with some APIs excluded that caused
test failures; see bugs 171886397, 171888296, 171864568.

APIs excluded:
Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
Landroid/os/Process;->myPpid()I
Landroid/os/SharedMemory;->getFd()I
Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I

Bug: 170729553
Test: Treehugger
Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
2020-10-29 11:51:12 +00:00
Hongwei Wang
050275cd83 Revert "Add maxTargetSdk restriction to unused APIs."
This reverts commit 72f07d6a8a.

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397

Bug: 171886397
Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
2020-10-28 20:16:22 +00:00
Mathew Inwood
72f07d6a8a Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
2020-10-27 15:46:07 +00:00
Ameer Armaly
b6fafa6052 Add API to record touch interactions.
Bug: 159651900
Test: manually enable the flag and turn on debugging. Observe motion events being dispatched as part of the AccessibilityGestureEvent.
Change-Id: Ia27dcfd3b3fe0af423d9b10054ba69a6914e0f78
2020-10-21 00:00:30 +00:00
Roman Kalukiewicz
24403f7ef2 Add @Nullable annotation to the parameter of Object.equals() methods.
Those annotations could be inferred by some tools (like Kotlin), but the
https://checkerframework.org/ doesn't check inherited annotations
complaining about all equals() invocations that get nullable argument.

The change was generated by running

find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /'

in the frameworks/base directory and by automatically adding and
formatting required imports if needed. No manual edits.

Bug: 170883422
Test: Annotation change only. Should have not impact.
Exempt-From-Owner-Approval: Mechanical change not specific to any component.
Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
2020-10-15 10:48:01 -07:00
Ameer Armaly
0295f94356 [DO NOT MERGE ] Stop setting flag to enable two-finger passthrough swipes.
Bug: 162521649
Test: atest GestureManifoldTest TouchExplorerTest AccessibilityGestureDetectorTest FrameworksServicesTests:TouchExplorerTest
Change-Id: I7718ac2ae86d46aa05d45a1ac3abc556e000e39d
2020-10-13 20:27:26 +00:00
Ameer Armaly
abfaf269a9 [DO NOT MERGE] Enable two-finger passthrough swipes.
Bug: 162521649
Test: atest GestureManifoldTest TouchExplorerTest AccessibilityGestureDetectorTest FrameworksServicesTests:TouchExplorerTest
Change-Id: I9e6b691295a0fa006578d7b8ad8468579c66939c
2020-10-11 08:04:42 -07:00
Ameer Armaly
ba854db8c5 Add gesture ids 43-45.
GESTURE_2_FINGER_SINGLE_TAP_AND_HOLD = 43
GESTURE_3_FINGER_SINGLE_TAP_AND_HOLD = 44
GESTURE_3_FINGER_TRIPLE_TAP_AND_HOLD = 45

Bug: 169189474
Test: atest GestureManifoldTest TouchExplorerTest AccessibilityGestureDetectorTest FrameworksServicesTests:TouchExplorerTest
Change-Id: Icaed2bbfcea35d42bf3fdf0cee9bfdf8ac819438
2020-10-01 14:08:08 -07:00
Ameer Armaly
2820f73943 Enable two-finger passthrough swipes.
Bug: 162521649
Test: atest GestureManifoldTest TouchExplorerTest AccessibilityGestureDetectorTest FrameworksServicesTests:TouchExplorerTest
Change-Id: I9e6b691295a0fa006578d7b8ad8468579c66939c
2020-08-06 15:25:18 -07:00
Sally Yuen
f55b5b9620 Unhide global action constants
Bug: 158004529
Test: Builds
Change-Id: Ida65a458767417536975519b89afc2a81a9034e9
2020-06-24 18:03:41 +00:00
Sally Yuen
38401222ac Merge "Add GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS" into rvc-dev am: 310bf3094a am: 47c5064448 am: f0866c2436 am: 23cdd538fb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11697460

Change-Id: I91d26054990c5682aa1d18fa1a31cb895b6a47a6
2020-06-03 04:29:03 +00:00