Merge "Import translations. DO NOT MERGE" into nyc-mr1-dev
diff --git a/res/layout/dashboard_container_header.xml b/res/layout/dashboard_container_header.xml
index a12f249..59e7eb1 100644
--- a/res/layout/dashboard_container_header.xml
+++ b/res/layout/dashboard_container_header.xml
@@ -20,4 +20,6 @@
     android:id="@+id/sliding_tabs"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_marginLeft="@dimen/dashboard_header_margin_left"
+    android:layout_marginRight="@dimen/dashboard_header_margin_right"
     android:background="?android:attr/colorPrimary"/>
diff --git a/res/layout/settings_main_dashboard.xml b/res/layout/settings_main_dashboard.xml
index c10193c..1b7506e 100644
--- a/res/layout/settings_main_dashboard.xml
+++ b/res/layout/settings_main_dashboard.xml
@@ -21,4 +21,5 @@
              android:id="@+id/main_content"
              android:layout_height="match_parent"
              android:layout_width="match_parent"
+             android:background="@color/material_grey_300"
              />
diff --git a/res/layout/support_tile_spacer.xml b/res/layout/support_tile_spacer.xml
index 95aea0b..41cc221 100644
--- a/res/layout/support_tile_spacer.xml
+++ b/res/layout/support_tile_spacer.xml
@@ -15,7 +15,7 @@
      limitations under the License.
 -->
 
-<Space
+<View
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="@dimen/support_spacer_height"
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
index 56d8318..d924344 100644
--- a/res/values-sw720dp-land/dimens.xml
+++ b/res/values-sw720dp-land/dimens.xml
@@ -18,8 +18,12 @@
     <dimen name="settings_side_margin">112dp</dimen>
 
     <!-- Dashboard padding in its container -->
-    <dimen name="dashboard_padding_start">128dp</dimen>
-    <dimen name="dashboard_padding_end">128dp</dimen>
+    <dimen name="dashboard_padding_start">160dp</dimen>
+    <dimen name="dashboard_padding_end">160dp</dimen>
+
+    <!-- Dashboard Header margin in its container -->
+    <dimen name="dashboard_header_margin_right">304dp</dimen>
+    <dimen name="dashboard_header_margin_left">304dp</dimen>
 
     <!-- ActionBar contentInsetStart -->
     <dimen name="actionbar_contentInsetStart">128dp</dimen>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 981c936..0a2a1ce 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -42,6 +42,10 @@
     <dimen name="dashboard_padding_start">80dp</dimen>
     <dimen name="dashboard_padding_end">80dp</dimen>
 
+    <!-- Dashboard Header margin in its container -->
+    <dimen name="dashboard_header_margin_right">176dp</dimen>
+    <dimen name="dashboard_header_margin_left">176dp</dimen>
+
     <!-- Dashboard category padding start / end -->
     <dimen name="dashboard_category_padding_start">24dp</dimen>
     <dimen name="dashboard_category_padding_end">24dp</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 2a2b406..74441c2 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -96,6 +96,10 @@
     <dimen name="dashboard_padding_top">0dp</dimen>
     <dimen name="dashboard_padding_bottom">0dp</dimen>
 
+    <!-- Dashboard Header margin in its container -->
+    <dimen name="dashboard_header_margin_right">0dp</dimen>
+    <dimen name="dashboard_header_margin_left">0dp</dimen>
+
     <!-- Dashboard category padding start / end -->
     <dimen name="dashboard_category_padding_start">0dp</dimen>
     <dimen name="dashboard_category_padding_end">0dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 57c33b1..a1d42cf 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1594,9 +1594,9 @@
     <!-- Checkbox title. Should we switch to using cellular data if Wi-Fi is still connected but the Wi-Fi network we're connected to no longer has Internet access (e.g., due to an outage)? -->
     <string name="wifi_switch_away_when_unvalidated">Switch to cellular data if Wi\u2011Fi loses Internet access.</string>
     <!-- Preference title for option to automatically switch away from bad wifi networks [CHAR LIMIT=60]-->
-    <string name="wifi_cellular_data_fallback_title">Cellular data fallback</string>
+    <string name="wifi_cellular_data_fallback_title">Switch to cellular data automatically</string>
     <!-- Preference summary for option to automatically switch away from bad wifi networks [CHAR LIMIT=None]-->
-    <string name="wifi_cellular_data_fallback_summary">Use cellular data when Wi\u2011Fi loses Internet access. Additional charges may apply.</string>
+    <string name="wifi_cellular_data_fallback_summary">Use cellular data when Wi\u2011Fi loses Internet access. Data usage may apply.</string>
     <!-- Action bar text message to manually add a wifi network [CHAR LIMIT=20]-->
     <string name="wifi_add_network">Add network</string>
     <!-- Header for the list of wifi networks-->
@@ -1993,15 +1993,26 @@
     <string name="wifi_calling_suggestion_title">Turn on Wi-Fi Calling</string>
     <!-- Summary of suggestion to turn on wifi calling [CHAR LIMIT=60] -->
     <string name="wifi_calling_suggestion_summary">Use Wi-Fi instead of mobile network</string>
-    <!-- WFC mode [CHAR LIMIT=30] -->
+    <!-- Title of WFC preference item [CHAR LIMIT=30] -->
     <string name="wifi_calling_mode_title">Calling preference</string>
-    <!-- WFC mode dialog [CHAR LIMIT=30] -->
+    <!-- Title of WFC preference selection dialog [CHAR LIMIT=30] -->
     <string name="wifi_calling_mode_dialog_title">Wi-Fi calling mode</string>
+    <!-- Title of WFC roaming preference item [CHAR LIMIT=45] -->
+    <string name="wifi_calling_roaming_mode_title">Roaming preference</string>
+    <!-- Summary of WFC roaming preference item [CHAR LIMIT=NONE]-->
+    <string name="wifi_calling_roaming_mode_summary"><xliff:g id="wfc_roaming_preference" example="Wi-Fi">%1$s</xliff:g></string>
+    <!-- WFC mode dialog [CHAR LIMIT=45] -->
+    <string name="wifi_calling_roaming_mode_dialog_title">Roaming preference</string>
     <string-array name="wifi_calling_mode_choices">
         <item>Wi-Fi preferred</item>
         <item>Cellular preferred</item>
         <item>Wi-Fi only</item>
     </string-array>
+    <string-array name="wifi_calling_mode_choices_v2">
+        <item>Wi-Fi</item>
+        <item>Cellular</item>
+        <item>Wi-Fi only</item>
+    </string-array>
     <string-array name="wifi_calling_mode_values">
         <item>"2"</item>
         <item>"1"</item>
@@ -2011,13 +2022,19 @@
         <item>Wi-Fi preferred</item>
         <item>Cellular preferred</item>
     </string-array>
+    <string-array name="wifi_calling_mode_choices_v2_without_wifi_only">
+        <item>Wi-Fi</item>
+        <item>Cellular</item>
+    </string-array>
     <string-array name="wifi_calling_mode_values_without_wifi_only">
         <item>"2"</item>
         <item>"1"</item>
     </string-array>
     <!-- Wi-Fi Calling settings. Text displayed when Wi-Fi Calling is off -->
     <string name="wifi_calling_off_explanation">When Wi-Fi calling is on, your phone can route calls via Wi-Fi networks or your carrier\u2019s network, depending on your preference and which signal is stronger. Before turning on this feature, check with your carrier regarding fees and other details.</string>
+    <!-- Title of a preference for updating emergency address [CHAR LIMIT=40] -->
     <string name="emergency_address_title">Update Emergency Address</string>
+    <!-- Summary of Update Emergency Address preference, explaining usage of emergency address [CHAR LIMIT=NONE] -->
     <string name="emergency_address_summary">Address used by emergency services as your location if you make a 911 call using WiFi</string>
 
 
@@ -5870,6 +5887,12 @@
     <!--Dashboard strings-->
     <!-- Text to describe the dashboard fragment title [CHAR LIMIT=16] -->
     <string name="dashboard_title">Settings</string>
+    <!-- Text to describe the items to be expanded as suggested settings [CHAR LIMIT=none] -->
+    <plurals name="settings_suggestion_header_summary_hidden_items">
+        <item quantity="one">Show %d hidden item</item>
+        <item quantity="other">Show %d hidden items</item>
+    </plurals>
+
 
     <!-- Search strings -->
     <!-- Text to describe the search results fragment title [CHAR LIMIT=16] -->
diff --git a/res/xml/wifi_calling_settings.xml b/res/xml/wifi_calling_settings.xml
index c32582c..0adb1e8 100644
--- a/res/xml/wifi_calling_settings.xml
+++ b/res/xml/wifi_calling_settings.xml
@@ -26,10 +26,17 @@
             android:entryValues="@array/wifi_calling_mode_values"
             android:dialogTitle="@string/wifi_calling_mode_dialog_title" />
 
+    <ListPreference
+            android:key="wifi_calling_roaming_mode"
+            android:title="@string/wifi_calling_roaming_mode_title"
+            android:summary="@string/wifi_calling_roaming_mode_summary"
+            android:entries="@array/wifi_calling_mode_choices_v2"
+            android:entryValues="@array/wifi_calling_mode_values"
+            android:dialogTitle="@string/wifi_calling_roaming_mode_dialog_title" />
+
     <Preference
-        android:key="emergency_address_key"
-        android:title="@string/emergency_address_title"
-        android:summary="@string/emergency_address_summary">
-    </Preference>
+            android:key="emergency_address_key"
+            android:title="@string/emergency_address_title"
+            android:summary="@string/emergency_address_summary" />
 
 </PreferenceScreen>
diff --git a/src/com/android/settings/WifiCallingSettings.java b/src/com/android/settings/WifiCallingSettings.java
index 0af6ffa..3e9da17 100644
--- a/src/com/android/settings/WifiCallingSettings.java
+++ b/src/com/android/settings/WifiCallingSettings.java
@@ -56,6 +56,7 @@
 
     //String keys for preference lookup
     private static final String BUTTON_WFC_MODE = "wifi_calling_mode";
+    private static final String BUTTON_WFC_ROAMING_MODE = "wifi_calling_roaming_mode";
     private static final String PREFERENCE_EMERGENCY_ADDRESS = "emergency_address_key";
 
     private static final int REQUEST_CHECK_WFC_EMERGENCY_ADDRESS = 1;
@@ -69,11 +70,13 @@
     private SwitchBar mSwitchBar;
     private Switch mSwitch;
     private ListPreference mButtonWfcMode;
+    private ListPreference mButtonWfcRoamingMode;
     private Preference mUpdateAddress;
     private TextView mEmptyView;
 
     private boolean mValidListener = false;
     private boolean mEditableWfcMode = true;
+    private boolean mEditableWfcRoamingMode = true;
 
     private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
         /*
@@ -94,26 +97,33 @@
             switchBar.setEnabled((state == TelephonyManager.CALL_STATE_IDLE)
                     && isNonTtyOrTtyOnVolteEnabled);
 
+            boolean isWfcModeEditable = true;
+            boolean isWfcRoamingModeEditable = false;
+            final CarrierConfigManager configManager = (CarrierConfigManager)
+                    activity.getSystemService(Context.CARRIER_CONFIG_SERVICE);
+            if (configManager != null) {
+                PersistableBundle b = configManager.getConfig();
+                if (b != null) {
+                    isWfcModeEditable = b.getBoolean(
+                            CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
+                    isWfcRoamingModeEditable = b.getBoolean(
+                            CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL);
+                }
+            }
+
             Preference pref = getPreferenceScreen().findPreference(BUTTON_WFC_MODE);
             if (pref != null) {
-                pref.setEnabled(isWfcEnabled && getEditableWfcMode(activity)
+                pref.setEnabled(isWfcEnabled && isWfcModeEditable
+                        && (state == TelephonyManager.CALL_STATE_IDLE));
+            }
+            Preference pref_roam = getPreferenceScreen().findPreference(BUTTON_WFC_ROAMING_MODE);
+            if (pref_roam != null) {
+                pref_roam.setEnabled(isWfcEnabled && isWfcRoamingModeEditable
                         && (state == TelephonyManager.CALL_STATE_IDLE));
             }
         }
     };
 
-    private static boolean getEditableWfcMode(Context context) {
-        CarrierConfigManager configManager = (CarrierConfigManager)
-                context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
-        if (configManager != null) {
-            PersistableBundle b = configManager.getConfig();
-            if (b != null) {
-                return b.getBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
-            }
-        }
-        return true;
-    }
-
     private final OnPreferenceClickListener mUpdateAddressListener =
             new OnPreferenceClickListener() {
                 /*
@@ -204,6 +214,9 @@
         mButtonWfcMode = (ListPreference) findPreference(BUTTON_WFC_MODE);
         mButtonWfcMode.setOnPreferenceChangeListener(this);
 
+        mButtonWfcRoamingMode = (ListPreference) findPreference(BUTTON_WFC_ROAMING_MODE);
+        mButtonWfcRoamingMode.setOnPreferenceChangeListener(this);
+
         mUpdateAddress = (Preference) findPreference(PREFERENCE_EMERGENCY_ADDRESS);
         mUpdateAddress.setOnPreferenceClickListener(mUpdateAddressListener);
 
@@ -217,6 +230,8 @@
             PersistableBundle b = configManager.getConfig();
             if (b != null) {
                 mEditableWfcMode = b.getBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
+                mEditableWfcRoamingMode = b.getBoolean(
+                        CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL);
                 isWifiOnlySupported = b.getBoolean(
                         CarrierConfigManager.KEY_CARRIER_WFC_SUPPORTS_WIFI_ONLY_BOOL, true);
             }
@@ -225,6 +240,10 @@
         if (!isWifiOnlySupported) {
             mButtonWfcMode.setEntries(R.array.wifi_calling_mode_choices_without_wifi_only);
             mButtonWfcMode.setEntryValues(R.array.wifi_calling_mode_values_without_wifi_only);
+            mButtonWfcRoamingMode.setEntries(
+                    R.array.wifi_calling_mode_choices_v2_without_wifi_only);
+            mButtonWfcRoamingMode.setEntryValues(
+                    R.array.wifi_calling_mode_values_without_wifi_only);
         }
     }
 
@@ -247,9 +266,11 @@
         boolean wfcEnabled = ImsManager.isWfcEnabledByUser(context)
                 && ImsManager.isNonTtyOrTtyOnVolteEnabled(context);
         mSwitch.setChecked(wfcEnabled);
-        int wfcMode = ImsManager.getWfcMode(context);
+        int wfcMode = ImsManager.getWfcMode(context, false);
+        int wfcRoamingMode = ImsManager.getWfcMode(context, true);
         mButtonWfcMode.setValue(Integer.toString(wfcMode));
-        updateButtonWfcMode(context, wfcEnabled, wfcMode);
+        mButtonWfcRoamingMode.setValue(Integer.toString(wfcRoamingMode));
+        updateButtonWfcMode(context, wfcEnabled, wfcMode, wfcRoamingMode);
 
         context.registerReceiver(mIntentReceiver, mIntentFilter);
 
@@ -332,8 +353,9 @@
         Log.i(TAG, "updateWfcMode(" + wfcEnabled + ")");
         ImsManager.setWfcSetting(context, wfcEnabled);
 
-        int wfcMode = ImsManager.getWfcMode(context);
-        updateButtonWfcMode(context, wfcEnabled, wfcMode);
+        int wfcMode = ImsManager.getWfcMode(context, false);
+        int wfcRoamingMode = ImsManager.getWfcMode(context, true);
+        updateButtonWfcMode(context, wfcEnabled, wfcMode, wfcRoamingMode);
         if (wfcEnabled) {
             MetricsLogger.action(getActivity(), getMetricsCategory(), wfcMode);
         } else {
@@ -356,9 +378,12 @@
         }
     }
 
-    private void updateButtonWfcMode(Context context, boolean wfcEnabled, int wfcMode) {
+    private void updateButtonWfcMode(Context context, boolean wfcEnabled,
+                                     int wfcMode, int wfcRoamingMode) {
         mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode));
         mButtonWfcMode.setEnabled(wfcEnabled && mEditableWfcMode);
+        // mButtonWfcRoamingMode.setSummary is not needed; summary is just selected value.
+        mButtonWfcRoamingMode.setEnabled(wfcEnabled && mEditableWfcRoamingMode);
 
         final PreferenceScreen preferenceScreen = getPreferenceScreen();
         boolean updateAddressEnabled = (getCarrierActivityIntent(context) != null);
@@ -366,9 +391,15 @@
             if (mEditableWfcMode) {
                 preferenceScreen.addPreference(mButtonWfcMode);
             } else {
-                // Don't show WFC mode preference if it's not editable.
+                // Don't show WFC (home) preference if it's not editable.
                 preferenceScreen.removePreference(mButtonWfcMode);
             }
+            if (mEditableWfcRoamingMode) {
+                preferenceScreen.addPreference(mButtonWfcRoamingMode);
+            } else {
+                // Don't show WFC roaming preference if it's not editable.
+                preferenceScreen.removePreference(mButtonWfcRoamingMode);
+            }
             if (updateAddressEnabled) {
                 preferenceScreen.addPreference(mUpdateAddress);
             } else {
@@ -376,6 +407,7 @@
             }
         } else {
             preferenceScreen.removePreference(mButtonWfcMode);
+            preferenceScreen.removePreference(mButtonWfcRoamingMode);
             preferenceScreen.removePreference(mUpdateAddress);
         }
     }
@@ -386,12 +418,28 @@
         if (preference == mButtonWfcMode) {
             mButtonWfcMode.setValue((String) newValue);
             int buttonMode = Integer.valueOf((String) newValue);
-            int currentMode = ImsManager.getWfcMode(context);
-            if (buttonMode != currentMode) {
-                ImsManager.setWfcMode(context, buttonMode);
+            int currentWfcMode = ImsManager.getWfcMode(context, false);
+            if (buttonMode != currentWfcMode) {
+                ImsManager.setWfcMode(context, buttonMode, false);
                 mButtonWfcMode.setSummary(getWfcModeSummary(context, buttonMode));
                 MetricsLogger.action(getActivity(), getMetricsCategory(), buttonMode);
             }
+            if (!mEditableWfcRoamingMode) {
+                int currentWfcRoamingMode = ImsManager.getWfcMode(context, true);
+                if (buttonMode != currentWfcRoamingMode) {
+                    ImsManager.setWfcMode(context, buttonMode, true);
+                    // mButtonWfcRoamingMode.setSummary is not needed; summary is selected value
+                }
+            }
+        } else if (preference == mButtonWfcRoamingMode) {
+            mButtonWfcRoamingMode.setValue((String) newValue);
+            int buttonMode = Integer.valueOf((String) newValue);
+            int currentMode = ImsManager.getWfcMode(context, true);
+            if (buttonMode != currentMode) {
+                ImsManager.setWfcMode(context, buttonMode, true);
+                // mButtonWfcRoamingMode.setSummary is not needed; summary is just selected value.
+                MetricsLogger.action(getActivity(), getMetricsCategory(), buttonMode);
+            }
         }
         return true;
     }
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 7e3b8d8..7434e67 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -362,7 +362,7 @@
             getPreferenceScreen().addPreference(mButtonWfc);
 
             mButtonWfc.setSummary(WifiCallingSettings.getWfcModeSummary(
-                    context, ImsManager.getWfcMode(context)));
+                    context, ImsManager.getWfcMode(context, mTm.isNetworkRoaming())));
         } else {
             removePreference(KEY_WFC_SETTINGS);
         }
diff --git a/src/com/android/settings/dashboard/DashboardAdapter.java b/src/com/android/settings/dashboard/DashboardAdapter.java
index ca68a74..6b2e145 100644
--- a/src/com/android/settings/dashboard/DashboardAdapter.java
+++ b/src/com/android/settings/dashboard/DashboardAdapter.java
@@ -301,11 +301,22 @@
     }
 
     private void onBindSuggestionHeader(final DashboardItemHolder holder) {
-        holder.icon.setImageResource(hasMoreSuggestions() ? R.drawable.ic_expand_more
-                : R.drawable.ic_expand_less);
-        holder.title.setText(mContext.getString(R.string.suggestions_title, mSuggestions.size()));
+        final boolean moreSuggestions = hasMoreSuggestions();
         final int undisplayedSuggestionCount =
                 mSuggestions.size() - getDisplayableSuggestionCount();
+        holder.icon.setImageResource(moreSuggestions ? R.drawable.ic_expand_more
+                : R.drawable.ic_expand_less);
+        holder.title.setText(mContext.getString(R.string.suggestions_title, mSuggestions.size()));
+        String summaryContentDescription;
+        if (moreSuggestions) {
+            summaryContentDescription = mContext.getResources().getQuantityString(
+                    R.plurals.settings_suggestion_header_summary_hidden_items,
+                    undisplayedSuggestionCount, undisplayedSuggestionCount);
+        } else {
+            summaryContentDescription = mContext.getString(R.string.condition_expand_hide);
+        }
+        holder.summary.setContentDescription(summaryContentDescription);
+
         if (undisplayedSuggestionCount == 0) {
             holder.summary.setText(null);
         } else {
diff --git a/src/com/android/settings/widget/SlidingTabLayout.java b/src/com/android/settings/widget/SlidingTabLayout.java
index 6e2d8c6..7099646 100644
--- a/src/com/android/settings/widget/SlidingTabLayout.java
+++ b/src/com/android/settings/widget/SlidingTabLayout.java
@@ -83,19 +83,21 @@
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         if (mTitleView.getChildCount() > 0) {
-            mTitleView.layout(0, 0, mTitleView.getMeasuredWidth(), mTitleView.getMeasuredHeight());
             final int indicatorBottom = getMeasuredHeight();
             final int indicatorHeight = mIndicatorView.getMeasuredHeight();
             final int indicatorWidth = mIndicatorView.getMeasuredWidth();
             final int totalWidth = getMeasuredWidth();
+            final int leftPadding = getPaddingLeft();
+            final int rightPadding = getPaddingRight();
 
+            mTitleView.layout(leftPadding, 0, mTitleView.getMeasuredWidth() + rightPadding,
+                    mTitleView.getMeasuredHeight());
             // IndicatorView should start on the right when RTL mode is enabled
             if (isRtlMode()) {
                 mIndicatorView.layout(totalWidth - indicatorWidth,
                         indicatorBottom - indicatorHeight, totalWidth,
                         indicatorBottom);
             } else {
-
                 mIndicatorView.layout(0, indicatorBottom - indicatorHeight,
                         indicatorWidth, indicatorBottom);
             }