Merge "Notifying ECBM stop, if an emergency call starts during ECBM" into main
diff --git a/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java b/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java
index 3c2ad0cd..48cc7cb 100644
--- a/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java
+++ b/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java
@@ -601,6 +601,11 @@
                     releaseWakeLock();
                     ((GsmCdmaPhone) mPhone).notifyEcbmTimerReset(Boolean.TRUE);
 
+                    if (mFeatureFlags.emergencyCallbackModeNotification()) {
+                        mPhone.stopEmergencyCallbackMode(EMERGENCY_CALLBACK_MODE_CALL,
+                                STOP_REASON_OUTGOING_EMERGENCY_CALL_INITIATED);
+                    }
+
                     mOngoingCallProperties = 0;
                     mCallEmergencyModeFuture = new CompletableFuture<>();
                     setEmergencyMode(mPhone, EMERGENCY_TYPE_CALL, MODE_EMERGENCY_WWAN,
diff --git a/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java
index 32cca3c..df14080 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java
@@ -1107,7 +1107,7 @@
         verify(phone0, never()).exitEmergencyMode(any(Message.class));
         verify(phone0, times(2)).startEmergencyCallbackMode(
                 eq(EMERGENCY_CALLBACK_MODE_CALL), anyLong());
-        verify(phone0, never()).stopEmergencyCallbackMode(
+        verify(phone0, times(1)).stopEmergencyCallbackMode(
                 eq(EMERGENCY_CALLBACK_MODE_CALL), anyInt());
     }