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

Commit 7383e397 authored by Shareef Ali's avatar Shareef Ali Committed by Gerrit Code Review
Browse files

Merge "Telephony: Bring back older IMSI method for legacy RIL" into cm-11.0

parents 7125fcbb a7b3e3ea
Loading
Loading
Loading
Loading
+37 −1
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ public final class RuimRecords extends IccRecords {
    private String mMin;
    private String mHomeSystemId;
    private String mHomeNetworkId;
    private boolean mMSIMRecordeEnabled = false;

    @Override
    public String toString() {
@@ -86,6 +87,7 @@ public final class RuimRecords extends IccRecords {
    }

    // ***** Event Constants
    private static final int EVENT_GET_IMSI_DONE = 3;
    private static final int EVENT_GET_DEVICE_IDENTITY_DONE = 4;
    private static final int EVENT_GET_ICCID_DONE = 5;
    private static final int EVENT_GET_CDMA_SUBSCRIPTION_DONE = 10;
@@ -425,6 +427,7 @@ public final class RuimRecords extends IccRecords {
            String operatorNumeric = getOperatorNumeric();
            if (operatorNumeric != null) {
                if(operatorNumeric.length() <= 6) {
                    mMSIMRecordeEnabled = true;
                    MccTable.updateMccMncConfiguration(mContext, operatorNumeric);
                }
            }
@@ -515,6 +518,35 @@ public final class RuimRecords extends IccRecords {
                log("Event EVENT_GET_DEVICE_IDENTITY_DONE Received");
            break;

            /* IO events */
            case EVENT_GET_IMSI_DONE:
                isRecordLoadResponse = true;

                ar = (AsyncResult)msg.obj;
                if (ar.exception != null) {
                    loge("Exception querying IMSI, Exception:" + ar.exception);
                    break;
                }

                mImsi = (String) ar.result;

                // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more
                // than 15 (and usually 15).
                if (mImsi != null && (mImsi.length() < 6 || mImsi.length() > 15)) {
                    loge("invalid IMSI " + mImsi);
                    mImsi = null;
                }

                log("IMSI: " + mImsi.substring(0, 6) + "xxxxxxxxx");

                String operatorNumeric = getOperatorNumeric();
                if (operatorNumeric != null) {
                    if(operatorNumeric.length() <= 6) {
                        MccTable.updateMccMncConfiguration(mContext, operatorNumeric);
                    }
                }
                break;

            case EVENT_GET_CDMA_SUBSCRIPTION_DONE:
                ar = (AsyncResult)msg.obj;
                String localTemp[] = (String[])ar.result;
@@ -690,6 +722,10 @@ public final class RuimRecords extends IccRecords {
        mRecordsRequested = true;

        if (DBG) log("fetchRuimRecords " + mRecordsToLoad);
        if (!mMSIMRecordeEnabled) {
            mCi.getIMSIForApp(mParentApp.getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
            mRecordsToLoad++;
        }

        mFh.loadEFTransparent(EF_ICCID,
                obtainMessage(EVENT_GET_ICCID_DONE));