Prevent turning on airplane mode when in network identified e-call.

When the device is in a network-identified emergency call, prevent the
user from toggling on airplane mode.  Instead of relying on old
PhoneUtils code to see if there is an emergency call, rely on Telecom
which knows of all calls.

Test: Used new test intent to identify call as ecall and verified user is
not able to turn on airplane mode.
Test: Set outgoing number as emergency number using ril.ecclist property
and verify user is not able to turn on airplane mode.
Bug: 77565333

Change-Id: Idb8d4745a1651097c7276233bc06cc8cb254ac96
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index b1e061f..d0b236f 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -41,6 +41,7 @@
 import android.os.UserManager;
 import android.preference.PreferenceManager;
 import android.provider.Settings;
+import android.telecom.TelecomManager;
 import android.telephony.CarrierConfigManager;
 import android.telephony.ServiceState;
 import android.telephony.SubscriptionManager;
@@ -665,7 +666,9 @@
         if (isAirplaneNewlyOn) {
             // If we are trying to turn off the radio, make sure there are no active
             // emergency calls.  If there are, switch airplane mode back to off.
-            if (PhoneUtils.isInEmergencyCall(mCM)) {
+            TelecomManager tm = (TelecomManager) context.getSystemService(TELECOM_SERVICE);
+
+            if (tm != null && tm.isInEmergencyCall()) {
                 // Switch airplane mode back to off.
                 ConnectivityManager.from(this).setAirplaneMode(false);
                 Toast.makeText(this, R.string.radio_off_during_emergency_call, Toast.LENGTH_LONG)