diff options
| author | Grace Chen <chengrace@google.com> | 2018-12-20 22:50:18 -0800 |
|---|---|---|
| committer | Grace Chen <chengrace@google.com> | 2019-01-08 18:43:09 +0000 |
| commit | c3eb446c52ca6b99ddef42539abd87729c219201 (patch) | |
| tree | 8895457bc469eb82273b1c9b322cc3c8456323d9 | |
| parent | a4cacee5811635844de3ee041381700ba1cb8395 (diff) | |
Add profile class in SubscriptionInfo database
Bug: 116732485
Test: Basic telephony sanity
Change-Id: I28a6d64c90db94ef0735f4d97f430560b733e797
| -rw-r--r-- | api/system-current.txt | 6 | ||||
| -rw-r--r-- | telephony/java/android/telephony/SubscriptionInfo.java | 41 | ||||
| -rw-r--r-- | telephony/java/android/telephony/SubscriptionManager.java | 70 |
3 files changed, 109 insertions, 8 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 7d889a29ace8..ed0d6b877e0a 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6254,6 +6254,7 @@ package android.telephony { public class SubscriptionInfo implements android.os.Parcelable { method public java.util.List<android.telephony.UiccAccessRule> getAccessRules(); method public int getCardId(); + method public int getProfileClass(); } public class SubscriptionManager { @@ -6263,6 +6264,11 @@ package android.telephony { method public void setDefaultDataSubId(int); method public void setDefaultSmsSubId(int); field public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI; + field public static final int PROFILE_CLASS_DEFAULT = -1; // 0xffffffff + field public static final int PROFILE_CLASS_OPERATIONAL = 2; // 0x2 + field public static final int PROFILE_CLASS_PROVISIONING = 1; // 0x1 + field public static final int PROFILE_CLASS_TESTING = 0; // 0x0 + field public static final int PROFILE_CLASS_UNSET = -1; // 0xffffffff field public static final android.net.Uri VT_ENABLED_CONTENT_URI; field public static final android.net.Uri WFC_ENABLED_CONTENT_URI; field public static final android.net.Uri WFC_MODE_CONTENT_URI; diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index a1e8b199d2a0..51d5ab17ee16 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -174,6 +174,16 @@ public class SubscriptionInfo implements Parcelable { private boolean mIsGroupDisabled = false; /** + * Profile class, PROFILE_CLASS_TESTING, PROFILE_CLASS_OPERATIONAL + * PROFILE_CLASS_PROVISIONING, or PROFILE_CLASS_UNSET. + * A profile on the eUICC can be defined as test, operational, provisioning, or unset. + * The profile class will be populated from the profile metadata if present. Otherwise, + * the profile class defaults to unset if there is no profile metadata or the subscription + * is not on an eUICC ({@link #isEmbedded} returns false). + */ + private int mProfileClass; + + /** * @hide */ public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName, @@ -182,7 +192,8 @@ public class SubscriptionInfo implements Parcelable { @Nullable UiccAccessRule[] accessRules, String cardString) { this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number, roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, - false, null, true, TelephonyManager.UNKNOWN_CARRIER_ID); + false, null, true, TelephonyManager.UNKNOWN_CARRIER_ID, + SubscriptionManager.PROFILE_CLASS_DEFAULT); } /** @@ -192,10 +203,10 @@ public class SubscriptionInfo implements Parcelable { CharSequence carrierName, int nameSource, int iconTint, String number, int roaming, Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded, @Nullable UiccAccessRule[] accessRules, String cardString, boolean isOpportunistic, - @Nullable String groupUUID, boolean isMetered, int carrierId) { + @Nullable String groupUUID, boolean isMetered, int carrierId, int profileClass) { this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number, roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, -1, - isOpportunistic, groupUUID, isMetered, false, carrierId); + isOpportunistic, groupUUID, isMetered, false, carrierId, profileClass); } /** @@ -206,7 +217,7 @@ public class SubscriptionInfo implements Parcelable { Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded, @Nullable UiccAccessRule[] accessRules, String cardString, int cardId, boolean isOpportunistic, @Nullable String groupUUID, boolean isMetered, - boolean isGroupDisabled, int carrierid) { + boolean isGroupDisabled, int carrierid, int profileClass) { this.mId = id; this.mIccId = iccId; this.mSimSlotIndex = simSlotIndex; @@ -229,6 +240,7 @@ public class SubscriptionInfo implements Parcelable { this.mIsMetered = isMetered; this.mIsGroupDisabled = isGroupDisabled; this.mCarrierId = carrierid; + this.mProfileClass = profileClass; } @@ -466,6 +478,15 @@ public class SubscriptionInfo implements Parcelable { } /** + * @return the profile class of this subscription. + * @hide + */ + @SystemApi + public @SubscriptionManager.ProfileClass int getProfileClass() { + return this.mProfileClass; + } + + /** * Checks whether the app with the given context is authorized to manage this subscription * according to its metadata. Only supported for embedded subscriptions (if {@link #isEmbedded} * returns true). @@ -590,11 +611,12 @@ public class SubscriptionInfo implements Parcelable { boolean isMetered = source.readBoolean(); boolean isGroupDisabled = source.readBoolean(); int carrierid = source.readInt(); + int profileClass = source.readInt(); return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, cardId, isOpportunistic, groupUUID, - isMetered, isGroupDisabled, carrierid); + isMetered, isGroupDisabled, carrierid, profileClass); } @Override @@ -627,6 +649,7 @@ public class SubscriptionInfo implements Parcelable { dest.writeBoolean(mIsMetered); dest.writeBoolean(mIsGroupDisabled); dest.writeInt(mCarrierId); + dest.writeInt(mProfileClass); } @Override @@ -662,7 +685,8 @@ public class SubscriptionInfo implements Parcelable { + " accessRules " + Arrays.toString(mAccessRules) + " cardString=" + cardStringToPrint + " cardId=" + mCardId + " isOpportunistic " + mIsOpportunistic + " mGroupUUID=" + mGroupUUID - + " isMetered=" + mIsMetered + " mIsGroupDisabled=" + mIsGroupDisabled + "}"; + + " isMetered=" + mIsMetered + " mIsGroupDisabled=" + mIsGroupDisabled + + " profileClass=" + mProfileClass + "}"; } @Override @@ -670,7 +694,7 @@ public class SubscriptionInfo implements Parcelable { return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded, mIsOpportunistic, mGroupUUID, mIsMetered, mIccId, mNumber, mMcc, mMnc, mCountryIso, mCardString, mCardId, mDisplayName, mCarrierName, mAccessRules, - mIsGroupDisabled, mCarrierId); + mIsGroupDisabled, mCarrierId, mProfileClass); } @Override @@ -705,6 +729,7 @@ public class SubscriptionInfo implements Parcelable { && Objects.equals(mCardId, toCompare.mCardId) && TextUtils.equals(mDisplayName, toCompare.mDisplayName) && TextUtils.equals(mCarrierName, toCompare.mCarrierName) - && Arrays.equals(mAccessRules, toCompare.mAccessRules); + && Arrays.equals(mAccessRules, toCompare.mAccessRules) + && mProfileClass == toCompare.mProfileClass; } } diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 2c712a1c36e1..4e04ef21cf06 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -22,6 +22,7 @@ import static android.net.NetworkPolicyManager.OVERRIDE_UNMETERED; import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.DurationMillisLong; +import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -62,6 +63,8 @@ import com.android.internal.telephony.ISub; import com.android.internal.telephony.ITelephonyRegistry; import com.android.internal.telephony.PhoneConstants; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -599,6 +602,73 @@ public class SubscriptionManager { * @hide */ public static final String IS_METERED = "is_metered"; + + /** + * TelephonyProvider column name for the profile class of a subscription + * Only present if {@link #IS_EMBEDDED} is 1. + * <P>Type: INTEGER (int)</P> + * @hide + */ + public static final String PROFILE_CLASS = "profile_class"; + + /** + * Profile class of the subscription + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = { "PROFILE_CLASS_" }, value = { + PROFILE_CLASS_TESTING, + PROFILE_CLASS_PROVISIONING, + PROFILE_CLASS_OPERATIONAL, + PROFILE_CLASS_UNSET, + PROFILE_CLASS_DEFAULT + }) + public @interface ProfileClass {} + + /** + * A testing profile can be pre-loaded or downloaded onto + * the eUICC and provides connectivity to test equipment + * for the purpose of testing the device and the eUICC. It + * is not intended to store any operator credentials. + * @hide + */ + @SystemApi + public static final int PROFILE_CLASS_TESTING = 0; + + /** + * A provisioning profile is pre-loaded onto the eUICC and + * provides connectivity to a mobile network solely for the + * purpose of provisioning profiles. + * @hide + */ + @SystemApi + public static final int PROFILE_CLASS_PROVISIONING = 1; + + /** + * An operational profile can be pre-loaded or downloaded + * onto the eUICC and provides services provided by the + * operator. + * @hide + */ + @SystemApi + public static final int PROFILE_CLASS_OPERATIONAL = 2; + + /** + * The profile class is unset. This occurs when profile class + * info is not available. The subscription either has no profile + * metadata or the profile metadata did not encode profile class. + * @hide + */ + @SystemApi + public static final int PROFILE_CLASS_UNSET = -1; + + /** + * Default profile class + * @hide + */ + @SystemApi + public static final int PROFILE_CLASS_DEFAULT = PROFILE_CLASS_UNSET; + /** * Broadcast Action: The user has changed one of the default subs related to * data, phone calls, or sms</p> |
