Merge "Extinguish notification LED when user passes through lock screen"

This commit is contained in:
Mike Lockwood
2011-08-30 08:46:18 -07:00
committed by Android (Google) Code Review

View File

@@ -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;