summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAdrianDC <radian.dc@gmail.com>2016-05-04 19:07:22 +0200
committerSteve Kondik <shade@chemlab.org>2016-05-09 15:05:37 -0700
commit648593d3956d0978e4534d034d7a24101a451b8b (patch)
tree0b69a614679f4420eeb672eea09797ecaf6af22a /services
parent002900bdc6fa2fe386b27c5c9c520f858d2541ee (diff)
downloadframeworks_base-648593d3956d0978e4534d034d7a24101a451b8b.zip
frameworks_base-648593d3956d0978e4534d034d7a24101a451b8b.tar.gz
frameworks_base-648593d3956d0978e4534d034d7a24101a451b8b.tar.bz2
batteryservice: Use Alpha channel for segmented LED power level
* Allows proper usage of the RGB color down the liblights layers, and custom liblights will implement the usage of alpha value Change-Id: I40e2867051d5296f3045bcb85958c59793bc86cc
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/BatteryService.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index fd04811..839ba6e 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -1050,8 +1050,8 @@ public final class BatteryService extends SystemService {
mBatteryLedOff = context.getResources().getInteger(
com.android.internal.R.integer.config_notificationsBatteryLedOff);
- // Does a device have a segmented battery LED? In this case, we send the level
- // in the lower 8 bits of the color and let the HAL sort it out.
+ // Does the Device have segmented battery LED support? In this case, we send the level
+ // in the alpha channel of the color and let the HAL sort it out.
mUseSegmentedBatteryLed = context.getResources().getBoolean(
org.cyanogenmod.platform.internal.R.bool.config_useSegmentedBatteryLed);
}
@@ -1095,14 +1095,12 @@ public final class BatteryService extends SystemService {
final int level = mBatteryProps.batteryLevel;
final int status = mBatteryProps.batteryStatus;
+ mNotificationLedBrightnessLevel = mUseSegmentedBatteryLed ? level :
+ LIGHT_BRIGHTNESS_MAXIMUM;
if (!mLightEnabled) {
// No lights if explicitly disabled
mBatteryLight.turnOff();
- } else if (mUseSegmentedBatteryLed &&
- (status == BatteryManager.BATTERY_STATUS_CHARGING
- || status == BatteryManager.BATTERY_STATUS_FULL)) {
- mBatteryLight.setColor(level);
} else if (level < mLowBatteryWarningLevel) {
mBatteryLight.setModes(mNotificationLedBrightnessLevel,
mMultipleLedsEnabled);