Merge "Add profile class in SubscriptionInfo database"

This commit is contained in:
Treehugger Robot
2019-01-11 18:04:44 +00:00
committed by Gerrit Code Review
3 changed files with 108 additions and 8 deletions

View File

@@ -5392,6 +5392,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 {
@@ -5400,6 +5401,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;

View File

@@ -173,6 +173,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
*/
@@ -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;
}
@@ -465,6 +477,15 @@ public class SubscriptionInfo implements Parcelable {
return mIsMetered;
}
/**
* @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}
@@ -589,11 +610,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
@@ -626,6 +648,7 @@ public class SubscriptionInfo implements Parcelable {
dest.writeBoolean(mIsMetered);
dest.writeBoolean(mIsGroupDisabled);
dest.writeInt(mCarrierId);
dest.writeInt(mProfileClass);
}
@Override
@@ -661,7 +684,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
@@ -669,7 +693,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
@@ -704,6 +728,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;
}
}

View File

@@ -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;
@@ -602,6 +605,72 @@ public class SubscriptionManager {
*/
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>