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

Commit 7da06c35 authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas
Browse files

Don't show the user aspect ratio button for transparent activities

If a permission dialog is showing, don't show the user aspect ratio
button as clicking it will take you to the app info page of the
permission dialog and not of the underlying app.

Fix: 296158940
Test: atest WmTests:TaskTests#testTopActivityEligibleForUserAspectRatioButton
Change-Id: Iceb98639de81f043c418d825cf4a270d23d1e801
parent 22daeee1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3513,7 +3513,8 @@ class Task extends TaskFragment {
        }
        appCompatTaskInfo.topActivityEligibleForUserAspectRatioButton = top != null
                && !appCompatTaskInfo.topActivityInSizeCompat
                && top.mLetterboxUiController.shouldEnableUserAspectRatioSettings();
                && top.mLetterboxUiController.shouldEnableUserAspectRatioSettings()
                && !info.isTopActivityTransparent;
        appCompatTaskInfo.topActivityBoundsLetterboxed = top != null  && top.areBoundsLetterboxed();
    }

+7 −0
Original line number Diff line number Diff line
@@ -574,6 +574,7 @@ public class TaskTests extends WindowTestsBase {
        spyOn(root);
        spyOn(root.mLetterboxUiController);

        doReturn(true).when(root).fillsParent();
        doReturn(true).when(root.mLetterboxUiController)
                .shouldEnableUserAspectRatioSettings();
        doReturn(false).when(root).inSizeCompatMode();
@@ -596,6 +597,12 @@ public class TaskTests extends WindowTestsBase {
        assertFalse(task.getTaskInfo()
                .appCompatTaskInfo.topActivityEligibleForUserAspectRatioButton);
        doReturn(false).when(root).inSizeCompatMode();

        // When the top activity is transparent, the button is not enabled
        doReturn(false).when(root).fillsParent();
        assertFalse(task.getTaskInfo()
                .appCompatTaskInfo.topActivityEligibleForUserAspectRatioButton);
        doReturn(true).when(root).fillsParent();
    }

    /**