lineage-sdk lights: add battery light isSupported() helper
*) Used by fw/b to prevent making LightsService calls when a battery light is not present. Change-Id: I871a0fd3505e6f0b4db8eb6ba5971680c36a14c3
This commit is contained in:
@@ -35,6 +35,7 @@ public final class LineageBatteryLights {
|
||||
private final boolean DEBUG = false;
|
||||
|
||||
// Battery light capabilities.
|
||||
private final boolean mHasBatteryLed;
|
||||
private final boolean mMultiColorLed;
|
||||
private final boolean mUseSegmentedBatteryLed;
|
||||
|
||||
@@ -56,6 +57,10 @@ public final class LineageBatteryLights {
|
||||
mContext = context;
|
||||
mLedUpdater = ledUpdater;
|
||||
|
||||
// Does the device have a battery LED ?
|
||||
mHasBatteryLed = LightsCapabilities.supports(
|
||||
mContext, LightsCapabilities.LIGHTS_BATTERY_LED);
|
||||
|
||||
// Does the device support changing battery LED colors?
|
||||
mMultiColorLed = LightsCapabilities.supports(
|
||||
mContext, LightsCapabilities.LIGHTS_RGB_BATTERY_LED);
|
||||
@@ -69,6 +74,10 @@ public final class LineageBatteryLights {
|
||||
observer.observe();
|
||||
}
|
||||
|
||||
public boolean isSupported() {
|
||||
return mHasBatteryLed;
|
||||
}
|
||||
|
||||
public void calcLights(LedValues ledValues, int level, int status, boolean low) {
|
||||
if (DEBUG) {
|
||||
Slog.i(TAG, "calcLights input: ledValues={ " + ledValues + " } level="
|
||||
|
||||
Reference in New Issue
Block a user