diff options
3 files changed, 42 insertions, 2 deletions
diff --git a/lineage/res/res/values/config.xml b/lineage/res/res/values/config.xml index 83075099..32257b25 100644 --- a/lineage/res/res/values/config.xml +++ b/lineage/res/res/values/config.xml @@ -60,14 +60,41 @@ This integer should equal the sum of the corresponding value for each of the following capabilities present: + // Device has a color adjustable battery light. LIGHTS_RGB_NOTIFICATION_LED = 1 + + // Device has a color adjustable notification light. LIGHTS_RGB_BATTERY_LED = 2 + LIGHTS_MULTIPLE_NOTIFICATION_LED = 4 (deprecated) + + // The notification light has adjustable pulsing capability. LIGHTS_PULSATING_LED = 8 + + // Device has a multi-segment battery light that is able to + // use the light brightness value to determine how many + // segments to show (in order to represent battery level). LIGHTS_SEGMENTED_BATTERY_LED = 16 + + // The notification light supports HAL adjustable brightness + // via the alpha channel. + // Note: if a device notification light supports LIGHTS_RGB_NOTIFICATION_LED + // then HAL support is not necessary for brightness control. In this case, + // brightness support will be provided by lineage-sdk through the scaling of + // RGB color values. LIGHTS_ADJUSTABLE_NOTIFICATION_LED_BRIGHTNESS = 32 + + // Device has a battery light. LIGHTS_BATTERY_LED = 64 + // The battery light supports HAL adjustable brightness via + // the alpha channel. + // Note: if a device battery light supports LIGHTS_RGB_BATTERY_LED then HAL + // support is not necessary for brightness control. In this case, + // brightness support will be provided by lineage-sdk through the scaling of + // RGB color values. + LIGHTS_ADJUSTABLE_BATTERY_LED_BRIGHTNESS = 128 + For example, a device with notification and battery lights that supports pulsating and RGB control would set this config to 75. --> <integer name="config_deviceLightCapabilities">8</integer> diff --git a/sdk/src/java/org/lineageos/internal/notification/LightsCapabilities.java b/sdk/src/java/org/lineageos/internal/notification/LightsCapabilities.java index a1ee26a6..81815ae1 100644 --- a/sdk/src/java/org/lineageos/internal/notification/LightsCapabilities.java +++ b/sdk/src/java/org/lineageos/internal/notification/LightsCapabilities.java @@ -36,12 +36,25 @@ public final class LightsCapabilities { // segments to show (in order to represent battery level). public static final int LIGHTS_SEGMENTED_BATTERY_LED = 16; - // The notification light supports adjustable brightness. + // The notification light supports HAL adjustable brightness + // via the alpha channel. + // Note: if a device notification light supports LIGHTS_RGB_NOTIFICATION_LED + // then HAL support is not necessary for brightness control. In this case, + // brightness support will be provided by lineage-sdk through the scaling of + // RGB color values. public static final int LIGHTS_ADJUSTABLE_NOTIFICATION_LED_BRIGHTNESS = 32; // Device has a battery light. public static final int LIGHTS_BATTERY_LED = 64; + // The battery light supports HAL adjustable brightness via + // the alpha channel. + // Note: if a device battery light supports LIGHTS_RGB_BATTERY_LED then HAL + // support is not necessary for brightness control. In this case, + // brightness support will be provided by lineage-sdk through the scaling of + // RGB color values. + public static final int LIGHTS_ADJUSTABLE_BATTERY_LED_BRIGHTNESS = 128; + public static boolean supports(Context context, final int capability) { final int capabilities = context.getResources().getInteger( org.lineageos.platform.internal.R.integer.config_deviceLightCapabilities); diff --git a/sdk/src/java/org/lineageos/internal/notification/LineageBatteryLights.java b/sdk/src/java/org/lineageos/internal/notification/LineageBatteryLights.java index a318ce12..121ac8e3 100644 --- a/sdk/src/java/org/lineageos/internal/notification/LineageBatteryLights.java +++ b/sdk/src/java/org/lineageos/internal/notification/LineageBatteryLights.java @@ -81,7 +81,7 @@ public final class LineageBatteryLights { mContext, LightsCapabilities.LIGHTS_RGB_BATTERY_LED); mHALAdjustableBrightness = LightsCapabilities.supports( - mContext, LightsCapabilities.LIGHTS_ADJUSTABLE_NOTIFICATION_LED_BRIGHTNESS); + mContext, LightsCapabilities.LIGHTS_ADJUSTABLE_BATTERY_LED_BRIGHTNESS); // We support brightness adjustment if either the HAL supports it // or the light is RGB adjustable. |