Fix inability to select default clock color option

Default clock color option could not be selected due to the fact that
the default clock color id was null. Therefore, when it is selected, the
overriding clock color id is set to null. This is confounding because
the overriding value being null could signal either that the default
clock color was selected, or no overriding clock color was selected, and
in the current logic, we assume the latter, and therefore provide the
system selected color id instead. Give default clock color option an id
to fix the problem.

Flag: com.android.systemui.shared.new_customization_picker_ui
Test: Manually verified
Test: ClockPickerViewModelTest passes
Bug: 369114305

Change-Id: I425da6159b338f80e6ded7fdb7a9240b062dd456
diff --git a/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt b/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt
index 6740b3b..c9fa9db 100644
--- a/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt
+++ b/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt
@@ -212,7 +212,7 @@
         combine(overridingClockColorId, clockPickerInteractor.selectedColorId) {
             overridingClockColorId,
             selectedColorId ->
-            overridingClockColorId ?: selectedColorId
+            overridingClockColorId ?: selectedColorId ?: DEFAULT_CLOCK_COLOR_ID
         }
 
     private val overridingSliderProgress = MutableStateFlow<Int?>(null)
@@ -224,8 +224,7 @@
         }
     val isSliderEnabled: Flow<Boolean> =
         combine(previewingClock, previewingClockColorId) { clock, clockColorId ->
-                // clockColorId null means clock color is the system theme color, thus no slider
-                clock.isReactiveToTone && clockColorId != null
+                clock.isReactiveToTone && clockColorId != DEFAULT_CLOCK_COLOR_ID
             }
             .distinctUntilChanged()
 
@@ -235,7 +234,8 @@
 
     val previewingSeedColor: Flow<Int?> =
         combine(previewingClockColorId, previewingSliderProgress) { clockColorId, sliderProgress ->
-            val clockColorViewModel = if (clockColorId == null) null else colorMap[clockColorId]
+            val clockColorViewModel =
+                if (clockColorId == DEFAULT_CLOCK_COLOR_ID) null else colorMap[clockColorId]
             if (clockColorViewModel == null) {
                 null
             } else {
@@ -322,7 +322,8 @@
                 /** darkTheme= */
                 true
             )
-        val isSelectedFlow = previewingClockColorId.map { it == null }.stateIn(viewModelScope)
+        val isSelectedFlow =
+            previewingClockColorId.map { it == DEFAULT_CLOCK_COLOR_ID }.stateIn(viewModelScope)
         return OptionItemViewModel<ColorOptionIconViewModel>(
             key = MutableStateFlow(key) as StateFlow<String>,
             payload =
@@ -345,7 +346,7 @@
                         null
                     } else {
                         {
-                            overridingClockColorId.value = null
+                            overridingClockColorId.value = DEFAULT_CLOCK_COLOR_ID
                             overridingSliderProgress.value =
                                 ClockMetadataModel.DEFAULT_COLOR_TONE_PROGRESS
                         }
@@ -375,7 +376,7 @@
                 clockPickerInteractor.applyClock(
                     clockId = clock.clockId,
                     size = size,
-                    selectedColorId = colorId,
+                    selectedColorId = if (colorId == DEFAULT_CLOCK_COLOR_ID) null else colorId,
                     colorToneProgress = progress,
                     seedColor = seedColor,
                 )
@@ -391,6 +392,7 @@
     }
 
     companion object {
+        private const val DEFAULT_CLOCK_COLOR_ID = "DEFAULT"
         private val helperColorLab: DoubleArray by lazy { DoubleArray(3) }
 
         fun blendColorWithTone(color: Int, colorTone: Double): Int {