summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractorTest.kt1
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/SpatialAudioAvailabilityCriteria.kt11
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractor.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/model/SpatialAudioEnabledModel.kt3
4 files changed, 14 insertions, 3 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractorTest.kt
index 06ae220876d6..7c6ab9dc53e6 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractorTest.kt
@@ -108,6 +108,7 @@ class SpatialAudioComponentInteractorTest : SysuiTestCase() {
assertThat(values)
.containsExactly(
+ SpatialAudioEnabledModel.Unknown,
SpatialAudioEnabledModel.Disabled,
SpatialAudioEnabledModel.HeadTrackingEnabled,
SpatialAudioEnabledModel.SpatialAudioEnabled,
diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/SpatialAudioAvailabilityCriteria.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/SpatialAudioAvailabilityCriteria.kt
index 71bce5e470f4..9d74c581f866 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/SpatialAudioAvailabilityCriteria.kt
+++ b/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/SpatialAudioAvailabilityCriteria.kt
@@ -18,11 +18,12 @@ package com.android.systemui.volume.panel.component.spatial.domain
import com.android.systemui.volume.panel.component.spatial.domain.interactor.SpatialAudioComponentInteractor
import com.android.systemui.volume.panel.component.spatial.domain.model.SpatialAudioAvailabilityModel
+import com.android.systemui.volume.panel.component.spatial.domain.model.SpatialAudioEnabledModel
import com.android.systemui.volume.panel.dagger.scope.VolumePanelScope
import com.android.systemui.volume.panel.domain.ComponentAvailabilityCriteria
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.map
+import kotlinx.coroutines.flow.combine
@VolumePanelScope
class SpatialAudioAvailabilityCriteria
@@ -31,5 +32,11 @@ constructor(private val interactor: SpatialAudioComponentInteractor) :
ComponentAvailabilityCriteria {
override fun isAvailable(): Flow<Boolean> =
- interactor.isAvailable.map { it is SpatialAudioAvailabilityModel.SpatialAudio }
+ combine(interactor.isAvailable, interactor.isEnabled) { isAvailable, isEnabled ->
+ if (isAvailable is SpatialAudioAvailabilityModel.SpatialAudio) {
+ isEnabled !is SpatialAudioEnabledModel.Unknown
+ } else {
+ false
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractor.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractor.kt
index 6032bfe3b50a..a32b75adc748 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/interactor/SpatialAudioComponentInteractor.kt
@@ -115,7 +115,7 @@ constructor(
.stateIn(
coroutineScope,
SharingStarted.Eagerly,
- SpatialAudioEnabledModel.Disabled,
+ SpatialAudioEnabledModel.Unknown,
)
/**
diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/model/SpatialAudioEnabledModel.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/model/SpatialAudioEnabledModel.kt
index 9735e5cbd9c9..4255a4044737 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/model/SpatialAudioEnabledModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/volume/panel/component/spatial/domain/model/SpatialAudioEnabledModel.kt
@@ -39,4 +39,7 @@ interface SpatialAudioEnabledModel {
/** Head tracking is enabled. This also means that [SpatialAudioEnabled]. */
data object HeadTrackingEnabled : SpatialAudioEnabled
+
+ /** Spatial audio enabled state is unknown. */
+ data object Unknown : SpatialAudioEnabled
}