Commit Graph

344 Commits

Author SHA1 Message Date
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
Bernardo Rufino
90bb3709dc 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
Test: TH passes
Change-Id: I11a27b9bdab7959ee86e90aa1e1cbebd7aaf883c
2021-12-15 18:21:38 +00:00
sallyyuen
70243103c8 Add and implement cache API
Does not yet include the prefetching API, which will be introduced later.

- Have a CacheController as the source of cache manipulation
- Notify system to update user relevant types

Bug: 192489177
Test: Build, added cts tests, atest CacheControllerTest
Change-Id: I150a01192dcf764ffcfe9848b499034a48aded08
2021-12-14 12:31:53 -08:00
Minche Li
7ce8fa3980 Merge "The legacy magnification controller APIs controls only full-screen magnification" 2021-12-14 02:20:08 +00:00
yingleiw
b5f3d34def Add new setInputMethodEnabled API
Make accessibility services able to enable/disable a specified
IME in the same package for the current user.

Bug: 195476910
Fix: 191386474

Test: atest AccessibilitySoftKeyboardTest. Also tested with
modified talkback (use the swith input method API for enable
ime), and self created empty a11y service with an empty ime.
Mananged device and profile which set limit on user 0 are also
tested.

Change-Id: I4187468076705ac597d680f2f5dc32d7b166da1f
2021-12-10 15:20:44 -08:00
mincheli
7712805752 The legacy magnification controller APIs controls only full-screen magnification
See go/b200769372 - the legacy public methods
The legacy magnification controller methods,
  setScale(), setCenter(),
  getScale(), getCenterX(), getCenterY(),
  getMagnificationRegion(),
  reset(),
will keep the behavior before that control
only full-screen magnification.

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

This change
1. Updates the doc of the legcacy APIs.
2. The legacy APIs controls only fullscreen magnification

TODO: Add new public methods, getCurrentMagnificationRegion(),
 resetCurrentMagnification() for the current controlling magnifier

Bug: 210069654
Test: atest MagnificationProcessorTest,
    atest AbstractAccessibilityServiceConnectionTest,
    atest AccessibilityMagnificationTest,
Change-Id: Ia157971d2c9716df7aa14024525ee0adfdc0d46f
2021-12-10 04:26:27 +00:00
Ryan Lin
2f1c24fff4 Merge "Document the split-screen action" into sc-v2-dev am: 93124d69fc am: 75309bcd38
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16375117

Change-Id: If9f3418e702c8502f19d2ed7476ab1662e7f2a02
2021-12-10 01:14:41 +00:00
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
mincheli
7c91f43c3a Adds public APIs for AccessibilityService to control magnifier by setting MagnificationConfig
See go/b200769372
AccessibilityService adds new magnificationController APIs,
setMagnificationConfig and getMagnificationConfig, to control
magnification on demand.
The service can set the magnification mode, scale, center postion
of the magnifier on the display to control magnification.
And the service controls the least recently activated magnifier
on the display if the config mode is not specified.

Bug: 199732498
Test: atest MagnificationProcessorTest,
    atest  AbstractAccessibilityServiceConnectionTest,
    atest AccessibilityMagnificationTest,
Change-Id: I51be2bbf96411c6c54c9da30873556d09533bb65
2021-12-06 18:24:32 +08:00
mincheli
3ebc5789af Fixes the API format of MagnificationConfig
1. Add a range to the parameter in setScale(), setCenterX(), setCenterY()
2. The IntDef annotation name of MagnificationMode should not be
capitalized. The constants names should also start with the same prefix
set in the IntDef annotation.
3. Adds @hide for the IntDef annotation.
4. The related constants uses consistent prefix

Bug: 208422801
Test: none
Change-Id: Ibd997c3a13385d8884e208564092d829833ae637
2021-12-02 09:09:13 +00:00
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