Merge "Import translations. DO NOT MERGE" into lmp-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 27738c3..9a33e28 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -97,8 +97,7 @@
 
         <receiver android:name="ManagedProfileSetup">
             <intent-filter>
-                <action android:name="android.intent.action.BOOT_COMPLETED"/>
-                <action android:name="android.intent.action.PRE_BOOT_COMPLETED"/>
+                <action android:name="android.intent.action.USER_INITIALIZE"/>
             </intent-filter>
         </receiver>
 
@@ -1450,6 +1449,7 @@
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.settings.WIFI_DISPLAY_SETTINGS" />
+                <action android:name="android.settings.CAST_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
diff --git a/res/drawable/setup_wizard_card_bg.xml b/res/drawable/setup_wizard_card_bg.xml
new file mode 100644
index 0000000..8621437
--- /dev/null
+++ b/res/drawable/setup_wizard_card_bg.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <corners
+        android:topLeftRadius="@dimen/setup_wizard_card_corner_radius"
+        android:topRightRadius="@dimen/setup_wizard_card_corner_radius" />
+
+    <solid android:color="?android:attr/colorBackground" />
+
+</shape>
+
diff --git a/res/layout-sw600dp-land/setup_preference.xml b/res/layout-sw600dp-land/setup_preference.xml
index 0943817..3d4db3d 100644
--- a/res/layout-sw600dp-land/setup_preference.xml
+++ b/res/layout-sw600dp-land/setup_preference.xml
@@ -37,14 +37,17 @@
             <TextView
                 android:id="@+id/title"
                 style="@style/SetupCardTitle"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="6"
                 android:text="@string/wifi_setup_wizard_title"/>
 
             <LinearLayout
                 android:layout_width="0dp"
                 android:layout_height="match_parent"
-                android:layout_marginTop="@dimen/setup_wizard_card_margin_top"
+                android:layout_marginTop="@dimen/setup_wizard_card_land_margin_top"
                 android:layout_weight="8"
-                android:background="?android:attr/colorBackground"
+                android:background="@drawable/setup_wizard_card_bg"
                 android:elevation="@dimen/setup_wizard_card_elevation"
                 android:orientation="vertical">
 
diff --git a/res/layout-sw720dp-port/setup_preference.xml b/res/layout-sw720dp-port/setup_preference.xml
new file mode 100644
index 0000000..8d1f53b
--- /dev/null
+++ b/res/layout-sw720dp-port/setup_preference.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2014 Google Inc.
+
+    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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <com.android.settings.widget.SetupWizardIllustration
+        android:id="@+id/title_area"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1"
+        android:background="@drawable/setup_illustration_bg"
+        android:foreground="@drawable/setup_illustration_wifi_wide"
+        settings:aspectRatio="4.0">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:paddingLeft="@dimen/setup_wizard_card_port_margin_sides"
+            android:paddingRight="@dimen/setup_wizard_card_port_margin_sides">
+
+            <TextView
+                android:id="@+id/title"
+                style="@style/SetupCardTitle"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_setup_wizard_title" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:layout_weight="1"
+                android:background="@drawable/setup_wizard_card_bg"
+                android:elevation="@dimen/setup_wizard_card_elevation"
+                android:orientation="vertical">
+
+                <TextView
+                    android:id="@+id/wifi_required_info"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginBottom="6dp"
+                    android:text="@string/wifi_required_info_text"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:visibility="gone" />
+
+                <ListView
+                    android:id="@android:id/list"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:layout_weight="1"
+                    android:cacheColorHint="@android:color/transparent"
+                    android:clipToPadding="false"
+                    android:drawSelectorOnTop="false"
+                    android:headerDividersEnabled="false"
+                    android:scrollbarAlwaysDrawVerticalTrack="true" />
+
+            </LinearLayout>
+
+        </LinearLayout>
+
+    </com.android.settings.widget.SetupWizardIllustration>
+
+    <fragment
+        android:id="@+id/navigation_bar"
+        android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
+        style="@style/setup_wizard_navbar_style" />
+
+</LinearLayout>
+
diff --git a/res/layout/apn_preference_layout.xml b/res/layout/apn_preference_layout.xml
index f3ee453..05ffe51 100644
--- a/res/layout/apn_preference_layout.xml
+++ b/res/layout/apn_preference_layout.xml
@@ -27,8 +27,6 @@
         android:id="@+id/text_layout"
         android:layout_width="0dip"
         android:layout_height="match_parent"
-        android:paddingStart="8dip"
-        android:paddingEnd="8dip"
         android:gravity="center_vertical"
         android:layout_weight="1"
         android:focusable="true"
@@ -40,7 +38,7 @@
             android:layout_height="wrap_content"
             android:focusable="true"
             android:singleLine="true"
-            android:textAppearance="?android:attr/textAppearanceMedium" />
+            android:textAppearance="?android:attr/textAppearanceListItem" />
 
         <TextView
             android:id="@+android:id/summary"
@@ -48,13 +46,13 @@
             android:layout_height="wrap_content"
             android:layout_below="@android:id/title"
             android:layout_alignStart="@android:id/title"
-            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+            android:textColor="?android:attr/textColorSecondary"
             android:maxLines="2" />
 
     </RelativeLayout>
 
     <RadioButton
-        xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/apn_radiobutton"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml
index 68fcb1b..4033d43 100644
--- a/res/layout/manage_applications_apps.xml
+++ b/res/layout/manage_applications_apps.xml
@@ -20,7 +20,7 @@
         android:orientation="vertical">
 
     <FrameLayout android:id="@+id/pinned_header"
-            android:layout_width="match_parent"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:visibility="gone" />
 
diff --git a/res/layout/manage_applications_running.xml b/res/layout/manage_applications_running.xml
index cc8c1867..6cacf2a 100644
--- a/res/layout/manage_applications_running.xml
+++ b/res/layout/manage_applications_running.xml
@@ -20,7 +20,7 @@
             android:orientation="vertical">
 
     <FrameLayout android:id="@+id/pinned_header"
-                 android:layout_width="match_parent"
+                 android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:visibility="gone" />
 
diff --git a/res/layout/preference_list_fragment.xml b/res/layout/preference_list_fragment.xml
index a44535f..b47e175 100644
--- a/res/layout/preference_list_fragment.xml
+++ b/res/layout/preference_list_fragment.xml
@@ -25,7 +25,7 @@
       android:background="@android:color/transparent">
 
     <FrameLayout android:id="@+id/pinned_header"
-                 android:layout_width="match_parent"
+                 android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:visibility="gone" />
 
diff --git a/res/layout/setup_wizard_header.xml b/res/layout/setup_wizard_header.xml
index 2409fb4..8334868 100644
--- a/res/layout/setup_wizard_header.xml
+++ b/res/layout/setup_wizard_header.xml
@@ -24,7 +24,7 @@
     android:background="@drawable/setup_illustration_bg"
     android:foreground="@drawable/setup_illustration_wifi"
     android:tag="stickyContainer"
-    settings:aspectRatio="2.0">
+    settings:aspectRatio="2.22">
 
     <TextView
         android:id="@+id/title"
diff --git a/res/layout/text_description_preference.xml b/res/layout/text_description_preference.xml
index 78eb02a..d71f078 100644
--- a/res/layout/text_description_preference.xml
+++ b/res/layout/text_description_preference.xml
@@ -16,9 +16,8 @@
 
 <TextView
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/summary"
+    android:id="@android:id/summary"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
-    android:textAppearance="?android:attr/textAppearanceMedium"
-    android:textColor="?android:attr/textColorSecondary"
+    android:textAppearance="@android:style/TextAppearance.Material.Body1"
     android:padding="16dip" />
diff --git a/res/layout/user_preference.xml b/res/layout/user_preference.xml
index 79ffc38..625a065 100644
--- a/res/layout/user_preference.xml
+++ b/res/layout/user_preference.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@android:id/widget_frame"
-        android:layout_width="match_parent"
+        android:layout_width="wrap_content"
         android:layout_height="@dimen/user_spinner_item_height"
         android:orientation="horizontal" >
 
@@ -39,6 +39,7 @@
             android:ellipsize="marquee"
             android:fadingEdge="horizontal"
             android:paddingStart="@dimen/user_spinner_padding"
+            android:paddingEnd="@dimen/user_spinner_padding"
             style="@style/TextAppearance.Medium" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 79529e2..1aa4b55 100755
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -45,4 +45,10 @@
     <!-- Dashboard tile image margin start / end -->
     <dimen name="dashboard_tile_image_margin_start">12dp</dimen>
 
+    <dimen name="setup_wizard_card_title_margin_top">256dp</dimen>
+    <dimen name="setup_wizard_card_title_padding_end">32dp</dimen>
+    <dimen name="setup_wizard_card_title_padding_start">56dp</dimen>
+    <dimen name="setup_wizard_card_title_padding_top">24dp</dimen>
+    <dimen name="setup_wizard_card_title_padding_bottom">0dp</dimen>
+
 </resources>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 6e1b2b8..03b2e90 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -646,6 +646,7 @@
         <item>get usage stats</item>
         <item>mute/unmute microphone</item>
         <item>project media</item>
+        <item>activate VPN</item>
     </string-array>
 
     <!-- User display names for app ops codes -->
@@ -696,6 +697,7 @@
         <item>Get usage stats</item>
         <item>Mute/unmute microphone</item>
         <item>Project media</item>
+        <item>Activate VPN</item>
     </string-array>
 
     <!-- Titles for the list of long press timeout options. -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 865b029..bbe62a5 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -48,12 +48,15 @@
     <!-- Size of padding to give in the wifi list when there is no icon -->
     <dimen name="setup_list_no_icon_padding">56dp</dimen>
     <dimen name="setup_add_network_item_height">56dp</dimen>
+    <dimen name="setup_wizard_card_corner_radius">2dp</dimen>
     <dimen name="setup_wizard_card_elevation">5dp</dimen>
-    <dimen name="setup_wizard_card_margin_top">128dp</dimen>
-    <dimen name="setup_wizard_card_title_margin_top">256dp</dimen>
-    <dimen name="setup_wizard_card_title_padding_end">32dp</dimen>
-    <dimen name="setup_wizard_card_title_padding_start">56dp</dimen>
-    <dimen name="setup_wizard_card_title_padding_top">24dp</dimen>
+    <dimen name="setup_wizard_card_title_margin_top">0dp</dimen>
+    <dimen name="setup_wizard_card_title_padding_end">0dp</dimen>
+    <dimen name="setup_wizard_card_title_padding_start">0dp</dimen>
+    <dimen name="setup_wizard_card_title_padding_top">16dp</dimen>
+    <dimen name="setup_wizard_card_title_padding_bottom">28dp</dimen>
+    <dimen name="setup_wizard_card_port_margin_sides">56dp</dimen>
+    <dimen name="setup_wizard_card_land_margin_top">128dp</dimen>
     <dimen name="setup_wizard_margin_sides">40dp</dimen>
 
     <dimen name="divider_height">3dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 077f571..d2e19a1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -790,21 +790,21 @@
     <!-- Informational text in the first confirmation screen before starting device encryption -->
     <string name="crypt_keeper_desc" product="tablet">
     You can encrypt your accounts, settings, downloaded apps and their data,
-    media, and other files. After you encrypt your tablet, assuming you\’ve set up a screen lock
+    media, and other files. After you encrypt your tablet, assuming you\'ve set up a screen lock
     (that is, a pattern or numeric PIN or password), you\'ll need to unlock the screen to decrypt
     the tablet every time you power it on. The only other way to decrypt is to perform a factory
     data reset, erasing all your data.\n\nEncryption takes an hour or more. You must start with
-    a charged battery and keep your tablet plugged in throughout the process. If you interrupt,
-    you\’ll lose some or all of your data</string>
+    a charged battery and keep your tablet plugged in throughout the process. If you interrupt it,
+    you\'ll lose some or all of your data</string>
     <!-- Informational text in the first confirmation screen before starting device encryption -->
     <string name="crypt_keeper_desc" product="default">
     You can encrypt your accounts, settings, downloaded apps and their data,
-    media, and other files. After you encrypt your phone, assuming you’ve set up a screen lock
+    media, and other files. After you encrypt your phone, assuming you\'ve set up a screen lock
     (that is, a pattern or numeric PIN or password), you\'ll need to unlock the screen to decrypt
     the phone every time you power it on. The only other way to decrypt is to perform a factory
     data reset, erasing all your data.\n\nEncryption takes an hour or more. You must start with
-    a charged battery and keep your phone plugged in throughout the process. If you interrupt,
-    you\’ll lose some or all of your data.</string>
+    a charged battery and keep your phone plugged in throughout the process. If you interrupt it,
+    you\'ll lose some or all of your data.</string>
 
     <!-- Button text to start encryption process -->
     <string name="crypt_keeper_button_text" product="tablet">Encrypt tablet</string>
@@ -3339,8 +3339,6 @@
     <string name="input_methods_settings_title">Text input</string>
     <!-- Setting name for Input Method chooser -->
     <string name="input_method">Input method</string>
-    <!-- Title for the option to press to enable or disable keyboards, also known as input methods [CHAR LIMIT=35] -->
-    <string name="choose_input_methods">Choose Keyboards</string>
     <!-- Title for the option to press to choose the current keyboard, also known as input method [CHAR LIMIT=35] -->
     <string name="current_input_method">Current Keyboard</string>
     <!-- Title for setting the visibility of input method selector [CHAR LIMIT=35] -->
@@ -3431,6 +3429,8 @@
     <string name="allow_mock_location">Allow mock locations</string>
     <!-- setting Checkbox summary whether to allow mock locations  -->
     <string name="allow_mock_location_summary">Allow mock locations</string>
+    <!-- Setting Checkbox title whether to enable view attribute inspection -->
+    <string name="debug_view_attributes">Enable view attribute inspection</string>
     <!-- Title of warning dialog about the implications of enabling USB debugging -->
     <string name="adb_warning_title">Allow USB debugging?</string>
     <!-- Warning text to user about the implications of enabling USB debugging -->
@@ -3570,8 +3570,12 @@
     <string name="accessibility_long_press_timeout_preference_title">Touch &amp; hold delay</string>
     <!-- Title for the accessibility preference to configure display color inversion. [CHAR LIMIT=NONE] -->
     <string name="accessibility_display_inversion_preference_title">Color inversion</string>
+    <!-- Subtitle for the accessibility preference to configure display color inversion. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_display_inversion_preference_subtitle">(Experimental) May affect performance</string>
     <!-- Title for the accessibility preference to configure display color space correction. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_display_daltonizer_preference_title">Color space correction</string>
+    <string name="accessibility_display_daltonizer_preference_title">Color correction</string>
+    <!-- Subtitle for the accessibility preference to configure display color space correction. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_display_daltonizer_preference_subtitle">This feature is experimental and may affect performance.</string>
 
     <!-- Title for the preference to show a tile for a particular feature in the Quick Settings pane. [CHAR LIMIT=NONE] -->
     <string name="enable_quick_setting">Show in Quick Settings</string>
@@ -3598,6 +3602,8 @@
     <string name="accessibility_feature_state_on">On</string>
     <!-- Summary for the disabled state of an accessibility feature. [CHAR LIMIT=10] -->
     <string name="accessibility_feature_state_off">Off</string>
+    <!-- Summary when an accessibility feature or ime is not permitted. [CHAR LIMIT=40] -->
+    <string name="accessibility_feature_or_input_method_not_allowed">Not allowed by your organization</string>
 
     <!-- Title for the preference category containing the video caption preview. [CHAR LIMIT=35] -->
     <string name="captioning_preview_title">Preview</string>
@@ -4402,8 +4408,8 @@
     <string name="select_device_admin_msg">Device administrators</string>
     <!-- Message when there are no available device admins to display -->
     <string name="no_device_admins">No available device administrators</string>
-    <!-- Message displayed when the device admin can only be disabled by deleting the managed profile [CHAR_LIMIT=120] -->
-    <string name="managed_profile_device_admin_info">To stop <xliff:g id="app_name">%1$s</xliff:g> from accessing your work profile, remove the profile under Settings &gt; Accounts.</string>
+    <!-- Message displayed when the device admin can only be disabled by deleting the work profile [CHAR_LIMIT=120] -->
+    <string name="managed_profile_device_admin_info">To stop <xliff:g id="app_name">%1$s</xliff:g> from accessing your work profile, remove the profile under Settings &gt; Accounts</string>
     <!-- Title for personal device admins on the list [CHAR_LIMIT=25] -->
     <string name="personal_device_admin_title">Personal</string>
     <!-- Title for managed device admins on the list [CHAR_LIMIT=25] -->
@@ -4428,9 +4434,9 @@
         following operations:</string>
 
     <!-- Title for screen to set a profile owner [CHAR LIMIT=40] -->
-    <string name="profile_owner_add_title">Profile owner</string>
+    <string name="profile_owner_add_title">Activate Profile Manager?</string>
     <!-- Warning when trying to add a profile owner admin after setup has completed. [CHAR LIMIT=none] -->
-    <string name="adding_profile_owner_warning" translatable="false">This application wants to assume COMPLETE control of this user, including restricting critical operations. Only allow this if you trust this application.</string>
+    <string name="adding_profile_owner_warning">By proceeding, your User will be managed by your Administrator which may also be able to store associated data, in addition to your personal data.\n\nYour Administrator has the ability to monitor and manage settings, access, apps, and data associated with this User, including network activity and your device\'s location information.</string>
 
     <!-- Name to assign to a Network Access Point that was saved without a name -->
     <string name="untitled_apn">Untitled</string>
@@ -4567,8 +4573,8 @@
     <string name="sync_is_failing">Sync is currently experiencing problems. It will be back shortly.</string>
     <!-- Button label to add an account [CHAR LIMIT=20] -->
     <string name="add_account_label">Add account</string>
-    <!-- Label for the state of the managed profile [CHAR LIMIT=80] -->
-    <string name="managed_profile_not_available_label">Work profile is not available yet</string>
+    <!-- Label for the state of the work profile [CHAR LIMIT=80] -->
+    <string name="managed_profile_not_available_label">Work profile isn\'t available yet</string>
     <!-- Button label to remove the work profile [CHAR LIMIT=35] -->
     <string name="remove_managed_profile_label">Remove work profile</string>
     <!-- Data synchronization settings screen, title of setting that controls whether background data should be used [CHAR LIMIT=30] -->
@@ -4650,11 +4656,11 @@
     <string name="wimax_settings">4G</string>
     <string name="status_wimax_mac_address">4G MAC address</string>
     <!-- This is displayed to the user when the device needs to be decrypted -->
-    <string name="enter_password">Type password to decrypt storage</string>
+    <string name="enter_password">To start Android, enter your password</string>
     <!-- Informational text on the pin entry screen prompting the user for their pin -->
-    <string name="enter_pin">Enter your PIN to decrypt storage</string>
+    <string name="enter_pin">To start Android, enter your PIN</string>
     <!-- Informational text on the pattern entry screen prompting the user for their pattern -->
-    <string name="enter_pattern">Draw your pattern to decrypt storage</string>
+    <string name="enter_pattern">To start Android, draw your pattern</string>
     <!-- This is displayed when the password is entered incorrectly -->
     <string name="try_again">Try again.</string>
 
@@ -5175,8 +5181,8 @@
     <string name="user_add_user_menu">Add user</string>
     <!-- User settings summary for a restricted profile [CHAR LIMIT=50] -->
     <string name="user_summary_restricted_profile">Restricted profile</string>
-    <!-- User settings summary for a managed profile [CHAR LIMIT=50] -->
-    <string name="user_summary_managed_profile">Managed profile</string>
+    <!-- User settings summary for a work profile [CHAR LIMIT=50] -->
+    <string name="user_summary_managed_profile">Work profile</string>
     <!-- User settings warning that restricted profile needs a screen lock [CHAR LIMIT=NONE] -->
     <string name="user_need_lock_message">Before you can create a restricted profile, you\'ll need to set up a screen lock to protect your apps and personal data.</string>
     <!-- User settings dialog button to set screen lock [CHAR LIMIT=25] -->
@@ -5185,8 +5191,8 @@
     <string name="user_summary_not_set_up">Not set up</string>
     <!-- User summary to indicate that restricted profile is currently not set up [CHAR LIMIT=100] -->
     <string name="user_summary_restricted_not_set_up">Not set up - Restricted profile</string>
-    <!-- User summary to indicate that a managed profile is currently not set up [CHAR LIMIT=100] -->
-    <string name="user_summary_managed_profile_not_set_up">Not set up - Managed profile</string>
+    <!-- User summary to indicate that a work profile is currently not set up [CHAR LIMIT=100] -->
+    <string name="user_summary_managed_profile_not_set_up">Not set up - Work profile</string>
     <!-- User information string to represent the owner of the device [CHAR LIMIT=25] -->
     <string name="user_owner">Owner</string>
     <!-- User settings title for current user entry "You" user. [CHAR LIMIT=30] -->
@@ -5240,12 +5246,16 @@
     <string name="user_confirm_remove_title">Remove this user?</string>
     <!-- Profile removal confirmation title [CHAR LIMIT=25] -->
     <string name="user_profile_confirm_remove_title">Remove this profile?</string>
+    <!-- Work profile removal confirmation title [CHAR LIMIT=25] -->
+    <string name="work_profile_confirm_remove_title">Remove work profile?</string>
     <!-- User (self) removal confirmation message [CHAR LIMIT=none] -->
     <string name="user_confirm_remove_self_message" product="tablet">You will lose your space and data on this tablet. You can\'t undo this action.</string>
     <!-- User (self) removal confirmation message [CHAR LIMIT=none] -->
     <string name="user_confirm_remove_self_message" product="default">You will lose your space and data on this phone. You can\'t undo this action.</string>
     <!-- User removal confirmation message [CHAR LIMIT=none] -->
     <string name="user_confirm_remove_message">All apps and data will be deleted.</string>
+    <!-- Work profile removal confirmation message [CHAR LIMIT=none] -->
+    <string name="work_profile_confirm_remove_message">All apps and data in this profile will be deleted.</string>
     <!-- User profile removal confirmation message [CHAR LIMIT=none] -->
     <string name="user_profile_confirm_remove_message">All apps and data will be deleted.</string>
     <!-- Setting label to show that a new user is being added [CHAR LIMIT=30] -->
@@ -5257,11 +5267,13 @@
     <!-- Title for Guest user [CHAR LIMIT=35] -->
     <string name="user_guest">Guest</string>
     <!-- Label for item to exit guest mode [CHAR LIMIT=35] -->
-    <string name="user_exit_guest_title">Exit guest</string>
+    <string name="user_exit_guest_title">Remove guest</string>
     <!-- Title of dialog to user to confirm exiting guest. [CHAR LIMIT=50] -->
-    <string name="user_exit_guest_confirm_title">Exiting guest session?</string>
+    <string name="user_exit_guest_confirm_title">Remove guest?</string>
     <!-- Message to user to confirm exiting guest. [CHAR LIMIT=none] -->
-    <string name="user_exit_guest_confirm_message">Ending the guest session will remove local data.</string>
+    <string name="user_exit_guest_confirm_message">All apps and data in this session will be deleted.</string>
+    <!-- Label for button in confirmation dialog when exiting guest session [CHAR LIMIT=35] -->
+    <string name="user_exit_guest_dialog_remove">Remove</string>
 
     <!-- Title of preference to enable calling[CHAR LIMIT=40] -->
     <string name="user_enable_calling">Allow phone calls</string>
@@ -5781,7 +5793,7 @@
     <string name="app_notification_sensitive_title">Sensitive</string>
 
     <!-- [CHAR LIMIT=NONE] App notification settings: Sensitive option description-->
-    <string name="app_notification_sensitive_summary">When the device is locked, hide any sensitive content from this app’s notifications</string>
+    <string name="app_notification_sensitive_summary">When the device is locked, hide any sensitive content from this app\'s notifications</string>
 
     <!-- [CHAR LIMIT=20] Notification settings: App notifications row summary when banned -->
     <string name="app_notification_row_banned">Blocked</string>
@@ -5890,7 +5902,7 @@
     <!-- [CHAR LIMIT=300] Screen pinning description -->
     <string name="screen_pinning_description">When this setting is turned on, you can put the device in a state that keeps the current screen in view.\n\nTo pin a screen:\n\n1. Turn this setting on.\n\n2. Open an app.\n\n3. Touch the Recents button.\n\n4. Touch the pin icon.</string>
 
-    <!-- Title for a managed (work) profile. [CHAR LIMIT=25] -->
+    <!-- Title for a work profile. [CHAR LIMIT=25] -->
     <string name="managed_user_title">Work profile</string>
 
     <!-- Summary Title for saying that the preference is experimental and will evolve over time due to User feedback. [CHAR LIMIT=NONE] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1b08e0f..3f5f39d 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -174,15 +174,17 @@
         <item name="android:paddingTop">@dimen/setup_title_padding_top</item>
     </style>
 
-    <!-- Alternate title style used for some tablet-landscape layouts -->
-    <style name="SetupCardTitle" parent="@android:style/TextAppearance.Material.Display1">
-        <item name="android:layout_width">0dp</item>
-        <item name="android:layout_height">wrap_content</item>
+    <!-- Alternate title style used for some tablet layouts -->
+    <style name="SetupCardTitle">
         <item name="android:layout_marginTop">@dimen/setup_wizard_card_title_margin_top</item>
-        <item name="android:layout_weight">6</item>
-        <item name="android:paddingStart">@dimen/setup_wizard_card_title_padding_start</item>
+        <item name="android:paddingBottom">@dimen/setup_wizard_card_title_padding_bottom</item>
         <item name="android:paddingEnd">@dimen/setup_wizard_card_title_padding_end</item>
+        <item name="android:paddingStart">@dimen/setup_wizard_card_title_padding_start</item>
         <item name="android:paddingTop">@dimen/setup_wizard_card_title_padding_top</item>
+        <item name="android:textAppearance">@style/TextAppearance.SetupWizardCardTitle</item>
+    </style>
+
+    <style name="TextAppearance.SetupWizardCardTitle" parent="@android:style/TextAppearance.Material.Display1">
         <item name="android:textColor">@android:color/white</item>
     </style>
 
diff --git a/res/xml/accessibility_daltonizer_settings.xml b/res/xml/accessibility_daltonizer_settings.xml
index 30a5444..62c0dfc 100644
--- a/res/xml/accessibility_daltonizer_settings.xml
+++ b/res/xml/accessibility_daltonizer_settings.xml
@@ -17,6 +17,12 @@
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
     android:title="@string/accessibility_display_daltonizer_preference_title" >
 
+    <Preference
+        android:summary="@string/accessibility_display_daltonizer_preference_subtitle"
+        android:layout="@layout/text_description_preference"
+        android:persistent="false"
+        android:selectable="false" />
+
     <ListPreference
         android:entries="@array/daltonizer_type_entries"
         android:entryValues="@array/daltonizer_type_values"
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index a870074..d2d7711 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -86,6 +86,7 @@
         <SwitchPreference
             android:key="toggle_inversion_preference"
             android:title="@string/accessibility_display_inversion_preference_title"
+            android:summary="@string/accessibility_display_inversion_preference_subtitle"
             android:persistent="false" />
         <PreferenceScreen
             android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 2a1a5bb..807ae8b 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -86,6 +86,10 @@
             android:title="@string/allow_mock_location"
             android:summary="@string/allow_mock_location_summary"/>
 
+        <CheckBoxPreference
+                android:key="debug_view_attributes"
+                android:title="@string/debug_view_attributes" />
+
         <PreferenceScreen android:key="debug_app"
                 android:title="@string/debug_app" />
 
diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml
index b60dc5e..46072bf 100644
--- a/res/xml/language_settings.xml
+++ b/res/xml/language_settings.xml
@@ -46,12 +46,6 @@
             android:title="@string/keyboard_settings_category"
             settings:keywords="@string/keywords_keyboard_and_ime">
 
-        <!-- An intent for this preference will be populated programmatically. -->
-        <PreferenceScreen
-                android:key="choose_input_methods"
-                android:title="@string/choose_input_methods"
-                />
-
         <PreferenceScreen
                 android:key="current_input_method"
                 android:title="@string/current_input_method"
diff --git a/res/xml/sim_settings.xml b/res/xml/sim_settings.xml
index 105be2e..a36d524 100644
--- a/res/xml/sim_settings.xml
+++ b/res/xml/sim_settings.xml
@@ -27,8 +27,7 @@
 
         <com.android.settings.notification.DropDownPreference
             android:key="sim_cellular_data"
-            android:title="@string/cellular_data_title"
-            android:dialogTitle="@string/cellular_data_title" />
+            android:title="@string/cellular_data_title" />
 
         <com.android.settings.notification.DropDownPreference
             android:key="sim_calls"
@@ -36,8 +35,7 @@
 
         <com.android.settings.notification.DropDownPreference
             android:key="sim_sms"
-            android:title="@string/sms_messages_title"
-            android:dialogTitle="@string/sms_messages_title" />
+            android:title="@string/sms_messages_title" />
 
     </PreferenceCategory>
 
diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java
index b8864f3..d214df2 100644
--- a/src/com/android/settings/ApnSettings.java
+++ b/src/com/android/settings/ApnSettings.java
@@ -133,7 +133,9 @@
         mMobileStateFilter = new IntentFilter(
                 TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
 
-        setHasOptionsMenu(true);
+        if (!mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
+            setHasOptionsMenu(true);
+        }
     }
 
     @Override
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 11dc3c6..2cffe28 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -110,6 +110,7 @@
     private static final String DEBUG_APP_KEY = "debug_app";
     private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger";
     private static final String VERIFY_APPS_OVER_USB_KEY = "verify_apps_over_usb";
+    private static final String DEBUG_VIEW_ATTRIBUTES =  "debug_view_attributes";
     private static final String STRICT_MODE_KEY = "strict_mode";
     private static final String POINTER_LOCATION_KEY = "pointer_location";
     private static final String SHOW_TOUCHES_KEY = "show_touches";
@@ -187,6 +188,7 @@
     private CheckBoxPreference mBtHciSnoopLog;
     private CheckBoxPreference mEnableOemUnlock;
     private CheckBoxPreference mAllowMockLocation;
+    private CheckBoxPreference mDebugViewAttributes;
 
     private PreferenceScreen mPassword;
     private String mDebugApp;
@@ -295,6 +297,7 @@
             mEnableOemUnlock = null;
         }
         mAllowMockLocation = findAndInitCheckboxPref(ALLOW_MOCK_LOCATION);
+        mDebugViewAttributes = findAndInitCheckboxPref(DEBUG_VIEW_ATTRIBUTES);
         mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
         mAllPrefs.add(mPassword);
 
@@ -513,6 +516,8 @@
         }
         updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr,
                 Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
+        updateCheckBox(mDebugViewAttributes, Settings.Global.getInt(cr,
+                Settings.Global.DEBUG_VIEW_ATTRIBUTES, 0) != 0);
         updateHdcpValues();
         updatePasswordSummary();
         updateDebuggerOptions();
@@ -1019,7 +1024,7 @@
     private void writeUSBAudioOptions() {
         Settings.Secure.putInt(getContentResolver(),
                 Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED,
-                    mUSBAudio.isChecked() ? 1 : 0);
+                mUSBAudio.isChecked() ? 1 : 0);
     }
 
     private void updateForceRtlOptions() {
@@ -1380,6 +1385,10 @@
             Settings.Secure.putInt(getActivity().getContentResolver(),
                     Settings.Secure.ALLOW_MOCK_LOCATION,
                     mAllowMockLocation.isChecked() ? 1 : 0);
+        } else if (preference == mDebugViewAttributes) {
+            Settings.Global.putInt(getActivity().getContentResolver(),
+                    Settings.Global.DEBUG_VIEW_ATTRIBUTES,
+                    mDebugViewAttributes.isChecked() ? 1 : 0);
         } else if (preference == mDebugAppPref) {
             startActivityForResult(new Intent(getActivity(), AppPicker.class), RESULT_DEBUG_APP);
         } else if (preference == mWaitForDebugger) {
diff --git a/src/com/android/settings/ManagedProfileSetup.java b/src/com/android/settings/ManagedProfileSetup.java
index 1b3c838..198abe0 100644
--- a/src/com/android/settings/ManagedProfileSetup.java
+++ b/src/com/android/settings/ManagedProfileSetup.java
@@ -22,6 +22,7 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.util.Log;
 import android.os.UserHandle;
 import android.os.UserManager;
 
@@ -37,6 +38,7 @@
  * adds cross-profile intent filters for the appropriate Settings activities).
  */
 public class ManagedProfileSetup extends BroadcastReceiver {
+    private static final String TAG = "Settings";
     private static final String PRIMARY_PROFILE_SETTING =
             "com.android.settings.PRIMARY_PROFILE_CONTROLLED";
 
@@ -46,7 +48,8 @@
         if (!Utils.isManagedProfile(um)) {
             return;
         }
-
+        Log.i(TAG, "Received broadcast: " + broadcast.getAction()
+                + ". Setting up intent forwarding for managed profile.");
         final PackageManager pm  = context.getPackageManager();
         // Clear any previous intent forwarding we set up
         pm.clearCrossProfileIntentFilters(UserHandle.myUserId());
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index e88c0fc..4fb166a 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -774,17 +774,24 @@
             DialogInterface.OnClickListener onConfirmListener) {
         UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
         UserInfo userInfo = um.getUserInfo(removingUserId);
+        int titleResId;
+        int messageResId;
+        if (UserHandle.myUserId() == removingUserId) {
+            titleResId = R.string.user_confirm_remove_self_title;
+            messageResId = R.string.user_confirm_remove_self_message;
+        } else if (userInfo.isRestricted()) {
+            titleResId = R.string.user_profile_confirm_remove_title;
+            messageResId = R.string.user_profile_confirm_remove_message;
+        } else if (userInfo.isManagedProfile()) {
+            titleResId = R.string.work_profile_confirm_remove_title;
+            messageResId = R.string.work_profile_confirm_remove_message;
+        } else {
+            titleResId = R.string.user_confirm_remove_title;
+            messageResId = R.string.user_confirm_remove_message;
+        }
         Dialog dlg = new AlertDialog.Builder(context)
-                .setTitle(UserHandle.myUserId() == removingUserId
-                    ? R.string.user_confirm_remove_self_title
-                    : (userInfo.isRestricted()
-                        ? R.string.user_profile_confirm_remove_title
-                        : R.string.user_confirm_remove_title))
-                .setMessage(UserHandle.myUserId() == removingUserId
-                    ? R.string.user_confirm_remove_self_message
-                    : (userInfo.isRestricted()
-                        ? R.string.user_profile_confirm_remove_message
-                        : R.string.user_confirm_remove_message))
+                .setTitle(titleResId)
+                .setMessage(messageResId)
                 .setPositiveButton(R.string.user_delete_button,
                         onConfirmListener)
                 .setNegativeButton(android.R.string.cancel, null)
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index b256f94..ce3164d 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -129,9 +129,13 @@
         if (mTm.hasIccCard() && (ni != null)) {
             // Check for carrier apps that can handle provisioning first
             Intent provisioningIntent = new Intent(TelephonyIntents.ACTION_CARRIER_SETUP);
-            provisioningIntent.addCategory(TelephonyIntents.CATEGORY_MCCMNC_PREFIX
-                    + mTm.getSimOperator());
-            if (mPm.resolveActivity(provisioningIntent, 0 /* flags */) != null) {
+            List<String> carrierPackages =
+                    mTm.getCarrierPackageNamesForBroadcastIntent(provisioningIntent);
+            if (carrierPackages != null && !carrierPackages.isEmpty()) {
+                if (carrierPackages.size() != 1) {
+                    Log.w(TAG, "Multiple matching carrier apps found, launching the first.");
+                }
+                provisioningIntent.setPackage(carrierPackages.get(0));
                 startActivity(provisioningIntent);
                 return;
             }
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 36025a6..eff5fb6 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -18,6 +18,7 @@
 
 import android.accessibilityservice.AccessibilityServiceInfo;
 import android.app.ActivityManagerNative;
+import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.pm.PackageManager;
@@ -28,6 +29,7 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.RemoteException;
+import android.os.UserHandle;
 import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
@@ -197,11 +199,15 @@
 
     private int mLongPressTimeoutDefault;
 
+    private DevicePolicyManager mDpm;
+
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         addPreferencesFromResource(R.xml.accessibility_settings);
         initializeAllPreferences();
+        mDpm = (DevicePolicyManager) (getActivity()
+                .getSystemService(Context.DEVICE_POLICY_SERVICE));
     }
 
     @Override
@@ -434,7 +440,8 @@
                 accessibilityManager.getInstalledAccessibilityServiceList();
         Set<ComponentName> enabledServices = AccessibilityUtils.getEnabledServicesFromSettings(
                 getActivity());
-
+        List<String> permittedServices = mDpm.getPermittedAccessibilityServices(
+                UserHandle.myUserId());
         final boolean accessibilityEnabled = Settings.Secure.getInt(getContentResolver(),
                 Settings.Secure.ACCESSIBILITY_ENABLED, 0) == 1;
 
@@ -454,12 +461,27 @@
             preference.setTitle(title);
             final boolean serviceEnabled = accessibilityEnabled
                     && enabledServices.contains(componentName);
+            String serviceEnabledString;
             if (serviceEnabled) {
-                preference.setSummary(getString(R.string.accessibility_feature_state_on));
+                serviceEnabledString = getString(R.string.accessibility_feature_state_on);
             } else {
-                preference.setSummary(getString(R.string.accessibility_feature_state_off));
+                serviceEnabledString = getString(R.string.accessibility_feature_state_off);
             }
 
+            // Disable all accessibility services that are not permitted.
+            String packageName = serviceInfo.packageName;
+            boolean serviceAllowed =
+                    permittedServices == null || permittedServices.contains(packageName);
+            preference.setEnabled(serviceAllowed || serviceEnabled);
+
+            String summaryString;
+            if (serviceAllowed) {
+                summaryString = serviceEnabledString;
+            } else  {
+                summaryString = getString(R.string.accessibility_feature_or_input_method_not_allowed);
+            }
+            preference.setSummary(summaryString);
+
             preference.setOrder(i);
             preference.setFragment(ToggleAccessibilityServicePreferenceFragment.class.getName());
             preference.setPersistent(true);
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 9fe70df..b23035b 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -55,10 +55,10 @@
                 getActivity());
         setPreferenceScreen(preferenceScreen);
         mSummaryPreference = new Preference(getActivity()) {
-                @Override
+            @Override
             protected void onBindView(View view) {
                 super.onBindView(view);
-                TextView summaryView = (TextView) view.findViewById(R.id.summary);
+                final TextView summaryView = (TextView) view.findViewById(android.R.id.summary);
                 summaryView.setText(getSummary());
                 sendAccessibilityEvent(summaryView);
             }
diff --git a/src/com/android/settings/accounts/AccountSettings.java b/src/com/android/settings/accounts/AccountSettings.java
index 2eb89b0..891fdbb 100644
--- a/src/com/android/settings/accounts/AccountSettings.java
+++ b/src/com/android/settings/accounts/AccountSettings.java
@@ -137,7 +137,7 @@
                             currentProfile.getIdentifier()));
             menu.findItem(R.id.account_settings_menu_auto_sync_personal).setVisible(false);
             menu.findItem(R.id.account_settings_menu_auto_sync_work).setVisible(false);
-        } else {
+        } else if (mProfiles.size() > 1) {
             // We assume there's only one managed profile, otherwise UI needs to change
             final UserHandle managedProfile = mProfiles.valueAt(1).userInfo.getUserHandle();
 
@@ -152,6 +152,8 @@
                     .setChecked(ContentResolver.getMasterSyncAutomaticallyAsUser(
                             managedProfile.getIdentifier()));
             menu.findItem(R.id.account_settings_menu_auto_sync).setVisible(false);
+         } else {
+             Log.w(TAG, "Method onPrepareOptionsMenu called before mProfiles was initialized");
          }
     }
 
diff --git a/src/com/android/settings/applications/AppOpsState.java b/src/com/android/settings/applications/AppOpsState.java
index 75a8372..580c44e 100644
--- a/src/com/android/settings/applications/AppOpsState.java
+++ b/src/com/android/settings/applications/AppOpsState.java
@@ -190,13 +190,15 @@
                     AppOpsManager.OP_WRITE_SETTINGS,
                     AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
                     AppOpsManager.OP_WAKE_LOCK,
-                    AppOpsManager.OP_PROJECT_MEDIA },
+                    AppOpsManager.OP_PROJECT_MEDIA,
+                    AppOpsManager.OP_ACTIVATE_VPN, },
             new boolean[] { false,
                     true,
                     true,
                     true,
                     true,
                     true,
+                    false,
                     false, }
             );
 
diff --git a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
index e8bad0c..eca0cca 100644
--- a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
@@ -318,6 +318,6 @@
                 return R.drawable.ic_bt_headset_hfp;
             }
         }
-        return 0;
+        return R.drawable.ic_settings_bluetooth2;
     }
 }
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 3c62ba9..8ea680f 100755
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -230,10 +230,19 @@
     }
 
     private void startScanning() {
-        if (isUiRestricted()) return;
+        if (isUiRestricted()) {
+            return;
+        }
+
         if (!mAvailableDevicesCategoryIsPresent) {
             getPreferenceScreen().addPreference(mAvailableDevicesCategory);
         }
+
+        if (mAvailableDevicesCategory != null) {
+            setDeviceListGroup(mAvailableDevicesCategory);
+            removeAllDevices();
+        }
+
         mLocalManager.getCachedDeviceManager().clearCachedDevices();
         mAvailableDevicesCategory.removeAll();
         mLocalAdapter.startScanning(true);
diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
index ea43bad..64c807f 100755
--- a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
+++ b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
@@ -58,8 +58,6 @@
     private static final String KEY_UNPAIR = "unpair";
     private static final String KEY_PBAP_SERVER = "PBAP Server";
 
-    public static final String EXTRA_DEVICE = "device";
-
     private CachedBluetoothDevice mCachedDevice;
     private LocalBluetoothManager mManager;
     private LocalBluetoothProfileManager mProfileManager;
@@ -102,7 +100,6 @@
     @Override
     public void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
-        outState.putParcelable(EXTRA_DEVICE, mCachedDevice.getDevice());
     }
 
     @Override
@@ -135,8 +132,10 @@
         mCachedDevice = cachedDevice;
 
         mCachedDevice.registerCallback(this);
-        addPreferencesForProfiles();
-        refresh();
+        if (isResumed()) {
+            addPreferencesForProfiles();
+            refresh();
+        }
     }
 
     private void addPreferencesForProfiles() {
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index 3528c56..d0bc0cc 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -18,6 +18,7 @@
 
 import android.app.Activity;
 import android.app.Fragment;
+import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
@@ -34,6 +35,7 @@
 import android.hardware.input.KeyboardLayout;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.UserHandle;
 import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
@@ -80,7 +82,6 @@
         InputMethodPreference.OnSavePreferenceListener {
     private static final String KEY_SPELL_CHECKERS = "spellcheckers_settings";
     private static final String KEY_PHONE_LANGUAGE = "phone_language";
-    private static final String KEY_CHOOSE_INPUT_METHODS = "choose_input_methods";
     private static final String KEY_CURRENT_INPUT_METHOD = "current_input_method";
     private static final String KEY_INPUT_METHOD_SELECTOR = "input_method_selector";
     private static final String KEY_USER_DICTIONARY_SETTINGS = "key_user_dictionary_settings";
@@ -103,6 +104,7 @@
     private SettingsObserver mSettingsObserver;
     private Intent mIntentWaitingForResult;
     private InputMethodSettingValuesWrapper mInputMethodSettingValues;
+    private DevicePolicyManager mDpm;
 
     @Override
     public void onCreate(Bundle icicle) {
@@ -154,14 +156,6 @@
             }
             mKeyboardSettingsCategory.removeAll();
             getPreferenceScreen().addPreference(mKeyboardSettingsCategory);
-        } else {
-            final Preference pref = findPreference(KEY_CHOOSE_INPUT_METHODS);
-            final Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS);
-            intent.setClass(activity, SubSettings.class);
-            intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, getClass().getName());
-            intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID,
-                    R.string.choose_input_methods);
-            pref.setIntent(intent);
         }
 
         // Build hard keyboard and game controller preference categories.
@@ -184,6 +178,8 @@
 
         mHandler = new Handler();
         mSettingsObserver = new SettingsObserver(mHandler, activity);
+        mDpm = (DevicePolicyManager) (getActivity().
+                getSystemService(Context.DEVICE_POLICY_SERVICE));
     }
 
     private void updateInputMethodSelectorSummary(int value) {
@@ -412,6 +408,7 @@
                 mKeyboardSettingsCategory.removePreference(pref);
             }
             mInputMethodPreferenceList.clear();
+            List<String> permittedList = mDpm.getPermittedInputMethodsForCurrentUser();
             final Context context = getActivity();
             final List<InputMethodInfo> imis = mShowsOnlyFullImeAndKeyboardList
                     ? mInputMethodSettingValues.getInputMethodList()
@@ -419,8 +416,11 @@
             final int N = (imis == null ? 0 : imis.size());
             for (int i = 0; i < N; ++i) {
                 final InputMethodInfo imi = imis.get(i);
+                final boolean isAllowedByOrganization = permittedList == null
+                        || permittedList.contains(imi.getPackageName());
                 final InputMethodPreference pref = new InputMethodPreference(
-                        context, imi, mShowsOnlyFullImeAndKeyboardList /* hasSwitch */, this);
+                        context, imi, mShowsOnlyFullImeAndKeyboardList /* hasSwitch */,
+                        isAllowedByOrganization, this);
                 mInputMethodPreferenceList.add(pref);
             }
             final Collator collator = Collator.getInstance();
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java
index 111f79b..5cf5d6a 100755
--- a/src/com/android/settings/inputmethod/InputMethodPreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodPreference.java
@@ -68,6 +68,7 @@
     private final boolean mHasPriorityInSorting;
     private final OnSavePreferenceListener mOnSaveListener;
     private final InputMethodSettingValuesWrapper mInputMethodSettingValues;
+    private final boolean mIsAllowedByOrganization;
 
     private AlertDialog mDialog = null;
 
@@ -78,14 +79,18 @@
      * @param imi The {@link InputMethodInfo} of this preference.
      * @param isImeEnabler true if this preference is the IME enabler that has enable/disable
      *     switches for all available IMEs, not the list of enabled IMEs.
+     * @param isAllowedByOrganization false if the IME has been disabled by a device or profile
+           owner.
      * @param onSaveListener The listener called when this preference has been changed and needs
      *     to save the state to shared preference.
      */
     InputMethodPreference(final Context context, final InputMethodInfo imi,
-            final boolean isImeEnabler, final OnSavePreferenceListener onSaveListener) {
+            final boolean isImeEnabler, final boolean isAllowedByOrganization,
+            final OnSavePreferenceListener onSaveListener) {
         super(context);
         setPersistent(false);
         mImi = imi;
+        mIsAllowedByOrganization = isAllowedByOrganization;
         mOnSaveListener = onSaveListener;
         if (!isImeEnabler) {
             // Hide switch widget.
@@ -178,7 +183,7 @@
                 mImi, getContext());
         // Only when this preference has a switch and an input method should be always enabled,
         // this preference should be disabled to prevent accidentally disabling an input method.
-        setEnabled(!(isAlwaysChecked && isImeEnabler()));
+        setEnabled(!((isAlwaysChecked && isImeEnabler()) || (!mIsAllowedByOrganization)));
         setChecked(mInputMethodSettingValues.isEnabledImi(mImi));
         setSummary(getSummaryString());
     }
@@ -189,6 +194,9 @@
 
     private String getSummaryString() {
         final Context context = getContext();
+        if (!mIsAllowedByOrganization) {
+            return context.getString(R.string.accessibility_feature_or_input_method_not_allowed);
+        }
         final InputMethodManager imm = getInputMethodManager();
         final List<InputMethodSubtype> subtypes = imm.getEnabledInputMethodSubtypeList(mImi, true);
         final ArrayList<CharSequence> subtypeLabels = new ArrayList<>();
diff --git a/src/com/android/settings/location/DimmableIconPreference.java b/src/com/android/settings/location/DimmableIconPreference.java
new file mode 100644
index 0000000..acde1c1
--- /dev/null
+++ b/src/com/android/settings/location/DimmableIconPreference.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.android.settings.location;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.preference.Preference;
+import android.util.AttributeSet;
+
+/**
+ * A preference item that can dim the icon when it's disabled, either directly or because its parent
+ * is disabled.
+ */
+public class DimmableIconPreference extends Preference {
+    private static final int ICON_ALPHA_ENABLED = 255;
+    private static final int ICON_ALPHA_DISABLED = 102;
+
+    public DimmableIconPreference(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    public DimmableIconPreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public DimmableIconPreference(Context context) {
+        super(context);
+    }
+
+    private void dimIcon(boolean dimmed) {
+        Drawable icon = getIcon();
+        if (icon != null) {
+            icon.mutate().setAlpha(dimmed ? ICON_ALPHA_DISABLED : ICON_ALPHA_ENABLED);
+            setIcon(icon);
+        }
+    }
+
+    @Override
+    public void onParentChanged(Preference parent, boolean disableChild) {
+        dimIcon(disableChild);
+        super.onParentChanged(parent, disableChild);
+    }
+
+    @Override
+    public void setEnabled(boolean enabled) {
+        dimIcon(!enabled);
+        super.setEnabled(enabled);
+    }
+}
diff --git a/src/com/android/settings/location/InjectedSetting.java b/src/com/android/settings/location/InjectedSetting.java
index d8a3f49..5f4440a 100644
--- a/src/com/android/settings/location/InjectedSetting.java
+++ b/src/com/android/settings/location/InjectedSetting.java
@@ -23,7 +23,7 @@
 import com.android.internal.util.Preconditions;
 
 /**
- * Specifies a setting that is being injected into Settings > Location > Location services.
+ * Specifies a setting that is being injected into Settings &gt; Location &gt; Location services.
  *
  * @see android.location.SettingInjectorService
  */
diff --git a/src/com/android/settings/location/RecentLocationApps.java b/src/com/android/settings/location/RecentLocationApps.java
index 7c59927..e28f96b 100644
--- a/src/com/android/settings/location/RecentLocationApps.java
+++ b/src/com/android/settings/location/RecentLocationApps.java
@@ -81,7 +81,7 @@
      * Subclass of {@link Preference} to intercept views and allow content description to be set on
      * them for accessibility purposes.
      */
-    private static class AccessiblePreference extends Preference {
+    private static class AccessiblePreference extends DimmableIconPreference {
         public CharSequence mContentDescription;
 
         public AccessiblePreference(Context context, CharSequence contentDescription) {
diff --git a/src/com/android/settings/location/SettingsInjector.java b/src/com/android/settings/location/SettingsInjector.java
index 5f8d030..edf67b8 100644
--- a/src/com/android/settings/location/SettingsInjector.java
+++ b/src/com/android/settings/location/SettingsInjector.java
@@ -247,7 +247,7 @@
      * Adds an injected setting to the root.
      */
     private Preference addServiceSetting(List<Preference> prefs, InjectedSetting info) {
-        Preference pref = new Preference(mContext);
+        Preference pref = new DimmableIconPreference(mContext);
         pref.setTitle(info.title);
         pref.setSummary(null);
         PackageManager pm = mContext.getPackageManager();
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 9ad34a9..726fc00 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -630,14 +630,14 @@
                 Dialog dlg = new AlertDialog.Builder(context)
                         .setTitle(R.string.user_exit_guest_confirm_title)
                         .setMessage(R.string.user_exit_guest_confirm_message)
-                        .setPositiveButton(android.R.string.yes,
+                        .setPositiveButton(R.string.user_exit_guest_dialog_remove,
                                 new DialogInterface.OnClickListener() {
                                     @Override
                                     public void onClick(DialogInterface dialog, int which) {
                                         exitGuest();
                                     }
                                 })
-                        .setNegativeButton(android.R.string.no, null)
+                        .setNegativeButton(android.R.string.cancel, null)
                         .create();
                 return dlg;
             }
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index d409764..ab84654 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -45,8 +45,10 @@
 import android.view.MenuItem;
 import android.view.View;
 import android.widget.AdapterView.AdapterContextMenuInfo;
+import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.ArrayAdapter;
 import android.widget.ListView;
+import android.widget.Spinner;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -56,7 +58,6 @@
 import com.android.internal.util.ArrayUtils;
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
-
 import com.google.android.collect.Lists;
 
 import java.util.ArrayList;
@@ -349,15 +350,6 @@
 
         if (preference instanceof VpnPreference) {
             VpnProfile profile = ((VpnPreference) preference).getProfile();
-            if (mInfo != null && profile.key.equals(mInfo.key) &&
-                    mInfo.state == LegacyVpnInfo.STATE_CONNECTED) {
-                try {
-                    mInfo.intent.send();
-                    return true;
-                } catch (Exception e) {
-                    // ignore
-                }
-            }
             mDialog = new VpnDialog(getActivity(), this, profile, false);
         } else {
             // Generate a new key. Here we just use the current time.
diff --git a/src/com/android/settings/widget/SwitchBar.java b/src/com/android/settings/widget/SwitchBar.java
index e24d83f..c15ac41 100644
--- a/src/com/android/settings/widget/SwitchBar.java
+++ b/src/com/android/settings/widget/SwitchBar.java
@@ -124,7 +124,7 @@
     public void setEnabled(boolean enabled) {
         super.setEnabled(enabled);
         mTextView.setEnabled(enabled);
-        mSwitch.setEnabled(false);
+        mSwitch.setEnabled(enabled);
     }
 
     public final ToggleSwitch getSwitch() {
diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java
index 3df4ece..0321e7f 100644
--- a/src/com/android/settings/wifi/AccessPoint.java
+++ b/src/com/android/settings/wifi/AccessPoint.java
@@ -456,7 +456,7 @@
                 if (result.seen == 0)
                     continue;
 
-                if (result.status != ScanResult.ENABLED)
+                if (result.autoJoinStatus != ScanResult.ENABLED)
                     numBlackListed++;
 
                 if (result.frequency > LOWER_FREQ_5GHZ
diff --git a/src/com/android/settings/wifi/AdvancedWifiSettings.java b/src/com/android/settings/wifi/AdvancedWifiSettings.java
index 236aecd..a57097b 100644
--- a/src/com/android/settings/wifi/AdvancedWifiSettings.java
+++ b/src/com/android/settings/wifi/AdvancedWifiSettings.java
@@ -135,7 +135,9 @@
             wifiAssistant.setOnPreferenceChangeListener(this);
             wifiAssistant.setChecked(checked);
         } else {
-            getPreferenceScreen().removePreference(wifiAssistant);
+            if (wifiAssistant != null) {
+                getPreferenceScreen().removePreference(wifiAssistant);
+            }
         }
 
         Intent wifiDirectIntent = new Intent(context,
diff --git a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
index a91d153..10c86dc 100644
--- a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
+++ b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
@@ -53,6 +53,9 @@
     private Bundle mAccessPointSavedState;
     private AccessPoint mSelectedAccessPoint;
 
+    // Instance state key
+    private static final String SAVE_DIALOG_ACCESS_POINT_STATE = "wifi_ap_state";
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -69,6 +72,13 @@
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
         mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
+
+        if (savedInstanceState != null) {
+            if (savedInstanceState.containsKey(SAVE_DIALOG_ACCESS_POINT_STATE)) {
+                mAccessPointSavedState =
+                    savedInstanceState.getBundle(SAVE_DIALOG_ACCESS_POINT_STATE);
+            }
+        }
     }
 
     private void initPreferences() {
@@ -150,6 +160,11 @@
     public Dialog onCreateDialog(int dialogId) {
         switch (dialogId) {
             case WifiSettings.WIFI_DIALOG_ID:
+                if (mDlgAccessPoint == null) { // For re-launch from saved state
+                    mDlgAccessPoint = new AccessPoint(getActivity(), mAccessPointSavedState);
+                    // Reset the saved access point data
+                    mAccessPointSavedState = null;
+                }
                 mSelectedAccessPoint = mDlgAccessPoint;
                 mDialog = new WifiDialog(getActivity(), this, mDlgAccessPoint, false);
                 return mDialog;
@@ -159,6 +174,20 @@
     }
 
     @Override
+    public void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+
+        // If the dialog is showing, save its state.
+        if (mDialog != null && mDialog.isShowing()) {
+            if (mDlgAccessPoint != null) {
+                mAccessPointSavedState = new Bundle();
+                mDlgAccessPoint.saveWifiState(mAccessPointSavedState);
+                outState.putBundle(SAVE_DIALOG_ACCESS_POINT_STATE, mAccessPointSavedState);
+            }
+        }
+    }
+
+    @Override
     public void onClick(DialogInterface dialogInterface, int button) {
         if (button == WifiDialog.BUTTON_FORGET && mSelectedAccessPoint != null) {
             mWifiManager.forget(mSelectedAccessPoint.networkId, null);
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index fc2276a..3b07b9f 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -24,11 +24,11 @@
 import android.net.IpConfiguration.IpAssignment;
 import android.net.IpConfiguration.ProxySettings;
 import android.net.LinkAddress;
-import android.net.LinkProperties;
 import android.net.NetworkInfo.DetailedState;
 import android.net.NetworkUtils;
 import android.net.ProxyInfo;
 import android.net.RouteInfo;
+import android.net.StaticIpConfiguration;
 import android.net.Uri;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiConfiguration.AuthAlgorithm;
@@ -61,6 +61,7 @@
 import com.android.settings.R;
 
 import java.net.InetAddress;
+import java.net.Inet4Address;
 import java.util.Iterator;
 
 /**
@@ -137,7 +138,8 @@
 
     private IpAssignment mIpAssignment = IpAssignment.UNASSIGNED;
     private ProxySettings mProxySettings = ProxySettings.UNASSIGNED;
-    private LinkProperties mLinkProperties = new LinkProperties();
+    private ProxyInfo mHttpProxy = null;
+    private StaticIpConfiguration mStaticIpConfiguration = null;
 
     private String[] mLevels;
     private boolean mEdit;
@@ -216,13 +218,15 @@
                 if (config.getIpAssignment() == IpAssignment.STATIC) {
                     mIpSettingsSpinner.setSelection(STATIC_IP);
                     showAdvancedFields = true;
+                    // Display IP address.
+                    StaticIpConfiguration staticConfig = config.getStaticIpConfiguration();
+                    if (staticConfig != null && staticConfig.ipAddress != null) {
+                        addRow(group, R.string.wifi_ip_address,
+                           staticConfig.ipAddress.getAddress().getHostAddress());
+                    }
                 } else {
                     mIpSettingsSpinner.setSelection(DHCP);
                 }
-                //Display IP addresses
-                for(InetAddress a : config.getLinkProperties().getAddresses()) {
-                    addRow(group, R.string.wifi_ip_address, a.getHostAddress());
-                }
 
 
                 if (config.getProxySettings() == ProxySettings.STATIC) {
@@ -462,19 +466,20 @@
         }
 
         config.setIpConfiguration(
-                new IpConfiguration(mIpAssignment, mProxySettings, mLinkProperties));
+                new IpConfiguration(mIpAssignment, mProxySettings,
+                                    mStaticIpConfiguration, mHttpProxy));
 
         return config;
     }
 
     private boolean ipAndProxyFieldsAreValid() {
-        mLinkProperties.clear();
         mIpAssignment = (mIpSettingsSpinner != null &&
                 mIpSettingsSpinner.getSelectedItemPosition() == STATIC_IP) ?
                 IpAssignment.STATIC : IpAssignment.DHCP;
 
         if (mIpAssignment == IpAssignment.STATIC) {
-            int result = validateIpConfigFields(mLinkProperties);
+            mStaticIpConfiguration = new StaticIpConfiguration();
+            int result = validateIpConfigFields(mStaticIpConfiguration);
             if (result != 0) {
                 return false;
             }
@@ -482,6 +487,7 @@
 
         final int selectedPosition = mProxySettingsSpinner.getSelectedItemPosition();
         mProxySettings = ProxySettings.NONE;
+        mHttpProxy = null;
         if (selectedPosition == PROXY_STATIC && mProxyHostView != null) {
             mProxySettings = ProxySettings.STATIC;
             String host = mProxyHostView.getText().toString();
@@ -496,8 +502,7 @@
                 result = R.string.proxy_error_invalid_port;
             }
             if (result == 0) {
-                ProxyInfo proxyProperties= new ProxyInfo(host, port, exclusionList);
-                mLinkProperties.setHttpProxy(proxyProperties);
+                mHttpProxy = new ProxyInfo(host, port, exclusionList);
             } else {
                 return false;
             }
@@ -511,22 +516,27 @@
             if (uri == null) {
                 return false;
             }
-            ProxyInfo proxyInfo = new ProxyInfo(uri);
-            mLinkProperties.setHttpProxy(proxyInfo);
+            mHttpProxy = new ProxyInfo(uri);
         }
         return true;
     }
 
-    private int validateIpConfigFields(LinkProperties linkProperties) {
+    private Inet4Address getIPv4Address(String text) {
+        try {
+            return (Inet4Address) NetworkUtils.numericToInetAddress(text);
+        } catch (IllegalArgumentException|ClassCastException e) {
+            return null;
+        }
+    }
+
+    private int validateIpConfigFields(StaticIpConfiguration staticIpConfiguration) {
         if (mIpAddressView == null) return 0;
 
         String ipAddr = mIpAddressView.getText().toString();
         if (TextUtils.isEmpty(ipAddr)) return R.string.wifi_ip_settings_invalid_ip_address;
 
-        InetAddress inetAddr = null;
-        try {
-            inetAddr = NetworkUtils.numericToInetAddress(ipAddr);
-        } catch (IllegalArgumentException e) {
+        Inet4Address inetAddr = getIPv4Address(ipAddr);
+        if (inetAddr == null) {
             return R.string.wifi_ip_settings_invalid_ip_address;
         }
 
@@ -536,7 +546,7 @@
             if (networkPrefixLength < 0 || networkPrefixLength > 32) {
                 return R.string.wifi_ip_settings_invalid_network_prefix_length;
             }
-            linkProperties.addLinkAddress(new LinkAddress(inetAddr, networkPrefixLength));
+            staticIpConfiguration.ipAddress = new LinkAddress(inetAddr, networkPrefixLength);
         } catch (NumberFormatException e) {
             // Set the hint as default after user types in ip address
             mNetworkPrefixLengthView.setText(mConfigUi.getContext().getString(
@@ -555,13 +565,11 @@
             } catch (java.net.UnknownHostException u) {
             }
         } else {
-            InetAddress gatewayAddr = null;
-            try {
-                gatewayAddr = NetworkUtils.numericToInetAddress(gateway);
-            } catch (IllegalArgumentException e) {
+            InetAddress gatewayAddr = getIPv4Address(gateway);
+            if (gatewayAddr == null) {
                 return R.string.wifi_ip_settings_invalid_gateway;
             }
-            linkProperties.addRoute(new RouteInfo(gatewayAddr));
+            staticIpConfiguration.gateway = gatewayAddr;
         }
 
         String dns = mDns1View.getText().toString();
@@ -571,22 +579,20 @@
             //If everything else is valid, provide hint as a default option
             mDns1View.setText(mConfigUi.getContext().getString(R.string.wifi_dns1_hint));
         } else {
-            try {
-                dnsAddr = NetworkUtils.numericToInetAddress(dns);
-            } catch (IllegalArgumentException e) {
+            dnsAddr = getIPv4Address(dns);
+            if (dnsAddr == null) {
                 return R.string.wifi_ip_settings_invalid_dns;
             }
-            linkProperties.addDnsServer(dnsAddr);
+            staticIpConfiguration.dnsServers.add(dnsAddr);
         }
 
         if (mDns2View.length() > 0) {
             dns = mDns2View.getText().toString();
-            try {
-                dnsAddr = NetworkUtils.numericToInetAddress(dns);
-            } catch (IllegalArgumentException e) {
+            dnsAddr = getIPv4Address(dns);
+            if (dnsAddr == null) {
                 return R.string.wifi_ip_settings_invalid_dns;
             }
-            linkProperties.addDnsServer(dnsAddr);
+            staticIpConfiguration.dnsServers.add(dnsAddr);
         }
         return 0;
     }
@@ -797,28 +803,26 @@
                 mDns2View.addTextChangedListener(this);
             }
             if (config != null) {
-                LinkProperties linkProperties = config.getLinkProperties();
-                Iterator<LinkAddress> iterator = linkProperties.getLinkAddresses().iterator();
-                if (iterator.hasNext()) {
-                    LinkAddress linkAddress = iterator.next();
-                    mIpAddressView.setText(linkAddress.getAddress().getHostAddress());
-                    mNetworkPrefixLengthView.setText(Integer.toString(linkAddress
-                            .getNetworkPrefixLength()));
-                }
-
-                for (RouteInfo route : linkProperties.getRoutes()) {
-                    if (route.isDefaultRoute()) {
-                        mGatewayView.setText(route.getGateway().getHostAddress());
-                        break;
+                StaticIpConfiguration staticConfig = config.getStaticIpConfiguration();
+                if (staticConfig != null) {
+                    if (staticConfig.ipAddress != null) {
+                        mIpAddressView.setText(
+                                staticConfig.ipAddress.getAddress().getHostAddress());
+                        mNetworkPrefixLengthView.setText(Integer.toString(staticConfig.ipAddress
+                                .getNetworkPrefixLength()));
                     }
-                }
 
-                Iterator<InetAddress> dnsIterator = linkProperties.getDnsServers().iterator();
-                if (dnsIterator.hasNext()) {
-                    mDns1View.setText(dnsIterator.next().getHostAddress());
-                }
-                if (dnsIterator.hasNext()) {
-                    mDns2View.setText(dnsIterator.next().getHostAddress());
+                    if (staticConfig.gateway != null) {
+                        mGatewayView.setText(staticConfig.gateway.getHostAddress());
+                    }
+
+                    Iterator<InetAddress> dnsIterator = staticConfig.dnsServers.iterator();
+                    if (dnsIterator.hasNext()) {
+                        mDns1View.setText(dnsIterator.next().getHostAddress());
+                    }
+                    if (dnsIterator.hasNext()) {
+                        mDns2View.setText(dnsIterator.next().getHostAddress());
+                    }
                 }
             }
         } else {
@@ -848,7 +852,7 @@
                 mProxyExclusionListView.addTextChangedListener(this);
             }
             if (config != null) {
-                ProxyInfo proxyProperties = config.getLinkProperties().getHttpProxy();
+                ProxyInfo proxyProperties = config.getHttpProxy();
                 if (proxyProperties != null) {
                     mProxyHostView.setText(proxyProperties.getHost());
                     mProxyPortView.setText(Integer.toString(proxyProperties.getPort()));
@@ -865,7 +869,7 @@
                 mProxyPacView.addTextChangedListener(this);
             }
             if (config != null) {
-                ProxyInfo proxyInfo = config.getLinkProperties().getHttpProxy();
+                ProxyInfo proxyInfo = config.getHttpProxy();
                 if (proxyInfo != null) {
                     mProxyPacView.setText(proxyInfo.getPacFileUrl().toString());
                 }
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 5366d66..1503f22 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -41,10 +41,10 @@
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
 import android.net.wifi.WpsInfo;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import android.os.Parcelable;
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
 import android.util.Log;
@@ -101,12 +101,7 @@
     private static final int MENU_ID_MODIFY = Menu.FIRST + 8;
     private static final int MENU_ID_WRITE_NFC = Menu.FIRST + 9;
 
-    private static final String KEY_ASSISTANT_DISMISS_TIME = "wifi_assistant_dismiss_time";
-    private static final String KEY_ASSISTANT_START_TIME = "wifi_assistant_start_time";
-
-    private static final long MILI_SECONDS_30_DAYS = 30L * 24L * 60L * 60L * 1000L;
-    private static final long MILI_SECONDS_90_DAYS = MILI_SECONDS_30_DAYS * 3L;
-    private static final long MILI_SECONDS_180_DAYS = MILI_SECONDS_90_DAYS * 2L;
+    private static final String KEY_ASSISTANT_DISMISS_PLATFORM = "wifi_assistant_dismiss_platform";
 
     public static final int WIFI_DIALOG_ID = 1;
     /* package */ static final int WPS_PBC_DIALOG_ID = 2;
@@ -336,7 +331,7 @@
     public void onActivityResult(int requestCode, int resultCode, Intent resultData) {
         if (requestCode == REQUEST_ENABLE_WIFI_ASSISTANT) {
             if (resultCode == Activity.RESULT_OK) {
-                setWifiAssistantTimeout();
+                disableWifiAssistantCardUntilPlatformUpgrade();
                 getListView().removeHeaderView(mWifiAssistantCard);
                 mWifiAssistantApp = null;
             }
@@ -720,10 +715,11 @@
         }
 
         SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences();
-        long lastTimeoutEndTime = sharedPreferences.getLong(KEY_ASSISTANT_START_TIME, 0);
-        long dismissTime = sharedPreferences.getLong(KEY_ASSISTANT_DISMISS_TIME, 0);
+        int lastDismissPlatform = sharedPreferences.getInt(KEY_ASSISTANT_DISMISS_PLATFORM, 0);
 
-        if ((System.currentTimeMillis() - lastTimeoutEndTime) <= dismissTime) {
+        if (Build.VERSION.SDK_INT <= lastDismissPlatform) {
+            // User has dismissed the Wi-Fi assistant card on this SDK release. Suppress the card
+            // until the next major platform upgrade.
             return;
         }
 
@@ -761,7 +757,7 @@
                 noThanks.setOnClickListener(new OnClickListener() {
                     @Override
                     public void onClick(View v) {
-                        setWifiAssistantTimeout();
+                        disableWifiAssistantCardUntilPlatformUpgrade();
                         getListView().removeHeaderView(mWifiAssistantCard);
                         mWifiAssistantApp = null;
                     }
@@ -770,23 +766,10 @@
         }
     }
 
-    private void setWifiAssistantTimeout() {
+    private void disableWifiAssistantCardUntilPlatformUpgrade() {
         SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences();
         SharedPreferences.Editor editor = sharedPreferences.edit();
-        long dismissTime = sharedPreferences.getLong(KEY_ASSISTANT_DISMISS_TIME, 0);
-
-        if (dismissTime == 0) {
-            dismissTime = MILI_SECONDS_30_DAYS;
-        } else if (dismissTime == MILI_SECONDS_30_DAYS) {
-            dismissTime = MILI_SECONDS_90_DAYS;
-        } else if (dismissTime == MILI_SECONDS_90_DAYS) {
-            dismissTime = MILI_SECONDS_180_DAYS;
-        } else if (dismissTime == MILI_SECONDS_180_DAYS) {
-            dismissTime = java.lang.Long.MAX_VALUE;
-        }
-
-        editor.putLong(KEY_ASSISTANT_DISMISS_TIME, dismissTime);
-        editor.putLong(KEY_ASSISTANT_START_TIME, System.currentTimeMillis());
+        editor.putLong(KEY_ASSISTANT_DISMISS_PLATFORM, Build.VERSION.SDK_INT);
         editor.apply();
     }