Merge "Apply ColorStateList to external icons so that they update when preferences are disabled." into pi-car-dev
diff --git a/res/drawable/ic_audio_navi.xml b/res/drawable/ic_audio_navi.xml
index afc8a61..4919d18 100644
--- a/res/drawable/ic_audio_navi.xml
+++ b/res/drawable/ic_audio_navi.xml
@@ -21,7 +21,8 @@
     android:height="@dimen/icon_size"
     android:viewportHeight="24.0"
     android:viewportWidth="24.0">
+    <!-- Use solid fillColor for mask. Icon tint color will be applied after icon is loaded. -->
     <path
-        android:fillColor="?attr/iconColor"
+        android:fillColor="#FF000000"
         android:pathData="M18.92,5.01C18.72,4.42 18.16,4 17.5,4h-11c-0.66,0 -1.21,0.42 -1.42,1.01L3,11v8c0,0.55 0.45,1 1,1h1c0.55,0 1,-0.45 1,-1v-1h12v1c0,0.55 0.45,1 1,1h1c0.55,0 1,-0.45 1,-1v-8l-2.08,-5.99zM6.5,15c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,12 6.5,12s1.5,0.67 1.5,1.5S7.33,15 6.5,15zM17.5,15c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM5,10l1.5,-4.5h11L19,10L5,10z"/>
 </vector>
diff --git a/src/com/android/car/settings/accounts/SyncPreference.java b/src/com/android/car/settings/accounts/SyncPreference.java
index 76e3f2a..612a739 100644
--- a/src/com/android/car/settings/accounts/SyncPreference.java
+++ b/src/com/android/car/settings/accounts/SyncPreference.java
@@ -69,15 +69,15 @@
         switch (mSyncState) {
             case ACTIVE:
                 setIcon(R.drawable.ic_sync_anim);
-                getIcon().setTint(Themes.getAttrColor(getContext(), R.attr.iconColor));
+                getIcon().setTintList(Themes.getAttrColorStateList(getContext(), R.attr.iconColor));
                 break;
             case PENDING:
                 setIcon(R.drawable.ic_sync);
-                getIcon().setTint(Themes.getAttrColor(getContext(), R.attr.iconColor));
+                getIcon().setTintList(Themes.getAttrColorStateList(getContext(), R.attr.iconColor));
                 break;
             case FAILED:
                 setIcon(R.drawable.ic_sync_problem);
-                getIcon().setTint(Themes.getAttrColor(getContext(), R.attr.iconColor));
+                getIcon().setTintList(Themes.getAttrColorStateList(getContext(), R.attr.iconColor));
                 break;
             default:
                 setIcon(null);
diff --git a/src/com/android/car/settings/bluetooth/BluetoothDeviceNamePreferenceController.java b/src/com/android/car/settings/bluetooth/BluetoothDeviceNamePreferenceController.java
index 9ca375a..afb7db5 100644
--- a/src/com/android/car/settings/bluetooth/BluetoothDeviceNamePreferenceController.java
+++ b/src/com/android/car/settings/bluetooth/BluetoothDeviceNamePreferenceController.java
@@ -75,7 +75,8 @@
         }
         preference.setTitle(cachedDevice.getName());
         preference.setIcon(pair.first);
-        preference.getIcon().setTint(Themes.getAttrColor(getContext(), R.attr.iconColor));
+        preference.getIcon().setTintList(
+                Themes.getAttrColorStateList(getContext(), R.attr.iconColor));
         preference.setSummary(summaryJoiner.toString());
     }
 
diff --git a/src/com/android/car/settings/bluetooth/BluetoothDevicePreference.java b/src/com/android/car/settings/bluetooth/BluetoothDevicePreference.java
index 4748e01..66274c9 100644
--- a/src/com/android/car/settings/bluetooth/BluetoothDevicePreference.java
+++ b/src/com/android/car/settings/bluetooth/BluetoothDevicePreference.java
@@ -82,7 +82,7 @@
                 .getBtClassDrawableWithDescription(getContext(), mCachedDevice);
         if (pair.first != null) {
             setIcon(pair.first);
-            getIcon().setTint(Themes.getAttrColor(getContext(), R.attr.iconColor));
+            getIcon().setTintList(Themes.getAttrColorStateList(getContext(), R.attr.iconColor));
         }
 
         setEnabled(!mCachedDevice.isBusy());
diff --git a/src/com/android/car/settings/common/ExtraSettingsLoader.java b/src/com/android/car/settings/common/ExtraSettingsLoader.java
index 6d81060..1f51496 100644
--- a/src/com/android/car/settings/common/ExtraSettingsLoader.java
+++ b/src/com/android/car/settings/common/ExtraSettingsLoader.java
@@ -137,7 +137,8 @@
             preference.setSummary(summary);
             if (icon != null) {
                 preference.setIcon(icon.loadDrawable(mContext));
-                preference.getIcon().setTint(Themes.getAttrColor(mContext, R.attr.iconColor));
+                preference.getIcon().setTintList(
+                        Themes.getAttrColorStateList(mContext, R.attr.iconColor));
             }
             preference.setIntent(extraSettingIntent);
             mPreferenceBundleMap.put(preference, metaData);
diff --git a/src/com/android/car/settings/sound/VolumeSettingsPreferenceController.java b/src/com/android/car/settings/sound/VolumeSettingsPreferenceController.java
index 4e92c0d..fae748e 100644
--- a/src/com/android/car/settings/sound/VolumeSettingsPreferenceController.java
+++ b/src/com/android/car/settings/sound/VolumeSettingsPreferenceController.java
@@ -142,7 +142,8 @@
         SeekBarPreference preference = new SeekBarPreference(getContext());
         preference.setTitle(getContext().getString(titleId));
         preference.setIcon(getContext().getDrawable(iconResId));
-        preference.getIcon().setTint(Themes.getAttrColor(getContext(), R.attr.iconColor));
+        preference.getIcon().setTintList(
+                Themes.getAttrColorStateList(getContext(), R.attr.iconColor));
         try {
             preference.setValue(mCarAudioManager.getGroupVolume(volumeGroupId));
             preference.setMin(mCarAudioManager.getGroupMinVolume(volumeGroupId));