Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -23249,7 +23249,7 @@ package android.media { method public static boolean isHapticPlaybackSupported(); method public boolean isMicrophoneMute(); method public boolean isMusicActive(); method public static boolean isOffloadedPlaybackSupported(@NonNull android.media.AudioFormat); method public static boolean isOffloadedPlaybackSupported(@NonNull android.media.AudioFormat, @NonNull android.media.AudioAttributes); method public boolean isSpeakerphoneOn(); method public boolean isStreamMute(int); method public boolean isVolumeFixed(); core/jni/android_media_AudioSystem.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -2038,13 +2038,13 @@ android_media_AudioSystem_getStreamVolumeDB(JNIEnv *env, jobject thiz, static jboolean android_media_AudioSystem_isOffloadSupported(JNIEnv *env, jobject thiz, jint encoding, jint sampleRate, jint channelMask, jint channelIndexMask) jint encoding, jint sampleRate, jint channelMask, jint channelIndexMask, jint streamType) { audio_offload_info_t format = AUDIO_INFO_INITIALIZER; format.format = (audio_format_t) audioFormatToNative(encoding); format.sample_rate = (uint32_t) sampleRate; format.channel_mask = nativeChannelMaskFromJavaChannelMasks(channelMask, channelIndexMask); format.stream_type = AUDIO_STREAM_MUSIC; format.stream_type = (audio_stream_type_t) streamType; format.has_video = false; format.is_streaming = false; // offload duration unknown at this point: Loading Loading @@ -2292,7 +2292,7 @@ static const JNINativeMethod gMethods[] = { (void *)android_media_AudioSystem_registerRecordingCallback}, {"systemReady", "()I", (void *)android_media_AudioSystem_systemReady}, {"getStreamVolumeDB", "(III)F", (void *)android_media_AudioSystem_getStreamVolumeDB}, {"native_is_offload_supported", "(IIII)Z", (void *)android_media_AudioSystem_isOffloadSupported}, {"native_is_offload_supported", "(IIIII)Z", (void *)android_media_AudioSystem_isOffloadSupported}, {"getMicrophones", "(Ljava/util/ArrayList;)I", (void *)android_media_AudioSystem_getMicrophones}, {"getSurroundFormats", "(Ljava/util/Map;Z)I", (void *)android_media_AudioSystem_getSurroundFormats}, {"setSurroundFormatEnabled", "(IZ)I", (void *)android_media_AudioSystem_setSurroundFormatEnabled}, Loading media/apex/java/android/media/MediaPlayer2Utils.java +3 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ public class MediaPlayer2Utils { .setSampleRate(sampleRate) .setChannelMask(channelMask) .build(); return AudioManager.isOffloadedPlaybackSupported(format); //TODO MP2 needs to pass AudioAttributes for this query, instead of using default attr return AudioManager.isOffloadedPlaybackSupported(format, (new AudioAttributes.Builder()).build()); } } media/java/android/media/AudioManager.java +8 −3 Original line number Diff line number Diff line Loading @@ -1489,13 +1489,18 @@ public class AudioManager { * it does not indicate whether the resources necessary for the offloaded playback are * available at that instant. * @param format the audio format (codec, sample rate, channels) being checked. * @param attributes the {@link AudioAttributes} to be used for playback * @return true if the given audio format can be offloaded. */ public static boolean isOffloadedPlaybackSupported(@NonNull AudioFormat format) { public static boolean isOffloadedPlaybackSupported(@NonNull AudioFormat format, @NonNull AudioAttributes attributes) { if (format == null) { throw new IllegalArgumentException("Illegal null AudioFormat"); throw new NullPointerException("Illegal null AudioFormat"); } return AudioSystem.isOffloadSupported(format); if (attributes == null) { throw new NullPointerException("Illegal null AudioAttributes"); } return AudioSystem.isOffloadSupported(format, attributes); } //==================================================================== Loading media/java/android/media/AudioSystem.java +4 −3 Original line number Diff line number Diff line Loading @@ -1022,13 +1022,14 @@ public class AudioSystem public static native float getStreamVolumeDB(int stream, int index, int device); static boolean isOffloadSupported(@NonNull AudioFormat format) { static boolean isOffloadSupported(@NonNull AudioFormat format, @NonNull AudioAttributes attr) { return native_is_offload_supported(format.getEncoding(), format.getSampleRate(), format.getChannelMask(), format.getChannelIndexMask()); format.getChannelMask(), format.getChannelIndexMask(), attr.getVolumeControlStream()); } private static native boolean native_is_offload_supported(int encoding, int sampleRate, int channelMask, int channelIndexMask); int channelMask, int channelIndexMask, int streamType); public static native int getMicrophones(ArrayList<MicrophoneInfo> microphonesInfo); Loading Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -23249,7 +23249,7 @@ package android.media { method public static boolean isHapticPlaybackSupported(); method public boolean isMicrophoneMute(); method public boolean isMusicActive(); method public static boolean isOffloadedPlaybackSupported(@NonNull android.media.AudioFormat); method public static boolean isOffloadedPlaybackSupported(@NonNull android.media.AudioFormat, @NonNull android.media.AudioAttributes); method public boolean isSpeakerphoneOn(); method public boolean isStreamMute(int); method public boolean isVolumeFixed();
core/jni/android_media_AudioSystem.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -2038,13 +2038,13 @@ android_media_AudioSystem_getStreamVolumeDB(JNIEnv *env, jobject thiz, static jboolean android_media_AudioSystem_isOffloadSupported(JNIEnv *env, jobject thiz, jint encoding, jint sampleRate, jint channelMask, jint channelIndexMask) jint encoding, jint sampleRate, jint channelMask, jint channelIndexMask, jint streamType) { audio_offload_info_t format = AUDIO_INFO_INITIALIZER; format.format = (audio_format_t) audioFormatToNative(encoding); format.sample_rate = (uint32_t) sampleRate; format.channel_mask = nativeChannelMaskFromJavaChannelMasks(channelMask, channelIndexMask); format.stream_type = AUDIO_STREAM_MUSIC; format.stream_type = (audio_stream_type_t) streamType; format.has_video = false; format.is_streaming = false; // offload duration unknown at this point: Loading Loading @@ -2292,7 +2292,7 @@ static const JNINativeMethod gMethods[] = { (void *)android_media_AudioSystem_registerRecordingCallback}, {"systemReady", "()I", (void *)android_media_AudioSystem_systemReady}, {"getStreamVolumeDB", "(III)F", (void *)android_media_AudioSystem_getStreamVolumeDB}, {"native_is_offload_supported", "(IIII)Z", (void *)android_media_AudioSystem_isOffloadSupported}, {"native_is_offload_supported", "(IIIII)Z", (void *)android_media_AudioSystem_isOffloadSupported}, {"getMicrophones", "(Ljava/util/ArrayList;)I", (void *)android_media_AudioSystem_getMicrophones}, {"getSurroundFormats", "(Ljava/util/Map;Z)I", (void *)android_media_AudioSystem_getSurroundFormats}, {"setSurroundFormatEnabled", "(IZ)I", (void *)android_media_AudioSystem_setSurroundFormatEnabled}, Loading
media/apex/java/android/media/MediaPlayer2Utils.java +3 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ public class MediaPlayer2Utils { .setSampleRate(sampleRate) .setChannelMask(channelMask) .build(); return AudioManager.isOffloadedPlaybackSupported(format); //TODO MP2 needs to pass AudioAttributes for this query, instead of using default attr return AudioManager.isOffloadedPlaybackSupported(format, (new AudioAttributes.Builder()).build()); } }
media/java/android/media/AudioManager.java +8 −3 Original line number Diff line number Diff line Loading @@ -1489,13 +1489,18 @@ public class AudioManager { * it does not indicate whether the resources necessary for the offloaded playback are * available at that instant. * @param format the audio format (codec, sample rate, channels) being checked. * @param attributes the {@link AudioAttributes} to be used for playback * @return true if the given audio format can be offloaded. */ public static boolean isOffloadedPlaybackSupported(@NonNull AudioFormat format) { public static boolean isOffloadedPlaybackSupported(@NonNull AudioFormat format, @NonNull AudioAttributes attributes) { if (format == null) { throw new IllegalArgumentException("Illegal null AudioFormat"); throw new NullPointerException("Illegal null AudioFormat"); } return AudioSystem.isOffloadSupported(format); if (attributes == null) { throw new NullPointerException("Illegal null AudioAttributes"); } return AudioSystem.isOffloadSupported(format, attributes); } //==================================================================== Loading
media/java/android/media/AudioSystem.java +4 −3 Original line number Diff line number Diff line Loading @@ -1022,13 +1022,14 @@ public class AudioSystem public static native float getStreamVolumeDB(int stream, int index, int device); static boolean isOffloadSupported(@NonNull AudioFormat format) { static boolean isOffloadSupported(@NonNull AudioFormat format, @NonNull AudioAttributes attr) { return native_is_offload_supported(format.getEncoding(), format.getSampleRate(), format.getChannelMask(), format.getChannelIndexMask()); format.getChannelMask(), format.getChannelIndexMask(), attr.getVolumeControlStream()); } private static native boolean native_is_offload_supported(int encoding, int sampleRate, int channelMask, int channelIndexMask); int channelMask, int channelIndexMask, int streamType); public static native int getMicrophones(ArrayList<MicrophoneInfo> microphonesInfo); Loading