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

Commit 8765e421 authored by Massimo Carli's avatar Massimo Carli
Browse files

Fix letterboxing in bubble

For a better user experience we disable letterboxing in case
an activity is launched from a bubble.

Fix: 316502721
Test: atest WmTests:LetterboxUiControllerTest
Test: atest WmTests:ActivityRecordTests
Test: atest WmTests:ActivityRecordTests

Change-Id: I75859a38e22a0445a9aed02f91f6a2e5a48f837d
parent 6a7bdd3d
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -8507,8 +8507,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        applySizeOverrideIfNeeded(newParentConfiguration, parentWindowingMode, resolvedConfig);

        final boolean isFixedOrientationLetterboxAllowed =
                parentWindowingMode == WINDOWING_MODE_MULTI_WINDOW
        // Bubble activities should always fill their parent and should not be letterboxed.
        final boolean isFixedOrientationLetterboxAllowed = !getLaunchedFromBubble()
                && (parentWindowingMode == WINDOWING_MODE_MULTI_WINDOW
                        || parentWindowingMode == WINDOWING_MODE_FULLSCREEN
                        // When starting to switch between PiP and fullscreen, the task is pinned
                        // and the activity is fullscreen. But only allow to apply letterbox if the
@@ -8516,7 +8517,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                        || (!mWaitForEnteringPinnedMode
                                && parentWindowingMode == WINDOWING_MODE_PINNED
                                && resolvedConfig.windowConfiguration.getWindowingMode()
                                        == WINDOWING_MODE_FULLSCREEN);
                                        == WINDOWING_MODE_FULLSCREEN));
        // TODO(b/181207944): Consider removing the if condition and always run
        // resolveFixedOrientationConfiguration() since this should be applied for all cases.
        if (isFixedOrientationLetterboxAllowed) {
+11 −0
Original line number Diff line number Diff line
@@ -921,6 +921,17 @@ public class SizeCompatTests extends WindowTestsBase {
                mActivity.findMainWindow()));
    }

    @Test
    public void testIsLetterboxed_activityFromBubble_returnsFalse() {
        setUpDisplaySizeWithApp(1000, 2500);
        mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
        spyOn(mActivity);
        doReturn(true).when(mActivity).getLaunchedFromBubble();
        prepareUnresizable(mActivity, SCREEN_ORIENTATION_LANDSCAPE);

        assertFalse(mActivity.areBoundsLetterboxed());
    }

    @Test
    public void testAspectRatioMatchParentBoundsAndImeAttachable() {
        setUpApp(new TestDisplayContent.Builder(mAtm, 1000, 2000).build());