Commit Graph

181 Commits

Author SHA1 Message Date
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
Chris Li
f8a165d8b0 Notify organizer about TaskFragment parent windowing mode change
1. When the Task windowing mode changes, notify the organizer.
2. When organizer requests windowing mode change, record the last
   request value to avoid unnecessary IPC call.

Bug: 230446204
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Test: atest WMJetpackUnitTests:SplitPresenterTest
Change-Id: I30c5dbf7b70d085647490943508bd5d22fda3ead
2022-04-29 18:18:31 +08:00
Charles Chen
3e93b2623c Update SplitContainer for non-finishing containers
If an app is split with an Activity from another process
by Activity Embedding feature, and is launched twice
with different orientations, there's a chance that
the app still shows in previous orientation at the second
launch even if the orientation is changed.

The root cause is that, the app goes back to background
before the secondary container receives its TaskFragmentInfo.

Also, there's no pendingActivities and #onActivityPostCreated
won't be invoked, and also #updateContainer to change its
layout, because the Activity is from other process.

Moreover, in #onTaskFragmentParentInfoChanged, updateContainer
is skipped because secondary container is empty(No pending activities,
and hasn't received its TaskFragmentInfo).

This CL fixes the issue by verifying if one or both containers are
finished instead.

fixes: 228906392
Test: atest SplitControllerTest
Test: manual - reproducible steps in bug

Change-Id: Ifba4b56c9225089776835aeeef7c4a13249b55bf
2022-04-29 17:46:55 +08:00
Chris Li
10e4a19ef4 Reland "Allow activity in ActivityEmbedding to get Task windowing mode"
This reverts commit 0dc147eeee.

Before, when we are in ActivityEmbedding split, the TaskFragment
windowing mode is always set the WINDOWING_MODE_MULTI_WINDOW, which
overrides the activity windowing mode, and it causes the app process
unaware of the Task windowing mode. Now, when the Task is multi
windowing mode, we set the TaskFragment windowing mode to the same as
the Task.

Bug: 230446204
Change-Id: I61b0857c551e6fd4ee9a544b63a3a2c20e291fab
Test: atest WMJetpackUnitTests:JetpackTaskFragmentOrganizerTest
Test: atest WMJetpackUnitTests:TaskContainerTest
2022-04-29 11:28:14 +08:00
Sam Dubey
0dc147eeee Revert "Allow activity in ActivityEmbedding split to get Task windowing mode"
This reverts commit 0522842a34.

Reason for revert: Breaking PlatformScenarioTests Tests due to NPE

Bug: 230793322
Change-Id: Ib6a9a1b7fb1c95681fc7a1bb959da5618b840f16
2022-04-29 01:49:39 +00:00
TreeHugger Robot
3dd5217d92 Merge "Allow activity in ActivityEmbedding split to get Task windowing mode" into tm-dev am: 8358f51ed3 am: 7c9f75dba7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17905030

Change-Id: I27001f0eee7bde846140a6fa9aea48063917c06b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-28 08:41:56 +00:00
Chris Li
0522842a34 Allow activity in ActivityEmbedding split to get Task windowing mode
Before, when we are in ActivityEmbedding split, the TaskFragment
windowing mode is always set the WINDOWING_MODE_MULTI_WINDOW, which
overrides the activity windowing mode, and it causes the app process
unaware of the Task windowing mode. Now, when the Task is multi
windowing mode, we set the TaskFragment windowing mode to the same as
the Task.

Bug: 230446204
Test: atest WMJetpackUnitTests:JetpackTaskFragmentOrganizerTest
Test: atest WMJetpackUnitTests:TaskContainerTest
Change-Id: Id78a86359297c0c225043b14844441445711f89d
2022-04-27 12:52:46 +08:00
Chris Li
f87b7cc6f1 Merge "Keep the focus on the primary when launch ActivityEmbedding placeholder" into tm-dev am: 301ff2fec1 am: 37d3bc3d29
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17913434

Change-Id: I5eaf0513d313bbb3cf0b95ec8a22bce18bc9e0b8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 04:45:49 +00:00
Chris Li
301ff2fec1 Merge "Keep the focus on the primary when launch ActivityEmbedding placeholder" into tm-dev 2022-04-27 04:16:53 +00:00
Chris Li
88d2969586 Merge "Add TaskFragmentOrganizer#onActivityReparentToTask" into tm-dev am: 0b91be7283 am: 0676135870
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17817304

Change-Id: I44fd3e54bc9e0f786df4bf3f7873ac12135cd819
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-25 10:56:38 +00:00
Chris Li
c21254f45b Keep the focus on the primary when launch ActivityEmbedding placeholder
Default focus should be on primaryActivity when a placeholder is shown.
This is a short term improvement as focus navigation works from primary
to secondary but not in reverse.

Fix: 229138140
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Change-Id: Ic4e2280e4b37a8fa04fc532245a5d0cfa4e5e012
2022-04-24 16:57:10 +08:00
Chris Li
9e08260cce Add TaskFragmentOrganizer#onActivityReparentToTask
When the activity exits PiP and is reparented to the original Task, the
organizer should handle it as a new launch.

Bug: 225371112
Test: atest WmTests:TaskFragmentTest
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Change-Id: Ia7e32e995a35e167b0d76e701c972b269ae068cc
2022-04-22 17:36:02 +08:00
Chris Li
1ed6fb37dc Merge "Fix crash in getParentContainerBounds" into tm-dev am: 701b3f759c am: 3cbdebae0f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17800407

Change-Id: Ie138e2cbf058bde031ba1c6e634a9b44f240828e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 13:56:32 +00:00
Chris Li
e382326e3d Fix crash in getParentContainerBounds
Before, before TaskFragment appeared, the getTopNonFinishingActivity may
be null, and throw exception for no bounds found.
Now, make sure we always have Task bounds stored.

Bug: 228885031
Test: atest WMJetpackUnitTests:SplitControllerTest
Test: atest WMJetpackUnitTests:TaskContainerTest
Change-Id: I3744813a85f24941563c8ff8f284b2e45396f906
2022-04-20 15:45:09 +08:00
Samuel Solomon
4bf188817c Wait for Folding Feature State
Adding a change for a device state to be
found by DeviceStateManagerFoldingFeatureProducer
before it reports back the display features.

Bug: 223237296
Test: NA
Change-Id: Iad15ea6e66209a15fefdcf1b7d0a39796a28a1de
2022-04-19 17:00:16 +00:00