summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-17 05:44:49 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-17 05:44:49 -0700
commitd04635b1ca19d682bafe6fda98cf3e2923be194b (patch)
treead4ea84aa4e13c699099261ab33bd022671c0a4b
parent51f55e25d930a77ae85342aab458ad64199b7b69 (diff)
parent4d68d7bb4628d56132c335fdc0ada9d9bd225f28 (diff)
Merge "[flexiglass] SysUiState correction during SUW." into main
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/model/SysUiStateExtTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt7
-rw-r--r--packages/SystemUI/src/com/android/systemui/model/SceneContainerPlugin.kt25
-rw-r--r--packages/SystemUI/src/com/android/systemui/model/SysUiStateExt.kt14
-rw-r--r--packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt23
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt2
6 files changed, 37 insertions, 37 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/model/SysUiStateExtTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/model/SysUiStateExtTest.kt
index d1b552906fbb..5d4de02f9aaa 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/model/SysUiStateExtTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/model/SysUiStateExtTest.kt
@@ -16,7 +16,6 @@
package com.android.systemui.model
-import android.view.Display
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
@@ -35,7 +34,7 @@ class SysUiStateExtTest : SysuiTestCase() {
@Test
fun updateFlags() {
- underTest.updateFlags(Display.DEFAULT_DISPLAY, 1L to true, 2L to false, 4L to true)
+ underTest.updateFlags(1L to true, 2L to false, 4L to true)
assertThat(underTest.flags and 1L).isNotEqualTo(0L)
assertThat(underTest.flags and 2L).isEqualTo(0L)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
index 1743e056b65c..6d4fffdefb1b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
@@ -22,7 +22,6 @@ import android.os.PowerManager
import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.provider.Settings
-import android.view.Display
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.ObservableTransitionState
@@ -1213,15 +1212,15 @@ class SceneContainerStartableTest : SysuiTestCase() {
fakeSceneDataSource.pause()
sceneInteractor.changeScene(sceneKey, "reason")
runCurrent()
- verify(sysUiState, times(index)).commitUpdate(Display.DEFAULT_DISPLAY)
+ verify(sysUiState, times(index)).commitUpdate()
fakeSceneDataSource.unpause(expectedScene = sceneKey)
runCurrent()
- verify(sysUiState, times(index)).commitUpdate(Display.DEFAULT_DISPLAY)
+ verify(sysUiState, times(index)).commitUpdate()
transitionStateFlow.value = ObservableTransitionState.Idle(sceneKey)
runCurrent()
- verify(sysUiState, times(index + 1)).commitUpdate(Display.DEFAULT_DISPLAY)
+ verify(sysUiState, times(index + 1)).commitUpdate()
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/model/SceneContainerPlugin.kt b/packages/SystemUI/src/com/android/systemui/model/SceneContainerPlugin.kt
index 4559a7aea1a2..7b3f4c61088b 100644
--- a/packages/SystemUI/src/com/android/systemui/model/SceneContainerPlugin.kt
+++ b/packages/SystemUI/src/com/android/systemui/model/SceneContainerPlugin.kt
@@ -79,6 +79,7 @@ constructor(
SceneContainerPluginState(
scene = idleState.currentScene,
overlays = idleState.currentOverlays,
+ isVisible = sceneInteractor.get().isVisible.value,
invisibleDueToOcclusion = invisibleDueToOcclusion,
)
)
@@ -100,12 +101,17 @@ constructor(
mapOf<Long, (SceneContainerPluginState) -> Boolean>(
SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE to
{
- it.scene != Scenes.Gone || it.overlays.isNotEmpty()
+ when {
+ !it.isVisible -> false
+ it.scene != Scenes.Gone -> true
+ it.overlays.isNotEmpty() -> true
+ else -> false
+ }
},
SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED to
{
when {
- it.invisibleDueToOcclusion -> false
+ !it.isVisible -> false
it.scene == Scenes.Lockscreen -> true
it.scene == Scenes.Shade -> true
Overlays.NotificationsShade in it.overlays -> true
@@ -114,19 +120,23 @@ constructor(
},
SYSUI_STATE_QUICK_SETTINGS_EXPANDED to
{
- it.scene == Scenes.QuickSettings ||
- Overlays.QuickSettingsShade in it.overlays
+ when {
+ !it.isVisible -> false
+ it.scene == Scenes.QuickSettings -> true
+ Overlays.QuickSettingsShade in it.overlays -> true
+ else -> false
+ }
},
- SYSUI_STATE_BOUNCER_SHOWING to { Overlays.Bouncer in it.overlays },
+ SYSUI_STATE_BOUNCER_SHOWING to { it.isVisible && Overlays.Bouncer in it.overlays },
SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING to
{
- it.scene == Scenes.Lockscreen && !it.invisibleDueToOcclusion
+ it.isVisible && it.scene == Scenes.Lockscreen
},
SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED to
{
it.scene == Scenes.Lockscreen && it.invisibleDueToOcclusion
},
- SYSUI_STATE_COMMUNAL_HUB_SHOWING to { it.scene == Scenes.Communal },
+ SYSUI_STATE_COMMUNAL_HUB_SHOWING to { it.isVisible && it.scene == Scenes.Communal },
)
}
@@ -134,5 +144,6 @@ constructor(
val scene: SceneKey,
val overlays: Set<OverlayKey>,
val invisibleDueToOcclusion: Boolean,
+ val isVisible: Boolean,
)
}
diff --git a/packages/SystemUI/src/com/android/systemui/model/SysUiStateExt.kt b/packages/SystemUI/src/com/android/systemui/model/SysUiStateExt.kt
index 1e18f24c9e65..195535669c7e 100644
--- a/packages/SystemUI/src/com/android/systemui/model/SysUiStateExt.kt
+++ b/packages/SystemUI/src/com/android/systemui/model/SysUiStateExt.kt
@@ -16,8 +16,6 @@
package com.android.systemui.model
-import com.android.systemui.dagger.qualifiers.DisplayId
-
/**
* In-bulk updates multiple flag values and commits the update.
*
@@ -32,16 +30,8 @@ import com.android.systemui.dagger.qualifiers.DisplayId
* SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING to (sceneKey == Scenes.Lockscreen),
* )
* ```
- *
- * You can inject [displayId] by injecting it using:
- * ```
- * @DisplayId private val displayId: Int`,
- * ```
*/
-fun SysUiState.updateFlags(
- @DisplayId displayId: Int,
- vararg flagValuePairs: Pair<Long, Boolean>,
-) {
+fun SysUiState.updateFlags(vararg flagValuePairs: Pair<Long, Boolean>) {
flagValuePairs.forEach { (flag, enabled) -> setFlag(flag, enabled) }
- commitUpdate(displayId)
+ commitUpdate()
}
diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
index 3ad0867192d3..7ed4b9f8abfa 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
@@ -33,10 +33,8 @@ import com.android.systemui.bouncer.domain.interactor.SimBouncerInteractor
import com.android.systemui.bouncer.shared.logging.BouncerUiEvent
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.classifier.FalsingCollectorActual
-import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
-import com.android.systemui.dagger.qualifiers.DisplayId
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryHapticsInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
@@ -82,6 +80,7 @@ import com.android.systemui.util.kotlin.pairwise
import com.android.systemui.util.kotlin.sample
import com.android.systemui.util.printSection
import com.android.systemui.util.println
+import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow
import com.google.android.msdl.data.model.MSDLToken
import com.google.android.msdl.domain.MSDLPlayer
import dagger.Lazy
@@ -123,7 +122,6 @@ constructor(
private val bouncerInteractor: BouncerInteractor,
private val keyguardInteractor: KeyguardInteractor,
private val sysUiState: SysUiState,
- @DisplayId private val displayId: Int,
private val sceneLogger: SceneLogger,
@FalsingCollectorActual private val falsingCollector: FalsingCollector,
private val falsingManager: FalsingManager,
@@ -732,21 +730,26 @@ constructor(
sceneInteractor.transitionState
.mapNotNull { it as? ObservableTransitionState.Idle }
.distinctUntilChanged(),
+ sceneInteractor.isVisible,
occlusionInteractor.invisibleDueToOcclusion,
- ) { idleState, invisibleDueToOcclusion ->
+ ) { idleState, isVisible, invisibleDueToOcclusion ->
SceneContainerPlugin.SceneContainerPluginState(
scene = idleState.currentScene,
overlays = idleState.currentOverlays,
+ isVisible = isVisible,
invisibleDueToOcclusion = invisibleDueToOcclusion,
)
}
- .collect { sceneContainerPluginState ->
+ .map { sceneContainerPluginState ->
+ SceneContainerPlugin.EvaluatorByFlag.map { (flag, evaluator) ->
+ flag to evaluator(sceneContainerPluginState)
+ }
+ .toMap()
+ }
+ .distinctUntilChanged()
+ .collect { flags ->
sysUiState.updateFlags(
- displayId,
- *SceneContainerPlugin.EvaluatorByFlag.map { (flag, evaluator) ->
- flag to evaluator.invoke(sceneContainerPluginState)
- }
- .toTypedArray(),
+ *(flags.entries.map { (key, value) -> key to value }).toTypedArray()
)
}
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt
index 7a9b052481cb..349e670a9af3 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt
@@ -46,7 +46,6 @@ import com.android.systemui.scene.domain.interactor.sceneContainerOcclusionInter
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.session.shared.shadeSessionStorage
import com.android.systemui.scene.shared.logger.sceneLogger
-import com.android.systemui.settings.displayTracker
import com.android.systemui.shade.domain.interactor.shadeInteractor
import com.android.systemui.shade.domain.interactor.shadeModeInteractor
import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor
@@ -65,7 +64,6 @@ val Kosmos.sceneContainerStartable by Fixture {
bouncerInteractor = bouncerInteractor,
keyguardInteractor = keyguardInteractor,
sysUiState = sysUiState,
- displayId = displayTracker.defaultDisplayId,
sceneLogger = sceneLogger,
falsingCollector = falsingCollector,
falsingManager = falsingManager,