Fix animation target rule due to split screen arch change

Because singleTop root arch change, it makes animation target as
only one rather then both split root as target. It cause some
expection callback wrong for client such as shell split side and
Launcher side.
We should change animation target rule to follow previous behavior
before singleTop change.

Fix: 228572519
Test: manual
Test: pass existing tests
Change-Id: Id68cb0ae22ed39ad42d0593bf152f5bd3bd5f9f1
This commit is contained in:
Tony Huang
2022-04-20 16:54:59 +08:00
parent ac3033fd40
commit b307214724
3 changed files with 49 additions and 1 deletions

View File

@@ -912,6 +912,15 @@ public class AppTransitionController {
canPromote = false;
}
// If the current window container is task and it have adjacent task, it means
// both tasks will open or close app toghther but we want get their opening or
// closing animation target independently so do not promote.
if (current.asTask() != null
&& current.asTask().getAdjacentTaskFragment() != null
&& current.asTask().getAdjacentTaskFragment().asTask() != null) {
canPromote = false;
}
// Find all siblings of the current WindowContainer in "candidates", move them into
// a separate list "siblings", and checks if an animation target can be promoted
// to its parent.

View File

@@ -19,6 +19,7 @@ package com.android.server.wm;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.TRANSIT_CHANGE;
@@ -561,6 +562,37 @@ public class AppTransitionControllerTest extends WindowTestsBase {
opening, closing, false /* visible */));
}
@Test
public void testGetAnimationTargets_splitScreenOpening() {
// [DisplayContent] - [Task] -+- [split task 1] -+- [Task1] - [AR1] (opening, invisible)
// +- [split task 2] -+- [Task2] - [AR2] (opening, invisible)
final Task singleTopRoot = createTask(mDisplayContent);
final TaskBuilder builder = new TaskBuilder(mSupervisor)
.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW)
.setParentTaskFragment(singleTopRoot)
.setCreatedByOrganizer(true);
final Task splitRoot1 = builder.build();
final Task splitRoot2 = builder.build();
splitRoot1.setAdjacentTaskFragment(splitRoot2, false /* moveTogether */);
final ActivityRecord activity1 = createActivityRecordWithParentTask(splitRoot1);
activity1.setVisible(false);
activity1.mVisibleRequested = true;
final ActivityRecord activity2 = createActivityRecordWithParentTask(splitRoot2);
activity2.setVisible(false);
activity2.mVisibleRequested = true;
final ArraySet<ActivityRecord> opening = new ArraySet<>();
opening.add(activity1);
opening.add(activity2);
final ArraySet<ActivityRecord> closing = new ArraySet<>();
// Promote animation targets up to Task level, not beyond.
assertEquals(
new ArraySet<>(new WindowContainer[]{splitRoot1, splitRoot2}),
AppTransitionController.getAnimationTargets(
opening, closing, true /* visible */));
}
@Test
public void testGetAnimationTargets_openingClosingTaskFragment() {
// [DefaultTDA] - [Task] -+- [TaskFragment1] - [ActivityRecord1] (opening, invisible)

View File

@@ -1294,6 +1294,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
private TaskFragment mParentTaskFragment;
private boolean mCreateActivity = false;
private boolean mCreatedByOrganizer = false;
TaskBuilder(ActivityTaskSupervisor supervisor) {
mSupervisor = supervisor;
@@ -1385,6 +1386,11 @@ class WindowTestsBase extends SystemServiceTestsBase {
return this;
}
TaskBuilder setCreatedByOrganizer(boolean createdByOrganizer) {
mCreatedByOrganizer = createdByOrganizer;
return this;
}
Task build() {
SystemServicesTestRule.checkHoldsLock(mSupervisor.mService.mGlobalLock);
@@ -1420,7 +1426,8 @@ class WindowTestsBase extends SystemServiceTestsBase {
.setActivityInfo(mActivityInfo)
.setIntent(mIntent)
.setOnTop(mOnTop)
.setVoiceSession(mVoiceSession);
.setVoiceSession(mVoiceSession)
.setCreatedByOrganizer(mCreatedByOrganizer);
final Task task;
if (mParentTaskFragment == null) {
task = builder.setActivityType(mActivityType)