Commit Graph

19612 Commits

Author SHA1 Message Date
TreeHugger Robot
5a97c93a7a Merge "Add @hide IMM#setRequestCursorUpdateDisplayIdCheck()" 2022-11-02 17:29:41 +00:00
Yohei Yukawa
d4b0e8a107 Add @hide IMM#setRequestCursorUpdateDisplayIdCheck()
This is a follow up CL to our previous CL [1], which re-introduced

  InputMethodManager#reportVirtualDisplayGeometry()

for some special form factors.

For apps that only aim to bypass display ID mismatch check in

  RemoteInputConnectionImpl#requestCursorUpdatesInternal(),

this CL gives a much simpler and easier-to-maintain @hide method

  InputMethodManager#setRequestCursorUpdateDisplayIdCheck().

  [1]: I35b491da5a340844e17542d7a6198f8152bbeda3
       708c957fa3

Bug: 224424149
Bug: 256926300
Test: presubmit
Change-Id: I9e1f62e3d5d2a385dce8a9633b5b73f8e7f0ccef
2022-11-02 10:26:49 -07:00
Ziqi Chen
6745a77c6c Merge "Add a new API CursorAnchorInfo#getTextAppearanceInfo()." 2022-11-02 08:18:02 +00:00
Hieu Dang
4826cefb6c Merge "Revert "Remove an unused param from IMMS#showInputMethodPickerFromClient()"" 2022-11-02 07:20:24 +00:00
Hieu Dang
2fb98cdab1 Revert "Remove an unused param from IMMS#showInputMethodPickerFromClient()"
This reverts commit 3efbbb5e49.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=aosp_bramble-userdebug&lkgb=9245415&lkbb=9246274&fkbb=9245423, bug https://buganizer.corp.google.com/issues/256952514

Change-Id: I343828ad83d50436211004753f1b9ba1b13b60ca
Bug: 256952514
2022-11-02 07:19:39 +00:00
czq
50f792e09d Add a new API CursorAnchorInfo#getTextAppearanceInfo().
Add a new group of information related to text appearance in
CursorAnchorInfo, which is extracted from TextView.

Bug: 231894524

Test: atest android.view.inputmethod.cts.CursorAnchorInfoTest#testBuilder
atest android.view.inputmethod.cts.CursorAnchorInfoTest#testEquality
atest android.view.inputmethod.cts.InputMethodServiceTest#testOnUpdateCursorAnchorInfo

Change-Id: I8b96f055506b0a426dcfc6334db867dda7073868
2022-11-02 11:40:08 +08:00
Yohei Yukawa
e7058e49a7 Merge "Remove an unused param from IMMS#showInputMethodPickerFromClient()" 2022-11-02 01:52:35 +00:00
Yohei Yukawa
e21c66fb60 Merge "Add missing @RequiresPermission to IMM" 2022-11-02 00:08:39 +00:00
Yohei Yukawa
515e3ce276 Merge "Clarify required permission in IMM#getInputMethodListAsUser()" 2022-11-02 00:05:48 +00:00
TreeHugger Robot
f65ce2308b Merge "Add threading comments for the delegate initiation callback" 2022-11-01 23:52:56 +00:00
Taran Singh
79dbdbac77 Merge "Make text optional for InsertGesture" 2022-11-01 22:44:55 +00:00
TYM Tsai
98e013f664 Merge "Reset Autofill dialog if the content is changed" 2022-11-01 22:17:38 +00:00
TYM Tsai
6106c85a44 Merge "Avoid to hold a strong reference to Context object" 2022-11-01 22:16:44 +00:00
Justin Ghan
c4409a13be Add threading comments for the delegate initiation callback
Bug: 228100684
Bug: 256870186
Test: N/A
Change-Id: I6db21adad640d27a3efd020aa9f829276993bbe7
2022-11-01 14:18:24 -07:00
Yohei Yukawa
3efbbb5e49 Remove an unused param from IMMS#showInputMethodPickerFromClient()
This is a follow up CL to our previous CL [1], which introduced

  InputMethodManagerService#showInputMethodPickerFromClient(
          @NonNull IInputMethodClient client,
          int auxiliarySubtypeMode, int displayId);

Somehow the "client" has never been used, which is fine because the
actual caller verification is done by requiring WRITE_SECURE_SETTINGS
permission.

Let's remove such an unused parameter for simplicity.

There must be no observable behavior change.

 [1]: Ic7d7c5a7ad8005a3fbd9d1c1b73e3c5a39a07001
      0b05f9e49d

Bug: 234882948
Test: presubmit
Change-Id: I2f27160cbe7d83201c8f52dbb6dcb774a5b8ae43
2022-11-01 13:12:09 -07:00
Yohei Yukawa
e619330356 Add missing @RequiresPermission to IMM
This is mechanical refactoring that has no behavior change.

 - Add missing @RequiresPermission
 - Describe when INTERACT_ACROSS_USERS_FULL is required
 - Apply the same annotation order
 - Use the same import pattern around permissions

Fix: 256239860
Test: presubmit
Change-Id: I5ba2210e4de54b6941dba148471746f20720f9c6
2022-11-01 13:11:10 -07:00
Yohei Yukawa
05e924b2ab Clarify required permission in IMM#getInputMethodListAsUser()
This is a follow up CL to our previous CL [1], which exposed

  InputMethodManager#getInputMethodListAsUser(int userId) [2]

as an @TestApi.

One thing to clarify is that INTERACT_ACROSS_USERS_FULL permission is
required when and only when "userId" is different from the one of the
calling process.  To make it clear, this CL adds "conditional = true"
like other @RequiresPermission usages in InputMethodManager.

This is just about (Test) API annotation.  There must be no observable
behavior change.

 [1]: I4b73d9374d7a2ce4c9dfc48682a43d5d48b39042
      ec8b1449f2
 [2]: I5b50b5fe143c74c87b331bda3e5bcc4d6248436e
      d20eef826c

Bug: 256239860
Test: presubmit
Change-Id: I14867e528d4292f1f8713b1d9b491fc5ed6c1abb
2022-11-01 13:08:35 -07:00
Sally Yuen
fa16d9b083 Merge "Add AccessibilityDisplayProxy and register/unregister methods" 2022-11-01 19:38:20 +00:00
TreeHugger Robot
d6ffb3b531 Merge "Require TEST_INPUT_METHOD instead in IMM#addVirtualStylusIdForTestSession()" 2022-11-01 17:57:00 +00:00
Yohei Yukawa
943864be04 Merge "Make TEST_INPUT_METHOD @TestAPI" 2022-11-01 17:19:02 +00:00
Alec Mouri
35487fa8ee Merge "Tag UnsupportedAppUsages in SurfaceView with alternatives" 2022-11-01 16:33:40 +00:00
Wei Sheng Shih
341acd7c29 Merge "Fixes NPE crash when VRI#setView fail before input stage was create." 2022-11-01 10:10:04 +00:00
TYM Tsai
c3380c162b Avoid to hold a strong reference to Context object
We only use parts of Context in the Content Capture manager and
main session, we don't need to cache context object which will
cause some memory issues.

This change will extract the necessary information to save it, instead
of caching the entire context object.

Bug: 256247718
Fixes: 239192932
Test: atest CtsContentCaptureServiceTestCases
Change-Id: Id7b5e8617c521f31879199b0f2c7e18204bb7526
2022-11-01 09:48:04 +00:00
Ming-Shin Lu
43013d1d62 Merge "Update showSoftInput javadoc" 2022-11-01 06:10:56 +00:00
Haoyu Zhang
167691ce12 Merge "Introduce TextBoundsInfo" 2022-11-01 05:00:28 +00:00
Ming-Shin Lu
b3214c5176 Update showSoftInput javadoc
For the app developers to understand the editor view of requesting
showSoftInput requires the view and its window must be focused and
serverd by an input method.

Bug: 256517410
Test: build
Change-Id: Ibe52263a01f62140862527fd59111b914ad5e18c
2022-11-01 03:17:12 +00:00
TreeHugger Robot
9fa6872e1c Merge "Handwriting initiation delegation" 2022-11-01 01:07:57 +00:00
Taran Singh
1258fa8548 Make text optional for InsertGesture
text to insert should be optional field for InsertGesture. This allows
IME to use this gesture to move cursor.

Fix: 255839545
Test: atest InputConnectionEndToEndTest
Change-Id: Ibbffff210007dc7900b442d3d46232432e5dbbb2
2022-10-31 19:23:47 +00:00
Yohei Yukawa
e9490612d5 Introduce @hide ParcelableHandwritingGesture
This is a follow up CL to our previous CL [1], which introduced
HandwritingGesture and several subclasses.

One of the challenge is that we only wanted to make child classes
Parcelable, while keeping the abstract base class HandwritingGesture
non-Parcelable.  Although InputConnection has only one method

  InputConnection#performHandwritingGesture(
          HandwritingGesture, ResultReceiver),

in the IPC layer IRemoteInputConnection needed to define methods for
each subclass, e.g.

 * performHandwritingSelectGesture(in InputConnectionCommandHeader,
       in SelectGesture, ...)
 * performHandwritingInsertGesture(in InputConnectionCommandHeader,
       in InsertGesture, ...)
 * performHandwritingDeleteGesture(in InputConnectionCommandHeader,
       in DeleteGesture, ...)

because their abstract class HandwritingGesture is not Parcelable.

To avoid such method definitions (and lots of type-based dispatching /
merging logic), this CL introduces

  ParcelableHandwritingGesture

as a generic Parcelable container of HandwritingGesture subclasses.
You can freely use ParcelableHandwritingGesture in AIDL method
definitions as follows.

  performHandwritingGesture(in InputConnectionCommandHeader,
        in ParcelableHandwritingGesture, ...)

In the Java side, you can easily wrap objects as follows.

  var parcelableGesture = ParcelableHandwritingGesture.of(gesture);
  var unparceledGesture = parcelableGesture.get();

Note that this CL is still an internal cleanup. There must be no
developer observable behavior change.

 [1]: I53bcb62e03ac1c371feb60d1385c88c921754092
      3e3ff1a3d2

Bug: 234882948
Bug: 239783077
Test: presubmit
Test: atest FrameworksCoreTests:ParcelableHandwritingGestureTest
Change-Id: I158026087653f6772a78cc2394e678ae9741fb00
2022-10-31 08:08:54 -07:00
wilsonshih
f1a574074a Fixes NPE crash when VRI#setView fail before input stage was create.
Also catch RuntimeException for addToDisplayAsUser in case the throwing
type was not RemoteException.

Bug: 253200800
Test: Simulate to throw a runtime exception in WMS#addWindow, and verify
VRI#setView should catch that exception, and clear resources without
crash.

Change-Id: Ia113b836e4a18c656093f9db7f63e9c50c427e6c
2022-10-31 21:21:56 +08:00
Yohei Yukawa
cba800ef2f Require TEST_INPUT_METHOD instead in IMM#addVirtualStylusIdForTestSession()
This is a follow up CL to our previous CL [1], which introduced an @TestApi

  InputMethodManager#addVirtualStylusIdForTestSession(),

which internally requires INJECT_EVENTS permission.

Now that TEST_INPUT_METHOD is also available [2], let's require it
instead of INJECT_EVENTS for better consistency with other test APIs
defined in InputMethodManager.

This CL also add @RequiresPermission(TEST_INPUT_METHOD) to

  InputMethodManager#addVirtualStylusIdForTestSession()

to make it clear that it's guarded with the permission.

 [1]: I7399c0a56c04f024d65c16d459818cc2c5cdbc7f
      d96ef57bc4
 [2]: Ie79a3e9d41ce22605ae083594d639c37d08b7def
      b869c78380

Bug: 256239860
Test: atest CtsInputMethodTestCases:StylusHandwritingTest
Change-Id: Icdbb4ade2bd4b5066984e209efcf0ca93bfa08ca
2022-10-28 19:53:46 -07:00
Yohei Yukawa
89d683f2cf Make TEST_INPUT_METHOD @TestAPI
This is a follow up CL to my previous CL [1], which introduced

  android.permission.TEST_INPUT_METHO

to protect several @TestApi methods in InputMethodManager.

This CL makes the permission itself as @TestApi so that it can be
included as an API constant in test-current.txt.  This also enables us
to minimize special permission while running CTS as follows.

  SystemUtil.runWithShellPermissionIdentity(() -> {
      // do something.
  }, Manifest.permission.TEST_INPUT_METHOD);

There must be no user observable behavior change in this CL.

 [1]: Ie79a3e9d41ce22605ae083594d639c37d08b7def
      b869c78380

Bug: 256239860
Test: presubmit
Change-Id: I1fd3ceda9a1b641e63c7633a223a9a806e78cd2d
2022-10-28 19:41:18 -07:00
Alec Mouri
4e00fc472b Tag UnsupportedAppUsages in SurfaceView with alternatives
There is little evidence that the fields annoatated with
@UnsupportedAppUsage are actually used, and even if they were by some
long-tail of apps there are either public api alternatives to accessing
these fields or there are no good use-cases. Populate the usages with
publicAlternative so that we can start removing them during future
refactors.

The only @UnsupportedAppUsage that remains untouched is
SurfaceView#setFrame, because View#setFrame is also annotated with
@UnsuportedAppUsage and possibly has a higher usage level.

Bug: 249858453
Test: builds
Change-Id: I51c918c10ca087d87791899f7bce4b1425130902
2022-10-29 01:50:20 +00:00
Yohei Yukawa
a99bb97e67 Merge "Merge IInputMethodManagerInvoker and IInputMethodManagerGlobalInvoker" 2022-10-28 23:50:52 +00:00
Justin Ghan
9299b0b4ef Handwriting initiation delegation
Handwriting initiation delegation is introduced to support views which
appear to be a text input field, but are actually non-editor views which
are linked to a real editor view. Such views can be configured as
delegates, so that stylus movement on the view can trigger the
transition to show, focus, and start handwriting on the real editor
view.

Bug: 228100684
Test: atest android.view.stylus.HandwritingInitiatorTest
Test: atest android.view.inputmethod.cts.StylusHandwritingTest
Change-Id: I492fd507895d59213753c4ad06d42a4a212e0fde
2022-10-28 16:34:05 -07:00
Yohei Yukawa
6bc4ed39c2 Merge "Rename IInputMethodManagerGlobal to InputMethodManagerGlobal" 2022-10-28 16:06:40 +00:00
Prabir Pradhan
95e4067b09 Merge changes from topics "input-device-bluetooth-address", "notify-stylus-presence"
* changes:
  Add hidden API to query the bluetooth address of an InputDevice
  Native input manager: Add default initializers for locked members
  Introduce monitoring behavior changes for USI devices (3/n)
  Notify the policy when a stylus gesture starts
2022-10-28 15:00:01 +00:00
Prabir Pradhan
e513b7ffe3 Add hidden API to query the bluetooth address of an InputDevice
Since revealing the bluetooth address of an input device can reveal
whether bluetooth is enabled, we require the BLUETOOTH permission for
this API.

This also means we cannot send the bluetooth address to apps using the
InputDevice class. We add an IInputManager method to query the address
instead that performs the permission check.

Since we are not using the Java InputDevice class to store the address,
we must cache the vector of last-reported InputDeviceInfos in
NativeInputManager.

DD: go/inputdevice-battery-notifications

Bug: 243005009
Test: manual
Change-Id: I560cb170ab7008314821e5150caf4868efb5d8d5
2022-10-27 20:45:22 +00:00
Robert Horvath
68a196f1ba Merge "[PATCH] Don't report after view detached from window." am: 88749cfd8f am: 698a7836d2 am: 28951b551e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2262742

Change-Id: Ifd30343b0768153c0a165806995f06e29d6a70c9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-27 08:34:02 +00:00
Robert Horvath
28951b551e Merge "[PATCH] Don't report after view detached from window." am: 88749cfd8f am: 698a7836d2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2262742

Change-Id: Ia4a7fa688707877cf9145d3831d62587d44b9774
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-27 08:28:28 +00:00
Robert Horvath
698a7836d2 Merge "[PATCH] Don't report after view detached from window." am: 88749cfd8f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2262742

Change-Id: I63390f12c64d6c855b1c61f12d070bf258e3a735
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-27 07:57:17 +00:00
Robert Horvath
88749cfd8f Merge "[PATCH] Don't report after view detached from window." 2022-10-27 07:21:20 +00:00
sallyyuen
d86f7e729b Add AccessibilityDisplayProxy and register/unregister methods
An A11yDisplayProxy will be used by Exo to listen to UI changes and
perform actions on the UI.

For a Display that is shown on a ChromeBook/client device,
a privileged app like Exo, or an app with SystemAPI privileges and
the MANAGE_ACCESSIBILITY permission, should call
A11yManager.registerA11yProxy and A11yManager.unRegisterA11yProxy to
enable/disable a11y.

The app will only have visibility in the specified proxy display.

Currently only few A11yProxy methods are exposed. When the proxy is
plugged into the system via ProxyAccessibilityServiceConnection
other methods will be exposed. (See link in comments)

Bug: 241429275
Test: atest A11yProxyTest(cts), atest A11yManagerTest(unit)
Change-Id: I019732e50e6beba0af7f5898a07b44d25e03416b
2022-10-26 15:12:54 -07:00
Haoyu Zhang
43aae6ff6d Introduce TextBoundsInfo
This is an API for IME to request text bounds information from editor to
perform handwriting rich gestures. It's useful for IMEs to create custom
handwriting gesture that's not supported the HandwritingGesture. And
it can also be used to provide default rich gesture implementation for
handwriting gesture compatibility.

Bug: 239843501
Test: atest TextBoundsInfoTest
Change-Id: Ia7522371976a4e1fcdff4cc0d244ea427ad3d7c9
2022-10-26 13:51:45 -07:00
Yohei Yukawa
7cdbbbe90e Merge IInputMethodManagerInvoker and IInputMethodManagerGlobalInvoker
This CL mechanically merges

  IInputMethodManagerInvoker

into

  IInputMethodManagerGlobalInvoker

without changing any observable semantics.  This allows us to remove

  InputMethodManager#mServiceInvoker

completely.

This refactoring makes it much easier for us to see whether a method
in InputMethodManger is implemented only with static methods or not.

Bug: 234882948
Test: presubmit
Change-Id: I310a33f27b876419b6a3058202dcbd663b541079
2022-10-26 13:24:01 -07:00
Yohei Yukawa
f629ddf28b Rename IInputMethodManagerGlobal to InputMethodManagerGlobal
This is a mechanical renaming for classes outside
android.view.inputmethod package.

For non IMF classes, let's expose InputMethodManagerGlobal rather than
IInputMethodManagerGlobal.

In the next CL [1], we want to merge IInputMethodManagerGlobal and
IInputMethodManagerInvoker into a single class, and this CL is just a
preparation.

There must be no observable behavior changes.

 [1]: I310a33f27b876419b6a3058202dcbd663b541079

Bug: 234882948
Test: presubmit
Change-Id: I9b728560369179d5ee17c3570a2543b49b3f14ce
2022-10-26 12:47:56 -07:00
Harry Cutts
812b6ec77e Merge "Add MotionEventTest to code pointer for adding new axes" 2022-10-26 10:14:28 +00:00
Tiger Huang
2f8c5fe063 Merge changes from topic "requestedVisibleTypes2"
* changes:
  Describe requested visibilities in public types (3/n: server side)
  Describe requested visibilities in public types (2/n: client-server)
  Describe requested visibilities in public types (1/n: client side)
2022-10-26 06:10:04 +00:00
Yunfan Chen
b8b5ec823b Merge "Migrate Navigation Bar to InsetsFrameProvider" 2022-10-26 04:20:05 +00:00
Yeabkal Wubshit
81defaa0b4 Merge "Create VelocityTracker#getAxisVelocity API" 2022-10-25 20:35:56 +00:00