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     public static final int MAIN_SPEAKER = 0;
29     public static final int MAIN_HEADSET = 1<<0;
30     public static final int MAIN_HEADPHONES = 1<<1;
31     public static final int MAIN_DOCK_SPEAKERS = 1<<2;
32     public static final int MAIN_HDMI = 1<<3;
33     public static final int MAIN_USB = 1<<4;
34 
35     public CharSequence bluetoothName;
36     public int mainType = MAIN_SPEAKER;
37 
AudioRoutesInfo()38     public AudioRoutesInfo() {
39     }
40 
AudioRoutesInfo(AudioRoutesInfo o)41     public AudioRoutesInfo(AudioRoutesInfo o) {
42         bluetoothName = o.bluetoothName;
43         mainType = o.mainType;
44     }
45 
AudioRoutesInfo(Parcel src)46     AudioRoutesInfo(Parcel src) {
47         bluetoothName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(src);
48         mainType = src.readInt();
49     }
50 
51     @Override
describeContents()52     public int describeContents() {
53         return 0;
54     }
55 
56     @Override
writeToParcel(Parcel dest, int flags)57     public void writeToParcel(Parcel dest, int flags) {
58         TextUtils.writeToParcel(bluetoothName, dest, flags);
59         dest.writeInt(mainType);
60     }
61 
62     public static final Parcelable.Creator<AudioRoutesInfo> CREATOR
63             = new Parcelable.Creator<AudioRoutesInfo>() {
64         public AudioRoutesInfo createFromParcel(Parcel in) {
65             return new AudioRoutesInfo(in);
66         }
67 
68         public AudioRoutesInfo[] newArray(int size) {
69             return new AudioRoutesInfo[size];
70         }
71     };
72 }
73