Merge "Implement isRemovable"

This commit is contained in:
Jordan Liu
2019-02-27 20:40:31 +00:00
committed by Gerrit Code Review
6 changed files with 88 additions and 10 deletions

View File

@@ -43238,13 +43238,13 @@ package android.telephony {
} }
public final class UiccCardInfo implements android.os.Parcelable { public final class UiccCardInfo implements android.os.Parcelable {
ctor public UiccCardInfo(boolean, int, String, String, int);
method public int describeContents(); method public int describeContents();
method public int getCardId(); method public int getCardId();
method public String getEid(); method public String getEid();
method public String getIccId(); method public String getIccId();
method public int getSlotIndex(); method public int getSlotIndex();
method public boolean isEuicc(); method public boolean isEuicc();
method public boolean isRemovable();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.UiccCardInfo> CREATOR; field public static final android.os.Parcelable.Creator<android.telephony.UiccCardInfo> CREATOR;
} }

View File

@@ -6476,7 +6476,7 @@ package android.telephony {
} }
public class UiccSlotInfo implements android.os.Parcelable { public class UiccSlotInfo implements android.os.Parcelable {
ctor public UiccSlotInfo(boolean, boolean, String, int, int, boolean); ctor @Deprecated public UiccSlotInfo(boolean, boolean, String, int, int, boolean);
method public int describeContents(); method public int describeContents();
method public String getCardId(); method public String getCardId();
method public int getCardStateInfo(); method public int getCardStateInfo();
@@ -6484,6 +6484,7 @@ package android.telephony {
method public boolean getIsEuicc(); method public boolean getIsEuicc();
method public boolean getIsExtendedApduSupported(); method public boolean getIsExtendedApduSupported();
method public int getLogicalSlotIdx(); method public int getLogicalSlotIdx();
method public boolean isRemovable();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final int CARD_STATE_INFO_ABSENT = 1; // 0x1 field public static final int CARD_STATE_INFO_ABSENT = 1; // 0x1
field public static final int CARD_STATE_INFO_ERROR = 3; // 0x3 field public static final int CARD_STATE_INFO_ERROR = 3; // 0x3

View File

@@ -185,4 +185,20 @@
<item>@string/app_info</item> <item>@string/app_info</item>
</string-array> </string-array>
<!-- Device-specific array of SIM slot indexes which are are embedded eUICCs.
e.g. If a device has two physical slots with indexes 0, 1, and slot 1 is an
eUICC, then the value of this array should be:
<integer-array name="non_removable_euicc_slots">
<item>1</item>
</integer-array>
If a device has three physical slots and slot 1 and 2 are eUICCs, then the value of
this array should be:
<integer-array name="non_removable_euicc_slots">
<item>1</item>
<item>2</item>
</integer-array>
This is used to differentiate between removable eUICCs and built in eUICCs, and should
be set by OEMs for devices which use eUICCs. -->
<integer-array name="non_removable_euicc_slots"></integer-array>
</resources> </resources>

View File

@@ -2844,6 +2844,8 @@
<java-symbol type="array" name="resolver_target_actions_pin" /> <java-symbol type="array" name="resolver_target_actions_pin" />
<java-symbol type="array" name="resolver_target_actions_unpin" /> <java-symbol type="array" name="resolver_target_actions_unpin" />
<java-symbol type="array" name="non_removable_euicc_slots" />
<java-symbol type="string" name="install_carrier_app_notification_title" /> <java-symbol type="string" name="install_carrier_app_notification_title" />
<java-symbol type="string" name="install_carrier_app_notification_text" /> <java-symbol type="string" name="install_carrier_app_notification_text" />
<java-symbol type="string" name="install_carrier_app_notification_text_app_name" /> <java-symbol type="string" name="install_carrier_app_notification_text_app_name" />

View File

@@ -30,6 +30,7 @@ public final class UiccCardInfo implements Parcelable {
private final String mEid; private final String mEid;
private final String mIccId; private final String mIccId;
private final int mSlotIndex; private final int mSlotIndex;
private final boolean mIsRemovable;
public static final Creator<UiccCardInfo> CREATOR = new Creator<UiccCardInfo>() { public static final Creator<UiccCardInfo> CREATOR = new Creator<UiccCardInfo>() {
@Override @Override
@@ -49,6 +50,7 @@ public final class UiccCardInfo implements Parcelable {
mEid = in.readString(); mEid = in.readString();
mIccId = in.readString(); mIccId = in.readString();
mSlotIndex = in.readInt(); mSlotIndex = in.readInt();
mIsRemovable = in.readByte() != 0;
} }
@Override @Override
@@ -58,6 +60,7 @@ public final class UiccCardInfo implements Parcelable {
dest.writeString(mEid); dest.writeString(mEid);
dest.writeString(mIccId); dest.writeString(mIccId);
dest.writeInt(mSlotIndex); dest.writeInt(mSlotIndex);
dest.writeByte((byte) (mIsRemovable ? 1 : 0));
} }
@Override @Override
@@ -65,16 +68,21 @@ public final class UiccCardInfo implements Parcelable {
return 0; return 0;
} }
public UiccCardInfo(boolean isEuicc, int cardId, String eid, String iccId, int slotIndex) { /**
* @hide
*/
public UiccCardInfo(boolean isEuicc, int cardId, String eid, String iccId, int slotIndex,
boolean isRemovable) {
this.mIsEuicc = isEuicc; this.mIsEuicc = isEuicc;
this.mCardId = cardId; this.mCardId = cardId;
this.mEid = eid; this.mEid = eid;
this.mIccId = iccId; this.mIccId = iccId;
this.mSlotIndex = slotIndex; this.mSlotIndex = slotIndex;
this.mIsRemovable = isRemovable;
} }
/** /**
* Return whether the UiccCardInfo is an eUICC. * Return whether the UICC is an eUICC.
* @return true if the UICC is an eUICC. * @return true if the UICC is an eUICC.
*/ */
public boolean isEuicc() { public boolean isEuicc() {
@@ -127,7 +135,17 @@ public final class UiccCardInfo implements Parcelable {
* @hide * @hide
*/ */
public UiccCardInfo getUnprivileged() { public UiccCardInfo getUnprivileged() {
return new UiccCardInfo(mIsEuicc, mCardId, null, null, mSlotIndex); return new UiccCardInfo(mIsEuicc, mCardId, null, null, mSlotIndex, mIsRemovable);
}
/**
* Return whether the UICC or eUICC is removable.
* <p>
* UICCs are generally removable, but eUICCs may be removable or built in to the device.
* @return true if the UICC or eUICC is removable
*/
public boolean isRemovable() {
return mIsRemovable;
} }
@Override @Override
@@ -144,12 +162,13 @@ public final class UiccCardInfo implements Parcelable {
&& (mCardId == that.mCardId) && (mCardId == that.mCardId)
&& (Objects.equals(mEid, that.mEid)) && (Objects.equals(mEid, that.mEid))
&& (Objects.equals(mIccId, that.mIccId)) && (Objects.equals(mIccId, that.mIccId))
&& (mSlotIndex == that.mSlotIndex)); && (mSlotIndex == that.mSlotIndex)
&& (mIsRemovable == that.mIsRemovable));
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(mIsEuicc, mCardId, mEid, mIccId, mSlotIndex); return Objects.hash(mIsEuicc, mCardId, mEid, mIccId, mSlotIndex, mIsRemovable);
} }
@Override @Override
@@ -164,6 +183,8 @@ public final class UiccCardInfo implements Parcelable {
+ mIccId + mIccId
+ ", mSlotIndex=" + ", mSlotIndex="
+ mSlotIndex + mSlotIndex
+ ", mIsRemovable="
+ mIsRemovable
+ ")"; + ")";
} }
} }

View File

@@ -15,15 +15,15 @@
*/ */
package android.telephony; package android.telephony;
import android.annotation.IntDef;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.util.Objects; import java.util.Objects;
import android.annotation.IntDef;
/** /**
* Class for the information of a UICC slot. * Class for the information of a UICC slot.
* @hide * @hide
@@ -61,6 +61,7 @@ public class UiccSlotInfo implements Parcelable {
private final @CardStateInfo int mCardStateInfo; private final @CardStateInfo int mCardStateInfo;
private final int mLogicalSlotIdx; private final int mLogicalSlotIdx;
private final boolean mIsExtendedApduSupported; private final boolean mIsExtendedApduSupported;
private final boolean mIsRemovable;
public static final Creator<UiccSlotInfo> CREATOR = new Creator<UiccSlotInfo>() { public static final Creator<UiccSlotInfo> CREATOR = new Creator<UiccSlotInfo>() {
@Override @Override
@@ -81,6 +82,7 @@ public class UiccSlotInfo implements Parcelable {
mCardStateInfo = in.readInt(); mCardStateInfo = in.readInt();
mLogicalSlotIdx = in.readInt(); mLogicalSlotIdx = in.readInt();
mIsExtendedApduSupported = in.readByte() != 0; mIsExtendedApduSupported = in.readByte() != 0;
mIsRemovable = in.readByte() != 0;
} }
@Override @Override
@@ -91,6 +93,7 @@ public class UiccSlotInfo implements Parcelable {
dest.writeInt(mCardStateInfo); dest.writeInt(mCardStateInfo);
dest.writeInt(mLogicalSlotIdx); dest.writeInt(mLogicalSlotIdx);
dest.writeByte((byte) (mIsExtendedApduSupported ? 1 : 0)); dest.writeByte((byte) (mIsExtendedApduSupported ? 1 : 0));
dest.writeByte((byte) (mIsRemovable ? 1 : 0));
} }
@Override @Override
@@ -98,6 +101,11 @@ public class UiccSlotInfo implements Parcelable {
return 0; return 0;
} }
/**
* Construct a UiccSlotInfo.
* @deprecated apps should not be constructing UiccSlotInfo objects
*/
@Deprecated
public UiccSlotInfo(boolean isActive, boolean isEuicc, String cardId, public UiccSlotInfo(boolean isActive, boolean isEuicc, String cardId,
@CardStateInfo int cardStateInfo, int logicalSlotIdx, boolean isExtendedApduSupported) { @CardStateInfo int cardStateInfo, int logicalSlotIdx, boolean isExtendedApduSupported) {
this.mIsActive = isActive; this.mIsActive = isActive;
@@ -106,6 +114,22 @@ public class UiccSlotInfo implements Parcelable {
this.mCardStateInfo = cardStateInfo; this.mCardStateInfo = cardStateInfo;
this.mLogicalSlotIdx = logicalSlotIdx; this.mLogicalSlotIdx = logicalSlotIdx;
this.mIsExtendedApduSupported = isExtendedApduSupported; this.mIsExtendedApduSupported = isExtendedApduSupported;
this.mIsRemovable = false;
}
/**
* @hide
*/
public UiccSlotInfo(boolean isActive, boolean isEuicc, String cardId,
@CardStateInfo int cardStateInfo, int logicalSlotIdx, boolean isExtendedApduSupported,
boolean isRemovable) {
this.mIsActive = isActive;
this.mIsEuicc = isEuicc;
this.mCardId = cardId;
this.mCardStateInfo = cardStateInfo;
this.mLogicalSlotIdx = logicalSlotIdx;
this.mIsExtendedApduSupported = isExtendedApduSupported;
this.mIsRemovable = isRemovable;
} }
public boolean getIsActive() { public boolean getIsActive() {
@@ -136,6 +160,16 @@ public class UiccSlotInfo implements Parcelable {
return mIsExtendedApduSupported; return mIsExtendedApduSupported;
} }
/**
* Return whether the UICC slot is for a removable UICC.
* <p>
* UICCs are generally removable, but eUICCs may be removable or built in to the device.
* @return true if the slot is for removable UICCs
*/
public boolean isRemovable() {
return mIsRemovable;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
@@ -151,7 +185,8 @@ public class UiccSlotInfo implements Parcelable {
&& (Objects.equals(mCardId, that.mCardId)) && (Objects.equals(mCardId, that.mCardId))
&& (mCardStateInfo == that.mCardStateInfo) && (mCardStateInfo == that.mCardStateInfo)
&& (mLogicalSlotIdx == that.mLogicalSlotIdx) && (mLogicalSlotIdx == that.mLogicalSlotIdx)
&& (mIsExtendedApduSupported == that.mIsExtendedApduSupported); && (mIsExtendedApduSupported == that.mIsExtendedApduSupported)
&& (mIsRemovable == that.mIsRemovable);
} }
@Override @Override
@@ -163,6 +198,7 @@ public class UiccSlotInfo implements Parcelable {
result = 31 * result + mCardStateInfo; result = 31 * result + mCardStateInfo;
result = 31 * result + mLogicalSlotIdx; result = 31 * result + mLogicalSlotIdx;
result = 31 * result + (mIsExtendedApduSupported ? 1 : 0); result = 31 * result + (mIsExtendedApduSupported ? 1 : 0);
result = 31 * result + (mIsRemovable ? 1 : 0);
return result; return result;
} }
@@ -180,6 +216,8 @@ public class UiccSlotInfo implements Parcelable {
+ mLogicalSlotIdx + mLogicalSlotIdx
+ ", mIsExtendedApduSupported=" + ", mIsExtendedApduSupported="
+ mIsExtendedApduSupported + mIsExtendedApduSupported
+ ", mIsRemovable="
+ mIsRemovable
+ ")"; + ")";
} }
} }