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

Commit f787eede authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[MEP] Add temporary change to switching between PORT TAG(9F20 and 9F24)...

Merge "[MEP] Add temporary change to switching between PORT TAG(9F20 and 9F24) based on ATR strings as not all C10P10 proto and EVTs are having the latest M5." into tm-dev
parents 9d8f7e53 c68a0ae5
Loading
Loading
Loading
Loading
+24 −6
Original line number Diff line number Diff line
@@ -101,6 +101,9 @@ public class EuiccPort extends UiccPort {
    private static final String DEV_CAP_NR5GC = "nr5gc";
    private static final String DEV_CAP_EUTRAN5GC = "eutran5gc";

    private static final String ATR_ESIM_OS_V_M5 =
            "3B9F97C00AB1FE453FC6838031E073FE211F65D002341569810F21";

    // These interfaces are used for simplifying the code by leveraging lambdas.
    private interface ApduRequestBuilder {
        void build(RequestBuilder requestBuilder)
@@ -125,6 +128,7 @@ public class EuiccPort extends UiccPort {
    private volatile String mEid;
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    public boolean mIsSupportsMultipleEnabledProfiles;
    private String mAtr;

    public EuiccPort(Context c, CommandsInterface ci, IccCardStatus ics, int phoneId, Object lock,
            UiccCard card, boolean isSupportsMultipleEnabledProfiles) {
@@ -137,6 +141,7 @@ public class EuiccPort extends UiccPort {
            mEid = ics.eid;
            mCardId = ics.eid;
        }
        mAtr = ics.atr;
        mIsSupportsMultipleEnabledProfiles = isSupportsMultipleEnabledProfiles;
    }

@@ -160,6 +165,7 @@ public class EuiccPort extends UiccPort {
            if (!TextUtils.isEmpty(ics.eid)) {
                mEid = ics.eid;
            }
            mAtr = ics.atr;
            super.update(c, ci, ics, uiccCard);
        }
    }
@@ -181,8 +187,13 @@ public class EuiccPort extends UiccPort {
     * @since 1.1.0 [GSMA SGP.22]
     */
    public void getAllProfiles(AsyncResultCallback<EuiccProfileInfo[]> callback, Handler handler) {
        byte[] profileTags = mIsSupportsMultipleEnabledProfiles ? Tags.EUICC_PROFILE_MEP_TAGS
                : Tags.EUICC_PROFILE_TAGS;
        byte[] profileTags;
        if (mIsSupportsMultipleEnabledProfiles) {
            profileTags = ATR_ESIM_OS_V_M5.equals(mAtr)
                    ? Tags.EUICC_PROFILE_MEP_TAGS : Tags.EUICC_PROFILE_MEP_TAGS_WITH_9F20;
        } else {
            profileTags = Tags.EUICC_PROFILE_TAGS;
        }
        sendApdu(
                newRequestProvider((RequestBuilder requestBuilder) ->
                        requestBuilder.addStoreData(Asn1Node.newBuilder(Tags.TAG_GET_PROFILES)
@@ -223,8 +234,13 @@ public class EuiccPort extends UiccPort {
     */
    public final void getProfile(String iccid, AsyncResultCallback<EuiccProfileInfo> callback,
            Handler handler) {
        byte[] profileTags = mIsSupportsMultipleEnabledProfiles ? Tags.EUICC_PROFILE_MEP_TAGS
                : Tags.EUICC_PROFILE_TAGS;
        byte[] profileTags;
        if (mIsSupportsMultipleEnabledProfiles) {
            profileTags = ATR_ESIM_OS_V_M5.equals(mAtr)
                    ? Tags.EUICC_PROFILE_MEP_TAGS : Tags.EUICC_PROFILE_MEP_TAGS_WITH_9F20;
        } else {
            profileTags = Tags.EUICC_PROFILE_TAGS;
        }
        sendApdu(
                newRequestProvider((RequestBuilder requestBuilder) ->
                        requestBuilder.addStoreData(Asn1Node.newBuilder(Tags.TAG_GET_PROFILES)
@@ -1244,8 +1260,10 @@ public class EuiccPort extends UiccPort {
            // if the Profile is in the Enabled state on the same eSIM Port as where this
            // getProfilesInfo command was sent. So should check for enabledOnEsimPort(TAG_PORT)
            // tag and verify its value is a valid port (means port value is >=0) or not.
            if (profileNode.hasChild(Tags.TAG_PORT)
                    && profileNode.getChild(Tags.TAG_PORT).asInteger() >= 0) {
            if ((profileNode.hasChild(Tags.TAG_PORT)
                    && profileNode.getChild(Tags.TAG_PORT).asInteger() >= 0)
                    || (profileNode.hasChild(Tags.TAG_PORT_9F20)
                    && profileNode.getChild(Tags.TAG_PORT_9F20).asInteger() >= 0)) {
                profileBuilder.setState(EuiccProfileInfo.PROFILE_STATE_ENABLED);
            } else {
                // noinspection WrongConstant
+21 −3
Original line number Diff line number Diff line
@@ -84,9 +84,10 @@ class Tags {
    static final int TAG_PROFILE_NAME = 0x92;
    static final int TAG_OPERATOR_ID = 0xB7;
    static final int TAG_CARRIER_PRIVILEGE_RULES = 0xBF76;
    // TODO: Changed Port tag to 9F20 to unblock modem team. Once modem team is ready,
    //  revert back to 9F24.
    static final int TAG_PORT = 0x9F20;
    // TODO: PORT TAG(9F20 OR 9F24) will be used based on ATR Strings because not all MEP capable
    //  devices have M5 OS. Once modem team is ready, revert back to 9F24 TAG only.
    static final int TAG_PORT = 0x9F24;
    static final int TAG_PORT_9F20 = 0x9F20;

    // Tags from the RefArDo data standard - https://source.android.com/devices/tech/config/uicc
    static final int TAG_REF_AR_DO = 0xE2;
@@ -128,5 +129,22 @@ class Tags {
            (byte) (TAG_PORT % 256),
    };

    // TAG list for Euicc Profile with 9F20 tag.
    // TODO: This is temporary change, should be removed once all devices are upgraded to M5 OS.
    static final byte[] EUICC_PROFILE_MEP_TAGS_WITH_9F20 = new byte[] {
            TAG_ICCID,
            (byte) TAG_NICKNAME,
            (byte) TAG_SERVICE_PROVIDER_NAME,
            (byte) TAG_PROFILE_NAME,
            (byte) TAG_OPERATOR_ID,
            (byte) (TAG_PROFILE_STATE / 256),
            (byte) (TAG_PROFILE_STATE % 256),
            (byte) TAG_PROFILE_CLASS,
            (byte) TAG_PROFILE_POLICY_RULE,
            (byte) (TAG_CARRIER_PRIVILEGE_RULES / 256),
            (byte) (TAG_CARRIER_PRIVILEGE_RULES % 256),
            (byte) (TAG_PORT_9F20 / 256),
            (byte) (TAG_PORT_9F20 % 256),
    };
    private Tags() {}
}