1/* Copyright 2014, The Android Open Source Project
2 **
3 ** Licensed under the Apache License, Version 2.0 (the "License");
4 ** you may not use this file except in compliance with the License.
5 ** You may obtain a copy of the License at
6 **
7 **     http://www.apache.org/licenses/LICENSE-2.0
8 **
9 ** Unless required by applicable law or agreed to in writing, software
10 ** distributed under the License is distributed on an "AS IS" BASIS,
11 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 ** See the License for the specific language governing permissions and
13 ** limitations under the License.
14 */
15
16package android.support.v4.media.session;
17
18import android.os.Parcel;
19import android.os.Parcelable;
20
21/**
22 * Convenience class for passing information about the audio configuration of a
23 * {@link MediaSessionCompat}.
24 */
25public class ParcelableVolumeInfo implements Parcelable {
26    public int volumeType;
27    public int audioStream;
28    public int controlType;
29    public int maxVolume;
30    public int currentVolume;
31
32    public ParcelableVolumeInfo(int volumeType, int audioStream, int controlType,
33            int maxVolume,
34            int currentVolume) {
35        this.volumeType = volumeType;
36        this.audioStream = audioStream;
37        this.controlType = controlType;
38        this.maxVolume = maxVolume;
39        this.currentVolume = currentVolume;
40    }
41
42    public ParcelableVolumeInfo(Parcel from) {
43        volumeType = from.readInt();
44        controlType = from.readInt();
45        maxVolume = from.readInt();
46        currentVolume = from.readInt();
47        audioStream = from.readInt();
48    }
49
50    @Override
51    public int describeContents() {
52        return 0;
53    }
54
55    @Override
56    public void writeToParcel(Parcel dest, int flags) {
57        dest.writeInt(volumeType);
58        dest.writeInt(controlType);
59        dest.writeInt(maxVolume);
60        dest.writeInt(currentVolume);
61        dest.writeInt(audioStream);
62    }
63
64
65    public static final Parcelable.Creator<ParcelableVolumeInfo> CREATOR
66            = new Parcelable.Creator<ParcelableVolumeInfo>() {
67        @Override
68        public ParcelableVolumeInfo createFromParcel(Parcel in) {
69            return new ParcelableVolumeInfo(in);
70        }
71
72        @Override
73        public ParcelableVolumeInfo[] newArray(int size) {
74            return new ParcelableVolumeInfo[size];
75        }
76    };
77}
78