Merge "Update SubscriptionInfo and mPhone for new intents." into lmp-mr1-dev
diff --git a/res/color/settings_text_color_primary.xml b/res/color/settings_text_color_primary.xml
new file mode 100644
index 0000000..381465e
--- /dev/null
+++ b/res/color/settings_text_color_primary.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_enabled="false" android:color="@color/setting_disabled_color" />
+    <item android:color="@color/setting_primary_color" />
+</selector>
diff --git a/res/color/settings_text_color_secondary.xml b/res/color/settings_text_color_secondary.xml
new file mode 100644
index 0000000..7fa4435
--- /dev/null
+++ b/res/color/settings_text_color_secondary.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_enabled="false" android:color="@color/setting_disabled_color" />
+    <item android:color="@color/setting_secondary_color" />
+</selector>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 3f3990c..45b984e 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -50,6 +50,8 @@
     <color name="setting_primary_color">#333333</color>
     <!-- Color for the setting description text. -->
     <color name="setting_secondary_color">#737373</color>
+    <color name="setting_disabled_color">#aaaaaa</color>
+
     <color name="dialer_dialpad_touch_tint">#330288d1</color>
     <color name="floating_action_button_touch_tint">#80ffffff</color>
 
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1383a62..944bbee 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -170,9 +170,9 @@
         <item name="android:windowActionBarOverlay">false</item>
         <item name="android:colorPrimaryDark">@color/actionbar_background_color_dark</item>
         <!-- Setting text. -->
-        <item name="android:textColorPrimary">@color/setting_primary_color</item>
+        <item name="android:textColorPrimary">@color/settings_text_color_primary</item>
         <!-- Setting description. -->
-        <item name="android:textColorSecondary">@color/setting_secondary_color</item>
+        <item name="android:textColorSecondary">@color/settings_text_color_secondary</item>
     </style>
 
     <style name="DialerSettingsLight" parent="SettingsLight">
diff --git a/src/com/android/phone/CdmaOptions.java b/src/com/android/phone/CdmaOptions.java
index 50a6def..897c797 100644
--- a/src/com/android/phone/CdmaOptions.java
+++ b/src/com/android/phone/CdmaOptions.java
@@ -81,6 +81,7 @@
                             final Intent intent = new Intent(Settings.ACTION_APN_SETTINGS);
                             // This will setup the Home and Search affordance
                             intent.putExtra(":settings:show_fragment_as_subsetting", true);
+                            intent.putExtra("sub_id", mPhone.getSubId());
                             mPrefActivity.startActivity(intent);
                             return true;
                         }
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);
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 528b65d..5a15a47 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -179,6 +179,13 @@
         super(null);
         mTelephonyConnectionService = telephonyConnectionService;
         setConferenceHost(conferenceHost);
+        if (conferenceHost != null && conferenceHost.getCall() != null
+                && conferenceHost.getCall().getPhone() != null) {
+            mPhoneAccount = PhoneUtils.makePstnPhoneAccountHandle(
+                    conferenceHost.getCall().getPhone());
+            Log.v(this, "set phacc to " + mPhoneAccount);
+        }
+
         setConnectionCapabilities(
                 Connection.CAPABILITY_SUPPORT_HOLD |
                 Connection.CAPABILITY_HOLD |