Commit Graph

2090 Commits

Author SHA1 Message Date
YK Hung
cc9ae66987 Merge "Remove legacy useless BatteryTip cache mechanism" 2023-02-09 03:24:38 +00:00
TreeHugger Robot
5982ef23af Merge "Optimize the tip detector loading performance" 2023-02-09 03:21:04 +00:00
ykhung
7cf9d0108e Replace getBatteryIntent() to centralized method
Replace the current getBatteryIntent() in the Settings into the
centralized method in the SettingsLib

Bug: N/A
Test: presubmit
Change-Id: If27d01c4ff52259e0185ca5d16ac88ca1bebac82
2023-02-09 11:13:27 +08:00
ykhung
4a1f04e70d Remove legacy useless BatteryTip cache mechanism
Remove the legacy BatteryTip list cache mechanism to avoid not using the
new re-create BatteryTip list, but only update its state and invoke
updatePreference(). We should use the new BatteryTip list to apply the
new detected results.

Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge.batterytip"
Change-Id: I884f04927403ad4d97b459ff5477a1fe9df21553
2023-02-09 01:11:25 +08:00
ykhung
19b913cd0c Optimize the tip detector loading performance
Optimize the tip detector loading performance by removing 3 times
redundant IPC with PowerManager and BatteryManager

Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge.batterytip"
Change-Id: I0df8b0c600b743c93dfcdd66aeae07e2aba6b797
2023-02-09 00:46:58 +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
TreeHugger Robot
6f76d5dc91 Merge "Fix b/265746746: Announce "Battery usage for [slot_timestamp]" instead of changing focus when Talk Back on." 2023-02-06 10:49:46 +00: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
ykhung
a43f9ead39 Add incompatible charging battery tip detector
Fix: 263193978
Bug: 246960554
Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge.batterytip"
Change-Id: Ifbfd28e81b03aa8e1bb4cc70199b3262e21931cc
2023-02-06 08:48:49 +00:00
ykhung
c6d34d6c58 Add incompatible charging battery tip UI and card skeleton
Bug: 263193978
Bug: 246960554
Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge.batterytip"
Change-Id: I8180022bd39f66c88463a2552c6050669bb0357c
2023-02-06 03:25:23 +00:00
ykhung
2593fcd1bf Clean up useless battery tips and detectors
Bug: 263193978
Test: make -j64 RunSettingsRoboTests
ROBOTEST_FILTER="com.android.settings.fuelgauge.batterytip"

Change-Id: Idfe03eee5acee33126f1805ef45ccc4a9fc7e7a8
2023-02-05 18:34:00 +08:00
Zaiyue Xue
2b66ff613d Remove the comma between hour and minutes in app list.
Bug: 267184192
Fix: 267184192
Test: presubmit
Change-Id: Ic37046218ffe501600d5d247a10d3f091acf131b
2023-02-03 16:06:14 +08:00
TreeHugger Robot
2174e45c73 Merge "Only log the names of the app packages which are installed from Google Play Store in battery usage app optimization page" 2023-02-02 09:55:17 +00:00
Zaiyue Xue
65cfcbe486 Only log the names of the app packages which are installed from Google Play Store in battery usage app optimization page
This is to meet the Guidelines for Logging Package Names: go/package-name-logging-guidance

Bug: 267430574
Fix: 267430574
Test: presubmit
Change-Id: Icf10000f5dcf87e45175d4005af8365191ad444d
2023-02-02 16:51:13 +08:00
TreeHugger Robot
e0f2d9c879 Merge "[Battery Usage U] Add logging for selecting by the dropdown in battery usage page" 2023-01-31 13:30:00 +00:00
Zaiyue Xue
495d6d5030 [Battery Usage U] Add logging for selecting by the dropdown in battery usage page
Bug: 267270271
Fix: 267270271
Test: presubmit
Change-Id: I5c74afb48188b8bab2d4d1d087bc62db3baa4963
2023-01-31 20:02:35 +08:00
TreeHugger Robot
1b73b6c63b Merge "Fix battery usage chart error when daylight saving." 2023-01-31 11:44:39 +00:00
Zaiyue Xue
4af2ef80b0 Fix b/266795925: Different font size in IW language.
Bug: 266795925
Fix: 266795925
Test: manual
Change-Id: I9bd726852484cb33e2b442e5da19d2ac99e596ed
2023-01-31 18:40:01 +08:00
Zaiyue Xue
d72ff28a52 Fix battery usage chart error when daylight saving.
Bug: 258000978
Fix: 258000978
Test: presubmit
Change-Id: Ia8746ec67f0f37dd35043f78f2aa55d2ef7c215b
2023-01-31 18:33:47 +08:00
Zaiyue Xue
f622ebf269 Fix b/265364490: [UX] [Battery usage] Remove comma between hour and min for screen time
Bug: 265364490
Fix: 265364490
Test: manual
Change-Id: I380277674817bcc047d9d298cb889859048254b7
2023-01-24 23:12:47 +08:00
Chaohui Wang
9995a592cc Merge "Update for getSystemPackageNames change" 2023-01-20 05:50:03 +00:00
Zaiyue Xue
10479caea9 Merge "Fix b/266045288: CPU and GPS usage is missing in battery usage system list" 2023-01-20 03:36:21 +00:00
Zaiyue Xue
55f94517c0 Fix b/266045288: CPU and GPS usage is missing in battery usage system list
Already asked UX designer to provide new icons for CPU and GPS in
b/265364507.

Bug: 266045288
Fix: 266045288
Test: manual
Change-Id: Ia59c92de817958231d26c8839bc403be9ec5ad7c
2023-01-19 17:45:39 +08:00
Chaohui Wang
c4ee3fdf5b Update for getSystemPackageNames change
Bug: 266040895
Test: Make Settings
Change-Id: Iecdbe80861e812f58687d8509dbc1e2acee050a9
2023-01-19 16:11:48 +08:00
Zaiyue Xue
4c3532f5ed Fix b/265364380: Icon for Other is not showing up on light theme
screenshots after fix:
https://screenshot.googleplex.com/4Hm2fo44jVeuLWQ.png
https://screenshot.googleplex.com/6ZpW34AvXu9Hfvm.png

Bug: 265364380
Fix: 265364380
Test: manual
Change-Id: I2b73facba2704f4e01bd1e2d4f8e6f09dbca6286
2023-01-19 16:04:55 +08:00
Zaiyue Xue
478c4e9e4a Fix b/265617603: The 'breakdown by systems' list will change to 'breakdown by apps' after the user scrolls up and down.
The root cause is that the spinner was initialized many times for every
onBindViewHolder(). When the spinner is scrolled out of the screen and
scrolled back, onBindViewHolder() is triggered. The spinner selection
position was set to the mSavedSpinnerPosition. This is unexpected. Only
the first initialization should set the saved position. This fix changes
the spinner initialization to be only once.

Bug: 265617603
Fix: 265617603
Test: manual
Change-Id: I7ebd2b074cf6f560919ceec338eb8fcfaadf4d3a
2023-01-18 17:07:36 +08:00
Kuan Wang
b409ef7c42 Merge "Use battery unplugging event to compute the full charge start time on Pixel devices." 2023-01-18 03:38:57 +00:00
Zaiyue Xue
ce336ae7f4 Support accessibility for battery usage in U (2)
Fix b/248406644 TalkBack announce the incorrect day of the week for the Battery usage chart.

Request accessibility focus in mHandler.post() to avoid UI timing unsync.

Bug: 248406644
Fix: 248406644
Test: manual
Change-Id: I866cbba670e1bc4735088663241b1aad4d2f9c86
2023-01-17 17:42:31 +08:00
Kuan Wang
c28daecbc5 Use battery unplugging event to compute the full charge start time on
Pixel devices.

Test: make RunSettingsRoboTests + manual
Bug: 256124406
Change-Id: I80b33db6e25ac0c693c50ddf93b6343c0fea942f
2023-01-17 17:38:35 +08:00
Zaiyue Xue
a52da7b599 Support accessibility for battery usage in U (1)
Fix b/265746746: TalkBack doesn't have any feedback after the actual double-tap of day bar and bi-hourly bar.

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/1ZuKQDBiTA2F8hHZDFvNx5nJEP-rMA0eZ/view?usp=sharing&resourcekey=0-2Q552VNxN4QwI2b5sdnvqg

Bug: 265746746
Fix: 265746746
Test: manual
Change-Id: I5485e714149014a96318fd88e8f8c854dde6cb67
2023-01-17 17:36:19 +08:00
Zaiyue Xue
16dfab6b31 Fix b/265632782: Battery usage app list changed when entering the app details page and back
This only happens on the first time the Settings package is installed.
Discussed with Chaohui, the old showSystemApp() logic in Settings->Apps has some issues. This cl updates the logic to the new logic Chaohui provided.

Bug: 265632782
Fix: 265632782
Test: manual
Change-Id: I65ca150cc685409f69b8950b131feb198662f055
2023-01-16 18:48:13 +08:00
Kuan Wang
b427e8f02a Merge "Not show time information in battery optimization page when opened from Settings -> Apps" 2023-01-16 07:02:38 +00:00
Kuan Wang
1d58de3395 Merge "Add latest battery usage data when exporting battery usage data to EBS and Settings -> Apps" 2023-01-16 07:02:27 +00:00
Kuan Wang
96aee4896b Not show time information in battery optimization page when opened from
Settings -> Apps

Test: make RunSettingsRoboTests + manual
Bug: 265130434
Change-Id: Ie7ae6a97041f490e81adbe8e0c530799e09a7c66
2023-01-16 12:07:07 +08:00
Kuan Wang
54d7cd8a7a Add latest battery usage data when exporting battery usage data to EBS
and Settings -> Apps

Test: manual
Bug: 265130434
Change-Id: I1c6c1a831416d596b5bd71c6499f4c4672dbcdea
2023-01-16 11:44:53 +08:00
Zaiyue Xue
7627a0e575 Fix b/265409044: The battery usage page auto goes up when coming back from app details page.
screen record after fix: https://drive.google.com/file/d/1a2vvMIYLSalXfM8-004drKBWK2LcK_F9/view?resourcekey=0-A586Sk0yx-OnErHkd5EgjQ

Bug: 265409044
Fix: 265409044
Test: manual
Change-Id: I7a58c9081250936de27a4970d0a9708168138fb9
2023-01-13 20:41:26 +08:00
Kuan Wang
4a6b26558d Query usage event for a longer time period and then trim the usage
events outside the expected period to make sure the app usage calculation near the boundaries are correct.

Test: make RunSettingsRoboTests + manual
Bug: 264858898
Change-Id: I9f6aa5a09a537f48a26a08b7dff8ae81e8a16e2a
2023-01-13 15:17:27 +08:00
TreeHugger Robot
b8a4577914 Merge "Fix b/265054711: Settings crash on changing device orientation from battery usage page." 2023-01-12 10:34:05 +00:00
Zaiyue Xue
9e9886997f Merge "[Battery usage U] [UI] Show screen time in the battery detail usage page" 2023-01-12 09:18:25 +00:00
Zaiyue Xue
6676e1758b Fix b/265054711: Settings crash on changing device orientation from battery usage page.
Bug: 265054711
Fix: 265054711
Test: presubmit
Change-Id: I585fb054980d4536bb05d4778cb439031f34232f
2023-01-12 17:10:47 +08:00
Zaiyue Xue
0639abfcca [Battery usage U] [UI] Show screen time in the battery detail usage page
screen record: https://drive.google.com/file/d/1TUbcysrVoj10iUhoMIT0wuCDJY8EMpy7/view?resourcekey=0-lS9d0aIQqrgJ7CpOlsOlYw

Bug: 258125117
Fix: 258125117
Test: manual
Change-Id: I31fbc7c45473ded254ebf1b1e82e09dbc88480cf
2023-01-12 15:45:51 +08:00
Zaiyue Xue
4ecf42f1bb [Battery usage U] [UI] Add a threshold to filter out very small battery usage items in the app list
Bug: 264840285
Fix: 264840285
Test: manual
Change-Id: I36a6c0dc284d09efcf82316db1541d289c37b16f
2023-01-12 15:44:26 +08:00
TreeHugger Robot
6b47dd97dd Merge "Clean up always false parameter isValidToShowSummary." 2023-01-12 06:54:32 +00:00
Zaiyue Xue
e8f2631f25 Fix b/264582296: Incorrect app battery usage after switching between 'restricted/unrestricted/optimized'.
This bug is due to the instance fields state is not refreshed after setAppUsageState(). When setting back to the original mode in the same page, getAppOptimizationMode(mMode, mAllowListed) still returns the original mode. So the setting back action is ignored.

Bug: 264582296
Fix: 264582296
Test: manual
Change-Id: I4da5dd7f1ca2660661f842a67b7d799aabd1ba05
2023-01-12 12:13:48 +08:00
Zaiyue Xue
a500e4f739 Clean up always false parameter isValidToShowSummary.
So the next cl (new summary for battery detail page) doesn't need to
deal with isValidToShowSummary=true case.

Bug: 262802531
Test: presubmit
Change-Id: I88528caedb29d61a05b40d3ca435fc007bf3f54c
2023-01-11 21:03:42 +08:00
TreeHugger Robot
569becdb7f Merge "Use (the last existing timestamp in DB + 1) as the start time of usage event query to avoid loading the same events repeatedly." 2023-01-11 10:51:40 +00:00
Zaiyue Xue
43ace6ed33 Merge changes from topic "feature0"
* changes:
  Refactor processBatteryDiffData() from DataProcessor to BatteryDiffData class.
  Refactor PowerUsageFeatureProvider: Cache the config set to avoid generating the set again.
2023-01-11 08:57:29 +00:00
TreeHugger Robot
24dbaeba1e Merge "Clean up unused code in AdvancedPowerUsageDetail class" 2023-01-11 08:54:30 +00:00
Kuan Wang
6da66f9a5c Use (the last existing timestamp in DB + 1) as the start time of usage
event query to avoid loading the same events repeatedly.

queryEvents API will return the events within [start, end). In the
hourly job, if we query the events from the latest existing time, the
events happening at the latest time will be saved for multiple times
into database. This aims to avoid this issue.

Test: make RunSettingsRoboTests
Bug: 265110147
Fix: 265110147
Change-Id: I408e88b0e15fe22585906261935854cf47707f9c
2023-01-11 16:18:55 +08:00
Zaiyue Xue
cad4c069bd Clean up unused code in AdvancedPowerUsageDetail class
Bug: 262802531
Test: presubmit
Change-Id: Ide91bd5312296945effb5a54422bda2c9623341d
2023-01-11 14:27:53 +08:00