Merge "Don't collapse the panel post launch if we went back to sleep." into tm-dev
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
index 4235c1f..cc16ce2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
@@ -1870,7 +1870,13 @@
         if (!mPresenter.isCollapsing()) {
             onClosingFinished();
         }
-        if (launchIsFullScreen) {
+
+        // Collapse the panel if we're launching in fullscreen, over the lockscreen. Do not do this
+        // if the device has gone back to sleep - through a horrific chain of 15 or so function
+        // calls, instantCollapseNotificationPanel will eventually call through to
+        // StatusBar#wakeUpIfDozing, which will wake the device up even if it was put to sleep
+        // during the launch animation.
+        if (launchIsFullScreen && mPowerManager.isInteractive()) {
             instantCollapseNotificationPanel();
         }
     }