Merge commit 'f72fb68bf32014b075fe577c8495c2c8a86476a9' into eclair-mr2-plus-aosp * commit 'f72fb68bf32014b075fe577c8495c2c8a86476a9': Implement new notification LED blinking logic:
This commit is contained in:
@@ -99,7 +99,11 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
private NotificationRecord mVibrateNotification;
|
private NotificationRecord mVibrateNotification;
|
||||||
private Vibrator mVibrator = new Vibrator();
|
private Vibrator mVibrator = new Vibrator();
|
||||||
|
|
||||||
// adb
|
// for enabling and disabling notification pulse behavior
|
||||||
|
private boolean mScreenOn = true;
|
||||||
|
private boolean mNotificationPulseEnabled;
|
||||||
|
|
||||||
|
// for adb connected notifications
|
||||||
private boolean mUsbConnected;
|
private boolean mUsbConnected;
|
||||||
private boolean mAdbEnabled = false;
|
private boolean mAdbEnabled = false;
|
||||||
private boolean mAdbNotificationShown = false;
|
private boolean mAdbNotificationShown = false;
|
||||||
@@ -336,6 +340,12 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cancelAllNotificationsInt(pkgName, 0, 0);
|
cancelAllNotificationsInt(pkgName, 0, 0);
|
||||||
|
} else if (action.equals(Intent.ACTION_SCREEN_ON)) {
|
||||||
|
mScreenOn = true;
|
||||||
|
updateNotificationPulse();
|
||||||
|
} else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
|
||||||
|
mScreenOn = false;
|
||||||
|
updateNotificationPulse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -349,6 +359,8 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
ContentResolver resolver = mContext.getContentResolver();
|
ContentResolver resolver = mContext.getContentResolver();
|
||||||
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
||||||
Settings.Secure.ADB_ENABLED), false, this);
|
Settings.Secure.ADB_ENABLED), false, this);
|
||||||
|
resolver.registerContentObserver(Settings.System.getUriFor(
|
||||||
|
Settings.System.NOTIFICATION_LIGHT_PULSE), false, this);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,13 +370,21 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
ContentResolver resolver = mContext.getContentResolver();
|
ContentResolver resolver = mContext.getContentResolver();
|
||||||
mAdbEnabled = Settings.Secure.getInt(resolver,
|
boolean adbEnabled = Settings.Secure.getInt(resolver,
|
||||||
Settings.Secure.ADB_ENABLED, 0) != 0;
|
Settings.Secure.ADB_ENABLED, 0) != 0;
|
||||||
updateAdbNotification();
|
if (mAdbEnabled != adbEnabled) {
|
||||||
|
mAdbEnabled = adbEnabled;
|
||||||
|
updateAdbNotification();
|
||||||
|
}
|
||||||
|
boolean pulseEnabled = Settings.System.getInt(resolver,
|
||||||
|
Settings.System.NOTIFICATION_LIGHT_PULSE, 0) != 0;
|
||||||
|
if (mNotificationPulseEnabled != pulseEnabled) {
|
||||||
|
mNotificationPulseEnabled = pulseEnabled;
|
||||||
|
updateNotificationPulse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private final SettingsObserver mSettingsObserver;
|
|
||||||
|
|
||||||
NotificationManagerService(Context context, StatusBarService statusBar,
|
NotificationManagerService(Context context, StatusBarService statusBar,
|
||||||
LightsService lights)
|
LightsService lights)
|
||||||
{
|
{
|
||||||
@@ -399,10 +419,12 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
filter.addAction(Intent.ACTION_UMS_DISCONNECTED);
|
filter.addAction(Intent.ACTION_UMS_DISCONNECTED);
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
|
filter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
|
||||||
|
filter.addAction(Intent.ACTION_SCREEN_ON);
|
||||||
|
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
mContext.registerReceiver(mIntentReceiver, filter);
|
mContext.registerReceiver(mIntentReceiver, filter);
|
||||||
|
|
||||||
mSettingsObserver = new SettingsObserver(mHandler);
|
SettingsObserver observer = new SettingsObserver(mHandler);
|
||||||
mSettingsObserver.observe();
|
observer.observe();
|
||||||
}
|
}
|
||||||
|
|
||||||
void systemReady() {
|
void systemReady() {
|
||||||
@@ -1005,7 +1027,9 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
mLedNotification = mLights.get(n-1);
|
mLedNotification = mLights.get(n-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mLedNotification == null) {
|
|
||||||
|
// we only flash if screen is off and persistent pulsing is enabled
|
||||||
|
if (mLedNotification == null || mScreenOn || !mNotificationPulseEnabled) {
|
||||||
mNotificationLight.turnOff();
|
mNotificationLight.turnOff();
|
||||||
} else {
|
} else {
|
||||||
mNotificationLight.setFlashing(
|
mNotificationLight.setFlashing(
|
||||||
@@ -1097,7 +1121,13 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateNotificationPulse() {
|
||||||
|
synchronized (mNotificationList) {
|
||||||
|
updateLightsLocked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
@Override
|
@Override
|
||||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user