diff options
Diffstat (limited to 'services/java/com/android/server/NotificationManagerService.java')
| -rwxr-xr-x | services/java/com/android/server/NotificationManagerService.java | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index d7e1d25..147580b 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -86,7 +86,10 @@ class NotificationManagerService extends INotificationManager.Stub private WorkerHandler mHandler; private StatusBarService mStatusBarService; - private HardwareService mHardware; + private LightsService mLightsService; + private LightsService.Light mBatteryLight; + private LightsService.Light mNotificationLight; + private LightsService.Light mAttentionLight; private NotificationRecord mSoundNotification; private AsyncPlayer mSound; @@ -383,11 +386,11 @@ class NotificationManagerService extends INotificationManager.Stub } NotificationManagerService(Context context, StatusBarService statusBar, - HardwareService hardware) + LightsService lights) { super(); mContext = context; - mHardware = hardware; + mLightsService = lights; mAm = ActivityManagerNative.getDefault(); mSound = new AsyncPlayer(TAG); mSound.setUsesWakeLock(context); @@ -396,6 +399,10 @@ class NotificationManagerService extends INotificationManager.Stub mStatusBarService = statusBar; statusBar.setNotificationCallbacks(mNotificationCallbacks); + mBatteryLight = lights.getLight(LightsService.LIGHT_ID_BATTERY); + mNotificationLight = lights.getLight(LightsService.LIGHT_ID_NOTIFICATIONS); + mAttentionLight = lights.getLight(LightsService.LIGHT_ID_ATTENTION); + // Don't start allowing notifications until the setup wizard has run once. // After that, including subsequent boots, init with notifications turned on. // This works on the first boot because the setup wizard will toggle this @@ -700,7 +707,7 @@ class NotificationManagerService extends INotificationManager.Stub long identity = Binder.clearCallingIdentity(); try { r.statusBarKey = mStatusBarService.addIcon(icon, n); - mHardware.pulseBreathingLight(); + mAttentionLight.pulse(); } finally { Binder.restoreCallingIdentity(identity); @@ -996,24 +1003,20 @@ class NotificationManagerService extends INotificationManager.Stub // Battery low always shows, other states only show if charging. if (mBatteryLow) { if (mBatteryCharging) { - mHardware.setLightColor_UNCHECKED(HardwareService.LIGHT_ID_BATTERY, - BATTERY_LOW_ARGB); + mBatteryLight.setColor(BATTERY_LOW_ARGB); } else { // Flash when battery is low and not charging - mHardware.setLightFlashing_UNCHECKED(HardwareService.LIGHT_ID_BATTERY, - BATTERY_LOW_ARGB, HardwareService.LIGHT_FLASH_TIMED, - BATTERY_BLINK_ON, BATTERY_BLINK_OFF); + mBatteryLight.setFlashing(BATTERY_LOW_ARGB, LightsService.LIGHT_FLASH_TIMED, + BATTERY_BLINK_ON, BATTERY_BLINK_OFF); } } else if (mBatteryCharging) { if (mBatteryFull) { - mHardware.setLightColor_UNCHECKED(HardwareService.LIGHT_ID_BATTERY, - BATTERY_FULL_ARGB); + mBatteryLight.setColor(BATTERY_FULL_ARGB); } else { - mHardware.setLightColor_UNCHECKED(HardwareService.LIGHT_ID_BATTERY, - BATTERY_MEDIUM_ARGB); + mBatteryLight.setColor(BATTERY_MEDIUM_ARGB); } } else { - mHardware.setLightOff_UNCHECKED(HardwareService.LIGHT_ID_BATTERY); + mBatteryLight.turnOff(); } // handle notification lights @@ -1027,12 +1030,11 @@ class NotificationManagerService extends INotificationManager.Stub // we only flash if screen is off and persistent pulsing is enabled if (mLedNotification == null || mScreenOn || !mNotificationPulseEnabled) { - mHardware.setLightOff_UNCHECKED(HardwareService.LIGHT_ID_NOTIFICATIONS); + mNotificationLight.turnOff(); } else { - mHardware.setLightFlashing_UNCHECKED( - HardwareService.LIGHT_ID_NOTIFICATIONS, + mNotificationLight.setFlashing( mLedNotification.notification.ledARGB, - HardwareService.LIGHT_FLASH_TIMED, + LightsService.LIGHT_FLASH_TIMED, mLedNotification.notification.ledOnMS, mLedNotification.notification.ledOffMS); } |
