Use Locale default temperature unit in wallpaper picker

The assistant temperature unit is not available when rendering the
clock in the wallpaper picker context. We mitigate this by using
the locale default instead to determine which temperature unit should
be shown.

Bug: 285621525
Test: Manually checked several different locales
Change-Id: I826cfb7dd424d776dad5f159341595711cf90727
Merged-In: I826cfb7dd424d776dad5f159341595711cf90727
diff --git a/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt b/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt
index 0dcd88b..de18a90 100644
--- a/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt
+++ b/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt
@@ -24,6 +24,7 @@
 import android.view.View
 import android.widget.FrameLayout
 import androidx.annotation.ColorInt
+import androidx.core.text.util.LocalePreferences
 import androidx.lifecycle.LifecycleOwner
 import com.android.systemui.plugins.ClockController
 import com.android.systemui.plugins.WeatherData
@@ -180,13 +181,18 @@
         )
         controller.smallClock.events.onTargetRegionChanged(getSmallClockRegion())
 
-        // Use placeholder for weather clock preview in picker
+        // Use placeholder for weather clock preview in picker.
+        // Use locale default temp unit since assistant default is not available in this context.
+        val useCelsius =
+            LocalePreferences.getTemperatureUnit() == LocalePreferences.TemperatureUnit.CELSIUS
         controller.events.onWeatherDataChanged(
             WeatherData(
                 description = DESCRIPTION_PLACEHODLER,
                 state = WEATHERICON_PLACEHOLDER,
-                temperature = TEMPERATURE_PLACEHOLDER,
-                useCelsius = USE_CELSIUS_PLACEHODLER,
+                temperature =
+                    if (useCelsius) TEMPERATURE_CELSIUS_PLACEHOLDER
+                    else TEMPERATURE_FAHRENHEIT_PLACEHOLDER,
+                useCelsius = useCelsius,
             )
         )
         return controller
@@ -218,7 +224,8 @@
 
     companion object {
         const val DESCRIPTION_PLACEHODLER = ""
-        const val TEMPERATURE_PLACEHOLDER = 58
+        const val TEMPERATURE_FAHRENHEIT_PLACEHOLDER = 58
+        const val TEMPERATURE_CELSIUS_PLACEHOLDER = 21
         val WEATHERICON_PLACEHOLDER = WeatherData.WeatherStateIcon.MOSTLY_SUNNY
         const val USE_CELSIUS_PLACEHODLER = false