diff options
| -rwxr-xr-x | services/java/com/android/server/NotificationManagerService.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 7a3a344c0a76..6ee20bbb32bd 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -101,6 +101,7 @@ public class NotificationManagerService extends INotificationManager.Stub private Vibrator mVibrator = new Vibrator(); // for enabling and disabling notification pulse behavior + private boolean mScreenOn = true; private boolean mInCall = false; private boolean mNotificationPulseEnabled; @@ -344,9 +345,19 @@ public class NotificationManagerService extends INotificationManager.Stub cancelAllNotificationsInt(pkgName, 0, 0, !queryRestart); } } + } else if (action.equals(Intent.ACTION_SCREEN_ON)) { + // Keep track of screen on/off state, but do not turn off the notification light + // until user passes through the lock screen or views the notification. + mScreenOn = true; + } else if (action.equals(Intent.ACTION_SCREEN_OFF)) { + mScreenOn = false; } else if (action.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) { - mInCall = (intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals(TelephonyManager.EXTRA_STATE_OFFHOOK)); + mInCall = (intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals( + TelephonyManager.EXTRA_STATE_OFFHOOK)); updateNotificationPulse(); + } else if (action.equals(Intent.ACTION_USER_PRESENT)) { + // turn off LED when user passes through lock screen + mNotificationLight.turnOff(); } } }; @@ -417,6 +428,7 @@ public class NotificationManagerService extends INotificationManager.Stub filter.addAction(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); + filter.addAction(Intent.ACTION_USER_PRESENT); mContext.registerReceiver(mIntentReceiver, filter); IntentFilter pkgFilter = new IntentFilter(); pkgFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); @@ -1057,8 +1069,8 @@ public class NotificationManagerService extends INotificationManager.Stub } } - // Don't flash while we are in a call - if (mLedNotification == null || mInCall) { + // Don't flash while we are in a call or screen is on + if (mLedNotification == null || mInCall || mScreenOn) { mNotificationLight.turnOff(); } else { int ledARGB = mLedNotification.notification.ledARGB; |