Commit Graph

98 Commits

Author SHA1 Message Date
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
Wesley Wang
bf9f91f0ad Merge "Move optimization mode backup timing into onPause" into sc-v2-dev 2021-11-03 06:41:42 +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
TreeHugger Robot
b4e13a7af0 Merge "Adjust optimize page logging timing" into sc-v2-dev 2021-11-03 05:17:40 +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
ykhung
e7d4fefde0 Fix NPE issue of usage detailed page learn more button click event am: 8f0291cd1a am: b85bf67314
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16174737

Change-Id: I210c941a06b9d905bb8b37500377ad088f1d3230
2021-11-02 18:25:27 +00:00
ykhung
8f0291cd1a Fix NPE issue of usage detailed page learn more button click event
root cause: some OEMs can not provide valid intent for help & feedback
solution: check the intent is vaild or not before show up the help content

Bug: 204844010
Test: make RunSettingsRoboTests
Change-Id: I4e7a7c926205be1179d55d33ada345024c8a44ab
2021-11-02 16:34:34 +00:00
TreeHugger Robot
9abf3e5e76 Merge "Optimize battery optimize page control flow" into sc-v2-dev am: c6a5bcc933 am: 137f9acac1
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16138630

Change-Id: I53031d3f0c7abe2ac1a089534f0908c939ffb49c
2021-11-01 08:20:08 +00:00
Wesley.CW Wang
151b88f76f Optimize battery optimize page control flow
- Post the setup logic into background and setup once only when leaving
 this page, this can improve the performance since we won't setup
 every time when switching preference

Bug: 195306545
Bug: 199892006
Test: make SettingsRoboTests
Change-Id: I1c3ee4673cf5cdba0abe39f208dfb1412082c579
2021-11-01 14:52:42 +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.CW Wang
2146a873c2 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
2021-10-18 09:02:11 +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
ykhung
a3d3c22a27 Add metric for new battery relative functions for S (1/2)
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: I2a4df9ab900cbeaf9885bb2dbc21ea848920bc81
2021-05-19 12:22:20 +00: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
531e6b23a2 Update app usage page footer string
- Use lower case string

Bug: 178197718
Test: make SettingsRoboTests
Change-Id: Id4111256bdab5f74e31fed6d015b96fe687a4c7b
2021-05-04 21:13:25 +08: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
TreeHugger Robot
e39066c388 Merge "Make app usage page support legacy version" into sc-dev 2021-04-26 06:34:28 +00: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
ykhung
75c5fc5906 Wrap and carry clicked slot information data for restriction page
Refresh category title by different time slot condition

Bug: 177406865
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: I006f6825fdb471f863c0355c65bfc4ca9d980191
2021-04-25 11:05:03 +00: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
TreeHugger Robot
a30178221a Merge "Clean up app usage page" into sc-dev 2021-04-20 14:30:22 +00:00
Wesley Wang
386d4ba8a9 Merge "Update app usage page active time column" into sc-dev 2021-04-20 11:58:55 +00: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
ykhung
4752ea17b9 Refine startBatteryDetailPage method to support history data
Bug: 177406865
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: Iee3b6b353c4f92bdad37fac55adad58b4f205bf6
2021-04-19 14:06:55 +00: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
Wesley.CW Wang
50f314e45d Update StringUtil#formatElapsedTime method (2/3)
- Update the usage and the test case
 - Update discharging string to follow new string doc

Bug: 183689347
Test: make RunSettingsRoboTests
Change-Id: I1e14e7da8cb02755d8cf6e12626a0d94fad87121
2021-04-07 10:19:10 +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
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
Sean Stout
6441723a31 Add android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL
This intent action opens the advanced power usage details screen for
a provided application.

Test: adb shell am start -a \
"android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL" -d \
"package:com.google.android.deskclock" --ez \
"request_ignore_background_restriction" 1
Bug: 129901520

Test: None
Bug: 129901520
Change-Id: Ib19228111c71ef1cfb5888f859a7efcf92a01754
2019-04-09 13:43:28 -07:00
Fan Zhang
31b210017b Migrate all MetricsProto enums to SettingsEnums
Bug: 122855168
Test: rebuild
Change-Id: I962d9a71179f86b7cae9dc5e9a00e0aa1557dc76
2019-01-17 14:55:42 -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