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

Commit e91432d3 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz
Browse files

[DesktopStatusBar] Hide lockscreen status bar

The DesktopStatusBar is visible irrespective of lockscreen
state. Therefore, we can hide the KeyguardStatusBar in a
similar fashion to the ShadeHeader.

Test: Manual
Test: KeyguardStatusBarViewModelTest
Bug: 438499562
Flag: com.android.systemui.status_bar_for_desktop
Change-Id: I6206f6395131058a8e58091d6df0a5fbdd121e49
parent 94ef3b54
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import androidx.test.filters.SmallTest
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.desktop.domain.interactor.desktopInteractor
import com.android.systemui.desktop.domain.interactor.enableDesktopFeatureSet
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.flags.andSceneContainer
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository
@@ -94,6 +96,7 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa
            KeyguardStatusBarViewModel(
                testScope.backgroundScope,
                headsUpNotificationInteractor,
                kosmos.desktopInteractor,
                kosmos.sceneInteractor,
                keyguardInteractor,
                keyguardStatusBarInteractor,
@@ -168,6 +171,20 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa
            assertThat(latest).isFalse()
        }

    @Test
    fun isVisible_desktopFeatureSetEnabled_false() =
        testScope.runTest {
            val latest by collectLastValue(underTest.isVisible)
            kosmos.sceneContainerRepository.instantlyTransitionTo(Scenes.Lockscreen)
            runCurrent()
            assertThat(latest).isTrue()

            kosmos.enableDesktopFeatureSet()
            runCurrent()

            assertThat(latest).isFalse()
        }

    @Test
    @EnableSceneContainer
    @DisableFlags(StatusBarNoHunBehavior.FLAG_NAME)
+11 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.ui.viewmodel
import com.android.systemui.Flags
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.desktop.domain.interactor.DesktopInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.lifecycle.HydratedActivatable
import com.android.systemui.scene.domain.interactor.SceneInteractor
@@ -57,6 +58,7 @@ class KeyguardStatusBarViewModel
constructor(
    @Application scope: CoroutineScope,
    headsUpNotificationInteractor: HeadsUpNotificationInteractor,
    desktopInteractor: DesktopInteractor,
    sceneInteractor: SceneInteractor,
    private val keyguardInteractor: KeyguardInteractor,
    keyguardStatusBarInteractor: KeyguardStatusBarInteractor,
@@ -74,11 +76,18 @@ constructor(
    /** True if this view should be visible and false otherwise. */
    val isVisible: StateFlow<Boolean> =
        combine(
                desktopInteractor.isDesktopFeatureSetEnabled,
                sceneInteractor.currentScene,
                sceneInteractor.currentOverlays,
                keyguardInteractor.isDozing,
                showingHeadsUpStatusBar,
            ) { currentScene, currentOverlays, isDozing, showHeadsUpStatusBar ->
            ) {
                desktopFeatureSetEnabled,
                currentScene,
                currentOverlays,
                isDozing,
                showHeadsUpStatusBar ->
                !desktopFeatureSetEnabled &&
                    currentScene == Scenes.Lockscreen &&
                    Overlays.NotificationsShade !in currentOverlays &&
                    Overlays.QuickSettingsShade !in currentOverlays &&
+19 −0
Original line number Diff line number Diff line
@@ -16,9 +16,12 @@

package com.android.systemui.desktop.domain.interactor

import android.content.res.Configuration
import android.content.res.mainResources
import android.content.testableContext
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.backgroundScope
import com.android.systemui.res.R
import com.android.systemui.statusbar.policy.configurationController

val Kosmos.desktopInteractor: DesktopInteractor by
@@ -29,3 +32,19 @@ val Kosmos.desktopInteractor: DesktopInteractor by
            configurationController = configurationController,
        )
    }

fun Kosmos.enableDesktopFeatureSet() {
    testableContext.orCreateTestableResources.addOverride(
        R.bool.config_enableDesktopFeatureSet,
        true,
    )
    configurationController.onConfigurationChanged(Configuration())
}

fun Kosmos.disableDesktopFeatureSet() {
    testableContext.orCreateTestableResources.addOverride(
        R.bool.config_enableDesktopFeatureSet,
        false,
    )
    configurationController.onConfigurationChanged(Configuration())
}
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.ui.viewmodel

import com.android.systemui.desktop.domain.interactor.desktopInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
@@ -30,6 +31,7 @@ val Kosmos.keyguardStatusBarViewModel: KeyguardStatusBarViewModel by
        KeyguardStatusBarViewModel(
            applicationCoroutineScope,
            headsUpNotificationInteractor,
            desktopInteractor,
            sceneInteractor,
            keyguardInteractor,
            keyguardStatusBarInteractor,