Check Phone's ServiceState to see if it accepts Emergency Calls

When both SIM are PIN/PUK locked, only the SIM set as the default Data
SIM will allow outgoing Emergency Calls. Modify
TelephonyConnectionService#getFirstphoneForEmergencyCall to always
choose the SIM slot that allows emergency calling.

Change-Id: Ie2957f51f8713eec316252dc9e29d4f47ec78eae
Fix: 28320008
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 91ee5a0..40e4ef9 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -617,7 +617,8 @@
             if (phone == null)
                 continue;
 
-            if (ServiceState.STATE_IN_SERVICE == phone.getServiceState().getState()) {
+            if (ServiceState.STATE_IN_SERVICE == phone.getServiceState().getState() ||
+                    phone.getServiceState().isEmergencyOnly()) {
                 // the slot has the radio on & state is in service. This will be quicker,
                 // so just shortcut and use this option.
                 Log.d(this, "getFirstPhoneForEmergencyCall, radio on & in service, slotId:" + i);