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