Merge tag 'android-6.0.1_r3' into 601r3

Android 6.0.1 release 3

* tag 'android-6.0.1_r3':
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Make LetterTileDrawables bold

Change-Id: I531bf3e76dfb00a8a954e835778a51fac8addd60
diff --git a/res/values-mcc450-mnc05/qticonfig.xml b/res/values-mcc450-mnc05/qticonfig.xml
new file mode 100644
index 0000000..50d88ff
--- /dev/null
+++ b/res/values-mcc450-mnc05/qticonfig.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2015, The Linux Foundation. All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are
+  met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above
+         copyright notice, this list of conditions and the following
+         disclaimer in the documentation and/or other materials provided
+         with the distribution.
+       * Neither the name of The Linux Foundation nor the names of its
+         contributors may be used to endorse or promote products derived
+         from this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<resources>
+    <!-- 0 - Enable/disable video calling based on local/peer video capabilities
+         1 - Enable video calling regardless of local/peer video capabilities
+         2 - Disable video calling regardless of local/peer video capabilities -->
+    <integer name="config_enable_video_calling">1</integer>
+</resources>
diff --git a/res/values/qticonfig.xml b/res/values/qticonfig.xml
new file mode 100644
index 0000000..a9dc0da
--- /dev/null
+++ b/res/values/qticonfig.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2015, The Linux Foundation. All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are
+  met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above
+         copyright notice, this list of conditions and the following
+         disclaimer in the documentation and/or other materials provided
+         with the distribution.
+       * Neither the name of The Linux Foundation nor the names of its
+         contributors may be used to endorse or promote products derived
+         from this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<resources>
+    <!-- 0 - Enable/disable video calling based on local/peer video capabilities
+         1 - Enable video calling regardless of local/peer video capabilities
+         2 - Disable video calling regardless of local/peer video capabilities -->
+    <integer name="config_enable_video_calling">0</integer>
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fab8e97..ae9f241 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -419,8 +419,11 @@
 
     <string name="dialog_new_contact_account">Create contact under account</string>
 
-    <!-- Action string for selecting SIM for importing contacts -->
-    <string name="import_from_sim">Import from SIM card</string>
+    <!-- Action string for managing SIM contacts -->
+    <string name="manage_sim_contacts"> Manage SIM card contacts</string>
+
+    <!-- Action that exports all contacts to SIM -->
+    <string name="export_to_sim">Export to SIM card</string>
 
     <!-- Action string for selecting a SIM subscription for importing contacts -->
     <string name="import_from_sim_summary">Import from SIM <xliff:g id="sim_name">^1</xliff:g> - <xliff:g id="sim_number">^2</xliff:g></string>
@@ -428,6 +431,12 @@
     <!-- Action string for selecting a SIM subscription for importing contacts, without a phone number -->
     <string name="import_from_sim_summary_no_number">Import from SIM <xliff:g id="sim_name">%1$s</xliff:g></string>
 
+    <!-- Action string for selecting a SIM subscription for exporting contacts -->
+    <string name="export_to_sim_summary">Export to SIM <xliff:g id="sim_name">^1</xliff:g> - <xliff:g id="sim_number">^2</xliff:g></string>
+
+    <!-- Action string for selecting a SIM subscription for exporting contacts, without a phone number -->
+    <string name="export_to_sim_summary_no_number">Export to SIM <xliff:g id="sim_name">%1$s</xliff:g></string>
+
     <!-- Action string for selecting a .vcf file to import contacts from [CHAR LIMIT=30] -->
     <string name="import_from_vcf_file" product="default">Import from .vcf file</string>
 
diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java
index a5587ca..5b0cf9b 100644
--- a/src/com/android/contacts/common/CallUtil.java
+++ b/src/com/android/contacts/common/CallUtil.java
@@ -38,6 +38,11 @@
  */
 public class CallUtil {
 
+    /*Enable Video calling irrespective of video capabilities*/
+    private static final int ENABLE_VIDEO_CALLING = 1;
+    /*Disable Video calling irrespective of video capabilities*/
+    private static final int DISABLE_VIDEO_CALLING = 2;
+
     /**
      * Return an Intent for making a phone call. Scheme (e.g. tel, sip) will be determined
      * automatically.
@@ -100,7 +105,7 @@
      * @return {@code true} if one of the call capable phone accounts supports video calling,
      *      {@code false} otherwise.
      */
-    public static boolean isVideoEnabled(Context context) {
+    private static boolean hasVideoCapability(Context context) {
         TelecomManager telecommMgr = (TelecomManager)
                 context.getSystemService(Context.TELECOM_SERVICE);
         if (telecommMgr == null) {
@@ -117,6 +122,23 @@
         return false;
     }
 
+    public static boolean isVideoEnabled(Context context) {
+
+        final int enableVideoCall = getVideoCallingConfig(context);
+
+        if (enableVideoCall == ENABLE_VIDEO_CALLING) {
+            return true;
+        } else if(enableVideoCall == DISABLE_VIDEO_CALLING) {
+            return false;
+        } else {
+            return hasVideoCapability(context);
+        }
+    }
+
+    private static int getVideoCallingConfig(Context context) {
+        return context.getResources().getInteger(
+                R.integer.config_enable_video_calling);
+    }
     /**
      * Determines if one of the call capable phone accounts defined supports calling with a subject
      * specified.
diff --git a/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java b/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java
index 823d522..6553627 100644
--- a/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java
+++ b/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java
@@ -23,6 +23,7 @@
 import android.app.FragmentManager;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.DialogInterface.OnDismissListener;
 import android.content.Intent;
 import android.content.res.Resources;
 import android.database.Cursor;
@@ -131,12 +132,18 @@
             }
             if (subInfoRecords != null) {
                 if (subInfoRecords.size() == 1) {
-                    adapter.add(new AdapterEntry(getString(R.string.import_from_sim),
-                            R.string.import_from_sim, subInfoRecords.get(0).getSubscriptionId()));
+                    adapter.add(new AdapterEntry(getString(R.string.manage_sim_contacts),
+                            R.string.manage_sim_contacts,
+                            subInfoRecords.get(0).getSubscriptionId()));
+                    adapter.add(new AdapterEntry(getString(R.string.export_to_sim),
+                            R.string.export_to_sim,
+                            subInfoRecords.get(0).getSubscriptionId()));
                 } else {
                     for (SubscriptionInfo record : subInfoRecords) {
-                        adapter.add(new AdapterEntry(getSubDescription(record),
-                                R.string.import_from_sim, record.getSubscriptionId()));
+                        adapter.add(new AdapterEntry(getSubDescription(record, true),
+                                R.string.manage_sim_contacts, record.getSubscriptionId()));
+                        adapter.add(new AdapterEntry(getSubDescription(record, false),
+                                R.string.export_to_sim, record.getSubscriptionId()));
                     }
                 }
             }
@@ -161,7 +168,7 @@
                 boolean dismissDialog;
                 final int resId = adapter.getItem(which).mChoiceResourceId;
                 switch (resId) {
-                    case R.string.import_from_sim:
+                    case R.string.manage_sim_contacts:
                     case R.string.import_from_vcf_file: {
                         dismissDialog = handleImportRequest(resId,
                                 adapter.getItem(which).mSubscriptionId);
@@ -180,6 +187,15 @@
                         doShareVisibleContacts();
                         break;
                     }
+                    case R.string.export_to_sim: {
+                        dismissDialog = true;
+                        Intent intent = new Intent(Intent.ACTION_VIEW);
+                        intent.setClassName("com.android.phone",
+                                "com.android.phone.ExportContactsToSim");
+                        intent.putExtra("subscription_id", adapter.getItem(which).mSubscriptionId);
+                        startActivity(intent);
+                        break;
+                    }
                     default: {
                         dismissDialog = true;
                         Log.e(TAG, "Unexpected resource: "
@@ -292,16 +308,17 @@
         dismiss();
     }
 
-    private CharSequence getSubDescription(SubscriptionInfo record) {
+    private CharSequence getSubDescription(SubscriptionInfo record, boolean isImport) {
         CharSequence name = record.getDisplayName();
         if (TextUtils.isEmpty(record.getNumber())) {
             // Don't include the phone number in the description, since we don't know the number.
-            return getString(R.string.import_from_sim_summary_no_number, name);
+            return isImport ? getString(R.string.import_from_sim_summary_no_number, name) :
+                    getString(R.string.export_to_sim_summary_no_number, name);
         }
-        return TextUtils.expandTemplate(
-                getString(R.string.import_from_sim_summary),
-                name,
-                PhoneNumberUtils.createTtsSpannable(record.getNumber()));
+        return isImport ? TextUtils.expandTemplate(getString(R.string.import_from_sim_summary)
+                , name, PhoneNumberUtils.createTtsSpannable(record.getNumber())) :
+                TextUtils.expandTemplate(getString(R.string.export_to_sim_summary)
+                , name, PhoneNumberUtils.createTtsSpannable(record.getNumber()));
     }
 
     private static class AdapterEntry {
diff --git a/src/com/android/contacts/common/util/AccountSelectionUtil.java b/src/com/android/contacts/common/util/AccountSelectionUtil.java
index ccbc204..4302dc4 100644
--- a/src/com/android/contacts/common/util/AccountSelectionUtil.java
+++ b/src/com/android/contacts/common/util/AccountSelectionUtil.java
@@ -162,7 +162,7 @@
     public static void doImport(Context context, int resId, AccountWithDataSet account,
             int subscriptionId) {
         switch (resId) {
-            case R.string.import_from_sim: {
+            case R.string.manage_sim_contacts: {
                 doImportFromSim(context, account, subscriptionId);
                 break;
             }