From 5116a821b9507b16bdfa8549a65556493813e111 Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Wed, 4 Jun 2014 15:59:50 -0400 Subject: [PATCH] Disable the attention light on devices that do not have it. If the attention and notificaiton light are mapped to the same physical LED, then pulsing the attention light can turn off the notification light. See bug for detailed discussion. Bug: 12900389 Change-Id: I2703af23f50ecc3e92140b9843aaf340d520bce5 --- core/res/res/values/config.xml | 3 +++ core/res/res/values/symbols.xml | 1 + .../server/notification/NotificationManagerService.java | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 8af45db43124f..865d92a8f37e8 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -364,6 +364,9 @@ false + + false + true diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 6a032e2a12b6a..61b6a0d92c762 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1456,6 +1456,7 @@ + diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 027b669857fcd..386402b83ed98 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -163,6 +163,7 @@ public class NotificationManagerService extends SystemService { private long[] mDefaultVibrationPattern; private long[] mFallbackVibrationPattern; + private boolean mUseAttentionLight; boolean mSystemReady; private boolean mDisableNotificationAlerts; @@ -797,6 +798,8 @@ public class NotificationManagerService extends SystemService { VIBRATE_PATTERN_MAXLEN, DEFAULT_VIBRATE_PATTERN); + mUseAttentionLight = resources.getBoolean(R.bool.config_useAttentionLight); + // Don't start allowing notifications until the setup wizard has run once. // After that, including subsequent boots, init with notifications turned on. // This works on the first boot because the setup wizard will toggle this @@ -1742,7 +1745,9 @@ public class NotificationManagerService extends SystemService { if ((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0 && canInterrupt) { mLights.add(record.getKey()); updateLightsLocked(); - mAttentionLight.pulse(); + if (mUseAttentionLight) { + mAttentionLight.pulse(); + } } else if (wasShowLights) { updateLightsLocked(); }