diff options
author | Mike Lockwood <lockwood@android.com> | 2009-12-02 16:30:30 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-12-02 16:30:30 -0800 |
commit | fbe460e88841a45c005a2dd359e5f3ba2700f6eb (patch) | |
tree | 8d975aaf077db3a4d6fc3756827db3a0c087b93e /services/java | |
parent | 190a80ceb5e3102e578b0f0ea292f0c0e23ec594 (diff) | |
parent | 9b7dba936c24fa7959561ddf1a0c8ba4d2165782 (diff) | |
download | frameworks_base-fbe460e88841a45c005a2dd359e5f3ba2700f6eb.zip frameworks_base-fbe460e88841a45c005a2dd359e5f3ba2700f6eb.tar.gz frameworks_base-fbe460e88841a45c005a2dd359e5f3ba2700f6eb.tar.bz2 |
am 9b7dba93: Merge change Icc49422a into eclair
Merge commit '9b7dba936c24fa7959561ddf1a0c8ba4d2165782' into eclair-plus-aosp
* commit '9b7dba936c24fa7959561ddf1a0c8ba4d2165782':
Implement new notification LED blinking logic:
Diffstat (limited to 'services/java')
-rwxr-xr-x | services/java/com/android/server/NotificationManagerService.java | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 94aa458..d7e1d25 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -96,7 +96,11 @@ class NotificationManagerService extends INotificationManager.Stub private NotificationRecord mVibrateNotification; 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 mAdbEnabled = false; private boolean mAdbNotificationShown = false; @@ -333,6 +337,12 @@ class NotificationManagerService extends INotificationManager.Stub return; } 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(); } } }; @@ -346,6 +356,8 @@ class NotificationManagerService extends INotificationManager.Stub ContentResolver resolver = mContext.getContentResolver(); resolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.ADB_ENABLED), false, this); + resolver.registerContentObserver(Settings.System.getUriFor( + Settings.System.NOTIFICATION_LIGHT_PULSE), false, this); update(); } @@ -355,13 +367,21 @@ class NotificationManagerService extends INotificationManager.Stub public void update() { ContentResolver resolver = mContext.getContentResolver(); - mAdbEnabled = Settings.Secure.getInt(resolver, + boolean adbEnabled = Settings.Secure.getInt(resolver, 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, HardwareService hardware) { @@ -392,10 +412,12 @@ class NotificationManagerService extends INotificationManager.Stub filter.addAction(Intent.ACTION_UMS_DISCONNECTED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); filter.addAction(Intent.ACTION_PACKAGE_RESTARTED); + filter.addAction(Intent.ACTION_SCREEN_ON); + filter.addAction(Intent.ACTION_SCREEN_OFF); mContext.registerReceiver(mIntentReceiver, filter); - mSettingsObserver = new SettingsObserver(mHandler); - mSettingsObserver.observe(); + SettingsObserver observer = new SettingsObserver(mHandler); + observer.observe(); } void systemReady() { @@ -1002,7 +1024,9 @@ class NotificationManagerService extends INotificationManager.Stub 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) { mHardware.setLightOff_UNCHECKED(HardwareService.LIGHT_ID_NOTIFICATIONS); } else { mHardware.setLightFlashing_UNCHECKED( @@ -1095,7 +1119,13 @@ class NotificationManagerService extends INotificationManager.Stub } } } - + + private void updateNotificationPulse() { + synchronized (mNotificationList) { + updateLightsLocked(); + } + } + // ====================================================================== @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { |