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

Commit 4a67e8f3 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Fix ADN records loading removing EFEXT1 dependency."

parents e7eb8494 b1907d8a
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -156,12 +156,14 @@ public final class AdnRecordCache extends Handler implements IccConstants {
    /* Find the free EXT1 record in the EXT1 file */
    private int findFreeExtRec(int extensionEf) {
        int[] extRec = extRecList.get(extensionEf);
        if (extRec != null) {
            for (int i = 0; i < extRec.length; i++) {
                if (extRec[i] == 0) {
                    Rlog.d(LOG_TAG, "Free record found: " +(i+1));
                    return (i+1);
                }
            }
        }

        Rlog.d(LOG_TAG, "No Free record found: ");
        return -1;
@@ -333,7 +335,7 @@ public final class AdnRecordCache extends Handler implements IccConstants {
        } else {
            mUserWriteResponse.put(efid, response);
            new AdnRecordLoader(mFh).updateEF(newAdn, efid, extensionEF,
                    index, pin2,
                    index, pin2, findFreeExtRec(extensionEF),
                    obtainMessage(EVENT_UPDATE_ADN_DONE, efid, index, newAdn));
        }

@@ -485,7 +487,8 @@ public final class AdnRecordCache extends Handler implements IccConstants {
                        mUsimPhoneBookManager.loadEfFilesFromUsim().set(index - 1, adn);
                    }
                    if (adn != null && adn.hasExtendedRecord()
                            && adn.mExtRecord > 0) {
                            && adn.mExtRecord > 0
                            && extRecList.get(extensionEf) != null) {
                        extRecList.get(extensionEf)[adn.mExtRecord - 1] = 1;
                    }
                }
+21 −20
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ public class AdnRecordLoader extends Handler {
    // For "load one"
    int mRecordNumber;

    int mNumExtRec;
    int mNumExtRec = -1;

    // for "load all"
    ArrayList<AdnRecord> mAdns; // only valid after EVENT_ADN_LOAD_ALL_DONE
@@ -208,7 +208,7 @@ public class AdnRecordLoader extends Handler {
    handleMessage(Message msg) {
        AsyncResult ar;
        byte data[];
        int[] extRecord;
        int[] extRecord = null;
        AdnRecord adn;

        try {
@@ -252,10 +252,8 @@ public class AdnRecordLoader extends Handler {
                    String path = (String)(ar.userObj);

                    if (ar.exception != null) {
                        throw new RuntimeException("get EF record size failed",
                                ar.exception);
                    }

                        Rlog.d(LOG_TAG, "Exception occured while fetching record size for EFEXT1");
                    } else {
                        int[] extRecordSize = (int[])ar.result;
                        // extRecordSize is int[3] array
                        // int[0]  is the record length
@@ -267,6 +265,7 @@ public class AdnRecordLoader extends Handler {
                                    ar.exception);
                        }
                        mNumExtRec = extRecordSize[2]; //Number of EXT records.
                    }
                    mPendingExtLoads = 1;

                    /* If we are loading from EF_ADN, specifically
@@ -373,10 +372,12 @@ public class AdnRecordLoader extends Handler {
                    mPendingExtLoads = 0;

                    // extRecord has the details of used/free EXT1 records.
                    if (mNumExtRec != -1) {
                        extRecord = new int[mNumExtRec];
                        for (int i = 0; i < mNumExtRec; i++) {
                            extRecord[i] = 0;
                        }
                    }

                    for (int i = 0, s = datas.size() ; i < s ; i++) {
                        adn = new AdnRecord(mEf, 1 + i, datas.get(i));