Remove ringer repository

This CL removes the repository for now since it is obsolete. It will be
added back when we add more fields or methods for logging.

Flag: com.android.systemui.volume_redesign
Bug: 369993851
Test: Build. Run presubmits.
Change-Id: Idf620723c88a11914164e6bfe005f74bef72188d
diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/data/VolumeDialogRingerRepository.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/data/VolumeDialogRingerRepository.kt
deleted file mode 100644
index 73b97f6..0000000
--- a/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/data/VolumeDialogRingerRepository.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.volume.dialog.ringer.data
-
-import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.volume.dialog.ringer.shared.model.VolumeDialogRingerModel
-import javax.inject.Inject
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.flow.filterNotNull
-import kotlinx.coroutines.flow.update
-
-/** Stores the state of volume dialog ringer model */
-@SysUISingleton
-class VolumeDialogRingerRepository @Inject constructor() {
-
-    private val mutableRingerModel = MutableStateFlow<VolumeDialogRingerModel?>(null)
-    val ringerModel: Flow<VolumeDialogRingerModel> = mutableRingerModel.filterNotNull()
-
-    fun updateRingerModel(update: (current: VolumeDialogRingerModel?) -> VolumeDialogRingerModel) {
-        mutableRingerModel.update(update)
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractor.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractor.kt
index 5562ea9..7265b821 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractor.kt
@@ -25,15 +25,15 @@
 import com.android.systemui.plugins.VolumeDialogController
 import com.android.systemui.volume.dialog.dagger.scope.VolumeDialog
 import com.android.systemui.volume.dialog.domain.interactor.VolumeDialogStateInteractor
-import com.android.systemui.volume.dialog.ringer.data.VolumeDialogRingerRepository
 import com.android.systemui.volume.dialog.ringer.shared.model.VolumeDialogRingerModel
 import com.android.systemui.volume.dialog.shared.model.VolumeDialogStateModel
 import javax.inject.Inject
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.launchIn
+import kotlinx.coroutines.flow.SharingStarted
+import kotlinx.coroutines.flow.filterNotNull
 import kotlinx.coroutines.flow.mapNotNull
-import kotlinx.coroutines.flow.onEach
+import kotlinx.coroutines.flow.stateIn
 
 /** Exposes [VolumeDialogRingerModel]. */
 @VolumeDialog
@@ -43,17 +43,13 @@
     @VolumeDialog private val coroutineScope: CoroutineScope,
     volumeDialogStateInteractor: VolumeDialogStateInteractor,
     private val controller: VolumeDialogController,
-    private val repository: VolumeDialogRingerRepository,
 ) {
 
-    val ringerModel: Flow<VolumeDialogRingerModel> = repository.ringerModel
-
-    init {
+    val ringerModel: Flow<VolumeDialogRingerModel> =
         volumeDialogStateInteractor.volumeDialogState
-            .mapNotNull { state -> toRingerModel(state) }
-            .onEach { ringerModel -> repository.updateRingerModel { ringerModel } }
-            .launchIn(coroutineScope)
-    }
+            .mapNotNull { toRingerModel(it) }
+            .stateIn(coroutineScope, SharingStarted.Eagerly, null)
+            .filterNotNull()
 
     private fun toRingerModel(state: VolumeDialogStateModel): VolumeDialogRingerModel? {
         return state.streamModels[AudioManager.STREAM_RING]?.let {
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/dialog/ringer/data/VolumeDialogRingerRepositoryKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/dialog/ringer/data/VolumeDialogRingerRepositoryKosmos.kt
deleted file mode 100644
index 2c51886..0000000
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/dialog/ringer/data/VolumeDialogRingerRepositoryKosmos.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.volume.dialog.ringer.data
-
-import com.android.systemui.kosmos.Kosmos
-
-val Kosmos.volumeDialogRingerRepository by Kosmos.Fixture { VolumeDialogRingerRepository() }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractorKosmos.kt
index b221692..c2a1544 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/dialog/ringer/domain/VolumeDialogRingerInteractorKosmos.kt
@@ -20,7 +20,6 @@
 import com.android.systemui.kosmos.applicationCoroutineScope
 import com.android.systemui.plugins.volumeDialogController
 import com.android.systemui.volume.dialog.domain.interactor.volumeDialogStateInteractor
-import com.android.systemui.volume.dialog.ringer.data.volumeDialogRingerRepository
 
 val Kosmos.volumeDialogRingerInteractor by
     Kosmos.Fixture {
@@ -28,6 +27,5 @@
             coroutineScope = applicationCoroutineScope,
             volumeDialogStateInteractor = volumeDialogStateInteractor,
             controller = volumeDialogController,
-            repository = volumeDialogRingerRepository,
         )
     }