summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-12-01 19:36:30 -0800
committerEric Laurent <elaurent@google.com>2014-12-08 09:37:30 -0800
commit7f5eb9fe3c10d8d83ff0e2b0fc60a05c2e6d5b02 (patch)
tree9b9147714ecdbbb8acd6a2fe059d4b686ba39b55 /media
parent2ea3650d18ab0ce4dba2cee101d639400b411452 (diff)
downloadframeworks_base-7f5eb9fe3c10d8d83ff0e2b0fc60a05c2e6d5b02.zip
frameworks_base-7f5eb9fe3c10d8d83ff0e2b0fc60a05c2e6d5b02.tar.gz
frameworks_base-7f5eb9fe3c10d8d83ff0e2b0fc60a05c2e6d5b02.tar.bz2
AudioSystem JNI: Add audio policy custom mixes registration
Bug: 16009464. Change-Id: I3763e79f4fa0331acb56d1d6f575c7a36e0bebd5
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioService.java27
-rw-r--r--media/java/android/media/AudioSystem.java3
2 files changed, 14 insertions, 16 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 03ecad2..ebb7380 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -4298,6 +4298,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;
@@ -5938,7 +5945,7 @@ public class AudioService extends IAudioService.Stub {
if (mHasFocusListener) {
mMediaFocusControl.addFocusFollower(mPolicyToken);
}
- updateMixes(AudioSystem.DEVICE_STATE_AVAILABLE);
+ connectMixes();
}
public void binderDied() {
@@ -5960,23 +5967,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);
}
};
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index e795fa7..46ab7e0 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -16,6 +16,7 @@
package android.media;
+import android.media.audiopolicy.AudioMix;
import java.util.ArrayList;
/* IF YOU CHANGE ANY OF THE CONSTANTS IN THIS FILE, DO NOT FORGET
@@ -566,5 +567,7 @@ public class AudioSystem
public static final int AUDIO_HW_SYNC_INVALID = 0;
public static native int getAudioHwSyncForSession(int sessionId);
+
+ public static native int registerPolicyMixes(ArrayList<AudioMix> mixes, boolean register);
}