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

Commit 55b01a4c authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Force embedded activity resizable

Assume the host task should be resizable so the embedded
activities belonging to the task should also be resizable.

Because an activity may not want to be put in system split
screen but allow to be embedded by a resizable task. This
change make the activity fit the bounds of the task fragment
instead of being letterboxed.

Bug: 199581491
Test: Launch a unresizable activity to embedded split.
Change-Id: Ibe0c41cc27de4d285f4e5ebd2fd75ed13ef96fbc
parent 0bce8531
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2596,6 +2596,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return parent != null ? parent.getOrganizedTaskFragment() : null;
    }

    boolean isEmbedded() {
        final TaskFragment parent = getTaskFragment();
        return parent != null && parent.isEmbedded();
    }

    @Override
    @Nullable
    TaskDisplayArea getDisplayArea() {
@@ -2687,7 +2692,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    boolean isResizeable() {
        return mAtmService.mForceResizableActivities
                || ActivityInfo.isResizeableMode(info.resizeMode)
                || info.supportsPictureInPicture();
                || info.supportsPictureInPicture()
                // If the activity can be embedded, it should inherit the bounds of task fragment.
                || isEmbedded();
    }

    /** @return whether this activity is non-resizeable but is forced to be resizable. */
+3 −1
Original line number Diff line number Diff line
@@ -2724,9 +2724,11 @@ public class ActivityRecordTests extends WindowTestsBase {
                mAtm, null /* fragmentToken */, false /* createdByOrganizer */);
        fragmentSetup.accept(taskFragment2, new Rect(width / 2, 0, width, height));
        task.addChild(taskFragment2, POSITION_TOP);
        final ActivityRecord activity2 = new ActivityBuilder(mAtm).build();
        final ActivityRecord activity2 = new ActivityBuilder(mAtm)
                .setResizeMode(ActivityInfo.RESIZE_MODE_UNRESIZEABLE).build();
        activity2.mVisibleRequested = true;
        taskFragment2.addChild(activity2);
        assertTrue(activity2.isResizeable());
        activity1.reparent(taskFragment1, POSITION_TOP);

        assertEquals(task, activity1.mStartingData.mAssociatedTask);