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

Commit 287d452d authored by Julia Tuttle's avatar Julia Tuttle
Browse files

ShadeLockscreenInteractor: change scene on main thread

If we do this on the background thread, we trip a new assert in
SceneTransitionLayout, so do it on the main thread instead.

(This already landed once as ag/27496336, but was accidentally undone in
ag/27607465; I took the opportunity to make it clearer this time.)

Fixes: 347269674
Test: manual: set lockscreen, post notif, go to lockscreen, expand notif
Flag: com.android.systemui.scene_container
Change-Id: I6fc7c55f1db564db60ca55de2974286ed3bc7f60
parent 1550c904
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -18,18 +18,22 @@ package com.android.systemui.shade.domain.interactor

import com.android.keyguard.LockIconViewController
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.model.SceneFamilies
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.shade.data.repository.ShadeRepository
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

class ShadeLockscreenInteractorImpl
@Inject
constructor(
    @Main private val mainDispatcher: CoroutineDispatcher,
    @Background private val backgroundScope: CoroutineScope,
    private val shadeInteractor: ShadeInteractor,
    private val sceneInteractor: SceneInteractor,
@@ -71,7 +75,7 @@ constructor(
    override fun transitionToExpandedShade(delay: Long) {
        backgroundScope.launch {
            delay(delay)
            changeToShadeScene()
            withContext(mainDispatcher) { changeToShadeScene() }
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.shade.domain.interactor

import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.shade.data.repository.shadeRepository
import com.android.systemui.util.mockito.mock
@@ -25,6 +26,7 @@ import com.android.systemui.util.mockito.mock
val Kosmos.shadeLockscreenInteractor by
    Kosmos.Fixture {
        ShadeLockscreenInteractorImpl(
            mainDispatcher = testDispatcher,
            backgroundScope = applicationCoroutineScope,
            shadeInteractor = shadeInteractorImpl,
            sceneInteractor = sceneInteractor,