Skip to content

Commit

Permalink
battery light: Use config_multicolorled overlay to set battery led color
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dmd79 authored and dinosnore1 committed Mar 19, 2020
1 parent ad58b21 commit 3a51160
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion services/core/java/com/android/server/BatteryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@ public void update() {
!= Settings.Global.ZEN_MODE_OFF;
mLowBatteryBlinking = Settings.System.getInt(resolver,
Settings.System.BATTERY_LIGHT_LOW_BLINKING, 0) == 1;

// Use overlay to set default color for battery led
// 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

if(mMultiColorLed) {
mBatteryLowARGB = Settings.System.getInt(resolver,
Settings.System.BATTERY_LIGHT_LOW_COLOR, 0xFFFF0000);
mBatteryMediumARGB = Settings.System.getInt(resolver,
Expand All @@ -349,7 +356,16 @@ public void update() {
Settings.System.BATTERY_LIGHT_FULL_COLOR, 0xFFFFFF00);
mBatteryReallyFullARGB = Settings.System.getInt(resolver,
Settings.System.BATTERY_LIGHT_REALLYFULL_COLOR, 0xFF00FF00);

} else {
mBatteryLowARGB = Settings.System.getInt(resolver,
Settings.System.BATTERY_LIGHT_LOW_COLOR, 0xFFFFFFFF);
mBatteryMediumARGB = Settings.System.getInt(resolver,
Settings.System.BATTERY_LIGHT_MEDIUM_COLOR, 0xFFFFFFFF);
mBatteryFullARGB = Settings.System.getInt(resolver,
Settings.System.BATTERY_LIGHT_FULL_COLOR, 0xFFFFFFFF);
mBatteryReallyFullARGB = Settings.System.getInt(resolver,
Settings.System.BATTERY_LIGHT_REALLYFULL_COLOR, 0xFFFFFFFF);
}
updateLed();
}
}
Expand Down

0 comments on commit 3a51160

Please sign in to comment.