Commit Graph

19398 Commits

Author SHA1 Message Date
Zeyin Wu
8bda3be985 Merge "Add CONTENT_CHANGE_TYPE_CONTENT_INVALID CONTENT_CHANGE_TYPE_ERROR" 2022-09-27 21:41:44 +00:00
Mark Punzalan
5e2dfc12cd Merge "Remove active translation on Activity destroyed" 2022-09-27 19:36:40 +00:00
Joanne Chung
b326bba8a4 Merge "Do not send event if the buffer is empty." 2022-09-27 11:25:12 +00:00
Mark Punzalan
ee46d18d05 Remove active translation on Activity destroyed
When a translated Activity is destroyed or translation is finished
(e.g., finishTranslation() call), we also have to remove the entry in
the active translations we are keeping track in
TranslationManagerService. Prior to this change, we were not removing
the entry in the Activity destroyed case, and this caused problems when
a new callback is registered (e.g., Gboard) because it would incorrectly
get an onStarted() call for the now-inactive translation.

This can happen relatively frequently when the device has a work
profile, since switching to apps across profiles re-creates the IME, and
in the case of Gboard, it registers a callback every time.

Also added additional logging on Activity destroyed and when callbacks
are registered and triggered.

Bug: 245911471
Test: atest UiTranslationManagerTest
Change-Id: If1881fd4588725021d38e5b9336c3e69bca17039
2022-09-27 06:44:43 +00:00
Lan Wei
02d2f81b52 Merge "IMA API InputConnection#replaceText()" 2022-09-27 00:01:06 +00:00
Zeyin Wu
9eef24a570 Add CONTENT_CHANGE_TYPE_CONTENT_INVALID CONTENT_CHANGE_TYPE_ERROR
Bug: 230141621
Test: cts tests & manually verified on talkback_tests
Change-Id: Ifebb197340b9e22b7451eb2292b22bce41a2cc9e
2022-09-26 22:59:46 +00:00
Maryam Dehaini
7282ed1f22 Merge "Fixing input coordinates discrepancy" into tm-qpr-dev am: bf338c7633 am: 8679358882
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19947893

Change-Id: Ia4d3b447191dd58ab92b6c84131f28a5fa0cf904
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-26 20:39:00 +00:00
Maryam Dehaini
8679358882 Merge "Fixing input coordinates discrepancy" into tm-qpr-dev am: bf338c7633
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19947893

Change-Id: I471736a34549e0201bdeba90c7060894a964f338
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-26 20:32:35 +00:00
Maryam Dehaini
bf338c7633 Merge "Fixing input coordinates discrepancy" into tm-qpr-dev 2022-09-26 20:16:33 +00:00
Justin Ghan
052676c96f Merge "Fix nullability annotations in InsertGesture API" 2022-09-26 16:15:21 +00:00
Harry Cutts
339b0ee4f7 Merge "Add CLASSIFICATION_TWO_FINGER_SCROLL for touchpad scrolling" 2022-09-26 14:19:40 +00:00
Arthur Hung
027ac2b54f Merge "Set VIEW_STATE_FOCUSED only if view and window has focus" 2022-09-26 04:53:20 +00:00
Joanne
c0f877a774 Do not send event if the buffer is empty.
Found many logs in bugreport that call sendEvents() even the buffer
is empty. We should avoid unnecessary API call to reduce ipc spam.
This change doesn't fix the potential ipc spam issue, only mitigates
the issue.

Bug: 231313913
Test: manual. Local add log and see the empty api call is skipped
Change-Id: I9c8afc5ae2d06074900886cf5743b1ec61ccb973
2022-09-26 11:55:35 +08:00
Automerger Merge Worker
8561a60d51 Merge "Merge "Fix view does not show fill dialog" into tm-qpr-dev am: 5bca0e0058" into tm-qpr-dev-plus-aosp am: a2caef3de9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19710492

Change-Id: If67122e23d28edec09bba8de4d47b36e9b696387
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-23 16:46:48 +00:00
Harry Cutts
7013c869e6 Add CLASSIFICATION_TWO_FINGER_SCROLL for touchpad scrolling
This will be used to denote the single-finger touches that
TouchInputMapper creates to simulate scrolling when the user makes
two-finger swipes on the touchpad.

Bug: 246758376
Test: check new value is sent to a test app when scrolling on a touchpad
Change-Id: Id93cba764522e36d850f7013ab8a117f64716fac
2022-09-23 13:38:21 +00:00
Jorim Jaggi
45d0a352bf Merge "Revert "Re-land "Enable LOCAL_LAYOUT""" into tm-qpr-dev am: 52c3498acf am: 1f09cd1808
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20025004

Change-Id: I6249a83f73202ab9cdc46ee99df2b149a98a03a4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-23 07:37:56 +00:00
Lan Wei
d5d530ad63 IMA API InputConnection#replaceText()
Add InputConnecton#replaceText(int, int, CharSequence, int, TextAttribute) API to support replacing the specific range in the editor with suggested text.

Add default implementation in InputConnection which delegates to call
finishComposingText()+setSelection()+commitText().

Add implementation in BaseInputConnection which will address the issue
of selection flash.

Bug: 241503197

Test: atest FrameworksCoreTests:BaseInputConnectionTest
Test: atest CtsInputMethodTestCases:BaseInputConnectionTest

Change-Id: Ia0e42270cfae112fcf19205a7151e4ab4ac4afdd
2022-09-23 09:37:00 +08:00
TYM Tsai
dcc45bdd20 Merge "Fix view does not show fill dialog" into tm-qpr-dev am: 5bca0e0058
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19710492

Change-Id: I24d669ae62f5e5d9a3a1f1c30a6beff57d745460
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-23 00:03:58 +00:00
TYM Tsai
5bca0e0058 Merge "Fix view does not show fill dialog" into tm-qpr-dev 2022-09-22 23:42:38 +00:00
Jorim Jaggi
1f09cd1808 Merge "Revert "Re-land "Enable LOCAL_LAYOUT""" into tm-qpr-dev am: 52c3498acf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20025004

Change-Id: I1256637878491e8f936ecc19b3617a3a0fbad972
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-22 22:35:38 +00:00
Jorim Jaggi
52c3498acf Merge "Revert "Re-land "Enable LOCAL_LAYOUT""" into tm-qpr-dev 2022-09-22 21:48:43 +00:00
Justin Ghan
3af873ba1c Fix nullability annotations in InsertGesture API
Bug: 239783077
Test: none
Change-Id: Iacc8bb3442100604e7d745755873950b5926a9ac
2022-09-22 13:59:01 -07:00
Chavi Weingarten
85a1ebf628 Make overrideHdrTypes per display
The API overrideHdrTypes should be per display. Add an API into DMS so
DMS can set the override with the correct displayToken. Remove usage of
getInternalDisplayToken in DisplayTests

Test: DisplayTest
Bug: 242714168
Change-Id: Ib338624a71a897d8d718080850f672a219f9627e
2022-09-22 14:44:46 +00:00
Chavi Weingarten
51847be272 Merge changes from topic "revert_capture_display"
* changes:
  Revert "Add captureDisplay API in WMS."
  Revert "Convert invalid crop to display bounds for captureDisplay"
2022-09-22 14:10:37 +00:00
Tiger Huang
b557bc88b8 Revert "Re-land "Enable LOCAL_LAYOUT""
This reverts commit 975dd2c513.

Reason for revert: This is too risky for tm-qpr1
Bug: 161810301
Bug: 175861564

Change-Id: If906b4d538885fca407ce0bd7039c9d35b507032
2022-09-22 13:24:37 +00:00
Tiger Huang
bd2df678ff Merge "Re-land "Enable LOCAL_LAYOUT"" into tm-qpr-dev am: b47c6f2061 am: 7f946269c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19963145

Change-Id: I182e703a5d672224bbe619609fcf08d5ca03fa89
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-21 22:37:07 +00:00
Tiger Huang
7f946269c8 Merge "Re-land "Enable LOCAL_LAYOUT"" into tm-qpr-dev am: b47c6f2061
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19963145

Change-Id: I2b1b8f36acbac91cdcdaec1f5f44b05a8226d9ea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-21 22:16:16 +00:00
Bo Liu
82839ebcfc Merge "NDK methods to get SurfaceControl/Transction from java" 2022-09-21 21:59:26 +00:00
Chavi Weingarten
0fff17bdd5 Revert "Add captureDisplay API in WMS."
This reverts commit c184fd711a.

Reason for revert: 247801379

Change-Id: I20ac6772656d116ca03bc12d60a0c331f7079df2
2022-09-21 21:52:05 +00:00
Chavi Weingarten
9affe38fc5 Revert "Convert invalid crop to display bounds for captureDisplay"
This reverts commit d2caa1f0ac.

Reason for revert: 247801379

Change-Id: I6da853fdbf50cf67d5f4f2428571d668d63b7317
2022-09-21 21:51:04 +00:00
Chavi Weingarten
94d707ccef Merge "Convert invalid crop to display bounds for captureDisplay" 2022-09-21 15:27:00 +00:00
Tiger Huang
b47c6f2061 Merge "Re-land "Enable LOCAL_LAYOUT"" into tm-qpr-dev 2022-09-21 06:10:48 +00:00
Arthur Hung
6898584b74 Set VIEW_STATE_FOCUSED only if view and window has focus
Set VIEW_STATE_FOCUSED state when view and window gain focus or it could
draw a wrong highlight hint on non-focused window.

Bug: 244273901
Test: atest DefaultFocusHighlightTest
Test: multi-window, use dpad key to navigate focus
Change-Id: Iabf58f41fe376d5921b679d53ec82c67650d4988
2022-09-21 03:31:04 +00:00
TreeHugger Robot
85a962599d Merge changes I93352621,I8357bfaf,Ibcde3576,I9c072b82
* changes:
  Remove InputMethodManagerDelegate#isRestartOnNextWindowFocus
  Use getLockObject to sync ImeFocusController#{mServedView, mNextServedView}
  Remove ImeFocusController#set{Served, NextServed}View
  Add InputMethodManagerDelegate#getLockObject
2022-09-21 00:26:58 +00:00
Chavi Weingarten
d2caa1f0ac Convert invalid crop to display bounds for captureDisplay
If the crop value passed in the args for captureDisplay is invalid, use
the display bounds instead.

Test: WindowManagerServiceTests#testCaptureDisplay
Bug: 242714168
Change-Id: Iebe42fd35c5f49b6e711699aa1b986a556a5a5f8
2022-09-20 19:31:10 +00:00
Ming-Shin Lu
786f31f228 Remove InputMethodManagerDelegate#isRestartOnNextWindowFocus
As isRestartOnNextWindowFocus is to check
InputMethodManager#mRestartOnNextWindowFocus flag if the input
connection is needed to force re-start when calling
startInputAsyncOnWindowFocusGain during gaining the window focus
from ImeFocusController#onPostWindowFocus next time.
(e.g. Switching IME apps from IME picker dialog)

Since in startInputOnWindowAyncFocusGain can just check
mRestartOnNextWindowFocus directly without exposing
isRestartOnNextWindowFocus, we could just simplied with inlining
the check logic.

Also, noticed in startInputAsyncOnWindowFocusGain has already reverted
CL[1]'s asynchronize starting input logic for some reasons, as a result,
renaming to startInputOnWindowFocusGain in case misleading.

[1]: I6aa4a664cfd0c86f75cee2457715317194bbe5e2

Bug: 244504062
Test: atest CtsInputMethodTestCases
Change-Id: I9335262136950021efb7b4b73c7eeb930e1333bb
2022-09-20 23:51:26 +08:00
Ming-Shin Lu
ea0c2ee270 Use getLockObject to sync ImeFocusController#{mServedView, mNextServedView}
As CL[1] added InputMethodManagerDelegate#getLockObject that used for
protecting mServedView/mNextServedView in ImeFocusController when we
exposed getServedView/getNextServedView for InputMethodManager to access
with thread safty.

Add synchornize block for all places that accessing
{mServedView, mNextServedView} in ImeFocusController.

[1]: I9c072b829d1db1e68b65e766d764ee71cb16e6a2

Bug: 244504062
Test: atest CtsInputMethodTestCases
Change-Id: I8357bfafeaf0a40e3b74eec2fc59a47309451f18
2022-09-20 23:51:25 +08:00
Ming-Shin Lu
6924863b37 Remove ImeFocusController#set{Served, NextServed}View
As ImeFocusController#set{Served, NextServed}View originally exposes to
InputMethodManager is only for clearing the served view in
IMM#finishInputLocked() with a special code logic:

```
  setNextServedView(null);
  if (getServedView() != null) {
      // do finish input
     setServedView(null);
  }
```

which isn't necessary and can be clean-up with a method to notify
ImeFocusController to clear the served / next served view, then doing
the rest of finshing logic when the method has cleared the served view:

```
if (controller.clearServedViewsLocked() != null) {
    // do finish input
}
```

With this change, we can simply remove the set{Served, NextServed}View
to get rid of this dependency with InputMethodManager.

Bug: 244504062
Test: atest CtsInputMethodTestCases

Change-Id: Ibcde35765c0e2e6c372aa64dbc7e774a8d860543
2022-09-20 23:51:25 +08:00
Ming-Shin Lu
31e4678463 Add InputMethodManagerDelegate#getLockObject
As CL[1] introduces per-window based ImeFocusController for handling
the IME served view focus update logic.

However, for InputMethodManager APIs requires to access
ImeFocusController#{mServedView, mNextServedView} for starting the input
connection or checking the caller's validity, which needs a lock for
thread safety.

As a result, it would make sense to expose mH for ImeFocusController
through an new method InputMethodManagerDelegate#getLockObject
to protect the data consistancy during InputMethodMananger APIs
invoking to access the served view.

Also, renaming the methods (and update the javadoc) with "Locked" sufix:
- ImeFocusController#get{Served, NextServed}View
- ImeFocusController#set{Served, NextServed}View

Note that this is a refactoring preperation CL with added a TODO that
will use getLockObject in the follow-up CL.

[1]: Ib455704fe1e9d243f93190a84f230210dbceac2a

Bug: 244504062
Test: atest CtsInputMethodTestCases
Change-Id: I9c072b829d1db1e68b65e766d764ee71cb16e6a2
2022-09-20 23:51:16 +08:00
Chavi Weingarten
dc59d4e40b Merge "Add captureDisplay API in WMS." 2022-09-20 13:36:00 +00:00
Arthur Hung
b066a1d673 Merge "Revert "Clear default focus highlight when lost window focus or re-enter touch mode"" 2022-09-20 00:45:49 +00:00
TYM Tsai
fc5f2a60d3 Fix view does not show fill dialog
Sometimes, views may not be visible for the user immediately after
laid out, so add flag for do the evaluation once the view is visible.

Bug: 234429643
Test: Manual, check the fill dialog is appeared
Change-Id: I6b96b68ffc4a4b1ee5f5056848c5c4996d21ae73
2022-09-19 22:51:25 +00:00
Chavi Weingarten
c184fd711a Add captureDisplay API in WMS.
Allow clients to request a display screen capture using a specified
displayId. The caller can pass in their own required arguments and they
will get the screenshot via an async callback directly from SF.

Test: ScreenshotTests
Bug: 242714168
Change-Id: I387f58d342f01ae71b85311fbf0634f0e7901f7d
2022-09-19 19:32:42 +00:00
Arthur Hung
9b81e4ea0a Revert "Clear default focus highlight when lost window focus or re-enter touch mode"
This reverts commit 5fc73f8f2f.

Reason for revert: b/246952306

Change-Id: I134a59a9cd576e6cf6a9bf8b5bcf2ae96e3fdb93
2022-09-19 11:33:54 +00:00
Wilson Wu
fe8bf190f9 Merge "Revert "Fix potential failures in InputMethodService"" 2022-09-19 09:13:38 +00:00
Wilson Wu
1e5f9b6bfd Revert "Fix potential failures in InputMethodService"
This reverts commit ce98507bf3.

Reason for revert: b/247426953

Change-Id: If7b7a258150f8f57a7b4a88e4926d412f948fd9c
2022-09-19 08:55:19 +00:00
Wilson Wu
624f3aef5e Merge "Prevent InputMethodManager call into DelegateImpl (1/N)" 2022-09-19 02:05:15 +00:00
TreeHugger Robot
306f2a61cb Merge "Fix potential failures in InputMethodService" 2022-09-19 01:58:35 +00:00
Bo Liu
789103b97a NDK methods to get SurfaceControl/Transction from java
Test: ASurfaceControlTest#testSurfaceControl_fromSurfaceControl
      and ASurfaceControlTest#testSurfaceTransaction_fromTransaction
Change-Id: Ic15bfaae22b50f70c1c82c8945c09b749654a00f
2022-09-17 16:17:08 -04:00
Tiger Huang
2a7f7ed158 Merge changes Ibc2f40dd,I37fb8ffc into tm-qpr-dev am: dea70726f6 am: d95c3121b6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19963144

Change-Id: I8c08856b1d5e20fef1175d2205e3f2dcc21af7cd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-17 12:42:07 +00:00