summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorWonsik Kim <wonsik@google.com>2015-02-03 23:59:02 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-03 23:59:02 +0000
commitf33c833ca0f91fa24ecd169d8af81d6eb5eec72c (patch)
tree13b0ca54ddc6f2edcfaec81900842f99f0c6d9c6 /media
parentec22b802b6f3041487f1af9ebad897e305429e17 (diff)
parentb86a45588a67f88730c15c82f624cd64fe1da80c (diff)
downloadframeworks_base-f33c833ca0f91fa24ecd169d8af81d6eb5eec72c.zip
frameworks_base-f33c833ca0f91fa24ecd169d8af81d6eb5eec72c.tar.gz
frameworks_base-f33c833ca0f91fa24ecd169d8af81d6eb5eec72c.tar.bz2
am b86a4558: am 015fdf39: Merge "audio: allow audio port cache update even when audio patches contain invalidated sources/sinks" into lmp-mr1-dev automerge: d7310bd
* commit 'b86a45588a67f88730c15c82f624cd64fe1da80c': audio: allow audio port cache update even when audio patches contain invalidated sources/sinks
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioManager.java31
1 files changed, 24 insertions, 7 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index f448dc2..986ae46 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -46,9 +46,9 @@ import android.provider.Settings;
import android.util.Log;
import android.view.KeyEvent;
-import java.util.HashMap;
import java.util.ArrayList;
-
+import java.util.HashMap;
+import java.util.Iterator;
/**
* AudioManager provides access to volume and ringer mode control.
@@ -3598,11 +3598,13 @@ public class AudioManager {
newPorts.clear();
status = AudioSystem.listAudioPorts(newPorts, portGeneration);
if (status != SUCCESS) {
+ Log.w(TAG, "updateAudioPortCache: listAudioPorts failed");
return status;
}
newPatches.clear();
status = AudioSystem.listAudioPatches(newPatches, patchGeneration);
if (status != SUCCESS) {
+ Log.w(TAG, "updateAudioPortCache: listAudioPatches failed");
return status;
}
} while (patchGeneration[0] != portGeneration[0]);
@@ -3611,18 +3613,33 @@ public class AudioManager {
for (int j = 0; j < newPatches.get(i).sources().length; j++) {
AudioPortConfig portCfg = updatePortConfig(newPatches.get(i).sources()[j],
newPorts);
- if (portCfg == null) {
- return ERROR;
- }
newPatches.get(i).sources()[j] = portCfg;
}
for (int j = 0; j < newPatches.get(i).sinks().length; j++) {
AudioPortConfig portCfg = updatePortConfig(newPatches.get(i).sinks()[j],
newPorts);
+ newPatches.get(i).sinks()[j] = portCfg;
+ }
+ }
+ for (Iterator<AudioPatch> i = newPatches.iterator(); i.hasNext(); ) {
+ AudioPatch newPatch = i.next();
+ boolean hasInvalidPort = false;
+ for (AudioPortConfig portCfg : newPatch.sources()) {
if (portCfg == null) {
- return ERROR;
+ hasInvalidPort = true;
+ break;
}
- newPatches.get(i).sinks()[j] = portCfg;
+ }
+ for (AudioPortConfig portCfg : newPatch.sinks()) {
+ if (portCfg == null) {
+ hasInvalidPort = true;
+ break;
+ }
+ }
+ if (hasInvalidPort) {
+ // Temporarily remove patches with invalid ports. One who created the patch
+ // is responsible for dealing with the port change.
+ i.remove();
}
}