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

Commit acc2a8a9 authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Use 3gpp2 as the default app type if voice RAT is CDMA.

(and if no app is available).

Test: atest UiccProfileTest#testSetVoiceRadioTech
Bug: 159761055
Change-Id: Iff3d8a2491f530ae03471d3c025b19a7c5aaf44c
parent eeaf7fe4
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -134,7 +134,8 @@ public class UiccProfile extends IccCard {

    private RegistrantList mNetworkLockedRegistrants = new RegistrantList();

    private int mCurrentAppType = UiccController.APP_FAM_3GPP; //default to 3gpp?
    @VisibleForTesting
    public int mCurrentAppType = UiccController.APP_FAM_3GPP; //default to 3gpp?
    private UiccCardApplication mUiccApplication = null;
    private IccRecords mIccRecords = null;
    private IccCardConstants.State mExternalState = IccCardConstants.State.UNKNOWN;
@@ -352,7 +353,7 @@ public class UiccProfile extends IccCard {
                mCurrentAppType = UiccController.APP_FAM_3GPP;
            } else {
                UiccCardApplication newApp = getApplication(UiccController.APP_FAM_3GPP2);
                if(newApp != null) {
                if (newApp != null || getApplication(UiccController.APP_FAM_3GPP) == null) {
                    mCurrentAppType = UiccController.APP_FAM_3GPP2;
                } else {
                    mCurrentAppType = UiccController.APP_FAM_3GPP;
+41 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -606,4 +607,44 @@ public class UiccProfileTest extends TelephonyTest {
        assertTrue(mUiccProfile.isEmptyProfile());

    }

    private void testUpdateUiccProfileApplicationNoCsim() {
        /* update app status and index */
        IccCardApplicationStatus imsApp = composeUiccApplicationStatus(
                IccCardApplicationStatus.AppType.APPTYPE_ISIM,
                IccCardApplicationStatus.AppState.APPSTATE_UNKNOWN, "0xA1");
        IccCardApplicationStatus umtsApp = composeUiccApplicationStatus(
                IccCardApplicationStatus.AppType.APPTYPE_USIM,
                IccCardApplicationStatus.AppState.APPSTATE_UNKNOWN, "0xA2");
        mIccCardStatus.mApplications = new IccCardApplicationStatus[]{imsApp, umtsApp};
        mIccCardStatus.mCdmaSubscriptionAppIndex = -1;
        mIccCardStatus.mImsSubscriptionAppIndex = 0;
        mIccCardStatus.mGsmUmtsSubscriptionAppIndex = 1;
        logd("Update UICC Profile Applications");
        mUiccProfile.update(mContext, mSimulatedCommands, mIccCardStatus);
        processAllMessages();

        assertEquals(2, mUiccProfile.getNumApplications());
        assertFalse(mUiccProfile.isApplicationOnIcc(IccCardApplicationStatus.AppType.APPTYPE_CSIM));
        assertTrue(mUiccProfile.isApplicationOnIcc(IccCardApplicationStatus.AppType.APPTYPE_ISIM));
        assertTrue(mUiccProfile.isApplicationOnIcc(IccCardApplicationStatus.AppType.APPTYPE_USIM));
    }

    @Test
    @SmallTest
    public void testSetVoiceRadioTech() {
        // if voice rat is GSM, mCurrentAppType should be 3gpp
        mUiccProfile.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_GSM);
        assertEquals(UiccController.APP_FAM_3GPP, mUiccProfile.mCurrentAppType);

        // if voice rat is CDMA, mCurrentAppType should be 3gpp2
        mUiccProfile.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_IS95A);
        assertEquals(UiccController.APP_FAM_3GPP2, mUiccProfile.mCurrentAppType);

        // if voice rat is CDMA, there is no CSIM app, and there is a SIM/USIM app, then
        // mCurrentAppType should be 3gpp
        testUpdateUiccProfileApplicationNoCsim();
        mUiccProfile.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_IS95A);
        assertEquals(UiccController.APP_FAM_3GPP, mUiccProfile.mCurrentAppType);
    }
}