Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2182b090 authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Keep on notification LED while dreaming." into cm-10.1

parents d0297fec f370e629
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -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,9 +607,11 @@ 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) {
                    mNotificationLight.turnOff();
                }
            }
        }
    };

    class LEDSettingsObserver extends ContentObserver {
@@ -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;