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

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

Merge "FR29338: Read SIM Contacts from EF-ADN if EF-PBR read failed."

parents 39ec9ea4 e0f5ff94
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ public abstract class IccPhoneBookInterfaceManager {
    protected final Object mLock = new Object();
    protected int mRecordSize[];
    protected boolean mSuccess;
    private   boolean mForceAdnUsage = false;
    protected List<AdnRecord> mRecords;


@@ -125,6 +126,7 @@ public abstract class IccPhoneBookInterfaceManager {
        if (mRecords != null) {
            mRecords.clear();
        }
        mForceAdnUsage = false;
    }

    public void updateIccRecords(IccRecords iccRecords) {
@@ -314,13 +316,13 @@ public abstract class IccPhoneBookInterfaceManager {
                    "Requires android.permission.READ_CONTACTS permission");
        }

        efid = updateEfForIccType(efid);
        if (DBG) logd("getAdnRecordsInEF: efid=" + efid);

        synchronized(mLock) {
            checkThread();
            AtomicBoolean status = new AtomicBoolean(false);
            Message response = mBaseHandler.obtainMessage(EVENT_LOAD_DONE, status);
            efid = updateEfForIccType(efid);
            if (DBG) logd("getAdnRecordsInEF: efid=" + efid);

            if (mAdnCache != null) {
                mAdnCache.requestLoadAllAdnLike(efid,
                        mAdnCache.extensionEfForEf(efid), null, response);
@@ -328,6 +330,11 @@ public abstract class IccPhoneBookInterfaceManager {
            } else {
                loge("Failure while trying to load from SIM due to uninitialised adncache");
            }
            if (mRecords == null && efid == IccConstants.EF_PBR && !mAdnCache.isPbrPresent()) {
                logd("getAdnRecordsInEF: Load from EF_ADN as pbr is not present");
                mForceAdnUsage = true;
                return getAdnRecordsInEf(IccConstants.EF_ADN);
            }
        }
        return mRecords;
    }
@@ -369,7 +376,7 @@ public abstract class IccPhoneBookInterfaceManager {

    private int updateEfForIccType(int efid) {
        // Check if we are trying to read ADN records
        if (efid == IccConstants.EF_ADN) {
        if (efid == IccConstants.EF_ADN && !mForceAdnUsage) {
            if (mPhone.getCurrentUiccAppType() == AppType.APPTYPE_USIM ||
                    mPhone.getCurrentUiccAppType() == AppType.APPTYPE_CSIM) {
                return IccConstants.EF_PBR;
+6 −0
Original line number Diff line number Diff line
@@ -149,6 +149,10 @@ public class UsimPhoneBookManager extends Handler implements IccConstants {
        mRefreshCache = false;
    }

    public boolean isPbrFilePresent() {
        return mIsPbrPresent;
    }

    public ArrayList<AdnRecord> loadEfFilesFromUsim() {
        synchronized (mLock) {
            if (!mPhoneBookRecords.isEmpty()) {
@@ -947,6 +951,8 @@ public class UsimPhoneBookManager extends Handler implements IccConstants {
                ar = (AsyncResult) msg.obj;
                if (ar.exception == null) {
                    createPbrFile((ArrayList<byte[]>) ar.result);
                } else {
                    mIsPbrPresent = false;
                }
                synchronized (mLock) {
                    mLock.notify();
+4 −0
Original line number Diff line number Diff line
@@ -355,6 +355,10 @@ public final class AdnRecordCache extends Handler implements IccConstants {
                useLocalPb ? mUsimLocalPhoneBookManager : mUsimGlobalPhoneBookManager;
    }

    public boolean isPbrPresent() {
        return (mUsimGlobalPhoneBookManager.isPbrFilePresent() ||
                mUsimLocalPhoneBookManager.isPbrFilePresent());
    }

    /**
     * Responds with exception (in response) if efid is not a known ADN-like