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

Commit 3e1264e4 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "NotificationManagerService: Fix notification led bug" into ics

parents d97a590f 5713307e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -305,6 +305,13 @@ public class Notification implements Parcelable
     */
    public static final int FLAG_HIGH_PRIORITY = 0x00000080;

    /**
     * Bit to be bitwise-ored into the {@link #flags} field that should be
     * set if this notification should force the led to pulse even if the
     * screen has been shut off while the notification was active.
     */
    public static final int FLAG_FORCE_LED_SCREEN_OFF = 0x00000100;

    public int flags;

    /**
+21 −1
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public class NotificationManagerService extends INotificationManager.Stub

    // for enabling and disabling notification pulse behavior
    private boolean mScreenOn = true;
    private boolean mWasScreenOn = false;
    private boolean mInCall = false;
    private boolean mNotificationPulseEnabled;

@@ -351,6 +352,8 @@ public class NotificationManagerService extends INotificationManager.Stub
                mScreenOn = true;
            } else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
                mScreenOn = false;
                mWasScreenOn = true;
                updateLightsLocked();
            } else if (action.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
                mInCall = (intent.getStringExtra(TelephonyManager.EXTRA_STATE).equals(
                        TelephonyManager.EXTRA_STATE_OFFHOOK));
@@ -1072,8 +1075,25 @@ public class NotificationManagerService extends INotificationManager.Stub
            }
        }

        boolean wasScreenOn = mWasScreenOn;
        mWasScreenOn = false;

        if (mLedNotification == null) {
            mNotificationLight.turnOff();
            return;
        }

        // We can assume that if the user turned the screen off while there was
        // still an active notification then they wanted to keep the notification
        // for later. In this case we shouldn't flash the notification light.
        // For special notifications that automatically turn the screen on (such
        // as missed calls), we use this flag to force the notification light
        // even if the screen was turned off.
        boolean forceWithScreenOff = (mLedNotification.notification.flags &
                Notification.FLAG_FORCE_LED_SCREEN_OFF) != 0;

        // Don't flash while we are in a call or screen is on
        if (mLedNotification == null || mInCall || mScreenOn) {
        if (mInCall || mScreenOn || (wasScreenOn && !forceWithScreenOff)) {
            mNotificationLight.turnOff();
        } else {
            int ledARGB = mLedNotification.notification.ledARGB;