diff --git a/api/current.txt b/api/current.txt index 2281ec9d9ba9d..b0279121f392e 100644 --- a/api/current.txt +++ b/api/current.txt @@ -19712,12 +19712,14 @@ package android.media { field public static final int TYPE_WIRED_HEADSET = 3; // 0x3 } - public class AudioFormat { + public class AudioFormat implements android.os.Parcelable { + method public int describeContents(); method public int getChannelCount(); method public int getChannelIndexMask(); method public int getChannelMask(); method public int getEncoding(); method public int getSampleRate(); + method public void writeToParcel(android.os.Parcel, int); field public static final deprecated int CHANNEL_CONFIGURATION_DEFAULT = 1; // 0x1 field public static final deprecated int CHANNEL_CONFIGURATION_INVALID = 0; // 0x0 field public static final deprecated int CHANNEL_CONFIGURATION_MONO = 2; // 0x2 @@ -19759,6 +19761,7 @@ package android.media { field public static final int CHANNEL_OUT_SIDE_RIGHT = 4096; // 0x1000 field public static final int CHANNEL_OUT_STEREO = 12; // 0xc field public static final int CHANNEL_OUT_SURROUND = 1052; // 0x41c + field public static final android.os.Parcelable.Creator CREATOR; field public static final int ENCODING_AC3 = 5; // 0x5 field public static final int ENCODING_DEFAULT = 1; // 0x1 field public static final int ENCODING_DTS = 7; // 0x7 diff --git a/api/removed.txt b/api/removed.txt index 0bf659438340d..3fe97b7e14d15 100644 --- a/api/removed.txt +++ b/api/removed.txt @@ -35,7 +35,7 @@ package android.database { package android.media { - public class AudioFormat { + public class AudioFormat implements android.os.Parcelable { ctor public AudioFormat(); } diff --git a/api/system-current.txt b/api/system-current.txt index c48e1a898d345..25b0cc24c76e6 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -21208,12 +21208,14 @@ package android.media { field public static final android.os.Parcelable.Creator CREATOR; } - public class AudioFormat { + public class AudioFormat implements android.os.Parcelable { + method public int describeContents(); method public int getChannelCount(); method public int getChannelIndexMask(); method public int getChannelMask(); method public int getEncoding(); method public int getSampleRate(); + method public void writeToParcel(android.os.Parcel, int); field public static final deprecated int CHANNEL_CONFIGURATION_DEFAULT = 1; // 0x1 field public static final deprecated int CHANNEL_CONFIGURATION_INVALID = 0; // 0x0 field public static final deprecated int CHANNEL_CONFIGURATION_MONO = 2; // 0x2 @@ -21255,6 +21257,7 @@ package android.media { field public static final int CHANNEL_OUT_SIDE_RIGHT = 4096; // 0x1000 field public static final int CHANNEL_OUT_STEREO = 12; // 0xc field public static final int CHANNEL_OUT_SURROUND = 1052; // 0x41c + field public static final android.os.Parcelable.Creator CREATOR; field public static final int ENCODING_AC3 = 5; // 0x5 field public static final int ENCODING_DEFAULT = 1; // 0x1 field public static final int ENCODING_DTS = 7; // 0x7 diff --git a/api/system-removed.txt b/api/system-removed.txt index 27de91312fae7..aa4750a636e0b 100644 --- a/api/system-removed.txt +++ b/api/system-removed.txt @@ -26,7 +26,7 @@ package android.database { package android.media { - public class AudioFormat { + public class AudioFormat implements android.os.Parcelable { ctor public AudioFormat(); } diff --git a/api/test-current.txt b/api/test-current.txt index 40f33cb7d3451..a8a9f4cbb72f2 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -19721,12 +19721,14 @@ package android.media { field public static final int TYPE_WIRED_HEADSET = 3; // 0x3 } - public class AudioFormat { + public class AudioFormat implements android.os.Parcelable { + method public int describeContents(); method public int getChannelCount(); method public int getChannelIndexMask(); method public int getChannelMask(); method public int getEncoding(); method public int getSampleRate(); + method public void writeToParcel(android.os.Parcel, int); field public static final deprecated int CHANNEL_CONFIGURATION_DEFAULT = 1; // 0x1 field public static final deprecated int CHANNEL_CONFIGURATION_INVALID = 0; // 0x0 field public static final deprecated int CHANNEL_CONFIGURATION_MONO = 2; // 0x2 @@ -19768,6 +19770,7 @@ package android.media { field public static final int CHANNEL_OUT_SIDE_RIGHT = 4096; // 0x1000 field public static final int CHANNEL_OUT_STEREO = 12; // 0xc field public static final int CHANNEL_OUT_SURROUND = 1052; // 0x41c + field public static final android.os.Parcelable.Creator CREATOR; field public static final int ENCODING_AC3 = 5; // 0x5 field public static final int ENCODING_DEFAULT = 1; // 0x1 field public static final int ENCODING_DTS = 7; // 0x7 diff --git a/api/test-removed.txt b/api/test-removed.txt index 0bf659438340d..3fe97b7e14d15 100644 --- a/api/test-removed.txt +++ b/api/test-removed.txt @@ -35,7 +35,7 @@ package android.database { package android.media { - public class AudioFormat { + public class AudioFormat implements android.os.Parcelable { ctor public AudioFormat(); } diff --git a/media/java/android/media/AudioFormat.aidl b/media/java/android/media/AudioFormat.aidl new file mode 100644 index 0000000000000..8613f550e3c8a --- /dev/null +++ b/media/java/android/media/AudioFormat.aidl @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.media; + +parcelable AudioFormat; diff --git a/media/java/android/media/AudioFormat.java b/media/java/android/media/AudioFormat.java index 000a56d186b53..22f4f04bcea8d 100644 --- a/media/java/android/media/AudioFormat.java +++ b/media/java/android/media/AudioFormat.java @@ -18,10 +18,13 @@ package android.media; import android.annotation.IntDef; import android.annotation.NonNull; +import android.os.Parcel; +import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Arrays; +import java.util.Objects; /** * The {@link AudioFormat} class is used to access a number of audio format and @@ -209,7 +212,7 @@ import java.util.Arrays; * AudioTrack.getPlaybackHeadPosition()}), * depending on the context where audio frame is used. */ -public class AudioFormat { +public class AudioFormat implements Parcelable { //--------------------------------------------------------- // Constants @@ -873,6 +876,44 @@ public class AudioFormat { } } + @Override + public int hashCode() { + return Objects.hash(mPropertySetMask, mSampleRate, mEncoding, mChannelMask, + mChannelIndexMask); + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mPropertySetMask); + dest.writeInt(mEncoding); + dest.writeInt(mSampleRate); + dest.writeInt(mChannelMask); + dest.writeInt(mChannelIndexMask); + } + + private AudioFormat(Parcel in) { + mPropertySetMask = in.readInt(); + mEncoding = in.readInt(); + mSampleRate = in.readInt(); + mChannelMask = in.readInt(); + mChannelIndexMask = in.readInt(); + } + + public static final Parcelable.Creator CREATOR = + new Parcelable.Creator() { + public AudioFormat createFromParcel(Parcel p) { + return new AudioFormat(p); + } + public AudioFormat[] newArray(int size) { + return new AudioFormat[size]; + } + }; + @Override public String toString () { return new String("AudioFormat:"