Commit Graph

395 Commits

Author SHA1 Message Date
sallyyuen
a4f4a831d6 [EXO] Create a service connection for proxies
A proxy will give a privileged app access to a11y data typically available to AccessibilityServices. (Refer to the design doc linked in the comments for more information.)

A proxy will easily be able to set modify a list of service infos
depending on what a11y services/features are running on the client
device.

Introduce the system connection for a proxy:

- The service connection needs to maintain a single info that
represents this proxy-supplied list, so merge list values.

- Populate properties for each listed info that are default populated
for services installed on the device. This will prevent exceptions if
an app accesses these properties.

- Make setAccessibilityTool a SystemAPI, so a proxy can set this if it
needs to, since it cannot set this before runtime.

Test: builds, atest ProxyAccessibilityServiceConnectionTest
Bug: 241429275
Change-Id: Id99e2fa08be567738751d7a9a84f0014279924a1
2022-10-17 20:16:28 +00:00
Sally Yuen
260a7285ba Merge "[EXO] Add aidl methods to set installed and enabled a11y services" 2022-10-07 20:36:48 +00:00
Daniel Norman
eeb387753a Tests that isAccessibilityTool is not dynamically updatable.
Bug: 248335757
Test: atest AbstractAccessibilityServiceConnectionTest
Change-Id: I99b97fd19c6a76a5873193a1aaf76a695466472b
2022-10-05 12:55:19 -07:00
sallyyuen
4496d8d5c3 [EXO] Add aidl methods to set installed and enabled a11y services
This will simplify the management of active a11y services when dealing
with proxies.

Test: builds
Bug: 241429275

Change-Id: I6785b9bea218946e95941453d637198bb0230a78
2022-10-05 12:28:36 -07:00
Daniel Norman
bc5d5e8088 Merge "Removes isAccessibilityTool from dynamically-configurable properties." 2022-09-30 16:39:29 +00:00
Daniel Norman
fda797c958 Adds more OWNERS to a11y FW dirs. am: b6dc971384 am: 4292755d27 am: 2325eb5313 am: e9dd122ce4 am: ce09a229dd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2234907

Change-Id: I2c582e4fe76438d51e99a0b2b1f22319badce3f2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 21:48:59 +00:00
Daniel Norman
ce09a229dd Adds more OWNERS to a11y FW dirs. am: b6dc971384 am: 4292755d27 am: 2325eb5313 am: e9dd122ce4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2234907

Change-Id: I005464c49af46492ee791c3068ec1e21cdaea18f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 21:18:45 +00:00
Daniel Norman
ae6b03f8e1 Removes isAccessibilityTool from dynamically-configurable properties.
AccessibilityServiceInfo#setAccessibilityTool() is already a hidden
method but reflection techniques may be able to bypass this. So, we
shouldn't allow this property to be modified at runtime by an
a11yservice after the service info is parsed from the XML.

This field was originally added to configurable properties to allow
modification during CTS tests.

This change replaces dynamic configuration with a flag in UiAutomation
that is used when connecting a new UiAutomation instance. CTS tests
which wish to change isAccessibilityTool mid-test can reconnect their
UiAutomation with a new flag value. The flag is @TestApi since it is
unlikely non-CTS developers will want it for their own tests.

Fix: 248335757
Test: atest AccessibilityEndToEndTest
Change-Id: I6ca3d9e6fb94207897cdfc94925bbd4d54348a29
2022-09-29 20:22:28 +00:00
Daniel Norman
b6dc971384 Adds more OWNERS to a11y FW dirs.
Bug: n/a
Test: n/a
Change-Id: I1331e89caf4942d2118e644ed3f9710daa66be95
2022-09-28 09:15:49 -07:00
TreeHugger Robot
000ee8d85f Merge "Fix a background NPE in A11yIME" into tm-qpr-dev am: 8a58b2161f am: c1bf6e66ac
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19915824

Change-Id: Ia88775b2fd61b636b2014e290f34bd0240280646
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-13 01:21:08 +00:00
Yohei Yukawa
89025ff06e Fix a background NPE in A11yIME
This is a follow up CL to my previous CL [1], which aimed to clean up
A11yIME without changing any semantics.  One thing I overlooked is that

  android.accessibilityservice.InputMethod#mStartedInputConnection

can be set to null at any time (on the UI thread) and

  InputMethod.SessionImpl#invalidateInput()

needs to gracefully do early-exit as needed.

 [1]: I5ff2e804cbcf90828370a0612ff54111130bdff4
      c60176c1f3

Fix: 245973012
Test: atest CtsInputMethodTestCases:AccessibilityInputMethodTest
Test: atest CtsAccessibilityServiceTestCases:AccessibilityInputConnectionTest
Test: atest CtsAccessibilityServiceTestCases:AccessibilityImeTest
Change-Id: I3bacff7772d20660bfdbeff724a0d19b5f0e6fe4
2022-09-10 08:57:58 +09:00
Daniel Norman
60bb7c9bca Revert "Revert "Limit off-label accessibility access using a new..."
Revert submission 19637776-revert-19246592-accessibility-tool-only-VJOPAMQMLT

Reason for revert: Relanding with fix
Reverted Changes:
I701b811fd:Revert "Limit off-label accessibility access using...
I85c58736b:Revert "CTS tests for the accessibilityDataPrivate...

Change-Id: Idfb12294c4ba75dfba8abd90985dea548d29042a
2022-08-23 20:40:08 +00:00
Daniel Norman
1e924c4709 Merge "Revert "Limit off-label accessibility access using a new property."" 2022-08-16 23:17:30 +00:00
Daniel Norman
ff3c059c29 Revert "Limit off-label accessibility access using a new property."
Revert submission 19246592-accessibility-tool-only

Reason for revert: Jank regression b/242267091
Reverted Changes:
I0685e6dd4:CTS tests for the accessibilityDataPrivate propert...
I1c02af88c:Limit off-label accessibility access using a new p...

Change-Id: I701b811fd4fb2634872a759134356736a7e8b7dd
2022-08-16 16:13:28 +00:00
Daniel Norman
f003dd10b2 Merge "Limit off-label accessibility access using a new property." 2022-08-11 17:04:57 +00:00
Sally Yuen
75109188d3 Merge "Convert AccessibilityServiceClientImpl to use Executor" 2022-08-08 15:13:05 +00:00
Daniel Norman
54eee1bc76 Limit off-label accessibility access using a new property.
Bug: 238390816
Test: atest AccessibilityEndToEndTest
Change-Id: I1c02af88c4b23aa61a2444f4b83c9f5972b31e17
2022-08-02 11:01:20 -07:00
Sally
d4bfcc9c54 Convert AccessibilityServiceClientImpl to use Executor
Callback will continue to happen on the main thread, which is
wrapped in an executor. Remove the AccessibilityEvent recycling as well.
EXO support will leverage this.

Bug: 240979189
Test: Manual with TalkBack, atest CtsAccessibilityServiceTestCases
atest CtsAccessibilityTestCases
atest CtsUiAutomationTestCases
atest FrameworksServicesTests:com.android.server.accessibility
atest FrameworksCoreTests:com.android.internal.accessibility
atest FrameworksCoreTests:android.view.accessibility

Change-Id: I12c7677d85ad81a3a5def52039642cb167c17ca8
2022-08-01 21:21:58 +00:00
Sally Yuen
0a0cb46b09 Merge "Remove references to deprecated web enhancement APIs" 2022-07-11 16:44:00 +00:00
sallyyuen
bfa7982cf3 Remove references to deprecated web enhancement APIs
Test: builds and run CTS suite
Bug: 237705788
Change-Id: I0dba15bb82af12e1ad9cc44dd07017148231ad9e
2022-07-01 09:01:53 -07:00
Hani Kazmi
4f221e5c51 Migrate Bundle/Intent APIs to new, type checked, variants
Part of go/safer-parcel. Follow up to ag/16639043. Migrates the following unsafe APIs:

* Parcel.readArray()
* Parcel.readParcelableArray()
* Bundle.getSerializable()
* Bundle.getParcelable()
* Bundle.getParcelableArrayList()
* Bundle.getParcelableArray()
* Bundle.getSparseParcelableArray()
* Intent.getSerializableExtra()
* Intent.getParcelableExtra()
* Intent.getParcelableArrayExtra()
* Intent.getParcelableArrayListExtra

Bug: 227458983
Test: m and presubmit pass
Change-Id: I72f206cb18eb5c669a7fff07a6845bed1c433fdb
2022-07-01 10:53:53 +00:00
Yohei Yukawa
538f36937d Merge "Let A11yIME use its own IPC definitions" into tm-dev 2022-04-20 17:42:55 +00:00
Yohei Yukawa
c60176c1f3 Let A11yIME use its own IPC definitions
This is a follow up CL to our previuos CL [1], which enabled
AccessibilityService to use a subset of InputConnection APIs.

In that CL we have reused existing AIDL interfaces that were designed
and maintained for IMEs for simplicity, where a non trivial amount of
unnecessary IPC endpoints were included.

From the security and maintainability viewpoints, however, exposing
unnecessary IPC endpoints is discouraged in general.  To address such
concerns this CL introduces a set of dedicated IPC definitions for
A11yIME so that we do not need to reuse IPCs for IMEs.

This CL also stops passing InputBinding object to A11yIME process as
it contains IInputContext Binder Proxy, which can still be used to
directly invoke fallback InputConnection.  This is doable now because
A11yIME no longer relies on fallback InputConnection [2].

This CL is should not have any observable changes in the semantics.
End-to-end CTS tests guarantee that everything is still working as
intended now and in the future.

 [1]: Ia651a811093a939d00c081be1961e24ed3ad0356
      fb17e5ae7a
 [2]: I2af3cd50444d8ddf25aa0f6479238156914e6fff
      dc635efb68

Fix: 215633021
Fix: 215636776
Test: atest CtsInputMethodTestCases:AccessibilityInputMethodTest
Test: atest CtsAccessibilityServiceTestCases:AccessibilityInputConnectionTest
Test: atest CtsAccessibilityServiceTestCases:AccessibilityImeTest
Change-Id: I5ff2e804cbcf90828370a0612ff54111130bdff4
2022-04-18 08:59:44 -07:00
TreeHugger Robot
8e157c498c Merge "Let A11yIME use its own method name for systrace" into tm-dev 2022-04-15 17:46:58 +00:00
Yohei Yukawa
df7d192d9b Merge "Do not expose fallback InputConnection to A11y IME" into tm-dev 2022-04-15 03:10:42 +00:00
Yohei Yukawa
4bde5d3403 Let A11yIME use its own method name for systrace
This is a follow up CL to our previous CL [1], which copied many
things from

  android.inputmethodservice.InputMethodService

to

  android.accessibilityservice.InputMethod.

As a result currently those two classes share the same systrace method
names as follows.

 * IMS.startInput
 * IMS.restartInput

With this CL, those systrace method names will be renamed to

 * AccessibilityService.startInput
 * AccessibilityService.restartInput

so that readers can understand which implementation is used without
having to check its process name.

There should be no user-observable behavior change in this CL.

 [1]: Ia651a811093a939d00c081be1961e24ed3ad0356
      fb17e5ae7a

Fix: 229118866
Test: Manually verified as follows
 1. Build aosp_coral-userdebug and flash it.
 2. make -j EditTextVariations
 3. adb install -r $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/arm64/EditTextVariations.apk
 4. make -j SampleInputMethodAccessibilityService
 5. adb install -r $OUT/system/app/SampleInputMethodAccessibilityService/SampleInputMethodAccessibilityService.apk
 6. adb shell settings put secure enabled_accessibility_services com.example.android.sampleinputmethodaccessibilityservice/com.example.android.sampleinputmethodaccessibilityservice.SampleInputMethodAccessibilityService
 7. external/perfetto/tools/record_android_trace wm
 8. adb shell am start -n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
 9. Tap an input field '<input type="text" />' in the WevView section.
10. Tap an input field '<input type="email" />' in the WevView section.
11. Hit Ctrl-C.
12. Verify trace event names from the sample A11yIME.

Change-Id: If89cfaec108a15aa168cfa32c689ca832b410324
2022-04-14 12:31:38 -07:00
Yohei Yukawa
dc635efb68 Do not expose fallback InputConnection to A11y IME
Unlike InputMethodService, A11y IME should never receive fallback
InputConnection, which is subject to be deprecated or demoted in the
future.

Fix: 228848796
Test: atest CtsInputMethodTestCases:AccessibilityInputMethodTest
Change-Id: I2af3cd50444d8ddf25aa0f6479238156914e6fff
2022-04-13 16:27:18 -07:00
Yohei Yukawa
ca605d21ef Remove TODO(b/217788708)
With my previous CL [1],

 android.accessibilityservice.InputMethod#invalidateInputInternal

should now be executed during CTS.

Fix: 217788708
Test: atest CtsInputMethodTestCases:AccessibilityInputMethodTest
Change-Id: I74b06d4211d771f769f3ced6b8dedd37007257a0
2022-04-13 10:55:10 -07:00
Ameer Armaly
7cb26674cc TouchExplorer: allow service to initiate touch exploration and there are no pointers on the screen
We need to be able to initiate touch exploration even if there are no pointers on the screen in order to reliably cover the case where a user just taps the screen.
The user expects to hear if they have tapped on anything.
Bug: 223673301
Test: manual. Tap on the screen and confirm that talkback reads the item in that position.

Change-Id: Id96fa8bd7f000ea153f45024e06915a43ca80826
2022-04-08 13:43:31 -07:00
mincheli
76ee08efb5 Updates the doc for FEATURE_WINDOW_MAGNIFICATION
If this feature is not supported,
1. Settings should hide window magnification settings.
2. Magnification mode settings should fallback to.
  full-screen settings.

Bug: 225086379
Test: none
Change-Id: I3248034d25eb88136bda1874092319d4702be455
2022-03-29 02:15:20 +08:00
Yinglei Wang
18355017e8 Merge "Add javadoc for a11y InputMethod constructor" into tm-dev 2022-03-19 04:12:51 +00:00
menghanli
8610a27372 Allow Accessibility features don't need summary, intro, and description
Bug: 224689419
Test: atest AccessibilityShortcutInfoTest
Change-Id: Ia2aa081bf8a16ebbb10762af80c125bcb2d52950
2022-03-16 05:55:51 +08:00
yingleiw
97cc3969ae Add javadoc for a11y InputMethod constructor
Fix: 223672843
Test: it builds fine.
Change-Id: Idae339dae3b52bd2da85b32b247fbf8a3393188b
2022-03-15 13:25:16 -07:00
Yinglei Wang
cf8bd65857 Merge "Make a11y InputMethod constructor public" into tm-dev 2022-03-09 23:38:53 +00:00
yingleiw
4e4f5a1386 Make a11y InputMethod constructor public
Per API review feedback.

Test: it builds fine.
Fix: 219740392
Change-Id: Ibad4ead04f4420d8cd80969a9266a419c6ea93e8
(cherry picked from commit 8c4ce40ec9)
2022-03-09 03:49:19 +00:00
yingleiw
89da511a1f handle dynamically set AccessibilityServiceInfo.FLAG_INPUT_METHOD_EDITOR
When the flag is set dynmatically, we need to create the InputMethod()
instance and request to bind ime. If the flag is unset, we clear the
InputMethod() instance and unbind ime.

Fix: 218193835
Test: Tested with talkback. When the flag is not set, we can't use
ime. When the flag is set, we can use ime again (dynamically set
flags).
Change-Id: Ied48d452108a593e8e4ee5c67c3208acbc87335e

Change-Id: I2a85c64b089983807cb7627de9b8512e8f716426
(cherry picked from commit 14e78228a1)
2022-03-09 03:39:27 +00:00
menghanli
92a755792f Refine A11y Tile Service javadoc
- Explicitly say that this is only the class name,to be looked up in the a11y services package, and not a full component name
- Fix typo of Javadoc refers to class names (plurar)
- Rename to getTileServiceName()

Bug: 219873375
Test: atest AccessibilityShortcutInfoTest
Change-Id: Ic7231f6e0b34edabea8b4086102e1d7f6ebe0eae
2022-02-24 09:49:34 +08:00
menghanli
f9184d6ab8 Add new intro attributes for accessibility
- Accessibilty service: AccessibilityService_intro
- Accesibility shortcut: AccessibilityShortcutTarget_intro

Bug: 218407448
Test: atest AccessibilityShortcutInfoTest
Change-Id: Ia9977a74e4f60d6ee36e6028ec24d9271656ce40
2022-02-11 20:48:28 +08:00
Sally Yuen
6bb459d3de Merge "Expose prefetching strategies to services" 2022-02-10 17:09:37 +00:00
Sally
026c7ac01f Expose prefetching strategies to services
Make the prefetching strategies public so a service can choose
which strategy works best in a particular spot. This should reduce
unnecessary/redundant prefetching.

For example, the FW currently only allows hybrid descendant
prefetching, but a service may want to do depth-first or
breadth-first traversal of the view hierarchy.

Currently, if there is another user interactive request, we
immediately return prefetched nodes. Also allow services to prevent
this interruption and force prefetching to a max of 50 nodes.

Services could potentially request a certain number of nodes, but
since asynchronous prefetching immediately returns the requested
node, the  service can force prefetching of 50 nodes if desired,
and only exposing strategies touches less code, I prefer limiting this.

Also use a LinkedHashMap so ordering is kept when prefetching
descendants.

Test: Manual, talkback builds
atest AccessibilityCacheTest,
AccessibilityInteractionControllerNodeRequestsTest
Bug: 192489177

Change-Id: I3d8358411ece5d2e1380282824cd3cf1835658ac
2022-02-09 17:55:50 +00:00
Yinglei Wang
e7e3dd676c Merge changes from topic "ime"
* changes:
  Add accessibilitySessions to InputBindResult
  Add FLAG_INPUT_METHOD_EDITOR to a11y
  Allow a11y services to enter text via the path IMEs use
2022-02-09 15:42:22 +00:00
yingleiw
8cb76d59ae Add FLAG_INPUT_METHOD_EDITOR to a11y
An accessibility service needs to set FLAG_INPUT_METHOD_EDITOR
accessibilityFlags to use ime apis. Capability is not added
per Phil's suggestion.

Bug: 187453053

Test: CTS test added.
Change-Id: I78703c48e343ba09c2a0bf61c3447eea7337cb49
2022-02-08 22:14:44 -08:00
yingleiw
fb17e5ae7a Allow a11y services to enter text via the path IMEs use
InputMethodService is the primary and a11y is the secondary.
InputMethodService is not
affected by a11y status. When the session from input method is
established, app can start input (pass input context to input method).
When an a11y session comes back, it will be passed to the app. When
InputMethodManagerService binds to/start input with
InputMethodService, it does the same to a11y services which
requested IME functionalities.

It is possible that input method can edit text before ally sessios are
established. So the EditorInfo passed to a11y could be stale.
So when an a11y session is passed to client, client will send
a notification (input method doesn't have this extra notification) for
the current selection. I think since the time for a11y session establish
shouldn't be long, and we get the current state later, it should be fine
for a11y services.

When input method is disconnected from app (client) (even for input
method switching), we cleared a11y and sessions too. When
input method request sessions, we must rerequest sessions for a11y. This
is mainly because when we unbindCurrentClientLocked(SWITCH_IME), we set
active to false for the current client. Suppose we don't want to
change the current structure of input method, an inactive client
probably should clear accessibility sessions too.

When we switch to a client which already has a session with input
method, there might be some a11y sessions with this client, and
some a11y services might be disabled or enabled while the client was
switched out. We pass unchanged a11y
sessions to client, and request sessions for newly enabled a11y services.
When an a11y service is disabled, it removes its session
from all clients in InputMethodManagerService.

Test: type word through modified "switchToInputMethod". Tested session
notification through logs. Tested client switching, input method
switching, a11y service enabled/disable, multiple a11y services,
a11y service enabled before device reboot.
Also tested work profile.

Bug: 187453053

Change-Id: Ia651a811093a939d00c081be1961e24ed3ad0356
2022-02-08 22:14:19 -08:00
menghanli
e383db25fc Add new tileService attributes for accessibility
- Accessibilty service: AccessibilityService_tileService
- Accesibility shortcut: AccessibilityShortcutTarget_tileService

Bug: 216614718
Test: atest AccessibilityShortcutInfoTest
Change-Id: I9394b689f0fea4ed6bf7399e6a0713200ca5a364
2022-02-08 16:58:23 +08:00
Ameer Armaly
c52cb42e51 Add API for services to turn off window animations.
Bug: 195757359
Test: atest AccessibilityWindowReportingTest
Change-Id: I5fc1c90e87de17fb770f6a3371fc341985017a61
2022-02-02 22:14:28 +00:00
Kaiqiang Wang
1a1ac2d983 Merge "Add DPAD keys into Accessibility GlobalAction and SystemAction." 2022-02-02 11:43:50 +00:00
Kaiqiang Wang
27f5dbe8b4 Add DPAD keys into Accessibility GlobalAction and SystemAction.
Also add the missing headset hook into SystemAction.

Test: local test.
Bug: 214164075
Change-Id: I8c8ad18990111737722274ca8410cc538b208167
2022-02-01 20:12:10 +00:00
Ameer Armaly
7429d9b386 TouchInteractionController: allow state transitions from STATE_DRAG.
This is necessary to make the drag -> delegate execution path work.
Bug: 159651900
Test: atest TouchInteractionControllerTest

Change-Id: Idfb5d5ea8290353a7f4dac9742826a38fdd17b04
2022-01-31 13:05:20 -08:00
mincheli
cecea8fe82 Deprecates the legcay magnifcation APIs of AccessibilityService
Bug: 215555911
Test: manual test
Change-Id: I2d64cee6d23a92340c91aa993a1f9953d7c4ba99
2022-01-25 01:52:36 +00:00
Ameer Armaly
0e96bcf1d5 TouchInteractionController: cache motion events when transitioning between states.
When transitioning between states, TouchInteractionController will queue motion events  and not deliver them until the state transition has been confirmed.
This avoids the case where a service will request a state transition twice because it processes a motion event after sending the transition request but before the transition completes.
Bug: 159651900
Test: atest TouchInteractionControllerTest

Change-Id: I2437b635a8053de28212d93e67c7144134c1dc08
2022-01-21 00:37:51 +00:00