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

Commit 273df2e8 authored by Shivakumar Neginal's avatar Shivakumar Neginal
Browse files

Remove the temporary changes.

Remove switching between PORT TAG(9F20 and 9F24) based on ATR strings.

Test: Manually tested esim scenarios on C10/B3 device and atest executed
Bug: 227282066
Merged-In: I8faf9cf58db7c9204193643d4fa710d6d6608d55

Change-Id: I62fc1a359a50c05b21f5bd1750c7991f553d3fe4
parent c54fadb9
Loading
Loading
Loading
Loading
+6 −24
Original line number Diff line number Diff line
@@ -101,9 +101,6 @@ 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)
@@ -128,7 +125,6 @@ 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) {
@@ -141,7 +137,6 @@ public class EuiccPort extends UiccPort {
            mEid = ics.eid;
            mCardId = ics.eid;
        }
        mAtr = ics.atr;
        mIsSupportsMultipleEnabledProfiles = isSupportsMultipleEnabledProfiles;
    }

@@ -165,7 +160,6 @@ public class EuiccPort extends UiccPort {
            if (!TextUtils.isEmpty(ics.eid)) {
                mEid = ics.eid;
            }
            mAtr = ics.atr;
            super.update(c, ci, ics, uiccCard);
        }
    }
@@ -187,13 +181,8 @@ public class EuiccPort extends UiccPort {
     * @since 1.1.0 [GSMA SGP.22]
     */
    public void getAllProfiles(AsyncResultCallback<EuiccProfileInfo[]> callback, Handler handler) {
        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;
        }
        byte[] profileTags = mIsSupportsMultipleEnabledProfiles ? Tags.EUICC_PROFILE_MEP_TAGS
                : Tags.EUICC_PROFILE_TAGS;
        sendApdu(
                newRequestProvider((RequestBuilder requestBuilder) ->
                        requestBuilder.addStoreData(Asn1Node.newBuilder(Tags.TAG_GET_PROFILES)
@@ -234,13 +223,8 @@ public class EuiccPort extends UiccPort {
     */
    public final void getProfile(String iccid, AsyncResultCallback<EuiccProfileInfo> callback,
            Handler handler) {
        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;
        }
        byte[] profileTags = mIsSupportsMultipleEnabledProfiles ? Tags.EUICC_PROFILE_MEP_TAGS
                : Tags.EUICC_PROFILE_TAGS;
        sendApdu(
                newRequestProvider((RequestBuilder requestBuilder) ->
                        requestBuilder.addStoreData(Asn1Node.newBuilder(Tags.TAG_GET_PROFILES)
@@ -1260,10 +1244,8 @@ 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)
                    || (profileNode.hasChild(Tags.TAG_PORT_9F20)
                    && profileNode.getChild(Tags.TAG_PORT_9F20).asInteger() >= 0)) {
            if (profileNode.hasChild(Tags.TAG_PORT)
                    && profileNode.getChild(Tags.TAG_PORT).asInteger() >= 0) {
                profileBuilder.setState(EuiccProfileInfo.PROFILE_STATE_ENABLED);
            } else {
                // noinspection WrongConstant
+0 −20
Original line number Diff line number Diff line
@@ -84,10 +84,7 @@ 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: 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;
@@ -129,22 +126,5 @@ 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() {}
}
+4 −4
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ public class EuiccPortTest extends TelephonyTest {
        assertEquals(1, profiles.length);
        assertEquals("98760000000000543210", profiles[0].getIccid());
        assertEquals(EuiccProfileInfo.PROFILE_STATE_ENABLED, profiles[0].getState());
        verifyStoreData(channel, "BF2D0F5C0D5A909192B79F709599BF769F20");
        verifyStoreData(channel, "BF2D0F5C0D5A909192B79F709599BF769F24");
    }

    @Test
@@ -203,7 +203,7 @@ public class EuiccPortTest extends TelephonyTest {
    @Test
    public void testEnabledOnEsimPort_GetAllProfiles() {
        int channel = mockLogicalChannelResponses(
                "BF2D18A016E3145A0A896700000000004523019F7001009F2001019000");
                "BF2D18A016E3145A0A896700000000004523019F7001009F2401019000");

        ResultCaptor<EuiccProfileInfo[]> resultCaptor = new ResultCaptor<>();
        mEuiccPort.mIsSupportsMultipleEnabledProfiles = true; // MEP capable
@@ -218,7 +218,7 @@ public class EuiccPortTest extends TelephonyTest {
        // which is valid port. So the state should be enabled.
        // (As per MEP state and enabledOnEsimPort concept)
        assertEquals(EuiccProfileInfo.PROFILE_STATE_ENABLED, profiles[0].getState());
        verifyStoreData(channel, "BF2D0F5C0D5A909192B79F709599BF769F20");
        verifyStoreData(channel, "BF2D0F5C0D5A909192B79F709599BF769F24");
    }

    @Test
@@ -235,7 +235,7 @@ public class EuiccPortTest extends TelephonyTest {
        EuiccProfileInfo[] profiles = resultCaptor.result;
        assertEquals(1, profiles.length);
        assertEquals(EuiccProfileInfo.PROFILE_STATE_DISABLED, profiles[0].getState());
        verifyStoreData(channel, "BF2D0F5C0D5A909192B79F709599BF769F20");
        verifyStoreData(channel, "BF2D0F5C0D5A909192B79F709599BF769F24");
    }

    @Test