Merge "Re-enable wifi proxy UI"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9e252cf..86903ed 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -4,8 +4,6 @@
 
     <original-package android:name="com.android.settings" />
 
-    <uses-permission android:name="com.google.android.gm.permission.WRITE_GMAIL" />
-    <uses-permission android:name="com.google.android.gm.permission.READ_GMAIL" />
     <uses-permission android:name="android.permission.WRITE_SETTINGS" />
     <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
     <uses-permission android:name="android.permission.DEVICE_POWER" />
@@ -138,6 +136,7 @@
                   android:theme="@android:style/Theme.Holo.NoActionBar"
                   android:windowBackground="@drawable/setups_bg_default"
                   android:clearTaskOnLaunch="true"
+                  android:screenOrientation="sensorLandscape"
                   android:exported="true" />
 
         <activity-alias android:name=".wifi.AdvancedSettings"
diff --git a/res/drawable-hdpi/ic_settings_accessibility.png b/res/drawable-hdpi/ic_settings_accessibility.png
index 8390084..849c19c 100755
--- a/res/drawable-hdpi/ic_settings_accessibility.png
+++ b/res/drawable-hdpi/ic_settings_accessibility.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_sound.png b/res/drawable-hdpi/ic_settings_sound.png
index ba7c674..42354cd 100755
--- a/res/drawable-hdpi/ic_settings_sound.png
+++ b/res/drawable-hdpi/ic_settings_sound.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_wireless.png b/res/drawable-hdpi/ic_settings_wireless.png
index 6161a38..20ceb20 100755
--- a/res/drawable-hdpi/ic_settings_wireless.png
+++ b/res/drawable-hdpi/ic_settings_wireless.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_accessibility.png b/res/drawable-mdpi/ic_settings_accessibility.png
index 71663ee..ba86d3d 100755
--- a/res/drawable-mdpi/ic_settings_accessibility.png
+++ b/res/drawable-mdpi/ic_settings_accessibility.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_sound.png b/res/drawable-mdpi/ic_settings_sound.png
index 9760e04..f647fea 100644
--- a/res/drawable-mdpi/ic_settings_sound.png
+++ b/res/drawable-mdpi/ic_settings_sound.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_wireless.png b/res/drawable-mdpi/ic_settings_wireless.png
index e998e06..f8acded 100755
--- a/res/drawable-mdpi/ic_settings_wireless.png
+++ b/res/drawable-mdpi/ic_settings_wireless.png
Binary files differ
diff --git a/res/layout-xlarge-land/crypt_keeper_password_entry.xml b/res/layout-xlarge-land/crypt_keeper_password_entry.xml
index f6cbecf..45a630a 100644
--- a/res/layout-xlarge-land/crypt_keeper_password_entry.xml
+++ b/res/layout-xlarge-land/crypt_keeper_password_entry.xml
@@ -45,7 +45,9 @@
         />
 
         <!-- Password entry field -->
-        <EditText android:id="@+id/passwordEntry"
+        <view
+            class="com.android.settings.CryptKeeper$CryptEditText"
+            android:id="@+id/passwordEntry"
             android:layout_height="wrap_content"
             android:layout_width="320dip"
             android:layout_toRightOf="@+id/passwordLabel"
diff --git a/res/layout-xlarge-land/date_time_settings_setupwizard.xml b/res/layout-xlarge-land/date_time_settings_setupwizard.xml
deleted file mode 100644
index ee425eb..0000000
--- a/res/layout-xlarge-land/date_time_settings_setupwizard.xml
+++ /dev/null
@@ -1,168 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
-  -->
-<RelativeLayout
-    android:id="@+id/layout_root"
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:paddingTop="154dip"
-    android:paddingLeft="128dip"
-    android:paddingRight="128dip"
-    android:paddingBottom="96dip">
-
-    <!-- Title: Set date & time-->
-    <TextView
-        android:id="@+id/title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:minHeight="48dip"
-        android:layout_alignParentLeft="true"
-        android:layout_marginLeft="16dip"
-        android:layout_alignParentTop="true"
-        android:textSize="32dip"
-        android:textColor="#FF99cc00"
-        android:text="@string/date_and_time_settings_title_setup_wizard"
-        android:gravity="bottom" />
-
-    <!-- Divider -->
-    <View
-        android:id="@+id/top_divider"
-        android:layout_width="match_parent"
-        android:layout_height="3dip"
-        android:layout_below="@id/title"
-        android:layout_marginTop="6dip"
-        android:layout_marginBottom="17dip"
-        android:background="@color/divider_color" />
-
-    <RelativeLayout
-        android:id="@+id/timezone_auto_time"
-        android:layout_width="716dip"
-        android:layout_height="wrap_content"
-        android:layout_centerHorizontal="true"
-        android:layout_below="@id/top_divider">
-        <!-- timezone -->
-        <Button
-            android:id="@+id/time_zone_button"
-            style="?android:attr/dropDownSpinnerStyle"
-            android:layout_width="304dip"
-            android:layout_height="48dip"
-            android:layout_alignParentLeft="true"
-            android:layout_alignBottom="@+id/date_time_auto"
-            android:gravity="left|center_vertical"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textSize="20dip" />
-
-        <LinearLayout
-            android:id="@+id/date_time_auto"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:layout_toRightOf="@id/time_zone_button"
-            android:layout_marginLeft="32dip"
-            android:layout_alignParentRight="true">
-
-            <Switch
-                android:id="@+id/date_time_auto_button"
-                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" />
-
-            <!-- Divider -->
-            <View
-                android:layout_width="match_parent"
-                android:layout_height="1px"
-                android:background="@color/divider_color" />
-        </LinearLayout>
-    </RelativeLayout>
-
-    <LinearLayout
-        android:layout_width="624dip"
-        android:layout_height="wrap_content"
-        android:layout_centerHorizontal="true"
-        android:layout_below="@+id/timezone_auto_time"
-        android:layout_marginTop="48dip"
-        android:orientation="horizontal">
-
-        <LinearLayout
-            android:layout_width="312dip"
-            android:layout_height="wrap_content"
-            android:orientation="vertical">
-            <TextView
-                android:id="@+id/date_picker_title"
-                android:layout_width="match_parent"
-                android:layout_height="48dip"
-                android:text="@string/date_picker_title"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="20dip"
-                android:clickable="false"
-                android:longClickable="false"
-                android:gravity="center" />
-            <DatePicker
-                android:id="@+id/date_picker"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/date_picker_title" />
-        </LinearLayout>
-
-        <!-- divider -->
-        <View
-            android:id="@+id/center_divider"
-            android:layout_width="1dip"
-            android:layout_height="match_parent"
-            android:background="@color/divider_color" />
-
-        <LinearLayout
-            android:layout_width="312dip"
-            android:layout_height="wrap_content"
-            android:orientation="vertical">
-            <TextView
-                android:id="@+id/time_picker_title"
-                android:layout_width="match_parent"
-                android:layout_height="48dip"
-                android:text="@string/time_picker_title"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="20dip"
-                android:gravity="center" />
-
-            <TimePicker
-                android:id="@+id/time_picker"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/time_picker_title" />
-        </LinearLayout>
-    </LinearLayout>
-
-    <View
-        android:id="@+id/bottom_divider"
-        android:layout_width="match_parent"
-        android:layout_height="3dip"
-        android:layout_alignLeft="@id/timezone_auto_time"
-        android:layout_above="@+id/next_button"
-        android:layout_marginBottom="16dip"
-        android:background="@color/divider_color" />
-
-    <Button
-        android:id="@+id/next_button"
-        style="@style/setup_wizard_button"
-        android:layout_alignParentBottom="true"
-        android:layout_alignParentRight="true"
-        android:text="@string/next_label" />
-</RelativeLayout>
diff --git a/res/layout-xlarge-land/wifi_settings_for_setup_wizard_xl.xml b/res/layout-xlarge-land/wifi_settings_for_setup_wizard_xl.xml
deleted file mode 100644
index 78f182d..0000000
--- a/res/layout-xlarge-land/wifi_settings_for_setup_wizard_xl.xml
+++ /dev/null
@@ -1,177 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
-  -->
-
-<RelativeLayout
-    android:id="@+id/layout_root"
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:paddingTop="60dip"
-    android:paddingLeft="128dip"
-    android:paddingRight="128dip"
-    android:paddingBottom="0dip" >
-
-    <FrameLayout
-        android:id="@+id/top_padding_layout"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true">
-        <!-- Set to gone when software keyboard appears -->
-        <View
-             android:id="@+id/top_padding"
-             android:layout_width="match_parent"
-             android:layout_height="94dip" />
-    </FrameLayout>
-
-    <TextView
-        android:id="@+id/wifi_setup_title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:minHeight="48dip"
-        android:layout_alignParentLeft="true"
-        android:layout_centerVertical="true"
-        android:layout_marginLeft="16dip"
-        android:layout_below="@id/top_padding_layout"
-        android:textSize="32dip"
-        android:textColor="#ff99cc00"
-        android:text="@string/wifi_setup_title"
-        android:gravity="bottom"/>
-
-    <!-- Divider -->
-    <RelativeLayout
-        android:id="@+id/top_divider"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/wifi_setup_title">
-        <ProgressBar
-            android:id="@+id/scanning_progress_bar"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            style="?android:attr/progressBarStyleHorizontal" />
-    </RelativeLayout>
-
-    <RelativeLayout
-        android:id="@+id/content"
-        android:layout_width="716dip"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/top_divider"
-        android:layout_centerHorizontal="true"
-        android:layout_marginTop="10dip"
-        android:layout_marginBottom="0dip">
-
-        <FrameLayout
-            android:id="@+id/wifi_setup"
-            android:layout_width="match_parent"
-            android:layout_height="360dip">
-            <fragment
-                class="com.android.settings.wifi.WifiSettings"
-                android:id="@+id/wifi_setup_fragment"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
-        </FrameLayout>
-        <FrameLayout
-            android:id="@+id/wifi_config_ui"
-            android:layout_width="wrap_content"
-            android:minWidth="406dip"
-            android:layout_height="wrap_content"
-            android:minHeight="160dip"
-            android:layout_alignParentLeft="true"
-            android:visibility="gone" />
-        <View
-            android:id="@+id/wifi_config_padding"
-            android:layout_width="match_parent"
-            android:layout_height="360dip"
-            android:visibility="gone" />
-        <LinearLayout
-            android:id="@+id/connecting_status_layout"
-            android:layout_width="match_parent"
-            android:layout_height="360dip"
-            android:visibility="gone">
-            <TextView
-                android:id="@+id/connecting_status"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:lineSpacingExtra="10dip"
-                android:inputType="textMultiLine"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textSize="20sp"
-                android:clickable="false"
-                android:longClickable="false" />
-        </LinearLayout>
-
-    </RelativeLayout>
-
-    <!-- Divider -->
-    <View
-        android:id="@+id/bottom_divider"
-        android:layout_width="match_parent"
-        android:layout_height="3dip"
-        android:layout_marginBottom="16dip"
-        android:layout_below="@id/content"
-        android:layout_alignLeft="@id/content"
-        android:background="@color/divider_color" />  <!-- TODO: fix this -->
-
-    <RelativeLayout
-        android:id="@+id/bottom_buttons"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/bottom_divider"
-        android:layout_alignLeft="@id/bottom_divider"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentBottom="true">
-
-        <Button
-            android:id="@+id/wifi_setup_add_network"
-            style="@style/setup_wizard_button"
-            android:layout_alignParentLeft="true"
-            android:text="@string/wifi_setup_add_network"
-            android:enabled="false" />
-
-        <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentRight="true"
-            android:orientation="horizontal">
-
-            <!-- This misleading name is for keeping consistency between non-XL
-                 layouts -->
-            <Button android:id="@+id/wifi_setup_cancel"
-                    style="@style/setup_wizard_button"
-                    android:text="@string/wifi_setup_back"
-                    android:visibility="gone" />
-
-            <Button android:id="@+id/wifi_setup_connect"
-                    style="@style/setup_wizard_button"
-                    android:layout_marginLeft="16dip"
-                    android:text="@string/wifi_setup_connect"
-                    android:enabled="false"
-                    android:visibility="gone" />
-
-            <Button android:id="@+id/wifi_setup_refresh_list"
-                    style="@style/setup_wizard_button"
-                    android:layout_marginLeft="16dip"
-                    android:text="@string/wifi_setup_refresh_list"
-                    android:enabled="false" />
-
-            <Button android:id="@+id/wifi_setup_skip_or_next"
-                    style="@style/setup_wizard_button"
-                    android:layout_marginLeft="16dip"
-                    android:text="@string/wifi_setup_skip"
-                    android:enabled="false" />
-        </LinearLayout>
-    </RelativeLayout>
-</RelativeLayout>
diff --git a/res/layout-xlarge/crypt_keeper_password_entry.xml b/res/layout-xlarge/crypt_keeper_password_entry.xml
index 2da2534..0610ec0 100644
--- a/res/layout-xlarge/crypt_keeper_password_entry.xml
+++ b/res/layout-xlarge/crypt_keeper_password_entry.xml
@@ -45,7 +45,9 @@
         />
 
         <!-- Password entry field -->
-        <EditText android:id="@+id/passwordEntry"
+        <view
+            class="com.android.settings.CryptKeeper$CryptEditText"
+            android:id="@+id/passwordEntry"
             android:layout_height="wrap_content"
             android:layout_width="320dip"
             android:layout_toRightOf="@+id/passwordLabel"
diff --git a/res/layout-xlarge/date_time_settings_setupwizard.xml b/res/layout-xlarge/date_time_settings_setupwizard.xml
index 479e3fd..ee425eb 100644
--- a/res/layout-xlarge/date_time_settings_setupwizard.xml
+++ b/res/layout-xlarge/date_time_settings_setupwizard.xml
@@ -20,8 +20,8 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:paddingTop="154dip"
-    android:paddingLeft="24dip"
-    android:paddingRight="24dip"
+    android:paddingLeft="128dip"
+    android:paddingRight="128dip"
     android:paddingBottom="96dip">
 
     <!-- Title: Set date & time-->
diff --git a/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml b/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml
index dd76e70..7b2a203 100644
--- a/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml
+++ b/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml
@@ -21,8 +21,8 @@
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:paddingTop="60dip"
-    android:paddingLeft="24dip"
-    android:paddingRight="24dip"
+    android:paddingLeft="128dip"
+    android:paddingRight="128dip"
     android:paddingBottom="0dip" >
 
     <FrameLayout
@@ -74,7 +74,7 @@
         android:layout_marginBottom="0dip">
 
         <FrameLayout
-            android:id="@+id/wifi_setup"
+            android:id="@+id/wifi_settings_fragment_layout"
             android:layout_width="match_parent"
             android:layout_height="360dip">
             <fragment
diff --git a/res/layout/preference_dialog_ringervolume.xml b/res/layout/preference_dialog_ringervolume.xml
index 6d494c1..5aebedc 100644
--- a/res/layout/preference_dialog_ringervolume.xml
+++ b/res/layout/preference_dialog_ringervolume.xml
@@ -17,91 +17,119 @@
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
-        
+
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:orientation="vertical"
             android:gravity="center_horizontal"
-            android:paddingBottom="20dip">
-            
+            android:paddingBottom="12dip"
+            android:paddingTop="12dip">
+
         <ImageView android:id="@android:id/icon"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:paddingTop="20dip" />
-                
+                android:paddingTop="20dip"
+                android:visibility="gone"/>
+
         <TextView
                 android:id="@+id/ringtone_label"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/incoming_call_volume_title"
                 android:paddingTop="10dip"
-                android:paddingLeft="20dip" 
+                android:paddingLeft="20dip"
                 android:paddingRight="20dip" />
-        
+
         <!-- Used for the ring volume.  This is what the superclass VolumePreference uses. -->
+        <!-- TODO - is this used? -->
         <SeekBar android:id="@*android:id/seekbar"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:paddingTop="2dip"
-                android:paddingLeft="20dip" 
-                android:paddingRight="20dip" />
-            
-        <!-- Used for the media volume -->
-        <TextView
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="@string/media_volume_title"
-                android:paddingTop="10dip"
-                android:paddingLeft="20dip" 
-                android:paddingRight="20dip" />
-        <SeekBar android:id="@+id/media_volume_seekbar"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingTop="2dip"
                 android:paddingLeft="20dip"
                 android:paddingRight="20dip" />
 
-        <!-- Used for the alarm volume -->
-        <TextView
+        <!-- Used for the media volume -->
+        <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="@string/alarm_volume_title"
-                android:paddingTop="10dip"
-                android:paddingLeft="20dip" 
-                android:paddingRight="20dip" />
-        <SeekBar android:id="@+id/alarm_volume_seekbar"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingTop="2dip"
-                android:paddingLeft="20dip" 
-                android:paddingRight="20dip" />
+                android:orientation="horizontal"
+                android:gravity="center_vertical">
 
+                <ImageView android:id="@+id/volume_mute_button"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"/>
+
+                <SeekBar android:id="@+id/media_volume_seekbar"
+                        android:layout_width="0dip"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:paddingTop="2dip"
+                        android:paddingLeft="20dip"
+                        android:paddingRight="20dip" />
+        </LinearLayout>
+
+        <!-- TODO - is this used? -->
         <CheckBox android:id="@+id/same_notification_volume"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/checkbox_notification_same_as_incoming_call"
                 android:textAppearance="?android:attr/textAppearanceSmall"
                 android:layout_marginTop="6dip"
-                android:layout_marginLeft="20dip" 
+                android:layout_marginLeft="20dip"
                 android:layout_marginRight="20dip" />
-    
-        <TextView android:id="@+id/notification_volume_title"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="@string/notification_volume_title"
-                android:paddingTop="6dip"
-                android:paddingLeft="20dip" 
-                android:paddingRight="20dip" />
-        
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:background="#1bffffff"
+            android:layout_marginTop="16dip"
+            android:layout_marginBottom="16dip"/>
+
         <!-- Used for the notification volume -->
-        <SeekBar android:id="@+id/notification_volume_seekbar"
+        <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:paddingTop="2dip"
-                android:paddingLeft="20dip" 
-                android:paddingRight="20dip" />
-        
+                android:orientation="horizontal">
+
+                <ImageView android:id="@+id/notification_mute_button"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"/>
+
+                <SeekBar android:id="@+id/notification_volume_seekbar"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:paddingTop="2dip"
+                        android:paddingLeft="20dip"
+                        android:paddingRight="20dip" />
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:background="#1bffffff"
+            android:layout_marginTop="16dip"
+            android:layout_marginBottom="16dip"/>
+
+        <!-- Used for the alarm volume -->
+        <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <ImageView android:id="@+id/alarm_mute_button"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"/>
+
+                <SeekBar android:id="@+id/alarm_volume_seekbar"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:paddingTop="2dip"
+                        android:paddingLeft="20dip"
+                        android:paddingRight="20dip" />
+        </LinearLayout>
+
     </LinearLayout>
-     
-</ScrollView>    
\ No newline at end of file
+
+</ScrollView>
\ No newline at end of file
diff --git a/res/layout/wifi_config_ui_for_setup_wizard.xml b/res/layout/wifi_config_ui_for_setup_wizard.xml
index ed5f9c2..698ce20 100644
--- a/res/layout/wifi_config_ui_for_setup_wizard.xml
+++ b/res/layout/wifi_config_ui_for_setup_wizard.xml
@@ -18,33 +18,35 @@
               android:orientation="vertical"
               android:layout_width="match_parent"
               android:layout_height="match_parent">
-    <!-- TODO: remove this once we confirm it is needless -->
-    <LinearLayout
-        android:id="@+id/wifi_general_info"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:visibility="gone">
-        <TextView android:id="@+id/title"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:singleLine="true"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textSize="20sp"
-            android:ellipsize="marquee"
-            android:fadingEdge="horizontal" />
-
-        <TextView android:id="@+id/summary"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@android:id/title"
-            android:layout_alignLeft="@android:id/title"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textColor="?android:attr/textColorSecondary"
-            android:maxLines="1" />
-    </LinearLayout>
-
     <!-- 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>
+    <!-- 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>
     <LinearLayout android:id="@+id/wps_fields"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
@@ -163,20 +165,6 @@
                  android:gravity="left|center_vertical"/>
     </RelativeLayout> <!-- android:id="@+id/type" -->
 
-    <LinearLayout 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" />
-    </LinearLayout>
-
     <!-- All the views below are "gone".
          We want them as data storage, not as UI components. -->
     <LinearLayout
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 3d752a3..0374ba6 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -25,6 +25,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.graphics.Rect;
 import android.inputmethodservice.KeyboardView;
 import android.os.Bundle;
 import android.os.Handler;
@@ -35,11 +36,14 @@
 import android.os.SystemProperties;
 import android.os.storage.IMountService;
 import android.text.TextUtils;
+import android.util.AttributeSet;
 import android.util.Log;
 import android.view.KeyEvent;
+import android.view.MotionEvent;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.Button;
 import android.widget.EditText;
 import android.widget.ProgressBar;
@@ -80,6 +84,38 @@
         }
     }
 
+    // Use a custom EditText to prevent the input method from showing.
+    public static class CryptEditText extends EditText {
+        InputMethodManager imm;
+
+        public CryptEditText(Context context, AttributeSet attrs) {
+            super(context, attrs);
+            imm = ((InputMethodManager) getContext().
+                    getSystemService(Context.INPUT_METHOD_SERVICE));
+        }
+
+        @Override
+        protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
+            super.onFocusChanged(focused, direction, previouslyFocusedRect);
+
+            if (focused && imm != null && imm.isActive(this)) {
+                imm.hideSoftInputFromWindow(getApplicationWindowToken(), 0);
+            }
+        }
+
+        @Override
+        public boolean onTouchEvent(MotionEvent event) {
+            boolean handled = super.onTouchEvent(event);
+
+            if (imm != null && imm.isActive(this)) {
+                imm.hideSoftInputFromWindow(getApplicationWindowToken(), 0);
+            }
+
+            return handled;
+        }
+    }
+
+
     private Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
diff --git a/src/com/android/settings/DateTimeSettingsSetupWizard.java b/src/com/android/settings/DateTimeSettingsSetupWizard.java
index 08c0227..bfbb601 100644
--- a/src/com/android/settings/DateTimeSettingsSetupWizard.java
+++ b/src/com/android/settings/DateTimeSettingsSetupWizard.java
@@ -95,6 +95,8 @@
         mAutoTimeZoneButton.setText(autoTimeZoneEnabled ? R.string.zone_auto_summaryOn :
                 R.string.zone_auto_summaryOff);*/
 
+        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
+
         final TimeZone tz = TimeZone.getDefault();
         mSelectedTimeZone = tz;
         mTimeZoneButton = (Button)findViewById(R.id.time_zone_button);
diff --git a/src/com/android/settings/RingerVolumePreference.java b/src/com/android/settings/RingerVolumePreference.java
index daae1a7..b546265 100644
--- a/src/com/android/settings/RingerVolumePreference.java
+++ b/src/com/android/settings/RingerVolumePreference.java
@@ -16,20 +16,34 @@
 
 package com.android.settings;
 
+import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
+import static android.provider.Telephony.Intents.SPN_STRINGS_UPDATED_ACTION;
+
+import com.android.internal.telephony.TelephonyIntents;
+
 import android.app.Dialog;
+import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
 import android.media.AudioManager;
 import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.preference.VolumePreference;
 import android.provider.Settings;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.KeyEvent;
 import android.view.View;
+import android.view.View.OnClickListener;
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
+import android.widget.ImageView;
 import android.widget.SeekBar;
 import android.widget.TextView;
 
@@ -38,12 +52,15 @@
  * notification volume.
  */
 public class RingerVolumePreference extends VolumePreference implements
-        CheckBox.OnCheckedChangeListener {
+        CheckBox.OnCheckedChangeListener, OnClickListener {
     private static final String TAG = "RingerVolumePreference";
+    private static final int MSG_RINGER_MODE_CHANGED = 101;
 
     private CheckBox mNotificationsUseRingVolumeCheckbox;
     private SeekBarVolumizer [] mSeekBarVolumizer;
     private boolean mIgnoreVolumeKeys;
+
+    // These arrays must all match in length and order
     private static final int[] SEEKBAR_ID = new int[] {
         R.id.notification_volume_seekbar,
         R.id.media_volume_seekbar,
@@ -51,9 +68,9 @@
     };
 
     private static final int[] NEED_VOICE_CAPABILITY_ID = new int[] {
-            R.id.ringtone_label,
-            com.android.internal.R.id.seekbar,
-            R.id.same_notification_volume
+        R.id.ringtone_label,
+        com.android.internal.R.id.seekbar,
+        R.id.same_notification_volume
     };
 
     private static final int[] SEEKBAR_TYPE = new int[] {
@@ -61,8 +78,63 @@
         AudioManager.STREAM_MUSIC,
         AudioManager.STREAM_ALARM
     };
+
+    private static final int[] CHECKBOX_VIEW_ID = new int[] {
+        R.id.notification_mute_button,
+        R.id.volume_mute_button,
+        R.id.alarm_mute_button
+    };
+
+    private static final int[] SEEKBAR_MUTED_RES_ID = new int[] {
+        com.android.internal.R.drawable.ic_audio_notification_mute,
+        com.android.internal.R.drawable.ic_audio_vol_mute,
+        com.android.internal.R.drawable.ic_audio_alarm_mute
+    };
+
+    private static final int[] SEEKBAR_UNMUTED_RES_ID = new int[] {
+        com.android.internal.R.drawable.ic_audio_notification,
+        com.android.internal.R.drawable.ic_audio_vol,
+        com.android.internal.R.drawable.ic_audio_alarm
+    };
+
+    private ImageView[] mCheckBoxes = new ImageView[SEEKBAR_MUTED_RES_ID.length];
+    private SeekBar[] mSeekBars = new SeekBar[SEEKBAR_ID.length];
+
+    private Handler mHandler = new Handler() {
+        public void handleMessage(Message msg) {
+            updateSlidersAndMutedStates();
+        }
+    };
+
+    @Override
+    public void createActionButtons() {
+        setPositiveButtonText(android.R.string.ok);
+        setNegativeButtonText(null);
+    }
+
+    private void updateSlidersAndMutedStates() {
+        for (int i = 0; i < SEEKBAR_TYPE.length; i++) {
+            int streamType = SEEKBAR_TYPE[i];
+            boolean muted = mAudioManager.isStreamMute(streamType);
+
+            if (mCheckBoxes[i] != null) {
+                mCheckBoxes[i].setImageResource(
+                        muted ? SEEKBAR_MUTED_RES_ID[i] : SEEKBAR_UNMUTED_RES_ID[i]);
+            }
+            if (mSeekBars[i] != null) {
+                mSeekBars[i].setEnabled(!muted);
+                final int volume = muted ? mAudioManager.getLastAudibleStreamVolume(streamType)
+                        : mAudioManager.getStreamVolume(streamType);
+                mSeekBars[i].setProgress(volume);
+            }
+        }
+    }
+
+    private BroadcastReceiver mRingModeChangedReceiver;
+    private AudioManager mAudioManager;
+
     //private SeekBarVolumizer mNotificationSeekBarVolumizer;
-    private TextView mNotificationVolumeTitle;
+    //private TextView mNotificationVolumeTitle;
 
     public RingerVolumePreference(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -71,10 +143,12 @@
         setStreamType(AudioManager.STREAM_RING);
 
         setDialogLayoutResource(R.layout.preference_dialog_ringervolume);
-        setDialogIcon(R.drawable.ic_settings_sound);
+        //setDialogIcon(R.drawable.ic_settings_sound);
 
         mSeekBarVolumizer = new SeekBarVolumizer[SEEKBAR_ID.length];
         mIgnoreVolumeKeys = !Utils.isVoiceCapable(context);
+
+        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
     }
 
     @Override
@@ -83,6 +157,7 @@
 
         for (int i = 0; i < SEEKBAR_ID.length; i++) {
             SeekBar seekBar = (SeekBar) view.findViewById(SEEKBAR_ID[i]);
+            mSeekBars[i] = seekBar;
             if (SEEKBAR_TYPE[i] == AudioManager.STREAM_MUSIC) {
                 mSeekBarVolumizer[i] = new SeekBarVolumizer(getContext(), seekBar,
                         SEEKBAR_TYPE[i], getMediaVolumeUri(getContext()));
@@ -92,7 +167,7 @@
             }
         }
 
-        mNotificationVolumeTitle = (TextView) view.findViewById(R.id.notification_volume_title);
+        //mNotificationVolumeTitle = (TextView) view.findViewById(R.id.notification_volume_title);
         mNotificationsUseRingVolumeCheckbox =
                 (CheckBox) view.findViewById(R.id.same_notification_volume);
         mNotificationsUseRingVolumeCheckbox.setOnCheckedChangeListener(this);
@@ -103,6 +178,32 @@
                         Settings.System.NOTIFICATIONS_USE_RING_VOLUME, 1) == 1);
         setNotificationVolumeVisibility(!mNotificationsUseRingVolumeCheckbox.isChecked());
         disableSettingsThatNeedVoice(view);
+
+        // Register callbacks for mute/unmute buttons
+        for (int i = 0; i < mCheckBoxes.length; i++) {
+            ImageView checkbox = (ImageView) view.findViewById(CHECKBOX_VIEW_ID[i]);
+            checkbox.setOnClickListener(this);
+            mCheckBoxes[i] = checkbox;
+        }
+
+        // Load initial states from AudioManager
+        updateSlidersAndMutedStates();
+
+        // Listen for updates from AudioManager
+        if (mRingModeChangedReceiver == null) {
+            final IntentFilter filter = new IntentFilter();
+            filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
+            mRingModeChangedReceiver = new BroadcastReceiver() {
+                public void onReceive(Context context, Intent intent) {
+                    final String action = intent.getAction();
+                    if (AudioManager.RINGER_MODE_CHANGED_ACTION.equals(action)) {
+                        mHandler.sendMessage(mHandler.obtainMessage(MSG_RINGER_MODE_CHANGED,
+                                intent.getIntExtra(AudioManager.EXTRA_RINGER_MODE, -1), 0));
+                    }
+                }
+            };
+            getContext().registerReceiver(mRingModeChangedReceiver, filter);
+        }
     }
 
     private Uri getMediaVolumeUri(Context context) {
@@ -147,10 +248,8 @@
         if (isChecked) {
             // The user wants the notification to be same as ring, so do a
             // one-time sync right now
-            AudioManager audioManager = (AudioManager) getContext()
-                    .getSystemService(Context.AUDIO_SERVICE);
-            audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION,
-                    audioManager.getStreamVolume(AudioManager.STREAM_RING), 0);
+            mAudioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION,
+                    mAudioManager.getStreamVolume(AudioManager.STREAM_RING), 0);
         }
     }
 
@@ -184,7 +283,7 @@
             mSeekBarVolumizer[0].getSeekBar().setVisibility(
                     visible ? View.VISIBLE : View.GONE);
         }
-        mNotificationVolumeTitle.setVisibility(visible ? View.VISIBLE : View.GONE);
+        // mNotificationVolumeTitle.setVisibility(visible ? View.VISIBLE : View.GONE);
     }
 
     private void cleanup() {
@@ -199,6 +298,10 @@
                 mSeekBarVolumizer[i] = null;
             }
         }
+        if (mRingModeChangedReceiver != null) {
+            getContext().unregisterReceiver(mRingModeChangedReceiver);
+            mRingModeChangedReceiver = null;
+        }
     }
 
     @Override
@@ -286,4 +389,17 @@
             }
         };
     }
+
+    public void onClick(View v) {
+        // Touching any of the mute buttons causes us to get the state from the system and toggle it
+        switch(mAudioManager.getRingerMode()) {
+            case AudioManager.RINGER_MODE_NORMAL:
+                mAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
+                break;
+            case AudioManager.RINGER_MODE_VIBRATE:
+            case AudioManager.RINGER_MODE_SILENT:
+                mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
+            break;
+        }
+    }
 }
diff --git a/src/com/android/settings/accounts/SyncStateCheckBoxPreference.java b/src/com/android/settings/accounts/SyncStateCheckBoxPreference.java
index b200eb6..4b9ca81 100644
--- a/src/com/android/settings/accounts/SyncStateCheckBoxPreference.java
+++ b/src/com/android/settings/accounts/SyncStateCheckBoxPreference.java
@@ -20,6 +20,7 @@
 
 import android.content.Context;
 import android.graphics.drawable.AnimationDrawable;
+import android.os.Handler;
 import android.preference.CheckBoxPreference;
 import android.util.AttributeSet;
 import android.view.View;
@@ -40,7 +41,7 @@
      * toggling whether the provider will do autosync.
      */
     private boolean mOneTimeSyncMode = false;
-    
+
     public SyncStateCheckBoxPreference(Context context, AttributeSet attrs) {
         super(context, attrs);
         setWidgetLayoutResource(R.layout.preference_widget_sync_toggle);
@@ -67,7 +68,7 @@
         boolean showError;
         boolean showPending;
         if (mIsActive) {
-            syncActiveView.post(new Runnable() {
+            new Handler(getContext().getMainLooper()).post(new Runnable() {
                 public void run() {
                     anim.start();
                 }
@@ -87,11 +88,11 @@
 
         syncFailedView.setVisibility(showError ? View.VISIBLE : View.GONE);
         syncPendingView.setVisibility((showPending && !mIsActive) ? View.VISIBLE : View.GONE);
-        
+
         View checkBox = view.findViewById(android.R.id.checkbox);
         if (mOneTimeSyncMode) {
             checkBox.setVisibility(View.GONE);
-            
+
             /*
              * Override the summary. Fill in the %1$s with the existing summary
              * (what ends up happening is the old summary is shown on the next
@@ -138,7 +139,7 @@
         mOneTimeSyncMode = oneTimeSyncMode;
         notifyChanged();
     }
-    
+
     /**
      * Gets whether the preference is in one-time sync mode.
      */
@@ -152,7 +153,7 @@
         // checkbox state
         if (!mOneTimeSyncMode) {
             super.onClick();
-        }            
+        }
     }
 
     public Account getAccount() {
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 9643220..df0c4a3 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -159,7 +159,7 @@
             mSsidView.addTextChangedListener(this);
             mSecuritySpinner = ((Spinner) mView.findViewById(R.id.security));
             mSecuritySpinner.setOnItemSelectedListener(this);
-            if (context instanceof WifiSettingsForSetupWizardXL) {
+            if (mInXlSetupWizard) {
                 // We want custom layout. The content must be same as the other cases.
                 mSecuritySpinner.setAdapter(
                         new ArrayAdapter<String>(context, R.layout.wifi_setup_custom_list_item_1,
@@ -482,16 +482,16 @@
     }
 
     private void showSecurityFields() {
+        if (mInXlSetupWizard) {
+            // Note: XL SetupWizard won't hide "EAP" settings here.
+            if (!((WifiSettingsForSetupWizardXL)mConfigUi.getContext()).initSecurityFields(mView,
+                        mAccessPointSecurity)) {
+                return;
+            }
+        }
         if (mAccessPointSecurity == AccessPoint.SECURITY_NONE) {
             mView.findViewById(R.id.security_fields).setVisibility(View.GONE);
             return;
-        } else if (mAccessPointSecurity == AccessPoint.SECURITY_EAP && mInXlSetupWizard) {
-            // In SetupWizard for XLarge screen, we don't have enough space for showing
-            // configurations needed for EAP. We instead disable the whole feature there and let
-            // users configure those networks after the setup.
-            mView.findViewById(R.id.eap_not_supported).setVisibility(View.VISIBLE);
-            mView.findViewById(R.id.security_fields).setVisibility(View.GONE);
-            return;
         }
         mView.findViewById(R.id.security_fields).setVisibility(View.VISIBLE);
 
diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
index b619145..00d18f1 100644
--- a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
+++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
@@ -21,7 +21,6 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.Configuration;
 import android.net.NetworkInfo.DetailedState;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
@@ -44,13 +43,14 @@
 
 import java.util.Collection;
 import java.util.EnumMap;
+import java.util.List;
 
 /**
  * WifiSetings Activity specific for SetupWizard with X-Large screen size.
  */
 public class WifiSettingsForSetupWizardXL extends Activity implements OnClickListener {
     private static final String TAG = "SetupWizard";
-    private static final boolean DEBUG = false;
+    private static final boolean DEBUG = true;
 
     private static final EnumMap<DetailedState, DetailedState> stateMap =
             new EnumMap<DetailedState, DetailedState>(DetailedState.class);
@@ -100,12 +100,19 @@
 
     private Button mConnectButton;
 
+    /**
+     * View enclosing {@link WifiSettings}.
+     */
+    private View mWifiSettingsFragmentLayout;
     private View mConnectingStatusLayout;
     private TextView mConnectingStatusView;
 
-    // true when a user already pressed "Connect" button and waiting for connection.
-    // Also true when the device is already connected to a wifi network on launch.
-    private boolean mAfterConnectAction;
+    private static final int SCREEN_STATE_DISCONNECTED = 0;
+    private static final int SCREEN_STATE_EDITING = 1;
+    private static final int SCREEN_STATE_CONNECTING = 2;
+    private static final int SCREEN_STATE_CONNECTED = 3;
+
+    private int mScreenState = SCREEN_STATE_DISCONNECTED;
 
     private WifiConfigUiForSetupWizardXL mWifiConfig;
 
@@ -156,8 +163,10 @@
     }
 
     public void setup() {
-        final View layoutRoot = findViewById(R.id.layout_root);
-        layoutRoot.setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
+        if (getIntent().getBooleanExtra("firstRun", false)) {
+            final View layoutRoot = findViewById(R.id.layout_root);
+            layoutRoot.setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
+        }
 
         mTitleView = (TextView)findViewById(R.id.wifi_setup_title);
         mProgressBar = (ProgressBar)findViewById(R.id.scanning_progress_bar);
@@ -179,6 +188,7 @@
         mTopPadding = findViewById(R.id.top_padding);
         mWifiConfigPadding = findViewById(R.id.wifi_config_padding);
 
+        mWifiSettingsFragmentLayout = findViewById(R.id.wifi_settings_fragment_layout);
         mConnectingStatusLayout = findViewById(R.id.connecting_status_layout);
         mConnectingStatusView = (TextView) findViewById(R.id.connecting_status);
 
@@ -256,42 +266,26 @@
             break;
         }
         case CONNECTING: {
-            showConnectingStatus();
+            if (mScreenState != SCREEN_STATE_DISCONNECTED &&
+                    mScreenState != SCREEN_STATE_CONNECTED) {
+                showConnectingState();
+            }
             break;
         }
         case CONNECTED: {
-            hideSoftwareKeyboard();
-            setPaddingVisibility(View.VISIBLE);
-
-            // If the device is already connected to a wifi without users' "Connect" request,
-            // this can be false here. We want to treat it as "after connect action".
-            mAfterConnectAction = true;
-
-            trySetBackground(R.drawable.setups_bg_complete);
-
-            mProgressBar.setIndeterminate(false);
-            mProgressBar.setProgress(2);
-
-            showConnectedTitle();
-            mConnectingStatusView.setText(R.string.wifi_setup_description_connected);
-            mConnectButton.setVisibility(View.GONE);
-            mAddNetworkButton.setVisibility(View.GONE);
-            mRefreshButton.setVisibility(View.GONE);
-            mBackButton.setVisibility(View.VISIBLE);
-            mBackButton.setText(R.string.wifi_setup_back);
-            mSkipOrNextButton.setVisibility(View.VISIBLE);
-            mSkipOrNextButton.setEnabled(true);
-            mHandler.removeCallbacks(mSkipButtonEnabler);
+            showConnectedState();
             break;
         }
         default:  // DISCONNECTED, FAILED
-            showDisconnectedStatus(Summary.get(this, state));
+            if (mScreenState != SCREEN_STATE_CONNECTED) {
+                showDisconnectedState(Summary.get(this, state));
+            }
             break;
         }
         mPreviousState = state;
     }
 
-    private void showDisconnectedStatus(String stateString) {
+    private void showDisconnectedState(String stateString) {
         mProgressBar.setIndeterminate(false);
         mProgressBar.setProgress(0);
 
@@ -299,7 +293,9 @@
         mRefreshButton.setEnabled(true);
     }
 
-    private void showConnectingStatus() {
+    private void showConnectingState() {
+        mScreenState = SCREEN_STATE_CONNECTING;
+
         mBackButton.setVisibility(View.VISIBLE);
         // We save this title and show it when authentication failed.
         mEditingTitle = mTitleView.getText();
@@ -307,11 +303,37 @@
         mProgressBar.setIndeterminate(false);
         mProgressBar.setProgress(1);
 
-        // We may enter "Connecting" status during editing password again (if the Wifi module
-        // tries to (re)connect a network.)
-        if (mAfterConnectAction) {
-            setPaddingVisibility(View.VISIBLE);
-        }
+        setPaddingVisibility(View.VISIBLE);
+    }
+
+    private void showConnectedState() {
+        // Once we show "connected" screen, we won't change it even when the device becomes
+        // disconnected afterwards. We keep the state unless a user explicitly cancel it
+        // (by pressing "back" button).
+        mScreenState = SCREEN_STATE_CONNECTED;
+
+        hideSoftwareKeyboard();
+        setPaddingVisibility(View.VISIBLE);
+
+        trySetBackground(R.drawable.setups_bg_complete);
+
+        mProgressBar.setIndeterminate(false);
+        mProgressBar.setProgress(2);
+
+        showConnectedTitle();
+
+        mWifiSettingsFragmentLayout.setVisibility(View.GONE);
+        mConnectingStatusLayout.setVisibility(View.VISIBLE);
+
+        mConnectingStatusView.setText(R.string.wifi_setup_description_connected);
+        mConnectButton.setVisibility(View.GONE);
+        mAddNetworkButton.setVisibility(View.GONE);
+        mRefreshButton.setVisibility(View.GONE);
+        mBackButton.setVisibility(View.VISIBLE);
+        mBackButton.setText(R.string.wifi_setup_back);
+        mSkipOrNextButton.setVisibility(View.VISIBLE);
+        mSkipOrNextButton.setEnabled(true);
+        mHandler.removeCallbacks(mSkipButtonEnabler);
     }
 
     private void showDefaultTitle() {
@@ -394,7 +416,7 @@
         // We don't want to keep scanning Wi-Fi networks during users' configuring one network.
         mWifiSettings.pauseWifiScan();
 
-        findViewById(R.id.wifi_setup).setVisibility(View.GONE);
+        mWifiSettingsFragmentLayout.setVisibility(View.GONE);
         mConnectingStatusLayout.setVisibility(View.GONE);
         final ViewGroup parent = (ViewGroup)findViewById(R.id.wifi_config_ui);
         parent.setVisibility(View.VISIBLE);
@@ -405,9 +427,6 @@
         mConnectButton.setTag(null);
         if (selectedAccessPoint == null) {  // "Add network" flow
             showAddNetworkTitle();
-            if (mWifiConfig != null) {
-                mWifiConfig.getView().findViewById(R.id.wifi_general_info).setVisibility(View.GONE);
-            }
             mConnectButton.setVisibility(View.VISIBLE);
             mConnectButton.setTag(CONNECT_BUTTON_TAG_ADD_NETWORK);
 
@@ -422,8 +441,7 @@
             showEditingTitle();
             showEditingButtonState();
             if (selectedAccessPoint.security == AccessPoint.SECURITY_EAP) {
-                mConnectButton.setVisibility(View.GONE);
-                mBackButton.setText(R.string.wifi_setup_back);
+                onEapNetworkSelected();
             } else {
                 mConnectButton.setVisibility(View.VISIBLE);
 
@@ -436,6 +454,47 @@
         }
     }
 
+    /**
+     * Called before security fields are correctly set by WifiConfigController.
+     *
+     * @param view security field view
+     * @param accessPointSecurity type of security. e.g. AccessPoint.SECURITY_NONE
+     * @return true when it is ok for the caller to init security fields. false when
+     * all security fields are managed by this method, and thus the caller shouldn't touch them.
+     */
+    /* package */ boolean initSecurityFields(View view, int accessPointSecurity) {
+        // Reset all states tweaked below.
+        view.findViewById(R.id.eap_not_supported).setVisibility(View.GONE);
+        view.findViewById(R.id.eap_not_supported_for_add_network).setVisibility(View.GONE);
+        view.findViewById(R.id.ssid_text).setVisibility(View.VISIBLE);
+        view.findViewById(R.id.ssid_layout).setVisibility(View.VISIBLE);
+
+        if (accessPointSecurity == AccessPoint.SECURITY_EAP) {
+            hideSoftwareKeyboard();
+
+            // In SetupWizard for XLarge screen, we don't have enough space for showing
+            // configurations needed for EAP. We instead disable the whole feature there and let
+            // users configure those networks after the setup.
+            if (view.findViewById(R.id.type).getVisibility() == View.VISIBLE) {
+                view.findViewById(R.id.eap_not_supported_for_add_network)
+                .setVisibility(View.VISIBLE);
+            } else {
+                view.findViewById(R.id.eap_not_supported).setVisibility(View.VISIBLE);
+            }
+            view.findViewById(R.id.security_fields).setVisibility(View.GONE);
+            view.findViewById(R.id.ssid_text).setVisibility(View.GONE);
+            view.findViewById(R.id.ssid_layout).setVisibility(View.GONE);
+            onEapNetworkSelected();
+            return false;
+        }
+        return true;
+    }
+
+    /* package */ void onEapNetworkSelected() {
+        mConnectButton.setVisibility(View.GONE);
+        mBackButton.setText(R.string.wifi_setup_back);
+    }
+
     private void showEditingButtonState() {
         mSkipOrNextButton.setVisibility(View.GONE);
         mAddNetworkButton.setVisibility(View.GONE);
@@ -445,7 +504,7 @@
 
     // May be called when user press "connect" button in WifiDialog
     /* package */ void onConnectButtonPressed() {
-        mAfterConnectAction = true;
+        mScreenState = SCREEN_STATE_CONNECTING;
 
         trySetBackground(R.drawable.setups_bg_wifi);
 
@@ -455,7 +514,7 @@
         // and the user still sees "not connected" message for a while, which looks strange.
         // We instead manually show "connecting" message before the system gets actual
         // "connecting" message from Wi-Fi module.
-        showConnectingStatus();
+        showConnectingState();
 
         // Might be better to delay showing this button.
         mBackButton.setVisibility(View.VISIBLE);
@@ -497,9 +556,9 @@
     private void onBackButtonPressed() {
         trySetBackground(R.drawable.setups_bg_default);
 
-        if (mAfterConnectAction) {
+        if (mScreenState == SCREEN_STATE_CONNECTING || mScreenState == SCREEN_STATE_CONNECTED) {
             if (DEBUG) Log.d(TAG, "Back button pressed after connect action.");
-            mAfterConnectAction = false;
+            mScreenState = SCREEN_STATE_DISCONNECTED;
 
             // When a user press "Back" button after pressing "Connect" button, we want to cancel
             // the "Connect" request and refresh the whole wifi status.
@@ -508,6 +567,21 @@
             mSkipOrNextButton.setEnabled(true);
             changeNextButtonState(false);  // Skip
 
+            // Wifi list becomes empty for a moment. We show "scanning" effect to a user so that
+            // he/she won't be astonished there. This stops once the scan finishes.
+            mProgressBar.setIndeterminate(true);
+
+            // Remembered networks may be re-used during SetupWizard, which confuse users.
+            // We force the module to forget them to reduce UX complexity
+            final List<WifiConfiguration> configs = mWifiManager.getConfiguredNetworks();
+            for (WifiConfiguration config : configs) {
+                if (DEBUG) {
+                    Log.d(TAG, String.format("forgeting Wi-Fi network \"%s\" (id: %d)",
+                            config.SSID, config.networkId));
+                }
+                mWifiManager.forgetNetwork(config.networkId);
+            }
+
             refreshAccessPoints(true);
         } else { // During user's Wifi configuration.
             mWifiSettings.resumeWifiScan();
@@ -519,7 +593,7 @@
             mSkipOrNextButton.setEnabled(true);
         }
 
-        findViewById(R.id.wifi_setup).setVisibility(View.VISIBLE);
+        mWifiSettingsFragmentLayout.setVisibility(View.VISIBLE);
         mConnectingStatusLayout.setVisibility(View.GONE);
         final ViewGroup parent = (ViewGroup)findViewById(R.id.wifi_config_ui);
         parent.removeAllViews();
@@ -564,7 +638,7 @@
                 ((Integer)tag == CONNECT_BUTTON_TAG_ADD_NETWORK)) {
             // In "Add network" flow, we won't get DetaledState available for changing ProgressBar
             // state. Instead we manually show previous status here.
-            showDisconnectedStatus(Summary.get(this, mPreviousState));
+            showDisconnectedState(Summary.get(this, mPreviousState));
         } else {
             showScanningStatus();
         }
@@ -592,7 +666,8 @@
      * Called once when Authentication failed.
      */
     private void onAuthenticationFailure() {
-        mAfterConnectAction = false;
+        mScreenState = SCREEN_STATE_EDITING;
+
         mSkipOrNextButton.setVisibility(View.GONE);
         mConnectButton.setVisibility(View.VISIBLE);
         mConnectButton.setEnabled(true);
@@ -671,8 +746,7 @@
      * Replace the current background with a new background whose id is resId if needed.
      */
     private void trySetBackground(int resId) {
-        final int orientation = getResources().getConfiguration().orientation;
-        if (orientation == Configuration.ORIENTATION_LANDSCAPE && mBackgroundId != resId) {
+        if (mBackgroundId != resId) {
             getWindow().setBackgroundDrawable(getResources().getDrawable(resId));
             mBackgroundId = resId;
         }