Refine the IllustrationPreference.

- Remove the system color part of the adaptive colors.
- Add a flag to disable the adaptive colors feature.
- Update the minSdkVersion to 28.

Fix: 191136169
Test: robotest and see the UI
Change-Id: Ia385055d24092d81960cfe4093c427b23f3f2b87
diff --git a/packages/SettingsLib/IllustrationPreference/AndroidManifest.xml b/packages/SettingsLib/IllustrationPreference/AndroidManifest.xml
index 120b085..73163fc 100644
--- a/packages/SettingsLib/IllustrationPreference/AndroidManifest.xml
+++ b/packages/SettingsLib/IllustrationPreference/AndroidManifest.xml
@@ -18,6 +18,6 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.settingslib.widget">
 
-    <uses-sdk android:minSdkVersion="21" />
+    <uses-sdk android:minSdkVersion="28" />
 
 </manifest>
diff --git a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/ColorUtils.java b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/ColorUtils.java
index cd2ddeb..07102d5 100644
--- a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/ColorUtils.java
+++ b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/ColorUtils.java
@@ -39,13 +39,6 @@
 public class ColorUtils {
 
     private static HashMap<String, Integer> sSysColors;
-    static {
-        sSysColors = new HashMap<>();
-        sSysColors.put(".colorAccent", android.R.attr.colorAccent);
-        sSysColors.put(".colorPrimary", android.R.attr.colorPrimary);
-        sSysColors.put(".colorPrimaryDark", android.R.attr.colorPrimaryDark);
-        sSysColors.put(".colorSecondary", android.R.attr.colorSecondary);
-    }
 
     private static HashMap<String, Pair<Integer, Integer>> sFixedColors;
     static {
@@ -110,19 +103,6 @@
      * Apply the color of tags to the animation.
      */
     public static void applyDynamicColors(Context context, LottieAnimationView animationView) {
-        for (String key : sSysColors.keySet()) {
-            final int color = sSysColors.get(key);
-            animationView.addValueCallback(
-                    new KeyPath("**", key, "**"),
-                    LottieProperty.COLOR_FILTER,
-                    new SimpleLottieValueCallback<ColorFilter>() {
-                        @Override
-                        public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) {
-                            return new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN);
-                        }
-                    }
-            );
-        }
         for (String key : sFixedColors.keySet()) {
             final Pair<Integer, Integer> fixedColorPair = sFixedColors.get(key);
             final int color = isDarkMode(context) ? fixedColorPair.second : fixedColorPair.first;
diff --git a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java
index 1370eef..8e6c579 100644
--- a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java
+++ b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java
@@ -35,7 +35,9 @@
  */
 public class IllustrationPreference extends Preference {
 
-    static final String TAG = "IllustrationPreference";
+    private static final String TAG = "IllustrationPreference";
+
+    private static final boolean IS_ENABLED_LOTTIE_ADAPTIVE_COLOR = false;
 
     private int mAnimationId;
     private boolean mIsAutoScale;
@@ -70,7 +72,6 @@
         mIllustrationView = (LottieAnimationView) holder.findViewById(R.id.lottie_view);
         mIllustrationView.setAnimation(mAnimationId);
         mIllustrationView.loop(true);
-        ColorUtils.applyDynamicColors(getContext(), mIllustrationView);
         mIllustrationView.playAnimation();
         if (mIsAutoScale) {
             enableAnimationAutoScale(mIsAutoScale);
@@ -78,6 +79,9 @@
         if (mMiddleGroundView != null) {
             enableMiddleGroundView();
         }
+        if (IS_ENABLED_LOTTIE_ADAPTIVE_COLOR) {
+            ColorUtils.applyDynamicColors(getContext(), mIllustrationView);
+        }
     }
 
     @VisibleForTesting