Merge "Initialize mPhone to the phone in slot 0." into lmp-mr1-dev
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 02632de..58aa511 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -266,6 +266,7 @@
             final int slotId = Integer.parseInt(tabId);
             final SubscriptionInfo sir = findRecordBySlotId(slotId);
             mPhone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(sir.getSubscriptionId()));
+            if (DBG) log("onTabChanged: slotId=" + slotId + " sir=" + sir);
 
             // The User has changed tab; update the body.
             updateBody();
@@ -290,13 +291,16 @@
         super.onCreate(icicle);
         final Context context = getApplicationContext();
 
-        mPhone = PhoneGlobals.getPhone();
         mHandler = new MyHandler();
         mUm = (UserManager) getSystemService(Context.USER_SERVICE);
         final TelephonyManager tm =
                 (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
         mSubscriptionManager = SubscriptionManager.from(this);
 
+        // Initialize Phone to the phone associated with slotId 0
+        final SubscriptionInfo si = findRecordBySlotId(0);
+        mPhone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(si.getSubscriptionId()));
+
         for (int i = 0; i < tm.getSimCount(); i++) {
             SubscriptionInfo sir = findRecordBySlotId(i);
             if (sir != null) {
@@ -402,6 +406,10 @@
         boolean isLteOnCdma = mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
         final int phoneSubId = mPhone.getSubId();
 
+        if (DBG) {
+            log("updateBody: isLteOnCdma=" + isLteOnCdma + " phoneSubId=" + phoneSubId);
+        }
+
         if (prefSet != null) {
             prefSet.removeAll();
             prefSet.addPreference(mButtonDataRoam);