Merge "No longer disable notification lights when screen turns on"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d0bf536fd6
@@ -101,13 +101,8 @@ public class NotificationManagerService extends INotificationManager.Stub
|
|||||||
private Vibrator mVibrator = new Vibrator();
|
private Vibrator mVibrator = new Vibrator();
|
||||||
|
|
||||||
// for enabling and disabling notification pulse behavior
|
// for enabling and disabling notification pulse behavior
|
||||||
private boolean mScreenOn = true;
|
|
||||||
private boolean mInCall = false;
|
private boolean mInCall = false;
|
||||||
private boolean mNotificationPulseEnabled;
|
private boolean mNotificationPulseEnabled;
|
||||||
// This is true if we have received a new notification while the screen is off
|
|
||||||
// (that is, if mLedNotification was set while the screen was off)
|
|
||||||
// This is reset to false when the screen is turned on.
|
|
||||||
private boolean mPendingPulseNotification;
|
|
||||||
|
|
||||||
private final ArrayList<NotificationRecord> mNotificationList =
|
private final ArrayList<NotificationRecord> mNotificationList =
|
||||||
new ArrayList<NotificationRecord>();
|
new ArrayList<NotificationRecord>();
|
||||||
@@ -349,12 +344,6 @@ public class NotificationManagerService extends INotificationManager.Stub
|
|||||||
cancelAllNotificationsInt(pkgName, 0, 0, !queryRestart);
|
cancelAllNotificationsInt(pkgName, 0, 0, !queryRestart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (action.equals(Intent.ACTION_SCREEN_ON)) {
|
|
||||||
mScreenOn = true;
|
|
||||||
updateNotificationPulse();
|
|
||||||
} else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
|
|
||||||
mScreenOn = false;
|
|
||||||
updateNotificationPulse();
|
|
||||||
} else if (action.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
|
} 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();
|
updateNotificationPulse();
|
||||||
@@ -1059,11 +1048,6 @@ public class NotificationManagerService extends INotificationManager.Stub
|
|||||||
// lock on mNotificationList
|
// lock on mNotificationList
|
||||||
private void updateLightsLocked()
|
private void updateLightsLocked()
|
||||||
{
|
{
|
||||||
// clear pending pulse notification if screen is on
|
|
||||||
if (mScreenOn || mLedNotification == null) {
|
|
||||||
mPendingPulseNotification = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle notification lights
|
// handle notification lights
|
||||||
if (mLedNotification == null) {
|
if (mLedNotification == null) {
|
||||||
// get next notification, if any
|
// get next notification, if any
|
||||||
@@ -1071,14 +1055,10 @@ public class NotificationManagerService extends INotificationManager.Stub
|
|||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
mLedNotification = mLights.get(n-1);
|
mLedNotification = mLights.get(n-1);
|
||||||
}
|
}
|
||||||
if (mLedNotification != null && !mScreenOn) {
|
|
||||||
mPendingPulseNotification = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we only flash if screen is off and persistent pulsing is enabled
|
// Don't flash while we are in a call
|
||||||
// and we are not currently in a call
|
if (mLedNotification == null || mInCall) {
|
||||||
if (!mPendingPulseNotification || mScreenOn || mInCall) {
|
|
||||||
mNotificationLight.turnOff();
|
mNotificationLight.turnOff();
|
||||||
} else {
|
} else {
|
||||||
int ledARGB = mLedNotification.notification.ledARGB;
|
int ledARGB = mLedNotification.notification.ledARGB;
|
||||||
|
|||||||
Reference in New Issue
Block a user