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

Commit 4427e4e3 authored by Romain Hunault's avatar Romain Hunault 💻
Browse files

Merge branch 'ten-qc-telephony-fix' into 'v1-FP3-q'

Ten qc telephony fix

See merge request !2
parents aa04b675 cf61807c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2890,6 +2890,11 @@ public class GsmCdmaPhone extends Phone {
        }
    }

    @Override
    public SIMRecords getSIMRecords() {
        return mSimRecords;
    }

    private void processIccRecordEvents(int eventCode) {
        switch (eventCode) {
            case IccRecords.EVENT_CFI:
+5 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
import com.android.internal.telephony.uicc.IccFileHandler;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.IsimRecords;
import com.android.internal.telephony.uicc.SIMRecords;
import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UiccCardApplication;
import com.android.internal.telephony.uicc.UiccController;
@@ -4109,6 +4110,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return RIL.RADIO_HAL_VERSION_UNKNOWN;
    }

    public SIMRecords getSIMRecords() {
        return null;
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("Phone: subId=" + getSubId());
        pw.println(" mPhoneId=" + mPhoneId);
+33 −8
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@ import com.android.internal.telephony.dataconnection.DataConnectionReasons.DataD
import com.android.internal.telephony.dataconnection.DataEnabledSettings.DataEnabledChangedReason;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.RuimRecords;
import com.android.internal.telephony.uicc.SIMRecords;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.AsyncChannel;
@@ -232,6 +234,7 @@ public class DcTracker extends Handler {
    private final TelephonyManager mTelephonyManager;

    private final AlarmManager mAlarmManager;
    private SIMRecords mSimRecords;

    /* Currently requested APN type (TODO: This should probably be a parameter not a member) */
    private int mRequestedApnType = ApnSetting.TYPE_DEFAULT;
@@ -250,6 +253,8 @@ public class DcTracker extends Handler {
    // Default sent packets without ack which triggers initial recovery steps
    private static final int NUMBER_SENT_PACKETS_OF_HANG = 10;

    private static final int EVENT_ESSENTIAL_SIM_RECORDS_LOADED = 100;

    // Default for the data stall alarm while non-aggressive stall detection
    private static final int DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS_DEFAULT = 1000 * 60 * 6;
    // Default for the data stall alarm for aggressive stall detection
@@ -1362,7 +1367,8 @@ public class DcTracker extends Handler {
            radioStateFromCarrier = true;
        }

        boolean recordsLoaded = mIccRecords.get() != null && mIccRecords.get().getRecordsLoaded();
        boolean recordsLoaded = mIccRecords.get() != null
                && mIccRecords.get().getEssentialRecordsLoaded();

        boolean defaultDataSelected = SubscriptionManager.isValidSubscriptionId(
                SubscriptionManager.getDefaultDataSubscriptionId());
@@ -3550,6 +3556,17 @@ public class DcTracker extends Handler {
        return null;
    }

    void onRecordsLoaded() {
        // If onRecordsLoadedOrSubIdChanged() is not called here, it should be called on
        // onSubscriptionsChanged() when a valid subId is available.
        int subId = mPhone.getSubId();
        if (mSubscriptionManager.isActiveSubId(subId)) {
            onRecordsLoadedOrSubIdChanged();
        } else {
            log("Ignoring EVENT_ESSENTIAL_SIM_RECORDS_LOADED as subId is not valid: " + subId);
        }
    }

    @Override
    public void handleMessage (Message msg) {
        if (VDBG) log("handleMessage msg=" + msg);
@@ -3561,13 +3578,21 @@ public class DcTracker extends Handler {
        int requestType;
        switch (msg.what) {
            case DctConstants.EVENT_RECORDS_LOADED:
                // If onRecordsLoadedOrSubIdChanged() is not called here, it should be called on
                // onSubscriptionsChanged() when a valid subId is available.
                int subId = mPhone.getSubId();
                if (mSubscriptionManager.isActiveSubId(subId)) {
                    onRecordsLoadedOrSubIdChanged();
                mSimRecords = mPhone.getSIMRecords();
                if ((mIccRecords.get() instanceof RuimRecords) && (mSimRecords != null)) {
                    mSimRecords.registerForEssentialRecordsLoaded(
                        this, EVENT_ESSENTIAL_SIM_RECORDS_LOADED, null);
                } else {
                    log("Ignoring EVENT_RECORDS_LOADED as subId is not valid: " + subId);
                    onRecordsLoaded();
                }
                break;

            case EVENT_ESSENTIAL_SIM_RECORDS_LOADED:
                if (DBG) log("EVENT_ESSENTIAL_SIM_RECORDS_LOADED");
                onRecordsLoaded();
                if (mSimRecords != null) {
                    mSimRecords.unregisterForEssentialRecordsLoaded(this);
                    mSimRecords = null;
                }
                break;

@@ -3983,7 +4008,7 @@ public class DcTracker extends Handler {
                if (mSubscriptionManager.isActiveSubId(mPhone.getSubId())) {
                    log("New records found.");
                    mIccRecords.set(newIccRecords);
                    newIccRecords.registerForRecordsLoaded(
                    newIccRecords.registerForEssentialRecordsLoaded(
                            this, DctConstants.EVENT_RECORDS_LOADED, null);
                }
            } else {
+42 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public abstract class IccRecords extends Handler implements IccConstants {
    protected TelephonyManager mTelephonyManager;

    protected RegistrantList mRecordsLoadedRegistrants = new RegistrantList();
    protected RegistrantList mEssentialRecordsLoadedRegistrants = new RegistrantList();
    protected RegistrantList mLockedRecordsLoadedRegistrants = new RegistrantList();
    protected RegistrantList mNetworkLockedRecordsLoadedRegistrants = new RegistrantList();
    protected RegistrantList mImsiReadyRegistrants = new RegistrantList();
@@ -102,6 +103,12 @@ public abstract class IccRecords extends Handler implements IccConstants {
    protected RegistrantList mSpnUpdatedRegistrants = new RegistrantList();
    protected RegistrantList mRecordsOverrideRegistrants = new RegistrantList();

    @UnsupportedAppUsage
    protected boolean mEssentialRecordsListenerNotified;

    @UnsupportedAppUsage
    protected int mEssentialRecordsToLoad;  // number of pending essential records load requests

    @UnsupportedAppUsage
    protected int mRecordsToLoad;  // number of pending load requests

@@ -232,6 +239,7 @@ public abstract class IccRecords extends Handler implements IccConstants {
                + " mCi=" + mCi
                + " mFh=" + mFh
                + " mParentApp=" + mParentApp
                + " mEssentialRecordsToLoad=" + mEssentialRecordsToLoad
                + " recordsToLoad=" + mRecordsToLoad
                + " adnCache=" + mAdnCache
                + " recordsRequested=" + mRecordsRequested
@@ -370,6 +378,20 @@ public abstract class IccRecords extends Handler implements IccConstants {
        return mFullIccId;
    }

    @UnsupportedAppUsage
    public void registerForEssentialRecordsLoaded(Handler h, int what, Object obj) {
        if (mDestroyed.get()) {
            return;
        }

        Registrant r = new Registrant(h, what, obj);
        mEssentialRecordsLoadedRegistrants.add(r);

        if (getEssentialRecordsLoaded()) {
            r.notifyRegistrant(new AsyncResult(null, null, null));
        }
    }

    @UnsupportedAppUsage
    public void registerForRecordsLoaded(Handler h, int what, Object obj) {
        if (mDestroyed.get()) {
@@ -383,6 +405,12 @@ public abstract class IccRecords extends Handler implements IccConstants {
            r.notifyRegistrant(new AsyncResult(null, null, null));
        }
    }

    @UnsupportedAppUsage
    public void unregisterForEssentialRecordsLoaded(Handler h) {
        mEssentialRecordsLoadedRegistrants.remove(h);
    }

    @UnsupportedAppUsage
    public void unregisterForRecordsLoaded(Handler h) {
        mRecordsLoadedRegistrants.remove(h);
@@ -771,6 +799,11 @@ public abstract class IccRecords extends Handler implements IccConstants {
     */
    public abstract void onRefresh(boolean fileChanged, int[] fileList);

    @UnsupportedAppUsage
    public boolean getEssentialRecordsLoaded() {
        return mEssentialRecordsToLoad == 0 && mRecordsRequested;
    }

    @UnsupportedAppUsage
    public boolean getRecordsLoaded() {
        return mRecordsToLoad == 0 && mRecordsRequested;
@@ -919,6 +952,8 @@ public abstract class IccRecords extends Handler implements IccConstants {

    protected abstract void onRecordLoaded();

    protected abstract void onAllEssentialRecordsLoaded();

    protected abstract void onAllRecordsLoaded();

    /**
@@ -1187,6 +1222,12 @@ public abstract class IccRecords extends Handler implements IccConstants {
        pw.println(" mCi=" + mCi);
        pw.println(" mFh=" + mFh);
        pw.println(" mParentApp=" + mParentApp);
        pw.println(" mEssentialRecordsLoadedRegistrants: size="
                + mEssentialRecordsLoadedRegistrants.size());
        for (int i = 0; i < mEssentialRecordsLoadedRegistrants.size(); i++) {
            pw.println("  mEssentialRecordsLoadedRegistrants[" + i + "]="
                    + ((Registrant)mEssentialRecordsLoadedRegistrants.get(i)).getHandler());
        }
        pw.println(" recordsLoadedRegistrants: size=" + mRecordsLoadedRegistrants.size());
        for (int i = 0; i < mRecordsLoadedRegistrants.size(); i++) {
            pw.println("  recordsLoadedRegistrants[" + i + "]="
@@ -1227,6 +1268,7 @@ public abstract class IccRecords extends Handler implements IccConstants {
        }
        pw.println(" mRecordsRequested=" + mRecordsRequested);
        pw.println(" mLockedRecordsReqReason=" + mLockedRecordsReqReason);
        pw.println(" mEssentialRecordsToLoad=" + mEssentialRecordsToLoad);
        pw.println(" mRecordsToLoad=" + mRecordsToLoad);
        pw.println(" mRdnCache=" + mAdnCache);

+21 −2
Original line number Diff line number Diff line
@@ -154,9 +154,16 @@ public class IsimUiccRecords extends IccRecords implements IsimRecords {
        }
    }

    private void fetchEssentialIsimRecords() {
        //NOP: No essential ISim records identified.
    }

    @UnsupportedAppUsage
    protected void fetchIsimRecords() {
        mRecordsRequested = true;
        if (DBG) log("fetchIsimRecords " + mRecordsToLoad);

        fetchEssentialIsimRecords();

        mFh.loadEFTransparent(EF_IMPI, obtainMessage(
                IccRecords.EVENT_GET_ICC_RECORD_DONE, new EfIsimImpiLoaded()));
@@ -289,13 +296,18 @@ public class IsimUiccRecords extends IccRecords implements IsimRecords {
        mRecordsToLoad -= 1;
        if (DBG) log("onRecordLoaded " + mRecordsToLoad + " requested: " + mRecordsRequested);

        if (getEssentialRecordsLoaded() && !mEssentialRecordsListenerNotified) {
            onAllEssentialRecordsLoaded();
        }

        if (getRecordsLoaded()) {
            onAllRecordsLoaded();
        } else if (getLockedRecordsLoaded() || getNetworkLockedRecordsLoaded()) {
            onLockedAllRecordsLoaded();
        } else if (mRecordsToLoad < 0) {
        } else if (mRecordsToLoad < 0 || mEssentialRecordsToLoad < 0) {
            loge("recordsToLoad <0, programmer error suspected");
            mRecordsToLoad = 0;
            mEssentialRecordsToLoad = 0;
        }
    }

@@ -312,6 +324,13 @@ public class IsimUiccRecords extends IccRecords implements IsimRecords {
        }
    }

    @Override
    protected void onAllEssentialRecordsLoaded() {
        if (DBG) log("Essential record load complete");
        mEssentialRecordsListenerNotified = true;
        mEssentialRecordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
    }

    @Override
    protected void onAllRecordsLoaded() {
        if (DBG) log("record load complete");
Loading