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

Commit e287feac authored by Alex Yakavenka's avatar Alex Yakavenka
Browse files

Telephony: Remove CdmaLteUicc objects

-Pass IccCard object to GsmMmiCode
-Create IccCardProxy
-Make IccCard an interface and pass instance of IccCardProxy to
 external applications (PhoneApp). IccCardProxy will use internal
 UiccCard to map Icc requests to current active application on
 UiccCard to maintain backwards compatibility for external
 applications
-Add documentation to UiccController

The primary advantage of UiccController is that we can work with
multiple uicc applications at the same time. And that is a
requirement for modes like Cdma/Lte. The existing code supports
Cdma/Lte only partially and with guessing on modem side. However,
some things modem can guess, while others - it can't.

For instance, when a user tries to edit the fdn list the current
code will pass ef_id for fdn (0x6F3B). But the modem will have no
clue which fdn list the user wants to edit (csim or usim, both
have path 7FFF), and it's impossible for modem to guess correctly
all the time. All the modem can do is try to be consistent and
hope another device is doing same things. Imagine you bring your
card from another Cdma/Lte device to your new Cdma/Lte device:
if this modem uses different fdn file, it won't work as all
existing entries won't be there.

Another example is when the modem's guess is wrong for files like
csim/ef_li (7FFF 6F3A) versus usim/ef_adn (7FFF 6F3A). They have
same ef_ids so Android really should pass aid of the app it wants
to access. Without aids there is no way modem can know for sure
which file Android wants to read! However, in the current code
even Android doesn't know which aid it wants to read file from
since CdmaLteRecords has only 1 aid.

All of these problems cause more and more hacks, both in the modem
and in Android side. UiccController cleans up current code and
provides framework to work with multiple Uicc applications at the
same time.

Change-Id: I60216887b14140bdf833a8ed579ba16cad932bdc
parent 7ac8d802
Loading
Loading
Loading
Loading
+71 −0
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2011 The Android Open Source Project
 * Copyright (C) 2006, 2012 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -14,66 +14,58 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


package com.android.internal.telephony.cdma;
package com.android.internal.telephony;


import android.util.Log;
import android.util.Log;


import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccConstants;
import com.android.internal.telephony.IccConstants;
import com.android.internal.telephony.IccFileHandler;
import com.android.internal.telephony.IccFileHandler;
import android.os.Message;
import com.android.internal.telephony.UiccCardApplication;


/**
/**
 * {@hide}
 * {@hide}
 * This class should be used to access files in CSIM ADF
 */
 */
public final class CdmaLteUiccFileHandler extends IccFileHandler {
public final class CsimFileHandler extends IccFileHandler implements IccConstants {
    static final String LOG_TAG = "CDMA";
    static final String LOG_TAG = "RIL_CsimFH";


    public CdmaLteUiccFileHandler(IccCard card, String aid, CommandsInterface ci) {
    public CsimFileHandler(UiccCardApplication app, String aid, CommandsInterface ci) {
        super(card, aid, ci);
        super(app, aid, ci);
    }
    }


    @Override
    protected String getEFPath(int efid) {
    protected String getEFPath(int efid) {
        switch(efid) {
        switch(efid) {
        case EF_CSIM_SPN:
        case EF_SMS:
        case EF_CST:
        case EF_FDN:
        case EF_MSISDN:
        case EF_RUIM_SPN:
        case EF_CSIM_LI:
        case EF_CSIM_LI:
        case EF_CSIM_MDN:
        case EF_CSIM_MDN:
        case EF_CSIM_IMSIM:
        case EF_CSIM_IMSIM:
        case EF_CSIM_CDMAHOME:
        case EF_CSIM_CDMAHOME:
        case EF_CSIM_EPRL:
        case EF_CSIM_EPRL:
            return MF_SIM + DF_CDMA;
            return MF_SIM + DF_ADF;
        case EF_AD:
            return MF_SIM + DF_GSM;
        case EF_IMPI:
        case EF_DOMAIN:
        case EF_IMPU:
            return MF_SIM + DF_ADFISIM;
        }
        return getCommonIccEFPath(efid);
        }
        }

        String path = getCommonIccEFPath(efid);
    @Override
        if (path == null) {
    public void loadEFTransparent(int fileid, Message onLoaded) {
            // The EFids in UICC phone book entries are decided by the card manufacturer.
        if (fileid == EF_CSIM_EPRL) {
            // So if we don't match any of the cases above and if its a UICC return
            // Entire PRL could be huge. We are only interested in
            // the global 3g phone book path.
            // the first 4 bytes of the record.
            return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
            mCi.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
                            0, 0, 4, null, null, mAid,
                            obtainMessage(EVENT_READ_BINARY_DONE,
                                          fileid, 0, onLoaded));
        } else {
            super.loadEFTransparent(fileid, onLoaded);
        }
        }
        return path;
    }
    }



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


    @Override
    protected void loge(String msg) {
    protected void loge(String msg) {
        Log.e(LOG_TAG, "[CdmaLteUiccFileHandler] " + msg);
        Log.e(LOG_TAG, msg);
    }
    }

}
}
+59 −789

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@ import com.android.internal.telephony.IccCardStatus.PinState;
 *
 *
 * {@hide}
 * {@hide}
 */
 */
public class IccCardApplication {
public class IccCardApplicationStatus {
    public enum AppType{
    public enum AppType{
        APPTYPE_UNKNOWN,
        APPTYPE_UNKNOWN,
        APPTYPE_SIM,
        APPTYPE_SIM,
+690 −0

File added.

Preview size limit exceeded, changes collapsed.

+17 −62
Original line number Original line Diff line number Diff line
@@ -57,19 +57,13 @@ public class IccCardStatus {
        }
        }
    }
    }


    private CardState  mCardState;
    public CardState  mCardState;
    private PinState   mUniversalPinState;
    public PinState   mUniversalPinState;
    private int        mGsmUmtsSubscriptionAppIndex;
    public int        mGsmUmtsSubscriptionAppIndex;
    private int        mCdmaSubscriptionAppIndex;
    public int        mCdmaSubscriptionAppIndex;
    private int        mImsSubscriptionAppIndex;
    public int        mImsSubscriptionAppIndex;
    private int        mNumApplications;


    public IccCardApplicationStatus[] mApplications;
    private ArrayList<IccCardApplication> mApplications =
            new ArrayList<IccCardApplication>(CARD_MAX_APPS);

    public CardState getCardState() {
        return mCardState;
    }


    public void setCardState(int state) {
    public void setCardState(int state) {
        switch(state) {
        switch(state) {
@@ -87,10 +81,6 @@ public class IccCardStatus {
        }
        }
    }
    }


    public PinState getUniversalPinState() {
        return mUniversalPinState;
    }

    public void setUniversalPinState(int state) {
    public void setUniversalPinState(int state) {
        switch(state) {
        switch(state) {
        case 0:
        case 0:
@@ -116,69 +106,34 @@ public class IccCardStatus {
        }
        }
    }
    }


    public int getGsmUmtsSubscriptionAppIndex() {
        return mGsmUmtsSubscriptionAppIndex;
    }

    public void setGsmUmtsSubscriptionAppIndex(int gsmUmtsSubscriptionAppIndex) {
        mGsmUmtsSubscriptionAppIndex = gsmUmtsSubscriptionAppIndex;
    }

    public int getCdmaSubscriptionAppIndex() {
        return mCdmaSubscriptionAppIndex;
    }

    public void setCdmaSubscriptionAppIndex(int cdmaSubscriptionAppIndex) {
        mCdmaSubscriptionAppIndex = cdmaSubscriptionAppIndex;
    }

    public int getImsSubscriptionAppIndex() {
        return mImsSubscriptionAppIndex;
    }

    public void setImsSubscriptionAppIndex(int imsSubscriptionAppIndex) {
        mImsSubscriptionAppIndex = imsSubscriptionAppIndex;
    }

    public int getNumApplications() {
        return mNumApplications;
    }

    public void setNumApplications(int numApplications) {
        mNumApplications = numApplications;
    }

    public void addApplication(IccCardApplication application) {
        mApplications.add(application);
    }

    public IccCardApplication getApplication(int index) {
        return mApplications.get(index);
    }

    @Override
    @Override
    public String toString() {
    public String toString() {
        IccCardApplication app;
        IccCardApplicationStatus app;


        StringBuilder sb = new StringBuilder();
        StringBuilder sb = new StringBuilder();
        sb.append("IccCardState {").append(mCardState).append(",")
        sb.append("IccCardState {").append(mCardState).append(",")
        .append(mUniversalPinState)
        .append(mUniversalPinState)
        .append(",num_apps=").append(mNumApplications)
        .append(",num_apps=").append(mApplications.length)
        .append(",gsm_id=").append(mGsmUmtsSubscriptionAppIndex);
        .append(",gsm_id=").append(mGsmUmtsSubscriptionAppIndex);
        if (mGsmUmtsSubscriptionAppIndex >=0
        if (mGsmUmtsSubscriptionAppIndex >=0
                && mGsmUmtsSubscriptionAppIndex <CARD_MAX_APPS) {
                && mGsmUmtsSubscriptionAppIndex <CARD_MAX_APPS) {
            app = getApplication(mGsmUmtsSubscriptionAppIndex);
            app = mApplications[mGsmUmtsSubscriptionAppIndex];
            sb.append(app == null ? "null" : app);
            sb.append(app == null ? "null" : app);
        }
        }


        sb.append(",cmda_id=").append(mCdmaSubscriptionAppIndex);
        sb.append(",cmda_id=").append(mCdmaSubscriptionAppIndex);
        if (mCdmaSubscriptionAppIndex >=0
        if (mCdmaSubscriptionAppIndex >=0
                && mCdmaSubscriptionAppIndex <CARD_MAX_APPS) {
                && mCdmaSubscriptionAppIndex <CARD_MAX_APPS) {
            app = getApplication(mCdmaSubscriptionAppIndex);
            app = mApplications[mCdmaSubscriptionAppIndex];
            sb.append(app == null ? "null" : app);
            sb.append(app == null ? "null" : app);
        }
        }


        sb.append(",ism_id=").append(mImsSubscriptionAppIndex);
        sb.append(",ims_id=").append(mImsSubscriptionAppIndex);
        if (mImsSubscriptionAppIndex >=0
                && mImsSubscriptionAppIndex <CARD_MAX_APPS) {
            app = mApplications[mImsSubscriptionAppIndex];
            sb.append(app == null ? "null" : app);
        }


        sb.append("}");
        sb.append("}");


Loading