Don't always set the clock to View.GONE
Only do that when it's the right thing to do.
Right times:
- SUW
- Lock task mode
- Keyguard (makes the little-used keyguard swipe-up better)
Wrong times:
- I'm pretty sure all other times are wrong
Test: expand QS, icons don't snap to the left
Change-Id: I0178367833bc9412fa8c4b34f023a6053b7d3eb1
Fixes: 79494239
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
index ee83250..f7b7eeb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
@@ -165,7 +165,9 @@
showNotificationIconArea(animate);
}
}
- if ((diff1 & DISABLE_CLOCK) != 0) {
+ // The clock may have already been hidden, but we might want to shift its
+ // visibility to GONE from INVISIBLE or vice versa
+ if ((diff1 & DISABLE_CLOCK) != 0 || mClockView.getVisibility() != clockHiddenMode()) {
if ((state1 & DISABLE_CLOCK) != 0) {
hideClock(animate);
} else {
@@ -212,13 +214,24 @@
}
public void hideClock(boolean animate) {
- animateHiddenState(mClockView, View.GONE, animate);
+ animateHiddenState(mClockView, clockHiddenMode(), animate);
}
public void showClock(boolean animate) {
animateShow(mClockView, animate);
}
+ /**
+ * If panel is expanded/expanding it usually means QS shade is opening, so
+ * don't set the clock GONE otherwise it'll mess up the animation.
+ */
+ private int clockHiddenMode() {
+ if (!mStatusBar.isClosed() && !mKeyguardMonitor.isShowing()) {
+ return View.INVISIBLE;
+ }
+ return View.GONE;
+ }
+
public void hideNotificationIconArea(boolean animate) {
animateHide(mNotificationIconAreaInner, animate);
}