Volume: Improve inline volume controls used in settings.

 - Make the system internal ringer mode change signal available to
   other system components via a standard intent, instead of a
   volume-controller-only binder call.
 - Update sysui to use new intent for icon policy.
 - Add proper muting state to the volumizer, to look more like
   the associated volume panel slider.
 - Add basic ringer mode state tracking for the notification-ring
   slider setting.

Bug: 17899613
Change-Id: Ie2df52edb070055ef59c74039162a0e785d2fdbb
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
index 1fe4698..e79258e 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
@@ -546,6 +546,7 @@
     private void registerReceiver() {
         final IntentFilter filter = new IntentFilter();
         filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
+        filter.addAction(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION);
         filter.addAction(Intent.ACTION_SCREEN_OFF);
         mContext.registerReceiver(new BroadcastReceiver() {
             @Override
@@ -554,7 +555,12 @@
 
                 if (AudioManager.RINGER_MODE_CHANGED_ACTION.equals(action)) {
                     removeMessages(MSG_RINGER_MODE_CHANGED);
-                    sendMessage(obtainMessage(MSG_RINGER_MODE_CHANGED));
+                    sendEmptyMessage(MSG_RINGER_MODE_CHANGED);
+                }
+
+                if (AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION.equals(action)) {
+                    removeMessages(MSG_INTERNAL_RINGER_MODE_CHANGED);
+                    sendEmptyMessage(MSG_INTERNAL_RINGER_MODE_CHANGED);
                 }
 
                 if (Intent.ACTION_SCREEN_OFF.equals(action)) {
@@ -991,11 +997,6 @@
         obtainMessage(MSG_LAYOUT_DIRECTION, layoutDirection, 0).sendToTarget();
     }
 
-    public void postInternalRingerModeChanged(int mode) {
-        removeMessages(MSG_INTERNAL_RINGER_MODE_CHANGED);
-        obtainMessage(MSG_INTERNAL_RINGER_MODE_CHANGED, mode, 0).sendToTarget();
-    }
-
     private static String flagsToString(int flags) {
         return flags == 0 ? "0" : (flags + "=" + AudioManager.flagsToString(flags));
     }