Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fe6845f authored by Jordan Liu's avatar Jordan Liu
Browse files

Implement isRemovable

Add resource non_removable_euicc_slots which lists the slot indexes
which refer to non-removable eUICCs chips.

Test: EuiccCardTest
Bug: 122738148
Change-Id: I8836e25acf37527bbb067538902de056e1465b31
Merged-In: I8836e25acf37527bbb067538902de056e1465b31
parent 0dddb902
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43234,13 +43234,13 @@ package android.telephony {
  }
  public final class UiccCardInfo implements android.os.Parcelable {
    ctor public UiccCardInfo(boolean, int, String, String, int);
    method public int describeContents();
    method public int getCardId();
    method public String getEid();
    method public String getIccId();
    method public int getSlotIndex();
    method public boolean isEuicc();
    method public boolean isRemovable();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.UiccCardInfo> CREATOR;
  }
+2 −1
Original line number Diff line number Diff line
@@ -6467,7 +6467,7 @@ package android.telephony {
  }
  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 String getCardId();
    method public int getCardStateInfo();
@@ -6475,6 +6475,7 @@ package android.telephony {
    method public boolean getIsEuicc();
    method public boolean getIsExtendedApduSupported();
    method public int getLogicalSlotIdx();
    method public boolean isRemovable();
    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_ERROR = 3; // 0x3
+16 −0
Original line number Diff line number Diff line
@@ -185,4 +185,20 @@
        <item>@string/app_info</item>
    </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>
+2 −0
Original line number Diff line number Diff line
@@ -2844,6 +2844,8 @@
  <java-symbol type="array" name="resolver_target_actions_pin" />
  <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_text" />
  <java-symbol type="string" name="install_carrier_app_notification_text_app_name" />
+26 −5
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ public final class UiccCardInfo implements Parcelable {
    private final String mEid;
    private final String mIccId;
    private final int mSlotIndex;
    private final boolean mIsRemovable;

    public static final Creator<UiccCardInfo> CREATOR = new Creator<UiccCardInfo>() {
        @Override
@@ -49,6 +50,7 @@ public final class UiccCardInfo implements Parcelable {
        mEid = in.readString();
        mIccId = in.readString();
        mSlotIndex = in.readInt();
        mIsRemovable = in.readByte() != 0;
    }

    @Override
@@ -58,6 +60,7 @@ public final class UiccCardInfo implements Parcelable {
        dest.writeString(mEid);
        dest.writeString(mIccId);
        dest.writeInt(mSlotIndex);
        dest.writeByte((byte) (mIsRemovable ? 1 : 0));
    }

    @Override
@@ -65,16 +68,21 @@ public final class UiccCardInfo implements Parcelable {
        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.mCardId = cardId;
        this.mEid = eid;
        this.mIccId = iccId;
        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.
     */
    public boolean isEuicc() {
@@ -127,7 +135,17 @@ public final class UiccCardInfo implements Parcelable {
     * @hide
     */
    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
@@ -144,12 +162,13 @@ public final class UiccCardInfo implements Parcelable {
                && (mCardId == that.mCardId)
                && (Objects.equals(mEid, that.mEid))
                && (Objects.equals(mIccId, that.mIccId))
                && (mSlotIndex == that.mSlotIndex));
                && (mSlotIndex == that.mSlotIndex)
                && (mIsRemovable == that.mIsRemovable));
    }

    @Override
    public int hashCode() {
        return Objects.hash(mIsEuicc, mCardId, mEid, mIccId, mSlotIndex);
        return Objects.hash(mIsEuicc, mCardId, mEid, mIccId, mSlotIndex, mIsRemovable);
    }

    @Override
@@ -164,6 +183,8 @@ public final class UiccCardInfo implements Parcelable {
                + mIccId
                + ", mSlotIndex="
                + mSlotIndex
                + ", mIsRemovable="
                + mIsRemovable
                + ")";
    }
}
Loading