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

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

Merge "Fix configuration changes received by QSFragmentCompose" into main

parents 12cc63cf 937e17ec
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -154,6 +154,9 @@ import com.android.systemui.qs.ui.composable.QuickSettingsShade
import com.android.systemui.qs.ui.composable.QuickSettingsShade.systemGestureExclusionInShade
import com.android.systemui.qs.ui.composable.QuickSettingsTheme
import com.android.systemui.res.R
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener
import com.android.systemui.util.LifecycleFragment
import com.android.systemui.util.animation.MeasurementInput
import com.android.systemui.util.animation.UniqueObjectHostView
@@ -185,6 +188,7 @@ constructor(
    private val dumpManager: DumpManager,
    @Background private val backgroundDispatcher: CoroutineDispatcher,
    private val mediaLogger: MediaViewLogger,
    @ShadeDisplayAware private val configurationController: ConfigurationController,
) : LifecycleFragment(), QS, Dumpable {

    private val scrollListener = MutableStateFlow<QS.ScrollListener?>(null)
@@ -275,11 +279,6 @@ constructor(
        return frame
    }

    override fun onConfigurationChanged(newConfig: Configuration) {
        super.onConfigurationChanged(newConfig)
        view?.dispatchConfigurationChanged(newConfig)
    }

    @Composable
    private fun Content(modifier: Modifier = Modifier) {
        PlatformTheme(isDarkTheme = if (notificationShadeBlur()) isSystemInDarkTheme() else true) {
@@ -650,6 +649,13 @@ constructor(
        bottomContentPadding = padding
    }

    private val configurationListener =
        object : ConfigurationListener {
            override fun onConfigChanged(newConfig: Configuration) {
                view?.dispatchConfigurationChanged(newConfig)
            }
        }

    private fun setListenerCollections() {
        lifecycleScope.launch {
            lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) {
@@ -678,6 +684,14 @@ constructor(
                        setCustomizerShowing(it, EDIT_MODE_TIME_MILLIS.toLong())
                    }
                }
                launch {
                    try {
                        configurationController.addCallback(configurationListener)
                        awaitCancellation()
                    } finally {
                        configurationController.removeCallback(configurationListener)
                    }
                }
            }
        }
    }