Commit Graph

868 Commits

Author SHA1 Message Date
Ryan Lin
75309bcd38 Merge "Document the split-screen action" into sc-v2-dev am: 93124d69fc
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16375117

Change-Id: I3061d1fbbf4f6712ee5de7090ce5a72df5f962e8
2021-12-10 01:11:30 +00:00
ryanlwlin
1ad80ead92 Document the split-screen action
The split-screen behavior is changed, so systemui doesn't
support this action with a single activity. We don't handle
this action by default from sc-v2. If SystemUI has any behavior
changed, they could register this action to support it.

Bug: 207056257
Test: presubmit pass
Change-Id: If569eff1ac52601e6b88324d7b47630a53e198f2
2021-12-08 17:35:37 +08:00
Treehugger Robot
8a39104e92 Merge "Fix that AccessibilityServiceConnection#serviceInterface may be invalid in the async" am: 700fb9ebeb am: bf6cc67976 am: 481964bf2c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1870459

Change-Id: I0677c6a1f3b6f605d2c58a721a075f2a1630bbe3
2021-11-29 05:01:56 +00:00
huyuxin
e41806e611 Fix that AccessibilityServiceConnection#serviceInterface may be invalid in the async
Bug: 204104901
Test: Manual

Change-Id: Iab66934872ad6d480eb60d8cd418bd8ab3feda49
Signed-off-by: huyuxin <huyuxin@xiaomi.com>
2021-10-26 13:13:35 +00:00
Yabin Huang
b5de870db7 Merge "Add hidden APIs to allow to get and set task ID in AccessibilityWindowInfo" into sc-v2-dev am: 6f8792bba7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15440808

Change-Id: Iefd7acebf912793d76b4196f56a2656ef64f80cf
2021-08-05 01:34:47 +00:00
Yabin Huang
1cd59c50f1 Add hidden APIs to allow to get and set task ID in AccessibilityWindowInfo
Bug: 195346337
Test: atest android.view.WindowInfoTest
Change-Id: I416f0330966e4a1880a2b6bdd6f24e6077cbe1cc
2021-08-03 00:56:02 +00:00
Phil Weaver
8254cbd020 Merge "Fix "already registered" error" am: 0df5bbfe90 am: c4b00b8f57 am: f5bc120ad5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1751360

Change-Id: Ie8fb5498c7f19605097e4515a14cfdecded2bcf7
2021-07-19 18:01:36 +00:00
Phil Weaver
f5bc120ad5 Merge "Fix "already registered" error" am: 0df5bbfe90 am: c4b00b8f57
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1751360

Change-Id: Icc6dc6d5157c133097e67aad1837c3861fd02080
2021-07-19 18:00:44 +00:00
Ameer Armaly
aa704d7339 Merge "TouchExplorer: log malformed events instead of crashing." into sc-dev am: 1c405c33b0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15275875

Change-Id: I031feab71db7952ca80d2498f0831b2772e4c7b1
2021-07-16 01:54:03 +00:00
Ameer Armaly
81c452cc55 Merge "TouchExplorer: log malformed events instead of crashing." into sc-dev am: 1c405c33b0 am: 0edea2f14b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15275875

Change-Id: I27baec67ed7ff96427cdc7b0b8dead4c48806fbd
2021-07-15 15:14:49 +00:00
Ameer Armaly
c0b1a5b3da TouchExplorer: log malformed events instead of crashing.
Bug: 193092818
Test: atest GestureManifoldTest TouchExplorerTest AccessibilityGestureDetectorTest
Change-Id: I5aee4e253479b7d3b2cbdc573b335c6edf389eb9
2021-07-14 13:44:33 -07:00
Jacky Kao
418b3db820 Reset the features in A11yInputFilter per display
The A11yInputFilter is an input filter for implementing many
accessibility features on multi-display. When any display is
added or removed, all features of all displays would be reset
now.

To avoid server side bad user experience, we should only reset
the features and the event stream state based on the changed
display which is added or removed.

Bug: 187996964
Test: a11y CTS & unit tests
Merged-In: I39ae59e12690240adbb0e81338dcb4c736a92197
Change-Id: I39ae59e12690240adbb0e81338dcb4c736a92197
(cherry picked from commit e6014fc060)
2021-07-05 23:21:49 +00:00
Ryan Lin
8645872b66 Merge "Fix incorrect border after folding/unfolding the device" into sc-v2-dev 2021-07-02 02:29:43 +00:00
TreeHugger Robot
a2ac47278c Merge "Add FLAG_IS_ACCESSIBILITY_EVENT to KeyEvent and MotionEvent" into sc-dev am: 24b5ca6b4b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15021525

Change-Id: I6d72e36bb129e093bde0013c060a0eda61f16264
2021-07-01 03:43:03 +00:00
Siarhei Vishniakou
b42785efdf Add FLAG_IS_ACCESSIBILITY_EVENT to KeyEvent and MotionEvent
This flag indicates that the event was modified or generated by an
accessibility service.
It allows apps to tell apart real hardware events, events that are
injected (device id == -1), and events coming from accessibility (has
flag is_accessibility_event).

Events that have gone into accessibility, and got reinjected without
being modified will not be distinguishable from real hardware events.

In the next release, we will make FLAG_IS_ACCESSIBILITY_EVENT public
api. Until then, applications will have to hard-code its value (0x800)
to use it. The value is the same for both KeyEvents and MotionEvents for
convenience.

Bug: 175069843
Bug: 152399927
Test: atest VerifiedMotionEventTest VerifiedKeyEventTest
Test: atest AccessibilityGestureDispatchTest
Test: atest inputflinger_tests libinput_tests GamepadWithAccessibilityTest
Change-Id: I38ac2ab8e19e32cad927742c623f14f43ea0c588
2021-06-30 21:07:38 +00:00
Jintao Zhu
08280849dc Fix "already registered" error
Root cause:
 Upon running into the method "UiAutomationManager.registerUiTestAutomationServiceLocked", after assigning "mUiAutomationService" with newly created object, the calling of "mUiAutomationService.onAdded()" may throw an exception which simply skipping the next code line "mUiAutomationService.mServiceInterface.asBinder().linkToDeath", which preventing it from getting notification when the "mServiceInterface" process dies, then, the "mUiAutomationService" will never have a chance to be clean-up-ed.  And, next time, upon running into registerUiTestAutomationServiceLocked again, it has to complain "already registered".

Solution:
 Move the line "mUiAutomationService.onAdded()" to after the line "linkToDeath", so that, the possible exception will not prohibit the linkToDeath operation.

Bug: 192317057
Test: monkey test for one day and one night

Co-authored-by: Zheng Xiaoying <zheng.xiaoying@gm.com>

Signed-off-by: Jintao Zhu <zhujtcsieee@gmail.com>

Change-Id: Ife4584804910290fac70dbe6d6934333f9a7486a
2021-06-29 21:47:02 +08:00
Ryan Lin
5f48285bcf Merge "fix package visibility for installed accessibility services" into sc-dev am: d616f1ed95
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14972858

Change-Id: I859e0d4ef07de6283078f808c9765f384cdd886e
2021-06-23 01:27:16 +00:00
Ryan Lin
d616f1ed95 Merge "fix package visibility for installed accessibility services" into sc-dev 2021-06-23 01:13:13 +00:00
Jason Hsu
f01e33f152 Merge "Add the log for new supported accessibility button type 'Accessibility Floating Menu'" into sc-dev am: 72679b768a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14779652

Change-Id: Idfbf45595b36ffe1d3328f7327012d8e1bc69696
2021-06-18 02:33:14 +00:00
jasonwshsu
eb304bd341 Add the log for new supported accessibility button type 'Accessibility Floating Menu'
* Logs the atom AccessibilityShortcutReported in westworld

Bug: 189860801
Test: make statsd_testdrive && statsd_testdrive 266
Change-Id: I4e5814cb6a1d877af540e278de5ffa398d6d0351
2021-06-17 16:16:07 +00:00
ryanlwlin
827247ab2a Fix incorrect border after folding/unfolding the device
The display size is changed after folding/unfolding the device.
We need to refetch the size to draw the correct boundary on
the screen. Display#realSize is not updated in time, so we get the
bounds directly from windowConfiguration.

Bug: 190007130
Test: manual test
Change-Id: I942e333f62510650eec8b49d77ccf46a85a7457e
2021-06-17 16:08:44 +08:00
ryanlwlin
5170c58c86 fix package visibility for installed accessibility services
If the app targets API level 30, the returned installed
AccessibilityServiceInfo would based on its own package visiblity.
Using packageManagerInternal#filterAppAccess to determine whether
we need to fitler the service or not.

Bug: 179699353
Test: manual - use the test apk and check the log
      atest AppEnumerationTests
Change-Id: Ieea089e10410a9d9feeb4a741c871c43547b1861
2021-06-17 09:51:09 +08:00
Siarhei Vishniakou
c3fb5dcd53 Merge "Remove FLAG_INPUTFILTER_TRUSTED in MotionEventInjector" into sc-dev am: 5d552869af
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14676739

Change-Id: I6ad42551ed0bbd48270fb3386f717727b3374779
2021-06-15 21:55:49 +00:00
Siarhei Vishniakou
5d552869af Merge "Remove FLAG_INPUTFILTER_TRUSTED in MotionEventInjector" into sc-dev 2021-06-15 21:50:35 +00:00
Sally Yuen
eb1dadc9e1 Merge "Add AccessibilityManager#removeClient" into sc-dev am: 00d32f2d61
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14804058

Change-Id: I2247895c1fb90fba155ffd70b80dddf61d73eb57
2021-06-04 22:50:08 +00:00
Siarhei Vishniakou
1214444260 Remove FLAG_INPUTFILTER_TRUSTED in MotionEventInjector
All input events coming into inputfilter from
InputDispatcher will now have FLAG_INPUTFILTER_TRUSTED set by default.
It is now up to the inputfilter (a11y) to remove this flag when appropriate.
One such case is where an unknown a11y service is injecting the events.

From auditing the a11y code, the only such place is MotionEventInjector.

Therefore, label all events coming out of MotionEventInjector as
"untrusted" by removing this new flag INPUTFILTER_TRUSTED.

Separately, a11y should be distinguishable from regularly injected input
events. To tell apart the events injected by a11y, add a new flag,
FLAG_INJECTED_FROM_ACCESSIBILITY. This flag requests InputDispatcher to
apply the device id = -2 for the injected events.

Test: atest CtsInputTestCases:android.input.cts.GamepadWithAccessibilityTest
Test: atest MotionEventInjectorTest
Bug: 175069843
Change-Id: I12d4a7bd6fbab8af202f5ae88b6be97ff9e1754c
2021-06-04 21:15:43 +00:00
Sally
4a41eca71b Add AccessibilityManager#removeClient
Whenever an app makes a Text toast, this gets routed through systemUI
starting from R. Two A11yManagerClients are registered with
A11yManagerService for every toast. Since clients aren't removed until
the process is killed, there are a bunch of clients from systemui
hanging around and potentially cause the system to crash.

We add a way here to explicitly unregister a client

Test: build and flash,
atest android.view.accessibility.AccessibilityManagerTest
Bug: 189010828

Change-Id: I3f71bac475b4539c7be5b328adeb0be35a0b5543
2021-06-04 20:28:26 +00: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
Jacky Kao
31eaf452ad Improve the windows register and unregister mechanism
1. For fixing the crash due to mutl-register callback, we avoid using
the display context when un-registering the callback. Instead, we
remove the observer mapping if the display exists along with the
observer of any embedded displays that are children of the
un-registered one.

2. When an display registers its callback first, and then got its
reparent window, there's an displayWindowObserver for it in the
A11yWindowManager. But it didn't be used because it's an embedded
display and any windows change on it will be notified through the
callback of its parent display. So we add a callback to remove
this un-used displayWindowObservers in the A11yWindowManager when
this display is an embedded one.

Bug: 143114102
Test: a11y CTS & unit tests
Merged-In: I00fd1f45c0b4e362143a8d82f31264ff202f0967
(cherry picked from commit 5b8b737755)
2021-05-19 07:54:39 +00:00
mincheli
1b2cf756a7 Uses windowContext for the MagnificationGestureHandler
ContextImpl checks the incorrect Context usage in S.
If non-ui context access window service, it would throw an
IllegalAccessException.
And the bug happened because the GestureDectectors in
PanningScalingHandler.class don't have the correct context.
So we have to apply using uiContext for the GestureDectectors
and MagnificationGestureHandler.

Bug: 185154435
Test: none
Change-Id: I942192011526d0e4ce68e6121855bd321c499f56
2021-05-04 17:10:22 +08:00
lucychang
f1f2c84756 Adds install source checks for accessibility service
Adds install source checks for accessibility services. An
accessibility category service must be installed from the
given allow list or not from the default installer if no
allow list provided.

Bug: 182959209
Test: atest AccessibilitySecurityPolicyTest

Change-Id: I023c15b9ebd87785e2f7eb1e218bec4ad006e52f
2021-04-29 05:55:54 +00:00
Hongming Jin
cc9c2a00a3 Restructure tracing code to prepare for the adding of filtering and
searching features.

Bug: 157601519
Test: adb shell cmd accessibility start-trace
      adb shell cmd accessibility stop-trace
Change-Id: I4da67416139d018b8024f693b7dc88666867cff1
2021-04-15 10:38:39 -07:00
Sally Yuen
57406e2fb1 Merge "Service requests can interrupt node prefetching" into sc-dev 2021-04-09 16:33:40 +00:00
Bernardo Rufino
9e9669ea8d Merge "Allow accessibility services to send Intent.ACSD" into sc-dev 2021-04-09 15:13:17 +00:00
Sally
7853e418e7 Service requests can interrupt node prefetching
This is the re re..re-merging of ag/12923546 (where most of that original
message is posted below). This includes various bug fixes.

Slow prefetch requests would block user interactive requests, creating
noticeable sluggishness and unresponsiveness in accessibility services,
especially on the web.

Let's make it so a user interactive requests stops prefetching.
We can't interrupt an API call, but we can stop in between API calls.

On the service side, we have to separate the prefetch callbacks from the
find callback. And we have to make it asynchronous. It does dispatch
intothe main thread, so the AccessibilityCache can remain single threaded.

When the calls are interrupted on the application side,
returnPendingFindAccessibilityNodeInfosInPrefetch checks the find
requests that are waiting in the queue, to see if they can be addressed
by the prefetch results. If they can be, we don't have to call into
potentially non-performant application code. We don't  check requests
that have differing prefetch flags (FLAG_INCLUDE_NOT_IMPORTANT_VIEWS,
FLAG_REPORT_VIEW_IDS) that would result in different caches. We satisfy
at most one pending request.

We also make mPendingFindNodeByIdMessages thread-safe and ensure in
ActionReplacingCallback we don't return null results. Merged
ag/13246536, ag/13256330

Messages should be added to PrivateHandler and
mPendingFindNodeIdMessages at the same time to avoid a race condition
where we try removing a message from the handler before it's actually
enqueued. This was causing double recycling

We call into AccessibilityCache from the Binder thread, now that the
cache doesn’t call out to the app main thread with a lock(ag/14020225)

Added tests to verify AccessibilityInteractionController interactions

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

Bug: b/184076735
Change-Id: Iaad1b9100655ec86a788ba1c89edd2dd8a7df1f6
2021-04-09 02:30:34 +00:00
lucychang
901ca0f20b Send componentName via extra for Accessibility usage notification
Send componentName via extra instead of idenfifier for Accessibility
usage notification intents because the identifier is used to identify
different intents only. The formal way to send data is via extra, thus
the notification can be launched by adb command.

Bug: 176965357
Test: enable a11y service and execute adb command below.
adb shell am broadcast -a PolicyWarningUIController.ACTION_SEND_NOTIFICATION
-p android --receiver-permission android.permission.MANAGE_ACCESSIBILITY
--ei android.intent.extra.USER_ID 0
--ecn android.intent.extra.COMPONENT_NAME xxx/yyy

Change-Id: I898b66efc05f0144981dd16bd92d719c756b4c2d
2021-04-08 03:56:20 +00:00
Bernardo Rufino
19a613c3da Allow accessibility services to send Intent.ACSD
For targetSdk < S. For S, they can use the new
GLOBAL_ACTION_DISMISS_NOTIFICATION_SHADE action to dismiss the
notification shade.

Bug: 159334261
Test: Send Intent.ACSD from an a11y service and verify shade is
      collapsed when targetSdk < S, and exception thrown when targetSdk
      S+.
Change-Id: I0e4be3faef8efa53a0b8a08263e842e0c4b1553e
2021-04-07 15:26:05 +01:00
TreeHugger Robot
7d8ae59fee Merge "Updates magnification button after an accessibility action is performed" into sc-dev 2021-04-07 03:25:32 +00:00
mincheli
80a35549c8 Updates magnification button after an accessibility action is performed
To switch magnification mode, a user has to click the magnifcation
button UI. However magnification button UI is visible only when
there is an user touch interaction or the magnification shortcut
triggered event.
However some a11y services like switch-access or voice-access
can only interact with magnification UI by performing
accessibility actions. To make magnification button showing and
able to interact with a user, we also trigger updating
magnification button UI when an accessibility action is performed.

Bug: 179442890
Test: atest WindowMagnificationControllerTest;
atest WindowMagnificationTest;atest MagnificationControllerTest;atest WindowMagnificationManagerTest

Change-Id: I8d762096c9cb6a4421d024a7a1af99b3a48a3462
2021-04-07 01:16:24 +00: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
ryanlwlin
49284c318d update switch UI if display magnification request is from external
Display magnifier could be magipulated by public API. This request
should be treated as an user interaction. We should also update the
magnification button in such circumstance.

Besides, we also disable display magnification that is requested
by AccessibilityService  when window magnification is enabled.

In the test part, we also verify the shorct trigged in full-screen
mode.

Bug: 179446412
Test: atest MagnificationControllerTest
      manually Test: Use voice access to controll display magnifier
      and chek if switch button is shown.
Change-Id: I729ea6fbf921ba6bd735c62198a2b8caee6ec4d7
2021-04-01 13:03:48 +08:00
Jacky Kao
b599784e05 Merge "Logs magnification feature behavior. (2/2)." into sc-dev 2021-03-29 23:56:22 +00:00
ryanlwlin
1e80c6346e Revise string and change asset
Change icon to a11y asset and change string based on
String doc

Bug: 174336318
Test: 1. adb shell settings put secure \
      accessibility_show_window_magnification_prompt 1
      2. use full-screen magnification to see if it works well
      atest WindowMagnificationPromptControllerTest
Change-Id: I110ca30b95e268bcad5e9109d7715e854118f0db
2021-03-24 20:11:26 +08:00
Jacky Kao
f8fb7b24bc Logs magnification feature behavior. (2/2).
Uses the atom MagnificationModeWithImeOnReported in westworld to log
the activated mode when the IME window is shown on the screen.

Adding a new callback API in the MagnificationCallback to monitor the
IME window visibility changes. The A11y framework registers the
callback when the magnification is enabled. It logs the related
data when it receives the IME window visibility changes through
this callback and the magnification is in the activation.

Bug: 154021596
Test: a11y CTS & unit tests
Test: make statsd_testdrive && ./out/host/linux-x86/bin/statsd_testdrive 346
Merged-In: I49b02e00d5a1131b388eeb923440f59a2b4f81a6
Change-Id: I49b02e00d5a1131b388eeb923440f59a2b4f81a6
(cherry picked from commit 1aa113d8dd)
2021-03-24 05:10:57 +00:00
Minche Li
6c0af1a19e Merge changes from topic "magnification_btn" into sc-dev
* changes:
  Updates magnification button after magnification mode transition is done
  Also regarded as magnification activated when it is forced to show magnification bounds
2021-03-18 22:52:06 +00:00
lucychang
b98a658c27 Prompt notifications for non-accessibility services
Prompts a notification for the non-accessibility category service after
24 hours enabled to alert users the service has powerful permissions to
view and control the device. And the notification won't be resend to
the same service by saving the dismiss record to Settings.

Bug: 176965357
Test: atest AccessibilitySecurityPolicyTest
      atest PolicyWarningUIControllerTest
      and manually test

Change-Id: Id5daf7b14dc88cf3f71a53f46fa9a8f1dee91822
2021-03-18 03:01:10 +00:00
mincheli
97237d8142 Updates magnification button after magnification mode transition is done
Magnification button may be incorrect after magnification mode
transition is done. So just update magnification button with the target
mode after magnification mode transition is done.
The new UI behavior would keep magnification button showing when
the magnification mode transition is happened.

Bug: 181000039
Test: atest MagnificationControllerTest
Change-Id: Icbe34aead2e63c8a65c3238bdc62ebb30974ac6a
2021-03-18 10:28:08 +08:00
mincheli
eb467b991d Also regarded as magnification activated when it is forced to show magnification bounds
When fullscreen magnification is showing initially, it would force to
show magnification bounds but not not be magnifying first.
Then a user has to perform one tap to make the magnifier scaling.
For this case, we also think that it is magnification activated when the
magnification bounds are showing but not magnifying.

Bug: 181597348
Test: atest MagnificationControllerTest;atest FullScreenMagnificationControllerTest
Change-Id: I90b34cc25aca636d4ac84f6627d1a674faecbb1c
2021-03-18 10:25:25 +08:00
Jacky Kao
d8e01d08aa Logs magnification feature behavior. (1/2)
Uses the atom MagnificationUsageReported in westworld to log the
activated mode and its duration of the magnification.

The timing of logging the MagnificationUsageReported is
when the magnification feature is deactivated.

Bug: 154021596
Test: a11y CTS & unit tests
Test: make statsd_testdrive && ./out/host/linux-x86/bin/statsd_testdrive 345
Merged-In: I708e9731da23658774e462968a6b9df648b0ed19
Change-Id: I708e9731da23658774e462968a6b9df648b0ed19
(cherry picked from commit e19cdef475)
2021-03-15 06:32:57 +00:00
Sally Yuen
373028a524 Revert "Service requests can interrupt node prefetching"
This reverts commit 327de4b45c.

Reason for revert: b/182016372

Change-Id: I67ec01fc2f47b05a2dc11e7951c11a708fdbeebf
2021-03-08 19:49:37 +00:00