[automerger skipped] Import translations. DO NOT MERGE ANYWHERE am: bb0478821d -s ours

am skip reason: subject contains skip directive

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/ThemePicker/+/23558897

Change-Id: Ia24f90ea1f3a045daf847a9c4c1963ec4f8c05d2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/res/drawable/picker_fragment_background.xml b/res/drawable/picker_fragment_background.xml
index 3a49d7a..49fa48b 100644
--- a/res/drawable/picker_fragment_background.xml
+++ b/res/drawable/picker_fragment_background.xml
@@ -16,5 +16,5 @@
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
     <corners android:radius="28dp" />
-    <solid android:color="@color/color_surface" />
+    <solid android:color="@color/picker_fragment_background" />
 </shape>
diff --git a/res/layout/fragment_clock_settings.xml b/res/layout/fragment_clock_settings.xml
index 23fbfb8..bb4a0c2 100644
--- a/res/layout/fragment_clock_settings.xml
+++ b/res/layout/fragment_clock_settings.xml
@@ -46,6 +46,7 @@
 
         <com.android.customization.picker.clock.ui.view.ClockHostView
             android:id="@+id/clock_host_view"
+            android:importantForAccessibility="noHideDescendants"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_gravity="center" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 96ff1bf..c023924 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -360,6 +360,13 @@
     enabled. The dialog contains a list of instructions that the user needs to take in order to
     enable the option before it can be selected again. [CHAR LIMIT=NONE].
     -->
+    <string name="keyguard_affordance_enablement_dialog_headline">Shortcut unavailable</string>
+
+    <!--
+    Supporting text for a popup dialog shown when the user attempts to select an option that is not
+    currently enabled. The dialog contains a list of instructions that the user needs to take in
+    order to enable the option before it can be selected again. [CHAR LIMIT=NONE].
+    -->
     <string name="keyguard_affordance_enablement_dialog_title">To select `<xliff:g id="appName" example="Wallet">%1$s</xliff:g>` check the following</string>
 
     <!--
diff --git a/src/com/android/customization/model/color/ColorProvider.kt b/src/com/android/customization/model/color/ColorProvider.kt
index 6c83f23..63d298d 100644
--- a/src/com/android/customization/model/color/ColorProvider.kt
+++ b/src/com/android/customization/model/color/ColorProvider.kt
@@ -329,28 +329,68 @@
     /**
      * Returns the light theme version of the Revamped UI preview of a ColorScheme based on this
      * order: top left, top right, bottom left, bottom right
+     *
+     * This color mapping corresponds to GM3 colors: Primary (light), Primary (light), Secondary
+     * LStar 85, and Tertiary LStar 70
      */
     @ColorInt
     private fun getRevampedUILightColorPreview(colorScheme: ColorScheme): IntArray {
         return intArrayOf(
             setAlphaComponent(colorScheme.accent1.s600, ALPHA_MASK),
             setAlphaComponent(colorScheme.accent1.s600, ALPHA_MASK),
-            setAlphaComponent(colorScheme.accent2.s100, ALPHA_MASK),
-            ColorStateList.valueOf(colorScheme.accent3.s500).withLStar(59f).colors[0],
+            ColorStateList.valueOf(colorScheme.accent2.s500).withLStar(85f).colors[0],
+            setAlphaComponent(colorScheme.accent3.s300, ALPHA_MASK),
         )
     }
 
     /**
      * Returns the dark theme version of the Revamped UI preview of a ColorScheme based on this
      * order: top left, top right, bottom left, bottom right
+     *
+     * This color mapping corresponds to GM3 colors: Primary (dark), Primary (dark), Secondary LStar
+     * 35, and Tertiary LStar 70
      */
     @ColorInt
     private fun getRevampedUIDarkColorPreview(colorScheme: ColorScheme): IntArray {
         return intArrayOf(
             setAlphaComponent(colorScheme.accent1.s200, ALPHA_MASK),
             setAlphaComponent(colorScheme.accent1.s200, ALPHA_MASK),
-            setAlphaComponent(colorScheme.accent2.s700, ALPHA_MASK),
-            setAlphaComponent(colorScheme.accent3.s100, ALPHA_MASK),
+            ColorStateList.valueOf(colorScheme.accent2.s500).withLStar(35f).colors[0],
+            setAlphaComponent(colorScheme.accent3.s300, ALPHA_MASK),
+        )
+    }
+
+    /**
+     * Returns the light theme version of the Revamped UI preview of a ColorScheme based on this
+     * order: top left, top right, bottom left, bottom right
+     *
+     * This color mapping corresponds to GM3 colors: Primary LStar 0, Primary LStar 0, Secondary
+     * LStar 85, and Tertiary LStar 70
+     */
+    @ColorInt
+    private fun getRevampedUILightMonochromePreview(colorScheme: ColorScheme): IntArray {
+        return intArrayOf(
+            setAlphaComponent(colorScheme.accent1.s1000, ALPHA_MASK),
+            setAlphaComponent(colorScheme.accent1.s1000, ALPHA_MASK),
+            ColorStateList.valueOf(colorScheme.accent2.s500).withLStar(85f).colors[0],
+            setAlphaComponent(colorScheme.accent3.s300, ALPHA_MASK),
+        )
+    }
+
+    /**
+     * Returns the dark theme version of the Revamped UI preview of a ColorScheme based on this
+     * order: top left, top right, bottom left, bottom right
+     *
+     * This color mapping corresponds to GM3 colors: Primary LStar 99, Primary LStar 99, Secondary
+     * LStar 35, and Tertiary LStar 70
+     */
+    @ColorInt
+    private fun getRevampedUIDarkMonochromePreview(colorScheme: ColorScheme): IntArray {
+        return intArrayOf(
+            setAlphaComponent(colorScheme.accent1.s10, ALPHA_MASK),
+            setAlphaComponent(colorScheme.accent1.s10, ALPHA_MASK),
+            ColorStateList.valueOf(colorScheme.accent2.s500).withLStar(35f).colors[0],
+            setAlphaComponent(colorScheme.accent3.s300, ALPHA_MASK),
         )
     }
 
@@ -513,8 +553,8 @@
 
             when (style) {
                 Style.MONOCHROMATIC -> {
-                    darkColors = getRevampedUIDarkColorPreview(darkColorScheme)
-                    lightColors = getRevampedUILightColorPreview(lightColorScheme)
+                    darkColors = getRevampedUIDarkMonochromePreview(darkColorScheme)
+                    lightColors = getRevampedUILightMonochromePreview(lightColorScheme)
                 }
                 else -> {
                     darkColors = getRevampedUIPresetColorPreview(darkColorScheme, colorFromStub)
diff --git a/src/com/android/customization/picker/quickaffordance/data/repository/KeyguardQuickAffordancePickerRepository.kt b/src/com/android/customization/picker/quickaffordance/data/repository/KeyguardQuickAffordancePickerRepository.kt
index c432bd9..9729661 100644
--- a/src/com/android/customization/picker/quickaffordance/data/repository/KeyguardQuickAffordancePickerRepository.kt
+++ b/src/com/android/customization/picker/quickaffordance/data/repository/KeyguardQuickAffordancePickerRepository.kt
@@ -82,7 +82,7 @@
             isEnabled = isEnabled,
             enablementInstructions = enablementInstructions ?: emptyList(),
             enablementActionText = enablementActionText,
-            enablementActionComponentName = enablementActionComponentName,
+            enablementActionIntent = enablementActionIntent,
             configureIntent = configureIntent,
         )
     }
diff --git a/src/com/android/customization/picker/quickaffordance/shared/model/KeyguardQuickAffordancePickerAffordanceModel.kt b/src/com/android/customization/picker/quickaffordance/shared/model/KeyguardQuickAffordancePickerAffordanceModel.kt
index 7b04ff1..5ca7d56 100644
--- a/src/com/android/customization/picker/quickaffordance/shared/model/KeyguardQuickAffordancePickerAffordanceModel.kt
+++ b/src/com/android/customization/picker/quickaffordance/shared/model/KeyguardQuickAffordancePickerAffordanceModel.kt
@@ -39,10 +39,10 @@
      */
     val enablementActionText: String?,
     /**
-     * If not enabled, an optional component name (package and action) for a button that takes the
-     * user to a destination where they can re-enable it.
+     * If not enabled, an optional [Intent] for a button that takes the user to a destination where
+     * they can re-enable it.
      */
-    val enablementActionComponentName: String?,
+    val enablementActionIntent: Intent?,
     /** Optional [Intent] to use to start an activity to configure this affordance. */
     val configureIntent: Intent?,
 )
diff --git a/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt b/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt
index 525c657..08cb756 100644
--- a/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt
+++ b/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt
@@ -27,7 +27,6 @@
 import androidx.lifecycle.ViewModelProvider
 import androidx.lifecycle.viewModelScope
 import com.android.customization.picker.quickaffordance.domain.interactor.KeyguardQuickAffordancePickerInteractor
-import com.android.systemui.shared.customization.data.content.CustomizationProviderContract
 import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots
 import com.android.systemui.shared.quickaffordance.shared.model.KeyguardPreviewConstants
 import com.android.wallpaper.R
@@ -264,8 +263,7 @@
                                         name = affordance.name,
                                         instructions = affordance.enablementInstructions,
                                         actionText = affordance.enablementActionText,
-                                        actionComponentName =
-                                            affordance.enablementActionComponentName,
+                                        actionIntent = affordance.enablementActionIntent,
                                     )
                                 }
                             },
@@ -350,7 +348,7 @@
         name: String,
         instructions: List<String>,
         actionText: String?,
-        actionComponentName: String?,
+        actionIntent: Intent?,
     ) {
         _dialog.value =
             DialogViewModel(
@@ -359,7 +357,14 @@
                         drawable = icon,
                         contentDescription = null,
                     ),
-                title = Text.Loaded(name),
+                headline = Text.Resource(R.string.keyguard_affordance_enablement_dialog_headline),
+                supportingText =
+                    Text.Loaded(
+                        applicationContext.getString(
+                            R.string.keyguard_affordance_enablement_dialog_title,
+                            name
+                        )
+                    ),
                 message =
                     Text.Loaded(
                         buildString {
@@ -382,9 +387,7 @@
                                     ),
                             style = ButtonStyle.Primary,
                             onClicked = {
-                                actionComponentName.toIntent()?.let { intent ->
-                                    requestActivityStart(intent)
-                                }
+                                actionIntent?.let { intent -> requestActivityStart(intent) }
                             }
                         ),
                     ),
@@ -425,29 +428,6 @@
         return quickAffordanceInteractor.getAffordanceIcon(iconResourceId)
     }
 
-    private fun String?.toIntent(): Intent? {
-        if (isNullOrEmpty()) {
-            return null
-        }
-
-        val splitUp =
-            split(
-                CustomizationProviderContract.LockScreenQuickAffordances.AffordanceTable
-                    .COMPONENT_NAME_SEPARATOR
-            )
-        check(splitUp.size == 1 || splitUp.size == 2) {
-            "Illegal component name \"$this\". Must be either just an action or a package and an" +
-                " action separated by a" +
-                " \"${CustomizationProviderContract.LockScreenQuickAffordances.AffordanceTable.COMPONENT_NAME_SEPARATOR}\"!"
-        }
-
-        return Intent(splitUp.last()).apply {
-            if (splitUp.size > 1) {
-                setPackage(splitUp[0])
-            }
-        }
-    }
-
     private fun toDescriptionText(
         context: Context,
         slots: Map<String, KeyguardQuickAffordanceSlotViewModel>,
diff --git a/tests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt b/tests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
index 43ca2ab..d51f411 100644
--- a/tests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
+++ b/tests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
@@ -252,7 +252,7 @@
             val enablementActionText = "enablementActionText"
             val packageName = "packageName"
             val action = "action"
-            val enablementActionComponentName = "$packageName/$action"
+            val enablementActionIntent = Intent(action).apply { `package` = packageName }
             // Lets add a disabled affordance to the picker:
             val affordanceIndex =
                 client.addAffordance(
@@ -263,7 +263,7 @@
                         isEnabled = false,
                         enablementInstructions = enablementInstructions,
                         enablementActionText = enablementActionText,
-                        enablementActionComponentName = enablementActionComponentName,
+                        enablementActionIntent = enablementActionIntent,
                     )
                 )
 
@@ -273,7 +273,8 @@
             // We expect there to be a dialog that should be shown:
             assertThat(dialog()?.icon)
                 .isEqualTo(Icon.Loaded(FakeCustomizationProviderClient.ICON_1, null))
-            assertThat(dialog()?.title).isEqualTo(Text.Loaded("disabled"))
+            assertThat(dialog()?.headline)
+                .isEqualTo(Text.Resource(R.string.keyguard_affordance_enablement_dialog_headline))
             assertThat(dialog()?.message)
                 .isEqualTo(Text.Loaded(enablementInstructions.joinToString("\n")))
             assertThat(dialog()?.buttons?.size).isEqualTo(1)