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

Commit 5a5b7a30 authored by Youming Ye's avatar Youming Ye Committed by android-build-merger
Browse files

Merge "Make radio power off immediately after data cleanup is complete"

am: a5eee2c4

Change-Id: Ie50b11c4fdcdbe0d1de7b5dfa7da1db73dc7eb6b
parents 5c199aa1 a5eee2c4
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -4048,16 +4048,16 @@ public class ServiceStateTracker extends Handler {
                        mPhone.mCT.mBackgroundCall.hangupIfAlive();
                        mPhone.mCT.mForegroundCall.hangupIfAlive();
                    }
                    dcTracker.cleanUpAllConnections(Phone.REASON_RADIO_TURNED_OFF);
                    if (dds != mPhone.getSubId()
                            && !ProxyController.getInstance().isDataDisconnected(dds)) {
                        if (DBG) log("Data is active on DDS.  Wait for all data disconnect");
                        // Data is not disconnected on DDS. Wait for the data disconnect complete
                    if (!ProxyController.getInstance().isDataDisconnected(mPhone.getSubId())) {
                        if (DBG) log("Wait for all data disconnect");
                        // Data is not disconnected. Wait for the data disconnect complete
                        // before sending the RADIO_POWER off.
                        ProxyController.getInstance().registerForAllDataDisconnected(dds, this,
                                EVENT_ALL_DATA_DISCONNECTED, null);
                        ProxyController.getInstance().registerForAllDataDisconnected(
                                mPhone.getSubId(), this, EVENT_ALL_DATA_DISCONNECTED, null);
                        mPendingRadioPowerOffAfterDataOff = true;
                    }
                    dcTracker.cleanUpAllConnections(Phone.REASON_RADIO_TURNED_OFF);

                    Message msg = Message.obtain(this);
                    msg.what = EVENT_SET_RADIO_POWER_OFF;
                    msg.arg1 = ++mPendingRadioPowerOffAfterDataOffTag;
+13 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.nullable;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.anyObject;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.doReturn;
@@ -214,6 +215,18 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        assertTrue(oldState != mSimulatedCommands.getRadioState().isOn());
    }

    @Test
    @MediumTest
    public void testSetRadioPowerOffUnderDataConnected() {
        sst.setRadioPower(true);
        waitForMs(100);
        doReturn(false).when(mDct).isDisconnected();
        sst.setRadioPower(false);
        waitForMs(200);
        verify(this.mProxyController, times(1)).registerForAllDataDisconnected(anyInt(),
                 eq(sst), anyInt(), anyObject());
    }

    @Test
    @MediumTest
    public void testSetRadioPowerFromCarrier() {