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

Commit 2829f685 authored by Mateusz Cicheński's avatar Mateusz Cicheński Committed by Automerger Merge Worker
Browse files

Merge "Use the task windowing mode to determine inheritance" into udc-qpr-dev...

Merge "Use the task windowing mode to determine inheritance" into udc-qpr-dev am: 0f78d29c am: ff93b9e8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24596120



Change-Id: I3781a59ed4794129f8ec9eb098c2f26eba74180a
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c8e8beba ff93b9e8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
            return false;
        }

        final int sourceWindowingMode = source.getWindowingMode();
        final int sourceWindowingMode = source.getTask().getWindowingMode();
        if (sourceWindowingMode != WINDOWING_MODE_FULLSCREEN
                && sourceWindowingMode != WINDOWING_MODE_FREEFORM) {
            return false;
+2 −1
Original line number Diff line number Diff line
@@ -1662,9 +1662,10 @@ public class ActivityStarterTests extends WindowTestsBase {

    @Test
    public void testResultCanceledWhenNotAllowedStartingActivity() {
        final Task task = new TaskBuilder(mSupervisor).build();
        final ActivityStarter starter = prepareStarter(0, false);
        final ActivityRecord targetRecord = new ActivityBuilder(mAtm).build();
        final ActivityRecord sourceRecord = new ActivityBuilder(mAtm).build();
        final ActivityRecord sourceRecord = new ActivityBuilder(mAtm).setTask(task).build();
        targetRecord.resultTo = sourceRecord;

        // Abort the activity start and ensure the sourceRecord gets the result (RESULT_CANCELED).
+33 −0
Original line number Diff line number Diff line
@@ -678,6 +678,39 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase {
                WINDOWING_MODE_FULLSCREEN);
    }

    @Test
    public void testInheritsSourceTaskWindowingModeWhenActivityIsInDifferentWindowingMode() {
        final TestDisplayContent fullscreenDisplay = createNewDisplayContent(
                WINDOWING_MODE_FULLSCREEN);
        final ActivityRecord source = createSourceActivity(fullscreenDisplay);
        source.setWindowingMode(WINDOWING_MODE_PINNED);
        source.getTask().setWindowingMode(WINDOWING_MODE_FREEFORM);

        assertEquals(RESULT_CONTINUE,
                new CalculateRequestBuilder().setSource(source).calculate());

        assertEquivalentWindowingMode(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode,
                WINDOWING_MODE_FULLSCREEN);
    }

    @Test
    public void testDoesNotInheritsSourceTaskWindowingModeWhenActivityIsInFreeformWindowingMode() {
        // The activity could end up in different windowing mode state after calling finish()
        // while the task would still hold the WINDOWING_MODE_PINNED state, or in other words
        // be still in the Picture in Picture mode.
        final TestDisplayContent fullscreenDisplay = createNewDisplayContent(
                WINDOWING_MODE_FULLSCREEN);
        final ActivityRecord source = createSourceActivity(fullscreenDisplay);
        source.setWindowingMode(WINDOWING_MODE_FREEFORM);
        source.getTask().setWindowingMode(WINDOWING_MODE_PINNED);

        assertEquals(RESULT_CONTINUE,
                new CalculateRequestBuilder().setSource(source).calculate());

        assertEquivalentWindowingMode(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode,
                WINDOWING_MODE_FULLSCREEN);
    }


    @Test
    public void testKeepsPictureInPictureLaunchModeInOptions() {