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

Commit 6229e910 authored by jaesikkong's avatar jaesikkong Committed by Jaesik Kong
Browse files

(APDS) Notify modem to exit EMC mode when call is cancelled

This is sending radio power on request with forEmergency=false to notify
modem to exit emergency call mode when the call is canceled before radio
power is actually on when user dialed emergency call in airplane mode.

Flag: EXEMPT bugfix
Bug: 372376726
Bug: 376212305
Test: atest EmergencyStateTrackerTest
Test: manual test
1. Dial ECC in APM.
2. Cancel the call right away.
3. Verify that APDS sends radio power on without emc flag.
Change-Id: I067a264e514da31bd1a0bd3a521946151facf1ac
parent 8b834e63
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);
    }

    /**