Commit Graph

91 Commits

Author SHA1 Message Date
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
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
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
Zaiyue Xue
1cf801e793 Fix b/257404630 Inconsistent strings in battery chart
Change all the "from last full charge" to "since last full charge".

Bug: 257404630
Fix: 257404630
Test: presubmit
Change-Id: Ib316e9fecac60f388e2b1810de9a65c540c52358
2022-11-08 10:43:35 +08:00
Wesley Wang
5664ebc351 Merge "Add BatteryHistoricalLogUtil class" 2022-11-07 03:08:17 +00:00
Wesley Wang
d90026d184 Add BatteryHistoricalLogUtil class
- Impl optimize mode log mechanism to record optimize setup flow
 - Log optimize action with MANUAL, APPLY, RESET and RESTORE
 - Use proto file to serialize logs
 sample result: https://screenshot.googleplex.com/5KPrHVGb4pMvS7V.png

Bug: 241735485
Test: make SettingsRoboTests
Change-Id: I879663de4cf45d0cfb9cd7eee957eeb65addfbe1
2022-11-04 18:09:11 +08:00
Wesley Wang
eda172ce2c Fix app battery usage list launch incorrect works app
- App usage page only use package name to launch the page, it can not
   identify the different userId between normal app and work profile
   app, add extra userId info into launch args
 - Remove no battery usage state/string if usage time is empty

Bug: 251471047
Test: make SettingsRoboTests
Change-Id: Id06ebb0f0fcd863e423acd7839f89bc0ae2444c1
2022-11-03 11:32:30 +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
Zaiyue Xue
693711469d Updates battery usage messages from last 24hr to last full charge. (Part2: non-V2 files)
Test: manual
Bug: 236101166
Change-Id: Id5ad3e859a01d3288a950bf6288eafc6144a23d6
2022-08-05 10:52:38 +08:00
Sorin Basca
c1c3a84fdc Use Mockito 4.6.1 API
Bug: 236636175
Test: m RunSettingsRoboTests
Change-Id: I2cfda684059520f6ddd1e72c55f1ab1ec9c99e8b
2022-07-13 06:39:26 +01:00
Zaiyue Xue
7e6aa69cca Merge "Move battery usage files to a separate folder." into tm-qpr-dev am: 3b7953eac2 am: 6470ada117
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/18797446

Change-Id: I3d6a155e80a5d54c309061c41d0b6436e61cc4cb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-20 09:42:01 +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
Kuan Wang
02b6451258 Clean up legacy "optimization mode" design.
We have two different "Optimization mode" page design in the android R to support bi-state for AOSP and tri-state for Pixel device. From android T, we always show tri-state for both AOSP and Pixel. So it's time to clean up the legacy design for bi-state.
This change doesn't include string resources cleanup, which will be
included in a separated cl.

Bug: 232037602
Test: make RunSettingsRoboTests
Change-Id: I5194201d0b11e2dcea958d49bf07ed837a386465
2022-06-06 02:11:09 +00:00
ykhung
7015cd0dd9 Hide running time for "Android System" in the optimization page
Hide the running time information for "Android System" entry, since this
entry will combine multiple system components together. It will provide
incorrect running time information. The getRealUid() method maps many
UIDs to Process.SYSTEM_UID(1000), which results in combining all of
those UIDs into one "Android System" entry. This is the expected behavior.

Bug: 220717612
Test: make RunSettingsRoboTests -j56 ROBOTEST_FILTER="com.android.settings.fuelgauge"
Change-Id: I9d44fe8490ad5c684419b8ebf8d7d5576a42788a
2022-05-10 18:47:44 +08:00
ykhung
b593e00af0 Format BatteryEntry and BatteryDiffEntry class
Bug: N/A
Test: make RunSettingsRoboTests
Change-Id: I14e2ef4c455209e58edc5ccdbe064f469815cccd
2022-04-17 06:23:47 +00:00
YUKAI HUNG
a7412b33b2 Merge "Fix incorrect usage for the logging method to cause no data in WW" into sc-v2-dev am: 6e12a31e5f am: a1d72c11c5
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16221114

Change-Id: I4c9d5265d8abd4a73a19df2afc5c718d8827ddab
2021-11-10 10:10:05 +00:00
ykhung
101dc6878a Fix incorrect usage for the logging method to cause no data in WW
Fix incorrect usage for the logging method to cause the schedule type
and percentage data is not logged  into the WW, since
MetricsFeatureProvider doesn't support log Pair.of() data into the
WestWorld or Clearcut directly, it is used for EventLogWriter only

Bug: 202906853
Test: make SettingsRoboTests
Change-Id: I9f1d157c77df9bd74f441105318790a2505a9c01
2021-11-10 15:39:30 +08:00
Wesley Wang
0f3a672a94 Merge "Move optimization mode backup timing into onPause" into sc-v2-dev am: bf9f91f0ad am: e67f12f9b7
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16177444

Change-Id: I1f9c5dd515fa42c7a30f86f9c7b135b39ff67cc5
2021-11-03 07:06:04 +00:00
TreeHugger Robot
6d2db7a8cf Merge "Adjust optimize page logging timing" into sc-v2-dev am: b4e13a7af0 am: 3be2b733f2
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16170324

Change-Id: I66ecbb8213e9fb6301d75cacb493813180df1e18
2021-11-03 05:41:03 +00:00
Wesley.CW Wang
9b6eac28f3 Move optimization mode backup timing into onPause
- Move to onPause to avoid some corner case (like kill apps from recent
 app won't trigger onDestroy)

Bug: 195306545
Test: make SettingsRoboTests
Change-Id: I89445a7138c30e6c869ce1c5c9a3f818997d99a7
2021-11-03 12:38:10 +08:00
Wesley.CW Wang
7fb4cbf005 Adjust optimize page logging timing
- Log the optimize mode only when leave this page and mode changed
 - Update mOptimizationMode at onResume to make sure the state is sync
 with framework

Bug: 195306545
Test: make SettingsRoboTests
Change-Id: Iab116220cd7d2b1bdb1c170c4b47016c763bf4fe
2021-11-03 12:05:15 +08:00
YUKAI HUNG
265d683dc1 Merge "Update app usage page power summary" into sc-v2-dev am: 8e97bdd76c am: 054f3b5199
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16091765

Change-Id: Ic7bf43d79304b740b5b6cf2a148b317860ea4869
2021-10-21 11:08:48 +00:00
Wesley.CW Wang
23a5fb5e74 Update app usage page power summary
- Present empty string when this app consumed power but no usage time,
 usually they are some system components

Bug: 197749108
Test: make -j64 RunSettingsRoboTest
Change-Id: I1e88babb30c871748fa1f5fc23c7b4d834e384fd
2021-10-21 17:29:36 +08:00
Wesley.CW Wang
d11dec2f82 Revert "Add PowerSaveWhitelistExceptIdle as Optimizted modes condition"
- Reverts commit e7cca4cd81
 - Add try-catch to handle unexpected operate

Reason for revert: Previous fix will cause a side effect which makes app stuck at Optimize mode after switching state from Unrestricted to Optimize, add a try catch to handle previous issue first

BYPASS_INCLUSIVE_LANGUAGE_REASON=legacy naming, not edit by this code change

Bug: 199892006
Test: make SettingsRoboTests
Change-Id: I3b1850ab66bbf4cd605f14152a244a8ed7edd578
Merged-In: I3b1850ab66bbf4cd605f14152a244a8ed7edd578
2021-10-18 09:03:06 +00:00
Wesley Wang
b900e0e43b Revert "Add PowerSaveWhitelistExceptIdle as Optimizted modes condition"
This reverts commit 3f7839cad0.

Reason for revert: This fix will cause a side effect which makes app switch state from Unrestricted to Optimize then it will lock at Optimize mode only, will prepare other cl to fix the previous issue

Change-Id: Ic5232eb0099fa1591f15e72747eca4d08b9af9b9
2021-10-14 09:31:13 +00:00
Wesley.CW Wang
e7cca4cd81 Add PowerSaveWhitelistExceptIdle as Optimizted modes condition
- Check PowerSaveWhitelistExceptIdle list before update each apps
 optimizaton mode to avoid duplicate remove action
 - Make those apps which under PowerSaveWhitelistExceptIdle list keep at
 optimized mode only

BYPASS_INCLUSIVE_LANGUAGE_REASON=legacy naming, not edit by this code change


Bug: 199892006
Test: make SettingsRoboTests
Change-Id: I3cd10cf51b5132fc12a83e9554801ec4e8578cd1
Merged-In: I3cd10cf51b5132fc12a83e9554801ec4e8578cd1
2021-09-22 02:14:05 +00:00
Wesley.CW Wang
3f7839cad0 Add PowerSaveWhitelistExceptIdle as Optimizted modes condition
- Check PowerSaveWhitelistExceptIdle list before update each apps
 optimizaton mode to avoid duplicate remove action
 - Make those apps which under PowerSaveWhitelistExceptIdle list keep at
 optimized mode only

BYPASS_INCLUSIVE_LANGUAGE_REASON=legacy naming, not edit by this code change


Bug: 199892006
Test: make SettingsRoboTests
Change-Id: I3cd10cf51b5132fc12a83e9554801ec4e8578cd1
2021-09-17 18:38:01 +00:00
ykhung
87898aec66 [B&R] notify BackupManager when app optimization mode is changed am: 935a9321b5 am: 5f3bc01915
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15667992

Change-Id: I8e422e893bb80e202ed50550c05ea5484b1b2756
2021-08-25 03:55:48 +00:00
ykhung
935a9321b5 [B&R] notify BackupManager when app optimization mode is changed
Invoke BackupManager.dataChanged() when app optimization mode is changed
to notify BackupManager to execute Settings agent to backup data in the
next backup session, when performing the partial backup event.

Bug: 192523697
Bug: 197608038
Bug: 194633034
Test: make SettingsRoboTests
Change-Id: I456acc2594d22503763e4ce286435148ae0644a4
2021-08-25 02:21:16 +00:00
Yuri Lin
e9f13fbd5e Rename RadioButtonPreference -> SelectorWithWidgetPreference.
This change is to reduce ambiguity as we're adding the option to style the preference like a checkbox as well.

Bug: 190180868
Test: SelectorWithWidgetPreferenceTest, RunSettingsLibRoboTests
Change-Id: Ie414347bf67ed394ef495604890c5851fc42dbc7
2021-07-20 17:01:21 -04:00
Wesley.CW Wang
e1b1f67681 Make App info page support new battery entry
- Add new battery entry to app info battery preference, support both
 legacy and new args, controlled by P/H
 - Add a method to check is work profile app or not, use owner context to
 query correct context for feature provider
 - Add string for new args

Bug: 178197718
Test: make RunSettingsRoboTests
Change-Id: Ic93142a0c5e2851917cb3e224340a6e3e81fd801
2021-06-11 04:41:12 +08:00
Wesley.CW Wang
256636055b Add description to battery settings footer link (2/3)
- Update battery saver footer learn more link description
 - Update app usage footer learn more link description

Bug: 187812487
Bug: 187135286
Test: make RunSettingsRoboTests
Change-Id: Iee496cf615f2f9e0e61be69d6b3a1d6c1c859013
2021-05-28 17:40:04 +08:00
ykhung
646c1a2e5a Add usage percentage and battery level into app relative metric
Reference the table from PM requested:
https://docs.google.com/spreadsheets/d/1TC_6MLVMvOS0p1ic0wPfQ-19AOuY8Kc8FUJdqaQSM4I/edit?ts=6098b296#gid=0

Bug: 188505537
Test: make SettingsRoboTests
Change-Id: Ia31ada9438f120fe6f29b59b67dc4de6636c11e1
2021-05-20 20:03:22 +08:00
Wesley.CW Wang
100007e31b Update restriciton page to support legacy string
- Update active time string with "last full charge" when new graph disabled

Bug: 187666107
Test: make SettingsRoboTests
Change-Id: Ie790600dcbe8b845ad63edd46b4a95a317c623a3
2021-05-12 23:18:50 +08:00
Wesley.CW Wang
25498983b2 Fix AdvancedPowerUsageDetailTest test error
Bug: 187693428
Test: make SettingsRoboTests
Change-Id: I3c3976b93a5dfb242af09bcfbf700a1caddd350b
2021-05-10 13:02:18 +00:00
Wesley.CW Wang
86a6a0d32c Make app usage page active time support time period
- Add time slot into active time text
 Screenshot: https://screenshot.googleplex.com/hzj5cJ3eDJD5iW7.png

Bug: 178197718
Test: make SettingsRoboTests
Change-Id: I0904e78ca9ab0a5b454e093388f667e978e8722f
2021-04-29 15:08:30 +08:00
Wesley.CW Wang
d67f878c67 Make app usage page support legacy version
- Add a flag to divide legacy and new design
 - Add new layout for tristate design

Bug: 178197718
Test: make SettingsRoboTests
Change-Id: I61f694cad8ac9cea8195191feacbe80bac2df62e
2021-04-26 13:18:33 +08:00
Wesley.CW Wang
2cc7431fa3 Update app usage page active time format
- Make the text of active time support different states like foreground or background usage time less than one minutes

Bug: 178197718
Test: make SettingsRoboTests
Change-Id: I20be88e5b23a679c15f97bac4b9d400557685463
2021-04-21 20:20:05 +08:00
Wesley.CW Wang
72463703ac Clean up app usage page
- Remove unused reference

Bug: 178197718
Test: make SettingsRoboTests
Change-Id: Iecb9b14bba5e823c1ceee70d5a27c6fe74dab815
2021-04-20 18:08:25 +08:00
Wesley.CW Wang
f1966e9d0b Update app usage page active time column
Screenshot: https://screenshot.googleplex.com/5DYcV9fFTiatepi.png

Bug: 178197718
Test: make SettingsRoboTests
Change-Id: If0427a4ed634a453ac49b35bd8082b8790ca7402
2021-04-20 13:49:57 +08:00
Wesley.CW Wang
8ca6f31716 Add footer to app usage page
- Add a footer to present the description text, will present specific text once this app is optimized or unrestricted only
 Screenshots:
   https://screenshot.googleplex.com/4HZGQU6SDni3PdR.png
   https://screenshot.googleplex.com/9gLSgftmaYuZepf.png
   https://screenshot.googleplex.com/55masP3VoAtAFMo.png

Bug: 178197718
Test: make SettingsRoboTests
Change-Id: Iced0fa591faf72874e2e3dff942122c90d35a4e7
2021-04-19 08:14:54 +00:00
Wesley.CW Wang
5083d82df7 Update app usage page with 3 radio button control
- Improve the UX from 2 different preference column to 3 radio button,
 make the restriction state more easy to control and recognize
 Screenshot: https://screenshot.googleplex.com/4nCBnF5FzwePqrL.png

Bug: 178197718
Test: make SettingsRoboTests
Change-Id: Ic354ac91e5496c0e44c5b44142627ac8a090e30f
2021-04-19 08:14:41 +00:00
Dmitri Plotnikov
3bd707ab1a Remove unused code
Bug: 173745486
Test: make RunSettingsRoboTests
Change-Id: I9e6e32e4ad594b7d6f5f984bf1b839caf654066b
2021-03-18 12:59:15 -07: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
Dmitri Plotnikov
656c67c01d Encapsulate BatterySipper and BatteryConsumer in BatteryEntry
Bug: 173745486
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.BatteryEntryTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.AdvancedPowerUsageDetailTest

Change-Id: I67ab825c25b85012b5713736db62e0beb4d98a16
2021-03-13 12:51:47 -08:00
James Lemieux
f1dade40d2 Use binary resource support in robolectric
The resources available to tests are now exactly the merged resources
located in the APK under test.

Bug: 74359828
Test: make -j56 RunSettingsRoboTests
Change-Id: I050db81a92decefea23314b5ec7a62f77ff4bb2b
2018-12-12 19:53:49 -08:00
tmfang
dce94bb237 Use SettingsLib's LayoutPreference
- Remove LayoutPreference in Settings source code.
- Remove unused style, layout
- Replace old imports to com.android.settingslib.widget.LayoutPreference
- Replace old XML tag to com.android.settingslib.widget.LayoutPreference

Test: robotest, manual test
Bug: 120005054
Change-Id: I9ae1ae14a16f443e11ac5d75b6038c7c5e253844
2018-11-27 13:12:53 +08:00
tmfang
bbca29b6f4 Do not show installation status on Q
Test: robotest, visual
Bug: 116340579
Change-Id: I0b414f3faffe8a96cccb310abca74c585c9ac1f2
2018-11-09 10:17:54 +08:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
jackqdyulei
dd9b8af6b9 Remove the anomaly detection added in O-DR
1. Remove unused class and resources
2. Update function in AdvancedPowerUsageDetail since
we don't need pass in anomaly anymore

Change-Id: I96fbe5ddaae902b34b756c7aae0338e49afef1f3
Bug: 74529048
Test: 1. manual test in settings page. 2. robo test still pass
2018-07-17 12:42:43 -07:00