Skip to content

Commit 34eeeb8

Browse files
dmd79eldainosor
authored andcommitted
battery light: Use config_multicolorled overlay to set battery led color
for RGB we have no issue, any color can be used for single color led better use white for all battery levels this ensure that led will turn on in any case Change-Id: I2a0dfecec69aa4ce8cacdd0e4101c6aa13d42131
1 parent 663d4b0 commit 34eeeb8

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

services/core/java/com/android/server/BatteryService.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,13 @@ public void update() {
341341
!= Settings.Global.ZEN_MODE_OFF;
342342
mLowBatteryBlinking = Settings.System.getInt(resolver,
343343
Settings.System.BATTERY_LIGHT_LOW_BLINKING, 0) == 1;
344+
345+
// Use overlay to set default color for battery led
346+
// for RGB we have no issue, any color can be used
347+
// for single color led better use white for all battery levels
348+
// this ensure that led will turn on in any case
349+
350+
if(mMultiColorLed) {
344351
mBatteryLowARGB = Settings.System.getInt(resolver,
345352
Settings.System.BATTERY_LIGHT_LOW_COLOR, 0xFFFF0000);
346353
mBatteryMediumARGB = Settings.System.getInt(resolver,
@@ -349,7 +356,16 @@ public void update() {
349356
Settings.System.BATTERY_LIGHT_FULL_COLOR, 0xFFFFFF00);
350357
mBatteryReallyFullARGB = Settings.System.getInt(resolver,
351358
Settings.System.BATTERY_LIGHT_REALLYFULL_COLOR, 0xFF00FF00);
352-
359+
} else {
360+
mBatteryLowARGB = Settings.System.getInt(resolver,
361+
Settings.System.BATTERY_LIGHT_LOW_COLOR, 0xFFFFFFFF);
362+
mBatteryMediumARGB = Settings.System.getInt(resolver,
363+
Settings.System.BATTERY_LIGHT_MEDIUM_COLOR, 0xFFFFFFFF);
364+
mBatteryFullARGB = Settings.System.getInt(resolver,
365+
Settings.System.BATTERY_LIGHT_FULL_COLOR, 0xFFFFFFFF);
366+
mBatteryReallyFullARGB = Settings.System.getInt(resolver,
367+
Settings.System.BATTERY_LIGHT_REALLYFULL_COLOR, 0xFFFFFFFF);
368+
}
353369
updateLed();
354370
}
355371
}

0 commit comments

Comments
 (0)