Merge "PhoneInterfaceManager: Adding a call to set voicemail number." into lmp-mr1-dev
diff --git a/res/drawable-hdpi/ic_multi_sim1.png b/res/drawable-hdpi/ic_multi_sim1.png
deleted file mode 100644
index 12b800c..0000000
--- a/res/drawable-hdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim2.png b/res/drawable-hdpi/ic_multi_sim2.png
deleted file mode 100644
index d468081..0000000
--- a/res/drawable-hdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim3.png b/res/drawable-hdpi/ic_multi_sim3.png
deleted file mode 100644
index be17bd4..0000000
--- a/res/drawable-hdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim4.png b/res/drawable-hdpi/ic_multi_sim4.png
deleted file mode 100644
index fbff161..0000000
--- a/res/drawable-hdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_overflow_menu.png b/res/drawable-hdpi/ic_overflow_menu.png
deleted file mode 100644
index 262e9df..0000000
--- a/res/drawable-hdpi/ic_overflow_menu.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim1.png b/res/drawable-mdpi/ic_multi_sim1.png
deleted file mode 100644
index ef350bf..0000000
--- a/res/drawable-mdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim2.png b/res/drawable-mdpi/ic_multi_sim2.png
deleted file mode 100644
index a265723..0000000
--- a/res/drawable-mdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim3.png b/res/drawable-mdpi/ic_multi_sim3.png
deleted file mode 100644
index cce2d3f..0000000
--- a/res/drawable-mdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim4.png b/res/drawable-mdpi/ic_multi_sim4.png
deleted file mode 100644
index 233c386..0000000
--- a/res/drawable-mdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_overflow_menu.png b/res/drawable-mdpi/ic_overflow_menu.png
deleted file mode 100644
index 0e720dd..0000000
--- a/res/drawable-mdpi/ic_overflow_menu.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim1.png b/res/drawable-xhdpi/ic_multi_sim1.png
deleted file mode 100644
index 1ad3288..0000000
--- a/res/drawable-xhdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim2.png b/res/drawable-xhdpi/ic_multi_sim2.png
deleted file mode 100644
index 3a4152e..0000000
--- a/res/drawable-xhdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim3.png b/res/drawable-xhdpi/ic_multi_sim3.png
deleted file mode 100644
index 4c36a1c..0000000
--- a/res/drawable-xhdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim4.png b/res/drawable-xhdpi/ic_multi_sim4.png
deleted file mode 100644
index 26db92c..0000000
--- a/res/drawable-xhdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_overflow_menu.png b/res/drawable-xhdpi/ic_overflow_menu.png
deleted file mode 100644
index 9156076..0000000
--- a/res/drawable-xhdpi/ic_overflow_menu.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim1.png b/res/drawable-xxhdpi/ic_multi_sim1.png
deleted file mode 100644
index 6d89d58..0000000
--- a/res/drawable-xxhdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim2.png b/res/drawable-xxhdpi/ic_multi_sim2.png
deleted file mode 100644
index b9f3351..0000000
--- a/res/drawable-xxhdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim3.png b/res/drawable-xxhdpi/ic_multi_sim3.png
deleted file mode 100644
index beef5c8..0000000
--- a/res/drawable-xxhdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim4.png b/res/drawable-xxhdpi/ic_multi_sim4.png
deleted file mode 100644
index b947e84..0000000
--- a/res/drawable-xxhdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_overflow_menu.png b/res/drawable-xxhdpi/ic_overflow_menu.png
deleted file mode 100644
index 92526f5..0000000
--- a/res/drawable-xxhdpi/ic_overflow_menu.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_arrow_back_24dp.png b/res/drawable-xxxhdpi/ic_arrow_back_24dp.png
new file mode 100644
index 0000000..037b6f1
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_arrow_back_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_multi_sim1.png b/res/drawable-xxxhdpi/ic_multi_sim1.png
deleted file mode 100644
index a4ebf5c..0000000
--- a/res/drawable-xxxhdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_multi_sim2.png b/res/drawable-xxxhdpi/ic_multi_sim2.png
deleted file mode 100644
index 5835784..0000000
--- a/res/drawable-xxxhdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_multi_sim3.png b/res/drawable-xxxhdpi/ic_multi_sim3.png
deleted file mode 100644
index cc9ef41..0000000
--- a/res/drawable-xxxhdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_multi_sim4.png b/res/drawable-xxxhdpi/ic_multi_sim4.png
deleted file mode 100644
index 49f2c09..0000000
--- a/res/drawable-xxxhdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/network_settings.xml b/res/layout/network_settings.xml
new file mode 100644
index 0000000..d2a4acc
--- /dev/null
+++ b/res/layout/network_settings.xml
@@ -0,0 +1,60 @@
+<?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.
+-->
+
+<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@android:id/tabhost"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:id="@+id/tabs_container"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+        <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:scrollbars="none"
+            android:fillViewport="true">
+
+            <TabWidget
+                android:id="@android:id/tabs"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                style="?android:attr/tabWidgetStyle" />
+
+        </HorizontalScrollView>
+
+        <!-- give an empty content area to make tabhost happy -->
+        <FrameLayout
+            android:id="@android:id/tabcontent"
+            android:layout_width="0dip"
+            android:layout_height="0dip" />
+
+        <ListView
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:layout_weight="1"
+            android:clipChildren="false"
+            android:clipToPadding="false"
+            android:smoothScrollbar="false" />
+
+    </LinearLayout>
+
+</TabHost>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a97d7c4..23f44e3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -20,7 +20,7 @@
          and other settings UIs.  This is the version of the label for
          tablet devices, where the phone app handles mobile data but not
          actual phone calls. -->
-    <string name="phoneAppLabel" product="tablet">Mobile Data</string>
+    <string name="phoneAppLabel" product="tablet">Cellular Data</string>
 
     <!-- Official label of the phone app, as seen in "Manage Applications"
          and other settings UIs. -->
@@ -39,7 +39,7 @@
     <!-- Incoming call screen, string when number hidden -->
     <string name="private_num">Private number</string>
     <!-- Incoming call screen, string when called from a pay phone -->
-    <string name="payphone">Pay phone</string>
+    <string name="payphone">Payphone</string>
     <!-- In-call screen: status label for a call that's on hold -->
     <string name="onHold">On hold</string>
     <!-- Possible error messages with outgoing calls --><skip/>
@@ -126,7 +126,7 @@
     <string name="settings_label">Network settings</string>
 
     <!-- Label for settings screen for phone accounts. -->
-    <string name="phone_accounts">Phone account settings</string>
+    <string name="phone_accounts">Calling accounts</string>
     <!-- Label for list item which opens a dialog to select the default outgoing account -->
     <string name="phone_accounts_make_calls_with">Make calls with</string>
     <!-- Label for list item which opens a dialog to select the default outgoing account for SIP calls. -->
@@ -264,6 +264,8 @@
 
     <!-- Title of the progress dialog displayed while updating Call settings -->
     <string name="updating_title">Call settings</string>
+    <!-- Toast in Call settings when asked to launch settings for a secondary user -->
+    <string name="call_settings_primary_user_only">Call settings can only be changed by the primary user.</string>
     <!-- Title of the "Call settings" settings screen, with a text label identifying which SIM the settings are for. -->
     <string name="call_settings_with_label">Call settings (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
     <!-- Title of the alert dialog displayed if an error occurs while updating Call settings -->
@@ -286,9 +288,9 @@
     <!-- Button label used to dismiss the "Call settings error" dialog -->
     <string name="close_dialog">OK</string>
     <!-- Button label used in several settings-related dialogs -->
-    <string name="enable">Enable</string>
+    <string name="enable">Turn on</string>
     <!-- Button label used in several settings-related dialogs -->
-    <string name="disable">Disable</string>
+    <string name="disable">Turn off</string>
     <!-- Button label which indicates the user wants to update a stored
          phone number; used in several settings-related dialogs -->
     <string name="change_num">Update</string>
@@ -442,7 +444,7 @@
          "data roaming" feature turned off. -->
     <string name="roaming_reenable_message">You\'ve lost data connectivity because you left your home network with data roaming turned off.</string>
     <!-- Mobile network settings screen, dialog message when user selects the Data roaming check box -->
-    <string name="roaming_warning">Allow data roaming? You may incur significant roaming charges!</string>
+    <string name="roaming_warning">Allow data usage when roaming? Significant charges may apply.</string>
 
     <!-- USSD aggregation dialog box: separator strings between messages (new-lines will be added before and after) -->
     <string name="ussd_dialog_sep" translatable="false">----------</string>
@@ -813,21 +815,21 @@
     <!-- SIM PIN screen: error message when PIN is too short or too long -->
     <string name="invalidPin">Type a PIN that is 4 to 8 numbers.</string>
     <!-- Title of "Disable SIM PIN" screen -->
-    <string name="disable_sim_pin">Disable SIM PIN</string>
+    <string name="disable_sim_pin">Clear SIM PIN</string>
     <!-- Title of "Enable SIM PIN" screen -->
-    <string name="enable_sim_pin">Enable SIM PIN</string>
+    <string name="enable_sim_pin">Set SIM PIN</string>
     <!-- SIM PIN screen: progress message displayed while enabling -->
-    <string name="enable_in_progress">Please wait\u2026</string>
+    <string name="enable_in_progress">Setting PIN\u2026</string>
     <!-- SIM PIN screen: status message displayed in a popup (toast) -->
-    <string name="enable_pin_ok">SIM PIN enabled.</string>
+    <string name="enable_pin_ok">PIN set</string>
     <!-- SIM PIN screen: status message displayed in a popup (toast) -->
-    <string name="disable_pin_ok">SIM PIN disabled.</string>
+    <string name="disable_pin_ok">PIN cleared</string>
     <!-- SIM PIN screen: error message displayed in a popup (toast) -->
-    <string name="pin_failed">The PIN you typed was incorrect.</string>
+    <string name="pin_failed">PIN incorrect</string>
     <!-- SIM PIN screen: status message displayed in a popup (toast) -->
-    <string name="pin_changed">SIM PIN changed successfully.</string>
+    <string name="pin_changed">PIN updated</string>
     <!-- SIM PIN screen: error message displayed in a dialog -->
-    <string name="puk_requested">Password incorrect, PIN Blocked! PUK requested.</string>
+    <string name="puk_requested">Password incorrect. PIN now blocked. PUK requested.</string>
 
     <!-- SIM PIN2 strings -->
     <!-- SIM PIN2 screen: label for PIN entry widget -->
@@ -839,29 +841,29 @@
     <!-- SIM PIN2 screen: label for PIN entry widget -->
     <string name="confirmPin2Label">Confirm new PIN2</string>
     <!-- SIM PIN2 screen: error message -->
-    <string name="badPuk2">The PUK2 you typed isn\'t correct. Try again. </string>
+    <string name="badPuk2">PUK2 incorrect. Try again.</string>
     <!-- SIM PIN2 screen: error message -->
-    <string name="badPin2">The old PIN2 you typed isn\'t correct. Try again.</string>
+    <string name="badPin2">Old PIN2 incorrect. Try again.</string>
     <!-- SIM PIN2 screen: error message -->
-    <string name="mismatchPin2">The PIN2s you typed don\'t match. Try again.</string>
+    <string name="mismatchPin2">PIN2s don\'t match. Try again.</string>
     <!-- SIM PIN2 screen: error message -->
-    <string name="invalidPin2">Type a PIN2 that is 4 to 8 numbers.</string>
+    <string name="invalidPin2">Enter a PIN2 that is 4 to 8 numbers.</string>
     <!-- SIM PIN2 screen: error message -->
-    <string name="invalidPuk2">Type a PUK2 that is 8 numbers.</string>
+    <string name="invalidPuk2">Enter a PUK2 that is 8 numbers.</string>
     <!-- SIM PIN2 screen: status message displayed in a popup (toast) -->
-    <string name="pin2_changed">PIN2 changed successfully.</string>
+    <string name="pin2_changed">PIN2 updated</string>
     <!-- SIM PIN2 screen: label for PUK2 entry widget -->
-    <string name="label_puk2_code">Type PUK2 code</string>
+    <string name="label_puk2_code">Enter PUK2 code</string>
     <!-- SIM PIN2 screen: error message displayed in a dialog -->
-    <string name="fdn_enable_puk2_requested">Password incorrect, PIN2 Blocked. Please change PIN2 and retry!</string>
+    <string name="fdn_enable_puk2_requested">Password incorrect. PIN2 now Blocked. To try again, change PIN 2.</string>
     <!-- SIM PIN2 screen: error message displayed in a dialog -->
-    <string name="puk2_requested">Password incorrect, SIM is locked. PUK2 requested.</string>
+    <string name="puk2_requested">Password incorrect. SIM now locked. Enter PUK2.</string>
     <!-- SIM PIN2 screen: error message -->
     <string name="puk2_blocked">PUK2 is permanently blocked.</string>
     <!-- SIM PIN2 screen: error message -->
-    <string name="pin2_attempts">\nThere are <xliff:g id="number">%d</xliff:g> remaining attempts.</string>
+    <string name="pin2_attempts">\nYou have <xliff:g id="number">%d</xliff:g> remaining attempts.</string>
     <!-- SIM PIN screen: status message displayed in a popup (toast) -->
-    <string name="pin2_unblocked">PIN2 Unblocked!</string>
+    <string name="pin2_unblocked">PIN2 no longer blocked</string>
 
     <!-- SIM PIN screen: button label -->
     <string name="doneButton">Done</string>
@@ -880,7 +882,7 @@
     <!-- In-call screen: status label for a call in the "dialing" state -->
     <string name="card_title_dialing">Dialing</string>
     <!-- In-call screen: status label for a re-dialing call -->
-    <string name="card_title_redialing">Retrying</string>
+    <string name="card_title_redialing">Redialing</string>
     <!-- In-call screen: status label for a conference call -->
     <string name="card_title_conf_call">Conference call</string>
     <!-- In-call screen: status label for an incoming call -->
@@ -952,38 +954,38 @@
     <!-- In-call screen: call failure message displayed in an error dialog -->
     <string name="incall_error_out_of_service">Cellular network not available.</string>
     <!-- In-call screen: call failure message displayed in an error dialog -->
-    <string name="incall_error_no_phone_number_supplied">Call not sent, no valid number entered.</string>
+    <string name="incall_error_no_phone_number_supplied">To place a call, enter a valid number.</string>
     <!-- In-call screen: call failure message displayed in an error dialog -->
-    <string name="incall_error_call_failed">Call not sent.</string>
+    <string name="incall_error_call_failed">Can\'t call.</string>
     <!-- In-call screen: status message displayed in a dialog when starting an MMI -->
     <string name="incall_status_dialed_mmi">Starting MMI sequence\u2026</string>
     <!-- In-call screen: message displayed in an error dialog -->
-    <string name="incall_error_supp_service_unknown">Unsupported service.</string>
+    <string name="incall_error_supp_service_unknown">Service not supported</string>
     <!-- In-call screen: message displayed in an error dialog -->
-    <string name="incall_error_supp_service_switch">Unable to switch calls.</string>
+    <string name="incall_error_supp_service_switch">Can\'t switch calls.</string>
     <!-- In-call screen: message displayed in an error dialog -->
-    <string name="incall_error_supp_service_separate">Unable to separate call.</string>
+    <string name="incall_error_supp_service_separate">Can\'t separate call.</string>
     <!-- In-call screen: message displayed in an error dialog -->
-    <string name="incall_error_supp_service_transfer">Unable to transfer call.</string>
+    <string name="incall_error_supp_service_transfer">Can\'t transfer.</string>
     <!-- In-call screen: message displayed in an error dialog -->
-    <string name="incall_error_supp_service_conference">Unable to conference calls.</string>
+    <string name="incall_error_supp_service_conference">Can\'t conference.</string>
     <!-- In-call screen: message displayed in an error dialog -->
-    <string name="incall_error_supp_service_reject">Unable to reject call.</string>
+    <string name="incall_error_supp_service_reject">Can\'t reject call.</string>
     <!-- In-call screen: message displayed in an error dialog -->
-    <string name="incall_error_supp_service_hangup">Unable to release call(s).</string>
+    <string name="incall_error_supp_service_hangup">Can\'t release call(s).</string>
 
     <!-- Dialog title for the "radio enable" UI for emergency calls -->
     <string name="emergency_enable_radio_dialog_title">Emergency call</string>
     <!-- Status message for the "radio enable" UI for emergency calls -->
     <string name="emergency_enable_radio_dialog_message">Turning on radio\u2026</string>
     <!-- Status message for the "radio enable" UI for emergency calls -->
-    <string name="emergency_enable_radio_dialog_retry">Out of service area, retrying\u2026</string>
+    <string name="emergency_enable_radio_dialog_retry">No service. Trying again\u2026</string>
 
     <!-- Dialer text on Emergency Dialer -->
     <!-- Emergency dialer: message displayed in an error dialog -->
-    <string name="dial_emergency_error">Call not sent. <xliff:g id="non_emergency_number">%s</xliff:g> is not an emergency number!</string>
+    <string name="dial_emergency_error">Can\'t call. <xliff:g id="non_emergency_number">%s</xliff:g> is not an emergency number.</string>
     <!-- Emergency dialer: message displayed in an error dialog -->
-    <string name="dial_emergency_empty_error">Call not sent. Dial an emergency number!</string>
+    <string name="dial_emergency_empty_error">Can\'t call. Dial an emergency number.</string>
 
     <!-- Displayed in the text entry box in the dialer when in landscape mode to guide the user
          to dial using the physical keyboard -->
@@ -1098,9 +1100,9 @@
     <string name="ota_speaker">Speaker</string>
     <!-- String to be displayed on OTA listen screen once user has selected the
          correct option to begin provisioning -->
-    <string name="ota_progress">Wait while your phone is being programmed.</string>
+    <string name="ota_progress">Programming your phone\u2026</string>
     <!-- String to display within the OTA Fail Notice dialog -->
-    <string name="ota_failure">Programming unsuccessful</string>
+    <string name="ota_failure">Couldn\'t program your phone</string>
     <!-- String to be displayed on the OTA Fail/Success screen upon successful provisioning -->
     <string name="ota_successful">Your phone is now activated.  It may take up to 15 minutes for service to start.</string>
     <!-- String to be displayed on the OTA Fail/Success screen upon unsuccessful provisioning -->
@@ -1220,7 +1222,7 @@
 
     <!--  Setting option name to enable or disable dialpad autocomplete functionality
          [CHAR LIMIT=30] -->
-    <string name="dial_pad_autocomplete">Dial pad autocomplete</string>
+    <string name="dial_pad_autocomplete">Dialpad autocomplete</string>
 
     <!-- Title for the category "ringtone", which is shown above ringtone and vibration
          related settings.
diff --git a/res/xml/call_feature_setting.xml b/res/xml/call_feature_setting.xml
index 0182ac0..2ad10f2 100644
--- a/res/xml/call_feature_setting.xml
+++ b/res/xml/call_feature_setting.xml
@@ -25,7 +25,7 @@
             android:targetPackage="com.android.phone"
             android:targetClass="com.android.phone.settings.PhoneAccountSettingsActivity"/>
 
-    </PreferenceScreen>>
+    </PreferenceScreen>
 
     <PreferenceScreen
         android:key="button_voicemail_category_key"
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 4651677..7e670aa 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -52,6 +52,7 @@
 import android.util.Log;
 import android.view.MenuItem;
 import android.widget.ListAdapter;
+import android.widget.Toast;
 
 import com.android.ims.ImsManager;
 import com.android.internal.telephony.CallForwardInfo;
@@ -1123,13 +1124,21 @@
         super.onCreate(icicle);
         if (DBG) log("onCreate: Intent is " + getIntent());
 
+        // Make sure we are running as the primary user.
+        if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
+            Toast.makeText(this, R.string.call_settings_primary_user_only,
+                    Toast.LENGTH_SHORT).show();
+            finish();
+            return;
+        }
+
         mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
         mVmProviderSettingsUtil = new VoicemailProviderSettingsUtil(getApplicationContext());
 
         // Show the voicemail preference in onResume if the calling intent specifies the
         // ACTION_ADD_VOICEMAIL action.
         mShowVoicemailPreference = (icicle == null) &&
-                getIntent().getAction().equals(ACTION_ADD_VOICEMAIL);
+                TextUtils.equals(getIntent().getAction(), ACTION_ADD_VOICEMAIL);
 
         mSubscriptionInfoHelper = new SubscriptionInfoHelper(getIntent());
         mSubscriptionInfoHelper.setActionBarTitle(
diff --git a/src/com/android/phone/CallWaitingCheckBoxPreference.java b/src/com/android/phone/CallWaitingCheckBoxPreference.java
index ce2a420..bda8b3b 100644
--- a/src/com/android/phone/CallWaitingCheckBoxPreference.java
+++ b/src/com/android/phone/CallWaitingCheckBoxPreference.java
@@ -87,15 +87,20 @@
                 }
             }
 
-            if (ar.exception != null) {
+            if (ar.exception instanceof CommandException) {
                 if (DBG) {
-                    Log.d(LOG_TAG, "handleGetCallWaitingResponse: ar.exception=" + ar.exception);
+                    Log.d(LOG_TAG, "handleGetCallWaitingResponse: CommandException=" +
+                            ar.exception);
                 }
                 if (mTcpListener != null) {
                     mTcpListener.onException(CallWaitingCheckBoxPreference.this,
                             (CommandException)ar.exception);
                 }
-            } else if (ar.userObj instanceof Throwable) {
+            } else if (ar.userObj instanceof Throwable || ar.exception != null) {
+                // Still an error case but just not a CommandException.
+                if (DBG) {
+                    Log.d(LOG_TAG, "handleGetCallWaitingResponse: Exception" + ar.exception);
+                }
                 if (mTcpListener != null) {
                     mTcpListener.onError(CallWaitingCheckBoxPreference.this, RESPONSE_ERROR);
                 }
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index bbef032..5a64528 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -20,9 +20,13 @@
 import com.android.ims.ImsException;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.PhoneFactory;
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.internal.telephony.TelephonyProperties;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import android.app.ActionBar;
 import android.app.AlertDialog;
 import android.content.Context;
@@ -41,13 +45,23 @@
 import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
+import android.preference.PreferenceGroup;
 import android.preference.PreferenceScreen;
 import android.preference.SwitchPreference;
+import android.telephony.PhoneStateListener;
+import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.MenuItem;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.TabHost;
+import android.widget.TabHost.OnTabChangeListener;
+import android.widget.TabHost.TabContentFactory;
+import android.widget.TabHost.TabSpec;
+import android.widget.TabWidget;
 
 /**
  * "Mobile network settings" screen.  This preference screen lets you
@@ -96,12 +110,17 @@
     private Preference mLteDataServicePref;
 
     private static final String iface = "rmnet0"; //TODO: this will go away
+    private List<SubscriptionInfo> mSelectableSubInfos = null;
 
     private UserManager mUm;
     private Phone mPhone;
     private MyHandler mHandler;
     private boolean mOkClicked;
 
+    private TabHost mTabHost;
+    private TabWidget mTabWidget;
+    private ListView mListView;
+
     //GsmUmts options and Cdma options
     GsmUmtsOptions mGsmUmtsOptions;
     CdmaOptions mCdmaOptions;
@@ -111,6 +130,22 @@
     private boolean mIsGlobalCdma;
     private boolean mUnavailable;
 
+    private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
+        /*
+         * Enable/disable the 'Enhanced 4G LTE Mode' when in/out of a call.
+         * @see android.telephony.PhoneStateListener#onCallStateChanged(int,
+         * java.lang.String)
+         */
+        @Override
+        public void onCallStateChanged(int state, String incomingNumber) {
+            if (DBG) log("PhoneStateListener.onCallStateChanged: state=" + state);
+            Preference pref = getPreferenceScreen().findPreference(BUTTON_4G_LTE_KEY);
+            if (pref != null) {
+                pref.setEnabled(state == TelephonyManager.CALL_STATE_IDLE);
+            }
+        }
+    };
+
     //This is a method implemented for DialogInterface.OnClickListener.
     //  Used to dismiss the dialogs when they come up.
     public void onClick(DialogInterface dialog, int which) {
@@ -137,6 +172,7 @@
     @Override
     public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
         /** TODO: Refactor and get rid of the if's using subclasses */
+        final int phoneSubId = mPhone.getSubId();
         if (preference.getKey().equals(BUTTON_4G_LTE_KEY)) {
             return true;
         } else if (mGsmUmtsOptions != null &&
@@ -158,7 +194,8 @@
         } else if (preference == mButtonPreferredNetworkMode) {
             //displays the value taken from the Settings.System
             int settingsNetworkMode = android.provider.Settings.Global.getInt(mPhone.getContext().
-                    getContentResolver(), android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
+                    getContentResolver(),
+                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                     preferredNetworkMode);
             mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode));
             return true;
@@ -182,7 +219,8 @@
             return true;
         }  else if (preference == mButtonEnabledNetworks) {
             int settingsNetworkMode = android.provider.Settings.Global.getInt(mPhone.getContext().
-                    getContentResolver(), android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
+                    getContentResolver(),
+                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                     preferredNetworkMode);
             mButtonEnabledNetworks.setValue(Integer.toString(settingsNetworkMode));
             return true;
@@ -206,10 +244,46 @@
                   android.provider.Settings.Global.ENHANCED_4G_MODE_ENABLED, value);
     }
 
+    private OnTabChangeListener mTabListener = new OnTabChangeListener() {
+        @Override
+        public void onTabChanged(String tabId) {
+            final int slotId = Integer.parseInt(tabId);
+            final SubscriptionInfo sir = findRecordBySlotId(slotId);
+            mPhone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(sir.getSubscriptionId()));
+
+            // The User has changed tab; update the body.
+            updateBody();
+        }
+    };
+
+    private TabContentFactory mEmptyTabContent = new TabContentFactory() {
+        @Override
+        public View createTabContent(String tag) {
+            return new View(mTabHost.getContext());
+        }
+    };
+
+    private TabSpec buildTabSpec(String tag, String title) {
+        return mTabHost.newTabSpec(tag).setIndicator(title).setContent(
+                mEmptyTabContent);
+    }
+
     @Override
     protected void onCreate(Bundle icicle) {
         setTheme(R.style.Theme_Material_Settings);
         super.onCreate(icicle);
+        final Context context = getApplicationContext();
+
+        mSelectableSubInfos = new ArrayList<SubscriptionInfo>();
+        final TelephonyManager tm =
+                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+
+        for (int i = 0; i < tm.getSimCount(); i++) {
+            SubscriptionInfo sir = findRecordBySlotId(i);
+            if (sir != null) {
+                mSelectableSubInfos.add(sir);
+            }
+        }
 
         mPhone = PhoneGlobals.getPhone();
         mHandler = new MyHandler();
@@ -250,11 +324,85 @@
 
         mLteDataServicePref = prefSet.findPreference(BUTTON_CDMA_LTE_DATA_SERVICE_KEY);
 
+        if (mSelectableSubInfos.size() > 1) {
+            setContentView(R.layout.network_settings);
+
+            mTabHost = (TabHost) findViewById(android.R.id.tabhost);
+            mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
+            mListView = (ListView) findViewById(android.R.id.list);
+
+            mTabHost.setup();
+            mTabHost.setOnTabChangedListener(mTabListener);
+            mTabHost.clearAllTabs();
+
+            for (int i = 0; i < mSelectableSubInfos.size(); i++) {
+                mTabHost.addTab(buildTabSpec(String.valueOf(i),
+                        String.valueOf(mSelectableSubInfos.get(i).getDisplayName())));
+            }
+        }
+
+        updateBody();
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+
+        if (mUnavailable) {
+            return;
+        }
+
+        // upon resumption from the sub-activity, make sure we re-enable the
+        // preferences.
+        getPreferenceScreen().setEnabled(true);
+
+        // Set UI state in onResume because a user could go home, launch some
+        // app to change this setting's backend, and re-launch this settings app
+        // and the UI state would be inconsistent with actual state
+        mButtonDataRoam.setChecked(mPhone.getDataRoamingEnabled());
+
+        if (getPreferenceScreen().findPreference(BUTTON_PREFERED_NETWORK_MODE) != null)  {
+            mPhone.getPreferredNetworkType(mHandler.obtainMessage(
+                    MyHandler.MESSAGE_GET_PREFERRED_NETWORK_TYPE));
+        }
+
+        if (getPreferenceScreen().findPreference(BUTTON_ENABLED_NETWORKS_KEY) != null)  {
+            mPhone.getPreferredNetworkType(mHandler.obtainMessage(
+                    MyHandler.MESSAGE_GET_PREFERRED_NETWORK_TYPE));
+        }
+
+        if (ImsManager.isVolteEnabledByPlatform(this)) {
+            TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
+            tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
+        }
+    }
+
+    private void updateBody() {
+        final Context context = getApplicationContext();
+        final TelephonyManager tm =
+                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+        PreferenceScreen prefSet = getPreferenceScreen();
         boolean isLteOnCdma = mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
+        final int phoneSubId = mPhone.getSubId();
+
+        if (prefSet != null) {
+            prefSet.removeAll();
+            prefSet.addPreference(mButtonDataRoam);
+            prefSet.addPreference(mButtonPreferredNetworkMode);
+            prefSet.addPreference(mButtonEnabledNetworks);
+            prefSet.addPreference(mButton4glte);
+        }
+
+        int settingsNetworkMode = android.provider.Settings.Global.getInt(
+                mPhone.getContext().getContentResolver(),
+                android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
+                preferredNetworkMode);
+
         mIsGlobalCdma = isLteOnCdma && getResources().getBoolean(R.bool.config_show_cdma);
-        int shouldHideCarrierSettings = android.provider.Settings.Global.getInt(mPhone.getContext().
-                getContentResolver(), android.provider.Settings.Global.HIDE_CARRIER_NETWORK_SETTINGS, 0);
-        if (shouldHideCarrierSettings == 1) {
+        int shouldHideCarrierSettings = android.provider.Settings.Global.getInt(
+                mPhone.getContext().getContentResolver(),
+                android.provider.Settings.Global.HIDE_CARRIER_NETWORK_SETTINGS, 0);
+        if (shouldHideCarrierSettings == 1 ) {
             prefSet.removePreference(mButtonPreferredNetworkMode);
             prefSet.removePreference(mButtonEnabledNetworks);
             prefSet.removePreference(mLteDataServicePref);
@@ -264,11 +412,6 @@
             // change Preferred Network Mode.
             mButtonPreferredNetworkMode.setOnPreferenceChangeListener(this);
 
-            //Get the networkMode from Settings.System and displays it
-            int settingsNetworkMode = android.provider.Settings.Global.getInt(mPhone.getContext().
-                    getContentResolver(),android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
-                    preferredNetworkMode);
-            mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode));
             mCdmaOptions = new CdmaOptions(this, prefSet, mPhone);
             mGsmUmtsOptions = new GsmUmtsOptions(this, prefSet);
         } else {
@@ -324,12 +467,7 @@
                         R.array.preferred_network_mode_values_world_mode);
             }
             mButtonEnabledNetworks.setOnPreferenceChangeListener(this);
-            int settingsNetworkMode = android.provider.Settings.Global.getInt(
-                    mPhone.getContext().getContentResolver(),
-                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
-                    preferredNetworkMode);
             if (DBG) log("settingsNetworkMode: " + settingsNetworkMode);
-            mButtonEnabledNetworks.setValue(Integer.toString(settingsNetworkMode));
         }
 
         final boolean missingDataServiceUrl = TextUtils.isEmpty(
@@ -367,39 +505,23 @@
                 root.removePreference(ps);
             }
         }
-    }
 
-    @Override
-    protected void onResume() {
-        super.onResume();
-
-        if (mUnavailable) {
-            return;
-        }
-
-        // upon resumption from the sub-activity, make sure we re-enable the
-        // preferences.
-        getPreferenceScreen().setEnabled(true);
-
-        // Set UI state in onResume because a user could go home, launch some
-        // app to change this setting's backend, and re-launch this settings app
-        // and the UI state would be inconsistent with actual state
+        //Get the networkMode from Settings.System and displays it
         mButtonDataRoam.setChecked(mPhone.getDataRoamingEnabled());
-
-        if (getPreferenceScreen().findPreference(BUTTON_PREFERED_NETWORK_MODE) != null)  {
-            mPhone.getPreferredNetworkType(mHandler.obtainMessage(
-                    MyHandler.MESSAGE_GET_PREFERRED_NETWORK_TYPE));
-        }
-
-        if (getPreferenceScreen().findPreference(BUTTON_ENABLED_NETWORKS_KEY) != null)  {
-            mPhone.getPreferredNetworkType(mHandler.obtainMessage(
-                    MyHandler.MESSAGE_GET_PREFERRED_NETWORK_TYPE));
-        }
+        mButtonEnabledNetworks.setValue(Integer.toString(settingsNetworkMode));
+        mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode));
+        UpdatePreferredNetworkModeSummary(settingsNetworkMode);
+        UpdateEnabledNetworksValueAndSummary(settingsNetworkMode);
     }
 
     @Override
     protected void onPause() {
         super.onPause();
+
+        if (ImsManager.isVolteEnabledByPlatform(this)) {
+            TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
+            tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
+        }
     }
 
     /**
@@ -411,6 +533,7 @@
      * display value.
      */
     public boolean onPreferenceChange(Preference preference, Object objValue) {
+        final int phoneSubId = mPhone.getSubId();
         if (preference == mButtonPreferredNetworkMode) {
             //NOTE onPreferenceChange seems to be called even if there is no change
             //Check if the button value is changed from the System.Setting
@@ -419,7 +542,8 @@
             buttonNetworkMode = Integer.valueOf((String) objValue).intValue();
             int settingsNetworkMode = android.provider.Settings.Global.getInt(
                     mPhone.getContext().getContentResolver(),
-                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE, preferredNetworkMode);
+                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
+                    preferredNetworkMode);
             if (buttonNetworkMode != settingsNetworkMode) {
                 int modemNetworkMode;
                 // if new mode is invalid ignore it
@@ -448,7 +572,7 @@
                 UpdatePreferredNetworkModeSummary(buttonNetworkMode);
 
                 android.provider.Settings.Global.putInt(mPhone.getContext().getContentResolver(),
-                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
+                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                         buttonNetworkMode );
                 //Set the modem network mode
                 mPhone.setPreferredNetworkType(modemNetworkMode, mHandler
@@ -461,7 +585,8 @@
             if (DBG) log("buttonNetworkMode: " + buttonNetworkMode);
             int settingsNetworkMode = android.provider.Settings.Global.getInt(
                     mPhone.getContext().getContentResolver(),
-                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE, preferredNetworkMode);
+                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
+                    preferredNetworkMode);
             if (buttonNetworkMode != settingsNetworkMode) {
                 int modemNetworkMode;
                 // if new mode is invalid ignore it
@@ -484,7 +609,7 @@
                 UpdateEnabledNetworksValueAndSummary(buttonNetworkMode);
 
                 android.provider.Settings.Global.putInt(mPhone.getContext().getContentResolver(),
-                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
+                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                         buttonNetworkMode );
                 //Set the modem network mode
                 mPhone.setPreferredNetworkType(modemNetworkMode, mHandler
@@ -549,6 +674,7 @@
         }
 
         private void handleGetPreferredNetworkTypeResponse(Message msg) {
+            final int phoneSubId = mPhone.getSubId();
             AsyncResult ar = (AsyncResult) msg.obj;
 
             if (ar.exception == null) {
@@ -561,7 +687,7 @@
 
                 int settingsNetworkMode = android.provider.Settings.Global.getInt(
                         mPhone.getContext().getContentResolver(),
-                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
+                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                         preferredNetworkMode);
 
                 if (DBG) {
@@ -615,17 +741,18 @@
 
         private void handleSetPreferredNetworkTypeResponse(Message msg) {
             AsyncResult ar = (AsyncResult) msg.obj;
+            final int phoneSubId = mPhone.getSubId();
 
             if (ar.exception == null) {
                 int networkMode = Integer.valueOf(
                         mButtonPreferredNetworkMode.getValue()).intValue();
                 android.provider.Settings.Global.putInt(mPhone.getContext().getContentResolver(),
-                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
+                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                         networkMode );
                 networkMode = Integer.valueOf(
                         mButtonEnabledNetworks.getValue()).intValue();
                 android.provider.Settings.Global.putInt(mPhone.getContext().getContentResolver(),
-                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
+                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                         networkMode );
             } else {
                 mPhone.getPreferredNetworkType(obtainMessage(MESSAGE_GET_PREFERRED_NETWORK_TYPE));
@@ -633,12 +760,13 @@
         }
 
         private void resetNetworkModeToDefault() {
+            final int phoneSubId = mPhone.getSubId();
             //set the mButtonPreferredNetworkMode
             mButtonPreferredNetworkMode.setValue(Integer.toString(preferredNetworkMode));
             mButtonEnabledNetworks.setValue(Integer.toString(preferredNetworkMode));
             //set the Settings.System
             android.provider.Settings.Global.putInt(mPhone.getContext().getContentResolver(),
-                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
+                        android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                         preferredNetworkMode );
             //Set the Modem
             mPhone.setPreferredNetworkType(preferredNetworkMode,
@@ -925,4 +1053,24 @@
             systemSelect.setEnabled(enable);
         }
     }
+
+    /**
+     * finds a record with slotId.
+     * Since the number of SIMs are few, an array is fine.
+     */
+    public static SubscriptionInfo findRecordBySlotId(final int slotId) {
+        final List<SubscriptionInfo> subInfoList =
+            SubscriptionManager.getActiveSubscriptionInfoList();
+        final int subInfoLength = subInfoList.size();
+
+        for (int i = 0; i < subInfoLength; ++i) {
+            final SubscriptionInfo sir = subInfoList.get(i);
+            if (sir.getSimSlotIndex() == slotId) {
+                //Right now we take the first subscription on a SIM.
+                return sir;
+            }
+        }
+
+        return null;
+    }
 }
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index f92e7e4..e8cffa9 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1883,12 +1883,13 @@
     @Override
     public boolean setPreferredNetworkType(int networkType) {
         enforceModifyPermissionOrCarrierPrivilege();
+        final int phoneSubId = mPhone.getSubId();
         if (DBG) log("setPreferredNetworkType: type " + networkType);
         Boolean success = (Boolean) sendRequest(CMD_SET_PREFERRED_NETWORK_TYPE, networkType);
         if (DBG) log("setPreferredNetworkType: " + (success ? "ok" : "fail"));
         if (success) {
             Settings.Global.putInt(mPhone.getContext().getContentResolver(),
-                    Settings.Global.PREFERRED_NETWORK_MODE, networkType);
+                    Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId, networkType);
         }
         return success;
     }
diff --git a/src/com/android/services/telephony/DisconnectCauseUtil.java b/src/com/android/services/telephony/DisconnectCauseUtil.java
index 8af6849..8f38ee1 100644
--- a/src/com/android/services/telephony/DisconnectCauseUtil.java
+++ b/src/com/android/services/telephony/DisconnectCauseUtil.java
@@ -124,6 +124,7 @@
             case android.telephony.DisconnectCause.DIALED_MMI:
             case android.telephony.DisconnectCause.EXITED_ECM:
             case android.telephony.DisconnectCause.MMI:
+            case android.telephony.DisconnectCause.IMS_MERGED_SUCCESSFULLY:
                 return DisconnectCause.OTHER;
 
             case android.telephony.DisconnectCause.NOT_VALID:
@@ -334,6 +335,8 @@
             case android.telephony.DisconnectCause.NORMAL:
                 return ToneGenerator.TONE_PROP_PROMPT;
 
+            case android.telephony.DisconnectCause.IMS_MERGED_SUCCESSFULLY:
+                // Do not play any tones if disconnected because of a successful merge.
             default:
                 return ToneGenerator.TONE_UNKNOWN;
         }
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 7bd396b..3523288 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -18,6 +18,7 @@
 
 import android.content.ComponentName;
 import android.content.Context;
+import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.net.Uri;
 import android.telecom.PhoneAccount;
@@ -47,26 +48,6 @@
 final class TelecomAccountRegistry {
     private static final boolean DBG = false; /* STOP SHIP if true */
 
-    // Slot IDs are zero based indices but the numbered icons represent the first, second,
-    // etc... SIM in the device. So that means that index 0 is SIM 1, index 1 is SIM 2 and so on.
-
-    private final static int[] phoneAccountIcons = {
-            R.drawable.ic_multi_sim1,
-            R.drawable.ic_multi_sim2,
-            R.drawable.ic_multi_sim3,
-            R.drawable.ic_multi_sim4
-    };
-
-    private final static int[] colors = {
-        0xff00796b,
-        0xff3367d6,
-        0xff303f9f,
-        0xff7b1fa2,
-        0xffc2185b,
-        0xffc53929
-    };
-
-
     // This icon is the one that is used when the Slot ID that we have for a particular SIM
     // is not supported, i.e. SubscriptionManager.INVALID_SLOT_ID or the 5th SIM in a phone.
     private final static int defaultPhoneAccountIcon =  R.drawable.ic_multi_sim;
@@ -113,6 +94,7 @@
 
             String label;
             String description;
+            Bitmap iconBitmap = null;
 
             if (isEmergency) {
                 label = mContext.getResources().getString(R.string.sim_label_emergency_calls);
@@ -129,10 +111,9 @@
                 SubscriptionInfo record = SubscriptionManager.getSubscriptionInfoForSubscriber(subId);
                 if (record != null) {
                     subDisplayName = record.getDisplayName();
-                    slotId = record.getSubscriptionId();
-
-                    // Assign a "fake" color while the underlying Telephony stuff is refactored.
-                    color = makeFakeColor(subId);
+                    slotId = record.getSimSlotIndex();
+                    color = record.getIconTint();
+                    iconBitmap = record.createIconBitmap(mContext);
                 }
 
                 String slotIdString;
@@ -161,12 +142,19 @@
                     PhoneAccount.CAPABILITY_CALL_PROVIDER |
                     PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS;
 
+            if (iconBitmap == null) {
+                iconBitmap = BitmapFactory.decodeResource(
+                        mContext.getResources(),
+                        defaultPhoneAccountIcon);
+            }
+
             PhoneAccount account = PhoneAccount.builder(phoneAccountHandle, label)
                     .setAddress(Uri.fromParts(PhoneAccount.SCHEME_TEL, line1Number, null))
                     .setSubscriptionAddress(
                             Uri.fromParts(PhoneAccount.SCHEME_TEL, subNumber, null))
                     .setCapabilities(capabilities)
-                    .setIcon(mContext, getPhoneAccountIcon(slotId), color)
+                    .setIcon(iconBitmap)
+                    .setHighlightColor(color)
                     .setShortDescription(description)
                     .setSupportedUriSchemes(Arrays.asList(
                             PhoneAccount.SCHEME_TEL, PhoneAccount.SCHEME_VOICEMAIL))
@@ -182,10 +170,6 @@
         }
     }
 
-    private int makeFakeColor(long subId) {
-        return colors[((int) subId) % colors.length];
-    }
-
     private final SubscriptionListener mSubscriptionListener = new SubscriptionListener() {
         @Override
         public void onSubscriptionInfoChanged() {
@@ -322,16 +306,6 @@
         cleanupPhoneAccounts();
     }
 
-    private int getPhoneAccountIcon(int index) {
-        // A valid slot id doesn't necessarily mean that we have an icon for it.
-        if (SubscriptionManager.isValidSlotId(index) &&
-                index < TelecomAccountRegistry.phoneAccountIcons.length) {
-            return TelecomAccountRegistry.phoneAccountIcons[index];
-        }
-        // Invalid indices get the default icon that has no number associated with it.
-        return defaultPhoneAccountIcon;
-    }
-
     private void tearDownAccounts() {
         for (AccountEntry entry : mAccounts) {
             entry.teardown();