Commit Graph

753 Commits

Author SHA1 Message Date
Evan Rosky
6e895c09c9 Merge "Fix surface release race when using Shell Transitions" into sc-dev 2021-04-24 01:29:41 +00:00
Evan Rosky
52f6451203 Fix surface release race when using Shell Transitions
Shell Transitions operates on the leashes both before and
after the animation in order to adapt shell transit to the
legacy transit impls in launcher.

This means we can't release the surfaces before the finish
callback. Since the finish callback provides a convenient place
to release the surfaces anyways, we can effectively disable
the release here.

Bug: 186158221
Test: enable shell transit, physically rotate to landscape,
      launch messages and then close it (back-gesture) repeatedly
      and observe that launcher doesn't crash.
Change-Id: Ibdc958b1fd18d66a013d94b70772ce49409fb4c1
2021-04-23 14:49:48 -07:00
Tony Wickham
5117aa2835 Set PendingIntent as FLAG_IMMUTABLE
Test: compiles
Fixes: 174161910
Change-Id: I3e06e41aafc97670b7aa9ed0d873b69eaf1c635c
2021-04-23 10:48:22 -07:00
Hongwei Wang
b899f626b6 Merge "Apply PictureInPictureSurfaceTransaction upon reparent" into sc-dev 2021-04-23 05:17:12 +00:00
Hongwei Wang
0df585fb8d Apply PictureInPictureSurfaceTransaction upon reparent
When autoEnterPip from Task with multiple activities, besides passing
the mLastRecentsAnimationBounds we should also try to pass the last
PictureInPictureSurfaceTransaction to the new Task and apply both.

Changed also
- deprecate the last recents animation bounds and use the transaction only
- reset the transform once applied to the original task

Known issue: original task appears transparent in overview once.

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/hNZ0H62PqgVDEUGh1TVMiT
Bug: 184789412
Bug: 185509920
Test: manual with ApiDemos, see Video
Change-Id: I7fb77e41e1963e14ecaf53bd135d6b4cb24493c9
2021-04-22 11:14:44 -07:00
Evan Rosky
d1d54a14ef Merge "Initial implementation of merge-able transitions" into sc-dev 2021-04-22 17:04:13 +00:00
Evan Rosky
3fef7ff6e2 Initial implementation of merge-able transitions
This adds a couple things to support "merging" of transition
animations in shell.

1. Moves the finishing surface operations into a transaction that
   gets sent to shell. This does a couple things: it complies with
   the contract we have where during a transition, only the player
   should touch relevant surfaces; and, it makes it so that the
   player can merge the transaction with other ones.

2. Keeps a queue of "pending" transition animations in shell and
   either merges them or runs them serially.

3. Any transition that becomes ready while another is playing will
   first be sent to the playing handler to give it a chance to
   "merge" the incoming transition.

There are 3 expected responses to overlapping transition animations:
1. Cancel the currently playing transition and immediately start
   the incoming one. This can be achieved by having the currently
   playing transition cancel itself (ie. immediately finishing) when
   a merge request comes in. Then the rest of the shell transition
   logic will immediately start the next transition.

2. Queue up the incoming transition to play once the current one
   finishes animating. This is basically the default as long as
   the current transition simply rejects/ignores merge requests

3. Merge the incoming transition. This is achieved when the
   currently playing transition actually does some special logic
   to handle the incoming transition. It then calls the finish
   callback for the incoming transition (before it finishes its
   own animation) to indicate that it has been merged (or "consumed").
   Basically, any time the finish callback for a transition is
   called before a pre-ceding transition, that transition is assumed
   to have been merged.

Bug: 183994113
Test: atest ShellTransitionTests
Change-Id: I3cb54e221d57642306ddf15827c21d8881b014d0
2021-04-21 10:00:28 -07:00
Winson Chung
e5b567749e Skip some unnecessary allocations
- Move new matrix/rect construction to if the param is set on the
  builder, we only apply the params if the flags are set anyways
  and if the caller doesn't set those params then we are allocating
  new objects unnecessarily
- Always recycle motion event

Bug: 183756396
Test: Take memory profile when dragging pip
Change-Id: Ie7457c8c508ee61bd27daeebe486c39a5cebe7d7
2021-04-15 22:53:02 -07:00
TreeHugger Robot
14d6cdca25 Merge "InputMonitorCompat is no longer Parcelable" into sc-dev 2021-04-14 00:14:36 +00:00
Tony Wickham
1cac73d9bd InputMonitorCompat is no longer Parcelable
InputMonitorCompat is only instantiated directly now, so we can remove
old code for passing it from SysUi through Parcelable.

Test: compiles and runs locally
Bug: 185266621
Change-Id: I54e394c1eb9c702beeb5bbfbae7a140c29530c33
2021-04-13 14:42:01 -07:00
Rob Carr
211bf19cca Merge "Remove deferTransactionUntil" into sc-dev 2021-04-13 19:47:24 +00:00
Pedro Loureiro
d34f536b59 Add lint baseline to address NewApi errors
We are enabling a new lint check where the min sdk != compile sdk.
It has produced a lot of errors and adding the baseline file(s)
allows us to continue work without introducing more problems.

Bug: 150847901

Test: m lint-check
Change-Id: Ide8a8fe80ba31396f23853ab266afcbcc33af9a6
2021-04-13 10:51:51 +01:00
Evan Rosky
2bc5bd5168 Add shell transition handling for staged split-screen.
This makes StageCoordinator implement the TransitionHandler
interface.

In general, this currently expects 'enter' transitions to
contain 2 tasks (one in each split). The current UX is undefined
when one only one of the splits is occupied, so for now it will
throw an exception if that case is hit.

There is a split-screen API called startTasks which takes a list
of tasks (currently only supports 2) and associated options and
creates a transition to both enter split-screen and launch those
tasks into their respective stages.

These are the currently accounted-for entrypoints into
the handler interface:

- Core-initiated (handleRequest)
  - in split: trigger=HOME that is opening -> full dismiss.
  - in split: trigger=task with a stage parent that is last closing in
                    that stage -> dismiss with other stage onTop
  - NOT split: trigger=task with stage parent -> exception
- Shell-initiated
  - NOT split: startTasks -> enter split with 2 tasks
  - in split: snap-to-dismiss -> dismiss with other stage on top

Bug: 182002789
Test: atest SplitTransitionTests
      Or use the experimental pair-launch split-screen and observe
      protologs to see clean transition-infos.
Change-Id: I4f4dd431ad5642cf98b4a01c32eb1d09e5b9a11e
2021-04-09 13:13:56 -07:00
Robert Carr
c07e9b2140 Remove deferTransactionUntil
There are no uses in the tree.

Test: Existing tests pass
Bug: 168505645
Change-Id: If65a94103858188790991c765762a05657714395
2021-04-08 20:12:31 -07:00
Winson Chung
db41d72646 Merge "Expose the full task info with the remote animation target" into sc-dev 2021-04-01 03:56:55 +00:00
Marvin Bernal
68871a3d6b Merge "Add System Back function to SystemUiProxy" into sc-dev 2021-03-31 20:59:01 +00:00
Winson Chung
56dc281990 Expose the full task info with the remote animation target
- Allows launcher to get the associated launch cookies for
  the task

Bug: 129067201
Test: Manual, check the task info for the animation targets

Change-Id: I4b9d974af1732d0ec7b19681f4772b692f614e5e
2021-03-31 09:59:03 -07:00
shawnlin
bd374dc399 Support windowType in RemoteAnimationTargetCompat
Bug: 181638132
Test: make
Change-Id: I84a439866f69a66339a6b318757850f7e111ef5d
(cherry picked from commit 1a27741b35)
2021-03-31 06:33:44 +00:00
Marvin Bernal
38644e35ac Add System Back function to SystemUiProxy
Bug: 183988752
Test: Tested with foldable launcher prototype in ub-launcher3-foldable-exp (ag/14020347)
Change-Id: Id19445d9a11e314b57237235e4dcbf8dbcf289e7
2021-03-31 00:51:09 +00:00
Evan Rosky
0bdcf9b9c6 Merge "Add one-shot remote handler and remote runner interface" into sc-dev 2021-03-30 23:01:43 +00:00
Hongwei Wang
de204a5721 Apply the whole auto pip transaction in recents animation
Take the full transaction details passed from Launcher, including
position / windowCrop / scale / roundRadius and apply them in
RecentsAnimationController.TaskAnimationAdapter#onCleanup to make sure
the final state of autoEnterPip transition can be carried over.

Note: there are still several frames off when entering PiP from
landscape with autoEnterPip being enabled.

Bug: 179720719
Test: manually using the ApiDemos app
Change-Id: Ibfff75e09943960cfcd816d6c52a80d7a8af8fe8
2021-03-25 12:07:20 -07:00
Evan Rosky
eae6c92d2a Add one-shot remote handler and remote runner interface
This is the shell-transitions equivalent to RemoteAnimationRunner.

The OneShot handler is a utility to directly tie one call of a
remote transition to a specific transition (via
Transitions.startTransition) or as a general holder of a remote
for shell to use (taking care of binder lifetime and wrapping
callbacks).

Bug: 182002789
Test: ShellTransitionTests#testOneShotRemoteHandler
Change-Id: Ia405b133b18b4f132c8c841e74a6a264561df5a3
2021-03-24 19:56:45 -07:00
Ady Abraham
97190e25e9 Merge changes from topic "eEarlyWakeup_remove" into sc-dev
* changes:
  rename ExplicitEarlyWakeup -> EarlyWakeup
  Remove ISurfaceComposer::eEarlyWakeup
2021-03-19 17:39:19 +00:00
Winson Chung
d3d61ffefe Merge changes from topic "shell_feature_interfaces_reland" into sc-dev
* changes:
  2/ Add mechanism to expose other features directly
  1/ Add mechanism to expose shell feature directly (for Pip)
2021-03-19 06:55:31 +00:00
Winson Chung
caa6d6484f 2/ Add mechanism to expose other features directly
- Expose interfaces for splitscreen, one handed, shell transitions,
  starting window
- Make the shell code only reference the starting window controller and
  not the exported interface

Bug: 180074017
Test: atest WMShellUnitTests
Test: Verify Pip calls from Launcher work
Change-Id: Idafed90a8ed3382adfb4322b4b1797237be86a90
2021-03-18 20:12:07 +00:00
Winson Chung
2b72add7fd 1/ Add mechanism to expose shell feature directly (for Pip)
- Also split impl and controller for ShellInit/ShellCommandHandler
  (as with ag/13502602)
- Example implementation of exposing a subset of the Pip interface to
  Launcher directly.  This has the benefit of reducing unnecessary code
  in SysUI just to pipe calls to the Shell.

  The controller implements the binder interface which is collected
  and exposed to Launcher when it binds to the overview  service
  and Launcher can call through the binders directly.

  Note: this requires the shared lib to also build with the Shell
  interfaces so changes to the Shell aidls will still require updating
  the shared lib (until the shared lib prebuilt can removed).

Bug: 180074017
Test: atest WMShellUnitTests
Test: Verify Pip calls from Launcher work
Change-Id: Id74114da6a6a73d32c957f84fce5bbe23e87ba01
2021-03-18 20:04:49 +00:00
Ady Abraham
0a1bc33851 Remove ISurfaceComposer::eEarlyWakeup
The flag is deprecated.

Bug: 159125966
Test: build
Change-Id: Idc68ac200944a8ba9ce966faa5c9ffb2b5e5a5ea
2021-03-18 01:24:40 +00:00
Evan Rosky
1551cb7307 Initial support for display rotation in shell transitions
This puts display-content as another WC in a transition. It then
adds WC rotation to change tracking. If there is a rotation,
the shell-side handlers will play the transition.

This replaces ScreenTransitionAnimation, seamless-rotation, and
fixed-rotation:

 ScreenTransitionAnimation implementation will move to shell.

 seamless-rotation is redundant because the rotation setup is
 intrinsically "seamless": it requires shell to imbue an
 animation onto it rather than just doing the jump-cut.

 fixed-rotation is now just a custom animation where we
 counter-rotate the closing app on frame 1 and then perform
 the normal open animation on the opening app.

Bug: 179270750
Test: DisplayContentTests#testShellTransitRotation
      enable shell transitions and rotate the device or launch
      and close apps in different orientations.
Change-Id: I4bc23b2e614ba85bf9752f62da4c3f8d0c90436d
2021-03-17 15:08:10 -07:00
Hongwei Wang
3cd3a80f30 Merge "Settle auto PiP transaction in WindowContainerTransaction" into sc-dev 2021-03-15 21:59:13 +00:00
Winson Chung
e3e90bd0c4 Merge changes from topic "revert-13608835-shell_feature_interfaces-HRAUSTBFGW" into sc-dev
* changes:
  Revert "1/ Add mechanism to expose shell feature directly (for Pip)"
  Revert "2/ Add mechanism to expose other features directly"
2021-03-15 20:46:18 +00:00
Winson Chung
64b8381c7d Revert "1/ Add mechanism to expose shell feature directly (for Pip)"
Revert "Add shell aidl files"

Revert "Update starting window init call for CarLauncher"

Revert submission 13608835-shell_feature_interfaces

Reason for revert: SysUI Studio aidl import issue
Reverted Changes:
I49a5a0419:2/ Add mechanism to expose other features directly...
I19425896d:Update starting window init call for CarLauncher
If048d2cd9:1/ Add mechanism to expose shell feature directly ...
Ibb8365d3c:Add shell aidl files
Ie41b0b77a:Update calls to go through the feature interface i...

Change-Id: I97e591a5e157dfd27a72a735b51a3ed80bf1bf91
2021-03-15 17:52:25 +00:00
Winson Chung
a33a496a6f Revert "2/ Add mechanism to expose other features directly"
Revert "Add shell aidl files"

Revert "Update starting window init call for CarLauncher"

Revert submission 13608835-shell_feature_interfaces

Reason for revert: SysUI Studio aidl import issue
Reverted Changes:
I49a5a0419:2/ Add mechanism to expose other features directly...
I19425896d:Update starting window init call for CarLauncher
If048d2cd9:1/ Add mechanism to expose shell feature directly ...
Ibb8365d3c:Add shell aidl files
Ie41b0b77a:Update calls to go through the feature interface i...

Change-Id: I8bacc844fc3f0447311b5a97c4d356f2fb80f3ce
2021-03-15 17:52:25 +00:00
Hongwei Wang
f4dfb7c4a3 Settle auto PiP transaction in WindowContainerTransaction
At the end of autoEnterPip transition, followings happen in sequence
- Transition finishes in Launcher side, which operates on the
  animation leash
- RecentsAnimationController.TaskAnimationAdapter#onCleanup has the final
  chance to set the Task leash
- PipTaskOrganizer gets onTaskAppeared callback and commits Task into
  pinned mode

What's been changed here
- Transition in Launcher no longer in charge of settle the final transaction
- RecentsAnimationController.TaskAnimationAdapter#onCleanup sets the
  Task leash to be in sync with the final state in Launcher side
- PipTaskOrganizer commits the final leash transaction together with
  WindowContainerTransaction that enters PiP

Known issue: transition from landscape is not polished

Video: http://rcll/aaaaaabFQoRHlzixHdtY/hT5SXvaCy28P4UtfuoKiDw
Bug: 181342797
Test: see video
Change-Id: Ieabd6991ea5174099714ec22970198bebde1e336
2021-03-15 10:40:13 -07:00
Winson Chung
8064ce8216 Merge "Allow gestural nav to hide the bar and background" into sc-dev 2021-03-14 03:53:25 +00:00
Winson Chung
b7e0678d36 Merge changes from topic "shell_feature_interfaces" into sc-dev
* changes:
  2/ Add mechanism to expose other features directly
  1/ Add mechanism to expose shell feature directly (for Pip)
2021-03-13 19:13:21 +00:00
Winson Chung
596633ff6d Allow gestural nav to hide the bar and background
Bug: 181206743
Test: Manual
Change-Id: I8a4caec4576b72c1deb029e5145456055ae0d31a
2021-03-12 21:34:14 -08:00
Winson Chung
8e76243e57 2/ Add mechanism to expose other features directly
- Expose interfaces for splitscreen, one handed, shell transitions,
  starting window
- Make the shell code only reference the starting window controller and
  not the exported interface

Bug: 180074017
Test: atest WMShellUnitTests
Test: Verify Pip calls from Launcher work
Change-Id: I49a5a0419996754e5e154df7af1e475268035a5a
2021-03-12 21:22:51 -08:00
Winson Chung
2b52dceafc 1/ Add mechanism to expose shell feature directly (for Pip)
- Also split impl and controller for ShellInit/ShellCommandHandler
  (as with ag/13502602)
- Example implementation of exposing a subset of the Pip interface to
  Launcher directly.  This has the benefit of reducing unnecessary code
  in SysUI just to pipe calls to the Shell.

  The controller implements the binder interface which is collected
  and exposed to Launcher when it binds to the overview  service
  and Launcher can call through the binders directly.

  Note: this requires the shared lib to also build with the Shell
  interfaces so changes to the Shell aidls will still require updating
  the shared lib (until the shared lib prebuilt can removed).

Bug: 180074017
Test: atest WMShellUnitTests
Test: Verify Pip calls from Launcher work

Change-Id: If048d2cd9a6b8e5014ba30c0deaed7a3e177605d
Signed-off-by: Winson Chung <winsonc@google.com>
2021-03-12 17:15:58 -08:00
Shawn Lin
cb3141a4a4 Merge "Attach navigation bar to app during quick switching (2/N)" into sc-dev 2021-03-12 13:45:19 +00:00
shawnlin
2fe3ffa3c8 Attach navigation bar to app during quick switching (2/N)
- Create a new method in StatusBar to enable/disable nav bar luma
  sampling.
- Modify the IRcentsAnimationController.detachNavigationBarFromApp() API
  to notify the server side whether we should run the fade-in animation
  or not.
- Don't let fixed rotation animation control the navigation when it's
  controlled by recents animation and vice versa.
- Don't attach nav bar when it's in split screen mode and in landscape.
- Translate the nav bar surface to match the secondary app's bounds in
  split screen mode in portrait.

Bug: 139273001
Test: atest RecentsAnimationControllerTest CommandQueueTest
Change-Id: I06dc2dd0655bc8a2e6ad03808576e55294a322e8
2021-03-12 12:10:26 +08:00
Alex Chau
a67a82e08d Add option in Task.getVisibleThumbnailRatio to disregard insets
- Added an option to control if insets should be considered

Bug: 179922117
Test: manual
Change-Id: I9bbda52b9b417544338707bb53ef2568e63a6df6
2021-03-11 23:33:01 +00:00
Wei Sheng Shih
39baa852c6 Merge "Let Launcher able to receive task launching callback(3/N)" into sc-dev 2021-03-08 04:06:56 +00:00
Winson Chung
88c5179965 Merge "Revert "Add nav bar case to RemoteAnimationTarget of non-app window"" into sc-dev 2021-03-05 19:03:30 +00:00
Evan Rosky
86234a6ebd Merge "Abstract some transition checks so they can be expanded." into sc-dev 2021-03-05 16:48:32 +00:00
wilsonshih
8b7b5e6781 Let Launcher able to receive task launching callback(3/N)
When StartingWindowController receive addStartingWindow, send a callback
out so a listener can know whether current launch cold or warm.

Ref doc: go/starting_window_android_s

Bug: 131311659
Bug: 131727939
Bug: 152480470

Test: atest WindowOrganizerTests StartingSurfaceDrawerTests
SplashscreenTests

Change-Id: Ic9f02f51d5de141b56a8f28003bf1cb1a5a63f22
2021-03-05 21:22:59 +08:00
Shawn Lin
2a13ab663e Revert "Add nav bar case to RemoteAnimationTarget of non-app window"
This reverts commit f17300e706.

Reason for revert: <Caused test failures>

Change-Id: Id199e36e189c586c92f994023f60f64be9f5f443
2021-03-05 09:05:31 +00:00
Winson Chung
6d2a041ca4 Merge "Update the split screen APIs used by the launcher" into sc-dev 2021-03-05 04:25:11 +00:00
shawnlin
f17300e706 Add nav bar case to RemoteAnimationTarget of non-app window
1. Only send navigation bar target when:
   - The transitition is app launch
   - In gesture navigation bar mode
   - The navigation bar is not controlled by fixed rotation or recents

2. Add a windowType field to RemoteAnimationTarget so that the remote
   clients could use this to find the non-app window they want.

Bug: 139273001
Test: atest RemoteAnimationControllerTest
Change-Id: I7003011351913b040b47e6fb567eedb4baf34a55
2021-03-04 10:51:01 +08:00
Jeff Pierce
031bb5d835 Update the split screen APIs used by the launcher
Makes the following changes:
1. Adds a boolean visible parameter to the onTaskChanged method of
SplitScreenListener to allow the launcher to determine which task is
on top of a stage
2. Allows the launcher to specify a fill-in intent when asking to open
a PendingIntent on the main or side stages.
3. Allows the launcher to ask to remove a task from the side stage.

Bug: 179176511
Test: manually tested against the foldable taskbar launcher.
Change-Id: I9fa530f546af58779ccf71d0753d9b6d3479fd0b
2021-03-02 16:40:30 -08:00
Evan Rosky
7e3bc7154e Abstract some transition checks so they can be expanded.
This is mostly to clean-up CL diffs so its easier to tell
what is changing. The main change here is replacing naked
parint == null checks with TransitionInfo.isIndependent() which
can do extra logic to handle cases where, even though a change
has a parent, it might be animating independently with in it.
The easiest example is display rotating while an app is opening.

This also fixes a small bug when removing a non-visible task.

Bug: 179270750
Test: atest TransitionTests
Change-Id: Ibd72b0721f33602b26bcc5c7060fc959aed04377
2021-03-02 12:34:03 -08:00