From 1b9eb170dd167d29380660b83a4fca5146cbf0a4 Mon Sep 17 00:00:00 2001 From: mxyyiyi Date: Mon, 25 Sep 2023 18:57:33 +0800 Subject: [PATCH] Refactor Power Usage Time Page. - Show use time category Screenshot: [Screen time with hint] https://screenshot.googleplex.com/3cRLrwevzw4iytb [Background time with hint] https://screenshot.googleplex.com/zEf8PcWopCVCRZR [without hint] https://screenshot.googleplex.com/9bao9sVd8s7VRwM [enter from app info (without category)] https://screenshot.googleplex.com/8sozxMrq8ojadiF Bug: 302063050 Test: Manual Change-Id: Ic967d05a173afa76c2a958e1332dedd9f83cd687 --- res/layout/anomaly_app_item_preference.xml | 27 +---- res/layout/power_anomaly_hints.xml | 42 +++++++ res/layout/power_usage_time.xml | 49 ++++++++ res/values/strings.xml | 8 ++ res/xml/power_usage_detail.xml | 55 ++++++--- .../AppBatteryPreferenceController.java | 5 +- .../fuelgauge/AdvancedPowerUsageDetail.java | 58 +++++----- .../fuelgauge/PowerUsageTimeController.java | 108 ++++++++++++++++++ .../fuelgauge/PowerUsageTimePreference.java | 95 +++++++++++++++ .../batteryusage/AnomalyEventWrapper.java | 16 ++- .../BatteryUsageBreakdownController.java | 13 ++- .../protos/power_anomaly_event.proto | 2 + .../spa/app/appinfo/AppBatteryPreference.kt | 6 +- .../app/appinfo/AppBatteryPreferenceTest.kt | 2 + 14 files changed, 407 insertions(+), 79 deletions(-) create mode 100644 res/layout/power_anomaly_hints.xml create mode 100644 res/layout/power_usage_time.xml create mode 100644 src/com/android/settings/fuelgauge/PowerUsageTimeController.java create mode 100644 src/com/android/settings/fuelgauge/PowerUsageTimePreference.java diff --git a/res/layout/anomaly_app_item_preference.xml b/res/layout/anomaly_app_item_preference.xml index 0a198496f1e..681fe68339a 100644 --- a/res/layout/anomaly_app_item_preference.xml +++ b/res/layout/anomaly_app_item_preference.xml @@ -35,33 +35,10 @@ - - + android:layout_marginEnd="16dp"/> - - - - + \ No newline at end of file diff --git a/res/layout/power_anomaly_hints.xml b/res/layout/power_anomaly_hints.xml new file mode 100644 index 00000000000..e4ec47b6473 --- /dev/null +++ b/res/layout/power_anomaly_hints.xml @@ -0,0 +1,42 @@ + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/power_usage_time.xml b/res/layout/power_usage_time.xml new file mode 100644 index 00000000000..bad68f4517f --- /dev/null +++ b/res/layout/power_usage_time.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 3d05af37af2..3ed2dc95f31 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5307,6 +5307,10 @@ %1$s remaining %1$s to charge + + Screen time + + Background time %1$s%2$s @@ -5322,6 +5326,8 @@ Since this app is not set to optimize battery, you can\u2019t restrict it.\n\nTo restrict the app, first turn on battery optimization. + + Manage battery usage Unrestricted @@ -5668,6 +5674,8 @@ Background: less than a min Screen time: less than a min + + Less than a min Total: %s diff --git a/res/xml/power_usage_detail.xml b/res/xml/power_usage_detail.xml index c9836b4324c..7b92f998e4c 100644 --- a/res/xml/power_usage_detail.xml +++ b/res/xml/power_usage_detail.xml @@ -27,23 +27,48 @@ - + - + - + + + + + + + + + + + + +