Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3072147 authored by Tony Huang's avatar Tony Huang
Browse files

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
parent ac3033fd
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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.
+32 −0
Original line number Diff line number Diff line
@@ -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)
+8 −1
Original line number Diff line number Diff line
@@ -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)