OSDN Git Service

Merge "audioservice: Clear calling identity upon calling HdmiControlService" into...
[android-x86/frameworks-base.git] / media / java / android / media / AudioService.java
index a94573b..f0150d4 100644 (file)
@@ -3114,11 +3114,12 @@ public class AudioService extends IAudioService.Stub {
                 break;
             }
             if ((direction == AudioManager.ADJUST_LOWER)) {
-                if (VOLUME_SETS_RINGER_MODE_SILENT
-                        && mPrevVolDirection != AudioManager.ADJUST_LOWER) {
-                    ringerMode = RINGER_MODE_SILENT;
-                } else {
-                    result |= AudioManager.FLAG_SHOW_VIBRATE_HINT;
+                if (mPrevVolDirection != AudioManager.ADJUST_LOWER) {
+                    if (VOLUME_SETS_RINGER_MODE_SILENT) {
+                        ringerMode = RINGER_MODE_SILENT;
+                    } else {
+                        result |= AudioManager.FLAG_SHOW_VIBRATE_HINT;
+                    }
                 }
             } else if (direction == AudioManager.ADJUST_RAISE) {
                 ringerMode = RINGER_MODE_NORMAL;
@@ -4302,6 +4303,13 @@ public class AudioService extends IAudioService.Stub {
                             }
                         }
                     }
+
+                    synchronized (mAudioPolicies) {
+                        for(AudioPolicyProxy policy : mAudioPolicies.values()) {
+                            policy.connectMixes();
+                        }
+                    }
+
                     // indicate the end of reconfiguration phase to audio HAL
                     AudioSystem.setParameters("restarting=false");
                     break;
@@ -5942,7 +5950,7 @@ public class AudioService extends IAudioService.Stub {
             if (mHasFocusListener) {
                 mMediaFocusControl.addFocusFollower(mPolicyToken);
             }
-            updateMixes(AudioSystem.DEVICE_STATE_AVAILABLE);
+            connectMixes();
         }
 
         public void binderDied() {
@@ -5964,23 +5972,11 @@ public class AudioService extends IAudioService.Stub {
             if (mHasFocusListener) {
                 mMediaFocusControl.removeFocusFollower(mPolicyToken);
             }
-            updateMixes(AudioSystem.DEVICE_STATE_UNAVAILABLE);
+            AudioSystem.registerPolicyMixes(mMixes, false);
         }
 
-        void updateMixes(int connectionState) {
-            for (AudioMix mix : mMixes) {
-                // TODO implement sending the mix attribute matching info to native audio policy
-                if (DEBUG_AP) {
-                    Log.v(TAG, "AudioPolicyProxy mix new connection state=" + connectionState
-                            + " addr=" + mix.getRegistration());
-                }
-                AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_IN_REMOTE_SUBMIX,
-                        connectionState,
-                        mix.getRegistration());
-                AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_REMOTE_SUBMIX,
-                        connectionState,
-                        mix.getRegistration());
-            }
+        void connectMixes() {
+            AudioSystem.registerPolicyMixes(mMixes, true);
         }
     };