Commit Graph

848 Commits

Author SHA1 Message Date
Evan Rosky
39d28a2ef4 Plumb Scene-transition tag through shell transitions
This was being ignored, but we should plumb the information
through so that the defaulthandler doesn't apply an animation
on top of the scene-transition (which expects a jumpcut).

Bug: 190806800
Test: take screenshot, then pres edit button
Change-Id: Ib1bda6220012cf3b8f85fccac4cc50e1327b9886
2023-04-28 13:22:39 -07:00
Chavi Weingarten
dd33ac87b4 Merge "Ensure overlapping syncs don't submit buffers out of order" into udc-dev 2023-04-20 14:04:43 +00:00
Eghosa Ewansiha-Vlachavas
8f25ff0ef7 Merge "Replace compat UI related z values with constants in TaskConstants" into udc-dev 2023-04-20 10:56:01 +00:00
Evan Rosky
d780bfaace Add support for multiple animation tracks
The shell-transition player "Transitions" only supported
playing one animation at a time. It supported limited
support for concurrent animation via `merging`, but this
is for specific/curated situations. Since support via
merge is complicated, there weren't many implementors and
instead, by default, animations would just jump-to-end
to allow the next animation to start immediately (to
minimize perceived latency).

Unfortunately, if there are TRULY independent transitions,
this mechanism is unweildy as it'd require adding support
for any incoming transition into any active animation.

This CL moves the existing queue/merge mechanism into a
"track" and then adds support for multiple tracks to play
simultaneously. This way, for transitions which aren't
independent, the mechanism doesn't change; however, for
truly independent transitions, their corresponding
animations can also run independently.

The expectation is for WMCore to assign track ids to
transitions. Then the player (Transitions.java) can
use this information to either play them in parallel
or, in the future, do some type of merging on its own.

The default is that, all transitions with the same
track-id will play in the same track and serialize
with eachother -- but otherwise the tracks are independent.

There may, however, be some situations where a transition
might conflict with more than 1 track. In this case,
we just fall-back to a global "SYNC" and basically wait/
flush all the running animations/tracks before starting.
Supporting anything fancier is not worth the effort since
this situation isn't likely to be very common.

This SYNC is actually implemented by just generalizing the
existing SLEEP failsafe mechanic. We now just treat an
incoming SLEEP the same as SYNC.

Bug: 277838915
Bug: 264536014
Test: atest ShellTransitionTests
Test: this change, alone, should be a no-op so existing tests too.
Change-Id: I97ca21e0917be884cac105a6cb2d2c656f0e4207
2023-04-19 10:14:12 -07:00
Eghosa Ewansiha-Vlachavas
e84bed2135 Replace compat UI related z values with constants in TaskConstants
Introduce a new constant in TaskConstants for compat UI components,
unifying previous individual constants.

Replace z-values in compatui window manager classes and in
Letterbox.

Fixes: 262403744
Test: atest WMShellUnitTests:LetterboxEduWindowManagerTest
Test: atest WMShellUnitTests:ReachabilityEduWindowManagerTest
Test: atest WMShellUnitTests:CompatUIWindowManagerTest
Test: atest WMShellUnitTests:RestartDialogLayoutTest
Test: atest LetterboxTest
Change-Id: If5e22014e38f22c0bd4371da459b52486c7f2d27
2023-04-19 15:28:22 +00:00
Chavi Weingarten
75e2d5131b Ensure overlapping syncs don't submit buffers out of order
This change will ensure that if multiple SurfaceSyncGroups are created
for the same ViewRootImpl the SurfaceSyncGroups will maintain an order.
The scenario that could occur is the following:

1. SSG1 is created that includes the target VRI. There could be other
   VRIs in SSG1
2. The target VRI draws its frame and marks its own active SSG as ready,
   but SSG1 is still  waiting on other things in the SSG
3. Another SSG2 is created for the target VRI. The second frame renders
   and marks its own second SSG as complete. SSG2 has nothing else to
   wait on, so it will apply at this point, even though SSG1 has not
   finished.
4. Frame2 will get to SF first and Frame1 will later get to SF when
   SSG1 completes.

The code ensures the SSGs that contains the VRI maintain an order. What
happens here is we create a new SSG that's a placeholder. Its only job
is to prevent a SSG from completing. The active SSG for VRI will add a
transaction committed callback and when that's invoked, it will mark the
placeholder SSG as ready. If a new request to create a SSG comes in and
the placeholder SSG is not null, it's added as part of the new active SSG.
A new placeholder SSG is created to correspond to the new active SSG.
This creates a chain to ensure the latter SSG always waits for the former
SSG's transaction to get to SF.

Test: SurfaceSyncGroupTests#testOverlappingSyncsEnsureOrder
Test: WmTests:com.android.server.wm.SurfaceSyncGroupTests
Bug: 272189296
Change-Id: I921d78e347ecfb9786ebe4643308b347c5436332
2023-04-18 14:31:29 +00:00
Omar Miatello
fc0e17a688 Merge "Add isAnimationCallback() in BackNavigationInfo" into udc-dev 2023-04-18 12:29:06 +00:00
omarmt
47e45086db Add isAnimationCallback() in BackNavigationInfo
This method returns if the callback is an OnBackAnimationCallback.
This value can be serialized and can be used to determine whether or not to run predictive animations when you have no way to check the callback directly, for example in the BackAnimationController you only have access to the IOnBackInvokedCallback.

Why?
OnBackAnimationCallback is used by apps that want to play a custom animation when the user swipes back.
OnBackAnimationCallback exposes BackEvent every time there is a new progress value.

Ideally, we would like to expose the velocity only on the last progress value (or onBackInvoked()), but to do that we have to change the API. We are unable to do so now.

Therefore, we decided to handle the fling gesture in the system instead. As a result, we now need to determine if the app supports OnBackAnimationCallback so that we only send the fling if we have an OnBackAnimationCallback registered.

BackAnimationController can now produce more back events. This is done by producing more events when the user lifts their finger. This way, the developer does not have to handle the fling gesture. This approach was chosen because the velocity cannot be exposed in the BackEvent.

Test: atest BackNavigationControllerTests
Bug: 263402927
Change-Id: I4d85253c9ade39f35ef0d8c70c6b1c7c31b1390d
2023-04-14 18:53:14 +00:00
Chavi Weingarten
04b8bdf0c8 Ensure transaction is applied if added after SSG is complete
If a caller adds a Transaction to a SSG after its already complete, make
sure to immediately apply the Transaction and log a warning. It's better
for the Transaction to get applied instead of waiting around forever.

Also cleaning up some logs in SSG

Test: SurfaceSyncGroupTests
Bug: 272189296
Change-Id: I6810c5e0c20f3fd5c7d8bde16f24bc05a0495b4f
2023-04-13 00:01:13 +00:00
Omar Miatello
8e35c9eb8b Merge "BackMotionEvent: add velocity (in pixels/second)" into udc-dev 2023-04-11 12:44:22 +00:00
Stefan Andonian
7bcd1038f6 Merge "Write ViewCapture data to WmTrace when WindowManager dumps." into udc-dev 2023-04-05 20:19:40 +00:00
omarmt
4ad57489bf BackMotionEvent: add velocity (in pixels/second)
The velocity of the `BackMotionEvent` will be used to fire additional events when the user lifts their finger.

Note: Velocity is calculated for the last event only, for performance reasons (see `VelocityTracker.computeCurrentVelocity`).
`Float.NaN` will indicate that the value has not been calculated.

Test: atest BackAnimationControllerTest
Bug: 263402927
Change-Id: I301636f572eb4e59abc69f6fee11d8dba5647a16
2023-04-05 12:16:30 +00:00
Ajinkya Chalke
fd2730a054 Fix NPE in ScreenCapture.release method.
Bug: 276941014
Test: Manual test

Change-Id: I3675d8d3479ae0f514f0e113ddbf23e85b13e936
2023-04-04 21:22:00 +00:00
TreeHugger Robot
8f23f6bb53 Merge "Move exclude layer to CaptureArgs." into udc-dev 2023-04-04 00:25:56 +00:00
Ajinkya Chalke
dfc93ddcad Move exclude layer to CaptureArgs.
Test: atest ScreenCaptureTest ScreenCaptureChildOnlyTest
Bug: 267324693
Change-Id: I796dbb3dbc83da37a54ef36a7d05cf0ba7e0c431
2023-04-03 20:49:04 +00:00
Stefan Andonian
3c492d8644 Write ViewCapture data to WmTrace when WindowManager dumps.
This allows apps like the Launcher to write ViewCapture data to the
wmtrace directory so it can be shown in their UI. Normally, Launcher
doesn't have the correct file permissions. Also, Launcher's dump method
is called after the wmtrace dir is written to the bug report, so we need
to dump sooner via a callback method invoked inside WindowManager.

Bug: 224595733
Test: Latency tested this change and verified that a bugreport generated
the file properly, moved it to the wmtrace directory, and was picked up
properly by the go/web-hv tool.

Change-Id: I9dc8e61070d2470354b79c1758103f9b2b00ac36
2023-04-02 04:07:55 +00:00
Evan Rosky
597811e84e Merge "Improve transition logging" into udc-dev 2023-03-31 20:43:15 +00:00
Evan Rosky
7355478fe7 Improve transition logging
This passes a "debug" id along with transitioninfo
so that we can correspond transitions across processes.

Also adds debug-names to remotes so that they can
be identified across processes as well.

Bug: 276349701
Test: just added logs, so no tests needed.
Change-Id: If67524f8a82de366db2f96c8821b08eaec45ecb5
2023-03-30 17:25:16 -07:00
Evan Rosky
e392103533 Add to-top reporting to transitions
This will include a CHANGE info for tasks which have
moved to top while still visible. This allows recents to
be reported when a translucent task is running and also
provides a hook for multi-window order changes.

This also recalculates back-tasks on transient-launch finish
since, otherwise, the behind activity isn't paused. This
was because it wasn't changing visibility and just re-ordering
doesn't recalculate lifecycles.

Bug: 274696524
Test: TransitionTests#testMoveToTopWhileVisible
      Start a translucent task, enter recents, then restore the task.
Change-Id: If21d076eed4db88139ffc8a7c4c018c2ef5aad93
2023-03-30 12:48:56 -07:00
Wei Sheng Shih
d55c38e435 Merge "Play seekable animation for customize activity transition API.(2/N)" into udc-dev 2023-03-28 11:43:09 +00:00
Tiger
053dba3e07 Make WindowContainerTransaction add and remove insets with public types
This CL adds a new source SOURCE_ARBITRARY_RECTANGLE for the caller to
specify an arbitrary rectangle as the insets source frame in
InsetsFrameProvider. WindowContainerTransaction can use it to add and
remove insets with public insets types. This is a step to remove ITYPEs.

Bug: 234093736
Test: Presubmit
Change-Id: Ia9a851fe5bd0d09e4af9d170c839da5d0f8bf605
2023-03-24 17:30:53 +08:00
Riddle Hsu
765faeb31c Remove property of window insets lazy getter
So far it is no problem so make it default behavior.

Bug: 151908239
Test: android.view.WindowMetricsTest
Change-Id: Ia56699786c57a95aff38e78f458b2dbe6793f22f
2023-03-22 22:42:43 +08:00
wilsonshih
850d69d3c8 Play seekable animation for customize activity transition API.(2/N)
Add supporting for Activity#overrideActivityTransition.
The CustomizeActivityAnimation will load both enter and exit animation
for the close activity transition. And it is only valid if the exit
animation has set and loaded success. If the entering animation has not
set(i.e. 0), there will load the default entering animation for it.
Also note that if both overrideActivityTransition and windowAnimations
has set, system should prior to load the animation set from
overrideActivityTransition.

Bug: 259427810
Test: atest ActivityTransitionTests BackNavigationControllerTests\
CustomizeActivityAnimationTest

Change-Id: Id182dc8f93f55a256de68c1fb6cc91fd08450e3e
2023-03-20 10:55:07 +08:00
Massimo Carli
6c340b3af3 Merge "Force Kids app to use LANDSCAPE when in REVERSE_LANDSCAPE" into tm-qpr-dev am: 4ad16867ee am: 2e27a9c9e7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21798742

Change-Id: I1c10f7c2e9ae3def5b0e5062f48f7354b44dfd2e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-17 17:12:54 +00:00
Massimo Carli
2e27a9c9e7 Merge "Force Kids app to use LANDSCAPE when in REVERSE_LANDSCAPE" into tm-qpr-dev am: 4ad16867ee
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21798742

Change-Id: Iecf95b07963d48615088b42127d26e3877780ca2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-17 16:51:45 +00:00
Massimo Carli
4ad16867ee Merge "Force Kids app to use LANDSCAPE when in REVERSE_LANDSCAPE" into tm-qpr-dev 2023-03-17 16:10:30 +00:00
Massimo Carli
65ffa6db92 Force Kids app to use LANDSCAPE when in REVERSE_LANDSCAPE
A few apps in Kids Space request "reverseLandscape" orientation when
Display#getRotation returns ROTATION_270 expecting it to correspond
to the seascape display orientation while it may correspond to the
landscape one when config_reverseDefaultRotation is set to true.

This CL overrides the "reverseLandscape" orientation with "landscape"
in the context of apps running in the Kids space when
config_reverseDefaultRotation is set to true

Fixes: 265589619
Test: Run `atest WmTests:WindowManagerServiceTests`
      Run `atest WMShellUnitTests:KidsModeTaskOrganizerTest`
      Run `atest WmTests:LetterboxUiControllerTest`

Change-Id: I85688413571478f5acaa340624bb470f5aeb422f
2023-03-17 13:50:33 +00:00
Louis Chang
af5033e80b Merge "Remove the layer of task overlay activities" into udc-dev 2023-03-17 02:57:51 +00:00
Louis Chang
2d967e45be Remove the layer of task overlay activities
The task overlay activities should be on the same layer as
other activities in the task. It is already ensured to be
on top of other activities by making it always-on-top in wm
hierarchy.

Bug: 262404281
Test: build and presubmit
Change-Id: I0f4123355d711acb3a87e91c9523468f789da154
2023-03-15 03:10:59 +00:00
Vishnu Nair
6e40151c65 Merge "Set timeouts for SurfaceSyncGroup based on HW timeout" into udc-dev 2023-03-14 18:57:58 +00:00
Ats Jenk
12ec92ef30 Merge changes I1c8db490,I96539176 into tm-qpr-dev am: 3b5f927e0f am: e74b5581e2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21995209

Change-Id: I68e5cfdef4af17df55fc6d75ac7672100a4bab6f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-14 17:13:53 +00:00
Ats Jenk
e74b5581e2 Merge changes I1c8db490,I96539176 into tm-qpr-dev am: 3b5f927e0f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21995209

Change-Id: If6c3c55a5422a19fca21b7e58dbe4df6181366f1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-14 16:51:17 +00:00
Wei Sheng Shih
d5bfc15d3c Merge "Set TaskSnapshotWindow no InputChannel." into udc-dev 2023-03-14 08:28:04 +00:00
Wei Sheng Shih
008b3f1007 Merge "Do not draw snapshot starting window if allocate graphic buffer fail." into udc-dev 2023-03-14 01:45:39 +00:00
Evan Rosky
f8bbb00ca8 Merge "Add support for multiple roots in a transition" into udc-dev 2023-03-14 00:43:29 +00:00
Patrick Williams
182f57ef53 Merge "Add isTrustedOverlay field to WindowInfo" into udc-dev 2023-03-13 22:03:06 +00:00
Ats Jenk
6a3d39104b Enable overriding density for desktop tasks
Add a new API to WindowContainerTransaction to support updating the
container density.
This allows us to update the configuration object with a new density
value that would get applied by the WindowOrganizerController.
Allow list density changes in WindowOrganizerController as an allowed
configuration change.
Update DesktopTasksController to change the density value when moving a
task to desktop or back to fullscreen (if enabled).
Use system property persist.wm.desktop_mode_density to override the
density for desktop tasks. Allowed range for the density override is 100
to 1000.

Bug: 272529050
Test: atest DesktopTasksControllerTest
Change-Id: I96539176252fdd5b69b02e3bd1b6a4231990decb
2023-03-13 13:56:56 -07:00
Vishnu Nair
9d28de67f3 Set timeouts for SurfaceSyncGroup based on HW timeout
SurfaceSyncGroup is timing out on an emulator target. Use
ro.hw_timeout_multiplier to address this and other slow
target.

Test: presubmit
Bug: 273314551
Change-Id: I83dc352a24caabba2429ecf3f76c63500fa8a44d
2023-03-13 13:54:47 -07:00
wilsonshih
f4309a7b2a Do not draw snapshot starting window if allocate graphic buffer fail.
Preventing NPE crash.

Bug: 271472871
Test: simulate GraphicBuffer#create fail in SnapshotDrawer, and verify
no crash.

Change-Id: If3f9ad38a9b256f59bfd96258e43decb896a3604
2023-03-13 10:24:01 +00:00
Patrick Williams
117a5d9375 Add isTrustedOverlay field to WindowInfo
Bug: 263311858
Test: n/a, adds field for use in tests
Change-Id: I638f170ebe00e084528983e1b8455af6d14faa05
2023-03-10 11:59:36 -06:00
Evan Rosky
ee41c09e19 Add support for multiple roots in a transition
Each display needs its own root, so transitions that span
multiple displays will require multiple roots and correspondence
between members and their associated displays.

Bug: 261418859
Test: TransitionTests ShellTransitionTests
Change-Id: I02022fe610a43eef6c03b5729e77a7fcbc4674ca
2023-03-10 02:09:05 +00:00
wilsonshih
b109d69fef Set TaskSnapshotWindow no InputChannel.
TaskSnapshotWindow has no need to process any input events.
If it has a valid InputChannel but no InputEventReceiver,
it won't receive events sent by InputDispatcher like TouchModeEvent.
This may cause an ANR.

Test: when TaskSnapshotWindow is showing, verify that touch on
Notification shade won't trigger ANR on TaskSnapshotWindow.

Bug: 271552817

Change-Id: I9595b15fa277ebff4be375eed220cb57533a1a2c
2023-03-09 14:21:23 +08:00
Kazuki Takise
134ca1cc4b Add TASK_LAUNCHING_BEHIND to change flags
When ActivityRecord#mLaunchTaskBehind is true, the newly-launched
task is positioned behind home. However, for compatibility reasons,
it's marked as visible, so there's no way for Shell to tell if a
newly launched task should be shown to the user or not.

This CL adds a transition change flag for this purpose.

Bug: 268178951
Bug: 268130984
Bug: 268131581
Test: atest StartActivityTests#testStartActivityTaskLaunchBehind
Change-Id: I3c5b517de5c56fe365cc9dd487e7d42dfa584513
Merged-In: I3c5b517de5c56fe365cc9dd487e7d42dfa584513
(cherry picked from commit 7c56142676)
2023-03-09 01:39:26 +00:00
Chavi Weingarten
383e85af11 Merge "Add timeouts for SurfaceSyncGroup" into udc-dev 2023-03-09 01:20:28 +00:00
Wei Sheng Shih
06dfb81049 Merge "Play seekable animation for customize activity transition API." into udc-dev 2023-03-08 09:02:48 +00:00
Wei Sheng Shih
0b2aa2953a Merge "Revert^2 "Introduce Windowless starting window."" into udc-dev 2023-03-08 04:58:55 +00:00
wilsonshih
946871eb75 Play seekable animation for customize activity transition API.
For cross-activity animation, support seekable animation if app
has customize activity exit transition by Window#setWindowAnimations or
android:windowAnimationStyle.
Because there could fall back to default cross-activity animation when
the customized animation was not able to load, defer assigning the
mActiveCallback when received onAnimationStart.

Bug: 259427810
Test: verify customized animation can play.
Test: atest BackNavigationControllerTests BackAnimationControllerTest\
CustomizeActivityAnimationTest

Change-Id: I59dc6ef75a226c634b06f483aeed7aec03087d18
2023-03-07 18:40:23 +08:00
Patrick Williams
f810101b76 Add WindowInfosListenerForTest
Adds wrapper class WindowInfosListenerForTest that enables using
WindowInfosListener in tests.

Bug: 263311858
Test: presubmits
Change-Id: I8a5f83b0557db26aa0d05e1ffdfcbb7d374afc38
2023-03-06 15:28:07 -06:00
Wei Sheng Shih
565f82743e Revert^2 "Introduce Windowless starting window."
This reverts commit c930398694.

Reason for revert: reland ag/20426257

Refine the file strcutre. The remove window process now extract as an
interface, each type of starting window can handle it based on
different scenario.

For legacy starting window:
  Splash screen window and related API => SplashscreenWindowCreator
  Task snapshot window related => SnapshotWindowCreator

Support windowless starting surface:
- Draw splash view to a surface => WindowlessSplashWindowCreator
  A simple splash screen view with a static icon on it. It can play
  default reveal animation while remove.
- Draw snapshot to a surface => WindowlessSnapshotWindowCreator
  Similar to TaskSnapshotWindow just no window. It will play a fade
  out animation while remove because there is no default window
  animation.

Add another callback IWindowlessStartingSurfaceCallback for windowless
starting surface. Unlike starting window, there is no "addWindow"
signal to let core know the surface is create.

Also note the windowless starting surface is just a surface, it won't
support window-like features such as configuration change or resize.

Bug: 257857570
Test: atest SplashscreenTests StartingSurfaceDrawerTests
Test: verify legacy starting window work. Simulate that create splash
screen view fail won't crash SystemUI process.

Change-Id: Id95be6a4ff9472955b4f2b717748a331b1fad804
2023-03-06 18:51:37 +08:00
Chavi Weingarten
e2c31ef391 Add timeouts for SurfaceSyncGroup
Ensure there are timeouts in case something goes wrong with each level
of the SurfaceSyncGroup. It's better to timeout and not blocking all
dependant SSGs.

The timeouts are the following:
1. VRI has a timeout when it has mPausedForSync > 0. If the timeout is
   invoked, that means someone was holding the SurfaceSyncGroup for VRI
   without adding it to any SurfaceSyncGroup.

2. If a SurfaceSyncGroup has been added as a child or a parent of
   another SurfaceSyncGroup, it will get a timeout set. This is because
   it can now affect other SSG and we don't want them blocking others.
   If they are a standalone SSG, we don't care if they don't complete
   since it only affects itself.

Test: SurfaceSyncGroupTest
Bug: 237804605
Change-Id: I1a7886f8d51764b82d8eb0408433f5d77d2299cc
2023-03-02 21:25:00 +00:00