Commit Graph

399 Commits

Author SHA1 Message Date
Wei Sheng Shih
172ea326de Merge "Estimate animation duration for AVD and AnimationDrawable" into tm-dev 2022-03-02 06:24:50 +00:00
Shan Huang
ad89a82145 Turn off predictive back
Test: m -j. Test back in apps that opt-in, opt-out & sysUI
Bug: 222170518

Change-Id: I97ae7769ff2e04eb7fb39c49e025b255cdba057f
2022-03-02 01:42:11 +00:00
Gaurav Bhola
4b9e5c8811 Merge "Add client API to add/remove insets-provider." into tm-dev 2022-03-01 17:32:52 +00:00
Gaurav Bhola
0e971bdee2 Add client API to add/remove insets-provider.
Test: atest WindowOrganizerTests
Bug: 199449177
Change-Id: I9cc0541e4fa930775ee49cd52cbe6c2c728b4d78
2022-03-01 01:50:34 +00:00
TreeHugger Robot
3a05f90073 Merge "Fix Activity leaking form OnBackInvokedCallbackWrapper" into tm-dev 2022-02-28 21:40:20 +00:00
Chavi Weingarten
747b5bfad7 Merge "Add SurfaceSyncer class" into tm-dev 2022-02-28 18:11:41 +00:00
chaviw
d32068af7d Add SurfaceSyncer class
Add Syncer class that allows callers to add desired syncs into a set and
wait for them to all complete before getting a callback. The purpose of
the Syncer is to be an accounting mechanism so each sync implementation
doesn't need to handle it themselves. The Syncer class is used the
following way.

1. SurfaceSyncer#setupSync is called
2. addToSync is called for every SyncTarget object that wants to be
   included in the sync. If the addSync is called for a View or
   SurfaceView it needs to be called on the UI thread. When addToSync is
   called, it's guaranteed that any UI updates that were requested before
   addToSync but after the last frame drew, will be included in the sync.
3. SurfaceSyncer#markSyncReady should be called when all the SyncTargets
   have been added to the SyncSet. Now the SyncSet is closed and no more
   SyncTargets can be added to it.
4. When all SyncTargets are complete, the final merged Transaction will
   either be applied or sent back to the caller.

The following is what happens within the SyncSet
1. Each SyncableTarget will get an onReadyToSync callback that contains
   a SyncBufferCallback.
2. Each SyncableTarget needs to invoke SyncBufferCallback#onBufferReady.
   This makes sure the SyncSet knows when the SyncTarget is complete,
   allowing the SyncSet to get the Transaction that contains the buffer.
3. When the final FrameCallback finishes for the SyncSet, the
   syncRequestComplete Consumer will be invoked with the transaction
   that contains all information requested in the sync. This could include
   buffers and geometry changes. The buffer update will include the UI
   changes that were requested for the View.

Test: SurfaceSyncerTest
Test: SurfaceSyncerContinuousTest
Bug: 200284684
Change-Id: Iab87bff8a0483581e57803724eae88f0a3d96c8e
2022-02-25 13:44:46 -06:00
Vadim Caen
3e966e2996 Fix Activity leaking form OnBackInvokedCallbackWrapper
- The callback was not removed on the server in the clear() method since mWindow and
   mWindowSession fields were cleared before
 - The wrapper class was not static, risking to leak it's outer class
   and its field.

Test: com.android.launcher3.ui.widget.RequestPinItemTest#testPinWidgetWithConfig
Fixes: 220385755
Change-Id: I3e5a81bf48c2272b1cb2b5a9f2ba940d0f794a6f
2022-02-25 15:23:02 +01:00
Vadim Caen
ab4b27e02c Merge "Fix callbacks not being unregistered from ProxyDispatcher" into tm-dev 2022-02-25 13:09:22 +00:00
wilsonshih
5e0c72a2c5 Estimate animation duration for AVD and AnimationDrawable
For Android S, we use the API windowSplashScreenAnimationDuration to
know the duration of the animatable icon would be, however, developers
can be confused to thought that this API is used to declare the
duration of splash screen.
To get the real duration of the animatable icon, if it is an AVD or
AnimationDrawable, try to get the animation duration from it.

Test: atest StartingSurfaceDrawerTests SplashscreenTests
Bug: 211707095

Change-Id: Ia3f8c5cd50bab164360e07d9ced87ff7f4321e96
2022-02-25 11:17:31 +08:00
Vadim Caen
cb4c2a66cd Fix callbacks not being unregistered from ProxyDispatcher
Test: Manual
Bug: N/A
Change-Id: I1caae0fe212ca7915d6d689183e615e9c421dbfa
2022-02-24 13:24:30 +00:00
Evan Rosky
3c8a920a91 Support restoring the original task ordering of transient-launches
Like legacy recents, we need to be able to restore the home task
back to where it was in the task-ordering when recents doesn't
actually switch to home.

This CL records the "restore-below" task during activity-start
and stores in the associated transition. There is a new WCT op
that will "restore" a container back to where it was.

Bug: 210014802
Test: launch a task chain (task followed by task), then go to
      recents, then restore the top task. observe task order
      remains as it was before recents.
Change-Id: I9f9da7d35ffe69099e6431b7a0d5a527e33c5a74
2022-02-23 19:55:43 +00:00
Wilson Wu
9aa2d82590 Merge "Add more logs for WindowContextController" 2022-02-17 06:43:34 +00:00
Wilson Wu
4a184e4b58 Add more logs for WindowContextController
Change the mAttachedToDisplayArea from boolean to
int which should help us to know the reason when
there is a issue happened due to this flag.

Add more logs to clarify the exception reason when
WindowContextController calling attachToWindowToken
but the WindowTokenClient haven't been associated
with a display area.

Bug: 211062619
Bug: 220049234
Test: atest WindowContextControllerTest

Change-Id: I5e3832a466d47de5aafb32cf5fbf9c375a65160a
2022-02-17 06:42:56 +00:00
Chris Li
eb8ca0d725 Fixed rotation for entering PIP with Shell transition
Entering PIP rotation with orientation is changed to use fixed rotation,
so we need to update the animation as well.

Will update exiting PIP and swipe to enter in next cl

Bug: 219411429
Test: manual test enter PIP from different orientation
Change-Id: Id30f15c72b7d59ae63012d9f62e829d73ec4f335
2022-02-17 12:01:17 +08:00
Peiyong Lin
68e5d6b6d8 Merge "Address API review feedback." 2022-02-15 19:55:56 +00:00
Vadim Caen
a70bdd8739 Merge "Add enableOnBackInvokedCallaback manifest attribute" 2022-02-15 19:07:27 +00:00
Peiyong Lin
0c1891e714 Address API review feedback.
Avoid using nested callback classes, move the Executor to register
function and update the Javadoc to emphasize unregister call is always
expected even when a task is already destoryed.

Bug: b/216628683
Test: atest TaskFpsCallbackTest

Change-Id: I801898d082a6eeb6a6f991e3765795a270943d42
2022-02-14 22:18:29 +00:00
Vadim Caen
625f5e286f Add enableOnBackInvokedCallaback manifest attribute
Add a manifest flag for applications to opt-out of the new back
navigation system.

Test: atest
CtsWindowManagerDeviceTestCases: android.server.wm.BackNavigationLegacyTest
Bug: 217709328
Change-Id: I43d09a37b126e59bdb8f20bb83cf6d99e53a1e91
2022-02-14 22:27:10 +01:00
Pablo Gamito
c533e1070c Merge "Fix typos" 2022-02-14 14:55:10 +00:00
Shan Huang
642b0d8cdd Invoke callbacks based on back navigation type.
Test: m -j.
Test: Open and swipe back on pre-T and T apps.
Test: atest .../BackNavigationControllerTests.java
Test: atest .../BackAnimationControllerTest.java
Bug: b/195946584
Change-Id: I00cf7ab5b57760d57d30ac74dc5b3443a4203f38
2022-02-11 22:59:04 +00:00
Pablo Gamito
599f535b1b Fix typos
Test: N/A
Change-Id: I4ced02e143842f9fc38be1b991873d5c1bac7efd
2022-02-10 16:09:24 +01:00
Shan Huang
a1c62623bf Merge "Create BackEvent interface for back navigation parameters." 2022-02-10 14:59:06 +00:00
Shan Huang
27d450afa5 Merge "Avoid leaking Activity from OnBackInvokedCallback." 2022-02-10 14:58:38 +00:00
Shan Huang
a39fa74923 Create BackEvent interface for back navigation parameters.
Bug: b/210539672, b/195946584
Test: m -j
Change-Id: I0264d0995aed8a73563bece0d15d2a9aac0ebf06
2022-02-10 07:01:01 +00:00
Shan Huang
b533660125 Avoid leaking Activity from OnBackInvokedCallback.
- Remove mTopCallback field
- Cleanup compat and default callbacks
- Remove the callback held by WindowState when the window is removed.

Bug: 218328707
Test: atest packages/apps/Launcher3/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
Test: atest frameworks/base/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java
Change-Id: I38fd760a617500c874aef10bc8de165880837008
2022-02-10 04:46:24 +00:00
Vishnu Nair
77cbb96034 SurfaceView: Synchronize add/remove SurfacePackage with VRI draw
Apply the SurfacePackage reparent transactions with the next
ViewRootImpl draw so the caller can optionally synchronize attaching
SurfacePackages with contents on the main window.

Test: atest CtsWindowManagerDeviceTestCases:SurfaceControlViewHostTests
Bug: 217973491
Change-Id: I87f77cb6a5a2505592f6e9431d2964517fe497cd
2022-02-09 10:38:26 -08:00
Evan Rosky
d61906a562 Merge "Adapt shell transitions into legacy remote animations in systemui" 2022-02-09 00:41:34 +00:00
Charles Chen
18ef32b5b3 Merge "Report Activity config changes only if it handles the change" 2022-02-08 14:27:57 +00:00
Evan Rosky
8d71275060 Adapt shell transitions into legacy remote animations in systemui
systemui also defines several remote animations. Given the number
and complexity of animation entry-points in sysui, insert a
cheeky hack to swap remotetransitions in for remoteanimations
when shell transitions are enabled.

Bug: 217810915
Test: Open quick-settings, poke Settings icon. Observe animation
      and no paus.
Change-Id: I462034210f28051a03812eb6ae650fa1f0446ef5
2022-02-07 11:24:24 -08:00
Shan Huang
025b9e5ceb Add compatibility back callbacks.
For pre-T apps, the default back callback dispatches KEYCODE_BACK to the
application's root view.
For T+ apps, the default KEYCODE_BACK listener invokes the registered
OnBackInvokedCallback.

Test: m -j
Bug: 195946584
Change-Id: I62342b249e6cd6f8b036f7e950cc3f9754418ee4
2022-02-05 01:53:25 +00:00
Vadim Caen
717e53a6a7 Save the OnBackInvokedCallback in WindowState
This CL enable OnBackInvokedCallback to be saved in a WindowState and
queried by the BackNavigationController to be returned when
ATM.startBackNavigation() is called.

The DecorView provides a PendingOnBackInvokedDispatcher that can receive
callback registration before being added to a ViewRootImpl.

Test: atest FrameworksCoreTests:BackNavigationTest
Bug: 131727607
Change-Id: I01528a22ea4a6583a56ade4eab69136d727855d0
2022-02-02 22:08:02 +01:00
Pablo Gamito
d72672e545 Merge "Add option to override background color for animation through overridePendingTransition" 2022-01-28 14:26:11 +00:00
Evan Rosky
aad20ce51b Merge "Move fixed-rotation-related display information into config" 2022-01-27 22:04:14 +00:00
Pablo Gamito
8e3a0e498c Add option to override background color for animation through overridePendingTransition
Test: atest CtsWindowManagerDeviceTestCases:AnimationBackgroundTests
Change-Id: I3debc8c1f4646cfd7c20c3f8e57abd465aec23ad
2022-01-27 15:41:20 +01:00
Evan Rosky
c5a17006c8 Move fixed-rotation-related display information into config
Augment the "apparent" display information in configuration
from just the display bounds (maxBounds) to also include the
display rotation and cutout. Like maxBounds, these will be
expected to always be set as basically "the display that this
configuration was built against".

This heavily simplifies fixed-rotation since now we don't
need to deal with the "are we overriding?" question and also
don't need extra activity servertransactions. The configuration
is also in sync (since it is the source of truth used by
resources). Additionally, this means that even the current
legacy fixed-rotation model should work with in any
mixed-rotation situtaion, not just fullscreen.

Bug: 202201326
Test: atest DisplayTest
Change-Id: I6232f74c74324b70b1b0c9f46448c509c2694310
2022-01-26 12:51:42 -08:00
Charles Chen
286845eb3e Report Activity config changes only if it handles the change
In S, we don't dispatch #onConfigurationChanged callback if the screen
size changes doesn't corss size buckets. However,user may still want
to know the change even if it's very small.
This CL changes to dispatch the callback if the Activity handles
the config changes.
Also clean-up the unused code.

Bug: 202468254
Test: atest AppConfigurationTests
Change-Id: Ief68922ed80a0fcfc05c7ccb5e3692334352a2c3
2022-01-26 18:14:34 +08:00
Wei Sheng Shih
e8e313d496 Merge "Allow app to receive onSplashscreenExit even for empty splash screen." 2022-01-26 01:33:58 +00:00
Charles Chen
19e1e118e1 Merge "Override (un)registerComponentCallbacks for ContextWrapper" 2022-01-25 14:18:58 +00:00
wilsonshih
946a4063f7 Allow app to receive onSplashscreenExit even for empty splash screen.
Allow developers to customize the exit animation for empty style splash
screen, there is a target sdk version check to prevents apps from
crash if the app didn't do null pointer check for #getIconView.

Bug: 205907456
Test: atest SplashscreenTests
Change-Id: I235f25fdf42b7177a6e195d3ffc07b92690e6f79
2022-01-25 20:40:23 +08:00
Charles Chen
a4059c2f19 Override (un)registerComponentCallbacks for ContextWrapper
Bug: 193247900
Test: WindowContextTest
Test: ContextWrapperTest

Change-Id: Ia070b12eea5631d70a96d6e41d03ab08f6b44caa
2022-01-25 12:30:47 +08:00
Shan Huang
54b9c9d66e Implement OnBackInvokedDispatcher
Bug:209867448
Test: mp core services sysuig. atest FrameworksCoreTests:WindowOnBackInvokedDispatcherTest

Change-Id: Ib74250e93926854f07ebba6b9f680040aa98f9a4
2022-01-23 23:30:37 +00:00
Peiyong Lin
4f8f656dca Merge "Raise SurfaceControlFpsListener to System API." 2022-01-21 20:30:59 +00:00
Vadim Caen
e0b59d46ce Merge changes Ifc2ed99b,Ibd7fc78e
* changes:
  Integration of back gesture animation on Sysui (BackNav 2/n)
  Server infrastructure for back nav animation (BackNav 1/n)
2022-01-21 13:36:58 +00:00
Peiyong Lin
399e06d648 Raise SurfaceControlFpsListener to System API.
Previously the SurfaceControlFpsListener is a hidden API which only
allows platform code access. This patch renames it to follow the
callback convention and raises it to be a system API in order to allow
system applications to access the FPS count of a task and its children.
The FPS count access is guarded by a permission ACCESS_FPS_COUNTER.

To follow the API convention and properly check the permission, the
register/unregister callback APIs are moved to WindowManager and
permission check is done in the System Server.

Minor: Rename to SurfaceControlFpsCallback to TaskFpsCallback in order
to follow the API naming convention.

Bug: b/199920468
CTS-Coverage-Bug: b/199920468
Test: atest TaskFpsCallbackTest
Change-Id: I6b0a0ad6500278b3da09059e9c2ede28d9a743aa
2022-01-21 09:18:08 +00:00
Shan Huang
5b44dd8b79 Merge changes from topic "shanh-back-api"
* changes:
  Provide OnBackInvokedDispatcher from Activity, View and Dialog
  Introduce IOnBackInvokedCallback and OnBackInvokedDispatcher
2022-01-20 07:20:51 +00:00
Shan Huang
c0999600ee Provide OnBackInvokedDispatcher from Activity, View and Dialog
Test: mp core sysuig services
Bug: 195946584

Change-Id: Ia882ec621154ea1daa780c8976b900e4c8f44a7d
2022-01-20 01:33:56 +00:00
Vadim Caen
a4ca5286d2 Server infrastructure for back nav animation (BackNav 1/n)
This CL introduces the BackNavigationController that gathers the
required data to be passed to WMShell to create the back animation

These data are passed via the BackNavigationInfo Parcelable.

The CL also containes a basic screenshoting mechanism as a temporary
solution until a proper screenshoting infrastructure is created
(b/207481538).

Test: atest BackNavigationControllerTests
Bug: 131727607
Change-Id: Ibd7fc78e590794daf35f7718ddfa53e7f439813b
2022-01-18 10:42:21 +01:00
Pablo Gamito
157738c8a0 Support backgrounds during animations in shell
This is required for the go/t-activity-transitions where we want to allow apps to fade to a clear background color and fade back in from the background to another activity

Test: atest FlickerTests
Bug: 202844659
Change-Id: Iea18a8e7d32a63da55ab3430c47f903da5cff807
2022-01-17 13:26:59 +01:00
TreeHugger Robot
c945d14020 Merge "Ask the policy controller for launching activities" 2022-01-15 15:45:14 +00:00