Commit Graph

88 Commits

Author SHA1 Message Date
YK Hung
bc93a6a146 Reattribute data into other apps as the final result (4/5)
Bug: 346706894
Test: atest SettingsRoboTests:com.android.settings.fuelgauge.batteryusage
Flag: EXEMPT bug fix
Change-Id: I8b8a988df2718b64cd752915205db687ffe9d559
2024-06-26 06:25:15 +00:00
YK Hung
98319ac0f5 Load and process the battery reattribute data in the periodic job (3/5)
Bug: 346706894
Fix: 348156270
Test: atest SettingsRoboTests:com.android.settings.fuelgauge.batteryusage
Flag: EXEMPT bug fix
Change-Id: Ibaa1d9d960aa6a885307fbb3dd3a62aaeb32de23
2024-06-20 11:20:16 +00:00
mxyyiyi
08907935df Add flag to force expire the app optimization mode event.
Bug: 347444433
Test: atest
Change-Id: Id502607ed6c07870d14346656a65ceccb756b78f
2024-06-17 17:04:05 +08:00
Yiling Chuang
11e810e7a7 Provide different ways to detect battery defender.
Bug: 335567248
Test: robotests
Change-Id: Ie1d3d7da99fa698468ffd124410cfd3b56bc0c34
2024-04-26 03:10:51 +00:00
mxyyiyi
08d4b7a2ae Log optimization mode for app usage in BatteryUsageSlot.
Bug: 335374932
Test: atest ConvertUtilsTest
Change-Id: Icf86b9bee58b3b70d99e166d9fce0dfd7e30dea3
2024-04-19 10:58:15 +08:00
Shun Lung Chen
265fe257c2 Update detectSettingsAnomaly API to detectPowerAnomaly(1/2)
Since the detectSettingsAnomaly method does not only detect settings but
also other power related anomalies. Change the method name to
detectPowerAnomaly to make it more reflects what it really does.

Bug: 320404576
Test: make SettingsGoogleRoboTests
Change-Id: I4b5bec3aba81cd0dc6fef2c976eae3d64da3ede5
2024-03-25 07:34:33 +00:00
Wesley Wang
ffcce1e7cf Add AOSP smart battery entries
- Revert "Cleanup smart battery entries (1/3)" patch only instead whole topic, updated part of codes to resolve the conflicts

This reverts commit 742e506d13.

Reason for revert: b/315401539

Bug: 315401539

Change-Id: I75a4e4f75b624c90aae18288c77214c0238e43eb
2024-02-07 07:29:48 +00:00
mxyyiyi
ed7ce44f65 Add record for anomaly detect request source and clean up unused function.
Bug: 315905559
Test: make RunSettingsGoogleRoboTests ROBOTEST_FILTER="com.google.android.settings.fuelgauge.*"
Change-Id: I21a13a7910b21b27aac58143bd41c77e87c71953
2023-12-12 15:56:54 +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
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
Wesley Wang
a277f78789 Update detectSettingsAnomaly() return type (1/2)
Bug: 291689623
Test: make SettingsRoboTests
Change-Id: I3611e746900569dca8cf308072c1344686d27f9a
2023-08-11 06:56:14 +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
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
Wesley Wang
456ca0177c Imple call method to detect settings anomaly(1/2)
Bug: 290893324
Test: make SettingsRoboTests
Change-Id: I6c13f9cee29b723cbd9332fc5d84567be83699c3
2023-07-28 12:32:39 +08:00
Wesley Wang
e3d5e38834 Provide a method to detect battery usage history(1/2)
Bug: 290893324
Test: make SettingsRoboTests
Change-Id: Ief4e11b2c3afddb99a50c9d0148d78d4d581d34f
2023-07-19 11:59:56 +08:00
ykhung
24cbb2c0aa Limit the optimization mode restore mechanism for specific conditions
Limit the app optimization mode restore mechanism is enabled by checking
the isValidToRestoreOptimizationMode() method (default false)

Bug: 280192659
Test: make test RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.BatteryBackupHelperTest
Change-Id: I90a438a15905578336bc46ec7cd92d3bbe2858b7
2023-05-16 18:40:11 +08:00
ykhung
cad41681d6 Add device build information in the backup stage
Insert the device build information in the battery optimization mode
backup stage, such that we can use it to decide whether we should
restore the data in the targeted device or not

Bug: 192523697
Test: make test RunSettingsRoboTests
ROBOTEST_FILTER=com.android.settings.fuelgauge.*

Change-Id: I3ab76e013ea9aca4d336a62e0c7cb6882c5b5085
2023-05-16 11:07:31 +08:00
Wesley Wang
742e506d13 Cleanup smart battery entries (1/3)
- Remove smart battery entry from battery settings page since
   restriction app info already move to app list page and smart battery
   feature will keep as enabled, smart battery page will be empty
 - Enable battery usage list page for AOSP

Bug: 277175992
Test: make SettingsRoboTests
Change-Id: I9221cecbfc8445b8f470975551f600e94e3128d5
2023-04-17 16:50:21 +08:00
Treehugger Robot
a7152b9573 Merge "Align Settings and SystemUI packageName references" am: 1452f7dd3a am: ff6def3c7c am: 525b567db3
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2530819

Change-Id: Ic9c46e521d8ae7b85dc63fa593e5f05951f596a4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-12 10:51:42 +00:00
Shen Lin
57b03b309d Align Settings and SystemUI packageName references
This CL migrated both Settings and SystemUI packageName into Utils.java
to align references.

Bug: 277651621
Test: m Settings -j128
Change-Id: I3d6808de76120a2ddbbed4980b8a65cec81502c9
2023-04-11 10:27:04 +00:00
Zaiyue Xue
f57ae783f3 Change getSystemAppsAllowlist() returns an empty list instead of null.
Bug: 265751163
Test: presubmit
Change-Id: Ide8b36345b328d5969b764b6c5e1503904e9ecaf
2023-03-14 13:45:48 +08:00
Zaiyue Xue
cbd5223bc7 Fix b/265364507: Merge GPU and TPU into Others in battery usage system components list
Bug: 265364507
Fix: 265364507
Test: manual
Change-Id: Ia428a0854c42dacff130c2492ae11642643043b0
2023-02-23 16:01:07 +08:00
Zaiyue Xue
7fad47a8d7 Update battery usage app list filter logic:
(1) Add app screen on time thrshold 100 ms.
(2) Change app battery comsuption threshold from 0.1 mA to 1 mA.
Apps meet one of above conditions will be shown.

Bug: 264840285
Test: manual
Change-Id: Icfb304f09c49248397350ebe55bf06f3eb82d639
2023-02-13 15:30:03 +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
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
Zaiyue Xue
7f3ff17bcf Refactor PowerUsageFeatureProvider: Cache the config set to avoid generating the set again.
Bug: 262802531
Test: manual
Change-Id: I61b36e4e057c432d814aa104a37f0e0d552720cb
2023-01-10 19:42:09 +08:00
Zaiyue Xue
7c987c9d98 [Battery usage U] Add an item "Others" in the app list to group small usage apps. This will make the total percetage 100%, which is easy to understand for users.
Bug: 258124173
Fix: 258124173
Test: manual
Change-Id: I5965eeb73a2071c4a9994655e4ed24ec3adf64e8
2023-01-05 11:22:33 +08:00
Zaiyue Xue
e756675e69 Combine system apps to one item in the battery usage app list.
Bug: 262952385
Test: 262952385
Test: maunal
Change-Id: I078677b13a22f5e2f8f194bb5d5259f8c54c6b1e
2023-01-04 20:32:56 +08:00
ykhung
4a470d87dc Remove the legacy EarlyWarning tip mechanism to improve performance
Fix: 263835342
Test: presubmit
Change-Id: I0c3f61a21874c70b49cdeb73bbdc285ef8c4a35f
2022-12-28 15:33:19 +08:00
ykhung
b875752307 Add isBatteryManagerSupported() to control adaptive preferences page
Add isBatteryManagerSupported() in the PowerUsageFeatureProvider to
support controlling the adaptive preferences page dynamically

Bug: 229558366
Test: presubmit
Change-Id: Iffb552feb9e08ca72f2970eb778cd3fcd18f0b7e
2022-12-27 15:31:11 +08:00
Zaiyue Xue
daeafc8fc6 [Battery usage U] Remove 'Phone Idle' to avoid confusion
Bug: 252938706
Fix: 252938706
Test: manual
Change-Id: I0ad973718f77640839dbdf4ac5ca4241f01bdb79
2022-12-22 08:36:59 +08:00
Kuan Wang
cf7e1141df Cancel data loading when hourly job happens in the first 40 minutes
after booting in AOSP.

Test: make RunSettingsRoboTests + manual
Bug: 257384343
Change-Id: I437b68719ff5ece73fa33b74cb144f4262528e8c
2022-12-19 02:36:07 +00:00
Zaiyue Xue
bce700f1db Refactor getting allowlist set from feature provider.
(1) Use Set<CharSequence> for all the allowlists.
(2) The contains() method of Set<CharSequence> also works for String. No
    need an extra contains() util function.

Bug: 262802531
Fix: 262802531
Test: presubmit
Change-Id: Ib2aaf9a3b8db4618a8c46f138e8d35f15b77c104
2022-12-16 10:39:26 +08:00
Kuan Wang
6c4f83f33d Load app usage events data in the hourly job.
Test: make RunSettingsRoboTests + manual
Bug: 260964679
Change-Id: Iaccaa77bd52fb7356cdcb786c64523f21040b128
2022-12-15 06:32:54 +00:00
Zaiyue Xue
fa90a4b311 [Battery usage U] Create a flag to guard battery usage features
Bug: 261800937
Fix: 261800937
Test: manual
Change-Id: I891c235228c9ca0709471b496e6f75167fd0a126
2022-12-09 15:15:34 +08:00
Zhenwei Chen
1d72ff642c Add dock defender battery tips
1. Remove the dock defender v1 code
2. Add dock defender battery tips and update
   corresponding list item string

Bug: 260687359
Test: Unit test passed and manual test on device
Merged-In: Ib6c09df056744142f42f5e2a13252b58e54c7534
Change-Id: Ib6c09df056744142f42f5e2a13252b58e54c7534
Signed-off-by: Zhenwei Chen <zhenwec@google.com>
(cherry picked from commit 8d11d9ceea)
2022-11-29 10:31:37 +00:00
Zhenwei Chen
8d11d9ceea Add dock defender battery tips
1. Remove the dock defender v1 code
2. Add dock defender battery tips and update
   corresponding list item string

Bug:256523472
Test: Unit test passed and manual test on device
Change-Id: Ib6c09df056744142f42f5e2a13252b58e54c7534
Signed-off-by: Zhenwei Chen <zhenwec@google.com>
2022-11-28 17:45:51 +08:00
Kuan Wang
24f0f2c2da Clean up unused files for Battery Usage in SettingsGoogle, which have
been moved into Settings.

Test: make RunSettingsRoboTests
Bug: 256123455
Change-Id: I21fe684b9b3a2a748c5d10353e68e15ddf281838
2022-11-23 02:22:24 +00:00
Kuan Wang
628f12c1ad Remove isChartGraphEnabled() which should always return true after
migration.

Bug: 253395332
Test: make RunSettingsRoboTests + manually
Change-Id: I0c4a6e00a7a9fd66d4050e5ddcf87176462067cd
2022-11-01 07:58:57 +00: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
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
Pajace Chen
f3496399dd Implements the buttons layout for the extra defend
Bug: 235246949
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.*
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.widget.CardPreferenceTest
Test: manual test
Change-Id: I1dc4ab31adf85c684a4c09bd6c9bcfb54b52dc3c
2022-08-18 10:16:05 +00:00
Kuan Wang
e39ecafa1f Add function getBatteryHistorySinceLastFullCharge, used to replace
getBatteryHistory in BatteryHistoryLoader.

getBatteryHistory couldn't be changed directly as it needs to be kept
for other features.

Bug: 236101687
Test: make RunSettingsRoboTests
Change-Id: I3e3cdd3a0225228bf76f6750f6a56f031666720f
Merged-In: I3e3cdd3a0225228bf76f6750f6a56f031666720f
2022-07-11 09:10:08 +00:00
xuezaiyue
ac7318419a Move battery usage files to a separate folder.
Bug: 202118250
Test: presubmit
Change-Id: I21aa58ebc02327849ed2161dbbafcdc806c007f2
2022-06-19 05:59:35 +00:00
ykhung
3d1b6fd065 Add a mechanism to configure whether the summary should be set or not
Add a mechanism to customize whether the summary information in the
battery entry should be set or not. We can consider is as the extension
for the ag/18062824.

Bug: 220717612
Test: make RunSettingsRoboTests -j56 ROBOTEST_FILTER="com.android.settings.fuelgauge"
Change-Id: I3c21148d288f29ce65378f59f9086dab90c14a7b
2022-05-04 11:42:26 +08:00
ykhung
c5b8287f1e Replace HashSet with memory efficient ArraySet collection
https://developer.android.com/reference/android/util/ArraySet

Bug: 195306545
Test: N/A
Change-Id: I3f5831f2c5b5ec5ca50d312331c42eb90def2c61
2022-04-11 17:12:21 +00:00
TreeHugger Robot
bf19d369a0 Merge "Update adaptive preference summary" into sc-v2-dev am: 6ff60d7771 am: e6a10f3487
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15981706

Change-Id: If760aaa0006cadb1f5cbb999b977ffe719dfb6d7
2021-10-06 10:19:36 +00:00
Wesley.CW Wang
4137253658 Update adaptive preference summary
Bug: 195627250
Test: make RunSettingsRoboTests
Change-Id: I50ed736bbba7ac8d3d6fcf026e9e17e2116f86a7
2021-10-05 17:52:43 +08:00
ykhung
f27d0c2935 Move allowed list definition in the battery usage to feature provider am: b62cdecc67 am: bb535f4bce
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15785737

Change-Id: I4a19dcc41b14af235c3e1d94675d14fc8f05e3a0
2021-09-10 05:14:37 +00:00
ykhung
b62cdecc67 Move allowed list definition in the battery usage to feature provider
Bug: 199367609
Test: make SettingsRoboTests
Change-Id: I321426e6ff1b9586ee493792f1d39aed35ecc34d
Signed-off-by: ykhung <ykhung@google.com>
2021-09-10 01:29:32 +08:00