Clock floating sheeting

Change the layout of the clock floating sheet

Test: Manually tested. See bug.
Bug: 350718184
Flag: com.android.systemui.shared.new_customization_picker_ui
Change-Id: Ib309ff76c665788ab63b9f549dc3d0090ad2ff15
diff --git a/res/layout/clock_color_list_placeholder.xml b/res/layout/clock_color_list_placeholder.xml
deleted file mode 100644
index d7912c1..0000000
--- a/res/layout/clock_color_list_placeholder.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
-     Copyright (C) 2023 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.
--->
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:visibility="invisible"
-    android:orientation="vertical">
-
-    <include
-        layout="@layout/color_option"
-        android:layout_width="@dimen/option_item_size"
-        android:layout_height="@dimen/option_item_size" />
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/floating_sheet_list_item_vertical_space"/>
-
-    <include
-        layout="@layout/color_option"
-        android:layout_width="@dimen/option_item_size"
-        android:layout_height="@dimen/option_item_size" />
-</LinearLayout>
-
diff --git a/res/layout/clock_style_list_placeholder.xml b/res/layout/clock_style_list_placeholder.xml
deleted file mode 100644
index 48ef9a8..0000000
--- a/res/layout/clock_style_list_placeholder.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
-     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.
--->
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:visibility="invisible"
-    android:orientation="vertical">
-
-    <include
-        layout="@layout/clock_style_option"
-        android:layout_width="@dimen/floating_sheet_clock_style_option_size"
-        android:layout_height="@dimen/floating_sheet_clock_style_option_size" />
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/floating_sheet_list_item_vertical_space"/>
-
-    <include
-        layout="@layout/clock_style_option"
-        android:layout_width="@dimen/floating_sheet_clock_style_option_size"
-        android:layout_height="@dimen/floating_sheet_clock_style_option_size" />
-</LinearLayout>
-
diff --git a/res/layout/floating_sheet_clock.xml b/res/layout/floating_sheet_clock.xml
index 9ca8f1a..7ff663f 100644
--- a/res/layout/floating_sheet_clock.xml
+++ b/res/layout/floating_sheet_clock.xml
@@ -17,6 +17,8 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:paddingHorizontal="@dimen/floating_sheet_horizontal_padding"
     android:orientation="vertical">
 
@@ -29,36 +31,84 @@
         android:clipToPadding="false"
         android:clipChildren="false">
 
-        <FrameLayout
+        <androidx.constraintlayout.widget.ConstraintLayout
             android:id="@+id/clock_floating_sheet_style_content"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:clipToPadding="false"
             android:clipChildren="false">
 
-            <!--
-            This is an invisible placeholder put in place so that the parent keeps its height
-            stable as the RecyclerView updates from 0 items to N items. Keeping it stable allows
-            the layout logic to keep the size of the preview container stable as well, which
-            bodes well for setting up the SurfaceView for remote rendering without changing its
-            size after the content is loaded into the RecyclerView.
+            <FrameLayout
+                android:id="@+id/clock_style_list_container"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toTopOf="@+id/clock_style_clock_size_title"
+                android:clipToPadding="false"
+                android:clipChildren="false">
 
-            It's critical for any TextViews inside the included layout to have text.
-            -->
-            <include
-                layout="@layout/clock_style_list_placeholder"
+                <!--
+                This is an invisible placeholder put in place so that the parent keeps its height
+                stable as the RecyclerView updates from 0 items to N items. Keeping it stable allows
+                the layout logic to keep the size of the preview container stable as well, which
+                bodes well for setting up the SurfaceView for remote rendering without changing its
+                size after the content is loaded into the RecyclerView.
+
+                It's critical for any TextViews inside the included layout to have text.
+                -->
+                <include
+                    layout="@layout/clock_style_option"
+                    android:layout_width="@dimen/floating_sheet_clock_style_option_size"
+                    android:layout_height="@dimen/floating_sheet_clock_style_option_size"
+                    android:visibility="invisible" />
+
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/clock_style_list"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:clipChildren="false"
+                    android:clipToPadding="false"/>
+            </FrameLayout>
+
+            <TextView
+                android:id="@+id/clock_style_clock_size_title"
+                style="@style/CustomizationOptionEntryTitleTextStyle"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:text="@string/clock_size_large"
+                android:layout_marginStart="@dimen/floating_sheet_content_horizontal_padding"
+                android:layout_marginEnd="@dimen/floating_sheet_clock_style_clock_size_text_margin_end"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintEnd_toStartOf="@+id/clock_style_clock_size_switch"
+                app:layout_constraintTop_toBottomOf="@+id/clock_style_list_container"
+                app:layout_constraintBottom_toTopOf="@+id/clock_style_clock_size_description" />
+
+            <TextView
+                android:id="@+id/clock_style_clock_size_description"
+                style="@style/CustomizationOptionEntrySubtitleTextStyle"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/floating_sheet_content_horizontal_padding"
+                android:layout_marginEnd="@dimen/floating_sheet_clock_style_clock_size_text_margin_end"
+                android:text="@string/clock_size_dynamic_description"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintEnd_toStartOf="@+id/clock_style_clock_size_switch"
+                app:layout_constraintTop_toBottomOf="@+id/clock_style_clock_size_title"
+                app:layout_constraintBottom_toBottomOf="parent" />
+
+            <Switch
+                android:id="@+id/clock_style_clock_size_switch"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:visibility="invisible" />
-
-            <androidx.recyclerview.widget.RecyclerView
-                android:id="@+id/clock_style_list"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:clipChildren="false"
-                android:clipToPadding="false"/>
-        </FrameLayout>
-
+                android:layout_marginEnd="@dimen/floating_sheet_content_horizontal_padding"
+                app:layout_constraintTop_toTopOf="@+id/clock_style_clock_size_title"
+                app:layout_constraintBottom_toBottomOf="@+id/clock_style_clock_size_description"
+                app:layout_constraintEnd_toEndOf="parent"
+                style="@style/Switch.SettingsLib"
+                tools:ignore="UseSwitchCompatOrMaterialXml" />
+        </androidx.constraintlayout.widget.ConstraintLayout>
 
         <LinearLayout
             android:id="@+id/clock_floating_sheet_color_content"
@@ -85,9 +135,9 @@
                 It's critical for any TextViews inside the included layout to have text.
                 -->
                 <include
-                    layout="@layout/clock_color_list_placeholder"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
+                    layout="@layout/color_option"
+                    android:layout_width="@dimen/option_item_size"
+                    android:layout_height="@dimen/option_item_size"
                     android:visibility="invisible" />
 
                 <androidx.recyclerview.widget.RecyclerView
@@ -112,70 +162,6 @@
                 android:progressDrawable="@drawable/saturation_progress_drawable"
                 android:splitTrack="false" />
         </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/clock_floating_sheet_size_content"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:showDividers="middle"
-            android:baselineAligned="false"
-            android:divider="@drawable/horizontal_divider_16dp"
-            android:paddingVertical="@dimen/floating_sheet_content_vertical_padding"
-            android:paddingHorizontal="@dimen/floating_sheet_content_horizontal_padding">
-
-            <LinearLayout
-                android:id="@+id/clock_size_option_dynamic"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:orientation="vertical"
-                android:gravity="center_horizontal">
-                <ImageView
-                    android:layout_width="@dimen/floating_sheet_clock_size_icon_size"
-                    android:layout_height="@dimen/floating_sheet_clock_size_icon_size"
-                    android:background="#ff00ff"
-                    android:layout_marginBottom="@dimen/floating_sheet_clock_size_icon_margin_bottom" />
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="@style/SectionTitleTextStyle"
-                    android:gravity="center"
-                    android:text="@string/clock_size_dynamic"/>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="@style/SectionSubtitleTextStyle"
-                    android:gravity="center"
-                    android:text="@string/clock_size_dynamic_description"/>
-            </LinearLayout>
-
-            <LinearLayout
-                android:id="@+id/clock_size_option_small"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:orientation="vertical"
-                android:gravity="center_horizontal">
-                <ImageView
-                    android:layout_width="@dimen/floating_sheet_clock_size_icon_size"
-                    android:layout_height="@dimen/floating_sheet_clock_size_icon_size"
-                    android:background="#ff00ff"
-                    android:layout_marginBottom="@dimen/floating_sheet_clock_size_icon_margin_bottom" />
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="@style/SectionTitleTextStyle"
-                    android:gravity="center"
-                    android:text="@string/clock_size_small"/>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:textAppearance="@style/SectionSubtitleTextStyle"
-                    android:gravity="center"
-                    android:text="@string/clock_size_small_description"/>
-            </LinearLayout>
-        </LinearLayout>
     </FrameLayout>
 
     <com.android.wallpaper.picker.customization.ui.view.FloatingToolbar
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 6a923d9..9af13bf 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -185,9 +185,8 @@
     <dimen name="floating_sheet_tab_toolbar_vertical_margin">8dp</dimen>
     <dimen name="floating_sheet_list_item_horizontal_space">4dp</dimen>
     <dimen name="floating_sheet_list_item_vertical_space">4dp</dimen>
-    <dimen name="floating_sheet_clock_size_icon_size">80dp</dimen>
-    <dimen name="floating_sheet_clock_size_icon_margin_bottom">8dp</dimen>
     <dimen name="floating_sheet_clock_style_option_size">82dp</dimen>
     <dimen name="floating_sheet_clock_style_thumbnail_margin">12dp</dimen>
+    <dimen name="floating_sheet_clock_style_clock_size_text_margin_end">16dp</dimen>
     <dimen name="customization_option_entry_shortcut_icon_size">20dp</dimen>
 </resources>
diff --git a/src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt b/src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt
index a8d06a5..50b03ac 100644
--- a/src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt
+++ b/src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt
@@ -17,7 +17,6 @@
 package com.android.wallpaper.customization.ui.binder
 
 import android.animation.ValueAnimator
-import android.annotation.DrawableRes
 import android.content.Context
 import android.content.res.Configuration
 import android.graphics.drawable.Drawable
@@ -25,25 +24,24 @@
 import android.view.ViewGroup
 import android.widget.ImageView
 import android.widget.SeekBar
-import androidx.core.content.res.ResourcesCompat
+import android.widget.Switch
 import androidx.core.view.doOnLayout
 import androidx.core.view.isVisible
 import androidx.lifecycle.Lifecycle
 import androidx.lifecycle.LifecycleOwner
 import androidx.lifecycle.lifecycleScope
 import androidx.lifecycle.repeatOnLifecycle
-import androidx.recyclerview.widget.GridLayoutManager
+import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import com.android.customization.picker.clock.shared.ClockSize
 import com.android.customization.picker.color.ui.binder.ColorOptionIconBinder
 import com.android.customization.picker.color.ui.view.ColorOptionIconView
 import com.android.customization.picker.color.ui.viewmodel.ColorOptionIconViewModel
-import com.android.customization.picker.common.ui.view.DoubleRowListItemSpacing
+import com.android.customization.picker.common.ui.view.SingleRowListItemSpacing
 import com.android.themepicker.R
 import com.android.wallpaper.customization.ui.util.ThemePickerCustomizationOptionUtil.ThemePickerLockCustomizationOption.CLOCK
 import com.android.wallpaper.customization.ui.viewmodel.ClockFloatingSheetHeightsViewModel
 import com.android.wallpaper.customization.ui.viewmodel.ClockPickerViewModel.Tab.COLOR
-import com.android.wallpaper.customization.ui.viewmodel.ClockPickerViewModel.Tab.SIZE
 import com.android.wallpaper.customization.ui.viewmodel.ClockPickerViewModel.Tab.STYLE
 import com.android.wallpaper.customization.ui.viewmodel.ThemePickerCustomizationOptionsViewModel
 import com.android.wallpaper.picker.customization.ui.view.FloatingToolbar
@@ -119,10 +117,8 @@
             }
         )
 
-        // Clock size
-        val clockSizeContent = view.requireViewById<View>(R.id.clock_floating_sheet_size_content)
-        val clockSizeOptionDynamic = view.requireViewById<View>(R.id.clock_size_option_dynamic)
-        val clockSizeOptionSmall = view.requireViewById<View>(R.id.clock_size_option_small)
+        // Clock size switch
+        val clockSizeSwitch = view.requireViewById<Switch>(R.id.clock_style_clock_size_switch)
 
         view.doOnLayout {
             if (_clockFloatingSheetHeights.value == null) {
@@ -130,7 +126,6 @@
                     ClockFloatingSheetHeightsViewModel(
                         clockStyleContentHeight = clockStyleContent.height,
                         clockColorContentHeight = clockColorContent.height,
-                        clockSizeContentHeight = clockSizeContent.height,
                     )
             }
         }
@@ -150,7 +145,6 @@
                                 when (selectedTab) {
                                     STYLE -> heights.clockStyleContentHeight
                                     COLOR -> heights.clockColorContentHeight
-                                    SIZE -> heights.clockSizeContentHeight
                                 } +
                                     view.resources.getDimensionPixelSize(
                                         R.dimen.floating_sheet_content_vertical_padding
@@ -168,7 +162,6 @@
 
                             clockStyleContent.isVisible = selectedTab == STYLE
                             clockColorContent.isVisible = selectedTab == COLOR
-                            clockSizeContent.isVisible = selectedTab == SIZE
                         }
                 }
 
@@ -177,7 +170,7 @@
                         clockStyleAdapter.setItems(styleOptions) {
                             var indexToFocus = styleOptions.indexOfFirst { it.isSelected.value }
                             indexToFocus = if (indexToFocus < 0) 0 else indexToFocus
-                            (clockStyleList.layoutManager as GridLayoutManager)
+                            (clockStyleList.layoutManager as LinearLayoutManager)
                                 .scrollToPositionWithOffset(indexToFocus, 0)
                         }
                     }
@@ -188,7 +181,7 @@
                         clockColorAdapter.setItems(colorOptions) {
                             var indexToFocus = colorOptions.indexOfFirst { it.isSelected.value }
                             indexToFocus = if (indexToFocus < 0) 0 else indexToFocus
-                            (clockColorList.layoutManager as GridLayoutManager)
+                            (clockColorList.layoutManager as LinearLayoutManager)
                                 .scrollToPositionWithOffset(indexToFocus, 0)
                         }
                     }
@@ -209,26 +202,18 @@
                 }
 
                 launch {
-                    viewModel.sizeOptions.collect { sizeOptions ->
-                        sizeOptions.forEach { option ->
-                            lifecycleOwner.lifecycleScope.launch {
-                                lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
-                                    launch {
-                                        option.onClicked.collect { onClicked ->
-                                            when (option.size) {
-                                                ClockSize.DYNAMIC ->
-                                                    clockSizeOptionDynamic.setOnClickListener {
-                                                        onClicked?.invoke()
-                                                    }
-                                                ClockSize.SMALL ->
-                                                    clockSizeOptionSmall.setOnClickListener {
-                                                        onClicked?.invoke()
-                                                    }
-                                            }
-                                        }
-                                    }
-                                }
-                            }
+                    viewModel.previewingClockSize.collect { size ->
+                        when (size) {
+                            ClockSize.DYNAMIC -> clockSizeSwitch.isChecked = true
+                            ClockSize.SMALL -> clockSizeSwitch.isChecked = false
+                        }
+                    }
+                }
+
+                launch {
+                    viewModel.onClockSizeSwitchCheckedChange.collect { onCheckedChange ->
+                        clockSizeSwitch.setOnCheckedChangeListener { _, _ ->
+                            onCheckedChange.invoke()
                         }
                     }
                 }
@@ -250,18 +235,15 @@
     private fun RecyclerView.initStyleList(context: Context, adapter: OptionItemAdapter<Drawable>) {
         apply {
             this.adapter = adapter
-            layoutManager = GridLayoutManager(context, 2, GridLayoutManager.HORIZONTAL, false)
+            layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
             addItemDecoration(
-                DoubleRowListItemSpacing(
+                SingleRowListItemSpacing(
                     context.resources.getDimensionPixelSize(
                         R.dimen.floating_sheet_content_horizontal_padding
                     ),
                     context.resources.getDimensionPixelSize(
                         R.dimen.floating_sheet_list_item_horizontal_space
                     ),
-                    context.resources.getDimensionPixelSize(
-                        R.dimen.floating_sheet_list_item_vertical_space
-                    ),
                 )
             )
         }
@@ -288,24 +270,17 @@
     ) {
         apply {
             this.adapter = adapter
-            layoutManager = GridLayoutManager(context, 2, GridLayoutManager.HORIZONTAL, false)
+            layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
             addItemDecoration(
-                DoubleRowListItemSpacing(
+                SingleRowListItemSpacing(
                     context.resources.getDimensionPixelSize(
                         R.dimen.floating_sheet_content_horizontal_padding
                     ),
                     context.resources.getDimensionPixelSize(
                         R.dimen.floating_sheet_list_item_horizontal_space
                     ),
-                    context.resources.getDimensionPixelSize(
-                        R.dimen.floating_sheet_list_item_vertical_space
-                    ),
                 )
             )
         }
     }
-
-    private fun getDrawable(context: Context, @DrawableRes res: Int): Drawable? {
-        return ResourcesCompat.getDrawable(context.resources, res, null)
-    }
 }
diff --git a/src/com/android/wallpaper/customization/ui/viewmodel/ClockFloatingSheetHeightsViewModel.kt b/src/com/android/wallpaper/customization/ui/viewmodel/ClockFloatingSheetHeightsViewModel.kt
index 37752af..913ff11 100644
--- a/src/com/android/wallpaper/customization/ui/viewmodel/ClockFloatingSheetHeightsViewModel.kt
+++ b/src/com/android/wallpaper/customization/ui/viewmodel/ClockFloatingSheetHeightsViewModel.kt
@@ -19,5 +19,4 @@
 data class ClockFloatingSheetHeightsViewModel(
     val clockStyleContentHeight: Int,
     val clockColorContentHeight: Int,
-    val clockSizeContentHeight: Int,
 )
diff --git a/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt b/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt
index c9fa9db..cf45678 100644
--- a/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt
+++ b/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt
@@ -51,7 +51,6 @@
 import kotlinx.coroutines.flow.asStateFlow
 import kotlinx.coroutines.flow.combine
 import kotlinx.coroutines.flow.distinctUntilChanged
-import kotlinx.coroutines.flow.flow
 import kotlinx.coroutines.flow.flowOn
 import kotlinx.coroutines.flow.map
 import kotlinx.coroutines.flow.mapLatest
@@ -73,7 +72,6 @@
     enum class Tab {
         STYLE,
         COLOR,
-        SIZE,
     }
 
     private val colorMap = ClockColorViewModel.getPresetColorMap(context.resources)
@@ -104,16 +102,6 @@
                 ) {
                     _selectedTab.value = Tab.COLOR
                 },
-                FloatingToolbarTabViewModel(
-                    Icon.Resource(
-                        res = R.drawable.ic_open_in_full_24px,
-                        contentDescription = Text.Resource(R.string.clock_size),
-                    ),
-                    context.getString(R.string.clock_size),
-                    it == Tab.SIZE,
-                ) {
-                    _selectedTab.value = Tab.SIZE
-                },
             )
         }
 
@@ -125,6 +113,7 @@
             selectedClock ->
             overridingClock ?: selectedClock
         }
+
     @OptIn(ExperimentalCoroutinesApi::class)
     val clockStyleOptions: StateFlow<List<OptionItemViewModel<Drawable>>> =
         clockPickerInteractor.allClocks
@@ -172,38 +161,15 @@
             selectedClockSize ->
             overridingClockSize ?: selectedClockSize
         }
-    val sizeOptions = flow {
-        emit(
-            listOf(
-                ClockSizeOptionViewModel(
-                    ClockSize.DYNAMIC,
-                    previewingClockSize.map { it == ClockSize.DYNAMIC }.stateIn(viewModelScope),
-                    previewingClockSize
-                        .map {
-                            if (it == ClockSize.DYNAMIC) {
-                                null
-                            } else {
-                                { overridingClockSize.value = ClockSize.DYNAMIC }
-                            }
-                        }
-                        .stateIn(viewModelScope),
-                ),
-                ClockSizeOptionViewModel(
-                    ClockSize.SMALL,
-                    previewingClockSize.map { it == ClockSize.SMALL }.stateIn(viewModelScope),
-                    previewingClockSize
-                        .map {
-                            if (it == ClockSize.SMALL) {
-                                null
-                            } else {
-                                { overridingClockSize.value = ClockSize.SMALL }
-                            }
-                        }
-                        .stateIn(viewModelScope),
-                ),
-            )
-        )
-    }
+    val onClockSizeSwitchCheckedChange: Flow<(() -> Unit)> =
+        previewingClockSize.map {
+            {
+                when (it) {
+                    ClockSize.DYNAMIC -> overridingClockSize.value = ClockSize.SMALL
+                    ClockSize.SMALL -> overridingClockSize.value = ClockSize.DYNAMIC
+                }
+            }
+        }
 
     // Clock color
     // 0 - 100
diff --git a/tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModelTest.kt b/tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModelTest.kt
index 72f3f6b..6bec3df 100644
--- a/tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModelTest.kt
+++ b/tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModelTest.kt
@@ -124,10 +124,6 @@
         tabs()?.get(1)?.onClick?.invoke()
 
         assertThat(selectedTab()).isEqualTo(Tab.COLOR)
-
-        tabs()?.get(2)?.onClick?.invoke()
-
-        assertThat(selectedTab()).isEqualTo(Tab.SIZE)
     }
 
     @Test
@@ -139,10 +135,6 @@
         tabs()?.get(1)?.onClick?.invoke()
 
         assertThat(tabs()?.get(1)?.isSelected).isTrue()
-
-        tabs()?.get(2)?.onClick?.invoke()
-
-        assertThat(tabs()?.get(2)?.isSelected).isTrue()
     }
 
     @Test
@@ -185,39 +177,19 @@
     }
 
     @Test
-    fun previewingClockSize_whenClickOnSizeOptions() = runTest {
+    fun previewingClockSize_whenCallingOnClockSizeSwitchChecked() = runTest {
         val previewingClockSize = collectLastValue(underTest.previewingClockSize)
-        val sizeOptions = collectLastValue(underTest.sizeOptions)
 
         assertThat(previewingClockSize()).isEqualTo(ClockSize.DYNAMIC)
 
-        val option1OnClicked = collectLastValue(sizeOptions()!![1].onClicked)
-        option1OnClicked()?.invoke()
+        val onClockSizeSwitchCheckedChange =
+            collectLastValue(underTest.onClockSizeSwitchCheckedChange)
+        onClockSizeSwitchCheckedChange()?.invoke()
 
         assertThat(previewingClockSize()).isEqualTo(ClockSize.SMALL)
     }
 
     @Test
-    fun sizeOptions_whenClickOnSizeOptions() = runTest {
-        val sizeOptions = collectLastValue(underTest.sizeOptions)
-        val option0IsSelected = collectLastValue(sizeOptions()!![0].isSelected)
-        val option0OnClicked = collectLastValue(sizeOptions()!![0].onClicked)
-        val option1IsSelected = collectLastValue(sizeOptions()!![1].isSelected)
-        val option1OnClicked = collectLastValue(sizeOptions()!![1].onClicked)
-
-        assertThat(sizeOptions()!![0].size).isEqualTo(ClockSize.DYNAMIC)
-        assertThat(sizeOptions()!![1].size).isEqualTo(ClockSize.SMALL)
-        assertThat(option0IsSelected()).isTrue()
-        assertThat(option0OnClicked()).isNull()
-
-        option1OnClicked()?.invoke()
-
-        assertThat(option0IsSelected()).isFalse()
-        assertThat(option1IsSelected()).isTrue()
-        assertThat(option1OnClicked()).isNull()
-    }
-
-    @Test
     fun sliderProgress_whenOnSliderProgressChanged() = runTest {
         val sliderProgress = collectLastValue(underTest.previewingSliderProgress)