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

Commit d276eb1b authored by Massimo Carli's avatar Massimo Carli Committed by Android (Google) Code Review
Browse files

Merge "Fix exit transition from PIP" into main

parents bdaf3afb a6b4e3d6
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -196,10 +196,11 @@ class TransparentPolicy {

    // We evaluate the case when the policy should not be applied.
    private boolean shouldSkipTransparentPolicy(@Nullable ActivityRecord opaqueActivity) {
        if (opaqueActivity == null || opaqueActivity.isEmbedded()) {
        if (opaqueActivity == null || opaqueActivity.isEmbedded()
                || !opaqueActivity.areBoundsLetterboxed()) {
            // We skip letterboxing if the translucent activity doesn't have any
            // opaque activities beneath or the activity below is embedded which
            // never has letterbox.
            // never has letterbox or the activity is not letterboxed at all.
            return true;
        }
        final AppCompatSizeCompatModePolicy scmPolicy = mActivityRecord.mAppCompatController
+4 −0
Original line number Diff line number Diff line
@@ -259,6 +259,10 @@ class AppCompatActivityRobot {
        doReturn(embedded).when(mActivityStack.top()).isEmbedded();
    }

    void setTopActivityHasLetterboxedBounds(boolean letterboxed) {
        doReturn(letterboxed).when(mActivityStack.top()).areBoundsLetterboxed();
    }

    void setTopActivityVisible(boolean isVisible) {
        doReturn(isVisible).when(mActivityStack.top()).isVisible();
    }
+14 −0
Original line number Diff line number Diff line
@@ -217,6 +217,19 @@ public class TransparentPolicyTest extends WindowTestsBase {
        });
    }

    @Test
    public void testNotApplyStrategyToTranslucentActivitiesOverNotLetterboxedActivities() {
        runTestScenario((robot) -> {
            robot.transparentActivity((ta) -> {
                ta.activity().setTopActivityHasLetterboxedBounds(false);
                ta.launchTransparentActivityInTask();

                ta.checkTopActivityTransparentPolicyStartNotInvoked();
                ta.checkTopActivityTransparentPolicyStateIsRunning(/* running */ false);
            });
        });
    }

    @EnableFlags(com.android.window.flags.Flags.FLAG_RESPECT_NON_TOP_VISIBLE_FIXED_ORIENTATION)
    @Test
    public void testNotRunStrategyToTranslucentActivitiesIfRespectOrientation() {
@@ -388,6 +401,7 @@ public class TransparentPolicyTest extends WindowTestsBase {
            mTransparentActivityRobot = new AppCompatTransparentActivityRobot(activity());
            // We always create at least an opaque activity in a Task
            activity().createNewTaskWithBaseActivity();
            activity().setTopActivityHasLetterboxedBounds(true);
        }

        @Override