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

Commit e4e8e4d4 authored by Yong Zhang's avatar Yong Zhang Committed by Wink Saville
Browse files

Resolve race conditions with disconnect of CDMA data and airplane mode

Specifically, wait for data to be deactivated when setPowerStateToDesired()
is called during data activation.

Bug: 2101430
Change-Id: Ia97dd799f779c3f88f66bc1235e7a65958e1e04f
parent 31a12429
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -538,12 +538,15 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
                if (!mPendingRadioPowerOffAfterDataOff) {
                    DataConnectionTracker.State currentState = dcTracker.getState();
                    if (currentState != DataConnectionTracker.State.CONNECTED
                            && currentState != DataConnectionTracker.State.DISCONNECTING) {
                            && currentState != DataConnectionTracker.State.DISCONNECTING
                            && currentState != DataConnectionTracker.State.INITING) {
                        if (DBG) log("Data disconnected, turn off radio right away.");
                        cm.setRadioPower(false, null);
                    }
                    else if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 5000)) {
                        if (DBG) log("Wait 5 sec for data to be disconnected, then turn off radio.");
                    else if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 30000)) {
                        if (DBG) {
                            log("Wait up to 30 sec for data to disconnect, then turn off radio.");
                        }
                        mPendingRadioPowerOffAfterDataOff = true;
                    } else {
                        Log.w(LOG_TAG, "Cannot send delayed Msg, turn off radio right away.");