diff --git a/packages/SystemUI/res/drawable/stat_sys_alarm_dim.xml b/packages/SystemUI/res/drawable/stat_sys_alarm_dim.xml new file mode 100644 index 0000000000000..c8e2ac19a4e2e --- /dev/null +++ b/packages/SystemUI/res/drawable/stat_sys_alarm_dim.xml @@ -0,0 +1,32 @@ + + + + + + + + + + \ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index 5942b4633c9b0..7c10c6691a8ad 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -67,6 +67,7 @@ public class PhoneStatusBarPolicy { private final Handler mHandler = new Handler(); private final CastController mCast; private final HotspotController mHotspot; + private final AlarmManager mAlarmManager; // Assume it's all good unless we hear otherwise. We don't always seem // to get broadcasts that it *is* there. @@ -112,7 +113,8 @@ public class PhoneStatusBarPolicy { mContext = context; mCast = cast; mHotspot = hotspot; - mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE); + mService = (StatusBarManager) context.getSystemService(Context.STATUS_BAR_SERVICE); + mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); // listen for broadcasts IntentFilter filter = new IntentFilter(); @@ -173,9 +175,11 @@ public class PhoneStatusBarPolicy { } private void updateAlarm() { - AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); - boolean alarmSet = alarmManager.getNextAlarmClock(UserHandle.USER_CURRENT) != null; - mService.setIconVisibility(SLOT_ALARM_CLOCK, alarmSet); + final boolean hasAlarm = mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT) != null; + final boolean zenNone = mZen == Global.ZEN_MODE_NO_INTERRUPTIONS; + mService.setIconVisibility(SLOT_ALARM_CLOCK, hasAlarm); + mService.setIcon(SLOT_ALARM_CLOCK, zenNone ? R.drawable.stat_sys_alarm_dim + : R.drawable.stat_sys_alarm, 0, null); } private final void updateSimState(Intent intent) { @@ -259,6 +263,7 @@ public class PhoneStatusBarPolicy { mService.setIconVisibility(SLOT_VOLUME, volumeVisible); mVolumeVisible = volumeVisible; } + updateAlarm(); } private final void updateBluetooth() {