Loading src/com/android/server/telecom/CreateConnectionProcessor.java +12 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,18 @@ final class CreateConnectionProcessor { Log.i(this, "Emergency number detected"); mAttemptRecords.clear(); List<PhoneAccount> allAccounts = mPhoneAccountRegistrar.getAllPhoneAccounts(); if (allAccounts.isEmpty()) { // If the list of phone accounts is empty at this point, it means Telephony hasn't // registered any phone accounts yet. Add a fallback emergency phone account so // that emergency calls can still go through. We create a new ArrayLists here just // in case the implementation of PhoneAccountRegistrar ever returns an unmodifiable // list. allAccounts = new ArrayList<PhoneAccount>(); allAccounts.add(TelephonyUtil.getDefaultEmergencyPhoneAccount()); } // First, add SIM phone accounts which can place emergency calls. for (PhoneAccount phoneAccount : allAccounts) { if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS) && Loading src/com/android/server/telecom/TelephonyUtil.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.server.telecom; import android.content.ComponentName; import android.content.Context; import android.net.Uri; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telephony.PhoneNumberUtils; /** Loading @@ -33,8 +35,25 @@ public final class TelephonyUtil { private static final String PSTN_CALL_SERVICE_CLASS_NAME = "com.android.services.telephony.TelephonyConnectionService"; private static final PhoneAccountHandle DEFAULT_EMERGENCY_PHONE_ACCOUNT_HANDLE = new PhoneAccountHandle( new ComponentName(TELEPHONY_PACKAGE_NAME, PSTN_CALL_SERVICE_CLASS_NAME), "E"); private TelephonyUtil() {} /** * @return fallback {@link PhoneAccount} to be used by Telecom for emergency calls in the * rare case that Telephony has not registered any phone accounts yet. Details about this * account are not expected to be displayed in the UI, so the description, etc are not * populated. */ static PhoneAccount getDefaultEmergencyPhoneAccount() { return PhoneAccount.builder(DEFAULT_EMERGENCY_PHONE_ACCOUNT_HANDLE, "E") .setCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION | PhoneAccount.CAPABILITY_CALL_PROVIDER | PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS).build(); } static boolean isPstnComponentName(ComponentName componentName) { final ComponentName pstnComponentName = new ComponentName( TELEPHONY_PACKAGE_NAME, PSTN_CALL_SERVICE_CLASS_NAME); Loading Loading
src/com/android/server/telecom/CreateConnectionProcessor.java +12 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,18 @@ final class CreateConnectionProcessor { Log.i(this, "Emergency number detected"); mAttemptRecords.clear(); List<PhoneAccount> allAccounts = mPhoneAccountRegistrar.getAllPhoneAccounts(); if (allAccounts.isEmpty()) { // If the list of phone accounts is empty at this point, it means Telephony hasn't // registered any phone accounts yet. Add a fallback emergency phone account so // that emergency calls can still go through. We create a new ArrayLists here just // in case the implementation of PhoneAccountRegistrar ever returns an unmodifiable // list. allAccounts = new ArrayList<PhoneAccount>(); allAccounts.add(TelephonyUtil.getDefaultEmergencyPhoneAccount()); } // First, add SIM phone accounts which can place emergency calls. for (PhoneAccount phoneAccount : allAccounts) { if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS) && Loading
src/com/android/server/telecom/TelephonyUtil.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.server.telecom; import android.content.ComponentName; import android.content.Context; import android.net.Uri; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telephony.PhoneNumberUtils; /** Loading @@ -33,8 +35,25 @@ public final class TelephonyUtil { private static final String PSTN_CALL_SERVICE_CLASS_NAME = "com.android.services.telephony.TelephonyConnectionService"; private static final PhoneAccountHandle DEFAULT_EMERGENCY_PHONE_ACCOUNT_HANDLE = new PhoneAccountHandle( new ComponentName(TELEPHONY_PACKAGE_NAME, PSTN_CALL_SERVICE_CLASS_NAME), "E"); private TelephonyUtil() {} /** * @return fallback {@link PhoneAccount} to be used by Telecom for emergency calls in the * rare case that Telephony has not registered any phone accounts yet. Details about this * account are not expected to be displayed in the UI, so the description, etc are not * populated. */ static PhoneAccount getDefaultEmergencyPhoneAccount() { return PhoneAccount.builder(DEFAULT_EMERGENCY_PHONE_ACCOUNT_HANDLE, "E") .setCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION | PhoneAccount.CAPABILITY_CALL_PROVIDER | PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS).build(); } static boolean isPstnComponentName(ComponentName componentName) { final ComponentName pstnComponentName = new ComponentName( TELEPHONY_PACKAGE_NAME, PSTN_CALL_SERVICE_CLASS_NAME); Loading