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

Commit 7fe350ea authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix animation target rule due to split screen arch change" into tm-dev am: 992c55b4

parents 45d571ef 992c55b4
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;
@@ -552,6 +553,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
@@ -1290,6 +1290,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
        private TaskFragment mParentTaskFragment;

        private boolean mCreateActivity = false;
        private boolean mCreatedByOrganizer = false;

        TaskBuilder(ActivityTaskSupervisor supervisor) {
            mSupervisor = supervisor;
@@ -1381,6 +1382,11 @@ class WindowTestsBase extends SystemServiceTestsBase {
            return this;
        }

        TaskBuilder setCreatedByOrganizer(boolean createdByOrganizer) {
            mCreatedByOrganizer = createdByOrganizer;
            return this;
        }

        Task build() {
            SystemServicesTestRule.checkHoldsLock(mSupervisor.mService.mGlobalLock);

@@ -1416,7 +1422,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)