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

Commit 8668ae66 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove always compose flag" into main

parents 78a34d01 afc12fdc
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -1816,16 +1816,6 @@ flag {
    is_fixed_read_only: true
}

flag {
    name: "always_compose_qs_ui_fragment"
    namespace: "systemui"
    description: "Have QQS and QS scenes in the Compose fragment always composed, not just when it should be visible."
    bug: "389985793"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "move_transition_animation_layer"
    namespace: "systemui"
+59 −85
Original line number Diff line number Diff line
@@ -282,14 +282,10 @@ constructor(
    private fun Content(modifier: Modifier = Modifier) {
        PlatformTheme(isDarkTheme = if (notificationShadeBlur()) isSystemInDarkTheme() else true) {
            ProvideShortcutHelperIndication(interactionsConfig = interactionsConfig()) {
                // TODO(b/389985793): Make sure that there is no coroutine work or recompositions
                // happening when alwaysCompose is true but isQsVisibleAndAnyShadeExpanded is false.
                if (alwaysCompose || viewModel.isQsVisibleAndAnyShadeExpanded) {
                Box(
                    modifier =
                        modifier
                                .thenIf(alwaysCompose) {
                                    Modifier.layout { measurable, constraints ->
                            .layout { measurable, constraints ->
                                measurable.measure(constraints).run {
                                    layout(width, height) {
                                        if (viewModel.isQsVisibleAndAnyShadeExpanded) {
@@ -298,7 +294,6 @@ constructor(
                                    }
                                }
                            }
                                }
                            .graphicsLayer { alpha = viewModel.viewAlpha }
                            .thenIf(!Flags.notificationShadeBlur()) {
                                Modifier.offset {
@@ -319,7 +314,6 @@ constructor(
            }
        }
    }
    }

    /**
     * STL that contains both QQS (tiles) and QS (brightness, tiles, footer actions), but no Edit
@@ -371,7 +365,6 @@ constructor(
                    snapshotFlow { viewModel.expansionState }.map { it.progress },
                )
            }
            if (alwaysCompose) {
            // Normally, the Edit mode will stop if the composable leaves, but if the shade
            // is closed, because we are always composed, we don't stop edit mode.
            launch {
@@ -382,7 +375,6 @@ constructor(
                        }
                    }
            }
            }
            launch {
                snapshotFlow { viewModel.isQsFullyExpanded }
                    .collect {
@@ -394,12 +386,12 @@ constructor(
        }

        SceneTransitionLayout(state = sceneState, modifier = Modifier.fillMaxSize()) {
            scene(QuickSettings, alwaysCompose = alwaysCompose) {
            scene(QuickSettings, alwaysCompose = true) {
                LaunchedEffect(Unit) { viewModel.onQSOpen() }
                Element(QuickSettings.rootElementKey, Modifier) { QuickSettingsElement() }
            }

            scene(QuickQuickSettings, alwaysCompose = alwaysCompose) {
            scene(QuickQuickSettings, alwaysCompose = true) {
                LaunchedEffect(Unit) { viewModel.onQQSOpen() }
                // Cannot pass the element modifier in because the top element has a `testTag`
                // and this would overwrite it.
@@ -754,7 +746,6 @@ constructor(
                        // listening whenever this is composed. When always compose is true, we
                        // listen if we are visible and not fully expanded
                        val isListening: () -> Boolean =
                            if (alwaysCompose) {
                            remember(viewModel) {
                                    derivedStateOf {
                                        viewModel.isQsVisibleAndAnyShadeExpanded &&
@@ -763,9 +754,6 @@ constructor(
                                    }
                                }
                                .let { state -> { state.value } }
                            } else {
                                { true }
                            }

                        QuickQuickSettings(
                            viewModel = viewModel.quickQuickSettingsViewModel,
@@ -830,7 +818,6 @@ constructor(
        ) {
            if (viewModel.isQsEnabled) {
                Element(Elements.QuickSettingsContent, modifier = Modifier.weight(1f)) {
                    if (alwaysCompose) {
                    // scrollState never changes
                    LaunchedEffect(Unit) {
                        snapshotFlow { viewModel.isQsFullyCollapsed }
@@ -840,12 +827,7 @@ constructor(
                                }
                            }
                    }
                    } else {
                        DisposableEffect(Unit) {
                            lifecycleScope.launch { scrollState.scrollTo(0) }
                            onDispose { lifecycleScope.launch { scrollState.scrollTo(0) } }
                        }
                    }

                    Column(
                        modifier =
                            Modifier.fillMaxSize()
@@ -919,7 +901,6 @@ constructor(
                                    // compose is true, we look a the second condition and we'll
                                    // listen if QS is visible AND we are not fully collapsed.
                                    val isListening: () -> Boolean =
                                        if (alwaysCompose) {
                                        remember(viewModel) {
                                                derivedStateOf {
                                                    viewModel.isQsVisibleAndAnyShadeExpanded &&
@@ -931,9 +912,6 @@ constructor(
                                                }
                                            }
                                            .let { state -> { state.value } }
                                        } else {
                                            { true }
                                        }

                                    TileGrid(
                                        viewModel = containerViewModel.tileGridViewModel,
@@ -1061,7 +1039,6 @@ constructor(
                println("qqsPositionOnScreen", rect)
            }
            println("QQS visible", qqsVisible.value)
            println("Always composed", alwaysCompose)
            println("bottom QS padding", bottomContentPadding)
            if (::viewModel.isInitialized) {
                printSection("View Model") { viewModel.dump(this@run, args) }
@@ -1561,9 +1538,6 @@ private fun interactionsConfig() =
        surfaceCornerRadius = 16.dp,
    )

private inline val alwaysCompose
    get() = Flags.alwaysComposeQsUiFragment()

/**
 * Forces the configuration and themes to be dark theme. This is needed in order to have
 * [colorResource] retrieve the dark mode colors.