Merge "Add EHPLMN and HPLMN to SubscriptionInfo"

This commit is contained in:
Hall Liu
2019-04-15 23:27:40 +00:00
committed by Gerrit Code Review
2 changed files with 62 additions and 7 deletions

View File

@@ -39,6 +39,7 @@ import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@@ -122,6 +123,16 @@ public class SubscriptionInfo implements Parcelable {
*/ */
private String mMnc; private String mMnc;
/**
* EHPLMNs associated with the subscription
*/
private String[] mEhplmns;
/**
* HPLMNs associated with the subscription
*/
private String[] mHplmns;
/** /**
* ISO Country code for the subscription's provider * ISO Country code for the subscription's provider
*/ */
@@ -315,6 +326,14 @@ public class SubscriptionInfo implements Parcelable {
return this.mNameSource; return this.mNameSource;
} }
/**
* @hide
*/
public void setAssociatedPlmns(String[] ehplmns, String[] hplmns) {
mEhplmns = ehplmns;
mHplmns = hplmns;
}
/** /**
* Creates and returns an icon {@code Bitmap} to represent this {@code SubscriptionInfo} in a * Creates and returns an icon {@code Bitmap} to represent this {@code SubscriptionInfo} in a
* user interface. * user interface.
@@ -466,6 +485,20 @@ public class SubscriptionInfo implements Parcelable {
return mGroupUUID; return mGroupUUID;
} }
/**
* @hide
*/
public List<String> getEhplmns() {
return mEhplmns == null ? Collections.emptyList() : Arrays.asList(mEhplmns);
}
/**
* @hide
*/
public List<String> getHplmns() {
return mHplmns == null ? Collections.emptyList() : Arrays.asList(mHplmns);
}
/** /**
* @return the profile class of this subscription. * @return the profile class of this subscription.
* @hide * @hide
@@ -599,7 +632,7 @@ public class SubscriptionInfo implements Parcelable {
String mcc = source.readString(); String mcc = source.readString();
String mnc = source.readString(); String mnc = source.readString();
String countryIso = source.readString(); String countryIso = source.readString();
Bitmap iconBitmap = Bitmap.CREATOR.createFromParcel(source); Bitmap iconBitmap = source.readParcelable(Bitmap.class.getClassLoader());
boolean isEmbedded = source.readBoolean(); boolean isEmbedded = source.readBoolean();
UiccAccessRule[] accessRules = source.createTypedArray(UiccAccessRule.CREATOR); UiccAccessRule[] accessRules = source.createTypedArray(UiccAccessRule.CREATOR);
String cardString = source.readString(); String cardString = source.readString();
@@ -610,11 +643,15 @@ public class SubscriptionInfo implements Parcelable {
int carrierid = source.readInt(); int carrierid = source.readInt();
int profileClass = source.readInt(); int profileClass = source.readInt();
int subType = source.readInt(); int subType = source.readInt();
String[] ehplmns = source.readStringArray();
String[] hplmns = source.readStringArray();
return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName, SubscriptionInfo info = new SubscriptionInfo(id, iccId, simSlotIndex, displayName,
nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso, carrierName, nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc,
isEmbedded, accessRules, cardString, cardId, isOpportunistic, groupUUID, countryIso, isEmbedded, accessRules, cardString, cardId, isOpportunistic,
isGroupDisabled, carrierid, profileClass, subType); groupUUID, isGroupDisabled, carrierid, profileClass, subType);
info.setAssociatedPlmns(ehplmns, hplmns);
return info;
} }
@Override @Override
@@ -637,7 +674,7 @@ public class SubscriptionInfo implements Parcelable {
dest.writeString(mMcc); dest.writeString(mMcc);
dest.writeString(mMnc); dest.writeString(mMnc);
dest.writeString(mCountryIso); dest.writeString(mCountryIso);
mIconBitmap.writeToParcel(dest, flags); dest.writeParcelable(mIconBitmap, flags);
dest.writeBoolean(mIsEmbedded); dest.writeBoolean(mIsEmbedded);
dest.writeTypedArray(mAccessRules, flags); dest.writeTypedArray(mAccessRules, flags);
dest.writeString(mCardString); dest.writeString(mCardString);
@@ -648,6 +685,8 @@ public class SubscriptionInfo implements Parcelable {
dest.writeInt(mCarrierId); dest.writeInt(mCarrierId);
dest.writeInt(mProfileClass); dest.writeInt(mProfileClass);
dest.writeInt(mSubscriptionType); dest.writeInt(mSubscriptionType);
dest.writeStringArray(mEhplmns);
dest.writeStringArray(mHplmns);
} }
@Override @Override
@@ -685,6 +724,8 @@ public class SubscriptionInfo implements Parcelable {
+ " isOpportunistic " + mIsOpportunistic + " mGroupUUID=" + mGroupUUID + " isOpportunistic " + mIsOpportunistic + " mGroupUUID=" + mGroupUUID
+ " mIsGroupDisabled=" + mIsGroupDisabled + " mIsGroupDisabled=" + mIsGroupDisabled
+ " profileClass=" + mProfileClass + " profileClass=" + mProfileClass
+ " ehplmns = " + Arrays.toString(mEhplmns)
+ " hplmns = " + Arrays.toString(mHplmns)
+ " subscriptionType=" + mSubscriptionType + "}"; + " subscriptionType=" + mSubscriptionType + "}";
} }
@@ -728,6 +769,8 @@ public class SubscriptionInfo implements Parcelable {
&& TextUtils.equals(mDisplayName, toCompare.mDisplayName) && TextUtils.equals(mDisplayName, toCompare.mDisplayName)
&& TextUtils.equals(mCarrierName, toCompare.mCarrierName) && TextUtils.equals(mCarrierName, toCompare.mCarrierName)
&& Arrays.equals(mAccessRules, toCompare.mAccessRules) && Arrays.equals(mAccessRules, toCompare.mAccessRules)
&& mProfileClass == toCompare.mProfileClass; && mProfileClass == toCompare.mProfileClass
&& Arrays.equals(mEhplmns, toCompare.mEhplmns)
&& Arrays.equals(mHplmns, toCompare.mHplmns);
} }
} }

View File

@@ -457,6 +457,18 @@ public class SubscriptionManager {
*/ */
public static final String CARRIER_ID = "carrier_id"; public static final String CARRIER_ID = "carrier_id";
/**
* @hide A comma-separated list of EHPLMNs associated with the subscription
* <P>Type: TEXT (String)</P>
*/
public static final String EHPLMNS = "ehplmns";
/**
* @hide A comma-separated list of HPLMNs associated with the subscription
* <P>Type: TEXT (String)</P>
*/
public static final String HPLMNS = "hplmns";
/** /**
* TelephonyProvider column name for the MCC associated with a SIM, stored as a string. * TelephonyProvider column name for the MCC associated with a SIM, stored as a string.
* <P>Type: TEXT (String)</P> * <P>Type: TEXT (String)</P>