MSIM: Add MSIM support to ECBM implementation

Make use of phoneid details in ECBM intent to display ECBM dialog
properly for appropriate phone object.

Change-Id: I7af9f4821b3590dbb080d5ab5e591c3a38e5a389
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index f06ae0c..ca25653 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -73,12 +73,13 @@
 
     @Override
     public void onCreate() {
+         Phone phoneInEcm = PhoneGlobals.getInstance().getPhoneInEcm();
         // Check if it is CDMA phone
-        if ((PhoneFactory.getDefaultPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA)
-                && (PhoneFactory.getDefaultPhone().getImsPhone() == null)) {
-            Log.e(LOG_TAG, "Error! Emergency Callback Mode not supported for " +
-                    PhoneFactory.getDefaultPhone().getPhoneName() + " phones");
+        if (phoneInEcm == null || ((phoneInEcm.getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA)
+                && (phoneInEcm.getImsPhone() == null))) {
+            Log.e(LOG_TAG, "Error! Emergency Callback Mode not supported for " + phoneInEcm);
             stopSelf();
+            return;
         }
 
         // Register receiver for intents
@@ -90,7 +91,7 @@
         mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
 
         // Register ECM timer reset notfication
-        mPhone = PhoneFactory.getDefaultPhone();
+        mPhone = phoneInEcm;
         mPhone.registerForEcmTimerReset(mHandler, ECM_TIMER_RESET, null);
 
         startTimerNotification();