Next alarm clock updates.
- Add explicit user setup signal to status bar icon policy.
- Include per-user next alarm clock info in service dump.
Bug: 21551365
Change-Id: Ib16636522bbe04d205a377567007145f146e9d39
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 1e4aa61..5ff4ddb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -349,6 +349,9 @@
if (!mUserSetup && mStatusBarView != null)
animateCollapseQuickSettings();
}
+ if (mIconPolicy != null) {
+ mIconPolicy.setCurrentUserSetup(mUserSetup);
+ }
}
};
@@ -554,6 +557,7 @@
// Lastly, call to the icon policy to install/update all the icons.
mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController, mHotspotController);
+ mIconPolicy.setCurrentUserSetup(mUserSetup);
mSettingsObserver.onChange(false); // set up
mHeadsUpObserver.onChange(true); // set up
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 7c10c66..0872e06 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -18,6 +18,7 @@
import android.app.ActivityManagerNative;
import android.app.AlarmManager;
+import android.app.AlarmManager.AlarmClockInfo;
import android.app.IUserSwitchObserver;
import android.app.StatusBarManager;
import android.bluetooth.BluetoothAdapter;
@@ -75,6 +76,7 @@
private boolean mZenVisible;
private boolean mVolumeVisible;
+ private boolean mCurrentUserSetup;
private int mZen;
@@ -175,11 +177,12 @@
}
private void updateAlarm() {
- final boolean hasAlarm = mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT) != null;
+ final AlarmClockInfo alarm = mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT);
+ final boolean hasAlarm = alarm != null && alarm.getTriggerTime() > 0;
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);
+ mService.setIconVisibility(SLOT_ALARM_CLOCK, mCurrentUserSetup && hasAlarm);
}
private final void updateSimState(Intent intent) {
@@ -391,4 +394,10 @@
mKeyguardVisible = visible;
updateManagedProfile();
}
+
+ public void setCurrentUserSetup(boolean userSetup) {
+ if (mCurrentUserSetup == userSetup) return;
+ mCurrentUserSetup = userSetup;
+ updateAlarm();
+ }
}