OSDN Git Service

API changes to add carrier name to subinforecord
authorSanket Padawe <sanketpadawe@google.com>
Fri, 7 Nov 2014 19:37:29 +0000 (11:37 -0800)
committerSanket Padawe <sanketpadawe@google.com>
Fri, 7 Nov 2014 19:37:29 +0000 (11:37 -0800)
API changes required to add carrier name of sim as a member of subinforecord.

Change-Id: I08a7f53dc012967005f7b5abd1fbc08f2947da67

telephony/java/android/telephony/SubInfoRecord.java
telephony/java/android/telephony/SubscriptionManager.java

index 8ab69cc..ed0441b 100644 (file)
@@ -48,6 +48,11 @@ public class SubInfoRecord implements Parcelable {
     private CharSequence mDisplayName;
 
     /**
+     * The string displayed to the user that identifies Subscription Provider Name
+     */
+    private CharSequence mCarrierName;
+
+    /**
      * The source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
      * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT.
      */
@@ -90,6 +95,7 @@ public class SubInfoRecord implements Parcelable {
         this.mIccId = "";
         this.mSimSlotIndex = SubscriptionManager.INVALID_SLOT_ID;
         this.mDisplayName = "";
+        this.mCarrierName = "";
         this.mNameSource = 0;
         this.mColor = 0;
         this.mNumber = "";
@@ -104,12 +110,13 @@ public class SubInfoRecord implements Parcelable {
      * @hide
      */
     public SubInfoRecord(int id, String iccId, int simSlotIndex, CharSequence displayName,
-            int nameSource, int color, String number, int roaming, int[] iconRes, int mcc,
-            int mnc) {
+            CharSequence carrierName, int nameSource, int color, String number, int roaming,
+            int[] iconRes, int mcc, int mnc) {
         this.mId = id;
         this.mIccId = iccId;
         this.mSimSlotIndex = simSlotIndex;
         this.mDisplayName = displayName;
+        this.mCarrierName = carrierName;
         this.mNameSource = nameSource;
         this.mColor = color;
         this.mNumber = number;
@@ -156,6 +163,22 @@ public class SubInfoRecord implements Parcelable {
     }
 
     /**
+     * Returns the name displayed to the user that identifies Subscription provider name
+     * @hide
+     */
+    public CharSequence getCarrierName() {
+        return this.mCarrierName;
+    }
+
+    /**
+     * Sets the name displayed to the user that identifies Subscription provider name
+     * @hide
+     */
+    public void setCarrierName(CharSequence name) {
+        this.mCarrierName = name;
+    }
+
+    /**
      * Return the source of the name, eg NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
      * NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT.
      */
@@ -223,6 +246,7 @@ public class SubInfoRecord implements Parcelable {
             String iccId = source.readString();
             int simSlotIndex = source.readInt();
             CharSequence displayName = source.readCharSequence();
+            CharSequence carrierName = source.readCharSequence();
             int nameSource = source.readInt();
             int color = source.readInt();
             String number = source.readString();
@@ -232,8 +256,8 @@ public class SubInfoRecord implements Parcelable {
             int mcc = source.readInt();
             int mnc = source.readInt();
 
-            return new SubInfoRecord(id, iccId, simSlotIndex, displayName, nameSource, color, number,
-                    dataRoaming, iconRes, mcc, mnc);
+            return new SubInfoRecord(id, iccId, simSlotIndex, displayName, carrierName,
+                    nameSource, color, number, dataRoaming, iconRes, mcc, mnc);
         }
 
         @Override
@@ -248,6 +272,7 @@ public class SubInfoRecord implements Parcelable {
         dest.writeString(mIccId);
         dest.writeInt(mSimSlotIndex);
         dest.writeCharSequence(mDisplayName);
+        dest.writeCharSequence(mCarrierName);
         dest.writeInt(mNameSource);
         dest.writeInt(mColor);
         dest.writeString(mNumber);
@@ -265,7 +290,7 @@ public class SubInfoRecord implements Parcelable {
     @Override
     public String toString() {
         return "{id=" + mId + ", iccId=" + mIccId + " simSlotIndex=" + mSimSlotIndex
-                + " displayName=" + mDisplayName + " nameSource=" + mNameSource + " color=" + mColor
+                + " displayName=" + mDisplayName + " carrierName=" + mCarrierName + " nameSource=" + mNameSource + " color=" + mColor
                 + " number=" + mNumber + " dataRoaming=" + mDataRoaming + " simIconRes=" + mSimIconRes
                 + " mcc " + mMcc + " mnc " + mMnc + "}";
     }
index 9cd533d..5643cb9 100644 (file)
@@ -126,6 +126,13 @@ public class SubscriptionManager implements BaseColumns {
     public static final String DISPLAY_NAME = "display_name";
 
     /**
+     * TelephonyProvider column name for the service provider name for the SIM.
+     * <P>Type: TEXT (String)</P>
+     */
+    /** @hide */
+    public static final String CARRIER_NAME = "carrier_name";
+
+    /**
      * Default name resource
      * @hide
      */