Loading api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -21082,6 +21082,7 @@ package android.media { public final class AudioAttributes implements android.os.Parcelable { method public int describeContents(); method public int getAllFlags(); method public android.os.Bundle getBundle(); method public int getCapturePreset(); method public int getContentType(); method public int getFlags(); Loading Loading @@ -21120,6 +21121,7 @@ package android.media { public static class AudioAttributes.Builder { ctor public AudioAttributes.Builder(); ctor public AudioAttributes.Builder(android.media.AudioAttributes); method public android.media.AudioAttributes.Builder addBundle(android.os.Bundle); method public android.media.AudioAttributes build(); method public android.media.AudioAttributes.Builder setCapturePreset(int); method public android.media.AudioAttributes.Builder setContentType(int); media/java/android/media/AudioAttributes.java +62 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.media; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; Loading Loading @@ -242,6 +243,7 @@ public final class AudioAttributes implements Parcelable { private int mFlags = 0x0; private HashSet<String> mTags; private String mFormattedTags; private Bundle mBundle; // lazy-initialized, may be null private AudioAttributes() { } Loading Loading @@ -293,6 +295,20 @@ public final class AudioAttributes implements Parcelable { return (mFlags & FLAG_ALL); } /** * @hide * Return the Bundle of data. * @return a copy of the Bundle for this instance, may be null. */ @SystemApi public Bundle getBundle() { if (mBundle == null) { return mBundle; } else { return new Bundle(mBundle); } } /** * @hide * Return the set of tags. Loading Loading @@ -327,6 +343,7 @@ public final class AudioAttributes implements Parcelable { private int mSource = MediaRecorder.AudioSource.AUDIO_SOURCE_INVALID; private int mFlags = 0x0; private HashSet<String> mTags = new HashSet<String>(); private Bundle mBundle; /** * Constructs a new Builder with the defaults. Loading Loading @@ -365,6 +382,9 @@ public final class AudioAttributes implements Parcelable { aa.mFlags = mFlags; aa.mTags = (HashSet<String>) mTags.clone(); aa.mFormattedTags = TextUtils.join(";", mTags); if (mBundle != null) { aa.mBundle = new Bundle(mBundle); } return aa; } Loading Loading @@ -451,6 +471,25 @@ public final class AudioAttributes implements Parcelable { return this; } /** * @hide * Adds a Bundle of data * @param bundle a non-null Bundle * @return the same builder instance */ @SystemApi public Builder addBundle(@NonNull Bundle bundle) { if (bundle == null) { throw new IllegalArgumentException("Illegal null bundle"); } if (mBundle == null) { mBundle = new Bundle(bundle); } else { mBundle.putAll(bundle); } return this; } /** * @hide * Add a custom tag stored as a string Loading Loading @@ -584,6 +623,10 @@ public final class AudioAttributes implements Parcelable { * see definition of kAudioAttributesMarshallTagFlattenTags */ public final static int FLATTEN_TAGS = 0x1; private final static int ATTR_PARCEL_IS_NULL_BUNDLE = -1977; private final static int ATTR_PARCEL_IS_VALID_BUNDLE = 1980; /** * When adding tags for writeToParcel(Parcel, int), add them in the list of flags (| NEW_FLAG) */ Loading @@ -602,6 +645,12 @@ public final class AudioAttributes implements Parcelable { } else if ((flags & FLATTEN_TAGS) == FLATTEN_TAGS) { dest.writeString(mFormattedTags); } if (mBundle == null) { dest.writeInt(ATTR_PARCEL_IS_NULL_BUNDLE); } else { dest.writeInt(ATTR_PARCEL_IS_VALID_BUNDLE); dest.writeBundle(mBundle); } } private AudioAttributes(Parcel in) { Loading @@ -621,6 +670,16 @@ public final class AudioAttributes implements Parcelable { } mFormattedTags = TextUtils.join(";", mTags); } switch (in.readInt()) { case ATTR_PARCEL_IS_NULL_BUNDLE: mBundle = null; break; case ATTR_PARCEL_IS_VALID_BUNDLE: mBundle = new Bundle(in.readBundle()); break; default: Log.e(TAG, "Illegal value unmarshalling AudioAttributes, can't initialize bundle"); } } public static final Parcelable.Creator<AudioAttributes> CREATOR Loading Loading @@ -655,7 +714,7 @@ public final class AudioAttributes implements Parcelable { @Override public int hashCode() { return Objects.hash(mContentType, mFlags, mSource, mUsage, mFormattedTags); return Objects.hash(mContentType, mFlags, mSource, mUsage, mFormattedTags, mBundle); } @Override Loading @@ -664,7 +723,8 @@ public final class AudioAttributes implements Parcelable { + " usage=" + mUsage + " content=" + mContentType + " flags=0x" + Integer.toHexString(mFlags).toUpperCase() + " tags=" + mFormattedTags); + " tags=" + mFormattedTags + " bundle=" + (mBundle == null ? "null" : mBundle.toString())); } /** @hide */ Loading Loading
api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -21082,6 +21082,7 @@ package android.media { public final class AudioAttributes implements android.os.Parcelable { method public int describeContents(); method public int getAllFlags(); method public android.os.Bundle getBundle(); method public int getCapturePreset(); method public int getContentType(); method public int getFlags(); Loading Loading @@ -21120,6 +21121,7 @@ package android.media { public static class AudioAttributes.Builder { ctor public AudioAttributes.Builder(); ctor public AudioAttributes.Builder(android.media.AudioAttributes); method public android.media.AudioAttributes.Builder addBundle(android.os.Bundle); method public android.media.AudioAttributes build(); method public android.media.AudioAttributes.Builder setCapturePreset(int); method public android.media.AudioAttributes.Builder setContentType(int);
media/java/android/media/AudioAttributes.java +62 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.media; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; Loading Loading @@ -242,6 +243,7 @@ public final class AudioAttributes implements Parcelable { private int mFlags = 0x0; private HashSet<String> mTags; private String mFormattedTags; private Bundle mBundle; // lazy-initialized, may be null private AudioAttributes() { } Loading Loading @@ -293,6 +295,20 @@ public final class AudioAttributes implements Parcelable { return (mFlags & FLAG_ALL); } /** * @hide * Return the Bundle of data. * @return a copy of the Bundle for this instance, may be null. */ @SystemApi public Bundle getBundle() { if (mBundle == null) { return mBundle; } else { return new Bundle(mBundle); } } /** * @hide * Return the set of tags. Loading Loading @@ -327,6 +343,7 @@ public final class AudioAttributes implements Parcelable { private int mSource = MediaRecorder.AudioSource.AUDIO_SOURCE_INVALID; private int mFlags = 0x0; private HashSet<String> mTags = new HashSet<String>(); private Bundle mBundle; /** * Constructs a new Builder with the defaults. Loading Loading @@ -365,6 +382,9 @@ public final class AudioAttributes implements Parcelable { aa.mFlags = mFlags; aa.mTags = (HashSet<String>) mTags.clone(); aa.mFormattedTags = TextUtils.join(";", mTags); if (mBundle != null) { aa.mBundle = new Bundle(mBundle); } return aa; } Loading Loading @@ -451,6 +471,25 @@ public final class AudioAttributes implements Parcelable { return this; } /** * @hide * Adds a Bundle of data * @param bundle a non-null Bundle * @return the same builder instance */ @SystemApi public Builder addBundle(@NonNull Bundle bundle) { if (bundle == null) { throw new IllegalArgumentException("Illegal null bundle"); } if (mBundle == null) { mBundle = new Bundle(bundle); } else { mBundle.putAll(bundle); } return this; } /** * @hide * Add a custom tag stored as a string Loading Loading @@ -584,6 +623,10 @@ public final class AudioAttributes implements Parcelable { * see definition of kAudioAttributesMarshallTagFlattenTags */ public final static int FLATTEN_TAGS = 0x1; private final static int ATTR_PARCEL_IS_NULL_BUNDLE = -1977; private final static int ATTR_PARCEL_IS_VALID_BUNDLE = 1980; /** * When adding tags for writeToParcel(Parcel, int), add them in the list of flags (| NEW_FLAG) */ Loading @@ -602,6 +645,12 @@ public final class AudioAttributes implements Parcelable { } else if ((flags & FLATTEN_TAGS) == FLATTEN_TAGS) { dest.writeString(mFormattedTags); } if (mBundle == null) { dest.writeInt(ATTR_PARCEL_IS_NULL_BUNDLE); } else { dest.writeInt(ATTR_PARCEL_IS_VALID_BUNDLE); dest.writeBundle(mBundle); } } private AudioAttributes(Parcel in) { Loading @@ -621,6 +670,16 @@ public final class AudioAttributes implements Parcelable { } mFormattedTags = TextUtils.join(";", mTags); } switch (in.readInt()) { case ATTR_PARCEL_IS_NULL_BUNDLE: mBundle = null; break; case ATTR_PARCEL_IS_VALID_BUNDLE: mBundle = new Bundle(in.readBundle()); break; default: Log.e(TAG, "Illegal value unmarshalling AudioAttributes, can't initialize bundle"); } } public static final Parcelable.Creator<AudioAttributes> CREATOR Loading Loading @@ -655,7 +714,7 @@ public final class AudioAttributes implements Parcelable { @Override public int hashCode() { return Objects.hash(mContentType, mFlags, mSource, mUsage, mFormattedTags); return Objects.hash(mContentType, mFlags, mSource, mUsage, mFormattedTags, mBundle); } @Override Loading @@ -664,7 +723,8 @@ public final class AudioAttributes implements Parcelable { + " usage=" + mUsage + " content=" + mContentType + " flags=0x" + Integer.toHexString(mFlags).toUpperCase() + " tags=" + mFormattedTags); + " tags=" + mFormattedTags + " bundle=" + (mBundle == null ? "null" : mBundle.toString())); } /** @hide */ Loading