Merge "Make AudioManager.getReportedSurroundFormats a TestApi" into sc-dev
This commit is contained in:
@@ -1421,6 +1421,7 @@ package android.media {
|
|||||||
method @RequiresPermission("android.permission.QUERY_AUDIO_STATE") public int abandonAudioFocusForTest(@NonNull android.media.AudioFocusRequest, @NonNull String);
|
method @RequiresPermission("android.permission.QUERY_AUDIO_STATE") public int abandonAudioFocusForTest(@NonNull android.media.AudioFocusRequest, @NonNull String);
|
||||||
method @Nullable public static android.media.AudioDeviceInfo getDeviceInfoFromType(int);
|
method @Nullable public static android.media.AudioDeviceInfo getDeviceInfoFromType(int);
|
||||||
method @IntRange(from=0) @RequiresPermission("android.permission.QUERY_AUDIO_STATE") public long getFadeOutDurationOnFocusLossMillis(@NonNull android.media.AudioAttributes);
|
method @IntRange(from=0) @RequiresPermission("android.permission.QUERY_AUDIO_STATE") public long getFadeOutDurationOnFocusLossMillis(@NonNull android.media.AudioAttributes);
|
||||||
|
method @NonNull public java.util.List<java.lang.Integer> getReportedSurroundFormats();
|
||||||
method @NonNull public java.util.Map<java.lang.Integer,java.lang.Boolean> getSurroundFormats();
|
method @NonNull public java.util.Map<java.lang.Integer,java.lang.Boolean> getSurroundFormats();
|
||||||
method public boolean hasRegisteredDynamicPolicy();
|
method public boolean hasRegisteredDynamicPolicy();
|
||||||
method @RequiresPermission(anyOf={android.Manifest.permission.MODIFY_AUDIO_ROUTING, android.Manifest.permission.QUERY_AUDIO_STATE}) public boolean isFullVolumeDevice();
|
method @RequiresPermission(anyOf={android.Manifest.permission.MODIFY_AUDIO_ROUTING, android.Manifest.permission.QUERY_AUDIO_STATE}) public boolean isFullVolumeDevice();
|
||||||
|
|||||||
@@ -7062,14 +7062,11 @@ public class AudioManager {
|
|||||||
@TestApi
|
@TestApi
|
||||||
@NonNull
|
@NonNull
|
||||||
public Map<Integer, Boolean> getSurroundFormats() {
|
public Map<Integer, Boolean> getSurroundFormats() {
|
||||||
Map<Integer, Boolean> surroundFormats = new HashMap<>();
|
try {
|
||||||
int status = AudioSystem.getSurroundFormats(surroundFormats);
|
return getService().getSurroundFormats();
|
||||||
if (status != AudioManager.SUCCESS) {
|
} catch (RemoteException e) {
|
||||||
// fail and bail!
|
throw e.rethrowFromSystemServer();
|
||||||
Log.e(TAG, "getSurroundFormats failed:" + status);
|
|
||||||
return new HashMap<Integer, Boolean>(); // Always return a map.
|
|
||||||
}
|
}
|
||||||
return surroundFormats;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7116,15 +7113,14 @@ public class AudioManager {
|
|||||||
*
|
*
|
||||||
* @return a list of surround formats
|
* @return a list of surround formats
|
||||||
*/
|
*/
|
||||||
public ArrayList<Integer> getReportedSurroundFormats() {
|
@TestApi
|
||||||
ArrayList<Integer> reportedSurroundFormats = new ArrayList<>();
|
@NonNull
|
||||||
int status = AudioSystem.getReportedSurroundFormats(reportedSurroundFormats);
|
public List<Integer> getReportedSurroundFormats() {
|
||||||
if (status != AudioManager.SUCCESS) {
|
try {
|
||||||
// fail and bail!
|
return getService().getReportedSurroundFormats();
|
||||||
Log.e(TAG, "getReportedSurroundFormats failed:" + status);
|
} catch (RemoteException e) {
|
||||||
return new ArrayList<Integer>(); // Always return a list.
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
return reportedSurroundFormats;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -159,6 +159,10 @@ interface IAudioService {
|
|||||||
|
|
||||||
oneway void reloadAudioSettings();
|
oneway void reloadAudioSettings();
|
||||||
|
|
||||||
|
Map getSurroundFormats();
|
||||||
|
|
||||||
|
List getReportedSurroundFormats();
|
||||||
|
|
||||||
boolean setSurroundFormatEnabled(int audioFormat, boolean enabled);
|
boolean setSurroundFormatEnabled(int audioFormat, boolean enabled);
|
||||||
|
|
||||||
boolean isSurroundFormatEnabled(int audioFormat);
|
boolean isSurroundFormatEnabled(int audioFormat);
|
||||||
|
|||||||
@@ -1930,6 +1930,32 @@ public class AudioService extends IAudioService.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @see AudioManager#getSurroundFormats() */
|
||||||
|
@Override
|
||||||
|
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<>(); // Always return a map.
|
||||||
|
}
|
||||||
|
return surroundFormats;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @see AudioManager#getReportedSurroundFormats() */
|
||||||
|
@Override
|
||||||
|
public List<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<>(); // Always return a list.
|
||||||
|
}
|
||||||
|
return reportedSurroundFormats;
|
||||||
|
}
|
||||||
|
|
||||||
/** @see AudioManager#isSurroundFormatEnabled(int) */
|
/** @see AudioManager#isSurroundFormatEnabled(int) */
|
||||||
@Override
|
@Override
|
||||||
public boolean isSurroundFormatEnabled(int audioFormat) {
|
public boolean isSurroundFormatEnabled(int audioFormat) {
|
||||||
|
|||||||
Reference in New Issue
Block a user