• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 package android.media.session;
17 
18 import android.media.AudioAttributes;
19 import android.os.Parcel;
20 import android.os.Parcelable;
21 
22 /**
23  * Convenience class for passing information about the audio configuration of a
24  * session. The public implementation is {@link MediaController.PlaybackInfo}.
25  *
26  * @hide
27  */
28 public class ParcelableVolumeInfo implements Parcelable {
29     public int volumeType;
30     public AudioAttributes audioAttrs;
31     public int controlType;
32     public int maxVolume;
33     public int currentVolume;
34 
ParcelableVolumeInfo(int volumeType, AudioAttributes audioAttrs, int controlType, int maxVolume, int currentVolume)35     public ParcelableVolumeInfo(int volumeType, AudioAttributes audioAttrs, int controlType,
36             int maxVolume,
37             int currentVolume) {
38         this.volumeType = volumeType;
39         this.audioAttrs = audioAttrs;
40         this.controlType = controlType;
41         this.maxVolume = maxVolume;
42         this.currentVolume = currentVolume;
43     }
44 
ParcelableVolumeInfo(Parcel from)45     public ParcelableVolumeInfo(Parcel from) {
46         volumeType = from.readInt();
47         controlType = from.readInt();
48         maxVolume = from.readInt();
49         currentVolume = from.readInt();
50         audioAttrs = AudioAttributes.CREATOR.createFromParcel(from);
51     }
52 
53     @Override
describeContents()54     public int describeContents() {
55         return 0;
56     }
57 
58     @Override
writeToParcel(Parcel dest, int flags)59     public void writeToParcel(Parcel dest, int flags) {
60         dest.writeInt(volumeType);
61         dest.writeInt(controlType);
62         dest.writeInt(maxVolume);
63         dest.writeInt(currentVolume);
64         audioAttrs.writeToParcel(dest, flags);
65     }
66 
67 
68     public static final Parcelable.Creator<ParcelableVolumeInfo> CREATOR
69             = new Parcelable.Creator<ParcelableVolumeInfo>() {
70         @Override
71         public ParcelableVolumeInfo createFromParcel(Parcel in) {
72             return new ParcelableVolumeInfo(in);
73         }
74 
75         @Override
76         public ParcelableVolumeInfo[] newArray(int size) {
77             return new ParcelableVolumeInfo[size];
78         }
79     };
80 }
81