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

Commit a40eaffa authored by Matías Hernández's avatar Matías Hernández
Browse files

Increase the lifcecyle span for listening in the Modes and DND Tiles

This is a temporary workaround while the RESUMED state is broken when opening QQS in the locked shade.

Bug: 403434908
Test: manual
Flag: android.app.modes_ui_dnd_tile
Change-Id: Iaae3c4aefd4cd114fef91bbd122f836b09fd3fc8
parent fcfe1263
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.qs.QSHost
import com.android.systemui.qs.QsEventLogger
import com.android.systemui.qs.asQSTileIcon
import com.android.systemui.qs.flags.QsInCompose
import com.android.systemui.qs.logging.QSLogger
import com.android.systemui.qs.tileimpl.QSTileImpl
import com.android.systemui.qs.tiles.base.shared.model.QSTileConfigProvider
@@ -88,7 +89,11 @@ constructor(

    init {
        lifecycle.coroutineScope.launch {
            lifecycle.repeatOnLifecycle(Lifecycle.State.RESUMED) {
            lifecycle.repeatOnLifecycle(
                // TODO: b/403434908 - Workaround for "not listening to tile updates". Can be reset
                //   to RESUMED if either b/403434908 is fixed or QsInCompose is inlined.
                if (QsInCompose.isEnabled) Lifecycle.State.RESUMED else Lifecycle.State.CREATED
            ) {
                dataInteractor.tileData().collect { refreshState(it) }
            }
        }
+6 −4
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import com.android.systemui.animation.Expandable
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.modes.shared.ModesUi
import com.android.systemui.modes.shared.ModesUiIcons
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.plugins.qs.QSTile
@@ -40,6 +39,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.qs.QSHost
import com.android.systemui.qs.QsEventLogger
import com.android.systemui.qs.asQSTileIcon
import com.android.systemui.qs.flags.QsInCompose
import com.android.systemui.qs.logging.QSLogger
import com.android.systemui.qs.tileimpl.QSTileImpl
import com.android.systemui.qs.tiles.base.shared.model.QSTileConfigProvider
@@ -88,10 +88,12 @@ constructor(
    private val config = qsTileConfigProvider.getConfig(TILE_SPEC)

    init {
        /* Check if */ ModesUiIcons.isUnexpectedlyInLegacyMode()

        lifecycle.coroutineScope.launch {
            lifecycle.repeatOnLifecycle(Lifecycle.State.RESUMED) {
            lifecycle.repeatOnLifecycle(
                // TODO: b/403434908 - Workaround for "not listening to tile updates". Can be reset
                //   to RESUMED if either b/403434908 is fixed or QsInCompose is inlined.
                if (QsInCompose.isEnabled) Lifecycle.State.RESUMED else Lifecycle.State.CREATED
            ) {
                dataInteractor.tileData().collect { refreshState(it) }
            }
        }