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

Commit 63d25d20 authored by Jack Yu's avatar Jack Yu Committed by Automerger Merge Worker
Browse files

Merge "Fixed dangling DC controller" into sc-dev am: aab6f921

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/13499530

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia38e694f23b3489571c1d8814cb25ef89d7f8661
parents 2cb24e4b aab6f921
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -333,7 +333,6 @@ public class DataConnection extends StateMachine {
    static final int EVENT_SETUP_DATA_CONNECTION_DONE = BASE + 1;
    static final int EVENT_DEACTIVATE_DONE = BASE + 3;
    static final int EVENT_DISCONNECT = BASE + 4;
    static final int EVENT_RIL_CONNECTED = BASE + 5;
    static final int EVENT_DISCONNECT_ALL = BASE + 6;
    static final int EVENT_DATA_STATE_CHANGED = BASE + 7;
    static final int EVENT_TEAR_DOWN_NOW = BASE + 8;
@@ -375,7 +374,6 @@ public class DataConnection extends StateMachine {
                "EVENT_SETUP_DATA_CONNECTION_DONE";
        sCmdToString[EVENT_DEACTIVATE_DONE - BASE] = "EVENT_DEACTIVATE_DONE";
        sCmdToString[EVENT_DISCONNECT - BASE] = "EVENT_DISCONNECT";
        sCmdToString[EVENT_RIL_CONNECTED - BASE] = "EVENT_RIL_CONNECTED";
        sCmdToString[EVENT_DISCONNECT_ALL - BASE] = "EVENT_DISCONNECT_ALL";
        sCmdToString[EVENT_DATA_STATE_CHANGED - BASE] = "EVENT_DATA_STATE_CHANGED";
        sCmdToString[EVENT_TEAR_DOWN_NOW - BASE] = "EVENT_TEAR_DOWN_NOW";
+3 −32
Original line number Diff line number Diff line
@@ -114,13 +114,6 @@ public class DcController extends Handler {
        mDcTesterDeactivateAll = (TelephonyUtils.IS_DEBUGGABLE)
                ? new DcTesterDeactivateAll(mPhone, DcController.this, this)
                : null;

        if (mPhone != null && mDataServiceManager.getTransportType()
                == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
            mPhone.mCi.registerForRilConnected(this,
                    DataConnection.EVENT_RIL_CONNECTED, null);
        }

        mDataServiceManager.registerForDataCallListChanged(this,
                DataConnection.EVENT_DATA_STATE_CHANGED);
    }
@@ -131,19 +124,6 @@ public class DcController extends Handler {
        return new DcController("Dcc" + tagSuffix, phone, dct, dataServiceManager, looper);
    }

    void dispose() {
        log("dispose");
        if (mPhone != null & mDataServiceManager.getTransportType()
                == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
            mPhone.mCi.unregisterForRilConnected(this);
        }
        mDataServiceManager.unregisterForDataCallListChanged(this);

        if (mDcTesterDeactivateAll != null) {
            mDcTesterDeactivateAll.dispose();
        }
    }

    void addDc(DataConnection dc) {
        synchronized (mDcListAll) {
            mDcListAll.add(dc);
@@ -186,18 +166,6 @@ public class DcController extends Handler {
        AsyncResult ar;

        switch (msg.what) {
            case DataConnection.EVENT_RIL_CONNECTED:
                ar = (AsyncResult) msg.obj;
                if (ar.exception == null) {
                    if (DBG) {
                        log("EVENT_RIL_CONNECTED mRilVersion="
                                + ar.result);
                    }
                } else {
                    log("Unexpected exception on EVENT_RIL_CONNECTED");
                }
                break;

            case DataConnection.EVENT_DATA_STATE_CHANGED:
                ar = (AsyncResult) msg.obj;
                if (ar.exception == null) {
@@ -206,6 +174,9 @@ public class DcController extends Handler {
                    log("EVENT_DATA_STATE_CHANGED: exception; likely radio not available, ignore");
                }
                break;
            default:
                loge("Unexpected event " + msg);
                break;
        }
    }

+7 −18
Original line number Diff line number Diff line
@@ -218,7 +218,6 @@ public class DcTracker extends Handler {
            "extra_handover_failure_fallback";

    private final String mLogTag;
    private final String mLogTagSuffix;

    public AtomicBoolean isCleanupRequired = new AtomicBoolean(false);

@@ -726,12 +725,13 @@ 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.
        mLogTagSuffix = "-" + ((transportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                ? "C" : "I") + "-" + mPhone.getPhoneId();
        mLogTag = "DCT" + mLogTagSuffix;
        String tagSuffix = "-" + ((transportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                ? "C" : "I");
        tagSuffix += "-" + mPhone.getPhoneId();
        mLogTag = "DCT" + tagSuffix;

        mTransportType = transportType;
        mDataServiceManager = new DataServiceManager(phone, transportType, mLogTagSuffix);
        mDataServiceManager = new DataServiceManager(phone, transportType, tagSuffix);
        mDataThrottler = new DataThrottler(mPhone.getPhoneId(), transportType);

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

        mDataConnectionTracker = this;
@@ -789,7 +789,6 @@ public class DcTracker extends Handler {
    @VisibleForTesting
    public DcTracker() {
        mLogTag = "DCT";
        mLogTagSuffix = null;
        mTelephonyManager = null;
        mAlarmManager = null;
        mPhone = null;
@@ -872,7 +871,6 @@ public class DcTracker extends Handler {
        mSettingsObserver.unobserve();

        mNetworkPolicyManager.unregisterSubscriptionCallback(mSubscriptionCallback);
        mDcc.dispose();
        mDcTesterFailBringUpAll.dispose();

        mPhone.getContext().getContentResolver().unregisterContentObserver(mApnObserver);
@@ -5299,12 +5297,7 @@ public class DcTracker extends Handler {
    }

    private void onDataServiceBindingChanged(boolean bound) {
        if (bound) {
            if (mDcc == null) {
                mDcc = DcController.makeDcc(mPhone, this, mDataServiceManager,
                        mHandlerThread.getLooper(), mLogTagSuffix);
            }
        } else {
        if (!bound) {
            if (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WLAN) {
                boolean connPersistenceOnRestart = mPhone.getContext().getResources()
                   .getBoolean(com.android
@@ -5313,10 +5306,6 @@ public class DcTracker extends Handler {
                    cleanUpAllConnectionsInternal(false, Phone.REASON_IWLAN_DATA_SERVICE_DIED);
                }
            }
            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;
    }