Make aodIconTint default to white.
Previously, this defaulted to NO_COLOR (0) when the wallpaperTextColor
cannot be fetched from the context, which made some icons not show up at
all.
Bug: 260377107
Test: manual testing (issue fully reproducible with the debug
notification icon) & atest SystemUITests
Change-Id: Ia407251621fe11ec5daac76677d6b66bf8015fa2
diff --git a/packages/SettingsLib/src/com/android/settingslib/Utils.java b/packages/SettingsLib/src/com/android/settingslib/Utils.java
index a822e18..5611976 100644
--- a/packages/SettingsLib/src/com/android/settingslib/Utils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/Utils.java
@@ -308,8 +308,16 @@
@ColorInt
public static int getColorAttrDefaultColor(Context context, int attr) {
+ return getColorAttrDefaultColor(context, attr, 0);
+ }
+
+ /**
+ * Get color styled attribute {@code attr}, default to {@code defValue} if not found.
+ */
+ @ColorInt
+ public static int getColorAttrDefaultColor(Context context, int attr, @ColorInt int defValue) {
TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
- @ColorInt int colorAccent = ta.getColor(0, 0);
+ @ColorInt int colorAccent = ta.getColor(0, defValue);
ta.recycle();
return colorAccent;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index e70c81d..85590fc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -11,6 +11,7 @@
import android.view.View;
import android.widget.FrameLayout;
+import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.collection.ArrayMap;
@@ -62,6 +63,8 @@
public static final String HIGH_PRIORITY = "high_priority";
private static final long AOD_ICONS_APPEAR_DURATION = 200;
+ @ColorInt
+ private static final int DEFAULT_AOD_ICON_COLOR = 0xffffffff;
private final ContrastColorUtil mContrastColorUtil;
private final Runnable mUpdateStatusBarIcons = this::updateStatusBarIcons;
@@ -84,7 +87,7 @@
private NotificationIconContainer mShelfIcons;
private NotificationIconContainer mAodIcons;
private final ArrayList<Rect> mTintAreas = new ArrayList<>();
- private Context mContext;
+ private final Context mContext;
private final DemoModeController mDemoModeController;
@@ -567,7 +570,7 @@
private void reloadAodColor() {
mAodIconTint = Utils.getColorAttrDefaultColor(mContext,
- R.attr.wallpaperTextColor);
+ R.attr.wallpaperTextColor, DEFAULT_AOD_ICON_COLOR);
}
private void updateAodIconColors() {