2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.telephony;
19 import android.os.Parcel;
20 import android.os.Parcelable;
23 * A Parcelable class for Subscription Information.
24 * @hide - to be unhidden
26 public class SubInfoRecord implements Parcelable {
29 * Subscription Identifier, this is a device unique number
30 * and not an index into an array
33 /** The GID for a SIM that maybe associated with this subscription, empty if unknown */
36 * The slot identifier for that currently contains the subscription
37 * and not necessarily unique and maybe INVALID_SLOT_ID if unknown
41 * The string displayed to the user that identifies this subscription
43 public String displayName;
45 * The source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
46 * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT.
48 public int nameSource;
50 * The color to be used for when displaying to the user
54 * A number presented to the user identify this subscription
58 * How to display the phone number, DISPLAY_NUMBER_NONE, DISPLAY_NUMBER_FIRST,
61 public int displayNumberFormat;
63 * Data roaming state, DATA_RAOMING_ENABLE, DATA_RAOMING_DISABLE
65 public int dataRoaming;
67 * SIM Icon resource identifiers. FIXME: Check with MTK what it really is
69 public int[] simIconRes;
79 public SubInfoRecord() {
80 this.subId = SubscriptionManager.INVALID_SUB_ID;
82 this.slotId = SubscriptionManager.INVALID_SLOT_ID;
83 this.displayName = "";
87 this.displayNumberFormat = 0;
89 this.simIconRes = new int[2];
94 public SubInfoRecord(long subId, String iccId, int slotId, String displayName, int nameSource,
95 int color, String number, int displayFormat, int roaming, int[] iconRes,
100 this.displayName = displayName;
101 this.nameSource = nameSource;
103 this.number = number;
104 this.displayNumberFormat = displayFormat;
105 this.dataRoaming = roaming;
106 this.simIconRes = iconRes;
111 public static final Parcelable.Creator<SubInfoRecord> CREATOR = new Parcelable.Creator<SubInfoRecord>() {
113 public SubInfoRecord createFromParcel(Parcel source) {
114 long subId = source.readLong();
115 String iccId = source.readString();
116 int slotId = source.readInt();
117 String displayName = source.readString();
118 int nameSource = source.readInt();
119 int color = source.readInt();
120 String number = source.readString();
121 int displayNumberFormat = source.readInt();
122 int dataRoaming = source.readInt();
123 int[] iconRes = new int[2];
124 source.readIntArray(iconRes);
125 int mcc = source.readInt();
126 int mnc = source.readInt();
128 return new SubInfoRecord(subId, iccId, slotId, displayName, nameSource, color, number,
129 displayNumberFormat, dataRoaming, iconRes, mcc, mnc);
133 public SubInfoRecord[] newArray(int size) {
134 return new SubInfoRecord[size];
139 public void writeToParcel(Parcel dest, int flags) {
140 dest.writeLong(subId);
141 dest.writeString(iccId);
142 dest.writeInt(slotId);
143 dest.writeString(displayName);
144 dest.writeInt(nameSource);
145 dest.writeInt(color);
146 dest.writeString(number);
147 dest.writeInt(displayNumberFormat);
148 dest.writeInt(dataRoaming);
149 dest.writeIntArray(simIconRes);
155 public int describeContents() {
160 public String toString() {
161 return "{mSubId=" + subId + ", mIccId=" + iccId + " mSlotId=" + slotId
162 + " mDisplayName=" + displayName + " mNameSource=" + nameSource
163 + " mColor=" + color + " mNumber=" + number
164 + " mDisplayNumberFormat=" + displayNumberFormat + " mDataRoaming=" + dataRoaming
165 + " mSimIconRes=" + simIconRes + " mMcc " + mcc + " mMnc " + mnc + "}";