Commit Graph

195 Commits

Author SHA1 Message Date
Chris Li
8129e9da51 Merge "Do not freeze window in WM Core if Shell transition is enabled" into tm-qpr-dev 2022-06-30 14:05:18 +00:00
Issei Suzuki
d5fec58feb Merge "Pass keyguard occluded status in onAnimationCancelled." into tm-qpr-dev 2022-06-28 17:24:33 +00:00
Charles Chen
09478bf50c Merge "Expand SplitContainer if min dimensions not satisfied" into tm-qpr-dev 2022-06-25 06:26:53 +00:00
Issei Suzuki
a60723b1c8 Pass keyguard occluded status in onAnimationCancelled.
Test: No visible changes yet. Pass existing tests.
Bug: 235463625
Change-Id: Iabee71bc76e19f20702f8a2739f565aa915f9b52
Merged-In: Iabee71bc76e19f20702f8a2739f565aa915f9b52
2022-06-25 01:36:07 +00:00
Charles Chen
bd2723cf6e Expand SplitContainer if min dimensions not satisfied
Before this CL, SplitController creates new SplitContainer if
min dimensions of new lauched Activity/Intent is not satisfied.
This CL changes to expand the existing SplitContainer

Bug: 232871351
Test: atest SplitPresenterTest
Change-Id: Id8d122f7d95d1c6a3574b02ddd2b6afbc548f853
2022-06-24 23:50:12 +08:00
Louis Chang
966a4e4e81 Merge "Do nothing when a finishing Activity configuration changed" into tm-dev am: 725d1534ad am: 3ff8feac5a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19008927

Change-Id: I88bad53e137f2fe321928ba8b833f0f8b2ecea22
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-23 01:07:10 +00:00
Louis Chang
725d1534ad Merge "Do nothing when a finishing Activity configuration changed" into tm-dev 2022-06-23 00:30:19 +00:00
Chris Li
89b0876763 Do not freeze window in WM Core if Shell transition is enabled
Also disable legacy animation override from the organizer since it will never be used with Shell transition enabled.

Bug: 207070762
Test: pass existing
Change-Id: I16aaad606acb51bb47e881d5d533a5a3b1e1fbc9
2022-06-22 15:25:56 +00:00
Louis Chang
b6297b6a46 Do nothing when a finishing Activity configuration changed
Primary Activity and secondary Activity were both finished
while starting another Activity with FLAG_ACTIVITY_CLEAR_TASK
flag. The secondary container was then removed and the primary
container was resized to fullscreen while the organizer gets
the secondary TaskFragment info-changed event. And the primary
container was removed by primary TaskFragment info-changed event
afterward.

Since the primary Activity was resized before completely being
destroyed. The organizer got an onActivityConfigurationChanged c
allback and resulted in another placeholder activity being launched.

Bug: 236272623
Test: making Duo calls
Change-Id: I851828f739a4937725510d99cbdfae9ed212a023
2022-06-21 09:19:05 +00:00
Andrii Kulian
fad7f25eeb Check Task windowing mode when reporting display features
If an application uses ActivityEmbedding it would not be able to
observe display features (like folds or hinges) because they are
filtered out for activities in multi-window mode. One of the reasons
is because the client won't always know the correct position of the
window on screen in multi-window, and the position of the hinge could
be translated incorrectly to the task coordinate space.

However, it would still be OK to report the display features
when activities are in multi-window due to ActivityEmbedding as
long as the task is not in multi-window.

Bug: 236295340
Test: Sample app with embedding and display features.
Merged-In: I00f62574124df6df61f121228bd91ff9bc751c2a
Change-Id: I00f62574124df6df61f121228bd91ff9bc751c2a
2022-06-17 17:15:18 +00:00
Andrii Kulian
2eae3a52a7 Check Task windowing mode when reporting display features
If an application uses ActivityEmbedding it would not be able to
observe display features (like folds or hinges) because they are
filtered out for activities in multi-window mode. One of the reasons
is because the client won't always know the correct position of the
window on screen in multi-window, and the position of the hinge could
be translated incorrectly to the task coordinate space.

However, it would still be OK to report the display features
when activities are in multi-window due to ActivityEmbedding as
long as the task is not in multi-window.

Bug: 236295340
Test: Sample app with embedding and display features.
Change-Id: I00f62574124df6df61f121228bd91ff9bc751c2a
2022-06-17 06:46:40 +00:00
An An Yu
588e1f94d2 Setup T style clear top transition animation for ActivityEmbedding.
This registers system default clear-top xmls and propagate the
showBackdrop flag.
Test: atest RemoteAnimationsControllerTest
Bug: 221048002

Change-Id: I664f7edd181fd7d625b7010a77cd1f7b58fc3113
2022-06-14 13:36:57 -07:00
Charles Chen
fa3f9ca94c Respect minimum dimensions for embedded Activities
Before this CL, minimum dimensions of Activity wasn't respected,
that said, an Activity could be embedded in a TaskFragment of which
bounds are smaller its minimum dimensions.
This CL add the minimum dimensions on several places:

WM core:
1. Verify minimum dimension requirement before adding an Activity to
   a TaskFragment. It'll be early return if the requirement is not
   satisfied.
2. Propagate the minimum dimensions to the client side through
   TaskFragmentInfo to notify the requirement.
3. If TaskFragmentOrganizer tries to shrink a TaskFragment to
   the bounds that smaller than minimum dimensions of its children
   Activity, switch to match the parent bounds.
AndroidX Window extensions:
1. Early return if TaskFragment is resized to the bounds that smaller
   than minimum dimensions which dispatched from the server side.
2. When organizer tries to show Activities side-by-side, verify if
   minimum dimensions requirement of the primary Activiy. If the
   requirement is not satisfied, show Activities in fullscreen
   instead.
TODO: Add an API to check if an Activity intent is allowed to embed
   in a TaskFragment.

Bug: 232871351
Test: atest TaskFragmentOrganizerControllerTest
Test: atest TaskFragmentOrganizerTest TaskFragmentOrganizerPolicyTest
Test: atest SplitActivityLifecycleTest
Test: atest CtsWindowManagerJetpackTestCases
Test: atest WmJetpackUnitTests

Merged-In: Ib46c2cec2a0735b9e3f3420f2cb94754801b86b9
Change-Id: Ib46c2cec2a0735b9e3f3420f2cb94754801b86b9
2022-06-15 00:32:34 +08:00
Charles Chen
482fbfabd7 Respect minimum dimensions for embedded Activities
Before this CL, minimum dimensions of Activity wasn't respected,
that said, an Activity could be embedded in a TaskFragment of which
bounds are smaller its minimum dimensions.
This CL add the minimum dimensions on several places:

WM core:
1. Verify minimum dimension requirement before adding an Activity to
   a TaskFragment. It'll be early return if the requirement is not
   satisfied.
2. Propagate the minimum dimensions to the client side through
   TaskFragmentInfo to notify the requirement.
3. If TaskFragmentOrganizer tries to shrink a TaskFragment to
   the bounds that smaller than minimum dimensions of its children
   Activity, switch to match the parent bounds.
AndroidX Window extensions:
1. Early return if TaskFragment is resized to the bounds that smaller
   than minimum dimensions which dispatched from the server side.
2. When organizer tries to show Activities side-by-side, verify if
   minimum dimensions requirement of the primary Activiy. If the
   requirement is not satisfied, show Activities in fullscreen
   instead.
TODO: Add an API to check if an Activity intent is allowed to embed
   in a TaskFragment.

Bug: 232871351
Test: atest TaskFragmentOrganizerControllerTest
Test: atest TaskFragmentOrganizerTest TaskFragmentOrganizerPolicyTest
Test: atest SplitActivityLifecycleTest
Test: atest CtsWindowManagerJetpackTestCases
Test: atest WmJetpackUnitTests

Change-Id: Ib46c2cec2a0735b9e3f3420f2cb94754801b86b9
2022-05-31 23:25:18 +08:00
Chris Li
7c2912df8f Merge "Fix ConcurrentModificationException on finishing TaskFragment" into tm-dev am: 0d7ece81e8 am: 91b3e6b447
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18615113

Change-Id: I2e47be05d9862a8fb076e3430496707d1b249de6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 12:25:45 +00:00
Chris Li
4813b27d00 Fix ConcurrentModificationException on finishing TaskFragment
Fix: 228201646
Test: atest WMJetpackUnitTests:SplitControllerTest
Change-Id: I4569e48fa7e5c020f440f00f0027e560d33e647f
2022-05-27 11:17:50 +08:00
TreeHugger Robot
47a12740a2 Merge "Add pendingAppearedIntent to TaskFragmentContainer" into tm-dev am: 3f75b0485a am: 8fcee62b42
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18581805

Change-Id: Ibc0c69964a802f96e6982e5a5982d6a3a5032939
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-26 19:47:11 +00:00
Chris Li
f7f106b437 Add pendingAppearedIntent to TaskFragmentContainer
1. When an activity is launched without specifying launch TaskFragment,
   it may be placed to the primary TaskFragment of a split if all
   activities in secondary split are finishing. In this case, we still
   want to check if activity should be splitted with the activity below.

   In order to do that, we need to know if it should be split with the
   secondary TaskFragment, which may still be empty, so store the
   pending appeared Intent until the TaskFragment becomes non-empty.

   i.  The secondary TaskFragment can be empty when the primary trys to
       start the secondary during #onCreated.
   ii. If the Intent never actually started, it will trigger
       #onTaskFragmentAppearEmptyTimeout to update the existing top
       container.

2. When we are finishing a TaskFragment, we used to finish all
   activities in it as well. We should not do that for activity that is
   requested to be reparented (as pending appeared).

Fix: 233684054
Test: atest WMJetpackUnitTests:TaskFragmentContainerTest
Test: atest WMJetpackUnitTests:SplitControllerTest
Change-Id: I47329b23709da7e069a6a0c84124a3d7d08aae12
2022-05-26 06:31:44 +00:00
Andrii Kulian
0eea298a34 Merge "Synchronize SplitController" into tm-dev am: d4d0fee814 am: a15c08cb85
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18418602

Change-Id: I251c1d1e2ee68cf2fff3e56a0c5db5b24b9b61d8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-25 18:42:26 +00:00
Andrii Kulian
40a67faae4 Synchronize SplitController
Adding synchronization to the public methods in SplitController,
as they might be called on different threads and cause a
ConcurrentModificationException.

Bug: 228201646
Test: atest CtsWindowManagerJetpackTestCases --iterations 100
Change-Id: I2db9ccb5e9829487eae7aa85eff5f6153721cc04
2022-05-25 03:32:54 +00:00
TreeHugger Robot
f50591c036 Merge "Do not resolve activity creation if it is in unknown TaskFragment" into tm-dev am: 327887fad9 am: ef17f29be0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18482930

Change-Id: I15badec21bb7a60ead9d8099510996bb5ef8f658
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-24 11:55:30 +00:00
Chris Li
9d4244ee6f Do not resolve activity creation if it is in unknown TaskFragment
This can happen in two cases:
1. The activity is embedded in another app. Then the current organizer
   shouldn't control it.
2. The activity is in a TaskFragment that the organizer just request to
   remove, but hasn't reach the server side. Then the activity will soon
   be finished with the TaskFragment.

In either case, the organizer shouldn't need to resolve it. Otherwise it
may incorrectly change the state, such as entering split for a finishing
activity.

Bug: 233295443
Test: atest WMJetpackUnitTests:SplitControllerTest
Change-Id: I5d2028dd45abd8d20a8e82bc4e51c4d6dc6e26ee
2022-05-24 10:05:14 +08:00
Diego Vela
f85539b1bd Merge "Fix no features emitting." into tm-qpr-dev 2022-05-20 16:06:08 +00:00
Diego Vela
a8d0f22b7e Fix no features emitting.
Fix no features emitting by emitting if they are present.
Ignore emitting features if the current state is not valid.
No features are emitted on registration because consumers are not
registered to the source.
The following tests ar fixed
 ExtensionWindowLayoutComponent#testDisplayFeatures
 ExtensionWindowLayoutComponentTest#testSidecarHasSameDisplayFeatures
 ExtensionWindowLayoutComponentTest#testGetWindowLayoutInfo_windowRecreated_windowLayoutUpdates
 ExtensionWindowLayoutComponentTest#testGetWindowLayoutInfo_configChanged_windowLayoutUpdates
 ExtensionWindowLayoutComponentTest#testGetWindowLayoutInfo_windowRecreated_windowLayoutUpdates

Bug: 232354881
Test: atest CtsWindowManagerJetpackTestCases:ExtensionWindowLayoutComponent
Change-Id: Ia1f7631576bad0bbefdca0fea3308973c5514056
2022-05-19 20:38:51 -07:00
Chris Li
b0354b94c3 Merge "Don't bring the Task to front when launching placeholder in background" into tm-dev am: 721a2e8fc6 am: 23c0f4b9f7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18451946

Change-Id: I2d269740fedee79e14575b86e9f18e9145b2d830
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-19 09:31:07 +00:00
Chris Li
8891a579a9 Don't bring the Task to front when launching placeholder in background
If the secondary TaskFragment becomes empty, it may trigger to launch
the placeholder activity. If this happens when the Task is in the
background, we don't want the placeholder launch to bring the Task to
the front.

Fix: 232828672
Test: atest WMJetpackUnitTests:SplitControllerTest
Change-Id: Idc159a8c8117e6cc601d7f8650bcfa3c575af076
2022-05-19 08:43:25 +08:00
Chris Li
90bc9a17ac Merge "Cleanup handleActivityCreated" into tm-dev am: 5284c9b855 am: 993a098f61
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18179569

Change-Id: If304f1810abe8be3b249a516b5cd57930f5713c2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-13 08:59:42 +00:00
Chris Li
5284c9b855 Merge "Cleanup handleActivityCreated" into tm-dev 2022-05-13 05:41:30 +00:00
TreeHugger Robot
a15cb53989 Merge "Running SysUI e2e tests as a presubmit for libs/WindowManager/" into tm-dev am: 73843a56b4 am: 30b4b87bfa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18177204

Change-Id: I42b4cd0dd681cf4da8b5405d8b89e8352de9b31b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 20:18:26 +00:00
TreeHugger Robot
73843a56b4 Merge "Running SysUI e2e tests as a presubmit for libs/WindowManager/" into tm-dev 2022-05-12 19:15:22 +00:00
An An Yu
7f59598cd1 Merge "Update ActivityEmbedding default TaskFragment animations to crossfade." into tm-dev am: ca2a3e01da am: 5fb12d298f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17756833

Change-Id: Iff3431a020000c58ba235f1141b37e211a0c1871
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 17:59:46 +00:00
An An Yu
ca2a3e01da Merge "Update ActivityEmbedding default TaskFragment animations to crossfade." into tm-dev 2022-05-12 16:00:51 +00:00
Chris Li
e5d99bf4e6 Merge "Handle onActivityReparentToTask for activity in other process" into tm-dev am: 9b36cc92eb am: 3829254960
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17950644

Change-Id: I8b3a087cf289d682bca285ebaf0e2d10b32d4541
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 12:42:09 +00:00
Chris Li
9e5fc94412 Cleanup handleActivityCreated
1. For new created activity, check if it should be split with the other
   activity that is currently split with the activity below.
2. When the activity is reparented back to the Task from PiP window,
   check if it can be split with the existing.
3. Breakdown the long #handleActivityCreated to smaller pieces.

Bug: 225371112
Test: atest WMJetpackUnitTests:SplitControllerTest
Test: atest WMJetpackUnitTests:TaskFragmentContainerTest
Change-Id: Iba9f1487328768f5f2c27241d04c57ee7e5ed1d4
2022-05-12 19:14:32 +08:00
Chris Li
238e0b32bb Handle onActivityReparentToTask for activity in other process
1. Refactor onStartActivity so that we can reuse the same logic for
   onActivityReparentToTask. Also cleanup the logic there.
2. Besides the launching activity, check if the launched activity can be
   split with the top activities.

Bug: 225371112
Test: atest WMJetpackUnitTests:SplitControllerTest
Test: atest WMJetpackUnitTests:TaskContainerTest
Change-Id: I840766e4efaa4bdb9ec89cdca8b3c2c0bbe8cf8c
2022-05-12 11:13:05 +08:00
An An Yu
55ab97b862 Update ActivityEmbedding default TaskFragment animations to crossfade.
Test: tested locally on 1p app.

Change-Id: I1c4bd4d51ad0a9c909cf2cb002849b267868e1f2
2022-05-11 21:40:11 +00:00
Chris Li
499dfefff6 Merge "Remove pendingAppearedActivity when activity is destroyed" into tm-dev am: c9ab8713b8 am: f65980ca69
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18186206

Change-Id: I0dcfa4a9565dfbda4346a9fd059bdd07772dec12
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-10 21:17:08 +00:00
Chris Li
c9ab8713b8 Merge "Remove pendingAppearedActivity when activity is destroyed" into tm-dev 2022-05-10 02:12:08 +00:00
Chris Li
bc4e03d19d Remove pendingAppearedActivity when activity is destroyed
Fix: 230688566
Test: atest WMJetpackUnitTests:SplitControllerTest
Change-Id: Ifbbfa50b402ccb5ac45445168e4b991ec13b8ae5
2022-05-09 13:05:40 +08:00
vadimt
8c381ecacf Running SysUI e2e tests as a presubmit for libs/WindowManager/
A CL in that directory had broken SysUI presubmits:
ag/18030738

Bug: 230793322, 202567877
Test: presubmit
Change-Id: If9b39f357948cefb12338f4477ac360a25783107
2022-05-06 13:56:06 -07:00
Andrii Kulian
bfded808a1 Merge "Don't send split info callback before activity is created" into tm-dev am: 7bc9ba3bc5 am: 130494a46e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17818103

Change-Id: I3d0c56462a04764e84d3fdd099c1ddc21776f49c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 19:57:35 +00:00
Andrii Kulian
7bc9ba3bc5 Merge "Don't send split info callback before activity is created" into tm-dev 2022-05-04 18:29:20 +00:00
Andrii Kulian
564e618d06 Don't send split info callback before activity is created
Sending a split info callback before activity created would
give developer a reference to a not fully initalized class.
It is possible that an attemp to apply actions to such an
activity in the split callback would lead to unexpected
issues for developers. E.g. one might assuming that the
UI for an activity would've been constructed at this point
and try to update it to fit the split or collapsed state
requirements.

Bug: 228770009
Test: atest CtsWindowManagerJetpackTestCases:ActivityEmbeddingLifecycleTests
Change-Id: I3a19a028ad6da9a6d534a97d315bce5f95b191af
2022-05-03 22:35:00 +00:00
Chris Li
c924a21b10 Merge "Don't launch placeholder for bottom TaskFragment when waiting for top" into tm-dev am: d4011e0e2b am: 38dbe45b22
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17983784

Change-Id: I705d957210730642bd4705986949f0c2c391586a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-03 14:42:51 +00:00
Charles Chen
6de7098922 Merge "Update SplitContainer for non-finishing containers" into tm-dev am: 9040b7e261 am: 912c76ad73
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18030508

Change-Id: I49a289a951c3555f99ab43b92f28c466c5852499
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-03 07:44:09 +00:00
Chris Li
c45e1c1ed5 Don't launch placeholder for bottom TaskFragment when waiting for top
1. When the top TaskFragment just appears, we should treat it as active
   even if it is empty, because we are expecting an activity to be
   launched into it soon. Before that happens, we don't want to launch
   placeholder for the activity behind.
2. When a TaskFragment is appeared as empty, set a timeout to remove it
   instead of waiting forever in case the activtiy start failed.

Fix: 230540531
Bug: 219683160
Test: atest WMJetpackUnitTests:SplitControllerTest
Test: atest WMJetpackUnitTests:TaskFragmentContainerTest
Change-Id: Ie05e379bf898b67912a849ad84f9fe7708e289c6
2022-05-03 15:24:33 +08:00
Charles Chen
9040b7e261 Merge "Update SplitContainer for non-finishing containers" into tm-dev 2022-05-03 06:37:26 +00:00
TreeHugger Robot
9385fc4b95 Merge "Notify organizer about TaskFragment parent windowing mode change" into tm-dev am: 6725f73a88 am: 963dc4e957
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18032087

Change-Id: I7bfbadc99a86f164c5d5a017af2f891b9ad73147
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-03 02:30:17 +00:00
TreeHugger Robot
d41c4d0a10 Merge "Reland "Allow activity in ActivityEmbedding to get Task windowing mode"" into tm-dev am: ddcd8e5e7f am: 76d6b5bb51
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18030865

Change-Id: If1f5a7a953eb4a831a611660be1a1fb1c6f4d59b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-02 22:53:18 +00:00
Sam Dubey
473216bc8a Merge "Revert "Allow activity in ActivityEmbedding split to get Task windowing mode"" into tm-dev am: 4cac1be2ee am: 63a5fc3fd2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18030738

Change-Id: Ic36b3c6d60c2f72be12613ba6606b87f6056ce5b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-29 21:05:22 +00:00