Fixed a bug where the empty shade and dismiss views would animate

This lead to an ugly flash when turning the screen off and on again.
Bug: 18657280

Change-Id: I5ca572239639bf3c95c106ba193a268e0256df38
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index 2a393bf..6dcbed6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -2280,8 +2280,7 @@
                 updateContentHeight();
                 notifyHeightChangeListener(mDismissView);
             } else {
-                mEmptyShadeView.setWillBeGone(true);
-                mEmptyShadeView.performVisibilityAnimation(false, new Runnable() {
+                Runnable onFinishedRunnable = new Runnable() {
                     @Override
                     public void run() {
                         mEmptyShadeView.setVisibility(GONE);
@@ -2289,7 +2288,14 @@
                         updateContentHeight();
                         notifyHeightChangeListener(mDismissView);
                     }
-                });
+                };
+                if (mAnimationsEnabled) {
+                    mEmptyShadeView.setWillBeGone(true);
+                    mEmptyShadeView.performVisibilityAnimation(false, onFinishedRunnable);
+                } else {
+                    mEmptyShadeView.setInvisible();
+                    onFinishedRunnable.run();
+                }
             }
         }
     }
@@ -2318,7 +2324,7 @@
                         notifyHeightChangeListener(mDismissView);
                     }
                 };
-                if (mDismissView.isButtonVisible() && mIsExpanded) {
+                if (mDismissView.isButtonVisible() && mIsExpanded && mAnimationsEnabled) {
                     mDismissView.setWillBeGone(true);
                     mDismissView.performVisibilityAnimation(false, dimissHideFinishRunnable);
                 } else {