Commit Graph

55 Commits

Author SHA1 Message Date
mxyyiyi
c9e8b8a011 Support Private Space in battery usage.
- Use database cache for single-user single-profile
- Reload battery usage info in other cases

Bug: 299032923
Test: manual
Change-Id: I5e524a094422639eedbf6e07eda498f3f72fccae
2024-03-15 11:13:34 +08:00
mxyyiyi
b20f910cd1 Update accessibility content description for battery usage chart view.
- Add battery level percentage description.

Bug: 317000579
Test: make RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge.batteryusage.*"
Change-Id: I03c8a97c521997170cbd72b7e0fcc88f7eb97221
2024-01-08 18:30:01 +08:00
Jun Lan
cca804e1ed Format battery java code
After this CL, we can follow Guideline:go/hc-mainline-dev#format-code to keep java format consistent.

Test: manual
Bug: 304439460
Change-Id: I5bb77f81b0bd9be618e34942eaaee8296bc42796
2023-11-06 13:55:48 +08:00
Zaiyue Xue
6bf04986ac Fix NullPointerException when showEmptyChart
Bug: 301880705
Fix: 301880705
Test: presubmit
Change-Id: I22a1df6b791396b398038c6bdb8e6b3ca37dc9e1
2023-09-26 11:40:57 +08:00
mxyyiyi
56ba1c09d9 App anomaly tips on PowerUsage App list
Screenshots:
[in bg - banner] https://screenshot.googleplex.com/MzLC6LfX93TkkYf
[in bg - hints] https://screenshot.googleplex.com/9JLXNsRiVG8arAU
[in fg - banner] https://screenshot.googleplex.com/9oYbwUkeeLbQX2t
[in fg - hints] https://screenshot.googleplex.com/53DTTUCUnf8rsoE
[apps anomaly highlight hint + settings anomaly banner]
https://screenshot.googleplex.com/8NdS2VMrSzwv2DM

Bug: 291689643
Bug: 291689623
Test: manual
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:bfd0f5859b6e5ffef4727ee562009f2050de7a58)
Change-Id: Ic02db49cb3794ef134759d9dcec5f5ef32454a95
2023-09-18 10:41:27 +00:00
mxyyiyi
6b8daefd54 Impl highlight effect on BatteryChartView slots. am: 6750634259 am: 9e4fed1b62
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/24498956

Change-Id: I9a38284ab828c149ca06a51fbad7f3fcb2ac33de
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-13 08:54:29 +00:00
mxyyiyi
6750634259 Impl highlight effect on BatteryChartView slots.
Screenshot: https://screenshot.googleplex.com/F5VrGjj5kdNHMV6

Bug: 284893240
Bug: 291689623
Test: manual
Change-Id: I846d95d31e8bb839481b86a94d5191ff205f8328
2023-09-13 13:29:32 +08:00
Zaiyue Xue
ea0f5b3d45 Refactor battery usage page contollers interaction logic
(1) Move controllers interaction logic from BatteryChartPreferenceController to main page PowerUsageAdvanced.
(2) Move query power anomaly logic to DataProcessManager async job.

Bug: 284893240
Test: manual
Change-Id: Ib23b338fe3946e68ff73a372342ec5d86494c566
Merged-In: Ib23b338fe3946e68ff73a372342ec5d86494c566
2023-09-13 03:56:28 +00:00
mxyyiyi
19046965da Refactor flags of Power Anomaly Tips in Settings Intelligence.(1/2)
- Remove unused flag is_battery_tips_feedback_enabled
- Update logic about is_battery_tips_enabled

Bug: 284893240
Bug: 291689623
Test: Manual
Change-Id: I826f517aa61e0c970048164706c4512ac3e0472d
Merged-In: I826f517aa61e0c970048164706c4512ac3e0472d
2023-09-12 11:28:10 +00:00
Zaiyue Xue
f5ea50e20e Refactor battery usage page contollers interaction logic
(1) Move controllers interaction logic from BatteryChartPreferenceController to main page PowerUsageAdvanced.
(2) Move query power anomaly logic to DataProcessManager async job.

Bug: 284893240
Test: manual
Change-Id: Ib23b338fe3946e68ff73a372342ec5d86494c566
Merged-In: Ib23b338fe3946e68ff73a372342ec5d86494c566
2023-09-06 17:51:02 +08:00
mxyyiyi
2c0242bed3 Refactor flags of Power Anomaly Tips in Settings Intelligence.(1/2)
- Remove unused flag is_battery_tips_feedback_enabled
- Update logic about is_battery_tips_enabled

Bug: 284893240
Test: Manual
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:24e269dd0a63b5cb98fec791708cfe294b5aa47c)
Change-Id: I826f517aa61e0c970048164706c4512ac3e0472d
2023-09-05 17:48:18 +00:00
mxyyiyi
d9360ec326 Impl dismiss action in battery tips cards.
- Use SharedPreferences to record and filter the already dimissed anomaly.

Bug: 291689623
Test: manual
Change-Id: I4fd4a39066591a4a201857f9586b6595b7d5c43b
2023-08-25 20:17:31 +08:00
mxyyiyi
737b9ab5b7 Impl dismiss action in battery tips cards.
- Use SharedPreferences to record and filter the already dimissed anomaly.

Bug: 291689623
Test: manual
Change-Id: I4fd4a39066591a4a201857f9586b6595b7d5c43b
2023-08-24 10:20:49 +08:00
Xinyi Mao
26a2056b8e Merge "Update the detect & show pipeline for PowerAnomalyEventList." into main 2023-08-18 02:52:02 +00:00
Zaiyue Xue
aa37dd953e Merge "Battery usage page latency improvement (1-8)" into udc-qpr-dev am: 1dad0bf856 am: d1a0370ddb
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/24211971

Change-Id: I2e0c1388e423cc18db20bbbb1f14b73d9667199f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-18 02:47:49 +00:00
Zaiyue Xue
1dad0bf856 Merge "Battery usage page latency improvement (1-8)" into udc-qpr-dev 2023-08-18 02:35:15 +00:00
mxyyiyi
2037b262ff Impl the detect & show pipeline for PowerAnomalyEventList.
Test: make SettingsLibRoboTests
Bug: 293813663
Bug: 296322845
Change-Id: I0c477dc546ec4d00e4c4133afb61bf7d574be9f8
Merged-In: I0c477dc546ec4d00e4c4133afb61bf7d574be9f8
2023-08-17 06:35:49 +00:00
mxyyiyi
a7a0949a35 Update the detect & show pipeline for PowerAnomalyEventList.
Test: make SettingsLibRoboTests
Bug: 293813663
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f978f8b045c2d08e07735f0e7c2b343d53fb5580)
Change-Id: I4a5a550b8c1a2317468e8cc4bd8c2b594c4208ac
2023-08-17 03:55:21 +00:00
Zaiyue Xue
50da7feeb9 Battery usage page latency improvement (1-8)
Save battery slot diff data into database in hourly job. Then read the
saved diff data and only calculate the remaining data. This could speed
up the battery usage loading.

Bug: 261163071
Fix: 261163071
Test: manual
Change-Id: Icd4868ca9326b64b17ddbccdb0311e755dc68026
2023-08-16 15:12:04 +08:00
mxyyiyi
4ea5aaf5ef Impl the detect & show pipeline for PowerAnomalyEventList.
Test: make SettingsLibRoboTests
Bug: 293813663
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4c6f81c41e2806f384d2e465e89dadb7383048e8)
Change-Id: I0c477dc546ec4d00e4c4133afb61bf7d574be9f8
2023-08-11 13:24:39 +00:00
mxyyiyi
2148988cae Improve battery tips cards.
- Updated Card UI
- Set thumb-up/down feedback preference to be GONE
- Add basic button action

[Screenshots] https://screenshot.googleplex.com/925MEzRyUCxZCi8

Test: manual
Change-Id: I356648d0fcec5dd1ea724297187ecafb5be55fd8
Merged-In: I356648d0fcec5dd1ea724297187ecafb5be55fd8
Bug: 291689623
2023-08-11 03:26:15 +00:00
mxyyiyi
14d0a1c102 Improve battery tips cards.
Test: manual
Change-Id: I356648d0fcec5dd1ea724297187ecafb5be55fd8
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:13fec0dbdb2c809f20a1e3b711e2491745f6d506)
Bug: 291689623
2023-08-10 07:44:07 +00:00
Chaohui Wang
8e2ae547d6 Clean up FeatureFactory.getFeature()
Bug: 286764889
Test: m Settings
Change-Id: I7e472e6b0ca6b7a735c1b92742ddf06c545176fc
2023-08-08 08:41:48 +00:00
mxyyiyi
c4ac74872b Implement the battery tips cards.(1/2)
Bug: 291689623
Test: Manual
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:3ff665bd3292986030fdd8a3689b35bbf6f5a615)
Change-Id: I4443cdb21b3ba30900fc2f6fcc21c4c56dc1293f
2023-08-01 10:49:01 +00:00
mxyyiyi
be8407c566 Implement the battery tips cards.(1/2)
- Implement a tips card UI in Battery Usage.

[Screenshot]:
- Tips Card with thumbs-up/down feedback in dark mode
https://screenshot.googleplex.com/3nRCFYvLTWfiYYT
- Tips Card without feedback
https://screenshot.googleplex.com/B7QGRJZAHzgWpCP
- Tips Card in Force RTL layout
https://screenshot.googleplex.com/8crQdj8ao26pKpH
- Tips Card in light mode
https://screenshot.googleplex.com/885aVvZm8xmhK2S

[TODO]:
- Add accessibility
- Localization

Bug: 291689623
Test: Manual
Change-Id: I4443cdb21b3ba30900fc2f6fcc21c4c56dc1293f
Merged-In: I4443cdb21b3ba30900fc2f6fcc21c4c56dc1293f
2023-08-01 09:49:19 +00:00
Zaiyue Xue
d92c4fc823 Combine screen on time map into battery usage map
This cl is refactor only. It makes next cl ag/22809776 easy to replace screen
compenent time with screen on time.

Bug: 278022529
Test: manual
Change-Id: I2538aeafb0c697f13ec617cea44a70a1b2a114b0
2023-04-24 14:08:13 +08:00
Zaiyue Xue
bcafd5dfda Support battery usage chart start index label is the detailed last full charge time
https://screenshot.googleplex.com/5dYp7kJpNPMU6Jx.png
https://screenshot.googleplex.com/7ZSbWyCGRFSym6A.png
https://screenshot.googleplex.com/9GsPTa9zd2XttDX.png

Bug: 271214926
Fix: 271214926
Test: manual
Change-Id: Ic869653f66866964f34e111dd2ee8c052313e119
2023-04-13 16:37:35 +08:00
Zaiyue Xue
29da0e6d9f Fix b/277880435: System battery settings app crash
Bug: 277880435
Fix: 277880435
Test: manual
Change-Id: I369c04584c95c13e8636b5c9713e26e528ab627a
2023-04-13 11:23:46 +08:00
Zaiyue Xue
ea5b49f799 Fix b/265364351: Light theme icons opacity is too light
https://screenshot.googleplex.com/Avqsw3gb2tjKqrK.png
https://screenshot.googleplex.com/46AZuJMjp2HMyqd.png
https://screenshot.googleplex.com/9mE3XutRUNaGckg.png
https://screenshot.googleplex.com/5rNUKMJjhNBNShZ.png

Bug: 265364351
Fix: 265364351
Test: manual
Change-Id: I7521030f1a5d84cd88027fb84a465623610707fb
2023-02-23 21:12:29 +08:00
Zaiyue Xue
d4aa8d764d [Battery Usage] Make the timestamp slot info text format localizable.
(1) Some languages could localize the hephen to "~" or "to".
(2) Both 12hr format and 24hr format will have spaces around the hyphen.

Bug: 267185303
Bug: 266839251
Bug: 267349989
Bug: 267572852
Bug: 267595534
Test: manual
Change-Id: I62ff37d9ab20292621ee29ee3080cea7f8fd0fdb
2023-02-08 15:38:42 +08:00
Zaiyue Xue
e04ffdea58 Fix b/265746746: Announce "Battery usage for [slot_timestamp]" instead of changing focus when Talk Back on.
https://drive.google.com/file/d/173RPKsnIE7ZhBAJLrivqkbiWg9Ay41bC/view?usp=sharing&resourcekey=0-jHJ7vZ9BEhzxdWncqCQVQg

Bug: 265746746
Fix: 265746746
Test: manual
Change-Id: Iad92eff50d73853793daa9d6d3551768678c2eb2
2023-02-06 17:38:29 +08:00
Kuan Wang
a708592e0a Add logging for total screen-on time and foreground usage time.
Test: manual
Bug: 260965322
Change-Id: Ia1711fb73a6390e6a91289331daf3d88675731fe
2023-01-10 14:36:01 +08:00
Zaiyue Xue
833e47d851 [Battery usage U] [UI] Show total "Screen On Time" in the battery usage page
Screen record: https://drive.google.com/open?id=16ZOp1E2YBzWQXbnXl786FaLFPel-S9CF&authuser=0&resourcekey=0-oRqCrdTc9FZjVgsq9orhEw&usp=drive_link
For Arabic: https://drive.google.com/open?id=1zh_4jcUnqLC6CDgwju1qQkWJ0QCtm19c&authuser=0&resourcekey=0-kuKfDdOTWxqOUmD0RfPNLQ&usp=drive_link

Next step: show screen on time for each app

Bug: 258120710
Test: manual
Change-Id: I2085a2a85ebd50b2ac876972f6a8ebbf6f20246c
2023-01-06 19:09:52 +08:00
Kuan Wang
1ce97c8ebe Generate app and device screen-on time data and return back to UI for
rendering.

Test: make RunSettingsRoboTests + manually
Bug: 260964903
Change-Id: I2fd69b4686cc2e1413ad0eb43c07b6164e411411
2022-12-28 07:40:39 +00:00
Kuan Wang
a1a7cba6a6 Move the getBatteryLevelData function from DataProcessor to
DataProcessManager and start the async task in DataProcessManager when
there is no battery level data.

Test: make RunSettingsRoboTests + manually
Bug: 260964903
Change-Id: Ie36ab6d121a5596a3abc16e7f570dd0d9b32e11c
2022-12-21 02:39:11 +00:00
Zaiyue Xue
76f19809c1 Fix b/261390301: NullPointerException at BatteryChartPreferenceController.addAllPreferences()
Bug: 261390301
Fix: 261390301
Test: manual
Change-Id: I23a2f0e73c5840b87577e734a4760423e0d62516
2022-12-07 17:09:05 +08:00
Zaiyue Xue
3d7b8b3bfe [Battery usage U] Show battery usage info immediately up till as close to the current moment as possible.
screen_record: https://drive.google.com/file/d/1Wdm8Wpn39k6E9Yo4bbTENf5VANP337QA/view?usp=share_link&resourcekey=0-1LNmaTaZI13DUmjNfkBehQ

Bug: 252407178
Fix: 252407178
Test: maunal
Change-Id: Ia08dea791bb72113719fd1316e8e9587a96eaef1
2022-12-06 17:36:55 +08:00
Zaiyue Xue
00fb008e9c Support App and System tabs for battery usage breakdown.
design_doc: go/usage-frontend-dd

screen_record: https://drive.google.com/file/d/1I8dnoMf7y9KUg0eVeqLJpHqGGOtaX6_0/view?usp=share_link&resourcekey=0-Mte0-LKN1LULRssg9t7zGg

Bug b/260786962 is also fixed in this cl.

Bug: 258123381
Bug: 260786962
Fix: 258123381
Fix: 260786962
Test: manual
Change-Id: Ifd337331d02dc10c3234c594b2e142bcd459c00f
2022-12-06 11:23:27 +08:00
Kuan Wang
ec1c9d94f2 Remove foreground_service_usage_time_in_ms field which has been merged
into background_usage_time_in_ms in the BatteryUsageStats (b/257392992).

Test: make RunSettingsRoboTests + manual
Bug: 258124768
Bug: 253553141
Change-Id: I0967eec0cbe6d0cb7a0535d744a1046dec1d267b
2022-12-06 01:04:48 +00:00
Kuan Wang
53a761f55b Populate new fields foreground_service_usage_time_in_ms,
foreground_usage_consume_power, foreground_service_usage_consume_power,
background_usage_consume_power and cached_usage_consume_power into
database and pass them to UI.

Test: make RunSettingsRoboTests + manual
Bug: 256123455
Bug: 258124768
Change-Id: Ic46032f67eff5898f9d4182c517bbebe478eca01
2022-11-29 11:42:26 +08:00
Zaiyue Xue
c9d85ff63d Update the preference controller in search index for battery usage.
BatteryAppListPreferenceController is totally replaced by
BatteryChartPreferenceController now. Update the search index returns.

Bug: 256123455
Test: manual
Change-Id: I2340f1be0cee74771aab293a5df8551325c014be
2022-11-10 13:53:35 +08:00
Kuan Wang
c5c87b7774 Replaces getBatteryHistoryUri and getBatteryHistorySinceLastFullCharge
with the new functions in DatabaseUtils.

Bug: 253395332
Test: make RunSettingsRoboTests + manually
Change-Id: I5f60cef80d1e9ba3f87ab6f84492463152a40276
2022-11-01 02:06:57 +00:00
Zaiyue Xue
aabea16898 Fix b/248686898: Battery Usage list renders items on top of each other after swiping back from an app
Root cause: When adding an animation to the hourly chartview which is scolled up out of the page, onBindViewHolder() will be trigered, then UI is refreshed again, and then the animation is added to the hourly charview again. This is a dead loop.

This fix adds animation to the hourly chartview only if the visibility is changed.

http://cs/android/packages/apps/Settings/src/com/android/settings/fuelgauge/batteryusage/BatteryChartPreferenceController.java;l=676;rcl=9f24ea815d637a05e1b7ddf2d4372d716d749229
http://cs/android/packages/apps/Settings/src/com/android/settings/fuelgauge/batteryusage/BatteryHistoryPreference.java;l=102;rcl=9f24ea815d637a05e1b7ddf2d4372d716d749229

Bug: 248686898
Fix: 248686898
Test: manually
Change-Id: I93d4d089f537515d452c1330f5d75a6726b229f8
2022-10-26 11:22:03 +08:00
Kuan Wang
c7afa45eac Clean up unused function getHideApplicationSummary in
PowerUsageFeatureProvider.

Bug: 253395332
Bug: 254769892
Bug: 254769770
Test: make RunSettingsRoboTests
Change-Id: I6acf0cbdb7321934e85939e0acee567001107a17
2022-10-21 04:42:06 +00:00
Kuan Wang
b1b79bf0f0 Avoid fade animation when users switch index in hour chart.
Before: https://drive.google.com/file/d/13L1hfbhLiNY_GlT0zzE-SqU3fNXmdta6/view?usp=sharing
After: https://drive.google.com/file/d/1l75m1gzGBcy41SFHJvkcDiwaeZo0Rzpj/view?usp=sharing

Test: manually
Bug: 245655904
Change-Id: Iffaf5328b04ffb1f0ff155ecd8c67cd58b9cbfb5
2022-09-20 12:15:26 +08:00
Kuan Wang
bd9042c47f Show app list in Battery Usage page when there is no battery level data.
https://drive.google.com/file/d/1iQxKmEp_weNYdT4JnsiZgYy9mCdn7SRv/view?usp=sharing

Bug: 246233366
Test: make RunSettingsRoboTests + manually
Change-Id: If536c93652506c8009f5cabf3d0ae373b6825bfc
Merged-In: If536c93652506c8009f5cabf3d0ae373b6825bfc
2022-09-20 12:11:25 +08:00
Zaiyue Xue
9b24df2c38 Merge changes from topic "accessibility1" into tm-qpr-dev
* changes:
  Support accessibility for battery chart (4)
  Support accessibility for battery chart (3)
  Support accessibility for battery chart (2)
  Support accessibility for battery chart (1)
2022-09-14 05:46:17 +00:00
Zaiyue Xue
525fd2dc3b Support accessibility for battery chart (4)
According to accessibility suggestion, when users double clicked a time slot in battery usage chart with TalkBack on, jump the accessibility focus to the app list category title to let users know what happened after click.

screen record: https://drive.google.com/file/d/13vvA2Il5lz9kvHegH9Tmbq9hJYFGVwJJ/view?usp=sharing&resourcekey=0-g3A29rVsd4NU37SwBD1uzQ

Bug: 242989585
Fix: 242989585
Test: manual

Change-Id: I8ab3b5f1364247121e43b0b8d51e8aa3743b5c2b
2022-09-13 14:50:57 +08:00
Zaiyue Xue
79311805b6 Support accessibility for battery chart (3)
Support accessibilty read out full timestamp labels instead of the short one, e.g "Sunday" instead of "Sun".

Bug: 242989585
Test: manual
Change-Id: Ica2176ef3f07849d278327b9301f8c318782c2d5
2022-09-13 14:43:20 +08:00
Kuan Wang
3759adfda6 Add fade in / out animation for battery usage hourly chart.
After:
https://drive.google.com/file/d/1-1z2EM16X76qltTz_fL_DvgI7m65TtAN/view?usp=sharing

Before:
https://drive.google.com/file/d/1pG2rQ3V4rphjx7RLhSjb1r2HgXiFCYQZ/view?usp=sharing

Bug: 245655904
Test: manually
Change-Id: I72533a28445bea83aea604a937864052bd65c898
2022-09-13 12:19:59 +08:00