Public EuiccManager APIs.
Public EuiccManager and other related necessary files. Mark EuiccCardManager and other related necessary files as @SystemApi. Solve lint errors and warnings. Bug: 35851809 Test: test on phone Change-Id: Id7895f9b35ce9d4fb6fae42ba89ca9b29dbfa74c
This commit is contained in:
@@ -3444,9 +3444,6 @@ public class DevicePolicyManager {
|
||||
|
||||
/**
|
||||
* Flag for {@link #wipeData(int)}: also erase the device's eUICC data.
|
||||
*
|
||||
* TODO(b/35851809): make this public.
|
||||
* @hide
|
||||
*/
|
||||
public static final int WIPE_EUICC = 0x0004;
|
||||
|
||||
|
||||
@@ -3671,10 +3671,8 @@ public abstract class Context {
|
||||
*
|
||||
* @see #getSystemService(String)
|
||||
* @see android.telephony.euicc.EuiccManager
|
||||
* TODO(b/35851809): Unhide this API.
|
||||
* @hide
|
||||
*/
|
||||
public static final String EUICC_SERVICE = "euicc_service";
|
||||
public static final String EUICC_SERVICE = "euicc";
|
||||
|
||||
/**
|
||||
* Use with {@link #getSystemService(String)} to retrieve a
|
||||
@@ -3682,10 +3680,10 @@ public abstract class Context {
|
||||
*
|
||||
* @see #getSystemService(String)
|
||||
* @see android.telephony.euicc.EuiccCardManager
|
||||
* TODO(b/35851809): Make this a SystemApi.
|
||||
* @hide
|
||||
*/
|
||||
public static final String EUICC_CARD_SERVICE = "euicc_card_service";
|
||||
@SystemApi
|
||||
public static final String EUICC_CARD_SERVICE = "euicc_card";
|
||||
|
||||
/**
|
||||
* Use with {@link #getSystemService(String)} to retrieve a
|
||||
|
||||
@@ -2108,8 +2108,6 @@ public abstract class PackageManager {
|
||||
/**
|
||||
* Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device
|
||||
* supports embedded subscriptions on eUICCs.
|
||||
* TODO(b/35851809): Make this public.
|
||||
* @hide
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.FEATURE)
|
||||
public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc";
|
||||
|
||||
@@ -8562,9 +8562,8 @@ public final class Settings {
|
||||
*
|
||||
* @see android.service.euicc.EuiccService
|
||||
* @hide
|
||||
*
|
||||
* TODO(b/35851809): Make this a SystemApi.
|
||||
*/
|
||||
@SystemApi
|
||||
public static final String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus";
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ package android.service.euicc;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.service.carrier.CarrierIdentifier;
|
||||
@@ -26,15 +27,15 @@ import android.text.TextUtils;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Information about an embedded profile (subscription) on an eUICC.
|
||||
*
|
||||
* @hide
|
||||
*
|
||||
* TODO(b/35851809): Make this a SystemApi.
|
||||
*/
|
||||
@SystemApi
|
||||
public final class EuiccProfileInfo implements Parcelable {
|
||||
|
||||
/** Profile policy rules (bit mask) */
|
||||
@@ -44,6 +45,7 @@ public final class EuiccProfileInfo implements Parcelable {
|
||||
POLICY_RULE_DO_NOT_DELETE,
|
||||
POLICY_RULE_DELETE_AFTER_DISABLING
|
||||
})
|
||||
/** @hide */
|
||||
public @interface PolicyRule {}
|
||||
/** Once this profile is enabled, it cannot be disabled. */
|
||||
public static final int POLICY_RULE_DO_NOT_DISABLE = 1;
|
||||
@@ -60,6 +62,7 @@ public final class EuiccProfileInfo implements Parcelable {
|
||||
PROFILE_CLASS_OPERATIONAL,
|
||||
PROFILE_CLASS_UNSET
|
||||
})
|
||||
/** @hide */
|
||||
public @interface ProfileClass {}
|
||||
/** Testing profiles */
|
||||
public static final int PROFILE_CLASS_TESTING = 0;
|
||||
@@ -80,6 +83,7 @@ public final class EuiccProfileInfo implements Parcelable {
|
||||
PROFILE_STATE_ENABLED,
|
||||
PROFILE_STATE_UNSET
|
||||
})
|
||||
/** @hide */
|
||||
public @interface ProfileState {}
|
||||
/** Disabled profiles */
|
||||
public static final int PROFILE_STATE_DISABLED = 0;
|
||||
@@ -92,34 +96,34 @@ public final class EuiccProfileInfo implements Parcelable {
|
||||
public static final int PROFILE_STATE_UNSET = -1;
|
||||
|
||||
/** The iccid of the subscription. */
|
||||
public final String iccid;
|
||||
private final String mIccid;
|
||||
|
||||
/** An optional nickname for the subscription. */
|
||||
public final @Nullable String nickname;
|
||||
private final @Nullable String mNickname;
|
||||
|
||||
/** The service provider name for the subscription. */
|
||||
public final String serviceProviderName;
|
||||
private final String mServiceProviderName;
|
||||
|
||||
/** The profile name for the subscription. */
|
||||
public final String profileName;
|
||||
private final String mProfileName;
|
||||
|
||||
/** Profile class for the subscription. */
|
||||
@ProfileClass public final int profileClass;
|
||||
@ProfileClass private final int mProfileClass;
|
||||
|
||||
/** The profile state of the subscription. */
|
||||
@ProfileState public final int state;
|
||||
@ProfileState private final int mState;
|
||||
|
||||
/** The operator Id of the subscription. */
|
||||
public final CarrierIdentifier carrierIdentifier;
|
||||
private final CarrierIdentifier mCarrierIdentifier;
|
||||
|
||||
/** The policy rules of the subscription. */
|
||||
@PolicyRule public final int policyRules;
|
||||
@PolicyRule private final int mPolicyRules;
|
||||
|
||||
/**
|
||||
* Optional access rules defining which apps can manage this subscription. If unset, only the
|
||||
* platform can manage it.
|
||||
*/
|
||||
public final @Nullable UiccAccessRule[] accessRules;
|
||||
private final @Nullable UiccAccessRule[] mAccessRules;
|
||||
|
||||
public static final Creator<EuiccProfileInfo> CREATOR = new Creator<EuiccProfileInfo>() {
|
||||
@Override
|
||||
@@ -144,51 +148,51 @@ public final class EuiccProfileInfo implements Parcelable {
|
||||
if (!TextUtils.isDigitsOnly(iccid)) {
|
||||
throw new IllegalArgumentException("iccid contains invalid characters: " + iccid);
|
||||
}
|
||||
this.iccid = iccid;
|
||||
this.accessRules = accessRules;
|
||||
this.nickname = nickname;
|
||||
this.mIccid = iccid;
|
||||
this.mAccessRules = accessRules;
|
||||
this.mNickname = nickname;
|
||||
|
||||
this.serviceProviderName = null;
|
||||
this.profileName = null;
|
||||
this.profileClass = PROFILE_CLASS_UNSET;
|
||||
this.state = PROFILE_CLASS_UNSET;
|
||||
this.carrierIdentifier = null;
|
||||
this.policyRules = 0;
|
||||
this.mServiceProviderName = null;
|
||||
this.mProfileName = null;
|
||||
this.mProfileClass = PROFILE_CLASS_UNSET;
|
||||
this.mState = PROFILE_STATE_UNSET;
|
||||
this.mCarrierIdentifier = null;
|
||||
this.mPolicyRules = 0;
|
||||
}
|
||||
|
||||
private EuiccProfileInfo(Parcel in) {
|
||||
iccid = in.readString();
|
||||
nickname = in.readString();
|
||||
serviceProviderName = in.readString();
|
||||
profileName = in.readString();
|
||||
profileClass = in.readInt();
|
||||
state = in.readInt();
|
||||
mIccid = in.readString();
|
||||
mNickname = in.readString();
|
||||
mServiceProviderName = in.readString();
|
||||
mProfileName = in.readString();
|
||||
mProfileClass = in.readInt();
|
||||
mState = in.readInt();
|
||||
byte exist = in.readByte();
|
||||
if (exist == (byte) 1) {
|
||||
carrierIdentifier = CarrierIdentifier.CREATOR.createFromParcel(in);
|
||||
mCarrierIdentifier = CarrierIdentifier.CREATOR.createFromParcel(in);
|
||||
} else {
|
||||
carrierIdentifier = null;
|
||||
mCarrierIdentifier = null;
|
||||
}
|
||||
policyRules = in.readInt();
|
||||
accessRules = in.createTypedArray(UiccAccessRule.CREATOR);
|
||||
mPolicyRules = in.readInt();
|
||||
mAccessRules = in.createTypedArray(UiccAccessRule.CREATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(iccid);
|
||||
dest.writeString(nickname);
|
||||
dest.writeString(serviceProviderName);
|
||||
dest.writeString(profileName);
|
||||
dest.writeInt(profileClass);
|
||||
dest.writeInt(state);
|
||||
if (carrierIdentifier != null) {
|
||||
dest.writeString(mIccid);
|
||||
dest.writeString(mNickname);
|
||||
dest.writeString(mServiceProviderName);
|
||||
dest.writeString(mProfileName);
|
||||
dest.writeInt(mProfileClass);
|
||||
dest.writeInt(mState);
|
||||
if (mCarrierIdentifier != null) {
|
||||
dest.writeByte((byte) 1);
|
||||
carrierIdentifier.writeToParcel(dest, flags);
|
||||
mCarrierIdentifier.writeToParcel(dest, flags);
|
||||
} else {
|
||||
dest.writeByte((byte) 0);
|
||||
}
|
||||
dest.writeInt(policyRules);
|
||||
dest.writeTypedArray(accessRules, flags);
|
||||
dest.writeInt(mPolicyRules);
|
||||
dest.writeTypedArray(mAccessRules, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,45 +202,50 @@ public final class EuiccProfileInfo implements Parcelable {
|
||||
|
||||
/** The builder to build a new {@link EuiccProfileInfo} instance. */
|
||||
public static final class Builder {
|
||||
public String iccid;
|
||||
public UiccAccessRule[] accessRules;
|
||||
public String nickname;
|
||||
public String serviceProviderName;
|
||||
public String profileName;
|
||||
@ProfileClass public int profileClass;
|
||||
@ProfileState public int state;
|
||||
public CarrierIdentifier carrierIdentifier;
|
||||
@PolicyRule public int policyRules;
|
||||
private String mIccid;
|
||||
private List<UiccAccessRule> mAccessRules;
|
||||
private String mNickname;
|
||||
private String mServiceProviderName;
|
||||
private String mProfileName;
|
||||
@ProfileClass private int mProfileClass;
|
||||
@ProfileState private int mState;
|
||||
private CarrierIdentifier mCarrierIdentifier;
|
||||
@PolicyRule private int mPolicyRules;
|
||||
|
||||
public Builder() {}
|
||||
public Builder(String value) {
|
||||
if (!TextUtils.isDigitsOnly(value)) {
|
||||
throw new IllegalArgumentException("iccid contains invalid characters: " + value);
|
||||
}
|
||||
mIccid = value;
|
||||
}
|
||||
|
||||
public Builder(EuiccProfileInfo baseProfile) {
|
||||
iccid = baseProfile.iccid;
|
||||
nickname = baseProfile.nickname;
|
||||
serviceProviderName = baseProfile.serviceProviderName;
|
||||
profileName = baseProfile.profileName;
|
||||
profileClass = baseProfile.profileClass;
|
||||
state = baseProfile.state;
|
||||
carrierIdentifier = baseProfile.carrierIdentifier;
|
||||
policyRules = baseProfile.policyRules;
|
||||
accessRules = baseProfile.accessRules;
|
||||
mIccid = baseProfile.mIccid;
|
||||
mNickname = baseProfile.mNickname;
|
||||
mServiceProviderName = baseProfile.mServiceProviderName;
|
||||
mProfileName = baseProfile.mProfileName;
|
||||
mProfileClass = baseProfile.mProfileClass;
|
||||
mState = baseProfile.mState;
|
||||
mCarrierIdentifier = baseProfile.mCarrierIdentifier;
|
||||
mPolicyRules = baseProfile.mPolicyRules;
|
||||
mAccessRules = Arrays.asList(baseProfile.mAccessRules);
|
||||
}
|
||||
|
||||
/** Builds the profile instance. */
|
||||
public EuiccProfileInfo build() {
|
||||
if (iccid == null) {
|
||||
if (mIccid == null) {
|
||||
throw new IllegalStateException("ICCID must be set for a profile.");
|
||||
}
|
||||
return new EuiccProfileInfo(
|
||||
iccid,
|
||||
nickname,
|
||||
serviceProviderName,
|
||||
profileName,
|
||||
profileClass,
|
||||
state,
|
||||
carrierIdentifier,
|
||||
policyRules,
|
||||
accessRules);
|
||||
mIccid,
|
||||
mNickname,
|
||||
mServiceProviderName,
|
||||
mProfileName,
|
||||
mProfileClass,
|
||||
mState,
|
||||
mCarrierIdentifier,
|
||||
mPolicyRules,
|
||||
mAccessRules);
|
||||
}
|
||||
|
||||
/** Sets the iccId of the subscription. */
|
||||
@@ -244,55 +253,55 @@ public final class EuiccProfileInfo implements Parcelable {
|
||||
if (!TextUtils.isDigitsOnly(value)) {
|
||||
throw new IllegalArgumentException("iccid contains invalid characters: " + value);
|
||||
}
|
||||
iccid = value;
|
||||
mIccid = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the nickname of the subscription. */
|
||||
public Builder setNickname(String value) {
|
||||
nickname = value;
|
||||
mNickname = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the service provider name of the subscription. */
|
||||
public Builder setServiceProviderName(String value) {
|
||||
serviceProviderName = value;
|
||||
mServiceProviderName = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the profile name of the subscription. */
|
||||
public Builder setProfileName(String value) {
|
||||
profileName = value;
|
||||
mProfileName = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the profile class of the subscription. */
|
||||
public Builder setProfileClass(@ProfileClass int value) {
|
||||
profileClass = value;
|
||||
mProfileClass = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the state of the subscription. */
|
||||
public Builder setState(@ProfileState int value) {
|
||||
state = value;
|
||||
mState = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the carrier identifier of the subscription. */
|
||||
public Builder setCarrierIdentifier(CarrierIdentifier value) {
|
||||
carrierIdentifier = value;
|
||||
mCarrierIdentifier = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the policy rules of the subscription. */
|
||||
public Builder setPolicyRules(@PolicyRule int value) {
|
||||
policyRules = value;
|
||||
mPolicyRules = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the access rules of the subscription. */
|
||||
public Builder setUiccAccessRule(@Nullable UiccAccessRule[] value) {
|
||||
accessRules = value;
|
||||
public Builder setUiccAccessRule(@Nullable List<UiccAccessRule> value) {
|
||||
mAccessRules = value;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -306,75 +315,81 @@ public final class EuiccProfileInfo implements Parcelable {
|
||||
@ProfileState int state,
|
||||
CarrierIdentifier carrierIdentifier,
|
||||
@PolicyRule int policyRules,
|
||||
@Nullable UiccAccessRule[] accessRules) {
|
||||
this.iccid = iccid;
|
||||
this.nickname = nickname;
|
||||
this.serviceProviderName = serviceProviderName;
|
||||
this.profileName = profileName;
|
||||
this.profileClass = profileClass;
|
||||
this.state = state;
|
||||
this.carrierIdentifier = carrierIdentifier;
|
||||
this.policyRules = policyRules;
|
||||
this.accessRules = accessRules;
|
||||
@Nullable List<UiccAccessRule> accessRules) {
|
||||
this.mIccid = iccid;
|
||||
this.mNickname = nickname;
|
||||
this.mServiceProviderName = serviceProviderName;
|
||||
this.mProfileName = profileName;
|
||||
this.mProfileClass = profileClass;
|
||||
this.mState = state;
|
||||
this.mCarrierIdentifier = carrierIdentifier;
|
||||
this.mPolicyRules = policyRules;
|
||||
if (accessRules != null && accessRules.size() > 0) {
|
||||
this.mAccessRules = accessRules.toArray(new UiccAccessRule[accessRules.size()]);
|
||||
} else {
|
||||
this.mAccessRules = null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets the ICCID string. */
|
||||
public String getIccid() {
|
||||
return iccid;
|
||||
return mIccid;
|
||||
}
|
||||
|
||||
/** Gets the access rules. */
|
||||
@Nullable
|
||||
public UiccAccessRule[] getUiccAccessRules() {
|
||||
return accessRules;
|
||||
public List<UiccAccessRule> getUiccAccessRules() {
|
||||
if (mAccessRules == null) return null;
|
||||
return Arrays.asList(mAccessRules);
|
||||
}
|
||||
|
||||
/** Gets the nickname. */
|
||||
@Nullable
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
return mNickname;
|
||||
}
|
||||
|
||||
/** Gets the service provider name. */
|
||||
public String getServiceProviderName() {
|
||||
return serviceProviderName;
|
||||
return mServiceProviderName;
|
||||
}
|
||||
|
||||
/** Gets the profile name. */
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
return mProfileName;
|
||||
}
|
||||
|
||||
/** Gets the profile class. */
|
||||
@ProfileClass
|
||||
public int getProfileClass() {
|
||||
return profileClass;
|
||||
return mProfileClass;
|
||||
}
|
||||
|
||||
/** Gets the state of the subscription. */
|
||||
@ProfileState
|
||||
public int getState() {
|
||||
return state;
|
||||
return mState;
|
||||
}
|
||||
|
||||
/** Gets the carrier identifier. */
|
||||
public CarrierIdentifier getCarrierIdentifier() {
|
||||
return carrierIdentifier;
|
||||
return mCarrierIdentifier;
|
||||
}
|
||||
|
||||
/** Gets the policy rules. */
|
||||
@PolicyRule
|
||||
public int getPolicyRules() {
|
||||
return policyRules;
|
||||
return mPolicyRules;
|
||||
}
|
||||
|
||||
/** Returns whether any policy rule exists. */
|
||||
public boolean hasPolicyRules() {
|
||||
return policyRules != 0;
|
||||
return mPolicyRules != 0;
|
||||
}
|
||||
|
||||
/** Checks whether a certain policy rule exists. */
|
||||
public boolean hasPolicyRule(@PolicyRule int policy) {
|
||||
return (policyRules & policy) != 0;
|
||||
return (mPolicyRules & policy) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -387,50 +402,50 @@ public final class EuiccProfileInfo implements Parcelable {
|
||||
}
|
||||
|
||||
EuiccProfileInfo that = (EuiccProfileInfo) obj;
|
||||
return Objects.equals(iccid, that.iccid)
|
||||
&& Objects.equals(nickname, that.nickname)
|
||||
&& Objects.equals(serviceProviderName, that.serviceProviderName)
|
||||
&& Objects.equals(profileName, that.profileName)
|
||||
&& profileClass == that.profileClass
|
||||
&& state == that.state
|
||||
&& Objects.equals(carrierIdentifier, that.carrierIdentifier)
|
||||
&& policyRules == that.policyRules
|
||||
&& Arrays.equals(accessRules, that.accessRules);
|
||||
return Objects.equals(mIccid, that.mIccid)
|
||||
&& Objects.equals(mNickname, that.mNickname)
|
||||
&& Objects.equals(mServiceProviderName, that.mServiceProviderName)
|
||||
&& Objects.equals(mProfileName, that.mProfileName)
|
||||
&& mProfileClass == that.mProfileClass
|
||||
&& mState == that.mState
|
||||
&& Objects.equals(mCarrierIdentifier, that.mCarrierIdentifier)
|
||||
&& mPolicyRules == that.mPolicyRules
|
||||
&& Arrays.equals(mAccessRules, that.mAccessRules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 1;
|
||||
result = 31 * result + Objects.hashCode(iccid);
|
||||
result = 31 * result + Objects.hashCode(nickname);
|
||||
result = 31 * result + Objects.hashCode(serviceProviderName);
|
||||
result = 31 * result + Objects.hashCode(profileName);
|
||||
result = 31 * result + profileClass;
|
||||
result = 31 * result + state;
|
||||
result = 31 * result + Objects.hashCode(carrierIdentifier);
|
||||
result = 31 * result + policyRules;
|
||||
result = 31 * result + Arrays.hashCode(accessRules);
|
||||
result = 31 * result + Objects.hashCode(mIccid);
|
||||
result = 31 * result + Objects.hashCode(mNickname);
|
||||
result = 31 * result + Objects.hashCode(mServiceProviderName);
|
||||
result = 31 * result + Objects.hashCode(mProfileName);
|
||||
result = 31 * result + mProfileClass;
|
||||
result = 31 * result + mState;
|
||||
result = 31 * result + Objects.hashCode(mCarrierIdentifier);
|
||||
result = 31 * result + mPolicyRules;
|
||||
result = 31 * result + Arrays.hashCode(mAccessRules);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EuiccProfileInfo (nickname="
|
||||
+ nickname
|
||||
+ mNickname
|
||||
+ ", serviceProviderName="
|
||||
+ serviceProviderName
|
||||
+ mServiceProviderName
|
||||
+ ", profileName="
|
||||
+ profileName
|
||||
+ mProfileName
|
||||
+ ", profileClass="
|
||||
+ profileClass
|
||||
+ mProfileClass
|
||||
+ ", state="
|
||||
+ state
|
||||
+ mState
|
||||
+ ", CarrierIdentifier="
|
||||
+ carrierIdentifier.toString()
|
||||
+ mCarrierIdentifier.toString()
|
||||
+ ", policyRules="
|
||||
+ policyRules
|
||||
+ mPolicyRules
|
||||
+ ", accessRules="
|
||||
+ Arrays.toString(accessRules)
|
||||
+ Arrays.toString(mAccessRules)
|
||||
+ ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package android.service.euicc;
|
||||
|
||||
import android.annotation.CallSuper;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
@@ -41,8 +42,11 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* <p>To implement the LPA backend, you must extend this class and declare this service in your
|
||||
* manifest file. The service must require the
|
||||
* {@link android.Manifest.permission#BIND_EUICC_SERVICE} permission and include an intent filter
|
||||
* with the {@link #EUICC_SERVICE_INTERFACE} action. The priority of the intent filter must be set
|
||||
* to a non-zero value in case multiple implementations are present on the device. For example:
|
||||
* with the {@link #EUICC_SERVICE_INTERFACE} action. It's suggested that the priority of the intent
|
||||
* filter to be set to a non-zero value in case multiple implementations are present on the device.
|
||||
* See the below example. Note that there will be problem if two LPAs are present and they have the
|
||||
* same priority.
|
||||
* Example:
|
||||
*
|
||||
* <pre>{@code
|
||||
* <service android:name=".MyEuiccService"
|
||||
@@ -65,9 +69,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* filter with the appropriate action, the {@link #CATEGORY_EUICC_UI} category, and a non-zero
|
||||
* priority.
|
||||
*
|
||||
* TODO(b/35851809): Make this a SystemApi.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public abstract class EuiccService extends Service {
|
||||
/** Action which must be included in this service's intent filter. */
|
||||
public static final String EUICC_SERVICE_INTERFACE = "android.service.euicc.EuiccService";
|
||||
@@ -77,7 +81,10 @@ public abstract class EuiccService extends Service {
|
||||
|
||||
// LUI actions. These are passthroughs of the corresponding EuiccManager actions.
|
||||
|
||||
/** @see android.telephony.euicc.EuiccManager#ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS */
|
||||
/**
|
||||
* @see android.telephony.euicc.EuiccManager#ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS
|
||||
* The difference is this one is used by system to bring up the LUI.
|
||||
*/
|
||||
public static final String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS =
|
||||
"android.service.euicc.action.MANAGE_EMBEDDED_SUBSCRIPTIONS";
|
||||
/** @see android.telephony.euicc.EuiccManager#ACTION_PROVISION_EMBEDDED_SUBSCRIPTION */
|
||||
@@ -88,7 +95,10 @@ public abstract class EuiccService extends Service {
|
||||
// require user interaction.
|
||||
// TODO(b/33075886): Define extras for any input parameters to these dialogs once they are
|
||||
// more scoped out.
|
||||
/** Alert the user that this action will result in an active SIM being deactivated. */
|
||||
/**
|
||||
* Alert the user that this action will result in an active SIM being deactivated.
|
||||
* To implement the LUI triggered by the system, you need to define this in AndroidManifest.xml.
|
||||
*/
|
||||
public static final String ACTION_RESOLVE_DEACTIVATE_SIM =
|
||||
"android.service.euicc.action.RESOLVE_DEACTIVATE_SIM";
|
||||
/**
|
||||
@@ -102,7 +112,11 @@ public abstract class EuiccService extends Service {
|
||||
public static final String ACTION_RESOLVE_CONFIRMATION_CODE =
|
||||
"android.service.euicc.action.RESOLVE_CONFIRMATION_CODE";
|
||||
|
||||
/** Intent extra set for resolution requests containing the package name of the calling app. */
|
||||
/**
|
||||
* Intent extra set for resolution requests containing the package name of the calling app.
|
||||
* This is used by the above actions including ACTION_RESOLVE_DEACTIVATE_SIM,
|
||||
* ACTION_RESOLVE_NO_PRIVILEGES and ACTION_RESOLVE_CONFIRMATION_CODE.
|
||||
*/
|
||||
public static final String EXTRA_RESOLUTION_CALLING_PACKAGE =
|
||||
"android.service.euicc.extra.RESOLUTION_CALLING_PACKAGE";
|
||||
|
||||
@@ -136,10 +150,18 @@ public abstract class EuiccService extends Service {
|
||||
RESOLUTION_ACTIONS.add(EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE);
|
||||
}
|
||||
|
||||
/** Boolean extra for resolution actions indicating whether the user granted consent. */
|
||||
public static final String RESOLUTION_EXTRA_CONSENT = "consent";
|
||||
/** String extra for resolution actions indicating the carrier confirmation code. */
|
||||
public static final String RESOLUTION_EXTRA_CONFIRMATION_CODE = "confirmation_code";
|
||||
/**
|
||||
* Boolean extra for resolution actions indicating whether the user granted consent.
|
||||
* This is used and set by the implementation and used in {@code EuiccOperation}.
|
||||
*/
|
||||
public static final String EXTRA_RESOLUTION_CONSENT =
|
||||
"android.service.euicc.extra.RESOLUTION_CONSENT";
|
||||
/**
|
||||
* String extra for resolution actions indicating the carrier confirmation code.
|
||||
* This is used and set by the implementation and used in {@code EuiccOperation}.
|
||||
*/
|
||||
public static final String EXTRA_RESOLUTION_CONFIRMATION_CODE =
|
||||
"android.service.euicc.extra.RESOLUTION_CONFIRMATION_CODE";
|
||||
|
||||
private final IEuiccService.Stub mStubWrapper;
|
||||
|
||||
@@ -199,9 +221,9 @@ public abstract class EuiccService extends Service {
|
||||
*
|
||||
* @see IEuiccService#startOtaIfNecessary
|
||||
*/
|
||||
public interface OtaStatusChangedCallback {
|
||||
public abstract static class OtaStatusChangedCallback {
|
||||
/** Called when OTA status is changed. */
|
||||
void onOtaStatusChanged(int status);
|
||||
abstract void onOtaStatusChanged(int status);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,8 +260,7 @@ public abstract class EuiccService extends Service {
|
||||
/**
|
||||
* Populate {@link DownloadableSubscription} metadata for the given downloadable subscription.
|
||||
*
|
||||
* @param slotId ID of the SIM slot to use for the operation. This is currently not populated
|
||||
* but is here to future-proof the APIs.
|
||||
* @param slotId ID of the SIM slot to use for the operation.
|
||||
* @param subscription A subscription whose metadata needs to be populated.
|
||||
* @param forceDeactivateSim If true, and if an active SIM must be deactivated to access the
|
||||
* eUICC, perform this action automatically. Otherwise, {@link #RESULT_MUST_DEACTIVATE_SIM)}
|
||||
@@ -267,8 +288,7 @@ public abstract class EuiccService extends Service {
|
||||
/**
|
||||
* Download the given subscription.
|
||||
*
|
||||
* @param slotId ID of the SIM slot to use for the operation. This is currently not populated
|
||||
* but is here to future-proof the APIs.
|
||||
* @param slotId ID of the SIM slot to use for the operation.
|
||||
* @param subscription The subscription to download.
|
||||
* @param switchAfterDownload If true, the subscription should be enabled upon successful
|
||||
* download.
|
||||
@@ -286,8 +306,7 @@ public abstract class EuiccService extends Service {
|
||||
/**
|
||||
* Return a list of all @link EuiccProfileInfo}s.
|
||||
*
|
||||
* @param slotId ID of the SIM slot to use for the operation. This is currently not populated
|
||||
* but is here to future-proof the APIs.
|
||||
* @param slotId ID of the SIM slot to use for the operation.
|
||||
* @return The result of the operation.
|
||||
* @see android.telephony.SubscriptionManager#getAvailableSubscriptionInfoList
|
||||
* @see android.telephony.SubscriptionManager#getAccessibleSubscriptionInfoList
|
||||
@@ -297,8 +316,7 @@ public abstract class EuiccService extends Service {
|
||||
/**
|
||||
* Return info about the eUICC chip/device.
|
||||
*
|
||||
* @param slotId ID of the SIM slot to use for the operation. This is currently not populated
|
||||
* but is here to future-proof the APIs.
|
||||
* @param slotId ID of the SIM slot to use for the operation.
|
||||
* @return the {@link EuiccInfo} for the eUICC chip/device.
|
||||
* @see android.telephony.euicc.EuiccManager#getEuiccInfo
|
||||
*/
|
||||
@@ -310,8 +328,7 @@ public abstract class EuiccService extends Service {
|
||||
* <p>If the subscription is currently active, it should be deactivated first (equivalent to a
|
||||
* physical SIM being ejected).
|
||||
*
|
||||
* @param slotId ID of the SIM slot to use for the operation. This is currently not populated
|
||||
* but is here to future-proof the APIs.
|
||||
* @param slotId ID of the SIM slot to use for the operation.
|
||||
* @param iccid the ICCID of the subscription to delete.
|
||||
* @return the result of the delete operation. May be one of the predefined {@code RESULT_}
|
||||
* constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}.
|
||||
@@ -322,8 +339,7 @@ public abstract class EuiccService extends Service {
|
||||
/**
|
||||
* Switch to the given subscription.
|
||||
*
|
||||
* @param slotId ID of the SIM slot to use for the operation. This is currently not populated
|
||||
* but is here to future-proof the APIs.
|
||||
* @param slotId ID of the SIM slot to use for the operation.
|
||||
* @param iccid the ICCID of the subscription to enable. May be null, in which case the current
|
||||
* profile should be deactivated and no profile should be activated to replace it - this is
|
||||
* equivalent to a physical SIM being ejected.
|
||||
@@ -340,8 +356,7 @@ public abstract class EuiccService extends Service {
|
||||
/**
|
||||
* Update the nickname of the given subscription.
|
||||
*
|
||||
* @param slotId ID of the SIM slot to use for the operation. This is currently not populated
|
||||
* but is here to future-proof the APIs.
|
||||
* @param slotId ID of the SIM slot to use for the operation.
|
||||
* @param iccid the ICCID of the subscription to update.
|
||||
* @param nickname the new nickname to apply.
|
||||
* @return the result of the update operation. May be one of the predefined {@code RESULT_}
|
||||
|
||||
@@ -16,16 +16,19 @@
|
||||
package android.service.euicc;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.euicc.DownloadableSubscription;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Result of a {@link EuiccService#onGetDefaultDownloadableSubscriptionList} operation.
|
||||
* @hide
|
||||
*
|
||||
* TODO(b/35851809): Make this a SystemApi.
|
||||
*/
|
||||
@SystemApi
|
||||
public final class GetDefaultDownloadableSubscriptionListResult implements Parcelable {
|
||||
|
||||
public static final Creator<GetDefaultDownloadableSubscriptionListResult> CREATOR =
|
||||
@@ -42,20 +45,35 @@ public final class GetDefaultDownloadableSubscriptionListResult implements Parce
|
||||
};
|
||||
|
||||
/**
|
||||
* Result of the operation.
|
||||
* @hide
|
||||
* @deprecated - Do no use. Use getResult() instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final int result;
|
||||
|
||||
@Nullable
|
||||
private final DownloadableSubscription[] mSubscriptions;
|
||||
|
||||
/**
|
||||
* Gets the result of the operation.
|
||||
*
|
||||
* <p>May be one of the predefined {@code RESULT_} constants in EuiccService or any
|
||||
* implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}.
|
||||
*/
|
||||
public final int result;
|
||||
public int getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The available {@link DownloadableSubscription}s (with filled-in metadata).
|
||||
* Gets the available {@link DownloadableSubscription}s (with filled-in metadata).
|
||||
*
|
||||
* <p>Only non-null if {@link #result} is {@link EuiccService#RESULT_OK}.
|
||||
*/
|
||||
@Nullable
|
||||
public final DownloadableSubscription[] subscriptions;
|
||||
public List<DownloadableSubscription> getDownloadableSubscriptions() {
|
||||
if (mSubscriptions == null) return null;
|
||||
return Arrays.asList(mSubscriptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new {@link GetDefaultDownloadableSubscriptionListResult}.
|
||||
@@ -70,25 +88,25 @@ public final class GetDefaultDownloadableSubscriptionListResult implements Parce
|
||||
@Nullable DownloadableSubscription[] subscriptions) {
|
||||
this.result = result;
|
||||
if (this.result == EuiccService.RESULT_OK) {
|
||||
this.subscriptions = subscriptions;
|
||||
this.mSubscriptions = subscriptions;
|
||||
} else {
|
||||
if (subscriptions != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Error result with non-null subscriptions: " + result);
|
||||
}
|
||||
this.subscriptions = null;
|
||||
this.mSubscriptions = null;
|
||||
}
|
||||
}
|
||||
|
||||
private GetDefaultDownloadableSubscriptionListResult(Parcel in) {
|
||||
this.result = in.readInt();
|
||||
this.subscriptions = in.createTypedArray(DownloadableSubscription.CREATOR);
|
||||
this.mSubscriptions = in.createTypedArray(DownloadableSubscription.CREATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(result);
|
||||
dest.writeTypedArray(subscriptions, flags);
|
||||
dest.writeTypedArray(mSubscriptions, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package android.service.euicc;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.euicc.DownloadableSubscription;
|
||||
@@ -23,9 +24,8 @@ import android.telephony.euicc.DownloadableSubscription;
|
||||
/**
|
||||
* Result of a {@link EuiccService#onGetDownloadableSubscriptionMetadata} operation.
|
||||
* @hide
|
||||
*
|
||||
* TODO(b/35851809): Make this a SystemApi.
|
||||
*/
|
||||
@SystemApi
|
||||
public final class GetDownloadableSubscriptionMetadataResult implements Parcelable {
|
||||
|
||||
public static final Creator<GetDownloadableSubscriptionMetadataResult> CREATOR =
|
||||
@@ -42,20 +42,34 @@ public final class GetDownloadableSubscriptionMetadataResult implements Parcelab
|
||||
};
|
||||
|
||||
/**
|
||||
* Result of the operation.
|
||||
* @hide
|
||||
* @deprecated - Do no use. Use getResult() instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final int result;
|
||||
|
||||
@Nullable
|
||||
private final DownloadableSubscription mSubscription;
|
||||
|
||||
/**
|
||||
* Gets the result of the operation.
|
||||
*
|
||||
* <p>May be one of the predefined {@code RESULT_} constants in EuiccService or any
|
||||
* implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}.
|
||||
*/
|
||||
public final int result;
|
||||
public int getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link DownloadableSubscription} with filled-in metadata.
|
||||
* Gets the {@link DownloadableSubscription} with filled-in metadata.
|
||||
*
|
||||
* <p>Only non-null if {@link #result} is {@link EuiccService#RESULT_OK}.
|
||||
*/
|
||||
@Nullable
|
||||
public final DownloadableSubscription subscription;
|
||||
public DownloadableSubscription getDownloadableSubscription() {
|
||||
return mSubscription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new {@link GetDownloadableSubscriptionMetadataResult}.
|
||||
@@ -70,25 +84,25 @@ public final class GetDownloadableSubscriptionMetadataResult implements Parcelab
|
||||
@Nullable DownloadableSubscription subscription) {
|
||||
this.result = result;
|
||||
if (this.result == EuiccService.RESULT_OK) {
|
||||
this.subscription = subscription;
|
||||
this.mSubscription = subscription;
|
||||
} else {
|
||||
if (subscription != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Error result with non-null subscription: " + result);
|
||||
}
|
||||
this.subscription = null;
|
||||
this.mSubscription = null;
|
||||
}
|
||||
}
|
||||
|
||||
private GetDownloadableSubscriptionMetadataResult(Parcel in) {
|
||||
this.result = in.readInt();
|
||||
this.subscription = in.readTypedObject(DownloadableSubscription.CREATOR);
|
||||
this.mSubscription = in.readTypedObject(DownloadableSubscription.CREATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(result);
|
||||
dest.writeTypedObject(this.subscription, flags);
|
||||
dest.writeTypedObject(this.mSubscription, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,15 +16,18 @@
|
||||
package android.service.euicc;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Result of a {@link EuiccService#onGetEuiccProfileInfoList} operation.
|
||||
* @hide
|
||||
*
|
||||
* TODO(b/35851809): Make this a SystemApi.
|
||||
*/
|
||||
@SystemApi
|
||||
public final class GetEuiccProfileInfoListResult implements Parcelable {
|
||||
|
||||
public static final Creator<GetEuiccProfileInfoListResult> CREATOR =
|
||||
@@ -41,19 +44,38 @@ public final class GetEuiccProfileInfoListResult implements Parcelable {
|
||||
};
|
||||
|
||||
/**
|
||||
* Result of the operation.
|
||||
* @hide
|
||||
* @deprecated - Do no use. Use getResult() instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final int result;
|
||||
|
||||
@Nullable
|
||||
private final EuiccProfileInfo[] mProfiles;
|
||||
|
||||
private final boolean mIsRemovable;
|
||||
|
||||
/**
|
||||
* Gets the result of the operation.
|
||||
*
|
||||
* <p>May be one of the predefined {@code RESULT_} constants in EuiccService or any
|
||||
* implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}.
|
||||
*/
|
||||
public final int result;
|
||||
public int getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** The profile list (only upon success). */
|
||||
/** Gets the profile list (only upon success). */
|
||||
@Nullable
|
||||
public final EuiccProfileInfo[] profiles;
|
||||
public List<EuiccProfileInfo> getProfiles() {
|
||||
if (mProfiles == null) return null;
|
||||
return Arrays.asList(mProfiles);
|
||||
}
|
||||
|
||||
/** Whether the eUICC is removable. */
|
||||
public final boolean isRemovable;
|
||||
/** Gets whether the eUICC is removable. */
|
||||
public boolean getIsRemovable() {
|
||||
return mIsRemovable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new {@link GetEuiccProfileInfoListResult}.
|
||||
@@ -71,30 +93,29 @@ public final class GetEuiccProfileInfoListResult implements Parcelable {
|
||||
public GetEuiccProfileInfoListResult(
|
||||
int result, @Nullable EuiccProfileInfo[] profiles, boolean isRemovable) {
|
||||
this.result = result;
|
||||
this.isRemovable = isRemovable;
|
||||
this.mIsRemovable = isRemovable;
|
||||
if (this.result == EuiccService.RESULT_OK) {
|
||||
this.profiles = profiles;
|
||||
this.mProfiles = profiles;
|
||||
} else {
|
||||
if (profiles != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Error result with non-null profiles: " + result);
|
||||
}
|
||||
this.profiles = null;
|
||||
this.mProfiles = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private GetEuiccProfileInfoListResult(Parcel in) {
|
||||
this.result = in.readInt();
|
||||
this.profiles = in.createTypedArray(EuiccProfileInfo.CREATOR);
|
||||
this.isRemovable = in.readBoolean();
|
||||
this.mProfiles = in.createTypedArray(EuiccProfileInfo.CREATOR);
|
||||
this.mIsRemovable = in.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(result);
|
||||
dest.writeTypedArray(profiles, flags);
|
||||
dest.writeBoolean(isRemovable);
|
||||
dest.writeTypedArray(mProfiles, flags);
|
||||
dest.writeBoolean(mIsRemovable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user