Merge "[BUG] audio: Misalignement of Native/Java AudioAttributes" am: 47818c0a2d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2603066 Change-Id: Idcdaa0a9788b370e82d74f480da02a99800f78cc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1436,6 +1436,8 @@ public final class AudioAttributes implements Parcelable {
|
|||||||
return new String("AudioAttributes:"
|
return new String("AudioAttributes:"
|
||||||
+ " usage=" + usageToString()
|
+ " usage=" + usageToString()
|
||||||
+ " content=" + contentTypeToString()
|
+ " content=" + contentTypeToString()
|
||||||
|
+ (mSource != MediaRecorder.AudioSource.AUDIO_SOURCE_INVALID
|
||||||
|
? " source=" + MediaRecorder.toLogFriendlyAudioSource(mSource) : "")
|
||||||
+ " flags=0x" + Integer.toHexString(mFlags).toUpperCase()
|
+ " flags=0x" + Integer.toHexString(mFlags).toUpperCase()
|
||||||
+ " tags=" + mFormattedTags
|
+ " tags=" + mFormattedTags
|
||||||
+ " bundle=" + (mBundle == null ? "null" : mBundle.toString()));
|
+ " bundle=" + (mBundle == null ? "null" : mBundle.toString()));
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import android.annotation.SystemApi;
|
|||||||
import android.annotation.TestApi;
|
import android.annotation.TestApi;
|
||||||
import android.media.AudioAttributes;
|
import android.media.AudioAttributes;
|
||||||
import android.media.AudioSystem;
|
import android.media.AudioSystem;
|
||||||
import android.media.MediaRecorder;
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -130,9 +129,7 @@ public final class AudioProductStrategy implements Parcelable {
|
|||||||
return aa;
|
return aa;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new AudioAttributes.Builder()
|
return DEFAULT_ATTRIBUTES;
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN)
|
|
||||||
.setUsage(AudioAttributes.USAGE_UNKNOWN).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -250,7 +247,7 @@ public final class AudioProductStrategy implements Parcelable {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
public @NonNull AudioAttributes getAudioAttributes() {
|
public @NonNull AudioAttributes getAudioAttributes() {
|
||||||
// We need a choice, so take the first one
|
// We need a choice, so take the first one
|
||||||
return mAudioAttributesGroups.length == 0 ? (new AudioAttributes.Builder().build())
|
return mAudioAttributesGroups.length == 0 ? DEFAULT_ATTRIBUTES
|
||||||
: mAudioAttributesGroups[0].getAudioAttributes();
|
: mAudioAttributesGroups[0].getAudioAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,8 +399,7 @@ public final class AudioProductStrategy implements Parcelable {
|
|||||||
* Default attributes, with default source to be aligned with native.
|
* Default attributes, with default source to be aligned with native.
|
||||||
*/
|
*/
|
||||||
private static final @NonNull AudioAttributes DEFAULT_ATTRIBUTES =
|
private static final @NonNull AudioAttributes DEFAULT_ATTRIBUTES =
|
||||||
new AudioAttributes.Builder().setCapturePreset(MediaRecorder.AudioSource.DEFAULT)
|
new AudioAttributes.Builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
@@ -473,8 +469,7 @@ public final class AudioProductStrategy implements Parcelable {
|
|||||||
|
|
||||||
public @NonNull AudioAttributes getAudioAttributes() {
|
public @NonNull AudioAttributes getAudioAttributes() {
|
||||||
// We need a choice, so take the first one
|
// We need a choice, so take the first one
|
||||||
return mAudioAttributes.length == 0 ? (new AudioAttributes.Builder().build())
|
return mAudioAttributes.length == 0 ? DEFAULT_ATTRIBUTES : mAudioAttributes[0];
|
||||||
: mAudioAttributes[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user