summaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authorKriti Dang <kritidang@google.com>2021-06-04 14:51:48 +0200
committerKriti Dang <kritidang@google.com>2021-07-14 17:25:25 +0000
commit00e49c1482c8db1044ad9134f0bf98a4512f8241 (patch)
treeae9bd603554dac16205d976fe66093f47e161fab /media
parent0c36db22b424e6ceb93d81f1b0686908654f8482 (diff)
Make AudioManager.getReportedSurroundFormats a TestApi
Access to the API needed from a tunnel mode CTS test. TestAPIs dont work in CTS test if they intrenally call AudioSystem. Changing getSurroundFormats and getReportedSurroundFormats to call AudioService instead of AudioSystem. Bug: 189823767 Test: atest android.media.cts.DecoderTest#testTunneledAudioPTSGapsAc3 Change-Id: If6287743f57b77d0eb2639e4a2e9409c7d778f06 Merged-In: If6287743f57b77d0eb2639e4a2e9409c7d778f06
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioManager.java26
-rwxr-xr-xmedia/java/android/media/IAudioService.aidl4
2 files changed, 15 insertions, 15 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index bd3ca5a80f96..3b9c05bbe64f 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -7062,14 +7062,11 @@ public class AudioManager {
@TestApi
@NonNull
public Map<Integer, Boolean> getSurroundFormats() {
- Map<Integer, Boolean> surroundFormats = new HashMap<>();
- int status = AudioSystem.getSurroundFormats(surroundFormats);
- if (status != AudioManager.SUCCESS) {
- // fail and bail!
- Log.e(TAG, "getSurroundFormats failed:" + status);
- return new HashMap<Integer, Boolean>(); // Always return a map.
+ try {
+ return getService().getSurroundFormats();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
}
- return surroundFormats;
}
/**
@@ -7116,15 +7113,14 @@ public class AudioManager {
*
* @return a list of surround formats
*/
- public ArrayList<Integer> getReportedSurroundFormats() {
- ArrayList<Integer> reportedSurroundFormats = new ArrayList<>();
- int status = AudioSystem.getReportedSurroundFormats(reportedSurroundFormats);
- if (status != AudioManager.SUCCESS) {
- // fail and bail!
- Log.e(TAG, "getReportedSurroundFormats failed:" + status);
- return new ArrayList<Integer>(); // Always return a list.
+ @TestApi
+ @NonNull
+ public List<Integer> getReportedSurroundFormats() {
+ try {
+ return getService().getReportedSurroundFormats();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
}
- return reportedSurroundFormats;
}
/**
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index c08c368af55a..0b35ebed966a 100755
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -159,6 +159,10 @@ interface IAudioService {
oneway void reloadAudioSettings();
+ Map getSurroundFormats();
+
+ List getReportedSurroundFormats();
+
boolean setSurroundFormatEnabled(int audioFormat, boolean enabled);
boolean isSurroundFormatEnabled(int audioFormat);