Commit Graph

24 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
Chris Li
720ae87d6b Allow delete empty TaskFragment in PiP
We ignore WCT for TaskFragment in PiP, but in case the empty
TaskFragment is not removed before the Task enters PiP, we should allow
organizer to remove it.

Also make sure we have all requests in one WCT during
onTaskFragmentInfoChanged.

Bug: 225371112
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Test: atest WMJetpackUnitTests:SplitControllerTest
Test: atest WMJetpackUnitTests:TaskFragmentContainerTest
Change-Id: I718bbb7f6c18c35048c671ed3c131eaf536cf265
2022-04-18 18:12:05 +08:00
Charles Chen
77071e8140 Promote WMJetpackUnitTests to presubmit
Test: atest TestMappingsValidation#testTestSuiteSetting
Test: atest -p frameworks/base/libs/WindowManager/Jetpack/src:presubmit
Bug: 227710854
Change-Id: I2f8ac0452f26501d972cd9a12f0d0a3a90f7a8ae
2022-04-08 15:51:50 +08:00
Pablo Gamito
e2a041cf92 Merge "Update component ids from Winscope to Flicker" am: d41316339d am: 1016b2d3c2 am: b9a97d8d9b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2055046

Change-Id: If7f4442f602e60ca1a5322e02484cace47ce89a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-05 15:19:51 +00:00
Pablo Gamito
85c38bd427 Update component ids from Winscope to Flicker
Test: N/A
Change-Id: I5bc614c406535b0f282cb9d948e426e879d3a069
2022-04-04 22:31:02 +00:00
Chris Li
add68184dd Register remote animation per Task
Before, we register remote animation per organizer, and assume it only
organizes in one Task. Now, we register per organizer Task if there is a
rule that supports split in the Task width.

Bug: 207720388
Test: atest WMJetpackUnitTests
Change-Id: Iac4e10af9aa0e7846c81b036b2cf708b6cbe627e
2022-04-01 16:47:46 +08:00
Charles Chen
745801fe80 Make WM Jetpack unit tests mockable
Also adding a test to prove it's usable.

Test: atest SplitControllerTest
Bug: 219652919
Change-Id: I8a01ab0fb7e74739a626624f00a772c136771de7
2022-03-30 06:13:34 +00:00
TreeHugger Robot
e210469f90 Merge "Initial infra for WM Jetpack unit tests" into tm-dev 2022-03-25 00:12:18 +00:00
Charles Chen
08e542d05f Initial infra for WM Jetpack unit tests
Bug: 219652919
Test: atest WMJetpackUnitTests
Change-Id: I0b3793de206edd6a88a72dbd5daa1be4504e171d
2022-03-24 22:35:54 +08:00
Charles Chen
451e2ee39d Add OWNERS file for WM Jetpack library tests
Test: presubmit
Bug: 219652919
Change-Id: I95c609eeff47bef9ae45a5e9847eb56efc622b83
2022-03-24 00:11:32 +08:00