Loading core/java/android/app/Notification.java +7 −0 Original line number Diff line number Diff line Loading @@ -560,6 +560,13 @@ public class Notification implements Parcelable */ public static final String EXTRA_AS_HEADS_UP = "headsup"; /** * Used by light picker in Settings to force * notification lights on when screen is on * @hide */ public static final String EXTRA_FORCE_SHOW_LIGHTS = "android.forceShowLights"; /** * Value for {@link #EXTRA_AS_HEADS_UP}. * @hide Loading services/java/com/android/server/NotificationManagerService.java +28 −3 Original line number Diff line number Diff line Loading @@ -1249,8 +1249,10 @@ public class NotificationManagerService extends INotificationManager.Stub } else if (action.equals(Intent.ACTION_USER_PRESENT)) { // turn off LED when user passes through lock screen if (!mDreaming) { if (mLedNotification == null || !isLedNotificationForcedOn(mLedNotification)) { mNotificationLight.turnOff(); } } } else if (action.equals(Intent.ACTION_USER_SWITCHED)) { // reload per-user settings mSettingsObserver.update(null); Loading Loading @@ -2368,6 +2370,16 @@ public class NotificationManagerService extends INotificationManager.Stub } } private boolean isLedNotificationForcedOn(NotificationRecord r) { if (r != null) { final Notification n = r.sbn.getNotification(); if (n.extras != null) { return n.extras.getBoolean(Notification.EXTRA_FORCE_SHOW_LIGHTS, false); } } return false; } // lock on mNotificationList private void updateLightsLocked() { // handle notification lights Loading @@ -2384,8 +2396,21 @@ public class NotificationManagerService extends INotificationManager.Stub // Don't flash while we are in a call, screen is on or we are // in quiet hours with light dimmed if (mLedNotification == null || mInCall || (mScreenOn && !mDreaming) || (QuietHoursUtils.inQuietHours(mContext, Settings.System.QUIET_HOURS_DIM))) { // (unless Notification has EXTRA_FORCE_SHOW_LGHTS) final boolean enableLed; if (mLedNotification == null) { enableLed = false; } else if (isLedNotificationForcedOn(mLedNotification)) { enableLed = true; } else if (mInCall || (mScreenOn && !mDreaming)) { enableLed = false; } else if (QuietHoursUtils.inQuietHours(mContext, Settings.System.QUIET_HOURS_DIM)) { enableLed = false; } else { enableLed = true; } if (!enableLed) { mNotificationLight.turnOff(); } else if (mNotificationPulseEnabled) { final Notification ledno = mLedNotification.sbn.getNotification(); Loading Loading
core/java/android/app/Notification.java +7 −0 Original line number Diff line number Diff line Loading @@ -560,6 +560,13 @@ public class Notification implements Parcelable */ public static final String EXTRA_AS_HEADS_UP = "headsup"; /** * Used by light picker in Settings to force * notification lights on when screen is on * @hide */ public static final String EXTRA_FORCE_SHOW_LIGHTS = "android.forceShowLights"; /** * Value for {@link #EXTRA_AS_HEADS_UP}. * @hide Loading
services/java/com/android/server/NotificationManagerService.java +28 −3 Original line number Diff line number Diff line Loading @@ -1249,8 +1249,10 @@ public class NotificationManagerService extends INotificationManager.Stub } else if (action.equals(Intent.ACTION_USER_PRESENT)) { // turn off LED when user passes through lock screen if (!mDreaming) { if (mLedNotification == null || !isLedNotificationForcedOn(mLedNotification)) { mNotificationLight.turnOff(); } } } else if (action.equals(Intent.ACTION_USER_SWITCHED)) { // reload per-user settings mSettingsObserver.update(null); Loading Loading @@ -2368,6 +2370,16 @@ public class NotificationManagerService extends INotificationManager.Stub } } private boolean isLedNotificationForcedOn(NotificationRecord r) { if (r != null) { final Notification n = r.sbn.getNotification(); if (n.extras != null) { return n.extras.getBoolean(Notification.EXTRA_FORCE_SHOW_LIGHTS, false); } } return false; } // lock on mNotificationList private void updateLightsLocked() { // handle notification lights Loading @@ -2384,8 +2396,21 @@ public class NotificationManagerService extends INotificationManager.Stub // Don't flash while we are in a call, screen is on or we are // in quiet hours with light dimmed if (mLedNotification == null || mInCall || (mScreenOn && !mDreaming) || (QuietHoursUtils.inQuietHours(mContext, Settings.System.QUIET_HOURS_DIM))) { // (unless Notification has EXTRA_FORCE_SHOW_LGHTS) final boolean enableLed; if (mLedNotification == null) { enableLed = false; } else if (isLedNotificationForcedOn(mLedNotification)) { enableLed = true; } else if (mInCall || (mScreenOn && !mDreaming)) { enableLed = false; } else if (QuietHoursUtils.inQuietHours(mContext, Settings.System.QUIET_HOURS_DIM)) { enableLed = false; } else { enableLed = true; } if (!enableLed) { mNotificationLight.turnOff(); } else if (mNotificationPulseEnabled) { final Notification ledno = mLedNotification.sbn.getNotification(); Loading