sdk: Support breath LED mode

Change-Id: I9ec757a784dc3fb3afcb6f909f10e2eee86502ea
This commit is contained in:
LuK1337
2025-01-18 12:19:21 +01:00
parent 4796ff52f4
commit 2b130050dd
2 changed files with 12 additions and 0 deletions

View File

@@ -86,6 +86,9 @@
// RGB color values.
LIGHTS_ADJUSTABLE_BATTERY_LED_BRIGHTNESS = 128
// The notification light has non-adjustable pulsing capability.
LIGHTS_BREATHING_LED = 256
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>

View File

@@ -44,6 +44,15 @@ public final class LightsCapabilities {
// RGB color values.
public static final int LIGHTS_ADJUSTABLE_BATTERY_LED_BRIGHTNESS = 128;
// The notification light has non-adjustable pulsing capability.
public static final int LIGHTS_BREATHING_LED = 256;
public static boolean blinks(Context context) {
final int capabilities = context.getResources().getInteger(
org.lineageos.platform.internal.R.integer.config_deviceLightCapabilities);
return (capabilities & (LIGHTS_PULSATING_LED | LIGHTS_BREATHING_LED)) != 0;
}
public static boolean supports(Context context, final int capability) {
final int capabilities = context.getResources().getInteger(
org.lineageos.platform.internal.R.integer.config_deviceLightCapabilities);