Volume: dismiss volume UI to avoid HUNs.

Also include headsUp in the name of the pinned callback
method.

Internal version of AOSP proposal:
  https://android-review.googlesource.com/147502

Change-Id: I8fe14bd7d65b2d3564cb1e2869d7ffbbac89e80d
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 8914fb1..90e038a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -2158,7 +2158,7 @@
     }
 
     @Override
-    public void onPinnedModeChanged(final boolean inPinnedMode) {
+    public void onHeadsUpPinnedModeChanged(final boolean inPinnedMode) {
         if (inPinnedMode) {
             mHeadsUpExistenceChangedRunnable.run();
             updateNotificationTranslucency();
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 bf27e84..9a6a80e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1852,7 +1852,7 @@
     }
 
     @Override
-    public void onPinnedModeChanged(boolean inPinnedMode) {
+    public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) {
         if (inPinnedMode) {
             mStatusBarWindowManager.setHeadsUpShowing(true);
         } else {
@@ -1874,6 +1874,7 @@
 
     @Override
     public void onHeadsUpPinned(ExpandableNotificationRow headsUp) {
+        dismissVolumeDialog();
     }
 
     @Override
@@ -2377,13 +2378,17 @@
         }
         // manually dismiss the volume panel when interacting with the nav bar
         if (changing && interacting && barWindow == StatusBarManager.WINDOW_NAVIGATION_BAR) {
-            if (mVolumeComponent != null) {
-                mVolumeComponent.dismissNow();
-            }
+            dismissVolumeDialog();
         }
         checkBarModes();
     }
 
+    private void dismissVolumeDialog() {
+        if (mVolumeComponent != null) {
+            mVolumeComponent.dismissNow();
+        }
+    }
+
     private void resumeSuspendedAutohide() {
         if (mAutohideSuspended) {
             scheduleAutohide();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index ae98e76..e6edbeac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -347,7 +347,7 @@
     }
 
     @Override
-    public void onPinnedModeChanged(boolean inPinnedMode) {
+    public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) {
     }
 
     @Override