Commit Graph

18631 Commits

Author SHA1 Message Date
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
52c3498acf Merge "Revert "Re-land "Enable LOCAL_LAYOUT""" into tm-qpr-dev 2022-09-22 21:48:43 +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
b47c6f2061 Merge "Re-land "Enable LOCAL_LAYOUT"" into tm-qpr-dev 2022-09-21 06:10:48 +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
Tiger Huang
dea70726f6 Merge changes Ibc2f40dd,I37fb8ffc into tm-qpr-dev
* changes:
  Don't perform config change if relayoutAsync
  Apply synced relayout if we have FLAG_WINDOW_VISIBILITY_CHANGED
2022-09-16 14:23:42 +00:00
Tiger Huang
975dd2c513 Re-land "Enable LOCAL_LAYOUT"
Test: regular rotation, fixed rotation, and seamless rotation
Test: PowerMenuMicrobenchmark#testPower_verifySystemPowerMenuAppears
Bug: 161810301
Bug: 175861564
Change-Id: I7d70445a90ba234e2ba6482552886c1808d0d233
2022-09-15 15:37:35 +08:00
Tiger Huang
f3b99eee95 Don't perform config change if relayoutAsync
mPendingMergedConfiguration wouldn't be updated if we didn't call
IWindowSession#relayout.

Bug: 244003094
Test: atest ToggleDarkThemeMicrobenchmark#testToggle
Change-Id: Ibc2f40dd986136d9b54f3a7f491f7517489e05af
2022-09-15 15:02:40 +08:00
Xiaowen Lei
f8e4efccda Merge "Add AppTransition type and remote animation for Dream in occluding Keyguard." into tm-qpr-dev 2022-09-09 23:12:19 +00:00
Mark Punzalan
1eaf0fadf2 Merge "Don't reset translation callback with other state" into tm-qpr-dev 2022-09-09 20:56:27 +00:00
Xiaowen Lei
7c458bea7d Add AppTransition type and remote animation for Dream in occluding Keyguard.
The existing Keyguard Occlude Animation Runner doesn't match the spec
for Dream in. It animates activity expanding from the center of the
screen. For Dream in, we have:
  - Dream fading in
  - DreamOverlay complications fading in slightly delayed, with each part
    starting at different times.

This CL adds dedicated AppTransitionType and remote animation runner,
which animates Dream fading in. It doesn't implement the separate
animation for DreamOverlay complications.

Bug: 222507937
Bug: 240477956
Bug: 242864189
Fix: 240477956
Test: on device, wait for Keyguard to time out to Dream.
Change-Id: I5517ded2eea77ea962ca1551ed51dd997ff09993
Merged-In: I5517ded2eea77ea962ca1551ed51dd997ff09993
2022-09-09 20:42:45 +00:00
Tiger Huang
40b4880d7a Apply synced relayout if we have FLAG_WINDOW_VISIBILITY_CHANGED
The client needs to call relayout to get the valid surface if
- mFirst,
- mViewVisibility != viewVisibility,
- mNewSurfaceNeeded, or
- mAppVisibilityChanged.

We didn't cover mNewSurfaceNeeded or mAppVisibilityChanged previously.
All of them are covered by FLAG_WINDOW_VISIBILITY_CHANGED.

Bug: 244521023
Bug: 161810301
Test: 1. Enable LOCAL_LAYOUT
      2. Open Camera and double press the power button.
      See if the preview screen of Camera become blank.
Change-Id: I37fb8ffc9063b72bf3abba5d29fc2f750e7fc64f
2022-09-08 15:40:49 +08:00
Tiger Huang
7cacd12b23 Merge "Revert "Enable LOCAL_LAYOUT"" into tm-qpr-dev 2022-09-06 14:26:43 +00:00
Riddle Hsu
3ef46b57b9 Optimize screen decor insets calculation
This stores the computed decor insets and frame excluding insets.
So it can save 99% time of recomputing the insets every time during
starting an activity. E.g. dozen times of "prepare display info/frame,
compute window layout of insets source windows, calculate insets"
becomes "get result from array".

The saved decor insets will be updated when:
- Display metrics is changed (DC#updateBaseDisplayMetrics).
- Insets provider is added/removed/changed.

Also
- Use DisplayCutout rather than WmDisplayCutout to simplify
  passing the cutout between methods.
- Optimize getSourceProvider to avoid unnecessary object allocation.

This also fixes an issue that the display doesn't compute the latest
configuration when navigation mode is changed. Now it is fixed by
checking if the insets provider has layout changes and then recompute
screen configuration.

Bug: 238399969
Bug: 159103089
Test: atest DisplayPolicyInsetsTests DisplayPolicyLayoutTests
      DisplayPolicyTests#testUpdateDisplayConfigurationByDecor
Test: Change navigation mode or display size (density) in Settings.
      And then swipe-up or press home key, there won't be a
      frozen effect (display configuration change).

Change-Id: If6c28a89939372e6362b92f469ef7d793e8ec215
2022-09-02 23:29:29 +08:00
Neha Jain
3e52eb1bc6 Revert "Enable LOCAL_LAYOUT"
This reverts commit 1721522709.

Reason for revert: b/244521023

Change-Id: I67df39f4d218ff65cb7a2010b544c3ef158f50cf
2022-09-02 02:50:46 +00:00
Tiger Huang
2220c995a4 Merge "Enable LOCAL_LAYOUT" into tm-qpr-dev 2022-08-26 16:56:26 +00:00
Ming-Shin Lu
469cbe9037 Merge "Fix IME jumpcut when playing user IME animation after IME restarted" into tm-qpr-dev 2022-08-25 16:13:08 +00:00
Yunfan Chen
6640d839aa Refine the way of calculating insets for configuration (1/3)
The original patch reverted as commit
bc0d5539e6.

This patch only includes the part of refactors to make the calculation
of configuration around insets easier. The actual change of making extra
navigation bar treated as navigation bar and the fix of the UiDevice in
ui automator is in a separate patch to avoid being blocked and blocking
other changes for long.

Test: PlatformScenarioTests
Test: TaplTestsQuickstep, ThemeIconsTest, TaplTestsLauncher3
Bug: 238981445
Bug: 238985243
Bug: 238581838
Bug: 233945217
Change-Id: If966bcc8125300d47d5cd631f7db17ff027e5261
2022-08-24 09:01:03 +00:00
Hongwei Wang
5238c74d09 Merge "[Re-land] Remove getSfInstance usage from ViewRootImpl" into tm-qpr-dev 2022-08-19 22:03:03 +00:00
Hyunyoung Song
7f9f126df7 Merge "Add passive callback for system-run insets animation" into tm-qpr-dev 2022-08-19 18:37:40 +00:00
Ming-Shin Lu
a9fa413a21 Merge "Fix toggleSoftInput can't hide IME when the app in multi-window mode" into tm-qpr-dev 2022-08-19 14:52:59 +00:00
Fiona Campbell
a01ccaae13 Merge changes I36ea0ffc,I1f3797c5,I01aeeedd into tm-qpr-dev
* changes:
  Add constraints to window duration scale
  Add constraints to animation duration scales
  Ensure animation scales are within bounds
2022-08-19 14:49:40 +00:00
Hyunyoung Song
03110e20d9 Add passive callback for system-run insets animation
This passive window inset animation control listener
is used to for logging purpose when hide, show
method is called.

Test: atest InsetsControllerTest
Bug: 240192346

Change-Id: I399268ead9d04b356f10cc3e9ac1da9e31306e86
2022-08-19 05:15:29 +00:00
Mark Punzalan
ce2a5db2c8 Don't reset translation callback with other state
This fixes issues with Views that have their own custom
ViewTranslationCallback.

Bug: 236678324
Test: atest CtsTranslationTestCases
Test: manual - Verified on chat app that uses their own custom
ViewTranslationCallback; old and new messages are translated
Test: manual - Spot-checked translation on a few other chat apps

Change-Id: If4194bc8cde73a9cebb7b56594f6982855374410
2022-08-16 17:42:38 +00:00
Joanne Chung
9e263e643d Merge "Fix system toolbar doesn't use correct theme." into tm-qpr-dev 2022-08-16 10:00:57 +00:00
Joanne Chung
ebb357e1c9 Merge "Fix translation session id collision bug." into tm-qpr-dev 2022-08-16 09:52:18 +00:00
Tiger Huang
1721522709 Enable LOCAL_LAYOUT
Test: regular rotation, fixed rotation, and seamless rotation
Test: presubmit
Bug: 161810301
Bug: 175861564
Change-Id: If9488ffc84dc5e2af106acfae425a854fb7407a2
2022-08-16 08:45:02 +00:00
Tiger Huang
81ae41092e Merge "Introduce IWindowSession#relayoutAsync" into tm-qpr-dev 2022-08-16 08:44:11 +00:00
Wilson Wu
08fc972311 Merge "Refine {SHOW,HIDE}_MY_SOFT_INPUT constants" into tm-qpr-dev 2022-08-16 08:37:12 +00:00
Tiger Huang
3712433349 Introduce IWindowSession#relayoutAsync
IWindowSession#relayoutAsync is similar to IWindowSession#relayout, but
the former is an oneway method which just sends the layout attributes to
the server. Since the client can compute its own window frame, it just
needs to send attributes to the server without getting blocked for
receving the window frame.

In somes cases, the client still needs to obtain things from the server.
Such as:

- When view visibility is changed. The client maybe not be able to
  receive the latest insets state while it is INVISIBLE or GONE. In this
  case, the client needs to obtain the frame and the insets state. Also,
  the client need to obtain the surface control when it becomes VISIBLE.

- When the insets state is stale but the config is up-to-date. This can
  happen when WindowProcessController sends the new config to the client
  before WindowState does. In this case, the client needs to obtain the
  window frame from the server.

- When the position and the size of the frame are both changed. This
  will trigger a BLAST sync, and the client needs to obtain the sync seq
  ID.

For cases above, the client needs to call the original relayout method.

Bug: 161810301
Bug: 175861051
Test: Seamless rotation, fixed rotation, and regular rotation.
Merged-In: Ifb365789fa08103773fd3180e486ba1d92042fc5
Change-Id: Ifb365789fa08103773fd3180e486ba1d92042fc5
2022-08-16 12:49:31 +08:00
Fiona Campbell
43ca1914b2 Ensure animation scales are within bounds
Ensure that all uses of TRANSITION_ANIMATION_SCALE setting are bounded
between 0 and 20.

Bug: 238178261
Test: adb shell dumpsys window windows | grep "Animation setting"

Change-Id: I01aeeeddcbcdce0824d61db6b8f4a8946595131d
2022-08-15 11:16:33 +00:00
Ming-Shin Lu
caeb909eac Fix IME jumpcut when playing user IME animation after IME restarted
There are 2 cases that will seeing IME jumpcut when IME insets animation
is controlled by the app during IME prcocess being killed & restarted:

1) When IME process been killed for some reasons
 (e.g. force-stop package ), during IME restarting,
 DC#computeImeTarget will select the remote insets target as the control
 target and deliver IME leash to WM shell. If the focused window is
 not in multi-windowing mode, it may have a timing that IME surface
 may unexpectedly shown when starting insets animation from the remote.

2) Previously CL[1] fixed an IME surface visiblity issue when enabling
 shell-transition that related to somehow IME insets source visibility
 out of sync with the actual IME surface visiblity. The CL fix is
 setting IME surface alpha value according to the requested visiblity in
 InsetsSourceConsumer#setControl as a workaround. However, this may
 cause a side-effect that after IME restarted and leash updated,
 when the app requests showing IME animation, system calls setControl to
 the client to set the same leash after IME onPostLayout, then
 applyRequestedVisibilityToControl will be called before the
 insets controller calls setInsetsAndAlpha for the animation, if the
 IME requested visibility has visible, IME jumpcut will happen.

To fix this issue:
For 1), returning null control target in DC#computeImeTarget for
the above special case.

For 2), with CL[2] can fully fixed IME visiblity issue by letting the
client know the initial visibility of an InsetsSourceControl and
correctly animate insets when delivering the new leash or the
visibility change of the InsetsSourceControl. for delivering same
leash to request animation case, adding a check to call
applyRequestedVisibilityToControl only when there is no running
animation.

[1]: Iaacdf5f57e68b928e2a19036cbd8a137cf320497
[2]: I2c02e97e191ebd83238c0c54908e861d200d4c8d

Fix: 239808087
Bug: 209064170

Test: atest DisplayContentTests InsetsSourceConsumerTest
Test: manual test steps in b/239808087#comment2
Test: manual test as steps in b/209064170
   0) Enabling shell-transition
   1) Launching camera app
   2) Swiping camera app to launcher
   3) Verify status bar appear animation works

Change-Id: I242517a9214b36049d94e89d1ee63ffe505b91ac
(cherry picked from commit 8945b5bcfc)
2022-08-15 01:23:40 +00:00
Vishnu Nair
e0b684f7d0 SurfaceView: Revert SurfaceLock locking changes
This reverts commit 9e3cd0533f
and commit 74c760394a.

Initially we made a change to address a performance issue
in SurfaceView caused by holding the mSurfaceLock whenever
we went though the updateSurfaces loop. This had a side
effects of causing an ANR since the locking order changed.

The followup fix removed the lock but broke some API
contracts around lock and unlock canvas.

Subsequent fixes, which never went into QPR, introduced
new issues. Changing the locking order is too risky
QPR so lets revert and try to rework the locking
mechanism in U.

Test: app in b/234006724 does not ANR
Test: app in b/235188096 does not crash
Test: app in b/239895124 does not ANR
Test: app in b/239142077 does not crash
Test: atest SurfaceViewTest

Bug: 235188096
Change-Id: I99c5bb707ecad7c8d3c1fbd8b4105a77d58c145d
2022-08-12 17:35:40 +00:00
Joanne Chung
9325f9b97e Fix system toolbar doesn't use correct theme.
The toolbar should set the theme to the app's theme. Because the
service cannot get the application context, we should pass this
information from application to service.

Bug: 218833400
Test: manual. Use light/dark theme for app, the toolbar shows with
the same theme
Test: atest TextViewIntegrationTest
Test: atest android.widget.TextViewActivityTest

Change-Id: I6d4e4e117c680ce57e760a87987059eded09b2bc
2022-08-12 16:54:34 +00:00
Ming-Shin Lu
bb40322347 Fix toggleSoftInput can't hide IME when the app in multi-window mode
CL[1] changed toggleSoftInput behavior with checking the last IME
requested visibility by using
ImeInsetsSourceConsumer#mRequestedVisible to toggle IME.

However, ImeInsetsSourceConsumer#mRequestedVisible will be updated only
when:
1) The IME insets is controllable for the app.
2) The caller uses WindowsInsetsController#{show, hide}

Since by design when the app is in multi-window mode, SystemUI will
take over the insets control for synchronizing task resizing / IME
animation concern, so it ends up making the app unable to receive IME
insets control then affects toggling IME visiblity.

Even though toggleSoftInput has been deprecated since Android S, we
still requires to support its functionality for old apps run in some
platforms by default in multi-window mode (e.g. ARC++ in freeform
windowing mode).

To fix the issue, replace the check logic with
getRootWindowInests().isVisible(ime()) to check the last IME visiblity
from the root window the served view.

[1]: I390dc029e7bcc30c200926a9bfbbbd0268a1f714

Bug: 240886131
Test: atest KeyboardVisibilityControlTest#testToggleSoftInput in ARC++
Change-Id: Iaf7ccc17a7c02711000983db0d65ad095fe9f8fa
2022-08-12 14:09:05 +00:00
Tony Huang
e3f070a172 [Re-land] Remove getSfInstance usage from ViewRootImpl
The getSfInstance usage on ViewRootImpl is target to reduce jank
when moving split divider, but legacy split is going to be depracated
and it didn't used on new split too so we can remove whole related
codes safely.

Bug: 222696368
Test: build pass
Change-Id: Id492c738942c2e01fce85c231350d16ef88242f5
2022-08-12 06:13:16 +00:00
Riddle Hsu
62b637a788 Merge "Detect layout change of paramsForRotation precisely" into tm-qpr-dev 2022-08-11 11:43:13 +00:00
Mihir Patel
25192d7d0c Merge "Reporting the Autofill IDs and Positions of active views in list view" into tm-qpr-dev 2022-08-10 16:35:13 +00:00
Winson Chung
5f7ead346d Merge "Add some client side logging for interrupted draws to the dump" into tm-qpr-dev 2022-08-10 15:56:12 +00:00
Wilson Wu
2ac25627d8 Refine {SHOW,HIDE}_MY_SOFT_INPUT constants
Naming of SoftInputShowHideReason#{SHOW,HIDE}_MY_SOFT_INPUT
constants may not clear enough to indicate its semantics.

Improve show/hide reasons of InputMethodService by:

-. Update constants naming to {SHOW,HIDE}_SOFT_INPUT_FROM_IME.
-. Introduce respective reasons to indicate different hide request
   cases within IME process.

Bug: 224565148
Bug: 241890033
Test: presubmit
Test: atest CtsInputMethodTestCases and observe logs
Change-Id: I8b148e9b5ab05ff7b827c6b8fe23008ca30a8c4b
Merged-In: I8b148e9b5ab05ff7b827c6b8fe23008ca30a8c4b
2022-08-10 11:51:59 +08:00
Mihir Patel
a6e0f74c90 Reporting the Autofill IDs and Positions of active views in list view
Test: atest CtsContentCaptureServiceTestCases, observed events reported only once on scroll and stop as well as on fling
Bug: 211899037
Change-Id: Id67fcc360bf63fcab1d9f345c31d2bf7b9a173d6
2022-08-09 15:37:50 -07:00
Winson Chung
32e2b596d2 Add some client side logging for interrupted draws to the dump
In particular, these are to try and narrow down why the app window isn't
drawing in b/235463625 where the draw state for launcher is stuck in
DRAW_PENDING.

- mLastReportNextDrawReason: the reason the last draw was requested,
  maybe useful in telling if wm is not requesting a draw if not set
- mLastPerformTraversalsSkipDrawReason: the reason perform traversals
  returned without drawing (includes wm/predraw cancel reasons)
- mLastPerformDrawSkippedReason: the reason perform draw returned
  without drawing
- mLocalSyncState: extra logging to confirm that the last sync actually
  completes

Bug: 235463625
Test: dumpsys -T 60000 activity -v all
Test: dumpsys activity activities
Change-Id: I10118470fe62075920e9ce29fe449b0cfc8570c9
Merged-In: I10118470fe62075920e9ce29fe449b0cfc8570c9
2022-08-09 21:08:32 +00:00
TreeHugger Robot
3c6d6b5232 Merge changes from topic "desktop-windowing-flags" into tm-qpr-dev
* changes:
  SysUI flags to support desktop windowing proto
  Update flag constant for caption on shell
2022-08-09 01:44:18 +00:00
Riddle Hsu
e59483dc1c Detect layout change of paramsForRotation precisely
WindowManager.LayoutParams doesn't override equals(). It returns
false if the instances are different. So after writing/reading
from parcel, even if the fields are identical, the comparison
of Arrays.equals(paramsForRotation, o.paramsForRotation) always
returns false.

This is the first step as a signal to decide whether the screen
configuration needs to be recomputed according to if there is a
layout change from decor windows.

Bug: 238399969
Test: atest FrameworksCoreTests:android.view.WindowParamsTest

Change-Id: I82582ff48064bbf009403d2c0980a69157860f90
2022-08-08 23:06:28 +08:00
TreeHugger Robot
e2823f9a50 Merge "Fix some issues that make caption insets remain" into tm-qpr-dev 2022-08-05 18:45:00 +00:00
Ats Jenk
4f279bac32 Update flag constant for caption on shell
System properties under persist.debug namespace can't be modified by
SystemUI. aosp/I5808bf92dbba37e9e6da5559f8e0a5fdac016bf3 introduced a
new namespace, persist.wm.debug that can be used for system properties
that can be overridden from SystemUI.
Move captions_on_shell to this namespace so we can update this flag from
SystemUI to simplify enabling it on devices.

Bug: 241464028
Test: build succeeds
Change-Id: Ifcf54b6dfa70ca52dfb51fb2f7f2e67d0568566a
2022-08-05 11:21:22 -07:00
Garfield Tan
6a2e636f34 Fix some issues that make caption insets remain
This CL does the following:
* Remove caption insets when releasing the window decor
* Update caption insets in InsetsController when the caption is in WM
  shell
* Dump LocalInsetsSourceProviders to help debug related issues

Bug: 241029178
Test: The caption type of insets provider is removed when window decor
      is released.
Test: atest WindowDecorationTests
Change-Id: Ia20e1958588de3a7d965b3ac3d3e4333c67dff36
2022-08-03 12:57:27 -07:00
Arthur Hung
034c4ee421 Mark IWindowFocusObserver as oneway interface
It used to notify if the window focus is gained or lost, mark it as
oneway to prevent it block the system server when outgoing.

Bug: 238050065
Test: Trigger back gesture and see the logs
Change-Id: I17b79a361edadf03d2b2887cce7ec29c3968e3e5
2022-08-03 08:08:26 +00:00
TreeHugger Robot
5c0ba8f0f5 Merge "Add willShowImeOnTarget in RemoteAnimationTarget(Compat)" into tm-qpr-dev 2022-08-02 13:05:02 +00:00
Joanne
b680cb5257 Fix translation session id collision bug.
Currently the session id is genrated from a static random number
generator created with new Random(), all has the same seed value
in the given Context, so the sequence it generates is identical
across processes

Ideally the id should be generated from a center controller to
avoid collision, the content capture met the same problem before.
Follow the same solution used in content capture, we use SecureRandom
which produces non-deterministic output. But it still good to come out
a more stable solution in the future release.

Bug: 239385816
Test: manual
Test: atest CtsTranslationTestCases
Change-Id: Ie75acfa6a55a58e0c0a709f2a5ae1c6e5d6dc339
2022-08-02 12:21:42 +00:00