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

Commit a254dd28 authored by Massimo Carli's avatar Massimo Carli
Browse files

[80/n] Use single surface as default strategy

It's easier to handle multiple surfaces only in case the top activity
is transparent.

The heuristic will be improved knowing if the rounded corners have been
already applied on the main activity or if some action will be required in
Shell (e.g. specific rounded corners implementation in Shell).

Flag: EXEMPT Refactoring
Bug: 377875146
Test: atest WMShellUnitTests:LetterboxControllerStrategyTest

Change-Id: I827c887913ff2dfe53efee4e3f960f3cd6169061
parent 9f757ebe
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -44,15 +44,14 @@ class LetterboxControllerStrategy @Inject constructor(
        // Decides whether to use a single surface or multiple surfaces for the letterbox.
        // The primary trade-off is memory usage versus rendering performance.
        //
        // A single surface is used for letterboxes with rounded corners on opaque activities
        // and always for Bubble. In all other cases, such as for letterboxes with straight corners
        // or for those with rounded corners on a translucent activity, we use multiple surfaces to
        // ensure better performance.
        // The multi surfaces approach is only used when the activity is transparent. The single
        // surface approach is the default one because it is easier and less expensive to handle.
        // TODO(b/377875146): Improve heuristic for single/multiple surfaces
        currentMode = when {
            event.isBubble -> SINGLE_SURFACE
            event.isTranslucent -> MULTIPLE_SURFACES
            letterboxConfiguration.isLetterboxActivityCornersRounded() -> SINGLE_SURFACE
            else -> MULTIPLE_SURFACES
            else -> SINGLE_SURFACE
        }
        supportsInputSurface = event.supportsInput
    }
+2 −2
Original line number Diff line number Diff line
@@ -98,11 +98,11 @@ class LetterboxControllerStrategyTest : ShellTestCase() {
    }

    @Test
    fun `LetterboxMode is MULTIPLE_SURFACES with no rounded corners`() {
    fun `LetterboxMode is SINGLE_SURFACE with no rounded corners`() {
        runTestScenario { r ->
            r.configureRoundedCornerRadius(false)
            r.configureLetterboxMode()
            r.checkLetterboxModeIsMultiple()
            r.checkLetterboxModeIsSingle()
        }
    }