import android.os.Parcel;
import android.os.Parcelable;
import android.util.DisplayMetrics;
+import android.util.Log;
import java.util.Arrays;
-import java.util.ArrayList;
import java.util.List;
/**
/**
* Mobile Country Code
*/
- private int mMcc;
+ private String mMcc;
/**
* Mobile Network Code
*/
- private int mMnc;
+ private String mMnc;
/**
* ISO Country code for the subscription's provider
* @hide
*/
public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
- CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
- Bitmap icon, int mcc, int mnc, String countryIso) {
+ CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
+ Bitmap icon, String mcc, String mnc, String countryIso) {
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
- roaming, icon, mcc, mnc, countryIso, false /* isEmbedded */,
- null /* accessRules */, null /* accessRules */);
+ roaming, icon, mcc, mnc, countryIso, false /* isEmbedded */,
+ null /* accessRules */, null /* accessRules */);
}
/**
*/
public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
- Bitmap icon, int mcc, int mnc, String countryIso, boolean isEmbedded,
+ Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
@Nullable UiccAccessRule[] accessRules) {
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, null /* cardId */);
*/
public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
- Bitmap icon, int mcc, int mnc, String countryIso, boolean isEmbedded,
+ Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
@Nullable UiccAccessRule[] accessRules, String cardId) {
this.mId = id;
this.mIccId = iccId;
/**
* @return the MCC.
+ * @deprecated Use {@link #getMccString()} instead.
*/
+ @Deprecated
public int getMcc() {
- return this.mMcc;
+ try {
+ return this.mMcc == null ? 0 : Integer.valueOf(this.mMcc);
+ } catch (NumberFormatException e) {
+ Log.w(SubscriptionInfo.class.getSimpleName(), "MCC string is not a number");
+ return 0;
+ }
}
/**
* @return the MNC.
+ * @deprecated Use {@link #getMncString()} instead.
*/
+ @Deprecated
public int getMnc() {
+ try {
+ return this.mMnc == null ? 0 : Integer.valueOf(this.mMnc);
+ } catch (NumberFormatException e) {
+ Log.w(SubscriptionInfo.class.getSimpleName(), "MNC string is not a number");
+ return 0;
+ }
+ }
+
+ /**
+ * @return The MCC, as a string.
+ */
+ public String getMccString() {
+ return this.mMcc;
+ }
+
+ /**
+ * @return The MNC, as a string.
+ */
+ public String getMncString() {
return this.mMnc;
}
int iconTint = source.readInt();
String number = source.readString();
int dataRoaming = source.readInt();
- int mcc = source.readInt();
- int mnc = source.readInt();
+ String mcc = source.readString();
+ String mnc = source.readString();
String countryIso = source.readString();
Bitmap iconBitmap = Bitmap.CREATOR.createFromParcel(source);
boolean isEmbedded = source.readBoolean();
dest.writeInt(mIconTint);
dest.writeString(mNumber);
dest.writeInt(mDataRoaming);
- dest.writeInt(mMcc);
- dest.writeInt(mMnc);
+ dest.writeString(mMcc);
+ dest.writeString(mMnc);
dest.writeString(mCountryIso);
mIconBitmap.writeToParcel(dest, flags);
dest.writeBoolean(mIsEmbedded);