Added the heads up scrim back

Also fixed a bug where the notification panel would
keep a hardware layer.
Also improved the interal structure of the HeadsUpManager

Change-Id: I635e4a89b0a32573c26515cc3e65e142d77593ec
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index ade1a33..e101197 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -1176,8 +1176,8 @@
         updateEmptyShadeView();
         mQsNavbarScrim.setVisibility(mStatusBarState == StatusBarState.SHADE && mQsExpanded
                 && !mStackScrollerOverscrolling && mQsScrimEnabled
-                        ? View.VISIBLE
-                        : View.INVISIBLE);
+                ? View.VISIBLE
+                : View.INVISIBLE);
         if (mKeyguardUserSwitcher != null && mQsExpanded && !mStackScrollerOverscrolling) {
             mKeyguardUserSwitcher.hideIfNotSimple(true /* animate */);
         }
@@ -1520,6 +1520,9 @@
         float alpha;
         if (mExpandingFromHeadsUp || mHeadsUpManager.hasPinnedHeadsUp()) {
             alpha = 1f;
+            if (mNotificationStackScroller.getLayerType() == LAYER_TYPE_HARDWARE) {
+                mNotificationStackScroller.setLayerType(LAYER_TYPE_NONE, null);
+            }
         } else {
             alpha = (getNotificationsTopY() + mNotificationStackScroller.getItemHeight())
                     / (mQsMinExpansionHeight + mNotificationStackScroller.getBottomStackPeekSize()
@@ -2155,8 +2158,10 @@
     }
 
     @Override
-    public void OnHeadsUpPinned(ExpandableNotificationRow headsUp) {
-        mNotificationStackScroller.generateHeadsUpAnimation(headsUp, true);
+    public void OnHeadsUpPinnedChanged(ExpandableNotificationRow headsUp, boolean isHeadsUp) {
+        if (isHeadsUp) {
+            mNotificationStackScroller.generateHeadsUpAnimation(headsUp, true);
+        }
     }
 
     @Override