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

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

Merge "[flexiglass] Dismiss bouncer when clicking on action button" into main

parents bd3bd60f 066a2419
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import com.android.systemui.common.ui.data.repository.fakeConfigurationRepositor
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.kosmos.testScope
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository
import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository
import com.android.systemui.telephony.data.repository.fakeTelephonyRepository
@@ -91,6 +93,8 @@ class BouncerActionButtonInteractorTest : SysuiTestCase() {
        kosmos.fakeTelephonyRepository.setHasTelephonyRadio(true)

        kosmos.telecomManager = telecomManager

        kosmos.sceneInteractor.changeScene(Scenes.Bouncer, "")
    }

    @Test
@@ -130,6 +134,7 @@ class BouncerActionButtonInteractorTest : SysuiTestCase() {
            assertThat(metricsLogger.logs.element().category)
                .isEqualTo(MetricsProto.MetricsEvent.ACTION_EMERGENCY_CALL)
            verify(activityTaskManager).stopSystemLockTaskMode()
            assertThat(kosmos.sceneInteractor.currentScene.value).isEqualTo(Scenes.Lockscreen)
            verify(telecomManager).showInCallScreen(eq(false))
        }

@@ -156,6 +161,7 @@ class BouncerActionButtonInteractorTest : SysuiTestCase() {
            assertThat(metricsLogger.logs.element().category)
                .isEqualTo(MetricsProto.MetricsEvent.ACTION_EMERGENCY_CALL)
            verify(activityTaskManager).stopSystemLockTaskMode()
            assertThat(kosmos.sceneInteractor.currentScene.value).isEqualTo(Scenes.Lockscreen)

            // TODO(b/25189994): Test the activity has been started once we switch to the
            //  ActivityStarter interface here.
+10 −2
Original line number Diff line number Diff line
@@ -34,10 +34,14 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.doze.DozeLogger
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionsRepository
import com.android.systemui.telephony.domain.interactor.TelephonyInteractor
import com.android.systemui.user.domain.interactor.SelectedUserInteractor
import com.android.systemui.util.EmergencyDialerConstants
import dagger.Lazy
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.Flow
@@ -69,6 +73,7 @@ constructor(
    private val emergencyDialerIntentFactory: EmergencyDialerIntentFactory,
    private val metricsLogger: MetricsLogger,
    private val dozeLogger: DozeLogger,
    private val sceneInteractor: Lazy<SceneInteractor>,
) {
    /** The bouncer action button. If `null`, the button should not be shown. */
    val actionButton: Flow<BouncerActionButtonModel?> =
@@ -158,7 +163,10 @@ constructor(
    }

    private fun prepareToPerformAction() {
        // TODO(b/308001302): Trigger occlusion and resetting bouncer state.
        if (SceneContainerFlag.isEnabled) {
            sceneInteractor.get().changeScene(Scenes.Lockscreen, "Bouncer action button clicked")
        }

        metricsLogger.action(MetricsEvent.ACTION_EMERGENCY_CALL)
        activityTaskManager.stopSystemLockTaskMode()
    }
+3 −2
Original line number Diff line number Diff line
@@ -29,11 +29,12 @@ import kotlinx.coroutines.flow.StateFlow
class TelephonyInteractor
@Inject
constructor(
    repository: TelephonyRepository,
    private val repository: TelephonyRepository,
) {
    @Annotation.CallState val callState: Flow<Int> = repository.callState

    val isInCall: StateFlow<Boolean> = repository.isInCall

    val hasTelephonyRadio: Boolean = repository.hasTelephonyRadio
    val hasTelephonyRadio: Boolean
        get() = repository.hasTelephonyRadio
}
+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.systemui.bouncer.data.repository.emergencyServicesRepository
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.statusbar.pipeline.mobile.data.repository.mobileConnectionsRepository
import com.android.systemui.telephony.domain.interactor.telephonyInteractor
import com.android.systemui.user.domain.interactor.selectedUserInteractor
@@ -50,5 +51,6 @@ val Kosmos.bouncerActionButtonInteractor by Fixture {
            },
        metricsLogger = metricsLogger,
        dozeLogger = mock(),
        sceneInteractor = { sceneInteractor },
    )
}