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

Commit 273f974d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Dont reuse DcController object after calling dispose() on it." into rvc-dev

parents 79d9be2b f3a31308
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ public class DcTracker extends Handler {
            "extra_handover_failure_fallback";

    private final String mLogTag;
    private final String mLogTagSuffix;

    public AtomicBoolean isCleanupRequired = new AtomicBoolean(false);

@@ -673,13 +674,12 @@ public class DcTracker extends Handler {
                .createForSubscriptionId(phone.getSubId());
        // The 'C' in tag indicates cellular, and 'I' indicates IWLAN. This is to distinguish
        // between two DcTrackers, one for each.
        String tagSuffix = "-" + ((transportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                ? "C" : "I");
        tagSuffix += "-" + mPhone.getPhoneId();
        mLogTag = "DCT" + tagSuffix;
        mLogTagSuffix = "-" + ((transportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                ? "C" : "I") + "-" + mPhone.getPhoneId();
        mLogTag = "DCT" + mLogTagSuffix;

        mTransportType = transportType;
        mDataServiceManager = new DataServiceManager(phone, transportType, tagSuffix);
        mDataServiceManager = new DataServiceManager(phone, transportType, mLogTagSuffix);

        mResolver = mPhone.getContext().getContentResolver();
        mAlarmManager =
@@ -715,7 +715,7 @@ public class DcTracker extends Handler {
        mHandlerThread = new HandlerThread("DcHandlerThread");
        mHandlerThread.start();
        Handler dcHandler = new Handler(mHandlerThread.getLooper());
        mDcc = DcController.makeDcc(mPhone, this, mDataServiceManager, dcHandler, tagSuffix);
        mDcc = DcController.makeDcc(mPhone, this, mDataServiceManager, dcHandler, mLogTagSuffix);
        mDcTesterFailBringUpAll = new DcTesterFailBringUpAll(mPhone, dcHandler);

        mDataConnectionTracker = this;
@@ -738,6 +738,7 @@ public class DcTracker extends Handler {
    @VisibleForTesting
    public DcTracker() {
        mLogTag = "DCT";
        mLogTagSuffix = null;
        mTelephonyManager = null;
        mAlarmManager = null;
        mPhone = null;
@@ -5056,9 +5057,16 @@ public class DcTracker extends Handler {

    private void onDataServiceBindingChanged(boolean bound) {
        if (bound) {
            if (mDcc == null) {
                mDcc = DcController.makeDcc(mPhone, this, mDataServiceManager,
                        new Handler(mHandlerThread.getLooper()), mLogTagSuffix);
            }
            mDcc.start();
        } else {
            mDcc.dispose();
            // dispose sets the associated Handler object (StateMachine#mSmHandler) to null, so mDcc
            // needs to be created again (simply calling start() on it after dispose will not work)
            mDcc = null;
        }
        mDataServiceBound = bound;
    }