Merge "Fix preview for 2 pane small width (2/n)" into udc-dev
diff --git a/res/layout/notification_section.xml b/res/layout/notification_section.xml
index c20ffbf..f490e00 100644
--- a/res/layout/notification_section.xml
+++ b/res/layout/notification_section.xml
@@ -27,19 +27,13 @@
     android:orientation="horizontal"
     android:gravity="center_vertical">
 
-    <LinearLayout
+    <TextView
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_weight="1"
         android:layout_gravity="center"
-        android:orientation="vertical">
-
-        <TextView
-            android:id="@+id/subtitle"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            style="@style/SectionTitleTextStyle"/>
-    </LinearLayout>
+        android:text="@string/show_notifications_on_lock_screen"
+        style="@style/SectionTitleTextStyle"/>
 
     <Switch
         android:id="@+id/switcher"
diff --git a/src/com/android/customization/picker/notifications/ui/binder/NotificationSectionBinder.kt b/src/com/android/customization/picker/notifications/ui/binder/NotificationSectionBinder.kt
index edd469f..1868a4e 100644
--- a/src/com/android/customization/picker/notifications/ui/binder/NotificationSectionBinder.kt
+++ b/src/com/android/customization/picker/notifications/ui/binder/NotificationSectionBinder.kt
@@ -20,7 +20,6 @@
 import android.annotation.SuppressLint
 import android.view.View
 import android.widget.Switch
-import android.widget.TextView
 import androidx.lifecycle.Lifecycle
 import androidx.lifecycle.LifecycleOwner
 import androidx.lifecycle.lifecycleScope
@@ -39,19 +38,12 @@
         viewModel: NotificationSectionViewModel,
         lifecycleOwner: LifecycleOwner,
     ) {
-        val subtitle: TextView = view.requireViewById(R.id.subtitle)
         val switch: Switch = view.requireViewById(R.id.switcher)
 
         view.setOnClickListener { viewModel.onClicked() }
 
         lifecycleOwner.lifecycleScope.launch {
             lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
-                launch {
-                    viewModel.titleStringResourceId.collect {
-                        subtitle.text = view.context.getString(it)
-                    }
-                }
-
                 launch { viewModel.isSwitchOn.collect { switch.isChecked = it } }
             }
         }
diff --git a/src/com/android/customization/picker/notifications/ui/viewmodel/NotificationSectionViewModel.kt b/src/com/android/customization/picker/notifications/ui/viewmodel/NotificationSectionViewModel.kt
index 58a84a4..954efa2 100644
--- a/src/com/android/customization/picker/notifications/ui/viewmodel/NotificationSectionViewModel.kt
+++ b/src/com/android/customization/picker/notifications/ui/viewmodel/NotificationSectionViewModel.kt
@@ -17,13 +17,11 @@
 
 package com.android.customization.picker.notifications.ui.viewmodel
 
-import androidx.annotation.StringRes
 import androidx.annotation.VisibleForTesting
 import androidx.lifecycle.ViewModel
 import androidx.lifecycle.ViewModelProvider
 import androidx.lifecycle.viewModelScope
 import com.android.customization.picker.notifications.domain.interactor.NotificationsInteractor
-import com.android.wallpaper.R
 import kotlinx.coroutines.flow.Flow
 import kotlinx.coroutines.flow.map
 import kotlinx.coroutines.launch
@@ -35,16 +33,6 @@
     private val interactor: NotificationsInteractor,
 ) : ViewModel() {
 
-    /** A string resource ID for the title. */
-    @StringRes
-    val titleStringResourceId: Flow<Int> =
-        interactor.settings.map { model ->
-            when (model.isShowNotificationsOnLockScreenEnabled) {
-                true -> R.string.show_notifications_on_lock_screen
-                false -> R.string.hide_notifications_on_lock_screen
-            }
-        }
-
     /** Whether the switch should be on. */
     val isSwitchOn: Flow<Boolean> =
         interactor.settings.map { model -> model.isShowNotificationsOnLockScreenEnabled }
diff --git a/tests/src/com/android/customization/picker/notifications/ui/viewmodel/NotificationSectionViewModelTest.kt b/tests/src/com/android/customization/picker/notifications/ui/viewmodel/NotificationSectionViewModelTest.kt
index 43ddea7..63334f2 100644
--- a/tests/src/com/android/customization/picker/notifications/ui/viewmodel/NotificationSectionViewModelTest.kt
+++ b/tests/src/com/android/customization/picker/notifications/ui/viewmodel/NotificationSectionViewModelTest.kt
@@ -84,18 +84,14 @@
     @Test
     fun `toggles back and forth`() =
         testScope.runTest {
-            val titleStringResId = collectLastValue(underTest.titleStringResourceId)
             val isSwitchOn = collectLastValue(underTest.isSwitchOn)
 
-            val initialSubtitleStringRes = titleStringResId()
             val initialIsSwitchOn = isSwitchOn()
 
             underTest.onClicked()
-            assertThat(titleStringResId()).isNotEqualTo(initialSubtitleStringRes)
             assertThat(isSwitchOn()).isNotEqualTo(initialIsSwitchOn)
 
             underTest.onClicked()
-            assertThat(titleStringResId()).isEqualTo(initialSubtitleStringRes)
             assertThat(isSwitchOn()).isEqualTo(initialIsSwitchOn)
         }
 }