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

Commit 94c5747c authored by Jack Yu's avatar Jack Yu
Browse files

Fixed dangling DC controller

Instead of creating a DcController everytime, we reuse
the existing DcController.

Test: Manually tested with APM + wifi calling on. Killed the data service and saw the existing DCC being re-used and working correctly.
Bug: 176458078
Merged-In: I6a74fcaf60f66e49a389ae9840a925dc789940f1
Change-Id: I861de7162d2311e494e79215f60a92ac89279622
parent 0ca780c9
Loading
Loading
Loading
Loading
+2 −17
Original line number Diff line number Diff line
@@ -725,6 +725,7 @@ public class DcTracker extends Handler {
        mHandlerThread.start();
        Handler dcHandler = new Handler(mHandlerThread.getLooper());
        mDcc = DcController.makeDcc(mPhone, this, mDataServiceManager, dcHandler, mLogTagSuffix);
        mDcc.start();
        mDcTesterFailBringUpAll = new DcTesterFailBringUpAll(mPhone, dcHandler);

        mDataConnectionTracker = this;
@@ -3938,7 +3939,7 @@ public class DcTracker extends Handler {
                onDataReconnect((ApnContext) msg.obj, msg.arg1);
                break;
            case DctConstants.EVENT_DATA_SERVICE_BINDING_CHANGED:
                onDataServiceBindingChanged((Boolean) ((AsyncResult) msg.obj).result);
                mDataServiceBound = (boolean) ((AsyncResult) msg.obj).result;
                break;
            case DctConstants.EVENT_DATA_ENABLED_CHANGED:
                ar = (AsyncResult) msg.obj;
@@ -5139,22 +5140,6 @@ public class DcTracker extends Handler {
                .build();
    }

    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;
    }

    public static String requestTypeToString(@RequestNetworkType int type) {
        switch (type) {
            case REQUEST_TYPE_NORMAL: return "NORMAL";