Merge "Clean up public API of SubInfoRecord." into lmp-mr1-dev

This commit is contained in:
Stuart Scott
2014-11-04 01:28:59 +00:00
committed by Android (Google) Code Review
3 changed files with 167 additions and 93 deletions

View File

@@ -28850,26 +28850,20 @@ package android.telephony {
} }
public class SubInfoRecord implements android.os.Parcelable { public class SubInfoRecord implements android.os.Parcelable {
ctor public SubInfoRecord();
ctor public SubInfoRecord(int, java.lang.String, int, java.lang.String, int, int, java.lang.String, int, int, int[], int, int);
method public int describeContents(); method public int describeContents();
method public int getColor(); method public int getColor();
method public android.graphics.drawable.BitmapDrawable getIconDrawable(); method public int getDataRoaming();
method public java.lang.String getLabel(); method public java.lang.CharSequence getDisplayName();
method public java.lang.String getIccId();
method public android.graphics.drawable.BitmapDrawable getIcon();
method public int getMcc();
method public int getMnc();
method public int getNameSource();
method public java.lang.String getNumber();
method public int getSimSlotIndex();
method public int getSubscriptionId();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.SubInfoRecord> CREATOR; field public static final android.os.Parcelable.Creator<android.telephony.SubInfoRecord> CREATOR;
field public int color;
field public int dataRoaming;
field public java.lang.String displayName;
field public int displayNumberFormat;
field public java.lang.String iccId;
field public int mcc;
field public int mnc;
field public int nameSource;
field public java.lang.String number;
field public int[] simIconRes;
field public int slotId;
field public int subId;
} }
public class SubscriptionManager implements android.provider.BaseColumns { public class SubscriptionManager implements android.provider.BaseColumns {

View File

@@ -29,98 +29,138 @@ public class SubInfoRecord implements Parcelable {
* Subscription Identifier, this is a device unique number * Subscription Identifier, this is a device unique number
* and not an index into an array * and not an index into an array
*/ */
public int subId; private int mId;
/** The GID for a SIM that maybe associated with this subscription, empty if unknown */
public String iccId;
/** /**
* The slot identifier for that currently contains the subscription * The GID for a SIM that maybe associated with this subscription, empty if unknown
*/
private String mIccId;
/**
* The index of the slot that currently contains the subscription
* and not necessarily unique and maybe INVALID_SLOT_ID if unknown * and not necessarily unique and maybe INVALID_SLOT_ID if unknown
*/ */
public int slotId; private int mSimSlotIndex;
/** /**
* The string displayed to the user that identifies this subscription * The name displayed to the user that identifies this subscription
*/ */
public String displayName; private CharSequence mDisplayName;
/** /**
* The source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE, * The source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
* NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT. * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT.
*/ */
public int nameSource; private int mNameSource;
/** /**
* The color to be used for when displaying to the user * The color to be used for when displaying to the user
*/ */
public int color; private int mColor;
/** /**
* A number presented to the user identify this subscription * A number presented to the user identify this subscription
*/ */
public String number; private String mNumber;
/**
* How to display the phone number, DISPLAY_NUMBER_NONE, DISPLAY_NUMBER_FIRST,
* DISPLAY_NUMBER_LAST
*/
public int displayNumberFormat;
/** /**
* Data roaming state, DATA_RAOMING_ENABLE, DATA_RAOMING_DISABLE * Data roaming state, DATA_RAOMING_ENABLE, DATA_RAOMING_DISABLE
*/ */
public int dataRoaming; private int mDataRoaming;
/** /**
* SIM Icon resource identifiers. FIXME: Check with MTK what it really is * SIM Icon resource identifiers. FIXME: Check with MTK what it really is
*/ */
public int[] simIconRes; private int[] mSimIconRes;
/** /**
* Mobile Country Code * Mobile Country Code
*/ */
public int mcc; private int mMcc;
/** /**
* Mobile Network Code * Mobile Network Code
*/ */
public int mnc; private int mMnc;
/**
* @hide
public SubInfoRecord() { public SubInfoRecord() {
this.subId = SubscriptionManager.INVALID_SUB_ID; this.mId = SubscriptionManager.INVALID_SUB_ID;
this.iccId = ""; this.mIccId = "";
this.slotId = SubscriptionManager.INVALID_SLOT_ID; this.mSimSlotIndex = SubscriptionManager.INVALID_SLOT_ID;
this.displayName = ""; this.mDisplayName = "";
this.nameSource = 0; this.mNameSource = 0;
this.color = 0; this.mColor = 0;
this.number = ""; this.mNumber = "";
this.displayNumberFormat = 0; this.mDataRoaming = 0;
this.dataRoaming = 0; this.mSimIconRes = new int[2];
this.simIconRes = new int[2]; this.mMcc = 0;
this.mcc = 0; this.mMnc = 0;
this.mnc = 0;
} }
*/
public SubInfoRecord(int subId, String iccId, int slotId, String displayName, int nameSource, /**
int color, String number, int displayFormat, int roaming, int[] iconRes, * @hide
int mcc, int mnc) { */
this.subId = subId; public SubInfoRecord(int id, String iccId, int simSlotIndex, CharSequence displayName,
this.iccId = iccId; int nameSource, int color, String number, int roaming, int[] iconRes, int mcc,
this.slotId = slotId; int mnc) {
this.displayName = displayName; this.mId = id;
this.nameSource = nameSource; this.mIccId = iccId;
this.color = color; this.mSimSlotIndex = simSlotIndex;
this.number = number; this.mDisplayName = displayName;
this.displayNumberFormat = displayFormat; this.mNameSource = nameSource;
this.dataRoaming = roaming; this.mColor = color;
this.simIconRes = iconRes; this.mNumber = number;
this.mcc = mcc; this.mDataRoaming = roaming;
this.mnc = mnc; this.mSimIconRes = iconRes;
this.mMcc = mcc;
this.mMnc = mnc;
} }
/** /**
* Returns the string displayed to the user that identifies this subscription * Returns the subscription ID.
*/ */
public String getLabel() { public int getSubscriptionId() {
return this.displayName; return this.mId;
} }
/** /**
* Return the icon used to identify this SIM. * Returns the ICC ID.
* TODO: return the correct drawable.
*/ */
public BitmapDrawable getIconDrawable() { public String getIccId() {
return new BitmapDrawable(); return this.mIccId;
}
/**
* Returns the slot index of this Subscription's SIM card.
*/
public int getSimSlotIndex() {
return this.mSimSlotIndex;
}
/**
* Returns the name displayed to the user that identifies this subscription
*/
public CharSequence getDisplayName() {
return this.mDisplayName;
}
/**
* Sets the name displayed to the user that identifies this subscription
* @hide
*/
public void setDisplayName(CharSequence name) {
this.mDisplayName = name;
}
/**
* Return the source of the name, eg NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
* NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT.
*/
public int getNameSource() {
return this.mNameSource;
} }
/** /**
@@ -130,28 +170,70 @@ public class SubInfoRecord implements Parcelable {
public int getColor() { public int getColor() {
// Note: This color is currently an index into a list of drawables, but this is soon to // Note: This color is currently an index into a list of drawables, but this is soon to
// change. // change.
return this.color; return this.mColor;
}
/**
* Sets the color displayed to the user that identifies this subscription
* @hide
*/
public void setColor(int color) {
this.mColor = color;
}
/**
* Returns the number of this subscription.
*/
public String getNumber() {
return mNumber;
}
/**
* Return the data roaming value.
*/
public int getDataRoaming() {
return this.mDataRoaming;
}
/**
* Return the icon used to identify this subscription.
*/
public BitmapDrawable getIcon() {
return new BitmapDrawable();
}
/**
* Returns the MCC.
*/
public int getMcc() {
return this.mMcc;
}
/**
* Returns the MNC.
*/
public int getMnc() {
return this.mMnc;
} }
public static final Parcelable.Creator<SubInfoRecord> CREATOR = new Parcelable.Creator<SubInfoRecord>() { public static final Parcelable.Creator<SubInfoRecord> CREATOR = new Parcelable.Creator<SubInfoRecord>() {
@Override @Override
public SubInfoRecord createFromParcel(Parcel source) { public SubInfoRecord createFromParcel(Parcel source) {
int subId = source.readInt(); int id = source.readInt();
String iccId = source.readString(); String iccId = source.readString();
int slotId = source.readInt(); int simSlotIndex = source.readInt();
String displayName = source.readString(); String displayName = source.readString();
int nameSource = source.readInt(); int nameSource = source.readInt();
int color = source.readInt(); int color = source.readInt();
String number = source.readString(); String number = source.readString();
int displayNumberFormat = source.readInt();
int dataRoaming = source.readInt(); int dataRoaming = source.readInt();
int[] iconRes = new int[2]; int[] iconRes = new int[2];
source.readIntArray(iconRes); source.readIntArray(iconRes);
int mcc = source.readInt(); int mcc = source.readInt();
int mnc = source.readInt(); int mnc = source.readInt();
return new SubInfoRecord(subId, iccId, slotId, displayName, nameSource, color, number, return new SubInfoRecord(id, iccId, simSlotIndex, displayName, nameSource, color, number,
displayNumberFormat, dataRoaming, iconRes, mcc, mnc); dataRoaming, iconRes, mcc, mnc);
} }
@Override @Override
@@ -162,18 +244,17 @@ public class SubInfoRecord implements Parcelable {
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(subId); dest.writeInt(mId);
dest.writeString(iccId); dest.writeString(mIccId);
dest.writeInt(slotId); dest.writeInt(mSimSlotIndex);
dest.writeString(displayName); dest.writeString(mDisplayName.toString());
dest.writeInt(nameSource); dest.writeInt(mNameSource);
dest.writeInt(color); dest.writeInt(mColor);
dest.writeString(number); dest.writeString(mNumber.toString());
dest.writeInt(displayNumberFormat); dest.writeInt(mDataRoaming);
dest.writeInt(dataRoaming); dest.writeIntArray(mSimIconRes);
dest.writeIntArray(simIconRes); dest.writeInt(mMcc);
dest.writeInt(mcc); dest.writeInt(mMnc);
dest.writeInt(mnc);
} }
@Override @Override
@@ -183,10 +264,9 @@ public class SubInfoRecord implements Parcelable {
@Override @Override
public String toString() { public String toString() {
return "{mSubId=" + subId + ", mIccId=" + iccId + " mSlotId=" + slotId return "{id=" + mId + ", iccId=" + mIccId + " simSlotIndex=" + mSimSlotIndex
+ " mDisplayName=" + displayName + " mNameSource=" + nameSource + " displayName=" + mDisplayName + " nameSource=" + mNameSource + " color=" + mColor
+ " mColor=" + color + " mNumber=" + number + " number=" + mNumber + " dataRoaming=" + mDataRoaming + " simIconRes=" + mSimIconRes
+ " mDisplayNumberFormat=" + displayNumberFormat + " mDataRoaming=" + dataRoaming + " mcc " + mMcc + " mnc " + mMnc + "}";
+ " mSimIconRes=" + simIconRes + " mMcc " + mcc + " mMnc " + mnc + "}";
} }
} }

View File

@@ -209,7 +209,7 @@ public class SubscriptionManager implements BaseColumns {
public static final int DISPLAY_NUMBER_LAST = 2; public static final int DISPLAY_NUMBER_LAST = 2;
/** @hide */ /** @hide */
public static final int DISLPAY_NUMBER_DEFAULT = DISPLAY_NUMBER_FIRST; public static final int DISPLAY_NUMBER_DEFAULT = DISPLAY_NUMBER_FIRST;
/** /**
* TelephonyProvider column name for permission for data roaming of a SIM. * TelephonyProvider column name for permission for data roaming of a SIM.