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

Commit 5e15b4a0 authored by Louis Chang's avatar Louis Chang Committed by Automerger Merge Worker
Browse files

Merge "Skip letterboxing if the activity below is embedded" into udc-dev am: 901e2ccf

parents 15c7580c 901e2ccf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1395,9 +1395,9 @@ final class LetterboxUiController {
                FIRST_OPAQUE_NOT_FINISHING_ACTIVITY_PREDICATE /* callback */,
                mActivityRecord /* boundary */, false /* includeBoundary */,
                true /* traverseTopToBottom */);
        if (firstOpaqueActivityBeneath == null) {
        if (firstOpaqueActivityBeneath == null || firstOpaqueActivityBeneath.isEmbedded()) {
            // We skip letterboxing if the translucent activity doesn't have any opaque
            // activities beneath
            // activities beneath or the activity below is embedded which never has letterbox.
            return;
        }
        inheritConfiguration(firstOpaqueActivityBeneath);
+18 −0
Original line number Diff line number Diff line
@@ -383,6 +383,24 @@ public class SizeCompatTests extends WindowTestsBase {
        assertEquals(opaqueBounds, translucent2RequestedBounds);
    }

    @Test
    public void testNotApplyStrategyToTranslucentActivitiesOverEmbeddedActivities() {
        mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
        setUpDisplaySizeWithApp(2000, 1000);
        mActivity.info.screenOrientation = SCREEN_ORIENTATION_PORTRAIT;
        mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
        // Mock the activity as embedded without additional TaskFragment layer in the task for
        // simplicity.
        doReturn(true).when(mActivity).isEmbedded();
        // Translucent Activity
        final ActivityRecord translucentActivity = new ActivityBuilder(mAtm).build();
        doReturn(false).when(translucentActivity).matchParentBounds();
        doReturn(false).when(translucentActivity).fillsParent();
        mTask.addChild(translucentActivity);
        // Check the strategy has not being applied
        assertFalse(translucentActivity.mLetterboxUiController.hasInheritedLetterboxBehavior());
    }

    @Test
    public void testTranslucentActivitiesDontGoInSizeCompactMode() {
        mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);