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

Commit 31273d68 authored by Jaesik Kong's avatar Jaesik Kong Committed by Android (Google) Code Review
Browse files

Merge "(APDS) Notify modem to exit EMC mode when call is cancelled" into main

parents 2f8bf3a0 6229e910
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1690,6 +1690,17 @@ public class EmergencyStateTracker {
            mRadioOnHelper.triggerRadioOnAndListen(new RadioOnStateListener.Callback() {
                @Override
                public void onComplete(RadioOnStateListener listener, boolean isRadioReady) {
                    // Make sure the Call has not already been canceled by the user.
                    if (expectedConnection.getState() == STATE_DISCONNECTED) {
                        Rlog.i(TAG, "Call disconnected before the outgoing call was placed."
                                + "Skipping call placement.");
                        // If call is already canceled by the user, notify modem to exit emergency
                        // call mode by sending radio on with forEmergencyCall=false.
                        for (Phone phone : mPhoneFactoryProxy.getPhones()) {
                            phone.setRadioPower(true, false, false, true);
                        }
                        return;
                    }
                    if (!isRadioReady) {
                        if (satelliteController.isSatelliteEnabledOrBeingEnabled()) {
                            // Could not turn satellite off
+5 −2
Original line number Diff line number Diff line
@@ -270,6 +270,7 @@ public class EmergencyStateTrackerTest extends TelephonyTest {
    @Test
    @SmallTest
    public void startEmergencyCall_radioOff_turnOnRadioHangupCallTurnOffRadio() {
        android.telecom.Connection testConnection = new android.telecom.Connection() {};
        EmergencyStateTracker emergencyStateTracker = setupEmergencyStateTracker(
                true /* isSuplDdsSwitchRequiredForEmergencyCall */);
        // Create test Phones and set radio off
@@ -285,7 +286,7 @@ public class EmergencyStateTrackerTest extends TelephonyTest {
                .build();
        doReturn(nri).when(ss).getNetworkRegistrationInfo(anyInt(), anyInt());
        CompletableFuture<Integer> future = emergencyStateTracker.startEmergencyCall(testPhone,
                mTestConnection1, false);
                testConnection, false);

        // startEmergencyCall should trigger radio on
        ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
@@ -294,7 +295,8 @@ public class EmergencyStateTrackerTest extends TelephonyTest {
                eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS));

        // Hangup the call
        emergencyStateTracker.endCall(mTestConnection1);
        testConnection.setDisconnected(null);
        emergencyStateTracker.endCall(testConnection);

        // onTimeout and isOkToCall should return true even in case radion is off
        assertTrue(callback.getValue()
@@ -305,6 +307,7 @@ public class EmergencyStateTrackerTest extends TelephonyTest {
        callback.getValue().onComplete(null, true);

        assertFalse(future.isDone());
        verify(testPhone).setRadioPower(true, false, false, true);
    }

    /**