Merge "Force persistent taskbar all apps icon to light version." into tm-qpr-dev am: 858092151c am: f114ad9fa4

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

Change-Id: I1fc1ca1a807d3d23448e456dddc9de91af0fced6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index db584d8..38351a9 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -47,6 +47,7 @@
 import com.android.launcher3.util.LauncherBindableItemsContainer;
 import com.android.launcher3.views.ActivityContext;
 import com.android.launcher3.views.DoubleShadowBubbleTextView;
+import com.android.launcher3.views.IconButtonView;
 
 import java.util.function.Predicate;
 
@@ -80,7 +81,7 @@
     private @Nullable FolderIcon mLeaveBehindFolderIcon;
 
     // Only non-null when device supports having an All Apps button.
-    private @Nullable View mAllAppsButton;
+    private @Nullable IconButtonView mAllAppsButton;
 
     // Only non-null when device supports having an All Apps button.
     private @Nullable View mTaskbarDivider;
@@ -125,10 +126,14 @@
 
         if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()
                 && !mActivityContext.getPackageManager().hasSystemFeature(FEATURE_PC)) {
-            mAllAppsButton = LayoutInflater.from(context)
+            mAllAppsButton = (IconButtonView) LayoutInflater.from(context)
                     .inflate(R.layout.taskbar_all_apps_button, this, false);
             mAllAppsButton.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding);
             mAllAppsButton.setScaleX(mIsRtl ? -1 : 1);
+            mAllAppsButton.setForegroundTint(mActivityContext.getColor(
+                    DisplayController.isTransientTaskbar(mActivityContext)
+                            ? R.color.all_apps_button_color
+                            : R.color.all_apps_button_color_dark));
 
             if (FeatureFlags.ENABLE_TASKBAR_PINNING.get()) {
                 mTaskbarDivider = LayoutInflater.from(context).inflate(R.layout.taskbar_divider,
diff --git a/res/values-night-v31/colors.xml b/res/values-night-v31/colors.xml
index 54d6d88..2c1bc90 100644
--- a/res/values-night-v31/colors.xml
+++ b/res/values-night-v31/colors.xml
@@ -24,6 +24,4 @@
     <color name="home_settings_thumb_off_color">@android:color/system_neutral2_300</color>
     <color name="home_settings_track_on_color">@android:color/system_accent2_700</color>
     <color name="home_settings_track_off_color">@android:color/system_neutral1_700</color>
-
-    <color name="all_apps_button_color">?android:attr/textColorSecondary</color>
 </resources>
\ No newline at end of file
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index 17fe419..4ba77fa 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -17,5 +17,5 @@
 -->
 
 <resources>
-    <color name="all_apps_button_color">#BFC8CC</color>
+    <color name="all_apps_button_color">@color/all_apps_button_color_dark</color>
 </resources>
\ No newline at end of file
diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml
index cf4f000..63a5454 100644
--- a/res/values-v31/colors.xml
+++ b/res/values-v31/colors.xml
@@ -62,5 +62,6 @@
     <color name="preload_icon_accent_color_dark">@android:color/system_accent1_300</color>
     <color name="preload_icon_background_color_dark">@android:color/system_neutral2_700</color>
 
-    <color name="all_apps_button_color">?android:attr/textColorSecondary</color>
+    <color name="all_apps_button_color_light">@android:color/system_neutral2_700</color>
+    <color name="all_apps_button_color_dark">@android:color/system_neutral2_200</color>
 </resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 9d6927b..ef7bf91 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -80,7 +80,9 @@
     <color name="workspace_accent_color_light">#ff8df5e3</color>
     <color name="workspace_accent_color_dark">#ff3d665f</color>
 
-    <color name="all_apps_button_color">#40484B</color>
+    <color name="all_apps_button_color">@color/all_apps_button_color_light</color>
+    <color name="all_apps_button_color_light">#40484B</color>
+    <color name="all_apps_button_color_dark">#BFC8CC</color>
 
     <color name="preload_icon_accent_color_light">#00668B</color>
     <color name="preload_icon_background_color_light">#B5CAD7</color>
diff --git a/src/com/android/launcher3/views/IconButtonView.java b/src/com/android/launcher3/views/IconButtonView.java
index dd48c99..64e9327 100644
--- a/src/com/android/launcher3/views/IconButtonView.java
+++ b/src/com/android/launcher3/views/IconButtonView.java
@@ -30,6 +30,8 @@
 import android.os.Build;
 import android.util.AttributeSet;
 
+import androidx.annotation.ColorInt;
+
 import com.android.launcher3.BubbleTextView;
 import com.android.launcher3.icons.BaseIconFactory;
 import com.android.launcher3.icons.FastBitmapDrawable;
@@ -68,6 +70,14 @@
         }
     }
 
+    /** Updates the color of the icon's foreground layer. */
+    public void setForegroundTint(@ColorInt int tintColor) {
+        FastBitmapDrawable icon = getIcon();
+        if (icon instanceof IconDrawable) {
+            ((IconDrawable) icon).mFg.setTint(tintColor);
+        }
+    }
+
     private static class IconDrawable extends FastBitmapDrawable {
 
         private final Drawable mFg;