Merge "Show only APNs belonging to carrier (mno/mvno) under apn settings." into mnc-dev
diff --git a/res/drawable/ic_settings_memory.xml b/res/drawable/ic_settings_memory.xml
index a459465..410460e 100644
--- a/res/drawable/ic_settings_memory.xml
+++ b/res/drawable/ic_settings_memory.xml
@@ -17,7 +17,8 @@
         android:width="32dp"
         android:height="32dp"
         android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
+        android:viewportHeight="24.0"
+        android:tint="?android:attr/colorAccent">
     <path
         android:pathData="M6.0,4.0l0.0,16.0 12.0,0.0 0.0,-16.0 -12.0,0.0z
         M6.0,5.25l0,1.5 -3,0 0,-1.5 3,0z
@@ -33,5 +34,5 @@
         M13.25,14.5l1,0 0,3 -1,0 0,-3z
         M15.0,14.5l1,0 0,3 -1,0 0,-3z
         "
-        android:fillColor="#ff009587" />
+        android:fillColor="@android:color/black" />
 </vector>
diff --git a/res/layout/app_storage_settings.xml b/res/layout/app_storage_settings.xml
deleted file mode 100644
index 82493f7..0000000
--- a/res/layout/app_storage_settings.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?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/all_details"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
-    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
-    android:orientation="vertical">
-
-    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@+id/category_title"
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/dashboard_category_title_height"
-        android:singleLine="true"
-        android:gravity="center_vertical"
-        android:textAppearance="@style/TextAppearance.CategoryTitle"
-        android:textAlignment="viewStart"
-        android:text="@string/storage_label"
-        />
-
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingTop="0dip">
-        <TextView
-            android:id="@+id/total_size_prefix"
-            android:text="@string/total_size_label"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:textColor="?android:textColorPrimary"
-            android:maxLines="1" />
-        <TextView
-            android:id="@+id/total_size_text"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:gravity="right"
-            android:maxLines="1" />
-    </FrameLayout>
-
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingTop="3dip">
-        <TextView
-            android:id="@+id/application_size_prefix"
-            android:text="@string/application_size_label"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:textColor="?android:textColorPrimary"
-            android:maxLines="1" />
-        <TextView
-            android:id="@+id/application_size_text"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:gravity="right"
-            android:maxLines="1" />
-    </FrameLayout>
-
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingTop="3dip">
-        <TextView
-            android:id="@+id/external_code_size_prefix"
-            android:text="@string/external_code_size_label"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:textColor="?android:textColorPrimary"
-            android:maxLines="1" />
-        <TextView
-            android:id="@+id/external_code_size_text"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:gravity="right"
-            android:maxLines="1" />
-    </FrameLayout>
-
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingTop="3dip">
-        <TextView
-            android:id="@+id/data_size_prefix"
-            android:text="@string/data_size_label"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:textColor="?android:textColorPrimary"
-            android:maxLines="1" />
-        <TextView
-            android:id="@+id/data_size_text"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:gravity="right"
-            android:maxLines="1" />
-    </FrameLayout>
-
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingTop="3dip">
-        <TextView
-            android:id="@+id/external_data_size_prefix"
-            android:text="@string/external_data_size_label"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:textColor="?android:textColorPrimary"
-            android:maxLines="1" />
-        <TextView
-            android:id="@+id/external_data_size_text"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:gravity="right"
-            android:maxLines="1" />
-    </FrameLayout>
-
-    <include
-        android:id="@+id/clear_data_button"
-        layout="@layout/single_button_panel" />
-
-    <Space
-        android:layout_width="match_parent"
-        android:layout_height="10dp" />
-
-</LinearLayout>
diff --git a/res/layout/horizontal_preference.xml b/res/layout/horizontal_preference.xml
index 540b7e3..4e16e9a 100644
--- a/res/layout/horizontal_preference.xml
+++ b/res/layout/horizontal_preference.xml
@@ -20,7 +20,7 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="horizontal"
-    android:paddingTop="3dp"
+    android:paddingTop="1dp"
     android:paddingStart="?android:attr/listPreferredItemPaddingStart"
     android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
 
diff --git a/res/layout/single_button_panel.xml b/res/layout/single_button_panel.xml
index 5f1fee9..2af1765 100755
--- a/res/layout/single_button_panel.xml
+++ b/res/layout/single_button_panel.xml
@@ -22,15 +22,20 @@
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+        android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
         android:gravity="bottom"
-        android:paddingTop="4dip"
+        android:paddingTop="6dip"
+        android:paddingBottom="6dip"
         android:orientation="horizontal">
         <Button
             android:id="@+id/button"
             android:layout_width="120dip"
             android:layout_weight="0.4"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical" />
+            android:layout_gravity="center_vertical"
+            android:backgroundTint="?android:attr/colorAccent"
+            android:textColor="@android:color/white" />
         <Space
             android:layout_width="0dip"
             android:layout_height="wrap_content"
diff --git a/res/layout/tall_preference_category.xml b/res/layout/tall_preference_category.xml
new file mode 100644
index 0000000..7a5dd77
--- /dev/null
+++ b/res/layout/tall_preference_category.xml
@@ -0,0 +1,29 @@
+<?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.
+-->
+
+<!-- Based on frameworks/base/core/res/res/layout/preference_category_material.xml.
+     except has paddingBottom set.-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+android:id/title"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginBottom="16dip"
+    android:textAppearance="@android:style/TextAppearance.Material.Body2"
+    android:textColor="?android:attr/colorAccent"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:paddingBottom="8dp"
+    android:paddingTop="16dip" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 242177a..ebf1fb4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5860,6 +5860,7 @@
     <string name="keywords_all_apps">apps download applications system</string>
     <string name="keywords_app_permissions">apps permissions security</string>
     <string name="keywords_default_apps">apps default</string>
+    <string name="keywords_ignore_optimizations">ignore optimizations doze app standby</string>
     <!-- Search keywords for different screen unlock modes : slide to unlock, password, pattern and PIN [CHAR LIMIT=none] -->
     <string name="keywords_lockscreen">slide password pattern pin</string>
 
@@ -6467,6 +6468,12 @@
         LIMIT=45] -->
    <string name="app_permissions_group_summary"><xliff:g id="count" example="10">%d</xliff:g> of <xliff:g id="count" example="10">%d</xliff:g> apps allowed</string>
 
+   <!-- Label for tap to wake setting [CHAR LIMIT=30] -->
+   <string name="tap_to_wake">Tap to wake</string>
+
+   <!-- Summary for take to wake setting [CHAR LIMIT=90] -->
+   <string name="tap_to_wake_summary">Double-tap anywhere on the screen to wake device</string>
+
     <!-- Label for the Domain URLs list that shows domain urls per App [CHAR LIMIT=30] -->
     <string name="domain_urls_title">Domain URLs</string>
 
@@ -6558,22 +6565,19 @@
     <!-- Filter for apps allowed to use a lot of power [CHAR LIMIT=25] -->
     <string name="high_power_filter_on">Allowed</string>
 
-    <!-- Filter for apps not allowed to use a lot of power [CHAR LIMIT=25] -->
-    <string name="high_power_filter_off">Not allowed</string>
-
     <!-- Summary of app allowed to use a lot of power [CHAR LIMIT=60] -->
-    <string name="high_power_on">Allowed to ignore optimizations</string>
+    <string name="high_power_on">Ignoring battery optimizations</string>
 
     <!-- Summary of app not allowed to use a lot of power [CHAR LIMIT=60] -->
-    <string name="high_power_off">Not allowed to ignore optimizations</string>
+    <string name="high_power_off">Off</string>
 
     <!-- Description of high power switch [CHAR LIMIT=NONE] -->
-    <string name="high_power_desc">Ignore optimizations including Battery saver, allow instant content refresh etc.</string>
+    <string name="high_power_desc">Don\'t apply battery optimizations. May drain your battery more quickly.</string>
 
     <!-- Description of number of apps with high power turned on [CHAR LIMIT=NONE] -->
     <plurals name="high_power_count">
-        <item quantity="one">1 app is allowed to ignore battery optimizations</item>
-        <item quantity="other"><xliff:g id="count" example="10">%d</xliff:g> apps are allowed to battery optimizations</item>
+        <item quantity="one">1 app allowed to ignore battery optimizations</item>
+        <item quantity="other"><xliff:g id="count" example="10">%d</xliff:g> apps allowed to ignore battery optimizations</item>
     </plurals>
 
     <!-- Summary of power usage for an app [CHAR LIMIT=NONE] -->
@@ -6585,4 +6589,7 @@
     <!-- Link to an apps notification settings [CHAR LIMIT=50] -->
     <string name="app_notification_preferences">App notification preferences</string>
 
+    <!-- Turn on settings for system ui tuner [CHAR LIMIT=40] -->
+    <string name="system_ui_settings">Show SystemUI Tuner</string>
+
 </resources>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index a0dd581..76fc04f 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -30,6 +30,8 @@
     </style>
 
     <style name="SetupWizardTheme" parent="SuwThemeMaterial">
+        <!-- For all Alert Dialogs -->
+        <item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
         <item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item>
         <item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item>
         <item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -50,6 +52,8 @@
     </style>
 
     <style name="SetupWizardTheme.Light" parent="SuwThemeMaterial.Light">
+        <!-- For all Alert Dialogs -->
+        <item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
         <item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item>
         <item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item>
         <item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -160,6 +164,10 @@
         <item name="preferenceBackgroundColor">@drawable/preference_background</item>
     </style>
 
+    <style name="ThemeOverlay.AlertDialog" parent="@android:style/ThemeOverlay.Material.Dialog.Alert">
+        <item name="android:windowSoftInputMode">adjustResize</item>
+    </style>
+
     <style name="Theme.AlertDialog" parent="@*android:style/Theme.Material.Settings.Dialog.Alert">
         <item name="android:windowSoftInputMode">adjustResize</item>
 
diff --git a/res/xml/advanced_apps.xml b/res/xml/advanced_apps.xml
index 62431c3..1bb9c58 100644
--- a/res/xml/advanced_apps.xml
+++ b/res/xml/advanced_apps.xml
@@ -43,7 +43,8 @@
     <PreferenceScreen
         android:key="high_power_apps"
         android:title="@string/high_power_apps"
-        android:fragment="com.android.settings.applications.ManageApplications">
+        android:fragment="com.android.settings.applications.ManageApplications"
+        settings:keywords="@string/keywords_ignore_optimizations">
         <extra
             android:name="classname"
             android:value="com.android.settings.Settings$HighPowerApplicationsActivity" />
diff --git a/res/xml/app_storage_settings.xml b/res/xml/app_storage_settings.xml
index 6baaae1..5bb9204 100644
--- a/res/xml/app_storage_settings.xml
+++ b/res/xml/app_storage_settings.xml
@@ -23,12 +23,54 @@
         android:summary="@string/storage_type_internal"
         android:selectable="true" />
 
-    <com.android.settings.applications.LayoutPreference
-        android:key="storage_settings"
-        android:layout="@layout/app_storage_settings" />
+    <PreferenceCategory
+        android:key="storage_category"
+        android:layout="@layout/tall_preference_category"
+        android:title="@string/storage_label">
+
+        <Preference
+            android:key="total_size"
+            android:title="@string/total_size_label"
+            android:selectable="false"
+            android:layout="@layout/horizontal_preference" />
+
+        <Preference
+            android:key="app_size"
+            android:title="@string/application_size_label"
+            android:selectable="false"
+            android:layout="@layout/horizontal_preference" />
+
+        <Preference
+            android:key="external_code_size"
+            android:title="@string/external_code_size_label"
+            android:selectable="false"
+            android:layout="@layout/horizontal_preference" />
+
+        <Preference
+            android:key="data_size"
+            android:title="@string/data_size_label"
+            android:selectable="false"
+            android:layout="@layout/horizontal_preference" />
+
+        <Preference
+            android:key="external_data_size"
+            android:title="@string/external_data_size_label"
+            android:selectable="false"
+            android:layout="@layout/horizontal_preference" />
+
+        <com.android.settings.applications.LayoutPreference
+            android:key="clear_data_button"
+            android:layout="@layout/single_button_panel" />
+    </PreferenceCategory>
+
+    <Preference
+        android:key="cache_size"
+        android:title="@string/cache_size_label"
+        android:layout="@layout/horizontal_preference" />
 
     <com.android.settings.applications.LayoutPreference
-        android:key="cache_settings"
-        android:layout="@layout/app_cache_settings" />
+        android:key="clear_cache_button"
+        android:selectable="false"
+        android:layout="@layout/single_button_panel" />
 
 </PreferenceScreen>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index ecab700..39866c9 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -60,6 +60,11 @@
         android:summary="@string/runningservices_settings_summary"
         android:fragment="com.android.settings.applications.RunningServices" />
 
+    <SwitchPreference
+        android:key="tuner_ui"
+        android:persistent="false"
+        android:title="@string/system_ui_settings" />
+
     <PreferenceCategory android:key="debug_debugging_category"
             android:title="@string/debug_debugging_category">
 
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 70dcb9a..304a77b 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -72,6 +72,12 @@
                 android:summary="@string/doze_summary"
                 android:persistent="false" />
 
+        <SwitchPreference
+                android:key="tap_to_wake"
+                android:title="@string/tap_to_wake"
+                android:summary="@string/tap_to_wake_summary"
+                android:persistent="false" />
+
         <com.android.settings.WarnedListPreference
                 android:key="font_size"
                 android:title="@string/title_font_size"
diff --git a/res/xml/power_usage_details.xml b/res/xml/power_usage_details.xml
index 3ad6547..ad28650 100644
--- a/res/xml/power_usage_details.xml
+++ b/res/xml/power_usage_details.xml
@@ -25,23 +25,28 @@
             android:layout="@layout/two_buttons_panel"
             android:selectable="false" />
 
-        <Preference
-            android:key="high_power"
-            android:title="@string/high_power_apps" />
+        <PreferenceCategory
+            android:key="controls_parent"
+            android:title="@string/controls_subtitle">
+
+            <Preference
+                android:key="high_power"
+                android:title="@string/high_power_apps" />
+
+        </PreferenceCategory>
 
         <PreferenceCategory
             android:key="details_parent"
+            android:layout="@layout/tall_preference_category"
             android:title="@string/details_subtitle" />
 
         <PreferenceCategory
-            android:key="controls_parent"
-            android:title="@string/controls_subtitle" />
-
-        <PreferenceCategory
-            android:key="messages_parent" />
+            android:key="messages_parent"
+            android:layout="@layout/tall_preference_category" />
 
         <PreferenceCategory
             android:key="packages_parent"
+            android:layout="@layout/tall_preference_category"
             android:title="@string/packages_subtitle" />
 
 </PreferenceScreen>
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index 7aa1053..317d372 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -292,7 +292,6 @@
         /** increases the quality if necessary */
         private int upgradeQuality(int quality) {
             quality = upgradeQualityForDPM(quality);
-            quality = upgradeQualityForKeyStore(quality);
             return quality;
         }
 
@@ -305,15 +304,6 @@
             return quality;
         }
 
-        private int upgradeQualityForKeyStore(int quality) {
-            if (!mKeyStore.isEmpty()) {
-                if (quality < CredentialStorage.MIN_PASSWORD_QUALITY) {
-                    quality = CredentialStorage.MIN_PASSWORD_QUALITY;
-                }
-            }
-            return quality;
-        }
-
         /***
          * Disables preferences that are less secure than required quality. The actual
          * implementation is in disableUnusablePreferenceImpl.
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 3c964c9..314e70a 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -97,6 +97,9 @@
      */
     public static final String PREF_SHOW = "show";
 
+    private static final ComponentName SYSUI_TUNER = new ComponentName("com.android.systemui",
+            "com.android.systemui.tuner.TunerActivity");
+
     private static final String ENABLE_ADB = "enable_adb";
     private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
     private static final String ENABLE_TERMINAL = "enable_terminal";
@@ -112,6 +115,7 @@
     private static final String BUGREPORT = "bugreport";
     private static final String BUGREPORT_IN_POWER_KEY = "bugreport_in_power";
     private static final String OPENGL_TRACES_PROPERTY = "debug.egl.trace";
+    private static final String TUNER_UI_KEY = "tuner_ui";
 
     private static final String DEBUG_APP_KEY = "debug_app";
     private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger";
@@ -260,6 +264,8 @@
     private Dialog mAdbKeysDialog;
     private boolean mUnavailable;
 
+    private SwitchPreference mTunerUiPref;
+
     @Override
     protected int getMetricsCategory() {
         return MetricsLogger.DEVELOPMENT;
@@ -392,6 +398,8 @@
         mAllPrefs.add(mShowAllANRs);
         mResetSwitchPrefs.add(mShowAllANRs);
 
+        mTunerUiPref = findAndInitSwitchPref(TUNER_UI_KEY);
+
         Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
         if (hdcpChecking != null) {
             mAllPrefs.add(hdcpChecking);
@@ -593,6 +601,7 @@
         updateSimulateColorSpace();
         updateUseNuplayerOptions();
         updateUSBAudioOptions();
+        updateTweakUi();
     }
 
     private void resetDangerousOptions() {
@@ -1069,6 +1078,21 @@
         }
     }
 
+    private void updateTweakUi() {
+        updateSwitchPreference(mTunerUiPref, getActivity().getPackageManager()
+                .getComponentEnabledSetting(SYSUI_TUNER)
+                == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
+        mTunerUiPref.setOnPreferenceChangeListener(this);
+    }
+
+    private void writeTweakUi(Object newValue) {
+        Boolean enabled = (Boolean) newValue;
+        getActivity().getPackageManager().setComponentEnabledSetting(SYSUI_TUNER,
+                enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+                        : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+                        PackageManager.DONT_KILL_APP);
+    }
+
     private void updateUseNuplayerOptions() {
         updateSwitchPreference(
                 mUseAwesomePlayer, SystemProperties.getBoolean(USE_AWESOMEPLAYER_PROPERTY, false));
@@ -1669,6 +1693,9 @@
         } else if (preference == mSimulateColorSpace) {
             writeSimulateColorSpace(newValue);
             return true;
+        } else if (preference == mTunerUiPref) {
+            writeTweakUi(newValue);
+            return true;
         }
         return false;
     }
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 7ad3832..d9b6447 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -22,6 +22,7 @@
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.search.Indexable;
 
+import static android.provider.Settings.Secure.DOUBLE_TAP_TO_WAKE;
 import static android.provider.Settings.Secure.DOZE_ENABLED;
 import static android.provider.Settings.Secure.WAKE_GESTURE_ENABLED;
 import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
@@ -69,6 +70,7 @@
     private static final String KEY_SCREEN_SAVER = "screensaver";
     private static final String KEY_LIFT_TO_WAKE = "lift_to_wake";
     private static final String KEY_DOZE = "doze";
+    private static final String KEY_TAP_TO_WAKE = "tap_to_wake";
     private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness";
     private static final String KEY_AUTO_ROTATE = "auto_rotate";
     private static final String KEY_NIGHT_MODE = "night_mode";
@@ -84,6 +86,7 @@
     private Preference mScreenSaverPreference;
     private SwitchPreference mLiftToWakePreference;
     private SwitchPreference mDozePreference;
+    private SwitchPreference mTapToWakePreference;
     private SwitchPreference mAutoBrightnessPreference;
 
     @Override
@@ -139,6 +142,13 @@
             removePreference(KEY_DOZE);
         }
 
+        if (isTapToWakeAvailable(getResources())) {
+            mTapToWakePreference = (SwitchPreference) findPreference(KEY_TAP_TO_WAKE);
+            mTapToWakePreference.setOnPreferenceChangeListener(this);
+        } else {
+            removePreference(KEY_TAP_TO_WAKE);
+        }
+
         if (RotationPolicy.isRotationLockToggleVisible(activity)) {
             DropDownPreference rotatePreference =
                     (DropDownPreference) findPreference(KEY_AUTO_ROTATE);
@@ -201,6 +211,10 @@
         return !TextUtils.isEmpty(name);
     }
 
+    private static boolean isTapToWakeAvailable(Resources res) {
+        return res.getBoolean(com.android.internal.R.bool.config_supportDoubleTapWake);
+    }
+
     private static boolean isAutomaticBrightnessAvailable(Resources res) {
         return res.getBoolean(com.android.internal.R.bool.config_automatic_brightness_available);
     }
@@ -345,6 +359,12 @@
             int value = Settings.Secure.getInt(getContentResolver(), DOZE_ENABLED, 1);
             mDozePreference.setChecked(value != 0);
         }
+
+        // Update tap to wake if it is available.
+        if (mTapToWakePreference != null) {
+            int value = Settings.Secure.getInt(getContentResolver(), DOUBLE_TAP_TO_WAKE, 0);
+            mTapToWakePreference.setChecked(value != 0);
+        }
     }
 
     private void updateScreenSaverSummary() {
@@ -396,6 +416,10 @@
             boolean value = (Boolean) objValue;
             Settings.Secure.putInt(getContentResolver(), DOZE_ENABLED, value ? 1 : 0);
         }
+        if (preference == mTapToWakePreference) {
+            boolean value = (Boolean) objValue;
+            Settings.Secure.putInt(getContentResolver(), DOUBLE_TAP_TO_WAKE, value ? 1 : 0);
+        }
         if (preference == mNightModePreference) {
             try {
                 final int value = Integer.parseInt((String) objValue);
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index 5c367d7..fe68cbc4 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -29,6 +29,8 @@
 import android.os.Message;
 import android.os.storage.StorageManager;
 import android.os.storage.VolumeInfo;
+import android.preference.Preference;
+import android.preference.PreferenceCategory;
 import android.text.format.Formatter;
 import android.util.Log;
 import android.view.View;
@@ -69,17 +71,26 @@
     private static final int DLG_CANNOT_CLEAR_DATA = DLG_BASE + 2;
 
     private static final String KEY_MOVE_PREFERENCE = "app_location_setting";
-    private static final String KEY_STORAGE_SETTINGS = "storage_settings";
-    private static final String KEY_CACHE_SETTINGS = "cache_settings";
+    private static final String KEY_STORAGE_CATEGORY = "storage_category";
 
-    private TextView mTotalSize;
-    private TextView mAppSize;
-    private TextView mDataSize;
-    private TextView mExternalCodeSize;
-    private TextView mExternalDataSize;
+    private static final String KEY_TOTAL_SIZE = "total_size";
+    private static final String KEY_APP_SIZE = "app_size";
+    private static final String KEY_EXTERNAL_CODE_SIZE = "external_code_size";
+    private static final String KEY_DATA_SIZE = "data_size";
+    private static final String KEY_EXTERNAL_DATA_SIZE = "external_data_size";
+    private static final String KEY_CACHE_SIZE = "cache_size";
+
+    private static final String KEY_CLEAR_DATA = "clear_data_button";
+    private static final String KEY_CLEAR_CACHE = "clear_cache_button";
+
+    private Preference mTotalSize;
+    private Preference mAppSize;
+    private Preference mDataSize;
+    private Preference mExternalCodeSize;
+    private Preference mExternalDataSize;
 
     // Views related to cache info
-    private TextView mCacheSize;
+    private Preference mCacheSize;
     private Button mClearDataButton;
     private Button mClearCacheButton;
 
@@ -113,29 +124,28 @@
     private void setupViews() {
         mComputingStr = getActivity().getText(R.string.computing_size);
         mInvalidSizeStr = getActivity().getText(R.string.invalid_size_value);
-        LayoutPreference view = (LayoutPreference) findPreference(KEY_STORAGE_SETTINGS);
 
         // Set default values on sizes
-        mTotalSize = (TextView) view.findViewById(R.id.total_size_text);
-        mAppSize = (TextView) view.findViewById(R.id.application_size_text);
-        mDataSize = (TextView) view.findViewById(R.id.data_size_text);
-        mExternalCodeSize = (TextView) view.findViewById(R.id.external_code_size_text);
-        mExternalDataSize = (TextView) view.findViewById(R.id.external_data_size_text);
+        mTotalSize = findPreference(KEY_TOTAL_SIZE);
+        mAppSize =  findPreference(KEY_APP_SIZE);
+        mDataSize =  findPreference(KEY_DATA_SIZE);
+        mExternalCodeSize = findPreference(KEY_EXTERNAL_CODE_SIZE);
+        mExternalDataSize = findPreference(KEY_EXTERNAL_DATA_SIZE);
 
         if (Environment.isExternalStorageEmulated()) {
-            ((View) mExternalCodeSize.getParent()).setVisibility(View.GONE);
-            ((View) mExternalDataSize.getParent()).setVisibility(View.GONE);
+            PreferenceCategory category = (PreferenceCategory) findPreference(KEY_STORAGE_CATEGORY);
+            category.removePreference(mExternalCodeSize);
+            category.removePreference(mExternalDataSize);
         }
-        mClearDataButton = (Button) view.findViewById(R.id.clear_data_button)
+        mClearDataButton = (Button) ((LayoutPreference) findPreference(KEY_CLEAR_DATA))
                 .findViewById(R.id.button);
 
         mMoveDropDown = (DropDownPreference) findPreference(KEY_MOVE_PREFERENCE);
         mMoveDropDown.setCallback(this);
 
-        view = (LayoutPreference) findPreference(KEY_CACHE_SETTINGS);
         // Cache section
-        mCacheSize = (TextView) view.findViewById(R.id.cache_size_text);
-        mClearCacheButton = (Button) view.findViewById(R.id.clear_cache_button)
+        mCacheSize = findPreference(KEY_CACHE_SIZE);
+        mClearCacheButton = (Button) ((LayoutPreference) findPreference(KEY_CLEAR_CACHE))
                 .findViewById(R.id.button);
         mClearCacheButton.setText(R.string.clear_cache_btn_text);
     }
@@ -192,10 +202,10 @@
                 || mAppEntry.size == ApplicationsState.SIZE_UNKNOWN) {
             mLastCodeSize = mLastDataSize = mLastCacheSize = mLastTotalSize = -1;
             if (!mHaveSizes) {
-                mAppSize.setText(mComputingStr);
-                mDataSize.setText(mComputingStr);
-                mCacheSize.setText(mComputingStr);
-                mTotalSize.setText(mComputingStr);
+                mAppSize.setSummary(mComputingStr);
+                mDataSize.setSummary(mComputingStr);
+                mCacheSize.setSummary(mComputingStr);
+                mTotalSize.setSummary(mComputingStr);
             }
             mClearDataButton.setEnabled(false);
             mClearCacheButton.setEnabled(false);
@@ -210,29 +220,29 @@
             } else {
                 if (mLastExternalCodeSize != mAppEntry.externalCodeSize) {
                     mLastExternalCodeSize = mAppEntry.externalCodeSize;
-                    mExternalCodeSize.setText(getSizeStr(mAppEntry.externalCodeSize));
+                    mExternalCodeSize.setSummary(getSizeStr(mAppEntry.externalCodeSize));
                 }
                 if (mLastExternalDataSize !=  mAppEntry.externalDataSize) {
                     mLastExternalDataSize =  mAppEntry.externalDataSize;
-                    mExternalDataSize.setText(getSizeStr( mAppEntry.externalDataSize));
+                    mExternalDataSize.setSummary(getSizeStr( mAppEntry.externalDataSize));
                 }
             }
             if (mLastCodeSize != codeSize) {
                 mLastCodeSize = codeSize;
-                mAppSize.setText(getSizeStr(codeSize));
+                mAppSize.setSummary(getSizeStr(codeSize));
             }
             if (mLastDataSize != dataSize) {
                 mLastDataSize = dataSize;
-                mDataSize.setText(getSizeStr(dataSize));
+                mDataSize.setSummary(getSizeStr(dataSize));
             }
             long cacheSize = mAppEntry.cacheSize + mAppEntry.externalCacheSize;
             if (mLastCacheSize != cacheSize) {
                 mLastCacheSize = cacheSize;
-                mCacheSize.setText(getSizeStr(cacheSize));
+                mCacheSize.setSummary(getSizeStr(cacheSize));
             }
             if (mLastTotalSize != mAppEntry.size) {
                 mLastTotalSize = mAppEntry.size;
-                mTotalSize.setText(getSizeStr(mAppEntry.size));
+                mTotalSize.setSummary(getSizeStr(mAppEntry.size));
             }
 
             if ((mAppEntry.dataSize+ mAppEntry.externalDataSize) <= 0 || !mCanClearData) {
@@ -304,14 +314,18 @@
 
         final List<VolumeInfo> candidates = context.getPackageManager()
                 .getPackageCandidateVolumes(mAppEntry.info);
-        Collections.sort(candidates, VolumeInfo.getDescriptionComparator());
+        if (candidates.size() > 1) {
+            Collections.sort(candidates, VolumeInfo.getDescriptionComparator());
 
-        mMoveDropDown.clearItems();
-        for (VolumeInfo vol : candidates) {
-            final String volDescrip = storage.getBestVolumeDescription(vol);
-            mMoveDropDown.addItem(volDescrip, vol);
+            mMoveDropDown.clearItems();
+            for (VolumeInfo vol : candidates) {
+                final String volDescrip = storage.getBestVolumeDescription(vol);
+                mMoveDropDown.addItem(volDescrip, vol);
+            }
+            mMoveDropDown.setSelectable(!mAppControlRestricted);
+        } else {
+            removePreference(KEY_MOVE_PREFERENCE);
         }
-        mMoveDropDown.setSelectable(!mAppControlRestricted);
     }
 
     /*
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 1ef20f2..c74e23d 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -109,22 +109,22 @@
 
     // 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_ALL                     = 0;
-    public static final int FILTER_APPS_ENABLED                 = 1;
-    public static final int FILTER_APPS_DISABLED                = 2;
-    public static final int FILTER_APPS_BLOCKED                 = 3;
-    public static final int FILTER_APPS_PRIORITY                = 4;
-    public static final int FILTER_APPS_NO_PEEKING              = 5;
-    public static final int FILTER_APPS_SENSITIVE               = 6;
-    public static final int FILTER_APPS_PERSONAL                = 7;
-    public static final int FILTER_APPS_WORK                    = 8;
-    public static final int FILTER_APPS_WITH_DOMAIN_URLS        = 9;
-    public static final int FILTER_APPS_USAGE_ACCESS            = 10;
-    public static final int FILTER_APPS_POWER_WHITELIST         = 11;
-    public static final int FILTER_APPS_POWER_NO_WHITELIST      = 12;
+    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;
 
     // 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.filter_all_apps,      // All apps
         R.string.filter_enabled_apps,  // Enabled
         R.string.filter_apps_disabled, // Disabled
@@ -136,12 +136,11 @@
         R.string.filter_work_apps,     // Work
         R.string.filter_with_domain_urls_apps,     // Domain URLs
         R.string.filter_all_apps,      // Usage access screen, never displayed
-        R.string.high_power_filter_on,        // High power whitelist, on
-        R.string.high_power_filter_off,       // High power whitelist, off
     };
     // This is the actual mapping to filters from FILTER_ constants above, the order must
     // be kept in sync.
     public static final AppFilter[] FILTERS = new AppFilter[] {
+        AppStatePowerBridge.FILTER_POWER_WHITELISTED,     // High power whitelist, on
         ApplicationsState.FILTER_EVERYTHING,  // All apps
         ApplicationsState.FILTER_ALL_ENABLED, // Enabled
         ApplicationsState.FILTER_DISABLED,    // Disabled
@@ -153,8 +152,6 @@
         ApplicationsState.FILTER_WORK,        // Work
         ApplicationsState.FILTER_WITH_DOMAIN_URLS,   // Apps with Domain URLs
         AppStateUsageBridge.FILTER_APP_USAGE, // Apps with Domain URLs
-        AppStatePowerBridge.FILTER_POWER_WHITELISTED,     // High power whitelist, on
-        AppStatePowerBridge.FILTER_POWER_NOT_WHITELISTED, // High power whitelist, off
     };
 
     // sort order
@@ -321,7 +318,7 @@
             mFilterAdapter.enableFilter(FILTER_APPS_NO_PEEKING);
         }
         if (mListType == LIST_TYPE_HIGH_POWER) {
-            mFilterAdapter.enableFilter(FILTER_APPS_POWER_NO_WHITELIST);
+            mFilterAdapter.enableFilter(FILTER_APPS_ALL);
         }
         if (mListType == LIST_TYPE_STORAGE) {
             mApplications.setOverrideFilter(new VolumeFilter(mVolumeUuid));
diff --git a/src/com/android/settings/fuelgauge/PowerUsageDetail.java b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
index 5e11baf..6313ff5 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
@@ -358,6 +358,8 @@
         if (mHighPower != null) {
             mHighPower.setSummary(HighPowerDetail.getSummary(getActivity(), mApp.packageName));
         }
+
+        setupHeader();
     }
 
     private void createDetails() {
@@ -370,8 +372,6 @@
         mNoCoverage = args.getDouble(EXTRA_NO_COVERAGE, 0);
         mShowLocationButton = args.getBoolean(EXTRA_SHOW_LOCATION_BUTTON);
 
-        setupHeader();
-
         mTypes = args.getIntArray(EXTRA_DETAIL_TYPES);
         mValues = args.getDoubleArray(EXTRA_DETAIL_VALUES);
 
@@ -445,14 +445,14 @@
     private void setupHeader() {
         final Bundle args = getArguments();
         String title = args.getString(EXTRA_TITLE);
-        String iconPackage = args.getString(EXTRA_ICON_PACKAGE);
+        String pkg = args.getString(EXTRA_ICON_PACKAGE);
         int iconId = args.getInt(EXTRA_ICON_ID, 0);
         Drawable appIcon = null;
 
-        if (!TextUtils.isEmpty(iconPackage)) {
+        if (!TextUtils.isEmpty(pkg)) {
             try {
                 final PackageManager pm = getActivity().getPackageManager();
-                ApplicationInfo ai = pm.getPackageInfo(iconPackage, 0).applicationInfo;
+                ApplicationInfo ai = pm.getPackageInfo(pkg, 0).applicationInfo;
                 if (ai != null) {
                     appIcon = ai.loadIcon(pm);
                 }
@@ -466,8 +466,11 @@
             appIcon = getActivity().getPackageManager().getDefaultActivityIcon();
         }
 
+        if (pkg == null && mPackages != null) {
+            pkg = mPackages[0];
+        }
         AppHeader.createAppHeader(this, appIcon, title,
-                AppInfoWithHeader.getInfoIntent(this, iconPackage),
+                pkg != null ? AppInfoWithHeader.getInfoIntent(this, pkg) : null,
                 mDrainType != DrainType.APP ? android.R.color.white : 0);
     }
 
@@ -629,7 +632,6 @@
     private void addControl(int pageSummary, int actionTitle, final int action) {
         Preference pref = new Preference(getActivity());
         pref.setTitle(actionTitle);
-        pref.setSummary(pageSummary);
         pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
             @Override
             public boolean onPreferenceClick(Preference preference) {