From 4101c66b95394b38c4957acc0d9ea7de21800290 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Mon, 25 May 2015 03:36:01 +0100 Subject: [PATCH] lights: Reprioritize events attention > notification > battery Change-Id: I0cac6ced4248990b7339223d6860106f94cf3693 --- liblight/lights.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/liblight/lights.c b/liblight/lights.c index 615ddd8..e8fb9d5 100644 --- a/liblight/lights.c +++ b/liblight/lights.c @@ -138,6 +138,16 @@ set_speaker_light_locked(struct light_device_t* dev, return -1; } + if (state == NULL) { + write_int(RED_LED_FILE, 0); + write_int(GREEN_LED_FILE, 0); + write_int(BLUE_LED_FILE, 0); + write_int(RED_BLINK_FILE, 0); + write_int(GREEN_BLINK_FILE, 0); + write_int(BLUE_BLINK_FILE, 0); + return 0; + } + switch (state->flashMode) { case LIGHT_FLASH_TIMED: onMS = state->flashOnMS; @@ -192,10 +202,13 @@ set_speaker_light_locked(struct light_device_t* dev, static void handle_speaker_battery_locked(struct light_device_t* dev) { - if (is_lit(&g_battery)) { - set_speaker_light_locked(dev, &g_battery); - } else { + set_speaker_light_locked(dev, NULL); + if (is_lit(&g_attention)) { + set_speaker_light_locked(dev, &g_attention); + } else if (is_lit(&g_notification)) { set_speaker_light_locked(dev, &g_notification); + } else { + set_speaker_light_locked(dev, &g_battery); } }