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

Commit a4b66e9d authored by Michaël Burtin's avatar Michaël Burtin
Browse files

Add support for recent Huawei Qualcom RIL

Override RIL class with some Huawei specific calls.
Add a new CARDSTATE_NOT_READY state to Icc card status.
Add Huawei specific EF path.
Change the definition of NETWORK_LOCKED app state for Huawei RIL.

Change-Id: I66e4d7a42a0a5ca416e5d9e114e41c184afe5bd7
parent e3a56d8e
Loading
Loading
Loading
Loading
+909 −0

File added.

Preview size limit exceeded, changes collapsed.

+3 −1
Original line number Diff line number Diff line
@@ -764,7 +764,9 @@ public abstract class IccCard {
        if (app.app_state.isPukRequired()) {
            return IccCard.State.PUK_REQUIRED;
        }
        if (app.app_state.isSubscriptionPersoEnabled()) {
        if (app.app_state.isSubscriptionPersoEnabled() &&
            (!(this.mPhone.mCM.getClass() == HuaweiRIL.class) ||
               app.perso_substate.isPersoSubStateNetworkLocked())) {
            return IccCard.State.NETWORK_LOCKED;
        }
        if (app.app_state.isAppReady()) {
+5 −0
Original line number Diff line number Diff line
@@ -94,6 +94,11 @@ public class IccCardApplication {
        boolean isPersoSubStateUnknown() {
            return this == PERSOSUBSTATE_UNKNOWN;
        }

        boolean isPersoSubStateNetworkLocked()
        {
            return this == PERSOSUBSTATE_SIM_NETWORK;
        }
    };

    public AppType        app_type;
+5 −1
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ public class IccCardStatus {
    public enum CardState {
        CARDSTATE_ABSENT,
        CARDSTATE_PRESENT,
        CARDSTATE_ERROR;
        CARDSTATE_ERROR,
        CARDSTATE_NOT_READY;

        boolean isCardPresent() {
            return this == CARDSTATE_PRESENT;
@@ -82,6 +83,9 @@ public class IccCardStatus {
        case 2:
            mCardState = CardState.CARDSTATE_ERROR;
            break;
        case 3:
            mCardState = CardState.CARDSTATE_NOT_READY;
            break;
        default:
            throw new RuntimeException("Unrecognized RIL_CardState: " + state);
        }
+42 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.telephony.gsm;
import android.os.Message;
import android.util.Log;

import com.android.internal.telephony.HuaweiRIL;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccCardApplication;
import com.android.internal.telephony.IccConstants;
@@ -57,6 +58,12 @@ public final class SIMFileHandler extends IccFileHandler implements IccConstants
    }

    protected String getEFPath(int efid) {
        if (phone.mCM.getClass() == HuaweiRIL.class) {
            IccCard icccard = phone.getIccCard();
            if (icccard != null && icccard.isApplicationOnIcc(IccCardApplication.AppType.APPTYPE_USIM))
                return getEFPathForUICC(efid);
        }

        // TODO(): DF_GSM can be 7F20 or 7F21 to handle backward compatibility.
        // Implement this after discussion with OEMs.
        switch(efid) {
@@ -102,6 +109,41 @@ public final class SIMFileHandler extends IccFileHandler implements IccConstants
        return path;
    }

    protected String getEFPathForUICC(int efid) {
        switch (efid) {
            case EF_SMS:
            case EF_EXT6:
            case EF_MWIS:
            case EF_MBI:
            case EF_SPN:
            case EF_AD:
            case EF_MBDN:
            case EF_PNN:
            case EF_SPDI:
            case EF_SST:
            case EF_CFIS:
            case EF_MAILBOX_CPHS:
            case EF_VOICE_MAIL_INDICATOR_CPHS:
            case EF_CFF_CPHS:
            case EF_SPN_CPHS:
            case EF_SPN_SHORT_CPHS:
            case EF_INFO_CPHS:
            case EF_PBR:
            case EF_MSISDN:
            case EF_FDN:
                return MF_SIM + DF_ADFISIM;

            case EF_CSP_CPHS:
                // we only support global phonebook.
                return MF_SIM + DF_TELECOM + DF_PHONEBOOK;

        }
        String path = getCommonIccEFPath(efid);
        if (path == null)
            Log.e(LOG_TAG, "Error: EF Path being returned in null");
        return path;
    }

    protected void logd(String msg) {
        Log.d(LOG_TAG, "[SIMFileHandler] " + msg);
    }