Merge "Make android.media.AudioFormat parcelable" into nyc-dev

This commit is contained in:
Jean-Michel Trivi
2016-02-23 16:54:11 +00:00
committed by Android (Google) Code Review
8 changed files with 76 additions and 7 deletions

View File

@@ -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<android.media.AudioFormat> 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

View File

@@ -35,7 +35,7 @@ package android.database {
package android.media {
public class AudioFormat {
public class AudioFormat implements android.os.Parcelable {
ctor public AudioFormat();
}

View File

@@ -21208,12 +21208,14 @@ package android.media {
field public static final android.os.Parcelable.Creator<android.media.AudioFocusInfo> 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<android.media.AudioFormat> 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

View File

@@ -26,7 +26,7 @@ package android.database {
package android.media {
public class AudioFormat {
public class AudioFormat implements android.os.Parcelable {
ctor public AudioFormat();
}

View File

@@ -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<android.media.AudioFormat> 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

View File

@@ -35,7 +35,7 @@ package android.database {
package android.media {
public class AudioFormat {
public class AudioFormat implements android.os.Parcelable {
ctor public AudioFormat();
}

View File

@@ -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;

View File

@@ -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<AudioFormat> CREATOR =
new Parcelable.Creator<AudioFormat>() {
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:"