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

Commit 63b5ad9e authored by Mike Lockwood's avatar Mike Lockwood
Browse files

Extinguish notification LED when user passes through lock screen



Also do not blink for notifications received when the screen is on.

Bug: 5233071

Change-Id: I15675ca317007d4b900ef74e60d11a5bca3d7333
Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
parent 90200ee4
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -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;