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

Commit ea3a4caa authored by yinxu's avatar yinxu
Browse files

Modify the SIM state "Ready" and "Loaded"

In old implementation, "Ready" and "Loaded" are only related to the
current UiccCardApplication. In this CL, those two states are modified
to represent all the available UiccCardApplication of the profile.

Bug: 64131518
Test: Basic telephony sanity

Change-Id: I8e901fd9549859ea4489e645c60ffffaa4c6e78d
parent ceadaa5d
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -1297,6 +1297,7 @@ public class RadioResponse extends IRadioResponse.Stub {
            appStatus.pin1           = appStatus.PinStateFromRILInt(rilAppStatus.pin1);
            appStatus.pin1           = appStatus.PinStateFromRILInt(rilAppStatus.pin1);
            appStatus.pin2           = appStatus.PinStateFromRILInt(rilAppStatus.pin2);
            appStatus.pin2           = appStatus.PinStateFromRILInt(rilAppStatus.pin2);
            iccCardStatus.mApplications[i] = appStatus;
            iccCardStatus.mApplications[i] = appStatus;
            mRil.riljLog("IccCardApplicationStatus " + i + ":" + appStatus.toString());
        }
        }
        return iccCardStatus;
        return iccCardStatus;
    }
    }
+13 −2
Original line number Original line Diff line number Diff line
@@ -47,6 +47,7 @@ public abstract class IccRecords extends Handler implements IccConstants {


    // ***** Instance Variables
    // ***** Instance Variables
    protected AtomicBoolean mDestroyed = new AtomicBoolean(false);
    protected AtomicBoolean mDestroyed = new AtomicBoolean(false);
    protected AtomicBoolean mLoaded = new AtomicBoolean(false);
    protected Context mContext;
    protected Context mContext;
    protected CommandsInterface mCi;
    protected CommandsInterface mCi;
    protected IccFileHandler mFh;
    protected IccFileHandler mFh;
@@ -71,9 +72,9 @@ public abstract class IccRecords extends Handler implements IccConstants {
    // SIM is not locked
    // SIM is not locked
    protected static final int LOCKED_RECORDS_REQ_REASON_NONE = 0;
    protected static final int LOCKED_RECORDS_REQ_REASON_NONE = 0;
    // Records requested for PIN or PUK locked SIM
    // Records requested for PIN or PUK locked SIM
    protected static final int LOCKED_RECORDS_REQ_REASON_LOCKED = 0;
    protected static final int LOCKED_RECORDS_REQ_REASON_LOCKED = 1;
    // Records requested for network locked SIM
    // Records requested for network locked SIM
    protected static final int LOCKED_RECORDS_REQ_REASON_NETWORK_LOCKED = 0;
    protected static final int LOCKED_RECORDS_REQ_REASON_NETWORK_LOCKED = 2;


    protected boolean mRecordsRequested = false; // true if we've made requests for the sim records
    protected boolean mRecordsRequested = false; // true if we've made requests for the sim records
    protected int mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
    protected int mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
@@ -250,6 +251,7 @@ public abstract class IccRecords extends Handler implements IccConstants {
        if (mAdnCache != null) {
        if (mAdnCache != null) {
            mAdnCache.reset();
            mAdnCache.reset();
        }
        }
        mLoaded.set(false);
    }
    }


    public abstract void onReady();
    public abstract void onReady();
@@ -808,6 +810,15 @@ public abstract class IccRecords extends Handler implements IccConstants {
    public void setVoiceCallForwardingFlag(int line, boolean enable, String number) {
    public void setVoiceCallForwardingFlag(int line, boolean enable, String number) {
    }
    }


    /**
     * Indicates wether the ICC records have been loaded or not
     *
     * @return true if the records have been loaded, false otherwise.
     */
    public boolean isLoaded() {
        return mLoaded.get();
    }

    /**
    /**
     * Indicates wether SIM is in provisioned state or not.
     * Indicates wether SIM is in provisioned state or not.
     * Overridden only if SIM can be dynamically provisioned via OTA.
     * Overridden only if SIM can be dynamically provisioned via OTA.
+2 −0
Original line number Original line Diff line number Diff line
@@ -185,6 +185,7 @@ public class IsimUiccRecords extends IccRecords implements IsimRecords {


        mRecordsRequested = false;
        mRecordsRequested = false;
        mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
        mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
        mLoaded.set(false);
    }
    }


    private class EfIsimImpiLoaded implements IccRecords.IccRecordLoaded {
    private class EfIsimImpiLoaded implements IccRecords.IccRecordLoaded {
@@ -306,6 +307,7 @@ public class IsimUiccRecords extends IccRecords implements IsimRecords {
    @Override
    @Override
    protected void onAllRecordsLoaded() {
    protected void onAllRecordsLoaded() {
       if (DBG) log("record load complete");
       if (DBG) log("record load complete");
        mLoaded.set(true);
        mRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
        mRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
    }
    }


+2 −0
Original line number Original line Diff line number Diff line
@@ -157,6 +157,7 @@ public class RuimRecords extends IccRecords {
        // true only when fresh set of read requests are made.
        // true only when fresh set of read requests are made.
        mRecordsRequested = false;
        mRecordsRequested = false;
        mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
        mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
        mLoaded.set(false);
    }
    }


    public String getMdnNumber() {
    public String getMdnNumber() {
@@ -807,6 +808,7 @@ public class RuimRecords extends IccRecords {
            setSimLanguage(mEFli, mEFpl);
            setSimLanguage(mEFli, mEFpl);
        }
        }


        mLoaded.set(true);
        mRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
        mRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));


        // TODO: The below is hacky since the SubscriptionController may not be ready at this time.
        // TODO: The below is hacky since the SubscriptionController may not be ready at this time.
+2 −1
Original line number Original line Diff line number Diff line
@@ -293,6 +293,7 @@ public class SIMRecords extends IccRecords {
        // true only when fresh set of read requests are made.
        // true only when fresh set of read requests are made.
        mRecordsRequested = false;
        mRecordsRequested = false;
        mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
        mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE;
        mLoaded.set(false);
    }
    }


    //***** Public Methods
    //***** Public Methods
@@ -1600,7 +1601,7 @@ public class SIMRecords extends IccRecords {
        }
        }


        setVoiceMailByCountry(operator);
        setVoiceMailByCountry(operator);

        mLoaded.set(true);
        mRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
        mRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
    }
    }


Loading