diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/NotificationManagerService.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 06a8615..8a02380 100644 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -149,6 +149,7 @@ public class NotificationManagerService extends INotificationManager.Stub // for enabling and disabling notification pulse behaviour private boolean mScreenOn = true; + private boolean mDreaming = false; private boolean mInCall = false; private boolean mNotificationPulseEnabled; private HashMap<String, NotificationLedValues> mNotificationPulseCustomLedValues; @@ -587,6 +588,14 @@ public class NotificationManagerService extends INotificationManager.Stub } else if (action.equals(Intent.ACTION_SCREEN_OFF)) { mScreenOn = false; updateNotificationPulse(); + } else if (action.equals(Intent.ACTION_DREAMING_STARTED)) { + mDreaming = true; + updateNotificationPulse(); + } else if (action.equals(Intent.ACTION_DREAMING_STOPPED)) { + mDreaming = false; + if (mScreenOn) { + mNotificationLight.turnOff(); + } } else if (action.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) { mInCall = (intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals( TelephonyManager.EXTRA_STATE_OFFHOOK)); @@ -598,7 +607,9 @@ public class NotificationManagerService extends INotificationManager.Stub } } else if (action.equals(Intent.ACTION_USER_PRESENT)) { // turn off LED when user passes through lock screen - mNotificationLight.turnOff(); + if (!mDreaming) { + mNotificationLight.turnOff(); + } } } }; @@ -780,6 +791,8 @@ public class NotificationManagerService extends INotificationManager.Stub filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); filter.addAction(Intent.ACTION_USER_PRESENT); filter.addAction(Intent.ACTION_USER_STOPPED); + filter.addAction(Intent.ACTION_DREAMING_STARTED); + filter.addAction(Intent.ACTION_DREAMING_STOPPED); mContext.registerReceiver(mIntentReceiver, filter); IntentFilter pkgFilter = new IntentFilter(); pkgFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); @@ -1592,7 +1605,8 @@ 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 || (inQuietHours() && mQuietHoursDim)) { + if (mLedNotification == null || mInCall + || (mScreenOn && !mDreaming) || (inQuietHours() && mQuietHoursDim)) { mNotificationLight.turnOff(); } else { int ledARGB; |