am 85be8992: am b0a8d2c4: Merge "Fixed a potential bug where the keyguard could become empty" into mnc-dev

* commit '85be8992a989b5bd1a4aa953c42a6b8acaae9675':
  Fixed a potential bug where the keyguard could become empty
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 69198ed..cd90d27 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -3460,6 +3460,7 @@
             mKeyguardIndicationController.setVisible(true);
             mNotificationPanel.resetViews();
             mKeyguardUserSwitcher.setKeyguard(true, fromShadeLocked);
+            mStatusBarView.removePendingHideExpandedRunnables();
         } else {
             mKeyguardIndicationController.setVisible(false);
             mKeyguardUserSwitcher.setKeyguard(false,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index dfd280a..6a46924 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -42,6 +42,12 @@
     private ScrimController mScrimController;
     private float mMinFraction;
     private float mPanelFraction;
+    private Runnable mHideExpandedRunnable = new Runnable() {
+        @Override
+        public void run() {
+            mBar.makeExpandedInvisible();
+        }
+    };
 
     public PhoneStatusBarView(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -118,15 +124,14 @@
                     + Log.getStackTraceString(new Throwable()));
         }
         // Close the status bar in the next frame so we can show the end of the animation.
-        postOnAnimation(new Runnable() {
-            @Override
-            public void run() {
-                mBar.makeExpandedInvisible();
-            }
-        });
+        postOnAnimation(mHideExpandedRunnable);
         mLastFullyOpenedPanel = null;
     }
 
+    public void removePendingHideExpandedRunnables() {
+        removeCallbacks(mHideExpandedRunnable);
+    }
+
     @Override
     public void onPanelFullyOpened(PanelView openPanel) {
         super.onPanelFullyOpened(openPanel);