@@ -101,6 +101,7 @@ public class NotificationManagerService extends INotificationManager.Stub
101101 private Vibrator mVibrator = new Vibrator ();
102102
103103 // for enabling and disabling notification pulse behavior
104+ private boolean mScreenOn = true ;
104105 private boolean mInCall = false ;
105106 private boolean mNotificationPulseEnabled ;
106107
@@ -344,9 +345,19 @@ public void onReceive(Context context, Intent intent) {
344345 cancelAllNotificationsInt (pkgName , 0 , 0 , !queryRestart );
345346 }
346347 }
348+ } else if (action .equals (Intent .ACTION_SCREEN_ON )) {
349+ // Keep track of screen on/off state, but do not turn off the notification light
350+ // until user passes through the lock screen or views the notification.
351+ mScreenOn = true ;
352+ } else if (action .equals (Intent .ACTION_SCREEN_OFF )) {
353+ mScreenOn = false ;
347354 } else if (action .equals (TelephonyManager .ACTION_PHONE_STATE_CHANGED )) {
348- mInCall = (intent .getStringExtra (TelephonyManager .EXTRA_STATE ).equals (TelephonyManager .EXTRA_STATE_OFFHOOK ));
355+ mInCall = (intent .getStringExtra (TelephonyManager .EXTRA_STATE ).equals (
356+ TelephonyManager .EXTRA_STATE_OFFHOOK ));
349357 updateNotificationPulse ();
358+ } else if (action .equals (Intent .ACTION_USER_PRESENT )) {
359+ // turn off LED when user passes through lock screen
360+ mNotificationLight .turnOff ();
350361 }
351362 }
352363 };
@@ -417,6 +428,7 @@ public void update() {
417428 filter .addAction (Intent .ACTION_SCREEN_ON );
418429 filter .addAction (Intent .ACTION_SCREEN_OFF );
419430 filter .addAction (TelephonyManager .ACTION_PHONE_STATE_CHANGED );
431+ filter .addAction (Intent .ACTION_USER_PRESENT );
420432 mContext .registerReceiver (mIntentReceiver , filter );
421433 IntentFilter pkgFilter = new IntentFilter ();
422434 pkgFilter .addAction (Intent .ACTION_PACKAGE_REMOVED );
@@ -1057,8 +1069,8 @@ private void updateLightsLocked()
10571069 }
10581070 }
10591071
1060- // Don't flash while we are in a call
1061- if (mLedNotification == null || mInCall ) {
1072+ // Don't flash while we are in a call or screen is on
1073+ if (mLedNotification == null || mInCall || mScreenOn ) {
10621074 mNotificationLight .turnOff ();
10631075 } else {
10641076 int ledARGB = mLedNotification .notification .ledARGB ;
0 commit comments