Change color rings color to system accent

 - Create state drawable programmatically and fill options center part
 only with accent color
 video: https://drive.google.com/file/d/1swM0i_vfUg1CQj8m7F9h28Cr45020SHr/view?usp=sharing

 Fixes: 158625350
 Test: manually

Change-Id: Ica0f4a30b15e8195544a9619bc1af21c9f11ecc1
diff --git a/res/drawable/color_chip.xml b/res/drawable/color_chip.xml
deleted file mode 100644
index 11301b1..0000000
--- a/res/drawable/color_chip.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item
-        android:state_activated="true"
-        android:drawable="@drawable/color_chip_hollow" />
-    <item
-        android:state_activated="false"
-        android:drawable="@drawable/color_chip_filled" />
-    <item
-        android:drawable="@drawable/color_chip_filled"/>
-</selector>
\ No newline at end of file
diff --git a/res/drawable/color_chip_hollow.xml b/res/drawable/color_chip_hollow.xml
index 699dc60..49e6a4d 100644
--- a/res/drawable/color_chip_hollow.xml
+++ b/res/drawable/color_chip_hollow.xml
@@ -1,6 +1,5 @@
 <?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");
@@ -17,6 +16,7 @@
 -->
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
     <item
+        android:id="@+id/center_fill"
         android:height="@dimen/component_color_chip_size"
         android:width="@dimen/component_color_chip_size"
         android:gravity="center">
@@ -34,7 +34,7 @@
             android:innerRadius="24dp"
             android:thickness="@dimen/option_border_width"
             android:useLevel="false">
-        <solid android:color="@android:color/black"/>
+        <solid android:color="?android:colorAccent"/>
         </shape>
     </item>
 </layer-list>
diff --git a/res/layout/theme_color_option.xml b/res/layout/theme_color_option.xml
index 9a3c4c4..8d55626 100644
--- a/res/layout/theme_color_option.xml
+++ b/res/layout/theme_color_option.xml
@@ -26,6 +26,5 @@
         android:layout_width="@dimen/component_color_chip_container_size"
         android:layout_height="@dimen/component_color_chip_container_size"
         android:layout_gravity="center"
-        android:scaleType="center"
-        android:src="@drawable/color_chip"/>
+        android:scaleType="center"/>
 </FrameLayout>
diff --git a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
index b3d9d15..178098c 100644
--- a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
+++ b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
@@ -35,6 +35,7 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
 import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.StateListDrawable;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -315,8 +316,21 @@
         @Override
         public void bindThumbnailTile(View view) {
             @ColorInt int color = resolveColor(view.getResources());
-            ((ImageView) view.findViewById(R.id.option_tile)).setImageTintList(
+            LayerDrawable selectedOption = (LayerDrawable) view.getResources().getDrawable(
+                    R.drawable.color_chip_hollow, view.getContext().getTheme());
+            Drawable unselectedOption = view.getResources().getDrawable(
+                    R.drawable.color_chip_filled, view.getContext().getTheme());
+
+            selectedOption.findDrawableByLayerId(R.id.center_fill).setTintList(
                     ColorStateList.valueOf(color));
+            unselectedOption.setTintList(ColorStateList.valueOf(color));
+
+            StateListDrawable stateListDrawable = new StateListDrawable();
+            stateListDrawable.addState(new int[] {android.R.attr.state_activated}, selectedOption);
+            stateListDrawable.addState(
+                    new int[] {-android.R.attr.state_activated}, unselectedOption);
+
+            ((ImageView) view.findViewById(R.id.option_tile)).setImageDrawable(stateListDrawable);
             view.setContentDescription(mLabel);
         }