diff options
author | Kriti Dang <kritidang@google.com> | 2021-07-16 08:03:05 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-07-16 08:03:05 +0000 |
commit | 0077afd88a42326767982d18812ccb5aa6de64ae (patch) | |
tree | 0a34445e6798cd0a636c223bff30b8c6250a8a5b /media | |
parent | e032c8face20cfb1d2b09af8679db5f290812b1e (diff) | |
parent | 00e49c1482c8db1044ad9134f0bf98a4512f8241 (diff) |
Merge "Make AudioManager.getReportedSurroundFormats a TestApi" into sc-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioManager.java | 26 | ||||
-rwxr-xr-x | media/java/android/media/IAudioService.aidl | 4 |
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); |