[SettingsLib] Update Utils APIs usage
Update Utils.getColorAttr and similar methods in Utils to return a ColorStateList instead of a color
Bug: 74872054
Test: Force to display different color items then manually test
Change-Id: I92697a597b532ba95f29a886baa114ed6d0ac632
diff --git a/packages/SettingsLib/src/com/android/settingslib/Utils.java b/packages/SettingsLib/src/com/android/settingslib/Utils.java
index 56a242a..c756fdb 100644
--- a/packages/SettingsLib/src/com/android/settingslib/Utils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/Utils.java
@@ -204,16 +204,16 @@
@ColorInt
public static int getColorAccent(Context context) {
- return getColorAttr(context, android.R.attr.colorAccent);
+ return getColorAttrDefaultColor(context, android.R.attr.colorAccent);
}
@ColorInt
public static int getColorError(Context context) {
- return getColorAttr(context, android.R.attr.colorError);
+ return getColorAttrDefaultColor(context, android.R.attr.colorError);
}
@ColorInt
- public static int getDefaultColor(Context context, int resId) {
+ public static int getColorStateListDefaultColor(Context context, int resId) {
final ColorStateList list =
context.getResources().getColorStateList(resId, context.getTheme());
@@ -241,13 +241,24 @@
}
@ColorInt
- public static int getColorAttr(Context context, int attr) {
+ public static int getColorAttrDefaultColor(Context context, int attr) {
TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
@ColorInt int colorAccent = ta.getColor(0, 0);
ta.recycle();
return colorAccent;
}
+ public static ColorStateList getColorAttr(Context context, int attr) {
+ TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
+ ColorStateList stateList = null;
+ try {
+ stateList = ta.getColorStateList(0);
+ } finally {
+ ta.recycle();
+ }
+ return stateList;
+ }
+
public static int getThemeAttr(Context context, int attr) {
TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
int theme = ta.getResourceId(0, 0);
diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java b/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java
index e2f279a9..ec524c3 100644
--- a/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java
+++ b/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java
@@ -103,7 +103,8 @@
for (int i = 0; i < N; i++) {
mColors[2 * i] = levels.getInt(i, 0);
if (colors.getType(i) == TypedValue.TYPE_ATTRIBUTE) {
- mColors[2 * i + 1] = Utils.getColorAttr(context, colors.getThemeAttributeId(i, 0));
+ mColors[2 * i + 1] = Utils.getColorAttrDefaultColor(context,
+ colors.getThemeAttributeId(i, 0));
} else {
mColors[2 * i + 1] = colors.getColor(i, 0);
}
@@ -145,14 +146,16 @@
mWarningTextPaint.setColor(mColors[1]);
}
- mChargeColor = Utils.getDefaultColor(mContext, R.color.meter_consumed_color);
+ mChargeColor = Utils.getColorStateListDefaultColor(mContext, R.color.meter_consumed_color);
mBoltPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- mBoltPaint.setColor(Utils.getDefaultColor(mContext, R.color.batterymeter_bolt_color));
+ mBoltPaint.setColor(Utils.getColorStateListDefaultColor(mContext,
+ R.color.batterymeter_bolt_color));
mBoltPoints = loadPoints(res, R.array.batterymeter_bolt_points);
mPlusPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- mPlusPaint.setColor(Utils.getDefaultColor(mContext, R.color.batterymeter_plus_color));
+ mPlusPaint.setColor(Utils.getColorStateListDefaultColor(mContext,
+ R.color.batterymeter_plus_color));
mPlusPoints = loadPoints(res, R.array.batterymeter_plus_points);
mIntrinsicWidth = context.getResources().getDimensionPixelSize(R.dimen.battery_width);
diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/BluetoothDeviceLayerDrawable.java b/packages/SettingsLib/src/com/android/settingslib/graph/BluetoothDeviceLayerDrawable.java
index 3c5ac8d..11c9f7f 100644
--- a/packages/SettingsLib/src/com/android/settingslib/graph/BluetoothDeviceLayerDrawable.java
+++ b/packages/SettingsLib/src/com/android/settingslib/graph/BluetoothDeviceLayerDrawable.java
@@ -117,7 +117,8 @@
R.fraction.bt_battery_button_height_fraction, 1, 1);
mAspectRatio = resources.getFraction(R.fraction.bt_battery_ratio_fraction, 1, 1);
- final int tintColor = Utils.getColorAttr(context, android.R.attr.colorControlNormal);
+ final int tintColor = Utils.getColorAttrDefaultColor(context,
+ android.R.attr.colorControlNormal);
setColorFilter(new PorterDuffColorFilter(tintColor, PorterDuff.Mode.SRC_IN));
setBatteryLevel(batteryLevel);
mFrameColor = frameColor;
diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java b/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java
index 846e30d..a6b5755 100644
--- a/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java
+++ b/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java
@@ -132,13 +132,17 @@
public SignalDrawable(Context context) {
mDarkModeBackgroundColor =
- Utils.getDefaultColor(context, R.color.dark_mode_icon_color_dual_tone_background);
+ Utils.getColorStateListDefaultColor(context,
+ R.color.dark_mode_icon_color_dual_tone_background);
mDarkModeFillColor =
- Utils.getDefaultColor(context, R.color.dark_mode_icon_color_dual_tone_fill);
+ Utils.getColorStateListDefaultColor(context,
+ R.color.dark_mode_icon_color_dual_tone_fill);
mLightModeBackgroundColor =
- Utils.getDefaultColor(context, R.color.light_mode_icon_color_dual_tone_background);
+ Utils.getColorStateListDefaultColor(context,
+ R.color.light_mode_icon_color_dual_tone_background);
mLightModeFillColor =
- Utils.getDefaultColor(context, R.color.light_mode_icon_color_dual_tone_fill);
+ Utils.getColorStateListDefaultColor(context,
+ R.color.light_mode_icon_color_dual_tone_fill);
mIntrinsicSize = context.getResources().getDimensionPixelSize(R.dimen.signal_icon_size);
mHandler = new Handler();
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java
index 26f3683..f172947 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java
@@ -183,7 +183,7 @@
Drawable drawable = mIconInjector.getIcon(level);
if (!mForSavedNetworks && drawable != null) {
- drawable.setTint(Utils.getColorAttr(context, android.R.attr.colorControlNormal));
+ drawable.setTintList(Utils.getColorAttr(context, android.R.attr.colorControlNormal));
setIcon(drawable);
} else {
safeSetDefaultIcon();
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
index 9a26b35..5a6ff41 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
@@ -102,7 +102,7 @@
super.onFinishInflate();
mTitle = findViewById(R.id.title);
mRow = findViewById(R.id.row);
- mTextColor = Utils.getColorAttr(mContext, R.attr.wallpaperTextColor);
+ mTextColor = Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColor);
mIconSize = (int) mContext.getResources().getDimension(R.dimen.widget_icon_size);
}
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
index 0683514..84bb7fe 100644
--- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
@@ -164,8 +164,8 @@
if (mUseWallpaperTextColors) {
updateColors(
- Utils.getColorAttr(mContext, R.attr.wallpaperTextColor),
- Utils.getColorAttr(mContext, R.attr.wallpaperTextColorSecondary));
+ Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColor),
+ Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColorSecondary));
} else {
updateColors(mNonAdaptedForegroundColor, mNonAdaptedBackgroundColor);
}
@@ -180,10 +180,13 @@
Utils.getThemeAttr(context, R.attr.darkIconTheme));
Context dualToneLightTheme = new ContextThemeWrapper(context,
Utils.getThemeAttr(context, R.attr.lightIconTheme));
- mDarkModeBackgroundColor = Utils.getColorAttr(dualToneDarkTheme, R.attr.backgroundColor);
- mDarkModeFillColor = Utils.getColorAttr(dualToneDarkTheme, R.attr.fillColor);
- mLightModeBackgroundColor = Utils.getColorAttr(dualToneLightTheme, R.attr.backgroundColor);
- mLightModeFillColor = Utils.getColorAttr(dualToneLightTheme, R.attr.fillColor);
+ mDarkModeBackgroundColor = Utils.getColorAttrDefaultColor(dualToneDarkTheme,
+ R.attr.backgroundColor);
+ mDarkModeFillColor = Utils.getColorAttrDefaultColor(dualToneDarkTheme,
+ R.attr.fillColor);
+ mLightModeBackgroundColor = Utils.getColorAttrDefaultColor(dualToneLightTheme,
+ R.attr.backgroundColor);
+ mLightModeFillColor = Utils.getColorAttrDefaultColor(dualToneLightTheme, R.attr.fillColor);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java b/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java
index fb2eb4c..97d7999 100644
--- a/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/HardwareBgDrawable.java
@@ -61,7 +61,7 @@
: R.drawable.rounded_bg_bottom).mutate(),
};
}
- layers[1].setTint(Utils.getColorAttr(context, android.R.attr.colorPrimary));
+ layers[1].setTintList(Utils.getColorAttr(context, android.R.attr.colorPrimary));
return layers;
}
diff --git a/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingView.java b/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingView.java
index 9c411d6..ad6dfa4 100644
--- a/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingView.java
+++ b/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingView.java
@@ -95,7 +95,7 @@
private void setupPaint() {
mPaint = new Paint();
- mPaint.setColor(Utils.getColorAttr(mContext, R.attr.wallpaperTextColor));
+ mPaint.setColor(Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColor));
}
public void setPaintColor(int color) {
@@ -179,4 +179,4 @@
private float getPathGone(long now) {
return (float) (now - mAnimationStartTime) / (WirelessChargingAnimation.DURATION);
}
-}
\ No newline at end of file
+}
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
index a1adfa6..1489c21 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
@@ -106,7 +106,8 @@
d.setContentView(R.layout.shutdown_dialog);
d.setCancelable(false);
- int color = Utils.getColorAttr(mContext, com.android.systemui.R.attr.wallpaperTextColor);
+ int color = Utils.getColorAttrDefaultColor(mContext,
+ com.android.systemui.R.attr.wallpaperTextColor);
boolean onKeyguard = mContext.getSystemService(
KeyguardManager.class).isKeyguardLocked();
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
index 40ce69b..2763f4c 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
@@ -242,7 +242,7 @@
// remaining estimate is disabled
if (mEstimate == null || mBucket < 0
|| mEstimate.estimateMillis < mSevereWarningThreshold) {
- nb.setColor(Utils.getColorAttr(mContext, android.R.attr.colorError));
+ nb.setColor(Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorError));
}
nb.addAction(0,
mContext.getString(R.string.battery_saver_start_action),
@@ -337,7 +337,8 @@
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setContentIntent(pendingBroadcast(ACTION_CLICKED_TEMP_WARNING))
.setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_TEMP_WARNING))
- .setColor(Utils.getColorAttr(mContext, android.R.attr.colorError));
+ .setColor(Utils.getColorAttrDefaultColor(mContext,
+ android.R.attr.colorError));
SystemUI.overrideNotificationAppName(mContext, nb, false);
final Notification n = nb.build();
mNoMan.notifyAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, n, UserHandle.ALL);
@@ -387,7 +388,8 @@
.setContentIntent(pendingBroadcast(ACTION_CLICKED_THERMAL_SHUTDOWN_WARNING))
.setDeleteIntent(
pendingBroadcast(ACTION_DISMISSED_THERMAL_SHUTDOWN_WARNING))
- .setColor(Utils.getColorAttr(mContext, android.R.attr.colorError));
+ .setColor(Utils.getColorAttrDefaultColor(mContext,
+ android.R.attr.colorError));
SystemUI.overrideNotificationAppName(mContext, nb, false);
final Notification n = nb.build();
mNoMan.notifyAsUser(
diff --git a/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java b/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java
index 047e0d1..9b5f23b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/DataUsageGraph.java
@@ -45,8 +45,10 @@
public DataUsageGraph(Context context, AttributeSet attrs) {
super(context, attrs);
final Resources res = context.getResources();
- mTrackColor = Utils.getDefaultColor(context, R.color.data_usage_graph_track);
- mWarningColor = Utils.getDefaultColor(context, R.color.data_usage_graph_warning);
+ mTrackColor = Utils.getColorStateListDefaultColor(context,
+ R.color.data_usage_graph_track);
+ mWarningColor = Utils.getColorStateListDefaultColor(context,
+ R.color.data_usage_graph_warning);
mUsageColor = Utils.getColorAccent(context);
mOverlimitColor = Utils.getColorError(context);
mMarkerWidth = res.getDimensionPixelSize(R.dimen.data_usage_graph_marker_width);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
index cf549fa..4e78368 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
@@ -96,7 +96,7 @@
public QSFooterImpl(Context context, AttributeSet attrs) {
super(context, attrs);
- mColorForeground = Utils.getColorAttr(context, android.R.attr.colorForeground);
+ mColorForeground = Utils.getColorAttrDefaultColor(context, android.R.attr.colorForeground);
}
@Override
@@ -354,7 +354,7 @@
!(picture instanceof UserIconDrawable)) {
picture = picture.getConstantState().newDrawable(mContext.getResources()).mutate();
picture.setColorFilter(
- Utils.getColorAttr(mContext, android.R.attr.colorForeground),
+ Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorForeground),
Mode.SRC_IN);
}
mMultiUserAvatar.setImageDrawable(picture);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index e2af90d..655f962 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -162,7 +162,8 @@
updateResources();
Rect tintArea = new Rect(0, 0, 0, 0);
- int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground);
+ int colorForeground = Utils.getColorAttrDefaultColor(getContext(),
+ android.R.attr.colorForeground);
float intensity = getColorIntensity(colorForeground);
int fillColor = fillColorForIntensity(intensity, getContext());
diff --git a/packages/SystemUI/src/com/android/systemui/qs/car/CarStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/car/CarStatusBarHeader.java
index 31c455d..40f174f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/car/CarStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/car/CarStatusBarHeader.java
@@ -40,7 +40,8 @@
super.onFinishInflate();
// Set the light/dark theming on the header status UI to match the current theme.
- int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground);
+ int colorForeground = Utils.getColorAttrDefaultColor(getContext(),
+ android.R.attr.colorForeground);
float intensity = colorForeground == Color.WHITE ? 0f : 1f;
Rect tintArea = new Rect(0, 0, 0, 0);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
index 4aa83d0..bec4bab 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
@@ -101,7 +101,7 @@
mToolbar.getMenu().add(Menu.NONE, MENU_RESET, 0,
mContext.getString(com.android.internal.R.string.reset));
mToolbar.setTitle(R.string.qs_edit);
- int accentColor = Utils.getColorAttr(context, android.R.attr.colorAccent);
+ int accentColor = Utils.getColorAttrDefaultColor(context, android.R.attr.colorAccent);
mToolbar.setTitleTextColor(accentColor);
mToolbar.getNavigationIcon().setTint(accentColor);
mToolbar.getOverflowIcon().setTint(accentColor);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java
index cc60f87..ebfa6af 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java
@@ -94,10 +94,10 @@
setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
setBackground(mTileBackground);
- mColorActive = Utils.getColorAttr(context, android.R.attr.colorAccent);
+ mColorActive = Utils.getColorAttrDefaultColor(context, android.R.attr.colorAccent);
mColorDisabled = Utils.getDisabled(context,
- Utils.getColorAttr(context, android.R.attr.textColorTertiary));
- mColorInactive = Utils.getColorAttr(context, android.R.attr.textColorSecondary);
+ Utils.getColorAttrDefaultColor(context, android.R.attr.textColorTertiary));
+ mColorInactive = Utils.getColorAttrDefaultColor(context, android.R.attr.textColorSecondary);
setPadding(0, 0, 0, 0);
setClipChildren(false);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java
index 834feb7..6bc3bee 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java
@@ -387,11 +387,11 @@
switch (state) {
case Tile.STATE_UNAVAILABLE:
return Utils.getDisabled(context,
- Utils.getColorAttr(context, android.R.attr.textColorSecondary));
+ Utils.getColorAttrDefaultColor(context, android.R.attr.textColorSecondary));
case Tile.STATE_INACTIVE:
- return Utils.getColorAttr(context, android.R.attr.textColorSecondary);
+ return Utils.getColorAttrDefaultColor(context, android.R.attr.textColorSecondary);
case Tile.STATE_ACTIVE:
- return Utils.getColorAttr(context, android.R.attr.colorPrimary);
+ return Utils.getColorAttrDefaultColor(context, android.R.attr.colorPrimary);
default:
Log.e("QSTile", "Invalid state " + state);
return 0;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java
index 7224ae6..b52e215 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java
@@ -91,7 +91,7 @@
formatBytes(info.usageLevel));
bottom = res.getString(R.string.quick_settings_cellular_detail_data_limit,
formatBytes(info.limitLevel));
- usageColor = Utils.getDefaultColor(mContext, android.R.attr.colorError);
+ usageColor = Utils.getColorStateListDefaultColor(mContext, android.R.attr.colorError);
}
if (usageColor == 0) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
index e3ed1aa..0f64ea3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -198,7 +198,7 @@
}
public void reevaluateStyles() {
- int textColor = Utils.getColorAttr(mContext, R.attr.wallpaperTextColor);
+ int textColor = Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColor);
boolean usingDarkText = Color.luminance(textColor) < 0.5f;
mEmptyView.setTextColor(textColor);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
index 5ec822d..235ff2b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
@@ -166,7 +166,7 @@
mSemiTransparent = context.getColor(
com.android.internal.R.color.system_bar_background_semi_transparent);
mTransparent = context.getColor(R.color.system_bar_background_transparent);
- mWarning = Utils.getColorAttr(context, android.R.attr.colorError);
+ mWarning = Utils.getColorAttrDefaultColor(context, android.R.attr.colorError);
}
mGradient = context.getDrawable(gradientResourceId);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
index b817809..dc3a752 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -437,9 +437,10 @@
}
public void onThemeChanged() {
- @ColorInt int textColor = Utils.getColorAttr(mContext, R.attr.wallpaperTextColor);
- @ColorInt int iconColor = Utils.getDefaultColor(mContext, Color.luminance(textColor) < 0.5 ?
- R.color.dark_mode_icon_color_single_tone :
+ @ColorInt int textColor = Utils.getColorAttrDefaultColor(mContext,
+ R.attr.wallpaperTextColor);
+ @ColorInt int iconColor = Utils.getColorStateListDefaultColor(mContext,
+ Color.luminance(textColor) < 0.5 ? R.color.dark_mode_icon_color_single_tone :
R.color.light_mode_icon_color_single_tone);
float intensity = textColor == Color.WHITE ? 0 : 1;
mCarrierLabel.setTextColor(iconColor);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index db2139d..633ae48 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -750,8 +750,8 @@
final int dualToneLightTheme = Utils.getThemeAttr(ctx, R.attr.lightIconTheme);
Context darkContext = new ContextThemeWrapper(ctx, dualToneDarkTheme);
Context lightContext = new ContextThemeWrapper(ctx, dualToneLightTheme);
- final int lightColor = Utils.getColorAttr(lightContext, R.attr.singleToneColor);
- final int darkColor = Utils.getColorAttr(darkContext, R.attr.singleToneColor);
+ final int lightColor = Utils.getColorAttrDefaultColor(lightContext, R.attr.singleToneColor);
+ final int darkColor = Utils.getColorAttrDefaultColor(darkContext, R.attr.singleToneColor);
// Use the supplied style to set the icon's rotation parameters
Context rotateContext = new ContextThemeWrapper(ctx, style);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java
index 028da86..aa60ec5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/TrustDrawable.java
@@ -83,7 +83,7 @@
mPaint = new Paint();
mPaint.setStyle(Paint.Style.STROKE);
- mPaint.setColor(Utils.getColorAttr(context, R.attr.wallpaperTextColor));
+ mPaint.setColor(Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColor));
mPaint.setAntiAlias(true);
mPaint.setStrokeWidth(mThickness);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
index 302f097..13fabfd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
@@ -677,7 +677,8 @@
Drawable icon = UserIcons.getDefaultUserIcon(
context.getResources(), item.resolveId(), /* light= */ false);
if (item.isGuest) {
- icon.setColorFilter(Utils.getColorAttr(context, android.R.attr.colorForeground),
+ icon.setColorFilter(Utils.getColorAttrDefaultColor(context,
+ android.R.attr.colorForeground),
Mode.SRC_IN);
}
return icon;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index d282f25..f7813cd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -3882,7 +3882,7 @@
mUsingLightTheme = lightTheme;
Context context = new ContextThemeWrapper(mContext,
lightTheme ? R.style.Theme_SystemUI_Light : R.style.Theme_SystemUI);
- final int textColor = Utils.getColorAttr(context, R.attr.wallpaperTextColor);
+ final int textColor = Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColor);
mFooterView.setTextColor(textColor);
mEmptyShadeView.setTextColor(textColor);
}