Merge changes from topic "presubmit-am-445a081c9bbe42778389baf3ca97cdb1" into sc-qpr1-dev am: 159dff15e2

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

Change-Id: Ief30495f3d4c0af77339f6ebbcb2bc02fedadbec
diff --git a/res/color-night/check_circle_grey_large_not_select_background_color.xml b/res/color-night/check_circle_grey_large_not_select_background_color.xml
new file mode 100644
index 0000000..ab5c0cd
--- /dev/null
+++ b/res/color-night/check_circle_grey_large_not_select_background_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+    <item android:color="?androidprv:attr/textColorSecondary" />
+</selector>
\ No newline at end of file
diff --git a/res/color-night/check_circle_grey_large_not_select_color.xml b/res/color-night/check_circle_grey_large_not_select_color.xml
new file mode 100644
index 0000000..6e8db34
--- /dev/null
+++ b/res/color-night/check_circle_grey_large_not_select_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" >
+    <item android:color="?androidprv:attr/textColorOnAccent" />
+</selector>
\ No newline at end of file
diff --git a/res/color-night/option_background_new_selection_color.xml b/res/color-night/option_background_new_selection_color.xml
new file mode 100644
index 0000000..0158ea2
--- /dev/null
+++ b/res/color-night/option_background_new_selection_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+    <item android:color="?androidprv:attr/colorAccentPrimaryVariant" />
+</selector>
\ No newline at end of file
diff --git a/res/color/check_circle_grey_large_not_select_background_color.xml b/res/color/check_circle_grey_large_not_select_background_color.xml
new file mode 100644
index 0000000..c023611
--- /dev/null
+++ b/res/color/check_circle_grey_large_not_select_background_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+    <item android:color="?androidprv:attr/textColorSecondaryInverse" />
+</selector>
\ No newline at end of file
diff --git a/res/color/check_circle_grey_large_not_select_color.xml b/res/color/check_circle_grey_large_not_select_color.xml
new file mode 100644
index 0000000..252665f
--- /dev/null
+++ b/res/color/check_circle_grey_large_not_select_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+    <item android:color="?androidprv:attr/textColorPrimary" />
+</selector>
\ No newline at end of file
diff --git a/res/color/option_background_new_selection_color.xml b/res/color/option_background_new_selection_color.xml
new file mode 100644
index 0000000..0158ea2
--- /dev/null
+++ b/res/color/option_background_new_selection_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+    <item android:color="?androidprv:attr/colorAccentPrimaryVariant" />
+</selector>
\ No newline at end of file
diff --git a/res/drawable/check_circle_grey_large_not_select.xml b/res/drawable/check_circle_grey_large_not_select.xml
new file mode 100644
index 0000000..544d852
--- /dev/null
+++ b/res/drawable/check_circle_grey_large_not_select.xml
@@ -0,0 +1,32 @@
+<!--
+     Copyright (C) 2021 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.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+    <item>
+        <shape android:shape="oval">
+            <size android:width="@dimen/center_check_size"
+                android:height="@dimen/center_check_size" />
+            <solid android:color="@color/check_circle_grey_large_not_select_background_color" />
+        </shape>
+    </item>
+    <item>
+        <inset android:drawable="@drawable/ic_check_24dp_not_select"
+            android:insetTop="@dimen/center_check_padding"
+            android:insetRight="@dimen/center_check_padding"
+            android:insetBottom="@dimen/center_check_padding"
+            android:insetLeft="@dimen/center_check_padding"/>
+    </item>
+</layer-list>
diff --git a/res/drawable/ic_check_24dp_not_select.xml b/res/drawable/ic_check_24dp_not_select.xml
new file mode 100644
index 0000000..e6af76c
--- /dev/null
+++ b/res/drawable/ic_check_24dp_not_select.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+    <path
+        android:fillColor="@color/check_circle_grey_large_not_select_color"
+        android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41L9,16.17z"/>
+</vector>
diff --git a/res/drawable/option_border_new_selection.xml b/res/drawable/option_border_new_selection.xml
new file mode 100644
index 0000000..6c02caa
--- /dev/null
+++ b/res/drawable/option_border_new_selection.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+     Copyright (C) 2019 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.
+-->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+    android:color="?android:attr/colorControlHighlight">
+    <item android:id="@android:id/mask">
+        <shape android:shape="rectangle">
+            <solid android:color="@android:color/white"/>
+            <corners android:radius="@dimen/option_tile_radius" />
+        </shape>
+    </item>
+    <item>
+        <shape android:shape="rectangle">
+            <solid android:color="@color/option_background_new_selection_color" />
+            <corners android:radius="@dimen/option_tile_radius" />
+        </shape>
+    </item>
+</ripple>
diff --git a/res/layout/themed_icon_section_view.xml b/res/layout/themed_icon_section_view.xml
index 97892ee..cf7b842 100644
--- a/res/layout/themed_icon_section_view.xml
+++ b/res/layout/themed_icon_section_view.xml
@@ -28,6 +28,7 @@
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:gravity="center_vertical"
         android:orientation="horizontal">
 
         <TextView
@@ -42,7 +43,7 @@
         <Switch
             android:id="@+id/themed_icon_toggle"
             android:layout_width="wrap_content"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
             android:background="@null"
             android:clickable="false"
             android:focusable="false"
diff --git a/src/com/android/customization/model/grid/GridOption.java b/src/com/android/customization/model/grid/GridOption.java
index 16a5eb0..19c5d4f 100644
--- a/src/com/android/customization/model/grid/GridOption.java
+++ b/src/com/android/customization/model/grid/GridOption.java
@@ -93,11 +93,18 @@
         Context context = view.getContext();
 
         int colorFilter = ResourceUtils.getColorAttr(context,
-                view.isActivated() ? android.R.attr.textColorPrimary :
-                android.R.attr.textColorTertiary);
+                view.isActivated()
+                        ? (mIsCurrent
+                            ? android.R.attr.textColorPrimary
+                            : android.R.attr.textColorPrimaryInverse)
+                        : android.R.attr.textColorTertiary);
         mTileDrawable.setColorFilter(colorFilter, Mode.SRC_ATOP);
         ((ImageView) view.findViewById(R.id.grid_option_thumbnail))
                 .setImageDrawable(mTileDrawable);
+
+        int backgroundResource = view.isActivated() && !mIsCurrent
+                ? R.drawable.option_border_new_selection : R.drawable.option_border;
+        view.findViewById(R.id.option_tile).setBackgroundResource(backgroundResource);
     }
 
     @Override
diff --git a/src/com/android/customization/picker/grid/GridFragment.java b/src/com/android/customization/picker/grid/GridFragment.java
index bb29d55..5e5ee6a 100644
--- a/src/com/android/customization/picker/grid/GridFragment.java
+++ b/src/com/android/customization/picker/grid/GridFragment.java
@@ -186,7 +186,8 @@
             public void onOptionsLoaded(List<GridOption> options) {
                 mLoading.hide();
                 mOptionsController = new OptionSelectorController<>(
-                        mOptionsContainer, options, /* useGrid= */ false, CheckmarkStyle.CENTER);
+                        mOptionsContainer, options, /* useGrid= */ false,
+                        CheckmarkStyle.CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED);
                 mOptionsController.initOptions(mGridManager);
 
                 // Find the selected Grid option.
diff --git a/src/com/android/customization/widget/OptionSelectorController.java b/src/com/android/customization/widget/OptionSelectorController.java
index 8e85c01..aa54f4f 100644
--- a/src/com/android/customization/widget/OptionSelectorController.java
+++ b/src/com/android/customization/widget/OptionSelectorController.java
@@ -68,11 +68,13 @@
         void onOptionSelected(CustomizationOption selected);
     }
 
-    @IntDef({CheckmarkStyle.NONE, CheckmarkStyle.CORNER, CheckmarkStyle.CENTER})
+    @IntDef({CheckmarkStyle.NONE, CheckmarkStyle.CORNER, CheckmarkStyle.CENTER,
+            CheckmarkStyle.CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED})
     public @interface CheckmarkStyle {
         int NONE = 0;
         int CORNER = 1;
         int CENTER = 2;
+        int CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED = 3;
     }
 
     private static final float LINEAR_LAYOUT_HORIZONTAL_DISPLAY_OPTIONS_MAX = 4.35f;
@@ -243,6 +245,16 @@
                                     mContainer.getContext().getTheme()),
                             Gravity.CENTER, res.getDimensionPixelSize(R.dimen.center_check_size),
                             0);
+                }  else if (mCheckmarkStyle == CheckmarkStyle.CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED
+                        && option.equals(mAppliedOption)) {
+                    int drawableRes = option.equals(mSelectedOption)
+                            ? R.drawable.check_circle_grey_large
+                            : R.drawable.check_circle_grey_large_not_select;
+                    drawCheckmark(option, holder,
+                            res.getDrawable(drawableRes,
+                                    mContainer.getContext().getTheme()),
+                            Gravity.CENTER, res.getDimensionPixelSize(R.dimen.center_check_size),
+                            0);
                 } else if (option.equals(mAppliedOption)) {
                     // Initialize with "previewed" description if we don't show checkmark
                     holder.setContentDescription(mContainer.getContext(), option,