Merge "Update strings for Dialer-related Telephony settings." into lmp-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 7add3a8..b948958 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -148,7 +148,7 @@
 
         <activity android:name="FdnList"
                 android:label="@string/fdnListLabel"
-                android:theme="@style/SettingsLight">
+                android:theme="@style/DialerSettingsLight">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -300,7 +300,7 @@
 
         <activity android:name="GsmUmtsOptions"
                 android:label="@string/gsm_umts_options"
-                android:theme="@style/SettingsLight">
+                android:theme="@style/DialerSettingsLight">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
             </intent-filter>
@@ -308,7 +308,7 @@
 
         <activity android:name="CdmaOptions"
                 android:label="@string/cdma_options"
-                android:theme="@style/SettingsLight">
+                android:theme="@style/DialerSettingsLight">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
             </intent-filter>
@@ -316,7 +316,7 @@
 
         <activity android:name="GsmUmtsCallOptions"
                 android:label="@string/gsm_umts_options"
-                android:theme="@style/SettingsLight">
+                android:theme="@style/DialerSettingsLight">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
             </intent-filter>
@@ -324,7 +324,7 @@
 
         <activity android:name="CdmaCallOptions"
                 android:label="@string/cdma_options"
-                android:theme="@style/SettingsLight">
+                android:theme="@style/DialerSettingsLight">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
             </intent-filter>
@@ -359,7 +359,7 @@
         <!-- fdn setting -->
         <activity android:name="FdnSetting"
                 android:label="@string/fdn"
-                android:theme="@style/SettingsLight">
+                android:theme="@style/DialerSettingsLight">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
             </intent-filter>
@@ -367,7 +367,7 @@
 
         <activity android:name="EnableFdnScreen"
                 android:label=""
-                android:theme="@style/SettingsLight">
+                android:theme="@style/DialerSettingsLight">
         </activity>
 
         <!-- SIM PIN setting -->
@@ -396,12 +396,12 @@
         </activity>
 
         <activity android:name="EditFdnContactScreen"
-                android:theme="@style/SettingsLight"
+                android:theme="@style/DialerSettingsLight"
                 android:windowSoftInputMode="stateVisible">
         </activity>
 
         <activity android:name="DeleteFdnContactScreen"
-                android:theme="@style/SettingsLight"
+                android:theme="@style/DialerSettingsLight"
                 android:label="@string/delete_fdn_contact">
         </activity>
 
@@ -425,7 +425,7 @@
         <activity android:name="CallFeaturesSetting"
                 android:label="@string/call_settings"
                 android:configChanges="orientation|screenSize|keyboardHidden"
-                android:theme="@style/SettingsLight">
+                android:theme="@style/DialerSettingsLight">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <action android:name="android.intent.action.MAIN" />
@@ -493,7 +493,7 @@
 
         <activity android:label="Sip Settings"
                   android:name="com.android.services.telephony.sip.SipSettings"
-                  android:theme="@style/SettingsLight"
+                  android:theme="@style/DialerSettingsLight"
                   android:launchMode="singleTop"
                   android:configChanges="orientation|screenSize|keyboardHidden"
                   android:uiOptions="splitActionBarWhenNarrow"
@@ -504,7 +504,7 @@
             </intent-filter>
         </activity>
         <activity android:name="com.android.services.telephony.sip.SipEditor"
-                android:theme="@style/SettingsLight"
+                android:theme="@style/DialerSettingsLight"
                 android:configChanges="orientation|screenSize|keyboardHidden"
                 android:uiOptions="splitActionBarWhenNarrow">
         </activity>
diff --git a/res/drawable-hdpi/ic_multi_sim.png b/res/drawable-hdpi/ic_multi_sim.png
new file mode 100644
index 0000000..6c545fc
--- /dev/null
+++ b/res/drawable-hdpi/ic_multi_sim.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim1.png b/res/drawable-hdpi/ic_multi_sim1.png
new file mode 100644
index 0000000..12b800c
--- /dev/null
+++ b/res/drawable-hdpi/ic_multi_sim1.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim2.png b/res/drawable-hdpi/ic_multi_sim2.png
new file mode 100644
index 0000000..d468081
--- /dev/null
+++ b/res/drawable-hdpi/ic_multi_sim2.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim3.png b/res/drawable-hdpi/ic_multi_sim3.png
new file mode 100644
index 0000000..be17bd4
--- /dev/null
+++ b/res/drawable-hdpi/ic_multi_sim3.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim4.png b/res/drawable-hdpi/ic_multi_sim4.png
new file mode 100644
index 0000000..fbff161
--- /dev/null
+++ b/res/drawable-hdpi/ic_multi_sim4.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim.png b/res/drawable-mdpi/ic_multi_sim.png
new file mode 100644
index 0000000..401599d
--- /dev/null
+++ b/res/drawable-mdpi/ic_multi_sim.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim1.png b/res/drawable-mdpi/ic_multi_sim1.png
new file mode 100644
index 0000000..ef350bf
--- /dev/null
+++ b/res/drawable-mdpi/ic_multi_sim1.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim2.png b/res/drawable-mdpi/ic_multi_sim2.png
new file mode 100644
index 0000000..a265723
--- /dev/null
+++ b/res/drawable-mdpi/ic_multi_sim2.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim3.png b/res/drawable-mdpi/ic_multi_sim3.png
new file mode 100644
index 0000000..cce2d3f
--- /dev/null
+++ b/res/drawable-mdpi/ic_multi_sim3.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim4.png b/res/drawable-mdpi/ic_multi_sim4.png
new file mode 100644
index 0000000..233c386
--- /dev/null
+++ b/res/drawable-mdpi/ic_multi_sim4.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim.png b/res/drawable-xhdpi/ic_multi_sim.png
new file mode 100644
index 0000000..3dd1822
--- /dev/null
+++ b/res/drawable-xhdpi/ic_multi_sim.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim1.png b/res/drawable-xhdpi/ic_multi_sim1.png
new file mode 100644
index 0000000..1ad3288
--- /dev/null
+++ b/res/drawable-xhdpi/ic_multi_sim1.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim2.png b/res/drawable-xhdpi/ic_multi_sim2.png
new file mode 100644
index 0000000..3a4152e
--- /dev/null
+++ b/res/drawable-xhdpi/ic_multi_sim2.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim3.png b/res/drawable-xhdpi/ic_multi_sim3.png
new file mode 100644
index 0000000..4c36a1c
--- /dev/null
+++ b/res/drawable-xhdpi/ic_multi_sim3.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim4.png b/res/drawable-xhdpi/ic_multi_sim4.png
new file mode 100644
index 0000000..26db92c
--- /dev/null
+++ b/res/drawable-xhdpi/ic_multi_sim4.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim.png b/res/drawable-xxhdpi/ic_multi_sim.png
new file mode 100644
index 0000000..6f71ec5
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_multi_sim.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim1.png b/res/drawable-xxhdpi/ic_multi_sim1.png
new file mode 100644
index 0000000..6d89d58
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_multi_sim1.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim2.png b/res/drawable-xxhdpi/ic_multi_sim2.png
new file mode 100644
index 0000000..b9f3351
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_multi_sim2.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim3.png b/res/drawable-xxhdpi/ic_multi_sim3.png
new file mode 100644
index 0000000..beef5c8
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_multi_sim3.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim4.png b/res/drawable-xxhdpi/ic_multi_sim4.png
new file mode 100644
index 0000000..b947e84
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_multi_sim4.png
Binary files differ
diff --git a/res/values/colors.xml b/res/values/colors.xml
index b3c4066..f629da0 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -52,4 +52,5 @@
     <color name="setting_secondary_color">#989898</color>
     <color name="dialer_dialpad_touch_tint">#331dc7db</color>
     <color name="dialer_accent_color">#eeff41</color>
+    <color name="dialer_theme_color">#0288d1</color>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 3a025e2..76b100a 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -175,6 +175,16 @@
         <item name="android:textColorSecondary">@color/setting_secondary_color</item>
     </style>
 
+    <style name="DialerSettingsLight" parent="SettingsLight">
+        <item name="android:colorAccent">@color/dialer_theme_color</item>
+        <item name="android:dialogTheme">@style/DialerAlertDialogTheme</item>
+    </style>
+
+    <style name="DialerAlertDialogTheme"
+        parent="@android:style/Theme.Material.Light.Dialog">
+        <item name="android:colorAccent">@color/dialer_theme_color</item>
+    </style>
+
     <style name="Empty" parent="@android:style/Theme.Holo">
         <item name="android:windowIsTranslucent">true</item>
         <item name="android:windowBackground">@android:color/transparent</item>
diff --git a/res/xml/call_feature_setting.xml b/res/xml/call_feature_setting.xml
index 625ff4c..e97232b 100644
--- a/res/xml/call_feature_setting.xml
+++ b/res/xml/call_feature_setting.xml
@@ -140,10 +140,4 @@
 
     </PreferenceScreen>
 
-    <CheckBoxPreference
-        android:key="button_enable_video_calling"
-        android:title="@string/enable_video_calling_title"
-        android:persistent="true"
-        android:defaultValue="true" />
-
 </PreferenceScreen>
diff --git a/sip/res/xml/sip_setting.xml b/sip/res/xml/sip_setting.xml
index c754404..f66e5e4 100644
--- a/sip/res/xml/sip_setting.xml
+++ b/sip/res/xml/sip_setting.xml
@@ -23,4 +23,5 @@
             android:persistent="true"/>
 
     <PreferenceCategory android:key="sip_account_list" android:title="@string/sip_account_list"/>
+
 </PreferenceScreen>
diff --git a/sip/src/com/android/services/telephony/sip/SipSettings.java b/sip/src/com/android/services/telephony/sip/SipSettings.java
index e4fca2b..f799f75 100644
--- a/sip/src/com/android/services/telephony/sip/SipSettings.java
+++ b/sip/src/com/android/services/telephony/sip/SipSettings.java
@@ -293,8 +293,13 @@
             }
         });
         mSipListContainer.removeAll();
-        for (SipProfile p : mSipProfileList) {
-            addPreferenceFor(p);
+        if (mSipProfileList.isEmpty()) {
+            getPreferenceScreen().removePreference(mSipListContainer);
+        } else {
+            getPreferenceScreen().addPreference(mSipListContainer);
+            for (SipProfile p : mSipProfileList) {
+                addPreferenceFor(p);
+            }
         }
 
         if (!mSipSharedPreferences.isReceivingCallsEnabled()) return;
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 89749ad..05c00fa 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -488,13 +488,14 @@
                         .obtainMessage(MyHandler.MESSAGE_SET_PREFERRED_NETWORK_TYPE));
             }
         } else if (preference == mButton4glte) {
+            SwitchPreference ltePref = (SwitchPreference)preference;
+            ltePref.setChecked(!ltePref.isChecked());
+            setIMS(ltePref.isChecked());
+
             ImsManager imsMan = ImsManager.getInstance(getBaseContext(),
                     SubscriptionManager.getDefaultVoiceSubId());
-            SwitchPreference ltePref = (SwitchPreference)preference;
-
             if (imsMan != null) {
-                ltePref.setChecked(!ltePref.isChecked());
-                setIMS(ltePref.isChecked());
+
                 try {
                     imsMan.setAdvanced4GMode(ltePref.isChecked());
                 } catch (ImsException ie) {
diff --git a/src/com/android/services/telephony/GsmConference.java b/src/com/android/services/telephony/GsmConference.java
index d8bc11b..a45b896 100644
--- a/src/com/android/services/telephony/GsmConference.java
+++ b/src/com/android/services/telephony/GsmConference.java
@@ -49,8 +49,10 @@
         for (Connection connection : getConnections()) {
             Call call = getMultipartyCallForConnection(connection, "onDisconnect");
             if (call != null) {
+                Log.d(this, "Found multiparty call to hangup for conference.");
                 try {
                     call.hangup();
+                    break;
                 } catch (CallStateException e) {
                     Log.e(this, e, "Exception thrown trying to hangup conference");
                 }
diff --git a/src/com/android/services/telephony/GsmConferenceController.java b/src/com/android/services/telephony/GsmConferenceController.java
index e3d0bf5..8cdc9e9 100644
--- a/src/com/android/services/telephony/GsmConferenceController.java
+++ b/src/com/android/services/telephony/GsmConferenceController.java
@@ -170,6 +170,8 @@
             } else {
                 mGsmConference = new GsmConference(null);
                 for (Connection connection : conferencedConnections) {
+                    Log.d(this, "Adding a connection to a conference call: %s %s",
+                            mGsmConference, connection);
                     mGsmConference.addConnection(connection);
                 }
                 mConnectionService.addConference(mGsmConference);
diff --git a/src/com/android/services/telephony/TelecommAccountRegistry.java b/src/com/android/services/telephony/TelecommAccountRegistry.java
index 658d611..0770f14 100644
--- a/src/com/android/services/telephony/TelecommAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecommAccountRegistry.java
@@ -41,15 +41,21 @@
  * removal of SIMs and SIP accounts.
  */
 final class TelecommAccountRegistry {
+    private final static int[] phoneAccountIcons = {
+        com.android.phone.R.drawable.ic_multi_sim1,
+        com.android.phone.R.drawable.ic_multi_sim2,
+        com.android.phone.R.drawable.ic_multi_sim3,
+        com.android.phone.R.drawable.ic_multi_sim4
+    };
 
     private final class AccountEntry {
         private final Phone mPhone;
         private final PhoneAccount mAccount;
         private final PstnIncomingCallNotifier mIncomingCallNotifier;
 
-        AccountEntry(Phone phone, boolean isEmergency, boolean isDummy) {
+        AccountEntry(Phone phone, int iconResId, boolean isEmergency, boolean isDummy) {
             mPhone = phone;
-            mAccount = registerPstnPhoneAccount(isEmergency, isDummy);
+            mAccount = registerPstnPhoneAccount(iconResId, isEmergency, isDummy);
             Log.d(this, "Registered phoneAccount: %s with handle: %s",
                     mAccount, mAccount.getAccountHandle());
             mIncomingCallNotifier = new PstnIncomingCallNotifier((PhoneProxy) mPhone);
@@ -64,7 +70,7 @@
          * Registers the specified account with Telecomm as a PhoneAccountHandle.
          */
         private PhoneAccount registerPstnPhoneAccount(
-                boolean isEmergency, boolean isDummyAccount) {
+                int iconResId, boolean isEmergency, boolean isDummyAccount) {
             TelephonyManager telephonyManager = TelephonyManager.from(mContext);
             String dummyPrefix = isDummyAccount ? "Dummy " : "";
 
@@ -95,7 +101,7 @@
                     .withSubscriptionNumber(subNumber)
                     .withCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
                             PhoneAccount.CAPABILITY_CALL_PROVIDER)
-                    .withIconResId(com.android.phone.R.mipmap.ic_launcher_phone)
+                    .withIconResId(iconResId)
                     .withLabel(label)
                     .withShortDescription(description)
                     .build();
@@ -171,6 +177,9 @@
         // Before we do anything, we need to clear whatever entries we registered at boot.
         mTelecommManager.clearAccounts(mContext.getPackageName());
 
+        // Use counter to keep track of which default icon we are using
+        int currAccountIcon = 0;
+
         // Go through SIM-based phones and register ourselves
         Phone[] phones = PhoneFactory.getPhones();
         Log.d(this, "Found %d phones.  Attempting to register.", phones.length);
@@ -178,7 +187,8 @@
             long subscriptionId = phone.getSubId();
             Log.d(this, "Phone with subscription id %d", subscriptionId);
             if (subscriptionId >= 0) {
-                mAccounts.add(new AccountEntry(phone, false, false /* isDummy */));
+                mAccounts.add(new AccountEntry(phone, getPhoneAccountIcon(currAccountIcon++),
+                        false /* emergency */, false /* isDummy */));
             }
         }
 
@@ -187,17 +197,26 @@
         // numbers but a phone account is.
         if (mAccounts.isEmpty()) {
             mAccounts.add(new AccountEntry(
-                    PhoneFactory.getDefaultPhone(), true /*emergency*/, false /*isDummy*/));
+                    PhoneFactory.getDefaultPhone(), getPhoneAccountIcon(currAccountIcon++),
+                    true /* emergency */, false /* isDummy */));
         }
 
         // Add a fake account entry.
         if (phones.length > 0 && "TRUE".equals(System.getProperty("dummy_sim"))) {
-            mAccounts.add(new AccountEntry(phones[0], false, true /* isDummy */));
+            mAccounts.add(new AccountEntry(phones[0], getPhoneAccountIcon(currAccountIcon++),
+                    false /* emergency */, true /* isDummy */));
         }
 
         // TODO: Add SIP accounts.
     }
 
+    private int getPhoneAccountIcon(int index) {
+        if (index < TelecommAccountRegistry.phoneAccountIcons.length) {
+            return TelecommAccountRegistry.phoneAccountIcons[index];
+        }
+        return com.android.phone.R.drawable.ic_multi_sim;
+    }
+
     private void tearDownAccounts() {
         for (AccountEntry entry : mAccounts) {
             entry.teardown();