Commit Graph

65 Commits

Author SHA1 Message Date
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
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
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
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
TreeHugger Robot
88cd5025e1 Merge "Enhance battery settings limit charge tip" into sc-qpr1-dev am: daaf1728b4
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15747143

Change-Id: If2c47f007a67865ad9aaf8040eddc638f46f7964
2021-09-09 15:40:14 +00:00
Wesley.CW Wang
083ace54d5 Enhance battery settings limit charge tip
- Add dialog for limit charge tips
 - Add action button to make limit charge tips can bypass charge limited
 - Fix layout typo
 Screenshot: https://screenshot.googleplex.com/5ngtD2sJAKSQZD3.png

Bug: 196315151
Bug: 197769934
Test: make SettingsRoboTests
Change-Id: I0901c56ae93691c984376852da78cde9078caaf0
Merged-In: I0901c56ae93691c984376852da78cde9078caaf0
2021-09-09 22:13:33 +08:00
Wesley.CW Wang
0849672890 Enhance battery settings limit charge tip
- Add dialog for limit charge tips
 - Add action button to make limit charge tips can bypass charge limited
 - Fix layout typo
 Screenshot: https://screenshot.googleplex.com/5ngtD2sJAKSQZD3.png

Bug: 196315151
Bug: 197769934
Test: make SettingsRoboTests
Change-Id: I0901c56ae93691c984376852da78cde9078caaf0
2021-09-08 04:31:59 +00:00
TreeHugger Robot
f8b6a8297c Merge "Move legacy hide applications in usage screen list to SettingsGoogle" into sc-v2-dev am: 11d6ba6f57 am: 0d4e7a27e4
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15737567

Change-Id: I0a749bf60f06c8c9aa06ad8bc2a3ae222229d4e3
2021-09-02 09:26:12 +00:00
ykhung
0a03758738 Move legacy hide applications in usage screen list to SettingsGoogle
Bug: 195306545
Test: make SettingsRoboTests
Change-Id: Iccb3530c40bc32c20d74d65aa3f26eb2d6719106
2021-09-02 11:57:54 +08:00
Dmitri Plotnikov
99ec71728f Merge "Remove uses of deprecated class BatterySipper also, remove the obsolete class FakeUid" 2021-08-31 22:36:55 +00:00
ykhung
4e3f692164 Hide Camera background running time in the battery usage screen
hide camera background running time in the battery usage screen to avoid
users confuse about it, since it will standby in the backgound to sspeed
up launching time, not always running in the background

Bug: 196744910
Test: make SettingsRoboTests
Change-Id: Ia391d661bca44435fc5a68b1c86e5ca32dd0fcfe
Merged-In: Ia391d661bca44435fc5a68b1c86e5ca32dd0fcfe
2021-08-31 13:58:13 +00:00
ykhung
2401ec4235 Hide Camera background running time in the battery usage screen
hide camera background running time in the battery usage screen to avoid
users confuse about it, since it will standby in the backgound to sspeed
up launching time, not always running in the background

Bug: 196744910
Test: make SettingsRoboTests
Change-Id: Ia391d661bca44435fc5a68b1c86e5ca32dd0fcfe
2021-08-31 07:01:01 +00:00
Dmitri Plotnikov
ad0bb5b7fe Remove uses of deprecated class BatterySipper
also, remove the obsolete class FakeUid

Test: make RunSettingsRoboTests
Test: make RunSettingsGoogleRoboTests
Change-Id: I2f235a18dcca3b5b3a2839408b76553bbc4f655a
2021-08-27 18:19:36 -07:00
ykhung
70304cff07 Add new method to get URI to monitor battery history data is updated
we will reload the database battery history data if its content is changed, which can be done through monitored the database content observer (a part of this patch cl/383366685)

Bug: 192613268
Test: make SettingsRoboTests
Change-Id: I24ab154b1dfa00ca4bf4e6f7b308f5061578bcb5
2021-07-07 16:22:37 +00:00
ykhung
d8d5335096 Build a bridge to control whether the graph is clickable or not
Create a bridge to read phenotype flag from GoogleSettings to control
whether each time slot in the graph is clickable or not.

Bug: 185308803
Test: make SettingsRoboTests
Change-Id: If8b58dcaa50ad5fb6b447ca5b7146639ee31a9df
2021-05-09 04:46:41 +00:00
ykhung
f76ba1189a Adopt new battery history map with interpolation method
Bug: 184807417
Test: make SettingsRoboTests
Change-Id: I5c45a443d0a72df352d4bb707412328ad009f6d4
2021-05-07 00:25:33 +08:00
ykhung
318cc18f25 Add getBatteryHistory method to query data from SettingsIntelligence
Bug: 184807417
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: Idd640f8f8b07311fafc76f7b61c96c453ae7b604
2021-04-09 01:31:32 +00:00
ykhung
1599313caf Remove the current battery usage chart and replace it with new one
Bug: 183921876
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: I06f0eb5c09d07a9db0d1a93cda751e8fad672c79
2021-04-07 11:52:16 +00:00
Dmitri Plotnikov
036dc189b6 Transition BatteryAppListPreferences to BatteryUsageStats API
Bug: 173745486
Test: make RunSettingsRoboTests
Test: male RunSettingsGoogleRoboTests

Change-Id: I7af8cbcd27433b89cb2184750c6854aa74761d0d
2021-03-17 13:23:25 -07:00
Salvador Martinez
6a81e41c7c Update battery stuff to use SettingsLib Estimate class
This will make the upcoming consistency Cl easier to implement.

Test: Robotests still pass
Bug: 124030091
Change-Id: Ief4989e2b5f9b83b5c3b93d17f9f9fa12136f3ee
2019-04-19 17:35:23 +00:00
Lei Yu
68ffee1a7d Remove the old battery page
This CL removes PowerUsageSummaryLegacy and PowerUsageAdvancedLegacy
and their related layouts and strigns.

Also remove the isBatteryV2Enabled method in feature provider.

Change-Id: I1ec30f713d733ed24335a3e698fb515751232948
Fixes: 76027338
Test: robo test still pass
2018-03-26 17:40:10 -07:00
jackqdyulei
155c1785e1 Add auto restriction preference
1. Add method in feature provider to check whether smart battery
is supported
2. Hook up above method to controllers
3. Add auto restriction preference
4. Add tests

Bug: 73002171
Test: RunSettingsRoboTests
Change-Id: Ic314f61ad52e9bedb629b308731cb968bb4b1773
Merged-In: Ic314f61ad52e9bedb629b308731cb968bb4b1773
(cherry picked from commit ab0b0add0a)
2018-03-06 21:32:56 +00:00
Salvador Martinez
86a9be347c Add support for early warning query
This CL adds the necessary code to enable the early warning query
from the provider.

Test: robotests in topic
Bug: 71593245
Bug: 71812931
Change-Id: I32e10d1b9f752af672b5d1c6ccb8ba9f2f9cc387
2018-01-11 10:16:49 -08:00
Salvador Martinez
12e327608b Improve messaging for enhanced notifications
The message displayed in battery settings will now more accurately
reflect when an estimate is enhanced based on our updated
definition of what that means.

Test: robotests
Bug: 64833846
Change-Id: Id635d78d8f56d10253e22df2705af93f2693db70
2018-01-08 17:38:36 -08:00
jackqdyulei
166102c3c0 Add feature flag for battery settings page.
Create PowerUsageSummaryLegacy and power_usage_summary_legacy, which
contains the old implementaion.

Bug: 69797586
Test: RunSettingsRoboTests
Change-Id: Icb9c25f06889462a6eedea48ae166043a6636848
2017-12-05 13:15:13 -08:00
Alex Kulesza
82dbcd973d Render enhanced battery projection curves.
BatteryInfo now supplies standard linear or enhanced projection curves,
depending on the provider.

Note that the semantics of parsing have changed slightly in that the
value of endTime supplied to onParsingStarted is now the end time of the
historical data and does not include the projection. However, as far as
I can see there is no existing code that depends on the parsing
functionality besides BatteryInfo itself.

Also slightly optimizes the updating behavior of the UsageGraph, since
we are now reconfiguring it multiple times.

Bug: 38400320
Test: make RunSettingsRoboTests, manual on device
Change-Id: Ieff26d31356b34bb38e49f54f979fd80549864b2
2017-07-05 18:56:02 -04:00