Merge "Fix numeric strings to not be translated"
diff --git a/res/layout-xlarge/date_time_settings_setupwizard.xml b/res/layout-xlarge/date_time_settings_setupwizard.xml
index ee425eb..cbef18b 100644
--- a/res/layout-xlarge/date_time_settings_setupwizard.xml
+++ b/res/layout-xlarge/date_time_settings_setupwizard.xml
@@ -75,6 +75,34 @@
             android:layout_marginLeft="32dip"
             android:layout_alignParentRight="true">
 
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_toRightOf="@id/time_zone_button"
+                android:layout_alignParentRight="true">
+
+                <TextView
+                    android:id="@+id/date_time_auto_text"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:minHeight="?android:attr/listPreferredItemHeight"
+                    android:layout_marginLeft="16dip"
+                    android:text="@string/date_time_auto"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:textSize="20dip"
+                    android:layout_alignParentLeft="true"
+                    android:layout_toLeftOf="@+id/date_time_auto_button"
+                    android:gravity="left|center_vertical" />
+
+                <CheckBox
+                    android:id="@+id/date_time_auto_button"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_alignParentRight="true" />
+            </RelativeLayout>
+
+            <!--
             <Switch
                 android:id="@+id/date_time_auto_button"
                 android:layout_width="match_parent"
@@ -83,7 +111,7 @@
                 android:layout_marginLeft="16dip"
                 android:text="@string/date_time_auto"
                 android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="20dip" />
+                android:textSize="20dip" /> -->
 
             <!-- Divider -->
             <View
diff --git a/res/layout/wifi_config_ui_for_setup_wizard.xml b/res/layout/wifi_config_ui_for_setup_wizard.xml
index b0f0bb2..138458b 100644
--- a/res/layout/wifi_config_ui_for_setup_wizard.xml
+++ b/res/layout/wifi_config_ui_for_setup_wizard.xml
@@ -14,146 +14,180 @@
      limitations under the License.
 -->
 <!-- All ids in this layout must be in wifi_dialog.xml -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent">
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     <!-- UI components that should be shown appropriately -->
-    <FrameLayout android:id="@+id/eap_not_supported"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:minHeight="360dip"
-                  android:orientation="vertical"
-                  android:visibility="gone">
-        <TextView android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:lineSpacingExtra="12dip"
-                  android:text="@string/wifi_setup_eap_not_supported"
-                  android:textAppearance="?android:attr/textAppearanceMedium"
-                  android:textSize="20sp" />
+    <FrameLayout
+        android:id="@+id/eap_not_supported"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:minHeight="360dip"
+        android:orientation="vertical"
+        android:visibility="gone">
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:lineSpacingExtra="12dip"
+            android:text="@string/wifi_setup_eap_not_supported"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textSize="20sp" />
     </FrameLayout>
     <!-- In "add network" flow, we have security type field (@id/security below) below
          this View, so need a bit different layout than the other flow, in which we'll use
          @id/eap_not_supported. -->
-    <FrameLayout android:id="@+id/eap_not_supported_for_add_network"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:orientation="vertical"
-                  android:visibility="gone">
-        <TextView android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:lineSpacingExtra="12dip"
-                  android:text="@string/wifi_setup_eap_not_supported"
-                  android:textAppearance="?android:attr/textAppearanceMedium"
-                  android:textSize="20sp" />
+    <FrameLayout
+        android:id="@+id/eap_not_supported_for_add_network"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:visibility="gone">
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:lineSpacingExtra="12dip"
+            android:text="@string/wifi_setup_eap_not_supported"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textSize="20sp" />
     </FrameLayout>
-    <LinearLayout android:id="@+id/wps_fields"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:orientation="vertical"
-                  android:visibility="gone">
-        <TextView android:layout_width="match_parent"
-                  android:minWidth="128dip"
-                  android:layout_height="wrap_content"
-                  android:text="@string/wifi_wps_pin"
-                  android:textAppearance="?android:attr/textAppearanceMedium"
-                  android:textSize="20sp"
-                  android:gravity="bottom" />
+    <LinearLayout
+        android:id="@+id/wps_fields"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:visibility="gone">
+        <TextView
+            android:layout_width="match_parent"
+            android:minWidth="128dip"
+            android:layout_height="wrap_content"
+            android:text="@string/wifi_wps_pin"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textSize="20sp"
+            android:gravity="bottom" />
 
-        <EditText android:id="@+id/wps_pin"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textPassword"
-                  android:textAppearance="?android:attr/textAppearanceMedium"
-                  android:textSize="20sp" />
+        <EditText
+            android:id="@+id/wps_pin"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:singleLine="true"
+            android:inputType="textPassword"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textSize="20sp" />
     </LinearLayout>
-    <TableLayout android:layout_width="match_parent"
-                 android:layout_height="wrap_content"
-                 android:layout_marginBottom="16dip">
+    <TableLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="16dip">
         <!-- To accomodate @id/type into TableLayout, we splitted the layout into two:
              @id/type_ssid and @id/type_security. -->
-        <TableRow android:id="@+id/type_ssid"
-                  android:visibility="gone">
-            <TextView android:id="@+id/ssid_text"
-                      android:layout_width="wrap_content"
-                      android:minWidth="128dip"
-                      android:layout_height="wrap_content"
-                      android:minHeight="48dip"
-                      android:layout_alignParentLeft="true"
-                      android:text="@string/wifi_ssid"
-                      android:textAppearance="?android:attr/textAppearanceMedium"
-                      android:textSize="20sp"
-                      android:gravity="bottom"/>
+        <TableRow
+            android:id="@+id/type_ssid"
+            android:minHeight="56dip"
+            android:visibility="gone">
+            <TextView
+                android:id="@+id/ssid_text"
+                android:layout_width="wrap_content"
+                android:minWidth="128dip"
+                android:layout_height="wrap_content"
+                android:minHeight="56dip"
+                android:paddingRight="16dip"
+                android:layout_alignParentLeft="true"
+                android:text="@string/wifi_ssid"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:textSize="20sp"
+                android:gravity="left|center_vertical" />
 
-            <FrameLayout android:id="@+id/ssid_layout"
-                         android:layout_width="wrap_content"
-                         android:layout_height="wrap_content"
-                         android:layout_alignBottom="@id/ssid_text"
-                         android:layout_toRightOf="@id/ssid_text">
-                <EditText android:id="@+id/ssid"
-                          android:layout_width="368dip"
-                          android:layout_height="wrap_content"
-                          android:singleLine="true"
-                          android:inputType="textNoSuggestions"
-                          android:textAppearance="?android:attr/textAppearanceMedium"
-                          android:textSize="20sp" />
+            <FrameLayout
+                android:id="@+id/ssid_layout"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignBottom="@id/ssid_text"
+                android:layout_toRightOf="@id/ssid_text">
+                <EditText
+                    android:id="@+id/ssid"
+                    android:layout_width="368dip"
+                    android:layout_height="wrap_content"
+                    android:singleLine="true"
+                    android:inputType="textNoSuggestions"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:textSize="20sp" />
             </FrameLayout>
         </TableRow>
 
-        <TableRow android:id="@+id/security_fields"
-                  android:visibility="gone">
-            <TextView android:id="@+id/password_text"
-                      android:layout_width="wrap_content"
-                      android:minWidth="128dip"
-                      android:layout_height="wrap_content"
-                      android:minHeight="48dip"
-                      android:text="@string/wifi_password"
-                      android:textAppearance="?android:attr/textAppearanceMedium"
-                      android:textSize="20sp"
-                      android:gravity="bottom" />
+        <TableRow
+            android:id="@+id/security_fields"
+            android:minHeight="56dip"
+            android:visibility="gone">
+            <TextView
+                android:id="@+id/password_text"
+                android:layout_width="wrap_content"
+                android:minWidth="128dip"
+                android:layout_height="wrap_content"
+                android:minHeight="56dip"
+                android:text="@string/wifi_password"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:textSize="20sp"
+                android:gravity="left|center_vertical" />
 
-            <FrameLayout android:id="@+id/password_layout"
-                         android:layout_width="wrap_content"
-                         android:layout_height="wrap_content"
-                         android:minHeight="48dip">
-                <EditText android:id="@+id/password"
-                          android:layout_width="368dip"
-                          android:layout_height="wrap_content"
-                          android:singleLine="true"
-                          android:password="true"
-                          android:textAppearance="?android:attr/textAppearanceMedium"
-                          android:textSize="20sp" />
+            <LinearLayout
+                android:id="@+id/password_layout"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="bottom">
+                <EditText
+                    android:id="@+id/password"
+                    android:layout_width="368dip"
+                    android:layout_height="wrap_content"
+                    android:minHeight="56dip"
+                    android:singleLine="true"
+                    android:password="true"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:textSize="20sp" />
+            </LinearLayout>
+
+            <!-- It looks CheckBox isn't aligned well with TableRow -->
+            <FrameLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content">
+                <CheckBox
+                    android:id="@+id/show_password"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:minHeight="56dip"
+                    android:text="@string/wifi_show_password"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:textSize="20sp" />
             </FrameLayout>
-
-            <CheckBox android:id="@+id/show_password"
-                      android:layout_width="match_parent"
-                      android:layout_height="wrap_content"
-                      android:text="@string/wifi_show_password"
-                      android:textAppearance="?android:attr/textAppearanceMedium"
-                      android:textSize="20sp" />
         </TableRow>
 
-        <TableRow android:id="@+id/type_security"
-                  android:visibility="gone">
-            <TextView android:id="@+id/security_text"
-                      android:layout_width="wrap_content"
-                      android:minWidth="128dip"
-                      android:layout_height="wrap_content"
-                      android:minHeight="48dip"
-                      android:text="@string/wifi_security"
-                      android:textAppearance="?android:attr/textAppearanceMedium"
-                      android:textSize="20sp"
-                      android:gravity="bottom"/>
+        <TableRow
+            android:id="@+id/type_security"
+            android:minHeight="56dip"
+            android:visibility="gone">
+            <TextView
+                android:id="@+id/security_text"
+                android:layout_width="wrap_content"
+                android:minWidth="128dip"
+                android:layout_height="wrap_content"
+                android:minHeight="56dip"
+                android:text="@string/wifi_security"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:textSize="20sp"
+                android:gravity="bottom"/>
 
-            <Spinner android:id="@+id/security"
-                     android:layout_width="368dip"
-                     android:layout_height="wrap_content"
-                     android:minHeight="48dip"
-                     android:paddingLeft="4dip"
-                     android:textAppearance="?android:attr/textAppearanceMedium"
-                     android:textSize="20sp"
-                     android:gravity="left|center_vertical"/>
+            <FrameLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="bottom">
+                <Spinner
+                    android:id="@+id/security"
+                    android:layout_width="368dip"
+                    android:layout_height="wrap_content"
+                    android:minHeight="56dip"
+                    android:paddingLeft="4dip"/>
+            </FrameLayout>
         </TableRow>
     </TableLayout>
 
diff --git a/res/layout/wifi_setup_custom_list_item_1.xml b/res/layout/wifi_setup_custom_list_item_1.xml
index 355490e..9d329ea 100644
--- a/res/layout/wifi_setup_custom_list_item_1.xml
+++ b/res/layout/wifi_setup_custom_list_item_1.xml
@@ -22,6 +22,6 @@
     android:textAppearance="?android:attr/textAppearanceMedium"
     android:textSize="20sp"
     android:gravity="center_vertical"
-    android:paddingLeft="10dip"
+    android:paddingLeft="16dip"
     android:minHeight="48dip"
 />
diff --git a/res/values/colors.xml b/res/values/colors.xml
index af5595a..6879f9d 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -19,12 +19,12 @@
     <color name="red">#F00</color>
 
     <color name="memory_used">#F00</color>
-    <color name="memory_avail">#336600</color>
-    <color name="memory_apps_usage">#99CC00</color>
-    <color name="memory_downloads">#003399</color>
-    <color name="memory_video">#993300</color>
-    <color name="memory_audio">#667788</color>
-    <color name="memory_misc">#FF6600</color>
+    <color name="memory_avail">#333333</color>
+    <color name="memory_apps_usage">#77831A</color>
+    <color name="memory_downloads">#476093</color>
+    <color name="memory_video">#793A7F</color>
+    <color name="memory_audio">#8E562A</color>
+    <color name="memory_misc">#7C3030</color>
     
     <color name="crypt_keeper_clock_background">#ff9a9a9a</color>
     <color name="crypt_keeper_clock_foreground">#ff666666</color>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2c1164e..433c291 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -950,16 +950,20 @@
     <!-- Bluetooth settings. The user-visible string that is used whenever referring to the HID profile. -->
     <string name="bluetooth_profile_hid">Input Device</string>
     <!-- Bluetooth settings. The user-visible string that is used whenever referring to the PAN profile. [CHAR LIMIT=25]-->
-    <string name="bluetooth_profile_pan">Tethering</string>
+    <string name="bluetooth_profile_pan">Internet access</string>
 
-    <!-- Bluetooth settings.  Message for disconnecting from the A2DP profile. -->
+    <!-- Bluetooth settings.  Message for disconnecting from the A2DP profile. [CHAR LIMIT=80] -->
     <string name="bluetooth_disconnect_a2dp_profile"><xliff:g id="device_name">%1$s</xliff:g> will be disconnected from media audio.</string>
-    <!-- Bluetooth settings.  Message for disconnecting from the headset profile. -->
+    <!-- Bluetooth settings.  Message for disconnecting from the headset profile. [CHAR LIMIT=80] -->
     <string name="bluetooth_disconnect_headset_profile"><xliff:g id="device_name">%1$s</xliff:g> will be disconnected from handsfree audio.</string>
-    <!-- Bluetooth settings.  Message for disconnecting from the HID profile. -->
+    <!-- Bluetooth settings.  Message for disconnecting from the HID profile. [CHAR LIMIT=80] -->
     <string name="bluetooth_disconnect_hid_profile"><xliff:g id="device_name">%1$s</xliff:g> will be disconnected from input device.</string>
-    <!-- Bluetooth settings.  Message for disconnecting from the PAN profile. -->
-    <string name="bluetooth_disconnect_pan_profile"><xliff:g id="device_name">%1$s</xliff:g> will be disconnected from tethering.</string>
+    <!-- Bluetooth settings.  Message for disconnecting from the PAN profile (user role). [CHAR LIMIT=80] -->
+    <string name="bluetooth_disconnect_pan_user_profile">Internet access via <xliff:g id="device_name">%1$s</xliff:g> will be disconnected.</string>
+    <!-- Bluetooth settings.  Message for disconnecting from the PAN profile (NAP role). [CHAR LIMIT=80] -->
+    <string name="bluetooth_disconnect_pan_nap_profile" product="tablet"><xliff:g id="device_name">%1$s</xliff:g> will be disconnected from sharing this tablet\'s Internet connection.</string>
+    <!-- Bluetooth settings.  Message for disconnecting from the PAN profile (NAP role). [CHAR LIMIT=80] -->
+    <string name="bluetooth_disconnect_pan_nap_profile" product="default"><xliff:g id="device_name">%1$s</xliff:g> will be disconnected from sharing this phone\'s Internet connection.</string>
 
     <!-- Bluetooth settings.  Connection options screen.  The title of the screen. -->
     <string name="bluetooth_device_advanced_title"><xliff:g id="device_name">%1$s</xliff:g> options</string>
@@ -985,8 +989,10 @@
     <string name="bluetooth_opp_profile_summary_not_connected">Not connected to file transfer server</string>
     <!-- Bluetooth settings. Connection options screen. The summary for the HID checkbox preference when HID is connected. -->
     <string name="bluetooth_hid_profile_summary_connected">Connected to input device</string>
-    <!-- Bluetooth settings. Connection options screen. The summary for the PAN checkbox preference when PAN is connected. [CHAR LIMIT=25]-->
-    <string name="bluetooth_pan_profile_summary_connected">Tethered</string>
+    <!-- Bluetooth settings. Connection options screen. The summary for the checkbox preference when PAN is connected (user role). [CHAR LIMIT=25]-->
+    <string name="bluetooth_pan_user_profile_summary_connected">Connected to device for Internet access</string>
+    <!-- Bluetooth settings. Connection options screen. The summary for the checkbox preference when PAN is connected (NAP role). [CHAR LIMIT=25]-->
+    <string name="bluetooth_pan_nap_profile_summary_connected">Sharing local Internet connection with device</string>
 
     <!-- Bluetooth settings.  Connection options screen.  The summary for the A2DP checkbox preference that describes how checking it will set the A2DP profile as preferred. -->
     <string name="bluetooth_a2dp_profile_summary_use_for">Use for media audio</string>
@@ -1050,6 +1056,8 @@
     <string name="wifi_setting_sleep_policy_title">Wi-Fi disconnect policy</string>
     <!-- Setting summary for setting the wifi sleep policy -->
     <string name="wifi_setting_sleep_policy_summary">Specify when to switch from Wi-Fi to mobile data</string>
+    <!-- Setting summary for setting the wifi sleep policy for wifi-only devices [CHAR LIMIT=100] -->
+    <string name="wifi_setting_sleep_policy_summary_wifi_only">Specify when to disconnect from Wi-Fi</string>
     <!-- Generic error message when the sleep policy could not be set. -->
     <string name="wifi_setting_sleep_policy_error">There was a problem changing the setting</string>
     <!-- Action message to manually add a wifi network -->
@@ -1867,11 +1875,21 @@
     <!-- Label for bluetooth tether checkbox [CHAR LIMIT=25]-->
     <string name="bluetooth_tether_checkbox_text">Bluetooth tethering</string>
     <!-- Bluetooth available subtext - shown when Bluetooth tethering is turned on but it is not currently tethered to any devices [CHAR LIMIT=50]-->
-    <string name="bluetooth_tethering_available_subtext">Bluetooth tethering on, but not connected</string>
-    <!-- Bluetooth connected subtext - shown when a device is tethered over Bluetooth [CHAR LIMIT=50]-->
-    <string name="bluetooth_tethering_connected_subtext">Bluetooth tethering on and connected</string>
+    <string name="bluetooth_tethering_available_subtext" product="tablet">Sharing this tablet\'s Internet connection</string>
+    <!-- Bluetooth available subtext - shown when Bluetooth tethering is turned on but it is not currently tethered to any devices [CHAR LIMIT=50]-->
+    <string name="bluetooth_tethering_available_subtext" product="default">Sharing this phone\'s Internet connection</string>
+    <!-- Bluetooth connected subtext - shown when a device is tethered over Bluetooth [CHAR LIMIT=60]-->
+    <string name="bluetooth_tethering_device_connected_subtext" product="tablet">Sharing this tablet\'s Internet connection to 1 device</string>
+    <!-- Bluetooth connected subtext - shown when a device is tethered over Bluetooth [CHAR LIMIT=60]-->
+    <string name="bluetooth_tethering_device_connected_subtext" product="default">Sharing this phone\'s Internet connection to 1 device</string>
+    <!-- Bluetooth connected subtext - shown when multiple devices are tethered over Bluetooth [CHAR LIMIT=60]-->
+    <string name="bluetooth_tethering_devices_connected_subtext" product="tablet">Sharing this tablet\'s Internet connection to <xliff:g id="connectedDeviceCount">%1$d</xliff:g> devices</string>
+    <!-- Bluetooth connected subtext - shown when multiple devices are tethered over Bluetooth [CHAR LIMIT=60]-->
+    <string name="bluetooth_tethering_devices_connected_subtext" product="default">Sharing this phone\'s Internet connection to <xliff:g id="connectedDeviceCount">%1$d</xliff:g> devices</string>
     <!-- Bluetooth tethering off subtext - shown when Bluetooth Tethering is turned off [CHAR LIMIT=50]-->
-    <string name="bluetooth_tethering_off_subtext">Bluetooth tethering off</string>
+    <string name="bluetooth_tethering_off_subtext" product="tablet">Not sharing this tablet\'s Internet connection</string>
+    <!-- Bluetooth tethering off subtext - shown when Bluetooth Tethering is turned off [CHAR LIMIT=50]-->
+    <string name="bluetooth_tethering_off_subtext" product="default">Not sharing this phone\'s Internet connection</string>
     <!-- Bluetooth errored subtext - shown when Bluetooth is broken for some reason [CHAR LIMIT=50]-->
     <string name="bluetooth_tethering_errored_subtext">Bluetooth tethering error</string>
     <!-- Bluetooth Tethering settings. Error message shown when trying to connect an 8th device [CHAR LIMIT=50]-->
diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java
index 16c465b..3f4a4f3 100644
--- a/src/com/android/settings/ConfirmLockPassword.java
+++ b/src/com/android/settings/ConfirmLockPassword.java
@@ -108,7 +108,7 @@
 
             int currentType = mPasswordEntry.getInputType();
             mPasswordEntry.setInputType(isAlpha ? currentType
-                    : (currentType | InputType.TYPE_CLASS_NUMBER));
+                    : (InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD));
 
             // Update the breadcrumb (title) if this is embedded in a PreferenceActivity
             if (activity instanceof PreferenceActivity) {
@@ -138,10 +138,10 @@
         private void handleNext() {
             final String pin = mPasswordEntry.getText().toString();
             if (mLockPatternUtils.checkPassword(pin)) {
-                
+
                 Intent intent = new Intent();
                 intent.putExtra("password", pin);
-                
+
                 getActivity().setResult(RESULT_OK, intent);
                 getActivity().finish();
             } else {
diff --git a/src/com/android/settings/DateTimeSettingsSetupWizard.java b/src/com/android/settings/DateTimeSettingsSetupWizard.java
index ec9c2af..dffbab3 100644
--- a/src/com/android/settings/DateTimeSettingsSetupWizard.java
+++ b/src/com/android/settings/DateTimeSettingsSetupWizard.java
@@ -27,7 +27,6 @@
 import android.os.Bundle;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
-import android.text.format.DateFormat;
 import android.util.Log;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -41,6 +40,7 @@
 import android.widget.DatePicker;
 import android.widget.ListPopupWindow;
 import android.widget.SimpleAdapter;
+import android.widget.TextView;
 import android.widget.TimePicker;
 
 import java.util.Calendar;
@@ -119,8 +119,9 @@
 
         mAutoDateTimeButton = (CompoundButton)findViewById(R.id.date_time_auto_button);
         mAutoDateTimeButton.setChecked(autoDateTimeEnabled);
-        mAutoDateTimeButton.setText(autoDateTimeEnabled ? R.string.date_time_auto_summaryOn :
-                R.string.date_time_auto_summaryOff);
+        ((TextView)findViewById(R.id.date_time_auto_text))
+                .setText(autoDateTimeEnabled ? R.string.date_time_auto_summaryOn :
+                        R.string.date_time_auto_summaryOff);
         mAutoDateTimeButton.setOnCheckedChangeListener(this);
 
         mTimePicker = (TimePicker)findViewById(R.id.time_picker);
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index 39f0535..1513d43 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -95,6 +95,8 @@
     private WifiManager mWifiManager;
     private WifiConfiguration mWifiConfig = null;
 
+    private boolean mBluetoothEnableForTether;
+
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
@@ -239,7 +241,8 @@
     private class TetherChangeReceiver extends BroadcastReceiver {
         @Override
         public void onReceive(Context content, Intent intent) {
-            if (intent.getAction().equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) {
+            String action = intent.getAction();
+            if (action.equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) {
                 // TODO - this should understand the interface types
                 ArrayList<String> available = intent.getStringArrayListExtra(
                         ConnectivityManager.EXTRA_AVAILABLE_TETHER);
@@ -250,10 +253,27 @@
                 updateState(available.toArray(new String[available.size()]),
                         active.toArray(new String[active.size()]),
                         errored.toArray(new String[errored.size()]));
-            } else if (intent.getAction().equals(Intent.ACTION_MEDIA_SHARED) ||
-                       intent.getAction().equals(Intent.ACTION_MEDIA_UNSHARED)) {
+            } else if (action.equals(Intent.ACTION_MEDIA_SHARED) ||
+                       action.equals(Intent.ACTION_MEDIA_UNSHARED)) {
                 updateState();
-            } else if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+            } else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+                if (mBluetoothEnableForTether) {
+                    switch (intent
+                            .getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR)) {
+                        case BluetoothAdapter.STATE_ON:
+                            mBluetoothPan.setBluetoothTethering(true);
+                            mBluetoothEnableForTether = false;
+                            break;
+
+                        case BluetoothAdapter.STATE_OFF:
+                        case BluetoothAdapter.ERROR:
+                            mBluetoothEnableForTether = false;
+                            break;
+
+                        default:
+                            // ignore transition states
+                    }
+                }
                 updateState();
             }
         }
@@ -281,6 +301,8 @@
 
         if (intent != null) mTetherChangeReceiver.onReceive(activity, intent);
         mWifiApEnabler.resume();
+
+        updateState();
     }
 
     @Override
@@ -368,22 +390,10 @@
 
     private void updateBluetoothState(String[] available, String[] tethered,
             String[] errored) {
-        ConnectivityManager cm =
-                (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
-        int bluetoothError = ConnectivityManager.TETHER_ERROR_NO_ERROR;
-        for (String s : available) {
-            for (String regex : mBluetoothRegexs) {
-                if (s.matches(regex)) {
-                    if (bluetoothError == ConnectivityManager.TETHER_ERROR_NO_ERROR) {
-                        bluetoothError = cm.getLastTetherError(s);
-                    }
-                }
-            }
-        }
-        boolean bluetoothTethered = false;
+        int bluetoothTethered = 0;
         for (String s : tethered) {
             for (String regex : mBluetoothRegexs) {
-                if (s.matches(regex)) bluetoothTethered = true;
+                if (s.matches(regex)) bluetoothTethered++;
             }
         }
         boolean bluetoothErrored = false;
@@ -401,17 +411,19 @@
         } else if (btState == BluetoothAdapter.STATE_TURNING_ON) {
             mBluetoothTether.setEnabled(false);
             mBluetoothTether.setSummary(R.string.bluetooth_turning_on);
-        } else if (mBluetoothPan.isTetheringOn()) {
+        } else if (btState == BluetoothAdapter.STATE_ON && mBluetoothPan.isTetheringOn()) {
             mBluetoothTether.setChecked(true);
-            if (btState == BluetoothAdapter.STATE_ON) {
-                mBluetoothTether.setEnabled(true);
-                if (bluetoothTethered) {
-                    mBluetoothTether.setSummary(R.string.bluetooth_tethering_connected_subtext);
-                } else if (bluetoothErrored) {
-                    mBluetoothTether.setSummary(R.string.bluetooth_tethering_errored_subtext);
-                } else {
-                    mBluetoothTether.setSummary(R.string.bluetooth_tethering_available_subtext);
-                }
+            mBluetoothTether.setEnabled(true);
+            if (bluetoothTethered > 1) {
+                String summary = getString(
+                        R.string.bluetooth_tethering_devices_connected_subtext, bluetoothTethered);
+                mBluetoothTether.setSummary(summary);
+            } else if (bluetoothTethered == 1) {
+                mBluetoothTether.setSummary(R.string.bluetooth_tethering_device_connected_subtext);
+            } else if (bluetoothErrored) {
+                mBluetoothTether.setSummary(R.string.bluetooth_tethering_errored_subtext);
+            } else {
+                mBluetoothTether.setSummary(R.string.bluetooth_tethering_available_subtext);
             }
         } else {
             mBluetoothTether.setEnabled(true);
@@ -456,20 +468,21 @@
                 }
                 mUsbTether.setSummary("");
             }
-        } else if(preference == mBluetoothTether) {
+        } else if (preference == mBluetoothTether) {
             boolean bluetoothTetherState = mBluetoothTether.isChecked();
 
             if (bluetoothTetherState) {
                 // turn on Bluetooth first
                 BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
                 if (adapter.getState() == BluetoothAdapter.STATE_OFF) {
+                    mBluetoothEnableForTether = true;
                     adapter.enable();
                     mBluetoothTether.setSummary(R.string.bluetooth_turning_on);
                     mBluetoothTether.setEnabled(false);
+                } else {
+                    mBluetoothPan.setBluetoothTethering(true);
+                    mBluetoothTether.setSummary(R.string.bluetooth_tethering_available_subtext);
                 }
-
-                mBluetoothPan.setBluetoothTethering(true);
-                mBluetoothTether.setSummary(R.string.bluetooth_tethering_available_subtext);
             } else {
                 boolean errored = false;
 
diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java
index e56db74..11e4aae 100644
--- a/src/com/android/settings/applications/ApplicationsState.java
+++ b/src/com/android/settings/applications/ApplicationsState.java
@@ -248,8 +248,7 @@
              } else if (Intent.ACTION_PACKAGE_CHANGED.equals(actionStr)) {
                  Uri data = intent.getData();
                  String pkgName = data.getEncodedSchemeSpecificPart();
-                 removePackage(pkgName);
-                 addPackage(pkgName);
+                 invalidatePackage(pkgName);
              } else if (Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(actionStr) ||
                      Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(actionStr)) {
                  // When applications become available or unavailable (perhaps because
@@ -266,8 +265,7 @@
                  boolean avail = Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(actionStr);
                  if (avail) {
                      for (String pkgName : pkgList) {
-                         removePackage(pkgName);
-                         addPackage(pkgName);
+                         invalidatePackage(pkgName);
                      }
                  }
              }
@@ -624,6 +622,11 @@
         }
     }
 
+    void invalidatePackage(String pkgName) {
+        removePackage(pkgName);
+        addPackage(pkgName);
+    }
+    
     AppEntry getEntryLocked(ApplicationInfo info) {
         AppEntry entry = mEntriesMap.get(info.packageName);
         if (DEBUG) Log.i(TAG, "Looking up entry of pkg " + info.packageName + ": " + entry);
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index aafd3a1..ae27d00 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -452,7 +452,7 @@
         if(localLOGV) Log.i(TAG, "Have "+prefActList.size()+" number of activities in prefered list");
         boolean hasUsbDefaults = false;
         try {
-            hasUsbDefaults = mUsbManager.hasDefaults(packageName, mAppEntry.info.uid);
+            hasUsbDefaults = mUsbManager.hasDefaults(packageName);
         } catch (RemoteException e) {
             Log.e(TAG, "mUsbManager.hasDefaults", e);
         }
@@ -736,6 +736,11 @@
         ActivityManager am = (ActivityManager)getActivity().getSystemService(
                 Context.ACTIVITY_SERVICE);
         am.forceStopPackage(pkgName);
+        mState.invalidatePackage(pkgName);
+        ApplicationsState.AppEntry newEnt = mState.getEntry(pkgName);
+        if (newEnt != null) {
+            mAppEntry = newEnt;
+        }
         checkForceStop();
     }
 
@@ -807,7 +812,7 @@
         } else if(v == mActivitiesButton) {
             mPm.clearPackagePreferredActivities(packageName);
             try {
-                mUsbManager.clearDefaults(packageName, mAppEntry.info.uid);
+                mUsbManager.clearDefaults(packageName);
             } catch (RemoteException e) {
                 Log.e(TAG, "mUsbManager.clearDefaults", e);
             }
diff --git a/src/com/android/settings/bluetooth/A2dpProfile.java b/src/com/android/settings/bluetooth/A2dpProfile.java
index 96225d8..e8582f3 100644
--- a/src/com/android/settings/bluetooth/A2dpProfile.java
+++ b/src/com/android/settings/bluetooth/A2dpProfile.java
@@ -142,7 +142,7 @@
         return R.string.bluetooth_profile_a2dp;
     }
 
-    public int getDisconnectResource() {
+    public int getDisconnectResource(BluetoothDevice device) {
         return R.string.bluetooth_disconnect_a2dp_profile;
     }
 
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index 56e96b4..71a5c01 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -51,6 +51,13 @@
     private final List<LocalBluetoothProfile> mProfiles =
             new ArrayList<LocalBluetoothProfile>();
 
+    // List of profiles that were previously in mProfiles, but have been removed
+    private final List<LocalBluetoothProfile> mRemovedProfiles =
+            new ArrayList<LocalBluetoothProfile>();
+
+    // Device supports PANU but not NAP: remove PanProfile after device disconnects from NAP
+    private boolean mLocalNapRoleConnected;
+
     private boolean mVisible;
 
     private final Collection<Callback> mCallbacks = new ArrayList<Callback>();
@@ -100,8 +107,21 @@
         mProfileConnectionState.put(profile, newProfileState);
         if (newProfileState == BluetoothProfile.STATE_CONNECTED) {
             if (!mProfiles.contains(profile)) {
+                mRemovedProfiles.remove(profile);
                 mProfiles.add(profile);
+                if (profile instanceof PanProfile &&
+                        ((PanProfile) profile).isLocalRoleNap(mDevice)) {
+                    // Device doesn't support NAP, so remove PanProfile on disconnect
+                    mLocalNapRoleConnected = true;
+                }
             }
+        } else if (mLocalNapRoleConnected && profile instanceof PanProfile &&
+                ((PanProfile) profile).isLocalRoleNap(mDevice) &&
+                newProfileState == BluetoothProfile.STATE_DISCONNECTED) {
+            Log.d(TAG, "Removing PanProfile from device after NAP disconnect");
+            mProfiles.remove(profile);
+            mRemovedProfiles.add(profile);
+            mLocalNapRoleConnected = false;
         }
     }
 
@@ -391,7 +411,7 @@
         ParcelUuid[] localUuids = mLocalAdapter.getUuids();
         if (localUuids == null) return false;
 
-        mProfileManager.updateProfiles(uuids, localUuids, mProfiles);
+        mProfileManager.updateProfiles(uuids, localUuids, mProfiles, mRemovedProfiles);
 
         if (DEBUG) {
             Log.e(TAG, "updating profiles for " + mDevice.getName());
@@ -482,6 +502,10 @@
         return connectableProfiles;
     }
 
+    List<LocalBluetoothProfile> getRemovedProfiles() {
+        return mRemovedProfiles;
+    }
+
     void registerCallback(Callback callback) {
         synchronized (mCallbacks) {
             mCallbacks.add(callback);
diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
index 307125c..9db4baf 100644
--- a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
+++ b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
@@ -239,7 +239,7 @@
         if (TextUtils.isEmpty(name)) {
             name = context.getString(R.string.bluetooth_device);
         }
-        int disconnectMessage = profile.getDisconnectResource();
+        int disconnectMessage = profile.getDisconnectResource(device.getDevice());
         if (disconnectMessage == 0) {
             Log.w(TAG, "askDisconnect: unexpected profile " + profile);
             disconnectMessage = R.string.bluetooth_disconnect_blank;
@@ -288,6 +288,13 @@
                 refreshProfilePreference(profilePref, profile);
             }
         }
+        for (LocalBluetoothProfile profile : mCachedDevice.getRemovedProfiles()) {
+            Preference profilePref = findPreference(profile.toString());
+            if (profilePref != null) {
+                Log.d(TAG, "Removing " + profile.toString() + " from profile list");
+                mProfileContainer.removePreference(profilePref);
+            }
+        }
     }
 
     private void refreshProfilePreference(Preference profilePref, LocalBluetoothProfile profile) {
diff --git a/src/com/android/settings/bluetooth/HeadsetProfile.java b/src/com/android/settings/bluetooth/HeadsetProfile.java
index dac47b7..13dce33 100644
--- a/src/com/android/settings/bluetooth/HeadsetProfile.java
+++ b/src/com/android/settings/bluetooth/HeadsetProfile.java
@@ -22,13 +22,11 @@
 import android.bluetooth.BluetoothProfile;
 import android.bluetooth.BluetoothUuid;
 import android.content.Context;
-import android.os.Handler;
 import android.os.ParcelUuid;
 import android.util.Log;
 
 import com.android.settings.R;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -133,6 +131,8 @@
     }
 
     public int getConnectionStatus(BluetoothDevice device) {
+        if (mService == null) return BluetoothProfile.STATE_DISCONNECTED;
+
         List<BluetoothDevice> deviceList = mService.getConnectedDevices();
 
         return !deviceList.isEmpty() && deviceList.get(0).equals(device)
@@ -174,7 +174,7 @@
         return R.string.bluetooth_profile_headset;
     }
 
-    public int getDisconnectResource() {
+    public int getDisconnectResource(BluetoothDevice device) {
         return R.string.bluetooth_disconnect_headset_profile;
     }
 
diff --git a/src/com/android/settings/bluetooth/HidProfile.java b/src/com/android/settings/bluetooth/HidProfile.java
index 9185059..13d3db9 100644
--- a/src/com/android/settings/bluetooth/HidProfile.java
+++ b/src/com/android/settings/bluetooth/HidProfile.java
@@ -116,7 +116,7 @@
         return R.string.bluetooth_profile_hid;
     }
 
-    public int getDisconnectResource() {
+    public int getDisconnectResource(BluetoothDevice device) {
         return R.string.bluetooth_disconnect_hid_profile;
     }
 
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothProfile.java b/src/com/android/settings/bluetooth/LocalBluetoothProfile.java
index 936231a..878a032 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothProfile.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothProfile.java
@@ -60,8 +60,9 @@
     /**
      * Returns the string resource ID for the disconnect confirmation text
      * for this profile.
+     * @param device
      */
-    int getDisconnectResource();
+    int getDisconnectResource(BluetoothDevice device);
 
     /**
      * Returns the string resource ID for the summary text for this profile
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
index ee3cb66..f3143f0 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
@@ -110,7 +110,9 @@
                 BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED);
 
         mPanProfile = new PanProfile(context);
-        addProfile(mPanProfile, PanProfile.NAME, BluetoothPan.ACTION_CONNECTION_STATE_CHANGED);
+        addPanProfile(mPanProfile, PanProfile.NAME,
+                BluetoothPan.ACTION_CONNECTION_STATE_CHANGED);
+
         Log.d(TAG, "LocalBluetoothProfileManager construction complete");
     }
 
@@ -173,6 +175,13 @@
         mProfileNameMap.put(profileName, profile);
     }
 
+    private void addPanProfile(LocalBluetoothProfile profile,
+            String profileName, String stateChangedAction) {
+        mEventManager.addProfileHandler(stateChangedAction,
+                new PanStateChangedHandler(profile));
+        mProfileNameMap.put(profileName, profile);
+    }
+
     LocalBluetoothProfile getProfileByName(String name) {
         return mProfileNameMap.get(name);
     }
@@ -190,7 +199,7 @@
      * Generic handler for connection state change events for the specified profile.
      */
     private class StateChangedHandler implements BluetoothEventManager.Handler {
-        private final LocalBluetoothProfile mProfile;
+        final LocalBluetoothProfile mProfile;
 
         StateChangedHandler(LocalBluetoothProfile profile) {
             mProfile = profile;
@@ -215,6 +224,22 @@
         }
     }
 
+    /** State change handler for NAP and PANU profiles. */
+    private class PanStateChangedHandler extends StateChangedHandler {
+
+        PanStateChangedHandler(LocalBluetoothProfile profile) {
+            super(profile);
+        }
+
+        @Override
+        public void onReceive(Context context, Intent intent, BluetoothDevice device) {
+            PanProfile panProfile = (PanProfile) mProfile;
+            int role = intent.getIntExtra(BluetoothPan.EXTRA_LOCAL_ROLE, 0);
+            panProfile.setLocalRole(device, role);
+            super.onReceive(context, intent, device);
+        }
+    }
+
     // called from DockService
     void addServiceListener(ServiceListener l) {
         mServiceListeners.add(l);
@@ -269,9 +294,14 @@
      * @param uuids of the remote device
      * @param localUuids UUIDs of the local device
      * @param profiles The list of profiles to fill
+     * @param removedProfiles list of profiles that were removed
      */
     synchronized void updateProfiles(ParcelUuid[] uuids, ParcelUuid[] localUuids,
-        Collection<LocalBluetoothProfile> profiles) {
+            Collection<LocalBluetoothProfile> profiles,
+            Collection<LocalBluetoothProfile> removedProfiles) {
+        // Copy previous profile list into removedProfiles
+        removedProfiles.clear();
+        removedProfiles.addAll(profiles);
         profiles.clear();
 
         if (uuids == null) {
@@ -280,31 +310,36 @@
 
         if (mHeadsetProfile != null) {
             if ((BluetoothUuid.isUuidPresent(localUuids, BluetoothUuid.HSP_AG) &&
-                BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.HSP)) ||
-                (BluetoothUuid.isUuidPresent(localUuids, BluetoothUuid.Handsfree_AG) &&
-                BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.Handsfree))) {
-                    profiles.add(mHeadsetProfile);
+                    BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.HSP)) ||
+                    (BluetoothUuid.isUuidPresent(localUuids, BluetoothUuid.Handsfree_AG) &&
+                            BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.Handsfree))) {
+                profiles.add(mHeadsetProfile);
+                removedProfiles.remove(mHeadsetProfile);
             }
         }
 
         if (BluetoothUuid.containsAnyUuid(uuids, A2dpProfile.SINK_UUIDS) &&
             mA2dpProfile != null) {
             profiles.add(mA2dpProfile);
+            removedProfiles.remove(mA2dpProfile);
         }
 
         if (BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.ObexObjectPush) &&
             mOppProfile != null) {
             profiles.add(mOppProfile);
+            removedProfiles.remove(mOppProfile);
         }
 
         if (BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.Hid) &&
             mHidProfile != null) {
             profiles.add(mHidProfile);
+            removedProfiles.remove(mHidProfile);
         }
 
         if (BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.NAP) &&
             mPanProfile != null) {
             profiles.add(mPanProfile);
+            removedProfiles.remove(mPanProfile);
         }
     }
 }
diff --git a/src/com/android/settings/bluetooth/OppProfile.java b/src/com/android/settings/bluetooth/OppProfile.java
index 3f7df38..eb5900e 100644
--- a/src/com/android/settings/bluetooth/OppProfile.java
+++ b/src/com/android/settings/bluetooth/OppProfile.java
@@ -79,7 +79,7 @@
         return R.string.bluetooth_profile_opp;
     }
 
-    public int getDisconnectResource() {
+    public int getDisconnectResource(BluetoothDevice device) {
         return 0; // user must use notification to disconnect OPP transfer.
     }
 
diff --git a/src/com/android/settings/bluetooth/PanProfile.java b/src/com/android/settings/bluetooth/PanProfile.java
index 3f456e4..6cb1991 100644
--- a/src/com/android/settings/bluetooth/PanProfile.java
+++ b/src/com/android/settings/bluetooth/PanProfile.java
@@ -25,14 +25,19 @@
 
 import com.android.settings.R;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
- * PanProfile handles Bluetooth PAN profile.
+ * PanProfile handles Bluetooth PAN profile (NAP and PANU).
  */
 final class PanProfile implements LocalBluetoothProfile {
     private BluetoothPan mService;
 
+    // Tethering direction for each device
+    private final HashMap<BluetoothDevice, Integer> mDeviceRoleMap =
+            new HashMap<BluetoothDevice, Integer>();
+
     static final String NAME = "PAN";
 
     // Order of this profile in device profiles list
@@ -111,8 +116,12 @@
         return R.string.bluetooth_profile_pan;
     }
 
-    public int getDisconnectResource() {
-        return R.string.bluetooth_disconnect_pan_profile;
+    public int getDisconnectResource(BluetoothDevice device) {
+        if (isLocalRoleNap(device)) {
+            return R.string.bluetooth_disconnect_pan_nap_profile;
+        } else {
+            return R.string.bluetooth_disconnect_pan_user_profile;
+        }
     }
 
     public int getSummaryResourceForDevice(BluetoothDevice device) {
@@ -122,7 +131,11 @@
                 return R.string.bluetooth_pan_profile_summary_use_for;
 
             case BluetoothProfile.STATE_CONNECTED:
-                return R.string.bluetooth_pan_profile_summary_connected;
+                if (isLocalRoleNap(device)) {
+                    return R.string.bluetooth_pan_nap_profile_summary_connected;
+                } else {
+                    return R.string.bluetooth_pan_user_profile_summary_connected;
+                }
 
             default:
                 return Utils.getConnectionStateSummary(state);
@@ -132,4 +145,17 @@
     public int getDrawableResource(BluetoothClass btClass) {
         return R.drawable.ic_bt_network_pan;
     }
+
+    // Tethering direction determines UI strings.
+    void setLocalRole(BluetoothDevice device, int role) {
+        mDeviceRoleMap.put(device, role);
+    }
+
+    boolean isLocalRoleNap(BluetoothDevice device) {
+        if (mDeviceRoleMap.containsKey(device)) {
+            return mDeviceRoleMap.get(device) == BluetoothPan.LOCAL_NAP_ROLE;
+        } else {
+            return false;
+        }
+    }
 }
diff --git a/src/com/android/settings/vpn/VpnSettings.java b/src/com/android/settings/vpn/VpnSettings.java
index e62a5ee..5d75b6a 100644
--- a/src/com/android/settings/vpn/VpnSettings.java
+++ b/src/com/android/settings/vpn/VpnSettings.java
@@ -221,7 +221,14 @@
         }
 
         if (!mConnectDialogShowing) {
-            checkVpnConnectionStatus();
+            // If mActiveProfile is not null but it's in IDLE state, then a
+            // retry dialog must be showing now as the previous connection
+            // attempt failed. In this case, don't call checkVpnConnectionStatus()
+            // as it will clean up mActiveProfile due to the IDLE state.
+            if ((mActiveProfile == null)
+                    || (mActiveProfile.getState() != VpnState.IDLE)) {
+                checkVpnConnectionStatus();
+            }
         } else {
             // Dismiss the connect dialog in case there is another instance
             // trying to operate a vpn connection.
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 67218e8..7e07162 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -218,6 +218,7 @@
             if (pref != null) {
                 if (Utils.isWifiOnly()) {
                     pref.setEntries(R.array.wifi_sleep_policy_entries_wifi_only);
+                    pref.setSummary(R.string.wifi_setting_sleep_policy_summary_wifi_only);
                 }
                 pref.setOnPreferenceChangeListener(this);
                 int value = Settings.System.getInt(getContentResolver(),
diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
index ca7be1b..c9bc758 100644
--- a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
+++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
@@ -272,18 +272,16 @@
 
         switch (state) {
         case SCANNING: {
-            // Let users know the device is working correctly though currently there's
-            // no visible network on the list.
-            if (mWifiSettings.getAccessPointsCount() == 0) {
-                showScanningState();
-            } else {
-                // Users already see available networks.
-                showDisconnectedProgressBar();
-                if (mScreenState == SCREEN_STATE_DISCONNECTED &&
-                        mWifiSettings.getAccessPointsCount() > 0) {
+            if (mScreenState == SCREEN_STATE_DISCONNECTED) {
+                if (mWifiSettings.getAccessPointsCount() == 0) {
+                    showScanningState();                    
+                } else {
+                    showDisconnectedProgressBar();
                     mWifiSettingsFragmentLayout.setVisibility(View.VISIBLE);
                     mBottomPadding.setVisibility(View.GONE);
                 }
+            } else {
+                showDisconnectedProgressBar();
             }
             break;
         }
@@ -462,6 +460,7 @@
             showAddNetworkTitle();
             mConnectButton.setVisibility(View.VISIBLE);
 
+            showDisconnectedProgressBar();
             showEditingButtonState();
         } else if (selectedAccessPoint.security == AccessPoint.SECURITY_NONE) {
             mNetworkName = selectedAccessPoint.getTitle().toString();
@@ -471,6 +470,7 @@
         } else {
             mNetworkName = selectedAccessPoint.getTitle().toString();
             showEditingTitle();
+            showDisconnectedProgressBar();
             showEditingButtonState();
             if (selectedAccessPoint.security == AccessPoint.SECURITY_EAP) {
                 onEapNetworkSelected();