Commit Graph

212 Commits

Author SHA1 Message Date
Chris Li
3a00e2b213 Merge "Notify TaskFragmentOrganizer onConfigurationChanged" into sc-v2-dev 2021-06-24 21:44:16 +00:00
Chris Li
ad2dc01882 Notify TaskFragmentOrganizer onConfigurationChanged
Bug: 190433129
Bug: 190433500
Test: N/A
Change-Id: I383a434d536ac08f7cf82dfd87cd24bfc53a6d58
2021-06-24 10:58:40 -07:00
Wei Sheng Shih
a5c89744ab Merge "Clear padding and background after create view from context." into sc-dev am: f2d2fb5292
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15026547

Change-Id: I61065bea95ebcefa8b498a3abe63e3006ef649f1
2021-06-24 11:08:07 +00:00
wilsonshih
0797c86219 Clear padding and background after create view from context.
When create view with Context, there will also load some view
attributes from the Context and pre-set to the View object, to ensure
the splash screen view not affected by those attributes, clear padding
and background after create those view objects.

Bug: 191339594
Test: manual launch several apps from Launcher/Notification.
Tets: atest SplashscreenTests
Change-Id: I05be9c296a04cd49a0896ad8aef57643720d60ce
2021-06-24 11:10:07 +08:00
Chris Li
324f6df9cf Add WindowingMode in TaskFragmentCreationParams
Allow organizer to set the initial windowing mode for creating
TaskFragment.

Bug: 190433129
Test: N/A
Change-Id: I8848a27f69108ebc62be3342cd6f1656ec488433
2021-06-23 14:16:05 -07:00
Chris Li
f555a8a0e6 Merge changes from topic "task_fragment_organizer" into sc-v2-dev
* changes:
  Implement WCT#create/deleteTaskFragment
  Add TaskFragmentOrganizer API
  Add WindowContainerTransaction APIs for create/deleteTaskFragment
2021-06-23 04:44:23 +00:00
Chris Li
8c946d6594 Implement WCT#create/deleteTaskFragment
Also update setAdjacentRoots to accept TaskFragment.
Pass the WCT to WM Core. The implementation on WM Core side will be in a
separate cl.

Bug: 190433129
Test: N/A
Change-Id: I1ee8a7ba0a43e18e180c05a7fcf0467967564782
2021-06-22 15:56:24 -07:00
Chris Li
cf717a20eb Add TaskFragmentOrganizer API
Mainly the API surface.

Bug: 190433129
Test: N/A
Change-Id: I426b7fdbe62d58213c5e49a4773dd5fda0eb4dfe
2021-06-22 15:54:38 -07:00
Chris Li
80897e90ff Add WindowContainerTransaction APIs for create/deleteTaskFragment
This change contains mainly the function signatures and data classes.
The actual implemenation will come in a separate cl.

Bug: 190433129
Test: N/A
Change-Id: I4f9695cea270cc06f2f6b1a2c56245cd2a43b9fd
2021-06-22 15:00:24 -07:00
Charles Chen
dd4a748af0 Move initialization from onCreate to attachBaseContext
Previously we initialize WindowManager and associate DisplayArea in onCreate,
but apps may use WindowManager before WindowProviderService#onCreate.
The code may be like:
```
public void onCreate() {
    WindowManager wm = getSystemService(Windowmanager.class);
    wm.getCurrentWindowMetrics().getBounds(); // <--- crash here
    super.onCreate()
    ...
}
```
This CL move the initialization step to attachBaseContext to prevent
the crash.

Test: atest WindowContextTests
Test: run gsi_avd/boot_health/vendor_img_rvc on ABTD
Bug: 191635763
Change-Id: Id8bad73a749813a90b307ac2b4d020f740631ea3
2021-06-22 13:55:12 +08:00
Charles Chen
235a0bf9bd Merge changes from topic "ime_migration" into sc-v2-dev
* changes:
  Move IME log to WindowTokenClient
  Migrate InputMethodService to WindowProviderService
2021-06-21 08:46:33 +00:00
Chris Li
5f17dfe9f0 Merge "Add Builder for WindowContainerTransaction#HierarchyOp" into sc-v2-dev 2021-06-18 22:48:17 +00:00
Evan Rosky
2ed4561187 Merge "Some fixes to shell transitions lifecycle handling" into sc-v2-dev 2021-06-18 21:39:23 +00:00
Chris Li
58d1216088 Add Builder for WindowContainerTransaction#HierarchyOp
Refactor it as we are adding more options.

Bug: 190433129
Test: just refactor
Change-Id: I316899427c1c8e12d97fd5f018c455a246da30bb
2021-06-18 12:40:34 -07:00
Evan Rosky
6173c26649 Some fixes to shell transitions lifecycle handling
Added a remote transitionfilter for container ordering. This way
launcher animation won't engage if it is appearing behind a
translucent task.

Modify commitVisibility to properly update client visibility
when shell transitions are enabled.

Fixed issue where activity start was deferring sync-engine
readiness even for "delivered-to-top" or cancelled activity
starts. This meant it would wait forever.

Hooked up the "enter animation complete" reporting to shell
transitions.

Removed interference by legacy freeform/maximize animation
logic (which was calling setReady at incorrect times).

Bug: 183993924
Test: atest ActivityLifecycleTests
Change-Id: I1138079b1ae05248cefa211e0597fd6723a8bbba
2021-06-18 09:11:02 -07:00
Charles Chen
41fc06529b Merge "Handle WindowProviderService#onConfigurationChanged" into sc-v2-dev 2021-06-18 06:37:49 +00:00
Charles Chen
79cb3c5288 Move IME log to WindowTokenClient
IMF has the requirement to debug if the configuration is dispatched
to InputMethodService. Since we migrated InputMethodService to
WindowProviderService, we should also move the debug logic to
WindowContext module because config updates will be no longer from
ActivityThread.

Test: build & run
Bug: 135719017
Change-Id: I248c90f36249a6a4537228f7b0204f0d4466ebc7
2021-06-18 11:45:05 +08:00
Charles Chen
fc7a1b5b34 Migrate InputMethodService to WindowProviderService
Also introduce IWindowManager#getDisplayIdToLaunchIme to make IMS
be aware of the launched display to prevent extra onConfigurationChanged
callback

Bug: 149463653
Test: atest MultiDisplaySystemDecorationTests CtsInputMethodTestCases
Test: atest ContextTest ContextIsUiContextTest
Test: manual - moving IME between 2 displays and displayArea within
      display - config change received
Test: manual - the app to show IME crashed and focus is set to the
      next task - no config change

Change-Id: Ie565e30ed5dd3f2cfe27355a6dded76dc3adc14b
2021-06-18 11:44:30 +08:00
Charles Chen
0a3126f408 Handle WindowProviderService#onConfigurationChanged
This CL makes WindowProviderService receive onConfigurationChanged
callback when there's a config update from WM side.

Test: atest WindowContextTests
Test: atest ActivityThreadTest ActivityClientTest ConfigurationHelperTest
fixes: 185766946

Change-Id: I922d52c1c38aecc1a948c79039cc03354adc646f
2021-06-18 11:44:20 +08:00
Vadim Caen
ab9a4b9a5a Merge "Release the SurfacePackageViewHost on splash screen removed" into sc-dev am: dc07d29bd0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14775423

Change-Id: I41c53ecabb544054bbe522baf5ffddaac211975b
2021-06-16 12:31:00 +00:00
Vadim Caen
a46ff113be Release the SurfacePackageViewHost on splash screen removed
The SurfacePackageViewHost was never release, leading to a leak of its
surfaces.

This CL ensure it is released:
  - Directly in the shell if the SplashScreenView was not copied
  - From the client, through the window manger and then to the shell if
  the splash screen was copied in the client process

Test: Manually tested with app setting by checking if the surfaces
are actually removed (winscope + logs) in the following scenarios:
    - When the application registers an OnExitAnimationListener
      and calls remove(),
    - When the application registers an OnExitAnimationListener
      and dies without calling remove()
    - When the applicaiton does not register an OnExitAnimationListener
    and the shell removes the splash screen
Bug: 189759180

Change-Id: Ib68bfffad6720911368739d7dd87d8a03034c589
2021-06-15 15:39:09 +02:00
Selim Cinek
b77c0a3d8a Merge "Always do the app reveal animation when dismissing the splash screen" into sc-dev am: bfa0487b7a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14934416

Change-Id: Id5d4519dd0c96ee044a31c5ecac97cfd644d5cc5
2021-06-14 08:19:26 +00:00
wilsonshih
192aef77d7 Always do the app reveal animation when dismissing the splash screen
Let empty-style splash screen do reveal animation.
Also remove the extra animation duration if the icon is empty.

Bug: 190695897
Bug: 190695665
Test: manual
Test: atest SplashscreenTests
Change-Id: I8b3b52369c12fbddc32af8c40f37650cc84a88dd
2021-06-11 11:34:33 +08:00
Wei Sheng Shih
e80879f307 Merge "Introduce setSplashscreenStyle to specify splash screen style." into sc-dev am: 6b0741b3fe
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14609925

Change-Id: I4fb4f4a78d02a77ee6df4450dfc84366c1eb513e
2021-06-08 12:29:50 +00:00
wilsonshih
72a03ff774 Introduce setSplashscreenStyle to specify splash screen style.
Provide a method ActivityOptions#setSplashscreenStyle to specify
splash screen style if needed.

If not set, the default option will be empty-style splash screen, so
without any other change, the activity launched from systemui with
ActivityOptions will become empty style splash screen.

Bug: 188023621
Bug: 189293785

Test: manual test start application from Launcher and Notification.

Change-Id: I299320db8f32fbd835c7ec0acaad3df3486a13f5
2021-06-08 12:21:27 +08:00
Vadim Caen
be2ac213fe Merge changes from topic "splashscreen-surface" into sc-dev am: fc1efcb428
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14186656

Change-Id: Ie0e17006e404de22c20cce84cf7a43fdf0eb85e7
2021-05-25 15:24:45 +00:00
Evan Rosky
46ba708bb8 Enable remote transition animations to append to the finish transaction
Adds a parameter to the IRemoteTransitionFinishedCallback. This
transaction will be merged into the finish transaction before it is
applied. This is needed by transitions like live-tile recents where
the end-state of the transition is altered during the "animation".

Bug: 172695387
Test: open app, swipe up to overview, resume that same app, screen
      shouldn't turn black anymore.
Change-Id: I6fa1e22288ce087ad17fdfc950a8419e6ba61a47
2021-05-24 09:14:46 -07:00
Vadim Caen
cb81f1716d Display Splashscreen AVD in a SurfaceView
If the splashscreen uses an animated icon, we need to display it in a
surface view to avoid any jank if the view is passed to the client.

Test: CtsWindowManagerDeviceTestCases:SplashscreenTests#testHandleExitIconAnimatingActivity
Bug: 181757194

Change-Id: I7e2745a68626849374f5ebb9011c2e8c3b3b92c3
2021-05-21 13:13:15 +02:00
Tony Huang
c3acdff9e8 Merge changes I1ea02fa9,I033a79dc,Iac219a8e into sc-v2-dev
* changes:
  Make AppTransition animations sharable (6/n)
  Make AppTransition animations sharable (5/n)
  Make AppTransition animations sharable (4/n)
2021-05-21 07:46:13 +00:00
Wei Sheng Shih
919405b38d Merge "Tracking launch activity to decide next splash screen style." into sc-dev am: 9e14f714d4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14326844

Change-Id: I6d064be052444131f04143fa96fa2c861b6ce804
2021-05-21 05:02:52 +00:00
Wei Sheng Shih
8fde873208 Merge "Drawing the legacy icon similar to the Launcher." into sc-dev am: fffb1502cf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14234712

Change-Id: I1b800fdc2d6501e27e2937e01e58e21e6dd28fe8
2021-05-21 05:02:38 +00:00
Wei Sheng Shih
9e14f714d4 Merge "Tracking launch activity to decide next splash screen style." into sc-dev 2021-05-21 04:42:00 +00:00
Wei Sheng Shih
fffb1502cf Merge "Drawing the legacy icon similar to the Launcher." into sc-dev 2021-05-21 04:39:29 +00:00
Antonio Kantek
cdfddd3f5f Merge "Deleting ActivityView" into sc-dev am: b1c5d7fabb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14430990

Change-Id: Ibf78e9566b329920e0e89ea57d9c011362848d50
2021-05-21 01:22:21 +00:00
Antonio Kantek
5456990f7e Deleting ActivityView
Test: atest CtsAccessibilityServiceTestCases
Bug: 179161778
Change-Id: Ic66f3740819634366edb20a34a7c8177af258c2f
2021-05-20 19:04:49 +00:00
wilsonshih
64e67a6ebf Tracking launch activity to decide next splash screen style.
The generic rule to showing an empty splash screen is that if an
activity is launched from another visible activity besides Launcher.
So with this rule, when prepare the starting window for a launching
activity, we can tracking where the source activity comes from and
whether it has show splash screen or has drawn window before.
This can solve the inconsistent launch sequence when launching an
activity from non-system surface for the status either new task or
new process.
There will show an empty style splash screen if the launching
activity was drawn or it has show splash screen before.
Another coner case is that a process could start a new activity from
service, for the better UX we should also check whether there any
existing activities which were from the same process or same package
and has already at foreground.

We can still add "show icon_style_splash_screen" flag in the future.

Bug: 185433040
Bug: 185567723
Bug: 185448781
Test: atest SplashscreenTests ActivityRecordTests
Test: manual test
Launch browser from -1, empty splash screen
Launch calendar from launcher, icon splash screen
Launch work app from Settings -> Notifications -> Calendar show empty
splash screen
Launch Settings -> System update show empty splash screen
Launch Dialer -> call out -> show empty splash screen on InCallActivity

Change-Id: Id84f1f69de6c5e3f1c21cd249c62404958410193
2021-05-20 19:59:39 +08:00
Tony Huang
a2c4a7577d Make AppTransition animations sharable (4/n)
Migrate ActivityOptions transition animation to shell transition.

Bug: 178678389
Test: manual
Change-Id: Iac219a8eabab7ac7fac73a47e97ec003bbf2d366
2021-05-20 16:36:13 +08:00
Chris Li
e59ae90be3 Include RootDisplayArea feature id in DisplayAreaInfo
With the RootDisplayArea id, one can create WindowContext with bundle
that specifying the RootDisplayArea using KEY_ROOT_DISPLAY_AREA_ID to
get the WindowContext associated with the DA.

Bug: 176875245
Test: atest WmTests:DisplayAreaTest
2021-05-19 07:53:35 +00:00
TreeHugger Robot
eea27600d3 Merge "Take PIP snapshot in the shell and use bounds state size for crossfading" into sc-dev 2021-05-19 01:06:32 +00:00
wilsonshih
5e8f3c2e36 Drawing the legacy icon similar to the Launcher.
The legacy icon on the splash screen should looks similar to it shows
on Launcher, a circle background wrap the icon bitmap in the center.

Bug: 182883560
Test: atest SplashscreenTests
Change-Id: I994f516bb7b5b1231ff9e5bb02a3a92aa5113a84
2021-05-18 15:30:33 +02:00
jorgegil@google.com
75e94750f5 Take PIP snapshot in the shell and use bounds state size for crossfading
Since the width/height of the SC should not be used anymore,
we'll use the pre-resize bounds to scale the surface before
animating the crossfade.

Bug: 186669773
Test: Enter PIP in seamless resize demo, resize with seamless
turned off uses a crossfade animation with the correct size

Change-Id: I1405be9208ac9e7cc34283e3d97dc431f0cb643c
2021-05-17 10:15:09 -07:00
Riddle Hsu
a274fd1c1a Draw splashscreen edge to edge
- Switch from PhoneWindow to FrameLayout
 - Ensure the Action bar is not shown on the splashscree
 - Do not show the contrast scrim under the system bars
 - Use the latest insets API to layout fullscreen

Test: Updated CtsWindowManagerDeviceTestCases:SplashscreenTests
Bug: 181852475
Bug: 184941669
Change-Id: Ifc04bd2227394415cc74c20d2974f4726ec9c789
2021-05-14 17:51:23 +08:00
Hongwei Wang
bec1c53ed9 Pass the float9 values in PictureInPictureSurfaceTransaction
For auto enter PiP from landscape when no source rect hint is specified,
we should actually use the skew instead scale values to set the matrix
transform.

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/dpLVOQzIVjdJpn5kg7T4Fc
Bug: 179720719
Test: manual use ApiDemos app, see video
Change-Id: Ic7072e8354329584f9cb75876911c3d58d78e7f5
2021-05-07 14:26:43 -07:00
wilsonshih
3221600d7e Support enable default splash screen reveal aninatmion
- Add a temp flag persist.debug.enable_reveal_animation so user can
enable reveal animation.
- Remove icon shift animation.
- For shift up animation, use AnimationAdapter to capture the surface
control and pass to Shell, then cancel the animation when
WindowState#removeIfPossible for starting window.
- Fix the flicker test fail issue caused from shift up animation, the
surface control should be release after the last frame was commit.
- Use SyncRtSurfaceTransactionApplier to synchronize the shift-up
animation, and use vsyncId to ensure the transaction doesn't applyied
too early.
- Do not play reveal animation for empty splash screen.

Test: atest SplashscreenTests StartingSurfaceDrawerTests
Bug: 183004107
Bug: 182815506
Bug: 184830058
Change-Id: I4fc8456633b3f4ecd69b168e0222915945210426
2021-05-03 16:20:09 +08:00
TreeHugger Robot
929d2ce07d Merge "Support FLAG_ACTIVITY_LAUNCH_ADJACENT for launch root with adjacent" into sc-dev 2021-04-27 00:03:34 +00:00
Vadim Caen
8773bbe881 Merge "API to override the splashscreen theme" into sc-dev 2021-04-26 19:20:04 +00:00
Jerry Chang
d8abe76ba1 Support FLAG_ACTIVITY_LAUNCH_ADJACENT for launch root with adjacent
Add window container transaction APIs to indicate launch root for task
launching with FLAG_ACTIVITY_LAUNCH_ADJACENT. If launch adjacent flag
root is available, consider to launch to its adjacent task if the launch
is coming from the same root task.

Fix: 169271875
Test: atest WMShellUnitTests
Test: atest TaskDisplayAreaTests
Test: manual test FLAG_ACTIVITY_LAUNCH_ADJACENT behavior with adjacent
root.

Change-Id: I1716aaa48745d2c32cd413c8eac0b1d17810f0de
2021-04-27 01:07:50 +08:00
Riddle Hsu
25457d4257 Support PiP with fixed rotation
Add 2 cases with rotation change:
(a) Enter PiP from fullscreen.
    http://recall/-/d6GxE5mVL8Ww2IPnx7Nk0o/hDfmdrhrBFjJNOdi1s66OW
(b) Launch fullscreen app with the existing PiP.
    http://recall/-/d6GxE5mVL8Ww2IPnx7Nk0o/bUpHZ6Sh98zKZJnRM7oFy9

Steps of (a):
1. Task#setWindowingMode to PiP. If the next fullscreen activity
   will change display orientation, start fixed rotation on it.
   And start deferring orientation change.
2. PipTaskOrganizer#onFixedRotationStarted is called to mark it
   will be a special case.
3. PipTaskOrganizer#onTaskAppeared is called and starts the PiP
   rotation animation by animateResizePip with rotated destination
   bounds from rotated DisplayLayout.
4. When onPipAnimationEnd, use WCT#scheduleFinishEnterPip to notify
   that the animation is done, so the deferred orientation change
   can continue to update (PinnedTaskController#setEnterPipBounds).
   The end transaction of animation (reset matrix) is deferred
   until fixed rotation is finished. Also freeze the PiP task
   configuration one time, to avoid extra configuration change
   (letterboxed) by rotation change.
5. The seamless rotation starts, the PiP surface is transformed
   to previous rotation based on the bounds of previous step. So
   the PiP task can show the same orientation as rotated display.
   The frozen flag of PiP task configuration is cleared.
6. PipTaskOrganizer#onFixedRotationFinished is called. The final
   PiP destination bounds and the deferred transaction of step 4
   will be sent to WM.

Steps of (b):
1. Fixed rotation happens (PipTaskOrganizer#onFixedRotationStarted)
   when there is an existing PiP. Apply fade-out animation.
2. PipTaskOrganizer#onMovementBoundsChanged is called to update
   rotated destination bounds.
3. PipTaskOrganizer#onFixedRotationFinished is called to apply
   fade-in animation with new bounds.

Other changes:
- WCT#scheduleFinishEnterPip was used to set bounds and notify
  windowing mode change. That is already done by other config
  change oepration of WCT. So this redundant operation is changed
  to be a signal to notify that the PiP animation is done.
- Ignore calculating letterbox bounds for PiP activity because
  it should fill the task.
- Add PinnedTaskController#DEFER_ORIENTATION_CHANGE_TIMEOUT_MS
  to avoid using alpha animation after swiping from any task.
- Consider source rect hint with rotation.

Bug: 165794724
Bug: 175836469
Test: DisplayContentTests#testFixedRotationWithPip
      PipAnimationControllerTest#pipTransitionAnimator_rotatedEndValue

Change-Id: I2c26b5d93996193caaf020bd0e2314c8e1789545
2021-04-23 20:16:55 +08:00
Vadim Caen
7817164210 API to override the splashscreen theme
By default, the SplashScreen uses the manifest theme.
This API allows user to change the theme used for the splashcreen for
the whole application.

Test: atest CtsWindowManagerDeviceTestCases:SplashscreenTests#testOverrideSplashscreenTheme
Bug: 185109768

Change-Id: I64e24910f6529a0ea2867b67d7e5963b971164b4
2021-04-23 10:53:59 +02:00
Hongwei Wang
b899f626b6 Merge "Apply PictureInPictureSurfaceTransaction upon reparent" into sc-dev 2021-04-23 05:17:12 +00:00