Add high power whitelist for apps

 - Strings not final!
 - New UX for power usage details (more preferency)
 - Add high power apps list shows on/off and screen to
   change (when possible)
 - Link from power usage summary to high power list
 - Link from advanced apps to high power list

Bug: 19991702
Change-Id: I97c927ed82d3b89041e4429b427508545763d66c
diff --git a/res/xml/advanced_apps.xml b/res/xml/advanced_apps.xml
index e808210..62431c3 100644
--- a/res/xml/advanced_apps.xml
+++ b/res/xml/advanced_apps.xml
@@ -26,12 +26,6 @@
         settings:keywords="@string/keywords_default_apps" />
 
     <PreferenceScreen
-        android:key="manage_perms"
-        android:fragment="com.android.settings.applications.ManagePermissions"
-        android:title="@string/app_permissions"
-        settings:keywords="@string/keywords_app_permissions" />
-
-    <PreferenceScreen
             android:key="domain_urls"
             android:title="@string/domain_urls_title"
             android:fragment="com.android.settings.applications.ManageApplications">
@@ -40,4 +34,19 @@
                 android:value="com.android.settings.Settings$DomainsURLsAppListActivity" />
     </PreferenceScreen>
 
+    <PreferenceScreen
+        android:key="manage_perms"
+        android:fragment="com.android.settings.applications.ManagePermissions"
+        android:title="@string/app_permissions"
+        settings:keywords="@string/keywords_app_permissions" />
+
+    <PreferenceScreen
+        android:key="high_power_apps"
+        android:title="@string/high_power_apps"
+        android:fragment="com.android.settings.applications.ManageApplications">
+        <extra
+            android:name="classname"
+            android:value="com.android.settings.Settings$HighPowerApplicationsActivity" />
+    </PreferenceScreen>
+
 </PreferenceScreen>
diff --git a/res/xml/high_power_details.xml b/res/xml/high_power_details.xml
new file mode 100644
index 0000000..81f7806
--- /dev/null
+++ b/res/xml/high_power_details.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.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:title="@string/high_power">
+
+    <SwitchPreference
+        android:key="high_power_switch"
+        android:title="@string/high_power" />
+
+    <Preference
+        android:summary="@string/high_power_desc"
+        android:selectable="false" />
+
+</PreferenceScreen>
diff --git a/res/xml/installed_app_details.xml b/res/xml/installed_app_details.xml
index 233331d..deab13b 100644
--- a/res/xml/installed_app_details.xml
+++ b/res/xml/installed_app_details.xml
@@ -18,7 +18,8 @@
                   android:title="@string/application_info_label">
     <com.android.settings.applications.LayoutPreference
         android:key="header_view"
-        android:layout="@layout/installed_app_details" />
+        android:layout="@layout/installed_app_details"
+        android:selectable="false" />
 
     <Preference
         android:key="storage_settings"
@@ -44,4 +45,10 @@
         android:key="preferred_settings"
         android:title="@string/launch_by_default"
         android:selectable="true" />
+
+    <Preference
+        android:key="battery"
+        android:title="@string/power_usage_summary_title"
+        android:selectable="true" />
+
 </PreferenceScreen>
diff --git a/res/xml/power_usage_details.xml b/res/xml/power_usage_details.xml
new file mode 100644
index 0000000..ca84e89
--- /dev/null
+++ b/res/xml/power_usage_details.xml
@@ -0,0 +1,47 @@
+<?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.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+
+        <com.android.settings.fuelgauge.BatteryHistoryPreference
+            android:key="battery_history" />
+
+        <com.android.settings.applications.LayoutPreference
+            android:key="two_buttons"
+            android:layout="@layout/two_buttons_panel"
+            android:selectable="false" />
+
+        <Preference
+            android:key="high_power"
+            android:title="@string/high_power" />
+
+        <PreferenceCategory
+            android:key="details_parent"
+            android:title="@string/details_subtitle" />
+
+        <PreferenceCategory
+            android:key="controls_parent"
+            android:title="@string/controls_subtitle" />
+
+        <PreferenceCategory
+            android:key="messages_parent" />
+
+        <PreferenceCategory
+            android:key="packages_parent"
+            android:title="@string/packages_subtitle" />
+
+</PreferenceScreen>
diff --git a/res/xml/power_usage_summary.xml b/res/xml/power_usage_summary.xml
index 0622513..3f39d47 100644
--- a/res/xml/power_usage_summary.xml
+++ b/res/xml/power_usage_summary.xml
@@ -17,6 +17,13 @@
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
         android:title="@string/power_usage_summary_title"
-        settings:keywords="@string/keywords_battery"
-        android:key="app_list">
+        settings:keywords="@string/keywords_battery">
+
+        <com.android.settings.fuelgauge.BatteryHistoryPreference
+            android:key="battery_history" />
+
+        <PreferenceCategory
+            android:key="app_list"
+            android:title="@string/power_usage_list_summary" />
+
 </PreferenceScreen>