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

Commit a95110b8 authored by Shishir Agrawal's avatar Shishir Agrawal Committed by The Android Automerger
Browse files

DcTracker: Cleanup connections when IccRecords is destroyed.

The IccRecords are destroyed when the SIM goes through a state change like a
refresh reset. Attempting to setup data connections when in this case can lead
to incorrect APNs being passed to the radio.

The change will cleanup all data connections when IccRecords are disposed off.
New data connections will not be setup because SIM ready checks are done
before setting them up.

Bug: 19379406
Change-Id: Ide24ec3ab08bd8e76d4a98a47b4f0509987c11eb
parent 881deef2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ public interface Phone {
    static final String REASON_CONNECTED = "connected";
    static final String REASON_SINGLE_PDN_ARBITRATION = "SinglePdnArbitration";
    static final String REASON_DATA_SPECIFIC_DISABLED = "specificDisabled";
    static final String REASON_SIM_NOT_READY = "simNotReady";

    // Used for band mode selection methods
    static final int BM_UNSPECIFIED = 0; // selected by baseband automatically
+10 −0
Original line number Diff line number Diff line
@@ -1528,6 +1528,14 @@ public final class DcTracker extends DcTrackerBase {
        setupDataOnConnectableApns(Phone.REASON_SIM_LOADED);
    }

    private void onSimNotReady() {
        if (DBG) log("onSimNotReady");

        cleanUpAllConnections(true, Phone.REASON_SIM_NOT_READY);
        mAllApnSettings = null;
        mAutoAttachOnCreationConfig = false;
    }

    @Override
    protected void onSetDependencyMet(String apnType, boolean met) {
        // don't allow users to tweak hipri to work around default dependency not met
@@ -2771,6 +2779,8 @@ public final class DcTracker extends DcTrackerBase {
                mIccRecords.set(newIccRecords);
                newIccRecords.registerForRecordsLoaded(
                        this, DctConstants.EVENT_RECORDS_LOADED, null);
            } else {
                onSimNotReady();
            }
        }
    }