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

Commit 9268a5eb authored by Manish Dungriyal's avatar Manish Dungriyal
Browse files

Log atom for Emergency Dialed number.

Log push atom (EmergencyNumberDialed) when an emergency call is made.

Bug: 233263956
Test: m statsd_testdrive
Change-Id: Ic1a4adc34c3838543b7e79d23fda77fba4803b50
parent cb20ad6e
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -101,7 +101,9 @@ import android.telecom.PhoneAccountSuggestion;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.CarrierConfigManager;
import android.telephony.CellIdentity;
import android.telephony.PhoneNumberUtils;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Pair;
@@ -1719,6 +1721,23 @@ public class CallsManager extends Call.ListenerBase

            call.initAnalytics(callingPackage, creationLogs.toString());

            // Log info for emergency call
            if (call.isEmergencyCall()) {
                String simNumeric = "";
                String networkNumeric = "";
                int defaultVoiceSubId = SubscriptionManager.getDefaultVoiceSubscriptionId();
                if (defaultVoiceSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
                    TelephonyManager tm = getTelephonyManager().createForSubscriptionId(
                            defaultVoiceSubId);
                    CellIdentity cellIdentity = tm.getLastKnownCellIdentity();
                    simNumeric = tm.getSimOperatorNumeric();
                    networkNumeric = (cellIdentity != null) ? cellIdentity.getPlmn() : "";
                }
                TelecomStatsLog.write(TelecomStatsLog.EMERGENCY_NUMBER_DIALED,
                            handle.getSchemeSpecificPart(),
                            callingPackage, simNumeric, networkNumeric);
            }

            // Ensure new calls related to self-managed calls/connections are set as such.  This
            // will be overridden when the actual connection is returned in startCreateConnection,
            // however doing this now ensures the logs and any other logic will treat this call as