Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a224b010 authored by jackqdyulei's avatar jackqdyulei
Browse files

Create Advanced battery page

The advanced page shows two major parts, one is the battery usage
graph and the other is battery usage list. In usage list, each item
shows basic info of battery usage of one type(e.g. Apps, System)

Bug: 34385770
Test: RunSettingsRoboTests

Change-Id: I22475a489285787afa775af8d5ae3340eff1eed9
parent 58f72953
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
<!--
     Copyright (C) 2017 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0"
    android:tint="?android:attr/colorControlNormal">
    <path android:fillColor="#FF000000"
          android:pathData="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"/>
</vector>
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -153,4 +153,8 @@
        <attr name="aspectRatio" format="float" />
    </declare-styleable>

    <declare-styleable name="TintablePreference">
        <attr name="android:tint" format="color|reference"/>
    </declare-styleable>

</resources>
+13 −1
Original line number Diff line number Diff line
@@ -4320,7 +4320,9 @@
    <!-- Bluetooth on time -->
    <string name="bluetooth_on_time">Wi\u2011Fi on time</string>
    <!-- Activity title for battery usage history details -->
    <!-- Activity title for advanced battery usage page [CHAR LIMIT=60] -->
    <string name="advanced_battery_title">Advanced battery usage</string>
    <!-- Activity title for battery usage history details [CHAR LIMIT=60] -->
    <string name="history_details_title">History details</string>
    <!-- Activity title for battery usage details for an app. or power consumer -->
@@ -4354,6 +4356,14 @@
    <string name="power_unaccounted">Miscellaneous</string>
    <!-- Label for power that we computed too much for -->
    <string name="power_overcounted">Over-counted</string>
    <!-- Label for power consumed by apps [CHAR LIMIT=30] -->
    <string name="power_apps">Apps</string>
    <!-- Label for power consumed by services [CHAR LIMIT=30] -->
    <string name="power_service">Services</string>
    <!-- Label for power consumed by system [CHAR LIMIT=30] -->
    <string name="power_system">System</string>
    <!-- Label for power consumed by user [CHAR LIMIT=30] -->
    <string name="power_user">User</string>
    <!-- Label for CPU usage time -->
    <string name="usage_type_cpu">CPU total</string>
@@ -4473,6 +4483,8 @@
    <!-- Description for battery usage time for an app, i.e. Used for 30min. [CHAR LIMIT=60] -->
    <string name="battery_used_for">Used for %1$s</string>
    <!-- Description for battery usage detail information since last full charge. [CHAR LIMIT=120] -->
    <string name="battery_detail_since_full_charge">Usage breakdown since last full charge</string>
    <!-- Menu label for viewing battery usage since unplugged -->
    <string name="menu_stats_unplugged"><xliff:g id="unplugged">%1$s</xliff:g> since unplugged</string>
+0 −1
Original line number Diff line number Diff line
@@ -433,5 +433,4 @@
    </style>

    <style name="AppActionPrimaryButton" parent="android:Widget.Material.Button.Colored"/>

</resources>
+64 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 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/advanced_battery_title"
    settings:keywords="@string/keywords_battery">

    <com.android.settings.fuelgauge.BatteryHistoryPreference
        android:key="battery_graph"/>

    <PreferenceCategory
        android:key="battery_usage_list"
        android:title="@string/battery_detail_since_full_charge">

        <com.android.settings.fuelgauge.PowerGaugePreference
            android:key="battery_apps"
            android:title="@string/power_apps"/>

        <com.android.settings.fuelgauge.PowerGaugePreference
            android:key="battery_wifi"
            android:title="@string/power_wifi"/>

        <com.android.settings.fuelgauge.PowerGaugePreference
            android:key="battery_cell"
            android:title="@string/power_cell"/>

        <com.android.settings.fuelgauge.PowerGaugePreference
            android:key="battery_service"
            android:title="@string/power_service"/>

        <com.android.settings.fuelgauge.PowerGaugePreference
            android:key="battery_system"
            android:title="@string/power_system"/>

        <com.android.settings.fuelgauge.PowerGaugePreference
            android:key="battery_bluetooth"
            android:title="@string/power_bluetooth"/>

        <com.android.settings.fuelgauge.PowerGaugePreference
            android:key="battery_idle"
            android:title="@string/power_idle"/>

        <com.android.settings.fuelgauge.PowerGaugePreference
            android:key="battery_user"
            android:title="@string/power_user"/>

    </PreferenceCategory>

</PreferenceScreen>
Loading