Commit Graph

384 Commits

Author SHA1 Message Date
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
Bernardo Rufino
1a5cb387d6 Revert "Revert "Migrate unsafe parcel APIs in framework-minus-apex""
This reverts commit 331be9a643.

Reintroducing ag/16366278 since it seems unrelated to b/214053959 (more details on b/214053959#comment55).

Original commit message:

Migrate unsafe parcel APIs in framework-minus-apex

Migrate the following unsafe parcel APIs in framework-minus-apex:
* Parcel.readSerializable()
* Parcel.readArrayList()
* Parcel.readList()
* Parcel.readParcelable()
* Parcel.readParcelableList()
* Parcel.readSparseArray()

This CL was generated by applying lint fixes that infer the expected
type from the caller code and provide that as the type parameter
(ag/16365240).

A few observations:
* In some classes we couldn't migrate because the class also belonged to
another build module whose min SDK wasn't current (as is the case for
framework-minus-apex), hence I suppressed the lint check
(since I'll eventually submit the lint check to the tree).
* In some cases, I needed to do the cast in
https://stackoverflow.com/a/1080525/5765705 to make the compiler happy
since there isn't another way of providing a class of type
Class<MyClassWithGenerics<T>>.
* In the readSerializable() case, the new API also requires the class
loader, that was inferred to by InferredClass.class.getClassLoader().
* Note that automatic formatting and import rely on running hooked up
to the IDE, which wasn't the case here.

Bug: 195622897
Change-Id: I272432e6e082a973f7a50492ec35d79c2b577c93
Test: TH passes
2022-01-19 11:13:18 +00:00
Ashwini Oruganti
776b439703 Merge "Revert "Migrate unsafe parcel APIs in framework-minus-apex"" 2022-01-12 23:07:08 +00:00
Bernardo Rufino
331be9a643 Revert "Migrate unsafe parcel APIs in framework-minus-apex"
This reverts commit 90bb3709dc.

Reason for revert: b/214053959

Change-Id: Ic271bab1d3eaf677a5989dda9deb944ee2ad6850
2022-01-12 17:44:44 +00:00
Bernardo Rufino
c6ebb14b7d Merge "Migrate unsafer parcel APIs [2]" 2022-01-11 19:20:36 +00:00
Minche Li
4d4314dd81 Merge "Adds new magnificationController API: getCurrentMagnificationRegion, resetCurrentMagnification" 2022-01-07 01:05:32 +00:00
Minche Li
6c257f32e1 Merge "Notifies window magnifcation changes for AccessibilityService (1/n)" 2022-01-07 01:00:27 +00:00
Bernardo Rufino
74ee11c3f4 Migrate unsafer parcel APIs [2]
Manually migrate the few cases of:
* readArray()
* readParcelableArray()

To the new parcel APIs that take the expected type as the last
parameter. This enhances security because it prevents unexpected types
*before* running unparcelling code. More details at go/safer-parcel.

Owners, please check that the type of the objects expected is always a
subtype of the type provided as the 3rd parameter. This is usually easy
to verify due to casts that happen shortly after.

These changes often allowed further transformations but I decided to
avoid them to keep this change small and targeted.

This was manual since it's tricky to get lint to infer the type in
those cases and it was only a few.

Bug: 195622897
Test: TH passes
Change-Id: I262ed7cd6d3bc15b32e9296e88a8a67fdb59e880
2022-01-06 18:35:31 +00:00
Sally Yuen
f685942962 Merge "Add and implement cache API" 2022-01-05 20:11:36 +00:00
mincheli
91443b10f7 Adds new magnificationController API: getCurrentMagnificationRegion, resetCurrentMagnification
See go/b200769372 - the legacy public methods
The legacy magnification controller methods of a11y service,
  getMagnificationRegion(),
  reset(),
will keep the behavior before that control
only full-screen magnification.

To make the a11y service able to control the actiavted
magnifier on the display, the service should use the
new public APIs,
 1. getCurrentMagnificationRegion(),
 2. resetCurrentMagnification(),
instead of the legacy APIs.

Bug: 210069654
Test: atest AccessibilityMagnificationTest,
   atest MagnificationProcessorTest,
   atest AbstractAccessibilityServiceConnectionTest,
Change-Id: I76bfee43cbb76a9aeec33574a8db18430903e08c
2022-01-03 17:14:40 +08:00
mincheli
be41ea676c Notifies window magnifcation changes for AccessibilityService (1/n)
See Design doc:  go/b200769372
To make the behavior consistent on the new platform,
The legcay callback,
  onMagnificationChanged(MagnificationController controller,
  Region region, float scale, float centerX, float centerY)
keep notifying only full-screen magnification change as
before.

To support listening to the magnification changes of all
magnification modes, the service should overide
The new callback proposed in T,
  onMagnificationChanged(MagnificationController controller,
  Region region, MagnificationConfig config).

TODO: Notify magnifcation change when window magnifier turns off

Bug: 203013925
Test: atest AccessibilityMagnificationTest,
    atest MagnificationControllerTest,
    atest WindowMagnificationManagerTest,
    atest WindowMagnificationControllerTest,
    atest FullScreenMagnificationControllerTest,

Change-Id: Ia73195a71f55bb26ef3f2eafce0dc73d8a65583b
2022-01-03 10:31:54 +08:00
Yinglei Wang
ebbe319446 Merge "Add new setInputMethodEnabled API" 2021-12-15 19:23:34 +00:00