Merge changes I5639f639,Ied40e56a into main
* changes:
[Old [Battery] [Flexi]] Use textColorPrimary for ShadeHeader
[[Old] Battery] Set the battery colors in ShadeHeaderController
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt
index 516e140..cfb069a 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt
@@ -372,6 +372,20 @@
val batteryIcon = BatteryMeterView(context, null)
batteryIcon.setPercentShowMode(BatteryMeterView.MODE_ON)
+ val themedContext =
+ ContextThemeWrapper(context, R.style.Theme_SystemUI_QuickSettings_Header)
+ val fg = Utils.getColorAttrDefaultColor(themedContext, android.R.attr.textColorPrimary)
+ val bg =
+ Utils.getColorAttrDefaultColor(
+ themedContext,
+ android.R.attr.textColorPrimaryInverse,
+ )
+
+ // [BatteryMeterView.updateColors] is an old method that was built to distinguish
+ // between dual-tone colors and single-tone. The current icon is only single-tone, so
+ // the final [fg] is the only one we actually need
+ batteryIcon.updateColors(fg, bg, fg)
+
val batteryMaterViewController =
createBatteryMeterViewController(batteryIcon, StatusBarLocation.QS)
batteryMaterViewController.init()
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeHeaderController.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeHeaderController.kt
index df9c57c..f7c4358 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeHeaderController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeHeaderController.kt
@@ -303,10 +303,18 @@
// battery settings same as in QS icons
batteryMeterViewController.ignoreTunerUpdates()
+ val fgColor =
+ Utils.getColorAttrDefaultColor(header.context, android.R.attr.textColorPrimary)
+ val bgColor =
+ Utils.getColorAttrDefaultColor(header.context, android.R.attr.textColorPrimaryInverse)
+
iconManager = tintedIconManagerFactory.create(iconContainer, StatusBarLocation.QS)
- iconManager.setTint(
- Utils.getColorAttrDefaultColor(header.context, android.R.attr.textColorPrimary),
- Utils.getColorAttrDefaultColor(header.context, android.R.attr.textColorPrimaryInverse),
+ iconManager.setTint(fgColor, bgColor)
+
+ batteryIcon.updateColors(
+ fgColor /* foreground */,
+ bgColor /* background */,
+ fgColor /* single tone (current default) */
)
carrierIconSlots =