Commit Graph

422 Commits

Author SHA1 Message Date
TreeHugger Robot
8bd2541e6e Merge "Deprecating windowSplashScreenAnimationDuration attr." into tm-dev 2022-03-22 14:23:31 +00:00
Tiger Huang
630c25ddaa Merge "Let the client compute the backdrop frame on its own" into tm-dev 2022-03-22 04:05:18 +00:00
Vadim Caen
44311a6646 Merge "Fix setSplashScreenTheme documentation" into sc-dev am: ffad2f714d am: 73ee4fe036
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16343578

Change-Id: I11ada44b09906012acd33000caeed2b479420572
2022-03-21 14:05:10 +00:00
Tiger Huang
351d589dad Let the client compute the backdrop frame on its own
Since the new split-screen doesn't need the fullscreen backdrop frame.
The backdrop frame will always be the window frame. The server doesn't
need to send the backdrop frame to the client. The client just needs to
offset the backdrop frame to (0, 0).

This CL also moves the logic of calling onWindowSizeIsChanging to the
handler thread because it reads some fields which should only be
accessed on the handler thread. Otherwise, there might be race
conditions.

Bug: 161810301
Test: 1. Perform drag-resize and drag-move on a freeform app, and see if
         the layout is expected.
      2. Move the divider in the split-screen mode, and see if there is
         any abnormal.
Change-Id: Ie0058db0447260dd0561634179fc7721d965a9e2
2022-03-20 14:36:54 +08:00
Chavi Weingarten
249f65916d Merge "Store last data received from WindowInfosListener" into tm-dev 2022-03-18 21:11:20 +00:00
wilsonshih
4748ce9e02 Deprecating windowSplashScreenAnimationDuration attr.
In previous CL(5e0c72a2c5) we provide a
way to read the animation duration from AVD and AnimationDrawable,
which should be enough to deprecate this attribute since the naming
could confusing developers.

The attribute was used to cut off the animation if the icon is
animatable, but since the animation can be stop when removing the
splash screen view from window, the attribute is useless so framework
won't read it anymore.

The attribute was also be the return value from
SplashScreenView#getIconAnimationDuration, however, since this API was
designed to let developer decide when to cut off the animation if the
app want to handle OnExitAnimationListener#onSplashScreenExit,
developer can pre-decide the duration in the app without set this
attribute.

Bug: 211707095
Test: atest SplashscreenTests StartingSurfaceDrawerTests
Change-Id: Ib3a0b4314bd15158c392e56c0e125a33c753e716
2022-03-18 09:44:37 +08:00
Vadim Caen
3686891611 Change parameter order to make it SAM compatible
Move the callback as the last paramter to registerOnBackInvokedCallback

Test: Existing
Bug: 224562951
Change-Id: I8608a03b53baa04bedee81d2e86b2339abd6c594
2022-03-17 22:19:54 +01:00
Tiger Huang
c1cf2472f6 Merge "Use ClientWindowFrames to collect frames computed by WindowLayout" into tm-dev 2022-03-15 18:43:37 +00:00
TreeHugger Robot
b6468930d0 Merge "Revert "Turn off predictive back"" into tm-dev 2022-03-14 22:55:32 +00:00
Shan Huang
d7d9fb32d7 Revert "Turn off predictive back"
This reverts commit ad89a82145.

Reason for revert: b/222170518 was unrelated to gesture back, and is now fixed.
Test: m -j. Test back behavior throughout system.

Change-Id: Ia27c7ea97416831355e1949ec6874de570b52108
2022-03-14 17:09:00 +00:00
Tiger Huang
45790587c7 Use ClientWindowFrames to collect frames computed by WindowLayout
This is a step to move the window layout to the client side.

ClientWindowFrames is used to carry window frames dispatched from the
server to the client for now. Later, the window frames will be computed
at the client side, and the frames will be sent to the server side via
ClientWindowFrames.

Bug: 161810301
Test: presubmit (no behavior change but only code refactors)
Change-Id: I83d8cfff2432e09759ef5b3d5f3b21731fc71bff
2022-03-14 22:30:45 +08:00
TreeHugger Robot
77946e2ae8 Merge "Add API to indicate supported windowing modes on the virtual displays" into tm-dev 2022-03-11 01:22:20 +00:00
chaviw
277f1608be Store last data received from WindowInfosListener
Store the last data received from WindowInfoListener on the client so it
can easily be retrieved when a new caller registers to listen for
updates. This will help with accessibility since they won't need to
register their listener all the time and instead just get the last data
that was sent, immediately.

From the system server process, the data is constantly being updated
because WindowInfo is sent to InputDispatcher when any geometry in SF
changes. If a different process registers for the WindowInfoListener,
it's possible the initial data will be empty since we won't explicitly
request the latest data immediately.

Bug: 222767081
Test: Accessibility register only when enabled
Change-Id: Ib87edde7a14be8584504d5d8d6c41f20bde5c698
2022-03-09 09:40:40 -06:00
Iris Yang
6d709f6f95 Add API to indicate supported windowing modes on the virtual displays
1. Add new API in DWPC to get windowing features of the virtual display.
2. In ActivityRecord, consume the value of the allowed windowing modes
   of virtual display.

Bug: 180435098
Test: atest WmTests:ActivityRecordTests#testSupportsPictureInPicture && atest WmTests:DisplayWindowPolicyControllerHelperTests

Change-Id: I39a6cd9417f266f7fdef72cc054263c3ca4c5650
2022-03-09 12:48:52 +00:00
Jerry Chang
4ab407e5fe Merge "Support to get the exact task which IME is attached to" into tm-dev 2022-03-09 01:23:38 +00:00
Bryce Lee
459d5bd503 Make OnBackInvoked callback a WeakReference.
OnBackInvokedCallbackWrapper instances are sent to the WindowState over
AIDL. This leads to Activity leak issues even if the reference is
cleared in the remote side. This change makes the held reference weak
So it is not retained.

Test: verified leak no longer present through hprof
Bug: 221285764
Change-Id: I1c529d27769e2426898776e47f37bdb7abe1f681
2022-03-08 09:35:12 -08:00
Chavi Weingarten
53f62e57cf Merge "Changed setSyncTransaction to syncNextTransaction with callback logic." into tm-dev 2022-03-03 22:14:41 +00:00
Vadim Caen
8fa5667732 Merge "Move OnBackInvokedCallback to window package." into tm-dev 2022-03-03 10:03:41 +00:00
Tianhao Yao
5ecd6d37de Changed setSyncTransaction to syncNextTransaction with callback logic.
Modified SurfaceView and ViewRootImpl to provide callbacks when syncing
a transaction instead of sending transactions. This will ensure a clear
ownership of the transaction object since it will be provided in the
callback when BBQ adds a buffer into the transaction. Modified JNI to
add compatibility for native functions.

Test: Manual testing from go/wm-smoke.
Test: BLASTBufferQueueTest
Bug: 210714235.
Change-Id: I1f872d6b2846b0d64d5b33b8866d0b2ec7126c8c
2022-03-02 09:55:46 -06:00
Vadim Caen
72077726f5 Move OnBackInvokedCallback to window package.
Originally, View was implementing onBackInvokedDisptacherOwner, but now
only Activity and Dialog and since back event are related to the
window, it makes sense to move them into the android.window package

This follow up comment at:
ag/c/platform/frameworks/base/+/16764116/comments/e131f3ef_e3e1d2e0

Test: atest BackNavigationTests
Bug: 221401221
Change-Id: Ia2f26162beb6a41b6e162b31e599e882f8bf7320
2022-03-02 16:28:57 +01:00
wilsonshih
db6ba3ba58 Rename 'EMPTY' to 'SOLID_COLOR' for splash screen style.
Preventing from misleading developers.

Bug: 217953215
Test: atest SplashscreenTests StartingSurfaceDrawerTests
ActivityRecordTests

Change-Id: I8669effb2e843ebe61e807850359b07b36b39fb3
2022-03-02 20:30:31 +08:00
Wei Sheng Shih
172ea326de Merge "Estimate animation duration for AVD and AnimationDrawable" into tm-dev 2022-03-02 06:24:50 +00:00
Jerry Chang
f23631e4db Support to get the exact task which IME is attached to
To distinguish which side of the split that IME panel is attached to
after having a single-top root task for split screen, update
getImeTarget API to return the exact task that IME panel is attached to.

Bug: 207185041
Test: WMShellUnitTests
Test: enter split in portrait, toggle IME panel on the bottom split and
      verified split layout will be push up as expectedly.
Change-Id: Ib6ba74ecb1b844bb408475d5b6c28dd5816a8e29
2022-03-02 04:15:11 +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