Merge "Guard against callbacks when no list view created" into mnc-dev
diff --git a/res/color/storage_wizard_button.xml b/res/color/storage_wizard_button.xml
new file mode 100644
index 0000000..38c7d52
--- /dev/null
+++ b/res/color/storage_wizard_button.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_enabled="false"
+          android:alpha="?android:attr/disabledAlpha"
+          android:color="?android:attr/colorAccent" />
+    <item android:color="?android:attr/colorAccent" />
+</selector>
diff --git a/res/color/storage_wizard_button_red.xml b/res/color/storage_wizard_button_red.xml
new file mode 100644
index 0000000..9e9a908
--- /dev/null
+++ b/res/color/storage_wizard_button_red.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_enabled="false"
+          android:alpha="?android:attr/disabledAlpha"
+          android:color="#fff4511e" />
+    <item android:color="#fff4511e" />
+</selector>
diff --git a/res/drawable-hdpi/bg_internal_storage_header.png b/res/drawable-hdpi/bg_internal_storage_header.png
new file mode 100644
index 0000000..ccb5951
--- /dev/null
+++ b/res/drawable-hdpi/bg_internal_storage_header.png
Binary files differ
diff --git a/res/drawable-hdpi/bg_portable_storage_header.png b/res/drawable-hdpi/bg_portable_storage_header.png
new file mode 100644
index 0000000..fa640f0
--- /dev/null
+++ b/res/drawable-hdpi/bg_portable_storage_header.png
Binary files differ
diff --git a/res/drawable-hdpi/bg_tile.png b/res/drawable-hdpi/bg_tile.png
new file mode 100644
index 0000000..0680c57
--- /dev/null
+++ b/res/drawable-hdpi/bg_tile.png
Binary files differ
diff --git a/res/drawable-mdpi/bg_internal_storage_header.png b/res/drawable-mdpi/bg_internal_storage_header.png
new file mode 100644
index 0000000..a4f263d
--- /dev/null
+++ b/res/drawable-mdpi/bg_internal_storage_header.png
Binary files differ
diff --git a/res/drawable-mdpi/bg_portable_storage_header.png b/res/drawable-mdpi/bg_portable_storage_header.png
new file mode 100644
index 0000000..9b21825
--- /dev/null
+++ b/res/drawable-mdpi/bg_portable_storage_header.png
Binary files differ
diff --git a/res/drawable-mdpi/bg_tile.png b/res/drawable-mdpi/bg_tile.png
new file mode 100644
index 0000000..bd361f0
--- /dev/null
+++ b/res/drawable-mdpi/bg_tile.png
Binary files differ
diff --git a/res/drawable-xhdpi/bg_internal_storage_header.png b/res/drawable-xhdpi/bg_internal_storage_header.png
new file mode 100644
index 0000000..289b31c
--- /dev/null
+++ b/res/drawable-xhdpi/bg_internal_storage_header.png
Binary files differ
diff --git a/res/drawable-xhdpi/bg_portable_storage_header.png b/res/drawable-xhdpi/bg_portable_storage_header.png
new file mode 100644
index 0000000..76154ff
--- /dev/null
+++ b/res/drawable-xhdpi/bg_portable_storage_header.png
Binary files differ
diff --git a/res/drawable-xhdpi/bg_tile.png b/res/drawable-xhdpi/bg_tile.png
new file mode 100644
index 0000000..dc5b24c
--- /dev/null
+++ b/res/drawable-xhdpi/bg_tile.png
Binary files differ
diff --git a/res/drawable-xxhdpi/bg_internal_storage_header.png b/res/drawable-xxhdpi/bg_internal_storage_header.png
new file mode 100644
index 0000000..ed01721
--- /dev/null
+++ b/res/drawable-xxhdpi/bg_internal_storage_header.png
Binary files differ
diff --git a/res/drawable-xxhdpi/bg_portable_storage_header.png b/res/drawable-xxhdpi/bg_portable_storage_header.png
new file mode 100644
index 0000000..df6b38e
--- /dev/null
+++ b/res/drawable-xxhdpi/bg_portable_storage_header.png
Binary files differ
diff --git a/res/drawable-xxhdpi/bg_tile.png b/res/drawable-xxhdpi/bg_tile.png
new file mode 100644
index 0000000..bf28300
--- /dev/null
+++ b/res/drawable-xxhdpi/bg_tile.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/bg_internal_storage_header.png b/res/drawable-xxxhdpi/bg_internal_storage_header.png
new file mode 100644
index 0000000..26cae96
--- /dev/null
+++ b/res/drawable-xxxhdpi/bg_internal_storage_header.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/bg_portable_storage_header.png b/res/drawable-xxxhdpi/bg_portable_storage_header.png
new file mode 100644
index 0000000..78003f8
--- /dev/null
+++ b/res/drawable-xxxhdpi/bg_portable_storage_header.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/bg_tile.png b/res/drawable-xxxhdpi/bg_tile.png
new file mode 100644
index 0000000..7d22170
--- /dev/null
+++ b/res/drawable-xxxhdpi/bg_tile.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/shortcut_base.png b/res/drawable-xxxhdpi/shortcut_base.png
index cd509df..c5fcae7 100644
--- a/res/drawable-xxxhdpi/shortcut_base.png
+++ b/res/drawable-xxxhdpi/shortcut_base.png
Binary files differ
diff --git a/res/drawable/ic_settings_sim.xml b/res/drawable/ic_settings_sim.xml
new file mode 100644
index 0000000..d2b9d2f
--- /dev/null
+++ b/res/drawable/ic_settings_sim.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_sim_sd"
+    android:tint="?android:attr/colorAccent" />
+
diff --git a/res/layout/bluetooth_pin_confirm.xml b/res/layout/bluetooth_pin_confirm.xml
index 08f5d9f..2968b38 100644
--- a/res/layout/bluetooth_pin_confirm.xml
+++ b/res/layout/bluetooth_pin_confirm.xml
@@ -86,16 +86,15 @@
             android:textColor="@*android:color/secondary_text_material_light"
             android:visibility="gone" />
 
-        <TextView
-            android:id="@+id/phonebook_sharing_message"
+        <CheckBox
+            android:id="@+id/phonebook_sharing_message_confirm_pin"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/bluetooth_dialog_padding"
             android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
-            android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
             android:gravity="center_vertical"
-            android:text="@string/bluetooth_pairing_will_share_phonebook"
-            android:textSize="12sp" />
+            android:text="@string/bluetooth_pairing_shares_phonebook"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
 
     </LinearLayout>
 
diff --git a/res/layout/bluetooth_pin_entry.xml b/res/layout/bluetooth_pin_entry.xml
index 6f50cd4..aa9f187 100644
--- a/res/layout/bluetooth_pin_entry.xml
+++ b/res/layout/bluetooth_pin_entry.xml
@@ -87,16 +87,15 @@
             android:textAppearance="@android:style/TextAppearance.Material.Subhead"
             android:textColor="@*android:color/secondary_text_material_light"/>
 
-        <TextView
-            android:id="@+id/phonebook_sharing_message"
+        <CheckBox
+            android:id="@+id/phonebook_sharing_message_entry_pin"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/bluetooth_dialog_padding"
             android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
-            android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
             android:gravity="center_vertical"
-            android:text="@string/bluetooth_pairing_will_share_phonebook"
-            android:textSize="12sp" />
+            android:text="@string/bluetooth_pairing_shares_phonebook"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
 
     </LinearLayout>
 
diff --git a/res/layout/preference_storage_action.xml b/res/layout/preference_storage_action.xml
index 19d7763..5a37871 100644
--- a/res/layout/preference_storage_action.xml
+++ b/res/layout/preference_storage_action.xml
@@ -30,6 +30,7 @@
         android:layout_gravity="center"
         android:gravity="center"
         android:src="@drawable/ic_eject_24dp"
+        android:tint="?android:attr/textColorSecondary"
         android:background="?android:attr/selectableItemBackground" />
 
 </LinearLayout>
diff --git a/res/layout/shortcut_badge.xml b/res/layout/shortcut_badge.xml
index 117b386..28f8652 100644
--- a/res/layout/shortcut_badge.xml
+++ b/res/layout/shortcut_badge.xml
@@ -28,6 +28,7 @@
         android:id="@android:id/icon"
         android:layout_width="@dimen/shortcut_size"
         android:layout_height="@dimen/shortcut_size"
+        android:tint="@color/icon_accent"
         android:padding="12dp"
         android:scaleType="fitXY" />
 
diff --git a/res/layout/storage_summary.xml b/res/layout/storage_summary.xml
index cd63671..96a0cee 100644
--- a/res/layout/storage_summary.xml
+++ b/res/layout/storage_summary.xml
@@ -44,7 +44,7 @@
         android:layout_height="wrap_content"
         android:textAlignment="viewStart"
         android:textAppearance="@android:style/TextAppearance.Material.Body1"
-        android:textColor="#8a000000"
+        android:textColor="?android:attr/textColorSecondaryNoDisable"
         android:maxLines="10" />
 
     <ProgressBar
diff --git a/res/layout/storage_wizard_generic.xml b/res/layout/storage_wizard_generic.xml
index 4f0cef9..6b5890a 100644
--- a/res/layout/storage_wizard_generic.xml
+++ b/res/layout/storage_wizard_generic.xml
@@ -20,9 +20,7 @@
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/illustration_tile"
-    app:suwIllustrationHorizontalTile="@drawable/illustration_horizontal"
-    app:suwIllustrationImage="@drawable/illustration_generic">
+    app:suwBackgroundTile="@drawable/bg_tile">
 
     <LinearLayout
         style="@style/SuwContentFrame"
diff --git a/res/layout/storage_wizard_init.xml b/res/layout/storage_wizard_init.xml
index 421477c..6b69dd6 100644
--- a/res/layout/storage_wizard_init.xml
+++ b/res/layout/storage_wizard_init.xml
@@ -20,11 +20,7 @@
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/illustration_tile"
-    app:suwIllustrationHorizontalTile="@drawable/illustration_horizontal"
-    app:suwIllustrationImage="@drawable/illustration_generic">
-
-    <!-- android:layout="@layout/suw_template_short" -->
+    app:suwBackgroundTile="@drawable/bg_tile">
 
     <LinearLayout
         style="@style/SuwContentFrame"
diff --git a/res/layout/storage_wizard_migrate.xml b/res/layout/storage_wizard_migrate.xml
index 827a5d2..d78f4f9 100644
--- a/res/layout/storage_wizard_migrate.xml
+++ b/res/layout/storage_wizard_migrate.xml
@@ -20,9 +20,7 @@
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/illustration_tile"
-    app:suwIllustrationHorizontalTile="@drawable/illustration_horizontal"
-    app:suwIllustrationImage="@drawable/illustration_generic">
+    app:suwBackgroundTile="@drawable/bg_tile">
 
     <LinearLayout
         style="@style/SuwContentFrame"
diff --git a/res/layout/storage_wizard_navigation.xml b/res/layout/storage_wizard_navigation.xml
new file mode 100644
index 0000000..94f9baf
--- /dev/null
+++ b/res/layout/storage_wizard_navigation.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/suw_layout_navigation_bar"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal">
+
+    <Button
+        android:id="@+id/suw_navbar_back"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:visibility="gone" />
+
+    <View
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_weight="1" />
+
+    <Button
+        android:id="@+id/suw_navbar_more"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:visibility="gone" />
+
+    <Button
+        android:id="@+id/suw_navbar_next"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        android:layout_marginBottom="16dp"
+        android:layout_marginEnd="16dp"
+        android:text="@string/wizard_next"
+        android:textColor="@android:color/white"
+        android:backgroundTint="@color/storage_wizard_button" />
+
+</LinearLayout>
diff --git a/res/layout/storage_wizard_progress.xml b/res/layout/storage_wizard_progress.xml
index 52fd203..114635d 100644
--- a/res/layout/storage_wizard_progress.xml
+++ b/res/layout/storage_wizard_progress.xml
@@ -20,9 +20,7 @@
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/illustration_tile"
-    app:suwIllustrationHorizontalTile="@drawable/illustration_horizontal"
-    app:suwIllustrationImage="@drawable/illustration_generic">
+    app:suwBackgroundTile="@drawable/bg_tile">
 
     <LinearLayout
         style="@style/SuwContentFrame"
diff --git a/res/layout/storage_wizard_ready.xml b/res/layout/storage_wizard_ready.xml
index 5cb2e33..83ad03c 100644
--- a/res/layout/storage_wizard_ready.xml
+++ b/res/layout/storage_wizard_ready.xml
@@ -20,9 +20,7 @@
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    app:suwBackgroundTile="@drawable/illustration_tile"
-    app:suwIllustrationHorizontalTile="@drawable/illustration_horizontal"
-    app:suwIllustrationImage="@drawable/illustration_generic">
+    app:suwBackgroundTile="@drawable/bg_tile">
 
     <LinearLayout
         style="@style/SuwContentFrame"
diff --git a/res/values/colors.xml b/res/values/colors.xml
index c874970..0395989 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -100,4 +100,7 @@
 
     <color name="zen_rule_name_warning">@color/system_warning_color</color>
 
+    <!-- Accent color that matches the settings launcher icon -->
+    <color name="icon_accent">#ffabffec</color>
+
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 789224c..6169fc9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -653,6 +653,8 @@
     <!-- Security settings screen, setting option summary to change screen timeout -->
     <string name="lock_after_timeout_summary"><xliff:g id="timeout_string">%1$s</xliff:g> after sleep</string>
     <!-- Security settings screen, setting option summary to change screen timeout, with additional explanation-->
+    <string name="lock_immediately_summary_with_exception">Immediately after sleep, except when kept unlocked by <xliff:g id="trust_agent_name">%1$s</xliff:g></string>
+    <!-- Security settings screen, setting option summary to change screen timeout, with additional explanation-->
     <string name="lock_after_timeout_summary_with_exception"><xliff:g id="timeout_string">%1$s</xliff:g> after sleep, except when kept unlocked by <xliff:g id="trust_agent_name">%2$s</xliff:g></string>
     <!-- Text shown next to checkbox for showing owner info on LockScreen [CHAR LIMIT=50]-->
     <string name="show_owner_info_on_lockscreen_label">Show owner info on lock screen</string>
@@ -1155,8 +1157,6 @@
     <!-- Message when bluetooth dialog when passkey or pin needs to be displayed. -->
     <string name="bluetooth_display_passkey_pin_msg">To pair with:<xliff:g id="bold1">&lt;br>&lt;b></xliff:g><xliff:g id="device_name">%1$s</xliff:g><xliff:g id="end_bold1">&lt;/b>&lt;br>&lt;br></xliff:g>Type on it:<xliff:g id="bold2">&lt;br>&lt;b></xliff:g><xliff:g id="passkey">%2$s</xliff:g><xliff:g id="end_bold2">&lt;/b></xliff:g>, then press Return or Enter.</string>
 
-    <!-- Message in pairing dialogs.  [CHAR LIMIT=NONE] -->
-    <string name="bluetooth_pairing_will_share_phonebook">Pairing grants access to your contacts and call history when connected.</string>
     <!-- Checkbox message in pairing dialogs.  [CHAR LIMIT=NONE] -->
     <string name="bluetooth_pairing_shares_phonebook">Grant access to your contacts and call history when connected.</string>
 
@@ -4243,10 +4243,12 @@
     <!-- Menu label for refreshing with latest usage numbers -->
     <string name="menu_stats_refresh">Refresh</string>
 
-    <!-- Label for kernel threads -->
+    <!-- Label for kernel threads in battery usage -->
     <string name="process_kernel_label">Android OS</string>
-    <!-- Label for mediaserver process -->
+    <!-- Label for mediaserver process in battery usage -->
     <string name="process_mediaserver_label">Mediaserver</string>
+    <!-- Label for dex2oat process used for app optimization in battery usage -->
+    <string name="process_dex2oat_label">App optimization</string>
 
     <!-- [CHAR_LIMIT=40] Battery saver: Label for feature, title + menu item -->
     <string name="battery_saver">Battery saver</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index d24337f..ef1dbc8 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -343,4 +343,8 @@
         <item name="android:textSize">16sp</item>
         <item name="android:textColor">?android:attr/textColorPrimary</item>
     </style>
+
+    <style name="SetupWizardStorageStyle" parent="@style/SuwThemeMaterial.Light">
+        <item name="android:colorAccent">#ff009688</item>
+    </style>
 </resources>
diff --git a/res/xml/dashboard_categories.xml b/res/xml/dashboard_categories.xml
index 54d1d39..d437dcf 100644
--- a/res/xml/dashboard_categories.xml
+++ b/res/xml/dashboard_categories.xml
@@ -44,7 +44,7 @@
                 android:id="@+id/sim_settings"
                 android:title="@string/sim_settings_title"
                 android:fragment="com.android.settings.sim.SimSettings"
-                android:icon="@drawable/ic_sim_sd"
+                android:icon="@drawable/ic_settings_sim"
                 />
 
         <!-- Data Usage -->
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 4905f26..14c829a 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -65,13 +65,6 @@
         android:persistent="false"
         android:title="@string/system_ui_settings" />
 
-    <com.android.settings.DropDownPreference
-        android:key="night_mode"
-        android:title="@string/night_mode_title"
-        android:summary="@string/night_mode_summary"
-        android:entries="@array/night_mode_entries"
-        android:entryValues="@array/night_mode_values" />
-
     <PreferenceCategory android:key="debug_debugging_category"
             android:title="@string/debug_debugging_category">
 
diff --git a/src/com/android/settings/CreateShortcut.java b/src/com/android/settings/CreateShortcut.java
index 637bc6f..3c1bc6f0 100644
--- a/src/com/android/settings/CreateShortcut.java
+++ b/src/com/android/settings/CreateShortcut.java
@@ -73,7 +73,7 @@
     }
 
     private Bitmap createIcon(int resource) {
-        Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material_Light);
+        Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material);
         View view = LayoutInflater.from(context).inflate(R.layout.shortcut_badge, null);
         ((ImageView) view.findViewById(android.R.id.icon)).setImageResource(resource);
 
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index a4ee9616..4b3a7f7 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -588,7 +588,7 @@
         final MenuItem help = menu.findItem(R.id.data_usage_menu_help);
         String helpUrl;
         if (!TextUtils.isEmpty(helpUrl = getResources().getString(R.string.help_url_data_usage))) {
-            HelpUtils.prepareHelpMenuItem(context, help, helpUrl, getClass().getName());
+            HelpUtils.prepareHelpMenuItem(getActivity(), help, helpUrl, getClass().getName());
         } else {
             help.setVisible(false);
         }
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 89b081a..5d9e2bd 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -23,7 +23,6 @@
 import android.app.AppOpsManager;
 import android.app.AppOpsManager.PackageOps;
 import android.app.Dialog;
-import android.app.UiModeManager;
 import android.app.admin.DevicePolicyManager;
 import android.app.backup.IBackupManager;
 import android.bluetooth.BluetoothAdapter;
@@ -175,8 +174,6 @@
 
     private static final String TERMINAL_APP_PACKAGE = "com.android.terminal";
 
-    private static final String KEY_NIGHT_MODE = "night_mode";
-
     private static final int RESULT_DEBUG_APP = 1000;
     private static final int RESULT_MOCK_LOCATION_APP = 1001;
 
@@ -259,8 +256,6 @@
 
     private SwitchPreference mShowAllANRs;
 
-    private DropDownPreference mNightModePreference;
-
     private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
 
     private final ArrayList<SwitchPreference> mResetSwitchPrefs
@@ -419,27 +414,6 @@
             mAllPrefs.add(hdcpChecking);
             removePreferenceForProduction(hdcpChecking);
         }
-
-        mNightModePreference = (DropDownPreference) findPreference(KEY_NIGHT_MODE);
-        final UiModeManager uiManager = (UiModeManager) getSystemService(
-                Context.UI_MODE_SERVICE);
-        final int currentNightMode = uiManager.getNightMode();
-        mNightModePreference.setSelectedValue(String.valueOf(currentNightMode));
-        mNightModePreference.setCallback(new DropDownPreference.Callback() {
-            @Override
-            public boolean onItemSelected(int pos, Object newValue) {
-                try {
-                    final int value = Integer.parseInt((String) newValue);
-                    final UiModeManager uiManager = (UiModeManager) getSystemService(
-                            Context.UI_MODE_SERVICE);
-                    uiManager.setNightMode(value);
-                    return true;
-                } catch (NumberFormatException e) {
-                    Log.e(TAG, "could not persist night mode setting", e);
-                    return false;
-                }
-            }
-        });
     }
 
     private ListPreference addListPreference(String prefKey) {
diff --git a/src/com/android/settings/HelpUtils.java b/src/com/android/settings/HelpUtils.java
index 0e79c6d..3c36edb 100644
--- a/src/com/android/settings/HelpUtils.java
+++ b/src/com/android/settings/HelpUtils.java
@@ -16,6 +16,7 @@
 
 package com.android.settings;
 
+import android.app.Activity;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -28,6 +29,7 @@
 import android.util.TypedValue;
 import android.view.Menu;
 import android.view.MenuItem;
+import android.view.MenuItem.OnMenuItemClickListener;
 
 import java.net.URISyntaxException;
 import java.util.Locale;
@@ -65,16 +67,16 @@
     /** Static helper that is not instantiable*/
     private HelpUtils() { }
 
-    public static boolean prepareHelpMenuItem(Context context, Menu menu, String helpUri,
+    public static boolean prepareHelpMenuItem(Activity activity, Menu menu, String helpUri,
             String backupContext) {
         MenuItem helpItem = menu.add(0, MENU_HELP, 0, R.string.help_label);
-        return prepareHelpMenuItem(context, helpItem, helpUri, backupContext);
+        return prepareHelpMenuItem(activity, helpItem, helpUri, backupContext);
     }
 
-    public static boolean prepareHelpMenuItem(Context context, Menu menu, int helpUriResource,
+    public static boolean prepareHelpMenuItem(Activity activity, Menu menu, int helpUriResource,
             String backupContext) {
         MenuItem helpItem = menu.add(0, MENU_HELP, 0, R.string.help_label);
-        return prepareHelpMenuItem(context, helpItem, context.getString(helpUriResource),
+        return prepareHelpMenuItem(activity, helpItem, activity.getString(helpUriResource),
                 backupContext);
     }
 
@@ -86,7 +88,7 @@
      *
      * @return returns whether the help menu item has been made visible.
      */
-    public static boolean prepareHelpMenuItem(Context context, MenuItem helpMenuItem,
+    public static boolean prepareHelpMenuItem(final Activity activity, MenuItem helpMenuItem,
             String helpUriString, String backupContext) {
         if (TextUtils.isEmpty(helpUriString)) {
             // The help url string is empty or null, so set the help menu item to be invisible.
@@ -95,12 +97,18 @@
             // return that the help menu item is not visible (i.e. false)
             return false;
         } else {
-            Intent intent = getHelpIntent(context, helpUriString, backupContext);
+            final Intent intent = getHelpIntent(activity, helpUriString, backupContext);
 
             // Set the intent to the help menu item, show the help menu item in the overflow
             // menu, and make it visible.
             if (intent != null) {
-                helpMenuItem.setIntent(intent);
+                helpMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+                    @Override
+                    public boolean onMenuItemClick(MenuItem item) {
+                        activity.startActivityForResult(intent, 0);
+                        return true;
+                    }
+                });
                 helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
                 helpMenuItem.setVisible(true);
             } else {
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 93bf1e0..c967659 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -542,8 +542,13 @@
 
         Preference preference = getPreferenceScreen().findPreference(KEY_TRUST_AGENT);
         if (preference != null && preference.getTitle().length() > 0) {
-            mLockAfter.setSummary(getString(R.string.lock_after_timeout_summary_with_exception,
-                    entries[best], preference.getTitle()));
+            if (Long.valueOf(values[best].toString()) == 0) {
+                mLockAfter.setSummary(getString(R.string.lock_immediately_summary_with_exception,
+                        preference.getTitle()));
+            } else {
+                mLockAfter.setSummary(getString(R.string.lock_after_timeout_summary_with_exception,
+                        entries[best], preference.getTitle()));
+            }
         } else {
             mLockAfter.setSummary(getString(R.string.lock_after_timeout_summary, entries[best]));
         }
diff --git a/src/com/android/settings/applications/AppStatePowerBridge.java b/src/com/android/settings/applications/AppStatePowerBridge.java
index 3b1707f..069c901 100644
--- a/src/com/android/settings/applications/AppStatePowerBridge.java
+++ b/src/com/android/settings/applications/AppStatePowerBridge.java
@@ -19,6 +19,7 @@
 import com.android.settingslib.applications.ApplicationsState;
 import com.android.settingslib.applications.ApplicationsState.AppEntry;
 import com.android.settingslib.applications.ApplicationsState.AppFilter;
+import com.android.settingslib.applications.ApplicationsState.CompoundFilter;
 
 import java.util.ArrayList;
 
@@ -54,7 +55,8 @@
         public boolean isSystemHighPower;
     }
 
-    public static final AppFilter FILTER_POWER_WHITELISTED = new AppFilter() {
+    public static final AppFilter FILTER_POWER_WHITELISTED = new CompoundFilter(
+            ApplicationsState.FILTER_PERSONAL, new AppFilter() {
         @Override
         public void init() {
         }
@@ -63,17 +65,5 @@
         public boolean filterApp(AppEntry info) {
             return info.extraInfo == Boolean.TRUE;
         }
-    };
-
-    public static final AppFilter FILTER_POWER_NOT_WHITELISTED = new AppFilter() {
-        @Override
-        public void init() {
-        }
-
-        @Override
-        public boolean filterApp(AppEntry info) {
-            return info.extraInfo == Boolean.FALSE;
-        }
-    };
-
+    });
 }
diff --git a/src/com/android/settings/applications/DefaultPhonePreference.java b/src/com/android/settings/applications/DefaultPhonePreference.java
index 657391f..3d9131e 100644
--- a/src/com/android/settings/applications/DefaultPhonePreference.java
+++ b/src/com/android/settings/applications/DefaultPhonePreference.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.os.UserManager;
 import android.telecom.DefaultDialerManager;
+import android.telecom.TelecomManager;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.AttributeSet;
@@ -29,10 +30,12 @@
 import java.util.Objects;
 
 public class DefaultPhonePreference extends AppListPreference {
+    private final Context mContext;
 
     public DefaultPhonePreference(Context context, AttributeSet attrs) {
         super(context, attrs);
 
+        mContext = context.getApplicationContext();
         if (isAvailable(context)) {
             loadDialerApps();
         }
@@ -41,7 +44,7 @@
     @Override
     protected boolean persistString(String value) {
         if (!TextUtils.isEmpty(value) && !Objects.equals(value, getDefaultPackage())) {
-            DefaultDialerManager.setDefaultDialerApplication(getContext(), value);
+            TelecomManager.from(mContext).setDefaultDialer(value);
         }
         setSummary(getEntry());
         return true;
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 9afcff8..c1566d0 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -112,21 +112,23 @@
     // Filter options used for displayed list of applications
     // The order which they appear is the order they will show when spinner is present.
     public static final int FILTER_APPS_POWER_WHITELIST         = 0;
-    public static final int FILTER_APPS_ALL                     = 1;
-    public static final int FILTER_APPS_ENABLED                 = 2;
-    public static final int FILTER_APPS_DISABLED                = 3;
-    public static final int FILTER_APPS_BLOCKED                 = 4;
-    public static final int FILTER_APPS_PRIORITY                = 5;
-    public static final int FILTER_APPS_NO_PEEKING              = 6;
-    public static final int FILTER_APPS_SENSITIVE               = 7;
-    public static final int FILTER_APPS_PERSONAL                = 8;
-    public static final int FILTER_APPS_WORK                    = 9;
-    public static final int FILTER_APPS_WITH_DOMAIN_URLS        = 10;
-    public static final int FILTER_APPS_USAGE_ACCESS            = 11;
+    public static final int FILTER_APPS_POWER_WHITELIST_ALL     = 1;
+    public static final int FILTER_APPS_ALL                     = 2;
+    public static final int FILTER_APPS_ENABLED                 = 3;
+    public static final int FILTER_APPS_DISABLED                = 4;
+    public static final int FILTER_APPS_BLOCKED                 = 5;
+    public static final int FILTER_APPS_PRIORITY                = 6;
+    public static final int FILTER_APPS_NO_PEEKING              = 7;
+    public static final int FILTER_APPS_SENSITIVE               = 8;
+    public static final int FILTER_APPS_PERSONAL                = 9;
+    public static final int FILTER_APPS_WORK                    = 10;
+    public static final int FILTER_APPS_WITH_DOMAIN_URLS        = 11;
+    public static final int FILTER_APPS_USAGE_ACCESS            = 12;
 
     // This is the string labels for the filter modes above, the order must be kept in sync.
     public static final int[] FILTER_LABELS = new int[] {
-        R.string.high_power_filter_on,        // High power whitelist, on
+        R.string.high_power_filter_on, // High power whitelist, on
+        R.string.filter_all_apps,      // All apps label, but personal filter (for high power);
         R.string.filter_all_apps,      // All apps
         R.string.filter_enabled_apps,  // Enabled
         R.string.filter_apps_disabled, // Disabled
@@ -143,6 +145,7 @@
     // be kept in sync.
     public static final AppFilter[] FILTERS = new AppFilter[] {
         AppStatePowerBridge.FILTER_POWER_WHITELISTED,     // High power whitelist, on
+        ApplicationsState.FILTER_PERSONAL,    // All apps label, but personal filter
         ApplicationsState.FILTER_EVERYTHING,  // All apps
         ApplicationsState.FILTER_ALL_ENABLED, // Enabled
         ApplicationsState.FILTER_DISABLED,    // Disabled
@@ -333,7 +336,7 @@
             mFilterAdapter.enableFilter(FILTER_APPS_NO_PEEKING);
         }
         if (mListType == LIST_TYPE_HIGH_POWER) {
-            mFilterAdapter.enableFilter(FILTER_APPS_ALL);
+            mFilterAdapter.enableFilter(FILTER_APPS_POWER_WHITELIST_ALL);
         }
         if (mListType == LIST_TYPE_STORAGE) {
             mApplications.setOverrideFilter(new VolumeFilter(mVolumeUuid));
diff --git a/src/com/android/settings/applications/UsageAccessDetails.java b/src/com/android/settings/applications/UsageAccessDetails.java
index f65c4be..6d5995b 100644
--- a/src/com/android/settings/applications/UsageAccessDetails.java
+++ b/src/com/android/settings/applications/UsageAccessDetails.java
@@ -17,6 +17,7 @@
 
 import android.app.AlertDialog;
 import android.app.AppOpsManager;
+import android.app.admin.DevicePolicyManager;
 import android.content.ActivityNotFoundException;
 import android.content.ComponentName;
 import android.content.Context;
@@ -33,7 +34,6 @@
 import android.util.Log;
 
 import com.android.internal.logging.MetricsLogger;
-import com.android.settings.InstrumentedFragment;
 import com.android.settings.R;
 import com.android.settings.applications.AppStateUsageBridge.UsageState;
 
@@ -51,6 +51,7 @@
     private Preference mUsagePrefs;
     private Intent mSettingsIntent;
     private UsageState mUsageState;
+    private DevicePolicyManager mDpm;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -59,6 +60,7 @@
         Context context = getActivity();
         mUsageBridge = new AppStateUsageBridge(context, mState, null);
         mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
+        mDpm = context.getSystemService(DevicePolicyManager.class);
 
         addPreferencesFromResource(R.xml.usage_access_details);
         mSwitchPref = (SwitchPreference) findPreference(KEY_USAGE_SWITCH);
@@ -91,6 +93,14 @@
     public boolean onPreferenceChange(Preference preference, Object newValue) {
         if (preference == mSwitchPref) {
             if (mUsageState != null && (Boolean) newValue != mUsageState.hasAccess()) {
+                if (mUsageState.hasAccess() && mDpm.isProfileOwnerApp(mPackageName)) {
+                    new AlertDialog.Builder(getContext())
+                            .setIcon(com.android.internal.R.drawable.ic_dialog_alert_material)
+                            .setTitle(android.R.string.dialog_alert_title)
+                            .setMessage(R.string.work_profile_usage_access_warning)
+                            .setPositiveButton(R.string.okay, null)
+                            .show();
+                }
                 setHasAccess(!mUsageState.hasAccess());
                 refreshUi();
             }
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index ffe4945..29cac62 100755
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.bluetooth;
 
+import android.bluetooth.BluetoothClass;
 import android.bluetooth.BluetoothDevice;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -186,6 +187,24 @@
         TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
         TextView messageView2 = (TextView) view.findViewById(R.id.message_below_pin);
         CheckBox alphanumericPin = (CheckBox) view.findViewById(R.id.alphanumeric_pin);
+        CheckBox contactSharing = (CheckBox) view.findViewById(
+                R.id.phonebook_sharing_message_entry_pin);
+        contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
+                if (isChecked) {
+                    mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
+                } else {
+                    mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
+                }
+            }
+        });
+        if (mDevice.getBluetoothClass().getDeviceClass()
+                == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
+            contactSharing.setVisibility(View.VISIBLE);
+        } else {
+            contactSharing.setVisibility(View.GONE);
+        }
         mPairingView = (EditText) view.findViewById(R.id.text);
         mPairingView.addTextChangedListener(this);
         alphanumericPin.setOnCheckedChangeListener(this);
@@ -238,6 +257,24 @@
         TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption);
         TextView pairingViewContent = (TextView) view.findViewById(R.id.pairing_subhead);
         TextView messagePairing = (TextView) view.findViewById(R.id.pairing_code_message);
+        CheckBox contactSharing = (CheckBox) view.findViewById(
+                R.id.phonebook_sharing_message_confirm_pin);
+        contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
+                if (isChecked) {
+                    mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
+                } else {
+                    mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
+                }
+            }
+        });
+        if (mDevice.getBluetoothClass().getDeviceClass()
+                == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
+            contactSharing.setVisibility(View.VISIBLE);
+        } else {
+            contactSharing.setVisibility(View.GONE);
+        }
 
         String messageCaption = null;
         String pairingContent = null;
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index 799121b..0c65528 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -53,7 +53,6 @@
 import android.widget.EditText;
 
 import com.android.internal.logging.MetricsLogger;
-import com.android.internal.util.Preconditions;
 import com.android.settings.R;
 import com.android.settings.Settings.StorageUseActivity;
 import com.android.settings.SettingsPreferenceFragment;
@@ -110,6 +109,11 @@
 
     private Preference mExplore;
 
+    private boolean isVolumeValid() {
+        return (mVolume != null) && (mVolume.getType() == VolumeInfo.TYPE_PRIVATE)
+                && mVolume.isMountedReadable();
+    }
+
     @Override
     protected int getMetricsCategory() {
         return MetricsLogger.DEVICEINFO_STORAGE;
@@ -127,17 +131,19 @@
         mVolumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
         mVolume = mStorageManager.findVolumeById(mVolumeId);
 
-        Preconditions.checkNotNull(mVolume);
-        Preconditions.checkState(mVolume.getType() == VolumeInfo.TYPE_PRIVATE);
+        mMeasure = new StorageMeasurement(context, mVolume, mSharedVolume);
+        mMeasure.setReceiver(mReceiver);
+
+        if (!isVolumeValid()) {
+            getActivity().finish();
+            return;
+        }
 
         addPreferencesFromResource(R.xml.device_info_storage_volume);
 
         // Find the emulated shared storage layered above this private volume
         mSharedVolume = mStorageManager.findEmulatedForPrivate(mVolume);
 
-        mMeasure = new StorageMeasurement(context, mVolume, mSharedVolume);
-        mMeasure.setReceiver(mReceiver);
-
         mSummary = new StorageSummaryPreference(context);
 
         mApps = buildItem(R.string.storage_detail_apps);
@@ -162,6 +168,11 @@
     }
 
     public void update() {
+        if (!isVolumeValid()) {
+            getActivity().finish();
+            return;
+        }
+
         getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
 
         // Valid options may have changed
@@ -172,12 +183,6 @@
 
         screen.removeAll();
 
-        if (!mVolume.isMountedReadable()) {
-            Log.d(TAG, "Leaving details fragment due to state " + mVolume.getState());
-            finish();
-            return;
-        }
-
         screen.addPreference(mSummary);
 
         final boolean showUsers = !mUsers.isEmpty();
@@ -245,7 +250,7 @@
 
         // Refresh to verify that we haven't been formatted away
         mVolume = mStorageManager.findVolumeById(mVolumeId);
-        if (mVolume == null) {
+        if (!isVolumeValid()) {
             getActivity().finish();
             return;
         }
@@ -263,7 +268,9 @@
     @Override
     public void onDestroy() {
         super.onDestroy();
-        mMeasure.onDestroy();
+        if (mMeasure != null) {
+            mMeasure.onDestroy();
+        }
     }
 
     @Override
@@ -273,6 +280,8 @@
 
     @Override
     public void onPrepareOptionsMenu(Menu menu) {
+        if (!isVolumeValid()) return;
+
         final MenuItem rename = menu.findItem(R.id.storage_rename);
         final MenuItem mount = menu.findItem(R.id.storage_mount);
         final MenuItem unmount = menu.findItem(R.id.storage_unmount);
diff --git a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
index 08117ba..2987c12 100644
--- a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
@@ -16,8 +16,6 @@
 
 package com.android.settings.deviceinfo;
 
-import static com.android.settings.deviceinfo.StorageSettings.TAG;
-
 import android.content.Context;
 import android.content.Intent;
 import android.net.Uri;
@@ -33,7 +31,6 @@
 import android.text.TextUtils;
 import android.text.format.Formatter;
 import android.text.format.Formatter.BytesResult;
-import android.util.Log;
 
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.util.Preconditions;
@@ -67,6 +64,11 @@
     private Preference mFormatPublic;
     private Preference mFormatPrivate;
 
+    private boolean isVolumeValid() {
+        return (mVolume != null) && (mVolume.getType() == VolumeInfo.TYPE_PUBLIC)
+                && mVolume.isMountedReadable();
+    }
+
     @Override
     protected int getMetricsCategory() {
         return MetricsLogger.DEVICEINFO_STORAGE;
@@ -90,8 +92,10 @@
             mVolume = mStorageManager.findVolumeById(volId);
         }
 
-        Preconditions.checkNotNull(mVolume);
-        Preconditions.checkState(mVolume.getType() == VolumeInfo.TYPE_PUBLIC);
+        if (!isVolumeValid()) {
+            getActivity().finish();
+            return;
+        }
 
         mDisk = mStorageManager.findDiskById(mVolume.getDiskId());
         Preconditions.checkNotNull(mDisk);
@@ -109,6 +113,11 @@
     }
 
     public void update() {
+        if (!isVolumeValid()) {
+            getActivity().finish();
+            return;
+        }
+
         getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
 
         final Context context = getActivity();
@@ -116,12 +125,6 @@
 
         screen.removeAll();
 
-        if (!mVolume.isMountedReadable()) {
-            Log.d(TAG, "Leaving details fragment due to state " + mVolume.getState());
-            finish();
-            return;
-        }
-
         if (mVolume.isMountedReadable()) {
             screen.addPreference(mSummary);
 
@@ -163,7 +166,7 @@
 
         // Refresh to verify that we haven't been formatted away
         mVolume = mStorageManager.findVolumeById(mVolumeId);
-        if (mVolume == null) {
+        if (!isVolumeValid()) {
             getActivity().finish();
             return;
         }
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index b1745ec..a8a516b 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -24,6 +24,7 @@
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.graphics.Color;
+import android.graphics.drawable.Drawable;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.storage.DiskInfo;
@@ -165,11 +166,16 @@
         for (VolumeRecord rec : recs) {
             if (rec.getType() == VolumeInfo.TYPE_PRIVATE
                     && mStorageManager.findVolumeByUuid(rec.getFsUuid()) == null) {
+                // TODO: add actual storage type to record
+                final Drawable icon = context.getDrawable(R.drawable.ic_sim_sd);
+                icon.mutate();
+                icon.setTint(COLOR_PUBLIC);
+
                 final Preference pref = new Preference(context);
                 pref.setKey(rec.getFsUuid());
                 pref.setTitle(rec.getNickname());
                 pref.setSummary(com.android.internal.R.string.ext_media_status_missing);
-                pref.setIcon(R.drawable.ic_settings_storage);
+                pref.setIcon(icon);
                 mInternalCategory.addPreference(pref);
             }
         }
diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreference.java b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
index f535b85..bc7972a 100644
--- a/src/com/android/settings/deviceinfo/StorageVolumePreference.java
+++ b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
@@ -101,7 +101,6 @@
     protected void onBindView(View view) {
         final ImageView unmount = (ImageView) view.findViewById(R.id.unmount);
         if (unmount != null) {
-            unmount.getDrawable().setTint(Color.parseColor("#8a000000"));
             unmount.setOnClickListener(mUnmountListener);
         }
 
diff --git a/src/com/android/settings/deviceinfo/StorageWizardBase.java b/src/com/android/settings/deviceinfo/StorageWizardBase.java
index 294df95..1d91e6b 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardBase.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardBase.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.deviceinfo;
 
+import android.annotation.LayoutRes;
 import android.app.Activity;
 import android.graphics.Color;
 import android.os.Bundle;
@@ -23,9 +24,10 @@
 import android.os.storage.StorageEventListener;
 import android.os.storage.StorageManager;
 import android.os.storage.VolumeInfo;
-import android.os.storage.VolumeRecord;
 import android.text.TextUtils;
 import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
 import android.view.WindowManager;
 import android.widget.Button;
 import android.widget.ProgressBar;
@@ -33,19 +35,20 @@
 
 import com.android.settings.R;
 import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.view.NavigationBar;
-import com.android.setupwizardlib.view.NavigationBar.NavigationBarListener;
 
 import java.text.NumberFormat;
 import java.util.List;
 import java.util.Objects;
 
-public abstract class StorageWizardBase extends Activity implements NavigationBarListener {
+public abstract class StorageWizardBase extends Activity {
     protected StorageManager mStorage;
 
     protected VolumeInfo mVolume;
     protected DiskInfo mDisk;
 
+    private View mCustomNav;
+    private Button mCustomNext;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -64,7 +67,7 @@
             mDisk = mVolume.getDisk();
         }
 
-        setTheme(R.style.SuwThemeMaterial_Light);
+        setTheme(R.style.SetupWizardStorageStyle);
 
         if (mDisk != null) {
             mStorage.registerListener(mStorageListener);
@@ -72,20 +75,54 @@
     }
 
     @Override
+    public void setContentView(@LayoutRes int layoutResID) {
+        super.setContentView(layoutResID);
+
+        // Our wizard is a unique flower, so it has custom buttons
+        final ViewGroup navParent = (ViewGroup) findViewById(R.id.suw_layout_navigation_bar)
+                .getParent();
+        mCustomNav = getLayoutInflater().inflate(R.layout.storage_wizard_navigation,
+                navParent, false);
+
+        mCustomNext = (Button) mCustomNav.findViewById(R.id.suw_navbar_next);
+        mCustomNext.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                onNavigateNext();
+            }
+        });
+
+        // Swap our custom navigation bar into place
+        for (int i = 0; i < navParent.getChildCount(); i++) {
+            if (navParent.getChildAt(i).getId() == R.id.suw_layout_navigation_bar) {
+                navParent.removeViewAt(i);
+                navParent.addView(mCustomNav, i);
+                break;
+            }
+        }
+    }
+
+    @Override
     protected void onPostCreate(Bundle savedInstanceState) {
         super.onPostCreate(savedInstanceState);
 
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
+        final Window window = getWindow();
+        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
                 WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
                 WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
+        window.setStatusBarColor(Color.TRANSPARENT);
 
-        getNavigationBar().setSystemUiVisibility(
+        mCustomNav.setSystemUiVisibility(
                 View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
 
-        getWindow().setStatusBarColor(Color.TRANSPARENT);
+        final View scrollView = findViewById(R.id.suw_bottom_scroll_view);
+        scrollView.setVerticalFadingEdgeEnabled(true);
+        scrollView.setFadingEdgeLength(scrollView.getVerticalFadingEdgeLength() * 2);
 
-        getNavigationBar().setNavigationBarListener(this);
-        getBackButton().setVisibility(View.GONE);
+        // Our header assets already have padding baked in
+        final View title = findViewById(R.id.suw_layout_title);
+        title.setPadding(title.getPaddingLeft(), 0, title.getPaddingRight(),
+                title.getPaddingBottom());
     }
 
     @Override
@@ -94,16 +131,8 @@
         super.onDestroy();
     }
 
-    protected NavigationBar getNavigationBar() {
-        return (NavigationBar) findViewById(R.id.suw_layout_navigation_bar);
-    }
-
-    protected Button getBackButton() {
-        return getNavigationBar().getBackButton();
-    }
-
     protected Button getNextButton() {
-        return getNavigationBar().getNextButton();
+        return mCustomNext;
     }
 
     protected SetupWizardLayout getSetupWizardLayout() {
@@ -135,12 +164,16 @@
         secondBody.setVisibility(View.VISIBLE);
     }
 
-    @Override
-    public void onNavigateBack() {
-        throw new UnsupportedOperationException();
+    protected void setIllustrationInternal(boolean internal) {
+        if (internal) {
+            getSetupWizardLayout().setIllustration(R.drawable.bg_internal_storage_header,
+                    android.R.color.transparent);
+        } else {
+            getSetupWizardLayout().setIllustration(R.drawable.bg_portable_storage_header,
+                    android.R.color.transparent);
+        }
     }
 
-    @Override
     public void onNavigateNext() {
         throw new UnsupportedOperationException();
     }
diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java
index b35b8ec..ed01c51 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java
@@ -38,6 +38,7 @@
         setContentView(R.layout.storage_wizard_generic);
 
         mFormatPrivate = getIntent().getBooleanExtra(EXTRA_FORMAT_PRIVATE, false);
+        setIllustrationInternal(mFormatPrivate);
 
         if (mFormatPrivate) {
             setHeaderText(R.string.storage_wizard_format_confirm_title);
@@ -49,8 +50,8 @@
                     mDisk.getDescription());
         }
 
-        // TODO: make this a big red scary button
         getNextButton().setText(R.string.storage_wizard_format_confirm_next);
+        getNextButton().setBackgroundTintList(getColorStateList(R.color.storage_wizard_button_red));
     }
 
     @Override
diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
index 75d1758..e117c26 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
@@ -51,6 +51,7 @@
 
         mFormatPrivate = getIntent().getBooleanExtra(
                 StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
+        setIllustrationInternal(mFormatPrivate);
 
         setHeaderText(R.string.storage_wizard_format_progress_title, mDisk.getDescription());
         setBodyText(R.string.storage_wizard_format_progress_body, mDisk.getDescription());
diff --git a/src/com/android/settings/deviceinfo/StorageWizardInit.java b/src/com/android/settings/deviceinfo/StorageWizardInit.java
index b0211bf..a72872c 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardInit.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardInit.java
@@ -39,6 +39,7 @@
         }
         setContentView(R.layout.storage_wizard_init);
 
+        setIllustrationInternal(true);
         setHeaderText(R.string.storage_wizard_init_title, mDisk.getDescription());
 
         mRadioExternal = (RadioButton) findViewById(R.id.storage_wizard_init_external_title);
@@ -70,8 +71,10 @@
             if (isChecked) {
                 if (buttonView == mRadioExternal) {
                     mRadioInternal.setChecked(false);
+                    setIllustrationInternal(false);
                 } else if (buttonView == mRadioInternal) {
                     mRadioExternal.setChecked(false);
+                    setIllustrationInternal(true);
                 }
                 getNextButton().setEnabled(true);
             }
@@ -81,7 +84,8 @@
     @Override
     public void onNavigateNext() {
         if (mRadioExternal.isChecked()) {
-            if (mVolume != null && mVolume.getType() == VolumeInfo.TYPE_PUBLIC) {
+            if (mVolume != null && mVolume.getType() == VolumeInfo.TYPE_PUBLIC
+                    && mVolume.getState() != VolumeInfo.STATE_UNMOUNTABLE) {
                 // Remember that user made decision
                 mStorage.setVolumeInited(mVolume.getFsUuid(), true);
 
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrate.java b/src/com/android/settings/deviceinfo/StorageWizardMigrate.java
index 574408d..c12ae4a 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrate.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrate.java
@@ -23,7 +23,6 @@
 import android.widget.CompoundButton.OnCheckedChangeListener;
 import android.widget.RadioButton;
 
-import com.android.internal.util.Preconditions;
 import com.android.settings.R;
 
 public class StorageWizardMigrate extends StorageWizardBase {
@@ -41,6 +40,7 @@
         }
         setContentView(R.layout.storage_wizard_migrate);
 
+        setIllustrationInternal(true);
         setHeaderText(R.string.storage_wizard_migrate_title, mDisk.getDescription());
         setBodyText(R.string.memory_calculating_size);
 
@@ -50,7 +50,7 @@
         mRadioNow.setOnCheckedChangeListener(mRadioListener);
         mRadioLater.setOnCheckedChangeListener(mRadioListener);
 
-        mRadioNow.setChecked(true);
+        getNextButton().setEnabled(false);
 
         mEstimate = new MigrateEstimateTask(this) {
             @Override
@@ -73,6 +73,7 @@
                 } else if (buttonView == mRadioLater) {
                     mRadioNow.setChecked(false);
                 }
+                getNextButton().setEnabled(true);
             }
         }
     };
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
index ff74ea2..607cc6f 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
@@ -45,6 +45,7 @@
         final String sourceDescrip = mStorage.getBestVolumeDescription(sourceVol);
         final String targetDescrip = mStorage.getBestVolumeDescription(mVolume);
 
+        setIllustrationInternal(true);
         setHeaderText(R.string.storage_wizard_migrate_confirm_title, targetDescrip);
         setBodyText(R.string.memory_calculating_size);
         setSecondaryBodyText(R.string.storage_wizard_migrate_details, targetDescrip);
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
index 4446c51..941f6b9 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
@@ -30,10 +30,11 @@
 import android.view.View;
 import android.widget.Toast;
 
-import com.android.internal.util.Preconditions;
 import com.android.settings.R;
 
 public class StorageWizardMigrateProgress extends StorageWizardBase {
+    private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD";
+
     private int mMoveId;
 
     @Override
@@ -48,6 +49,7 @@
         mMoveId = getIntent().getIntExtra(EXTRA_MOVE_ID, -1);
 
         final String descrip = mStorage.getBestVolumeDescription(mVolume);
+        setIllustrationInternal(true);
         setHeaderText(R.string.storage_wizard_migrate_progress_title, descrip);
         setBodyText(R.string.storage_wizard_migrate_details, descrip);
 
@@ -68,6 +70,12 @@
                 Log.d(TAG, "Finished with status " + status);
                 if (status == PackageManager.MOVE_SUCCEEDED) {
                     if (mDisk != null) {
+                        // Kinda lame, but tear down that shiny finished
+                        // notification, since user is still in wizard flow
+                        final Intent finishIntent = new Intent(ACTION_FINISH_WIZARD);
+                        finishIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+                        sendBroadcast(finishIntent);
+
                         final Intent intent = new Intent(context, StorageWizardReady.class);
                         intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
                         startActivity(intent);
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMoveConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardMoveConfirm.java
index 429b03c..e835b15 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMoveConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMoveConfirm.java
@@ -56,6 +56,7 @@
         final String appName = getPackageManager().getApplicationLabel(mApp).toString();
         final String volumeName = mStorage.getBestVolumeDescription(mVolume);
 
+        setIllustrationInternal(true);
         setHeaderText(R.string.storage_wizard_move_confirm_title, appName);
         setBodyText(R.string.storage_wizard_move_confirm_body, appName, volumeName);
 
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java b/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java
index 660f85c..8b3c6da 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java
@@ -46,6 +46,7 @@
         final String appName = getIntent().getStringExtra(EXTRA_TITLE);
         final String volumeName = mStorage.getBestVolumeDescription(mVolume);
 
+        setIllustrationInternal(true);
         setHeaderText(R.string.storage_wizard_move_progress_title, appName);
         setBodyText(R.string.storage_wizard_move_progress_body, volumeName, appName);
 
diff --git a/src/com/android/settings/deviceinfo/StorageWizardReady.java b/src/com/android/settings/deviceinfo/StorageWizardReady.java
index d6ea5e4..2b6387d 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardReady.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardReady.java
@@ -19,7 +19,6 @@
 import android.os.Bundle;
 import android.os.storage.VolumeInfo;
 
-import com.android.internal.util.Preconditions;
 import com.android.settings.R;
 
 public class StorageWizardReady extends StorageWizardBase {
@@ -39,9 +38,11 @@
         final VolumeInfo publicVol = findFirstVolume(VolumeInfo.TYPE_PUBLIC);
         final VolumeInfo privateVol = findFirstVolume(VolumeInfo.TYPE_PRIVATE);
         if (publicVol != null) {
+            setIllustrationInternal(false);
             setBodyText(R.string.storage_wizard_ready_external_body,
                     mDisk.getDescription());
         } else if (privateVol != null) {
+            setIllustrationInternal(true);
             setBodyText(R.string.storage_wizard_ready_internal_body,
                     mDisk.getDescription());
         }
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index fce46fa..b81607b 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -576,7 +576,7 @@
             Context ctx = widget.getContext();
             Intent intent = HelpUtils.getHelpIntent(ctx, getURL(), ctx.getClass().getName());
             try {
-                ctx.startActivity(intent);
+                ((Activity) ctx).startActivityForResult(intent, 0);
             } catch (ActivityNotFoundException e) {
                 Log.w(FingerprintSettingsFragment.TAG,
                         "Actvity was not found for intent, " + intent.toString());
diff --git a/src/com/android/settings/fuelgauge/BatteryEntry.java b/src/com/android/settings/fuelgauge/BatteryEntry.java
index 8227c71..edab729 100644
--- a/src/com/android/settings/fuelgauge/BatteryEntry.java
+++ b/src/com/android/settings/fuelgauge/BatteryEntry.java
@@ -225,6 +225,8 @@
                 name = context.getResources().getString(R.string.process_kernel_label);
             } else if ("mediaserver".equals(name)) {
                 name = context.getResources().getString(R.string.process_mediaserver_label);
+            } else if ("dex2oat".equals(name)) {
+                name = context.getResources().getString(R.string.process_dex2oat_label);
             }
             iconId = R.drawable.ic_power_system;
             icon = context.getDrawable(iconId);