Commit Graph

16819 Commits

Author SHA1 Message Date
Arthur Hung
faf6041b60 Merge "Update OWNERS for input relevant files" 2022-01-10 12:30:33 +00:00
Arthur Hung
6c1c224661 Update OWNERS for input relevant files
Bug: 189241600
Change-Id: I3f6ab682578d379d576682de632374882f66d761
2022-01-07 14:24:22 +00:00
Bill Yi
6042a19c72 Merge sc-qpr1 to aosp-master - DO NOT MERGE
Merged-In: I90ca5ccbf686a975f479c2488ff34f82af12946a
Merged-In: I128f5ed6c1bad350ea449bba5da21123de3ea31b
Change-Id: Ib18c8042f735dceeee5e6ab9f1c963cf630913a6
2022-01-06 18:38:32 -08:00
Treehugger Robot
e908851af5 Merge "Fix an off-by-one bug in EditableInputConnection#endBatchEdit() return value" 2021-12-15 17:00:15 +00:00
Jon Eckenrode
629810015f Merge "Revised the OnDragListener and onDragEvent API documentation." 2021-12-15 15:22:55 +00:00
Yohei Yukawa
1fdc14b8a9 Fix an off-by-one bug in EditableInputConnection#endBatchEdit() return value
This is a follow up CL to our previous CL [1], which had an off-by-one
bug when determining the return value of

   EditableInputConnection#endBatchEdit().

According to the API document of InputConnection#endBatchEdit(), the
following test should pass.

   EditText editText = new EditText(context);
   EditorInfo editorInfo = new EditorInfo();
   InputConnection editableInputConnection =
           editText.onCreateInputConnection(editorInfo);
   assertThat(editableInputConnection.beginBatchEdit()).isTrue();
   assertThat(editableInputConnection.beginBatchEdit()).isTrue();
   assertThat(editableInputConnection.endBatchEdit()).isTrue();
   assertThat(editableInputConnection.endBatchEdit()).isFalse(); // (*)
   assertThat(editableInputConnection.endBatchEdit()).isFalse();

However, the last assertion marked with (*) actually fails due to an
off-by-one bug.  This CL finally fixes it.

The risk of app compat breakages because of fixing this long standing
bug is supposed to be low, mainly because:

 * the system has not relied on this return value yet.
 * Widgets like WebView have correctly implemented this API.
 * IME has always received true no matter what the app returned, which
   is the same behavior as other async InputConnection APIs.

This CL adds several notes to InputConnection#endBatchEdit() document
to help developers correctly implement and use this API.

 [1]: I1ec5518fdc16fb0551fbce9d13f5d92eb4bc78c0
      c478c171e9

Fix: 209958658
Fix: 210165648
Test: atest -c CtsInputMethodTestCases:EditTextImeSupportTest
Change-Id: Ibc40072fa11a4d6e3c24b8d7860c914ccdbcbc8a
Merged-In: Ibc40072fa11a4d6e3c24b8d7860c914ccdbcbc8a
(cherry picked from commit beda2b7f76)
2021-12-14 15:15:54 -08:00
joneckenrode
74390f89b2 Revised the OnDragListener and onDragEvent API documentation.
Test: Javadoc build
Signed-off-by: joneckenrode <joneckenrode@google.com>
Change-Id: I807143412b249787526c6e3f7e8a27cc7f77bf89
2021-12-14 19:00:22 +00:00
Treehugger Robot
d3b9a7f1b2 Merge "ANDROID: Fix EventLog string class problem in ViewRootImpl#enqueueInputEvent()" am: 808e0a5e7a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1909899

Change-Id: I1bc36b94f27ec90d484df3a468c1984d1ece8277
2021-12-03 22:21:12 +00:00
chenchaoli
beb8f3f4b3 ANDROID: Fix EventLog string class problem in ViewRootImpl#enqueueInputEvent()
EventLog function can handle string,integer class and long class. (in android_util_EventLog.cpp)
    If menu title string are used bold tag(like <b>test</b>), it'll be android.text.SpannedString.
    therefore any android activity using tag menu string(like <b></b>) can be crashed by IllegalArgumentException.

    Bug: 208862322

Change-Id: I2432b0cd28c8f5fcb07cdf3e29560bf6b6c0f7b6
Signed-off-by: chenchaoli <chenchaoli@xiaomi.com>
2021-12-03 05:52:33 +00:00
wilsonshih
05e7906edb Only register listeners if setView was success.
Found a memory leak on ViewRootImpl. If the view wasn't been set
to the VRI successfully, there would keep the registed listeners to the
AccessibilityManager and DisplayManager forever because there didn't
need to deatch anything from window.
Another reasonable way is to register all listeners after setView
success.

Bug: 200843755
Test: manual, hard code to force addWindow fail and monitor no more
ViewRootImpl object leaked to AccessibilityManager and DisplayManager.

Change-Id: I3c9cc52d0ca4595c74c1dc3c51d286d9e6e3897f
Merged-In: I3c9cc52d0ca4595c74c1dc3c51d286d9e6e3897f
(cherry picked from commit d69deffd35)
Merged-In:I3c9cc52d0ca4595c74c1dc3c51d286d9e6e3897f
2021-11-24 23:22:19 +00:00
Jon Eckenrode
98951a99f4 Merge "Reconciled description of WindowManager with description of Context#createDisplayContext()." am: 92a4b54de5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1882528

Change-Id: I894941a064dc61c68722036081f0617c47804c83
2021-11-22 16:38:54 +00:00
Jon Eckenrode
92a4b54de5 Merge "Reconciled description of WindowManager with description of Context#createDisplayContext()." 2021-11-22 16:21:19 +00:00
Xin Li
10d9972786 Merge sc-qpr1-dev-plus-aosp-without-vendor@7810918
Bug: 205056467
Merged-In: I13199bc39e9445929195f3d15579cbffe94e92b0
Change-Id: I35fa3c6c2abf679c51033f1395a08d511ed8739f
2021-11-18 17:00:37 +00:00
Treehugger Robot
d76da0b633 Merge "Add direct keys to launch applications." 2021-11-11 20:15:37 +00:00
Kyeongkab.Nam
11e61ab1fd Add direct keys to launch applications.
Many TV remotes have direct keys to launch the specific
application such as Netflix. KEYCODE_APP_X are
intended to be used for such a purpose and to be handled
by GlobalKeyManager.
Categorized like below.
 - KEYCODE_VIDEO_APP_X
 - KEYCODE_FEATURED_APP_X
 - KEYCODE_DEMO_APP_X

Prevent KEYCODE_APP_X from being sent to the apps.

Bug: 182532772
Test: atest KeyEventInterceptTest
Change-Id: I13c469c92da97014be5c76c230806331f0602b54
Merged-In: I13c469c92da97014be5c76c230806331f0602b54
2021-11-11 18:11:29 +00:00
Jon Eckenrode
a05912b129 Reconciled description of WindowManager with description of Context#createDisplayContext().
Signed-off-by: joneckenrode <joneckenrode@google.com>
Change-Id: I428ab2c0303ebf6414a0e29ad844c1c52af2db43
2021-11-11 16:10:00 +00:00
Vishnu Nair
cbb12e2e76 WM: Handle primary display orientation when calculating the transform hint
Query the surface flinger property
ro.surface_flinger.primary_display_orientation to determine the
primary display's install orientation. If the window is on the
primary display, then update the transform hint passed on to the
client.

Bug: 196167822
Test: check initial buffer transforms on displays with a different
install orientation

Change-Id: Idf010cd6be73172ba708820f87046c3ba3cf8001
Merged-In: Idf010cd6be73172ba708820f87046c3ba3cf8001
2021-11-11 03:14:21 +00:00
Joanne Chung
5667540a7d Fix not show translation if call startTranslation after pauseTranslation
It is possible the developer calls pauseTranslation() to show the
original text but it calls startTranslation() to show translated
text. Ideally the developer should call resumeTranslation but it
also make sense to call startTranslation() to show translated text.

When receiving translation response, we avoid showing transaltion
if the view already has the response and it's the same. But it is
good to also check if the view is showing translated text or not.
If the view is not translated text, it is possible developer calls
startTranslation() instead if calling pauseTranslation() to show
translated again, the fixing can resolve this case.

The issue case can be fixed by this change. But there is a deeper
problem about it's useless the caller call finishTranslation(). This
is planned to be fixed in next release.

Bug: 201238016
Test: manual. The issue case is fixed.
Test: manual. Test some chat apps, it still works fine.
Test: atest CtsTranslationTestCases
Change-Id: I699d0fa1d60ac96db094adcc6e17f4203df03214
2021-10-07 06:04:06 +00:00
Julian Odell
84a7a431cc Merge "Notify content capture on detach before setting attachInfo to null." into sc-qpr1-dev 2021-09-29 04:55:18 +00:00
Julian Odell
7c3d133d65 Notify content capture on detach before setting attachInfo to null.
If a view is detached before being removed (which seems common with some
recycler list views) then no content capture view removed event is sent
(notifyAppearedOrDisappearedForContentCaptureIfNeeded does nothing
if mAttachInfo is null).

Fix: 200166989
Test: Manual verification using AiAi logging
Change-Id: Ic04af005bb4ad425ba8398439f1f47bb6bcb334c
2021-09-28 20:24:07 +00:00
Vishnu Nair
f0ae9acf36 ViewRootImpl: Update opaque flag if SurfaceControl changes from relayout
The opaque flag is necessary for the compositor to blend the layers
correctly and prevent translucent pixels from showing the layer
underneath during animations.

Test: manually punch holes in apps and verify opaque apps don't show the layer underneath
Test: automated tests to follow
Bug: 198924563
Change-Id: I1116c51b2efd4e9c0fe2acbca080291f3950245c
2021-09-28 17:45:10 +00:00
Pablo Gamito
66d4318c18 Revert "Add API to specify background color for animations"
This reverts commit 2ccc829e71.

Reason for revert: No longer needed

Test: Existing tests
Bug: 200763116
Change-Id: Ibd9f22af05eba99c4509b503665c1e915993c940
2021-09-27 23:42:32 +02:00
Pablo Gamito
a5f3e90212 Stop relying on background color attribute to set task transition background
Because the background attribute used to have a different use some apps still set it and it means we could run transitions with unexpected background colors

Test: Existing

Fixes: 200763116
Merged-In: Id42f52760cb9a681c6c33f3c261d7db5e2f71af3
Change-Id: Id42f52760cb9a681c6c33f3c261d7db5e2f71af3
2021-09-27 23:42:15 +02:00
Joanne Chung
f0c99d831e Merge "Fix translation doesn't work on ViewGroup" into sc-qpr1-dev 2021-09-23 06:15:01 +00:00
Joanne Chung
0287b4722c Merge "Fix the existing translation doesn't update for new translated result." into sc-qpr1-dev 2021-09-23 01:14:44 +00:00
Pablo Gamito
3ea6b0ab10 Update status bar transition start time
Update to feel less flickery with the new task transition animation

We want to try and have the navbar transition right when the animation is in between the two tasks

Bug: 200674544
Test: Existing tests
Change-Id: If99965c4b4776c902a3c6b32a3fcdb0b65811407
2021-09-22 15:36:36 +02:00
Pablo Gamito
2ccc829e71 Add API to specify background color for animations
To be used for new task transtion animations
(go/android-new-task-motion) to set a background color behind the
animations instead of showing the wallpaper.

Test: atest FlickerTests:TaskTransitionTest
Bug: 199507257
Change-Id: I7fabfdcaf90be63c11eb3b18d65259c620570cab
2021-09-20 19:30:17 +02:00
Joanne Chung
7672bbc915 Fix the existing translation doesn't update for new translated result.
It is possible the existing text is changed that triggers a new
translation. We cache the translation response when onShowTransltion
is called. We should keep the translation response is updated if this
is a new translation result.

Bug: 200232741
Test: atest CtsTranslationTestCases
Test: manual. The issue app works fine.
Change-Id: Iaf7423cd35d4484e33de84e478256b77a000f390
2021-09-19 15:16:57 +00:00
Joanne Chung
ec3f41e70e Fix translation doesn't work on ViewGroup
The system will add requested view reference into cache but it is
possible the requested translation view is a viewgroup, we don't add
this into view reference list that cause the translation doesn't work
on ViewGroup.

Bug: 200233857
Test: atest CtsTranslationTestCases
Test: manual. Use a sample code to request translation for a
viewgroup and make sure it is added into view reference list.
Test: manual verify with issue client app, it works.

Change-Id: Ie593a1a436fd046373412ae2955a78057d22b892
2021-09-17 09:29:44 +00:00
Charles Chen
37430c5ba8 [RESTRICT AUTOMERGE] Send DA's config directly when attaching to DA
WindowContext relies on WindowTokenClient#onConfigurationChanged after
calling WMS#attachWindowContextToDisplayArea.
However, it took some time to wait for onConfigurationChanged callback
from the server side so that we may get a stale value right after
creating WindowContext.
This confuses developers especially when the foreground activity is in
size compat mode or freeform because the process config is overridden
by activity's config.
This CL makes #attachWindowContextToDisplayArea return DA's configuration
and applies to WindowContext direcly.
It also benefits WindowProviderService because it can obtain DA's
 configuration before onCreate() based on [1] and this CL.

Bug: 190019118
Bug: 190745506
Bug: 198298520
Test: manual - 1. launch an Activity in size compat mode
               2. create a WindowContext and verify if WindowMetrics
                  matches DA bounds.
Test: atest WindowContextTest WindowContextTests
Test: atest WindowContextControllerTest ContextGetDisplayTest
[1]: dd4a748af0

Change-Id: I8dd3987b731662502bc01e9d2ed67e718ada5f46
2021-09-14 03:06:50 +00:00
Adam He
4b02f45293 Merge "Fill in javadocs for translation feature." into sc-dev am: 1553fc7fad
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15597859

Change-Id: I214790439c5b6520131cf8a9f03a255ebe16421f
2021-09-09 16:04:28 +00:00
Adam He
47cb06a213 Fill in javadocs for translation feature.
Bug: 190236094
Test: atest CtsTranslationTestCases
Change-Id: I4d3e68cb4de4ca003f6f2cf1c0be626b91c0de97
2021-09-07 23:38:09 +00:00
Vishnu Nair
aacc61be3d Surface: Release references to BlastBufferQueue and SurfaceControl on Surface#destroy
SurfaceView clients may hold on to surface references. In S this means
they would extend the lifetime of the SurfaceControl resulting in
"leaking" buffers until the references are cleared or the app is
terminated.

Fix this by calling a new destroy function on Surface which will
explicitly remove references to the SurfaceControl and BBQ it holds.
This is safe because SurfaceView controls the lifecycle of the Surface
and knows when the Surface will become invalid. Once invalid, the Surface
cannot become valid again.

Test: repro steps in bug
Bug: 198133921
Change-Id: I5c7e43736f025fc0965eae2f19719ba40df3cb70
Merged-In: I5c7e43736f025fc0965eae2f19719ba40df3cb70
2021-09-03 17:03:23 +00:00
Joanne Chung
1957020797 Merge "Update javadoc for UiTranslation functions." into sc-dev am: eba4265116
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14880635

Change-Id: Idb7e697a519ef246b057012fa5ddd01e9f2587c0
2021-08-19 10:19:20 +00:00
Joanne Chung
119f044e62 Update javadoc for UiTranslation functions.
1. Provide more detailed information for UiTranslationManager.
2. Clarify the difference for VTC#onClearTranslation and
VTC#onHideTranslation.

Bug: 178044703
Test: n/a. Change javadoc not change code.

Change-Id: I4b2ef1a6c39c3bbbb85d0dcda519d286f10deb25
2021-08-19 05:15:31 +00:00
Joanne Chung
dd622014fe Bug Fix: fix NullPointerException while scrolling message apps am: 018e3d97d0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15605141

Change-Id: I17cbd83fd37aeef4eafbfd44d9ec5fd05466e04c
2021-08-18 14:46:35 +00:00
Joanne Chung
018e3d97d0 Bug Fix: fix NullPointerException while scrolling message apps
The issue will occur when the view is removed from the hierarchy by
the time the translation response returns. Do a null check to make
sure the view still exists.

Bug: 196933332
Test: atest CtsTranslationTestCases
Tese: manual. not see the crash when scrolling the apps.

Change-Id: Ifee933a802385750d431800ef50f6f2c306ccc0f
2021-08-18 06:50:28 +00:00
Mark Renouf
04bcff1e9f Return packageName to scroll capture requests from SysUI
Bug: 195013652
Test: manual
Change-Id: Ib623e34031b7a5117d9c5afb439fc382f9c77dd1
2021-08-11 18:57:28 +00:00
Joanne Chung
fd19460694 Fix the Translator references are gone when receiving response.
There are some issues TranslationService already sent the response
but the View onResponse doesn't be called. The reference seems to be
gone. If we don't fix the problem, we will missing the ui translation
even the service already give us the response. To fix the problem, we
change it to strong reference.

The change is low risk, the only risk is if TranslationService doesn
not release the reference to the callback properly causing a memory
leak for apps but this can recovered by app update.

Bug: 194973014
Test: atest CtsTranslationTestCases
Test: The translation for chat apps work fine. The memory is decreased
after receiving the responses for a while.

Change-Id: Ib3956b2250c54a29acf9f7d51f51e8191fe8aba2
2021-08-05 07:07:18 +00:00
Vishnu Nair
5d7ae9063a Merge "SurfaceView: Synchronize position updates with fixed size changes" into sc-dev 2021-08-05 04:36:08 +00:00
Vishnu Nair
befbb69cf5 SurfaceView: Synchronize position updates with fixed size changes
This cl solves a couple of issues:
1. Render thread workers and UI thread share the surface size. They work
on different frames (UI thread sets up the next frame while render
thread is working on the current frame. Accessing the surface size is
unsafe and can result in flickers.

2. UI thread is changing the geometry on size change which might
conflict with render thread causing flickers. This is because of
unsafe accesses as the one mentioned above and the UI thread may
not have the up-to-date position of the view.

This cl fixes the issues by only applying geometry changes in the
UI thread when creating the surface, otherwise the render thread
workers are responsible for updating the geometry. The RenderNode
position update listeners are updated whenever the surface size
changes in order to capture the new size and accompanying changes
which must be applied with the new geometry changes.

Note: updating the position update listeners will trigger a
position update callback so we are guaranteed to apply the
changes in scenarios where the fixed size changes but the view
size does not change.

Test: atest SurfaceViewSyncTest#testSurfaceViewChangeFixedSize
Test: atest SurfaceViewSyncTest#testSurfaceViewChangeFixedSizeWithViewSizeChanges
Test: go/wm-smoke
Test: repro steps from b/190449942
Fixes: 190449942
Change-Id: I076321c853f9a0f6cbf169637e3f3ede60361d60
2021-08-04 11:22:21 -07:00
Vishnu Nair
40ddf958e6 Merge "SurfaceView: Synchronize destframe updates with SurfaceView size changes" into sc-dev 2021-08-02 23:35:38 +00:00
Vishnu Nair
f13eac9f7e SurfaceView: Synchronize destframe updates with SurfaceView size changes
This CL fixes one of the issues with SurfaceView parent frame and
content syncing.

With BLAST, we have two surface controls each setting a scale. The
parent surface control sets a scale based on the requested surface
size and the SurfaceView layout size. The BlastBufferQueue surface
control scales the buffer to the requested buffer size if the buffer
has the appropriate scale mode.

The destination frame controls the second scaling and it must be
applied with the parent surface scale changes. This cl fixes flickers
where the requested fixed surface size changes without any view size
changes. This cl allows the caller to pass in a transaction to
BLASTBufferQueue#update which is updated with the destination frame
changes. This transaction can then be applied with the parent
surface changes.

This also fixes an issue where destination Frame was being set on
every buffer update and when we updated the BlastBufferQueue size.
Since buffer transactions can be queued up on the server side, a
stale value maybe applied for a few frames causing flickers.

Fixes: 194458377
Test: bug repro steps
Test: atest SurfaceViewSyncTest#testSurfaceViewSetFixedSize

Change-Id: I118bd1c3942b389e3951c3fd7389403895fc7b31
2021-07-30 16:18:21 -07:00
Yohei Yukawa
d8c0b18ea5 Clarify on return value of IC#setImeConsumesInput()
This CL aims to clarify on what the return value of

  InputConnection#setImeConsumesInput()

means for both the IME authors and editor authors [1][2].

In short, the semantics is exactly the same as

  InputConnection#performSpellCheck()

hence this CL reuses its @return section.

Other than clarifying an API doc, this CL changes nothing.

 [1]: Ic04cacfd73f1f4cb254bb16caf6b04c00c91a318
      30fe6aa964
 [2]: I8ac1ea4d53f747b0086ed415ff90793dfc6155bc
      66b21086e3

Bug: 175362887
Fix: 194099171
Test: presubmit
Change-Id: Ibdfe81a9dd1448856797aaed2f14de1314da1cac
Merged-In: Ibdfe81a9dd1448856797aaed2f14de1314da1cac
(cherry picked from commit f9ca70be57)
2021-07-30 13:49:02 +00:00
Winson Chung
954ce27d13 Add mechanism for a task's windows to be trusted overlays
- Exposes a method to set that a certain part of the SF hierarchy is
  trusted, and sets this state for tasks in PIP.

Bug: 191529039
Test: Manual, try using permission dialog while PIP is active

Change-Id: I170cb5a7d22ef569eb36de21cc0bcbef60dd385e
2021-07-21 12:59:50 -07:00
Vishnu Nair
861ba140a1 Merge "SurfaceView: Update transform hint only if the view is visible" into sc-dev 2021-07-19 23:17:07 +00:00
Vishnu Nair
bc9be8e428 SurfaceView: Update transform hint only if the view is visible
Transform hint should only be updated when creating the
surface or the view is visible. If the view is not visible, BBQ
will be null. This fixes a NPE in SurfaceView.

Test: go/wm-smoke
Fixes: 193618182
Change-Id: I98a463ae23a93d89ac803e2c2d80ecfd56ca97d2
2021-07-19 09:25:08 -07:00
Sally Yuen
ea5ce681f3 Merge "Don't query a null AccessibiiltyNodeInfo when populating ViewStructure" into sc-dev 2021-07-16 16:53:17 +00:00
Sally
3b548655fd Don't query a null AccessibiiltyNodeInfo when populating ViewStructure
Chrome may crash with an NPE

Bug: 193839657
Test: builds
Change-Id: I106bdf80678f9edd6fbd5193d3a79a48c95a1d7a
2021-07-16 01:07:13 +00:00
Rob Carr
b10b4141a5 Merge "ViewRootImpl: Use mWindowAttributes directly for BBQ" into sc-dev 2021-07-14 16:23:45 +00:00