Commit Graph

72 Commits

Author SHA1 Message Date
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
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
tmfang
f12e6adcdc Settings Fragment Migration (Fix test cases)
Fix all Roboletric test cases.
In this CL, some test cases are broken.
So, We ignored these test cases temporarily.

Test: make RunSettingsRoboTests -j56
Bug: 110259478
Change-Id: I1a3075438a614432a2de4f2d96d8abf9a83ce58c
2018-07-11 18:24:51 -07:00
tmfang
99cc23d0da Settings Fragment Migration (Change imports)
This commit *only* changes imports and optimize imports.
We don't do anything else.

This patch can't compile pass and run test case.
We will update other patches to fix these problem.

Change list.

1. import android.app.Fragment; ->
   import androidx.fragment.app.Fragment;
2. import android.app.DialogFragment; ->
   import androidx.fragment.app.DialogFragment;
3. import android.app.ListFragment; ->
   import androidx.fragment.app.ListFragment;
4. import android.app.LoaderManager; ->
   import androidx.loader.app.LoaderManager;
5. import android.content.AsyncTaskLoader; ->
   import androidx.loader.content.AsyncTaskLoader;
6. import android.content.Loader; ->
   import androidx.loader.content.Loader;
7. import android.app.FragmentTransaction; ->
   import androidx.fragment.app.FragmentTransaction;
8. import android.app.FragmentManager; ->
   import androidx.fragment.app.FragmentManager;
9. import android.app.LoaderManager.LoaderCallbacks; ->
    import androidx.loader.app.LoaderManager.LoaderCallbacks;

Bug: 110259478
Test: Can't test it.
Change-Id: I0a3f98fff34a3494a839c3c42aeabcec3df2c8b3
2018-07-11 18:23:51 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Lei Yu
6e96055232 Remove battery usage preference in app info page
Bug: 78011526
Test: RunSettingsRoboTests
Change-Id: I2dfb989167fe27857590f416fbb16d401e53bc1d
2018-04-13 14:41:03 -07:00
Lei Yu
04d13ee378 Fix tests for time format in settings
Because now we use different time format across the settings app.
We need to update all the tests.

Bug: 76113036
Test: RunSettingsRoboTests
Change-Id: Id4f7d55775adfdeb1aa0ae234f35d515ced4f450
2018-03-27 13:45:25 -07:00
James Lemieux
22a39c2b93 Use external/robolectric-shadows/run_robotests.mk
This allows Settings to test against the latest framework changes.

Also replaced TestConfig with traditional robolectric.properties.

Bug: 73173204
Bug: 73892008
Test: make -j56 RunSettingsRoboTests
Change-Id: I3135b4fa5f095ba79b282a76f45dd9baa2584bc7
2018-03-04 03:50:08 -08:00
Fan Zhang
be45f9c865 Migrate more settings to SubSettingsLauncher
Bug: 73250851
Test: robotests
Change-Id: I4100bef20e2ed477e4e31c9b7816f1b03f3f2809
2018-02-19 13:36:57 -08:00
Fan Zhang
615563db0c Migrate more subsetting launching to SubSettingLauncher
Bug: 73250851
Test: robotests
Change-Id: Ic0bf23f6ac6f717bdd3d477fdb84af68badae8e6
2018-02-15 15:39:56 -08:00
jackqdyulei
0c6d7e744a Extract method getBatteryInfo() from loader
In battery tips, we need synchronized method to get batteryInfo.
This cl move the logic to BatteryUtils, then in battery tips we
could use this method directly.

Bug: 70570352
Test: robotest still pass
Change-Id: Id69349a25395ae472a9b3152c6f04127ee32c4e1
2017-12-19 16:30:56 -08:00
jeffreyhuang
cbfb099a40 Rename SDK_VERSION_O to SDK_VERSION
Test: make RunSettingsRoboTests -j40
Change-Id: I6715062d8addadda441e32809db1af55f15e3a90
2017-12-05 16:43:54 -08:00
Fan Zhang
dff6dd687e Move away from deprecated FakeFeatureFactory.setupForTest()
Test: rerun
Change-Id: I896ba414315ddb1664c0499264f4992f0554ef98
2017-12-05 10:12:10 -08:00
jeffreyhuang
a79417487c Move fuelgauge test package to sdk 26
Test: make RunSettingsRoboTests -j40
Change-Id: I8122a41132821a42c4ec8c5995a1a11833b686cd
2017-11-29 10:57:54 -08:00
Tony Mak
49aea6af1f Fix power usage detail page is launched in wrong user
Two issues:
1. UID of settings app == system UID. But isSystemUid failed to recognize
Settings in secondary user is also a system uid.
2. For USER drain type, we should launch the detail page in current
   user.

Fix: 64506728
Test: make ROBOTEST_FILTER=AdvancedPowerUsageDetailTest -j40 RunSettingsRoboTests
Test: Switch to seconday user. Go to Settings->Battery, tap owner user
      battery entry, observe that detail page is shown.
Test: Stay long enough in Settings app, make sure no
      either Settings nor Android Framework battery entry.

Change-Id: I8d66ad55f18fcb3d9567b3bf753f737f5b98c609
2017-08-29 11:38:29 +01:00
jackqdyulei
fe5a771e92 Add uid data even though on battery stats
Advacned battery page doesn't show background toggle because it
doesn't get uid from battery stats. This cl make it get uid by
package name even though without battery stats.

Bug: 64049162
Test: RunSettingsRoboTests
Change-Id: Ie0f67ce9d080c02763a8382740e0640a66ce6053
2017-08-07 14:38:21 -07:00
jackqdyulei
51872ed345 Use package from sipper if default is null
The BatteryEntry need a background thread to update the
package name and icon. However in InstalledAppDetails we
don't have this thread and it is unnecessary because we
already has the package name.

This cl:
1. Use the mPackageName from InstalledAppDetails directly in
BatteryEntry
2. Double check the defaultPackageName in AdvancedPowerUsageDetail,
use packageName from sipper if default is null

This cl is cherry picked from oc-dr to fix the test breakage.

Bug: 64127162
Test: RunSettingsRoboTests

Change-Id: I5d21afca17f177817976758c28ed86b3a10e95eb
2017-07-28 14:16:38 -07:00
Michael Wachenschwanz
987711712c Add Foreground Service time to battery usage
Add foreground service time to foreground usage time of apps. This will
account for app usage that user is aware of but is not being displayed
on screen, such as playing music while screen is locked.

Change-Id: Ica9fe0819e46b50299eb2eab7f0483ea01441fb0
Fixes: 38313557
Test: RunSettingsRoboTests
2017-07-21 17:37:00 -07:00
jackqdyulei
bfc2b11b93 Update Anomaly detection framework
This cl make it could have multiple actions for each anomaly type.

This includes:
1. Add field "targetSdkVersion", "bgRestrictionEnabled" in Anomaly
2. Add new action which includes "force stop" and "background check"
3. Add "sdkVersion" and "bgRestrictionEnabled" method in BatteryUtils
4. Update BackgroundCheckAction to check sdkVersion first
5. Update serveral tests and add new test

Bug: 63037765
Test: RunSettingsRoboTests
Change-Id: Iea7a131ee57d501f7737ae4a3ba672d948d05cd8
2017-07-06 15:53:28 -07:00
jackqdyulei
43cbee6914 Update the method about foreground time.
For now it uses MIN(STATE_TOP_TIME, FOREGROUND_ACTIVITY_TIME) and this
method is used in both display and screen smearing.

Bug: 63080621
Test: RunSettingsRoboTests
Change-Id: I2ca3109697aa66fae67d8b2f4f10c4d08bb99d59
2017-06-30 16:18:29 -07:00