Merge "AdvancedSettings replaced by AdvancedWifiSettings"
diff --git a/res/layout-land/choose_lock_pattern_tutorial.xml b/res/layout-land/choose_lock_pattern_tutorial.xml
index 606d2e1..ac693cc 100644
--- a/res/layout-land/choose_lock_pattern_tutorial.xml
+++ b/res/layout-land/choose_lock_pattern_tutorial.xml
@@ -17,29 +17,29 @@
 <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/topLayout"
-    android:orientation="horizontal"
+    android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <RelativeLayout
-        android:layout_width="0dip"
-        android:layout_height="match_parent"
-        android:layout_weight="1">
+    <!-- Top: pattern and information -->
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="0dip"
+        android:layout_weight="1"
+        android:orientation="horizontal">
 
-        <!-- left side: lock pattern -->
+        <!-- left side: lock pattern. Given the square aspect, this will be the smaller of the
+             two dimensions (height) -->
         <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
-             android:layout_width="300dip"
-             android:layout_height="300dip"
-             android:layout_gravity="center_horizontal"
-             aspect="square"/>
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"/>
 
         <!-- right side: instructions and buttons -->
         <!-- header message -->
         <ScrollView
-            android:layout_width="300dip"
-            android:layout_height="180dip"
-            android:layout_alignParentTop="true"
-            android:layout_toRightOf="@id/lockPattern"
+            android:layout_width="0dip"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
             android:layout_marginLeft="25dip">
 
             <LinearLayout
@@ -69,25 +69,24 @@
 
         </ScrollView>
 
-        <LinearLayout
-            style="@style/SecurityPreferenceButtonContainer"
-            android:layout_alignParentRight="true"
-            android:layout_alignParentBottom="true"
-            android:orientation="horizontal">
+    </LinearLayout>
 
-            <!-- left / top button: skip, or re-try -->
-            <Button android:id="@+id/skip_button"
-                style="@style/SecurityPreferenceButton"
-                android:text="@string/lockpattern_tutorial_cancel_label"/>
+    <!-- Bottom: cancel/next buttons -->
+    <LinearLayout
+        style="@style/SecurityPreferenceButtonContainer"
+        android:orientation="horizontal">
 
-            <!-- right / bottom button: confirm or ok -->
-            <Button android:id="@+id/next_button"
-                style="@style/SecurityPreferenceButton"
-                android:text="@string/lockpattern_tutorial_continue_label"/>
+        <!-- left / top button: skip, or re-try -->
+        <Button android:id="@+id/skip_button"
+            style="@style/SecurityPreferenceButton"
+            android:text="@string/lockpattern_tutorial_cancel_label"/>
 
-        </LinearLayout>
+        <!-- right / bottom button: confirm or ok -->
+        <Button android:id="@+id/next_button"
+            style="@style/SecurityPreferenceButton"
+            android:text="@string/lockpattern_tutorial_continue_label"/>
 
-    </RelativeLayout>
+    </LinearLayout>
 
 </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
 
diff --git a/res/layout/choose_lock_pattern_tutorial.xml b/res/layout/choose_lock_pattern_tutorial.xml
index 5f6ea56..742cef8 100644
--- a/res/layout/choose_lock_pattern_tutorial.xml
+++ b/res/layout/choose_lock_pattern_tutorial.xml
@@ -33,6 +33,7 @@
             android:orientation="vertical"
             android:padding="5dip">
 
+            <!-- Top: instructions -->
             <TextView
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
@@ -40,26 +41,27 @@
                 android:text="@string/lock_title"
                 android:paddingBottom="10dip"
                 style="?android:attr/textAppearanceLarge"
+                android:visibility="visible"
             />
 
             <TextView
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="18sp"
                 android:text="@string/lock_intro_message"
             />
 
+            <!-- bottom: lock pattern -->
+            <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
+                 android:layout_width="200dip"
+                 android:layout_height="200dip"
+                 android:layout_marginTop="10dip"
+                 android:layout_gravity="left"/>
+
         </LinearLayout>
 
     </ScrollView>
 
-    <!-- bottom: lock pattern. Note the size is match_parent in both axis since requested aspect
-         is square and the pattern view will choose the smaller of the two. -->
-    <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
-         android:layout_width="match_parent"
-         android:layout_height="match_parent"/>
-
     <LinearLayout
         style="@style/SecurityPreferenceButtonContainer"
         android:orientation="horizontal">
diff --git a/res/layout/trusted_credential_details.xml b/res/layout/trusted_credential_details.xml
index c18d933..e220e1c 100644
--- a/res/layout/trusted_credential_details.xml
+++ b/res/layout/trusted_credential_details.xml
@@ -13,22 +13,11 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<LinearLayout
+<Button
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    >
-    <FrameLayout
-        android:id="@+id/cert_details"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        />
-    <Button
-        android:id="@+id/cert_remove_button"
-        android:layout_height="wrap_content"
-        android:layout_width="wrap_content"
-        android:layout_gravity="right"
-        android:layout_margin="6dip"
-        />
-</LinearLayout>
+    android:id="@+id/cert_remove_button"
+    android:layout_height="wrap_content"
+    android:layout_width="wrap_content"
+    android:layout_gravity="right"
+    android:layout_margin="6dip"
+    />
diff --git a/res/layout/vpn_dialog.xml b/res/layout/vpn_dialog.xml
index 3e4b441..a4bb216 100644
--- a/res/layout/vpn_dialog.xml
+++ b/res/layout/vpn_dialog.xml
@@ -93,8 +93,8 @@
                         android:prompt="@string/vpn_ipsec_ca_cert" />
             </LinearLayout>
 
-            <TextView style="@style/vpn_label" android:text="@string/vpn_domains"/>
-            <EditText style="@style/vpn_value" android:id="@+id/domains"
+            <TextView style="@style/vpn_label" android:text="@string/vpn_search_domains"/>
+            <EditText style="@style/vpn_value" android:id="@+id/search_domains"
                     android:hint="@string/vpn_not_used"/>
 
             <!-- Not sure if we have time to make it. -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 93a7720..e6a5136 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -237,7 +237,11 @@
     <!--Bluetooth settings screen, summary text under individual Bluetooth devices that are hands free or a headset -->
     <string name="bluetooth_device">handsfree/headset</string>
     <!--Bluetooth settings screen, text that appears in heading bar when scanning for devices -->
-    <string name="progress_scanning">Scanning</string>
+    <string name="progress_scanning">Searching</string>
+    <!--Bluetooth settings screen, text that appears in heading bar when scanning for devices is finished, indicating that user can tap on a device to pair with it [CHAR LIMIT=20]-->
+    <string name="progress_tap_to_pair">Tap to pair</string>
+    <!--Bluetooth settings screen, text that appears when scanning for devices is finished and no nearby bluetooth device was found [CHAR LIMIT=40]-->
+    <string name="bluetooth_no_devices_found">No Bluetooth devices were found nearby.</string>
     <!-- Notification ticker text (shown in the status bar) when a Bluetooth device wants to pair with us -->
     <string name="bluetooth_notif_ticker">Bluetooth pairing request</string>
     <!-- Notification title when a Bluetooth device wants to pair with us -->
@@ -936,8 +940,10 @@
 
     <!-- Bluetooth settings: The title of the preference (list item) that initiates a scan for devices -->
     <string name="bluetooth_preference_scan_title">Scan for devices</string>
-    <!-- Bluetooth settings: The title of the action button that initiates a scan for nearby devices [CHAR LIMIT=20] -->
-    <string name="bluetooth_scan_nearby_devices">Scan</string>
+    <!-- Bluetooth settings: The title of the action button that initiates a search for nearby devices [CHAR LIMIT=20] -->
+    <string name="bluetooth_search_for_devices">Search for devices</string>
+    <!-- Bluetooth settings: The title of the action button while a search for nearby devices is in progress [CHAR LIMIT=20] -->
+    <string name="bluetooth_searching_for_devices">Searching\u2026</string>
     <!-- Bluetooth settings: The sub heading for device settings. [CHAR LIMIT=30] -->
     <string name="bluetooth_preference_device_settings">Device settings</string>
     <!-- Bluetooth settings: The sub heading for paired devices. [CHAR LIMIT=30] -->
@@ -1189,7 +1195,7 @@
 
     <!-- Wi-Fi Advanced Settings --> <skip />
     <!-- Wi-Fi settings screen, advanced, settings section.  This is a header shown above advanced wifi settings. -->
-    <string name="wifi_advanced_titlebar">Advanced</string>
+    <string name="wifi_advanced_titlebar">Advanced Wi-Fi</string>
     <!-- Wi-Fi settings screen, setting title for setting the band [CHAR LIMIT=50]-->
     <string name="wifi_setting_frequency_band_title">Wi-Fi frequency band</string>
     <!-- Wi-Fi settings screen, setting summary for setting the wifi frequency band [CHAR LIMIT=50]-->
@@ -1652,7 +1658,7 @@
     <!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of media on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
     <string name="memory_media_usage">Media</string>
     <!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of /sdcard/Download on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
-    <string name="memory_downloads_usage">Downloads</string>    
+    <string name="memory_downloads_usage">Downloads</string>
     <!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of all pictures, videos in /sdcard/DCIM, /sdcard/Pictures folders on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
     <string name="memory_dcim_usage">Pictures, Videos</string>
     <!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of audio files in /sdcard on the device. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
@@ -2132,12 +2138,8 @@
         \n\nReady to start? Touch \u201CNext\u201D.
     </string>
     <!-- ChooseLockPatternTutorial, tutorial screen text -->
-    <string name="lock_intro_message" product="default"><font size="17">Protect your phone from unauthorized use by creating a personal screen unlock pattern.
-        \n<font height="17">\n</font><b>1</b>\u00A0 On the next screen, watch while an example pattern is drawn.
-        \n<font height="17">\n</font><b>2</b>\u00A0 When ready, draw your own personal unlock pattern. Experiment with different patterns but connect at least four dots.
-        \n<font height="17">\n</font><b>3</b>\u00A0 Redraw your pattern to confirm.
-        \n<font height="17">\n</font><b>Ready to start? Touch \u201CNext\u201D</b>.
-        \n<font height="3">\n</font>To leave your phone unprotected, touch \u201CCancel\u201D.</font>
+    <string name="lock_intro_message" product="default">Protect your phone from unauthorized use by creating a personal screen unlock pattern. Use your finger to connect at least four dots in any order on the next screen.
+        \n\nReady to start? Touch \u201CNext\u201D.
     </string>
 
     <!-- Applications Settings --> <skip />
@@ -3509,7 +3511,7 @@
     <!-- Selection label for the IPSec CA certificate of a VPN network. [CHAR LIMIT=40] -->
     <string name="vpn_ipsec_ca_cert">IPSec CA certificate</string>
     <!-- Input label for the DNS search domains of a VPN network. [CHAR LIMIT=40] -->
-    <string name="vpn_domains">DNS search domains</string>
+    <string name="vpn_search_domains">DNS search domains</string>
     <!-- Input label for the forwarding routes of a VPN network. [CHAR LIMIT=40] -->
     <string name="vpn_routes">Forwarding routes</string>
     <!-- Input label for the username of a VPN network. [CHAR LIMIT=40] -->
@@ -3517,7 +3519,7 @@
     <!-- Input label for the password of a VPN network. [CHAR LIMIT=40] -->
     <string name="vpn_password">Password</string>
     <!-- Checkbox label to save the username and the password for a VPN network. [CHAR LIMIT=40] -->
-    <string name="vpn_save_login">Save this information</string>
+    <string name="vpn_save_login">Save account information</string>
 
     <!-- Hint for an optional input of a VPN network. [CHAR LIMIT=40] -->
     <string name="vpn_not_used">(not used)</string>
diff --git a/res/xml/settings_headers.xml b/res/xml/settings_headers.xml
index 7e80db4..cd6191f 100644
--- a/res/xml/settings_headers.xml
+++ b/res/xml/settings_headers.xml
@@ -53,6 +53,7 @@
     <header
         android:id="@+id/wireless_settings"
         android:title="@string/radio_controls_title"
+        android:breadCrumbTitle="@string/wireless_networks_settings_title"
         android:fragment="com.android.settings.WirelessSettings"
         android:icon="@drawable/ic_settings_more_wireless" />
 
diff --git a/src/com/android/settings/ProgressCategory.java b/src/com/android/settings/ProgressCategory.java
index bedcc98..eee19bc 100644
--- a/src/com/android/settings/ProgressCategory.java
+++ b/src/com/android/settings/ProgressCategory.java
@@ -17,12 +17,15 @@
 package com.android.settings;
 
 import android.content.Context;
+import android.preference.Preference;
 import android.util.AttributeSet;
 import android.view.View;
+import android.widget.TextView;
 
 public class ProgressCategory extends ProgressCategoryBase {
 
     private boolean mProgress = false;
+    private Preference mNoDeviceFoundPreference;
 
     public ProgressCategory(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -32,12 +35,27 @@
     @Override
     public void onBindView(View view) {
         super.onBindView(view);
-        final View textView = view.findViewById(R.id.scanning_text);
+        final TextView textView = (TextView) view.findViewById(R.id.scanning_text);
         final View progressBar = view.findViewById(R.id.scanning_progress);
 
-        final int visibility = mProgress ? View.VISIBLE : View.INVISIBLE;
-        textView.setVisibility(visibility);
-        progressBar.setVisibility(visibility);
+        textView.setText(mProgress ? R.string.progress_scanning : R.string.progress_tap_to_pair);
+        boolean noDeviceFound = getPreferenceCount() == 0;
+        textView.setVisibility(noDeviceFound ? View.INVISIBLE : View.VISIBLE);
+        progressBar.setVisibility(mProgress ? View.VISIBLE : View.INVISIBLE);
+
+        if (mProgress) {
+            if (mNoDeviceFoundPreference != null) {
+                removePreference(mNoDeviceFoundPreference);
+            }
+        } else {
+            if (noDeviceFound) {
+                if (mNoDeviceFoundPreference == null) {
+                    mNoDeviceFoundPreference = new Preference(getContext());
+                    mNoDeviceFoundPreference.setSummary(R.string.bluetooth_no_devices_found);
+                }
+                addPreference(mNoDeviceFoundPreference);
+            }
+        }
     }
 
     @Override
diff --git a/src/com/android/settings/TrustedCredentialsSettings.java b/src/com/android/settings/TrustedCredentialsSettings.java
index 340e93d..3e50440 100644
--- a/src/com/android/settings/TrustedCredentialsSettings.java
+++ b/src/com/android/settings/TrustedCredentialsSettings.java
@@ -309,7 +309,7 @@
     }
 
     private void showCertDialog(final CertHolder certHolder) {
-        View view = View.inflate(getActivity(), R.layout.trusted_credential_details, null);
+        View view = certHolder.mSslCert.inflateCertificateView(getActivity());
         AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
         builder.setTitle(com.android.internal.R.string.ssl_certificate);
         builder.setView(view);
@@ -320,10 +320,12 @@
         });
         final Dialog certDialog = builder.create();
 
-        FrameLayout details = (FrameLayout) view.findViewById(R.id.cert_details);
-        details.addView(certHolder.mSslCert.inflateCertificateView(getActivity()));
-
-        Button removeButton = (Button) view.findViewById(R.id.cert_remove_button);
+        ViewGroup body = (ViewGroup) view.findViewById(com.android.internal.R.id.body);
+        LayoutInflater inflater = LayoutInflater.from(getActivity());
+        Button removeButton = (Button) inflater.inflate(R.layout.trusted_credential_details,
+                                                        body,
+                                                        false);
+        body.addView(removeButton);
         removeButton.setText(certHolder.mTab.getButtonLabel(certHolder));
         removeButton.setOnClickListener(new View.OnClickListener() {
             @Override public void onClick(View v) {
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 76bf623..cd37309 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -101,9 +101,12 @@
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         boolean bluetoothIsEnabled = mLocalAdapter.getBluetoothState() == BluetoothAdapter.STATE_ON;
-        menu.add(Menu.NONE, MENU_ID_SCAN, 0, R.string.bluetooth_scan_nearby_devices)
+        boolean isDiscovering = mLocalAdapter.isDiscovering();
+        int textId = isDiscovering ? R.string.bluetooth_searching_for_devices :
+            R.string.bluetooth_search_for_devices;
+        menu.add(Menu.NONE, MENU_ID_SCAN, 0, textId)
                 //.setIcon(R.drawable.ic_menu_scan_network)
-                .setEnabled(bluetoothIsEnabled && !mLocalAdapter.isDiscovering())
+                .setEnabled(bluetoothIsEnabled && !isDiscovering)
                 .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
         menu.add(Menu.NONE, MENU_ID_ADVANCED, 0, R.string.bluetooth_menu_advanced)
                 //.setIcon(android.R.drawable.ic_menu_manage)
@@ -218,7 +221,7 @@
     @Override
     public void onScanningStateChanged(boolean started) {
         super.onScanningStateChanged(started);
-        // Update 'Scan' option enabled state
+        // Update options' enabled state
         getActivity().invalidateOptionsMenu();
     }
 
diff --git a/src/com/android/settings/vpn2/VpnDialog.java b/src/com/android/settings/vpn2/VpnDialog.java
index 92ad362..2914b1b 100644
--- a/src/com/android/settings/vpn2/VpnDialog.java
+++ b/src/com/android/settings/vpn2/VpnDialog.java
@@ -60,7 +60,7 @@
     private TextView mServer;
     private TextView mUsername;
     private TextView mPassword;
-    private TextView mDomains;
+    private TextView mSearchDomains;
     private TextView mRoutes;
     private CheckBox mMppe;
     private TextView mL2tpSecret;
@@ -92,7 +92,7 @@
         mServer = (TextView) mView.findViewById(R.id.server);
         mUsername = (TextView) mView.findViewById(R.id.username);
         mPassword = (TextView) mView.findViewById(R.id.password);
-        mDomains = (TextView) mView.findViewById(R.id.domains);
+        mSearchDomains = (TextView) mView.findViewById(R.id.search_domains);
         mRoutes = (TextView) mView.findViewById(R.id.routes);
         mMppe = (CheckBox) mView.findViewById(R.id.mppe);
         mL2tpSecret = (TextView) mView.findViewById(R.id.l2tp_secret);
@@ -108,7 +108,7 @@
         mServer.setText(mProfile.server);
         mUsername.setText(mProfile.username);
         mPassword.setText(getDummy(mProfile.password));
-        mDomains.setText(mProfile.domains);
+        mSearchDomains.setText(mProfile.searchDomains);
         mRoutes.setText(mProfile.routes);
         mMppe.setChecked(mProfile.mppe);
         mL2tpSecret.setText(getDummy(mProfile.l2tpSecret));
@@ -288,7 +288,7 @@
         profile.server = mServer.getText().toString().trim();
         profile.username = mUsername.getText().toString();
         profile.password = getSecret(mProfile.password, mPassword);
-        profile.domains = mDomains.getText().toString().trim();
+        profile.searchDomains = mSearchDomains.getText().toString().trim();
         profile.routes = mRoutes.getText().toString().trim();
 
         // Then, save type-specific fields.
diff --git a/src/com/android/settings/vpn2/VpnProfile.java b/src/com/android/settings/vpn2/VpnProfile.java
index 9e4c528..24c2f5f 100644
--- a/src/com/android/settings/vpn2/VpnProfile.java
+++ b/src/com/android/settings/vpn2/VpnProfile.java
@@ -42,14 +42,15 @@
     String server = "";         // 2
     String username = "";       // 3
     String password = "";       // 4
-    String domains = "";        // 5
-    String routes = "";         // 6
-    boolean mppe = false;       // 7
-    String l2tpSecret = "";     // 8
-    String ipsecIdentifier = "";// 9
-    String ipsecSecret = "";    // 10
-    String ipsecUserCert = "";  // 11
-    String ipsecCaCert = "";    // 12
+    String dnsServers = "";     // 5
+    String searchDomains = "";  // 6
+    String routes = "";         // 7
+    boolean mppe = false;       // 8
+    String l2tpSecret = "";     // 9
+    String ipsecIdentifier = "";// 10
+    String ipsecSecret = "";    // 11
+    String ipsecUserCert = "";  // 12
+    String ipsecCaCert = "";    // 13
 
     // Helper fields.
     boolean saveLogin = false;
@@ -65,8 +66,8 @@
             }
 
             String[] values = new String(value, Charsets.UTF_8).split("\0", -1);
-            // Currently it always has 13 fields.
-            if (values.length < 13) {
+            // Currently it always has 14 fields.
+            if (values.length < 14) {
                 return null;
             }
 
@@ -79,14 +80,15 @@
             profile.server = values[2];
             profile.username = values[3];
             profile.password = values[4];
-            profile.domains = values[5];
-            profile.routes = values[6];
-            profile.mppe = Boolean.valueOf(values[7]);
-            profile.l2tpSecret = values[8];
-            profile.ipsecIdentifier = values[9];
-            profile.ipsecSecret = values[10];
-            profile.ipsecUserCert = values[11];
-            profile.ipsecCaCert = values[12];
+            profile.dnsServers = values[5];
+            profile.searchDomains = values[6];
+            profile.routes = values[7];
+            profile.mppe = Boolean.valueOf(values[8]);
+            profile.l2tpSecret = values[9];
+            profile.ipsecIdentifier = values[10];
+            profile.ipsecSecret = values[11];
+            profile.ipsecUserCert = values[12];
+            profile.ipsecCaCert = values[13];
 
             profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty();
             return profile;
@@ -102,7 +104,8 @@
         builder.append('\0').append(server);
         builder.append('\0').append(saveLogin ? username : "");
         builder.append('\0').append(saveLogin ? password : "");
-        builder.append('\0').append(domains);
+        builder.append('\0').append(dnsServers);
+        builder.append('\0').append(searchDomains);
         builder.append('\0').append(routes);
         builder.append('\0').append(mppe);
         builder.append('\0').append(l2tpSecret);