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

Commit b1907d8a authored by Umashankar Godachi's avatar Umashankar Godachi
Browse files

Fix ADN records loading removing EFEXT1 dependency.

Currently if EFEXT1 file is not present on a card a
runtime exception is thrown, and ADN records are not
loaded.

Fix: Allow ADN records loading even if EFEXT1 file is
not present by not throwing runtime exception.
Also in AdnRecordCache, find the free EXT1 record and
pass it to updateEF method, inorder to add the contact
with number greater than 20 in size.

Change-Id: Ibce813f259a1b734c57d15b98d7ac98d7f553bb4
CRs-Fixed: 927889
parent 27d8ca44
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));