Merge "add carrierid in subscriptionInfo" am: dcab1747cf
am: 0ee1e893ac
Change-Id: Ic0cbe9fd707d48d62b40ea6a03bcc55cd507ee71
diff --git a/api/current.txt b/api/current.txt
index cd71667..76469e3 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -42860,6 +42860,7 @@
public class SubscriptionInfo implements android.os.Parcelable {
method public android.graphics.Bitmap createIconBitmap(android.content.Context);
method public int describeContents();
+ method public int getCarrierId();
method public java.lang.CharSequence getCarrierName();
method public java.lang.String getCountryIso();
method public int getDataRoaming();
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index dacc5d8..a7e8e8a 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -80,6 +80,12 @@
private CharSequence mCarrierName;
/**
+ * The subscription carrier id.
+ * @see TelephonyManager#getSimCarrierId()
+ */
+ private int mCarrierId;
+
+ /**
* The source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
* NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT.
*/
@@ -171,7 +177,7 @@
@Nullable UiccAccessRule[] accessRules, String cardId) {
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardId,
- false, null, true);
+ false, null, true, TelephonyManager.UNKNOWN_CARRIER_ID);
}
/**
@@ -181,10 +187,10 @@
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
@Nullable UiccAccessRule[] accessRules, String cardId, boolean isOpportunistic,
- @Nullable String groupUUID, boolean isMetered) {
+ @Nullable String groupUUID, boolean isMetered, int carrierId) {
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardId,
- isOpportunistic, groupUUID, isMetered, false);
+ isOpportunistic, groupUUID, isMetered, false, carrierId);
}
/**
* @hide
@@ -193,7 +199,7 @@
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
@Nullable UiccAccessRule[] accessRules, String cardId, boolean isOpportunistic,
- @Nullable String groupUUID, boolean isMetered, boolean isGroupDisabled) {
+ @Nullable String groupUUID, boolean isMetered, boolean isGroupDisabled, int carrierid) {
this.mId = id;
this.mIccId = iccId;
this.mSimSlotIndex = simSlotIndex;
@@ -214,6 +220,7 @@
this.mGroupUUID = groupUUID;
this.mIsMetered = isMetered;
this.mIsGroupDisabled = isGroupDisabled;
+ this.mCarrierId = carrierid;
}
@@ -239,6 +246,14 @@
}
/**
+ * @return the carrier id of this Subscription carrier.
+ * @see TelephonyManager#getSimCarrierId()
+ */
+ public int getCarrierId() {
+ return this.mCarrierId;
+ }
+
+ /**
* @return the name displayed to the user that identifies this subscription
*/
public CharSequence getDisplayName() {
@@ -554,11 +569,12 @@
String groupUUID = source.readString();
boolean isMetered = source.readBoolean();
boolean isGroupDisabled = source.readBoolean();
+ int carrierid = source.readInt();
return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName,
nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso,
isEmbedded, accessRules, cardId, isOpportunistic, groupUUID, isMetered,
- isGroupDisabled);
+ isGroupDisabled, carrierid);
}
@Override
@@ -589,6 +605,7 @@
dest.writeString(mGroupUUID);
dest.writeBoolean(mIsMetered);
dest.writeBoolean(mIsGroupDisabled);
+ dest.writeInt(mCarrierId);
}
@Override
@@ -616,8 +633,9 @@
String iccIdToPrint = givePrintableIccid(mIccId);
String cardIdToPrint = givePrintableIccid(mCardId);
return "{id=" + mId + ", iccId=" + iccIdToPrint + " simSlotIndex=" + mSimSlotIndex
- + " displayName=" + mDisplayName + " carrierName=" + mCarrierName
- + " nameSource=" + mNameSource + " iconTint=" + mIconTint + " mNumber=" + mNumber
+ + " carrierId=" + mCarrierId + " displayName=" + mDisplayName
+ + " carrierName=" + mCarrierName + " nameSource=" + mNameSource
+ + " iconTint=" + mIconTint + " mNumber=" + mNumber
+ " dataRoaming=" + mDataRoaming + " iconBitmap=" + mIconBitmap + " mcc " + mMcc
+ " mnc " + mMnc + "mCountryIso=" + mCountryIso + " isEmbedded " + mIsEmbedded
+ " accessRules " + Arrays.toString(mAccessRules)
@@ -630,7 +648,8 @@
public int hashCode() {
return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded,
mIsOpportunistic, mGroupUUID, mIsMetered, mIccId, mNumber, mMcc, mMnc,
- mCountryIso, mCardId, mDisplayName, mCarrierName, mAccessRules, mIsGroupDisabled);
+ mCountryIso, mCardId, mDisplayName, mCarrierName, mAccessRules, mIsGroupDisabled,
+ mCarrierId);
}
@Override
@@ -653,8 +672,9 @@
&& mIsEmbedded == toCompare.mIsEmbedded
&& mIsOpportunistic == toCompare.mIsOpportunistic
&& mIsGroupDisabled == toCompare.mIsGroupDisabled
- && Objects.equals(mGroupUUID, toCompare.mGroupUUID)
+ && mCarrierId == toCompare.mCarrierId
&& mIsMetered == toCompare.mIsMetered
+ && Objects.equals(mGroupUUID, toCompare.mGroupUUID)
&& Objects.equals(mIccId, toCompare.mIccId)
&& Objects.equals(mNumber, toCompare.mNumber)
&& Objects.equals(mMcc, toCompare.mMcc)
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 4181f11..f782fae 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -379,6 +379,14 @@
public static final int SIM_PROVISIONED = 0;
/**
+ * TelephonyProvider column name for subscription carrier id.
+ * @see TelephonyManager#getSimCarrierId()
+ * <p>Type: INTEGER (int) </p>
+ * @hide
+ */
+ public static final String CARRIER_ID = "carrier_id";
+
+ /**
* TelephonyProvider column name for the MCC associated with a SIM, stored as a string.
* <P>Type: TEXT (String)</P>
* @hide