Commit Graph

75 Commits

Author SHA1 Message Date
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
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
27c84de325 Settings Fragment Migration (Build pass app)
This patch focused on fixing compile errors and some runtime errors.

Test: We can't test it now. But we will have an integration test later.
Bug: 110259478
Change-Id: I16c471ddcd0fa1460c665b7f74d86fcace5ee67b
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
Doris Ling
2511d108ed Consolidate the 2 app button prefernece controllers.
- move the fuelgauge app button controller and the button dialog
fragment into app info package and change app detail fragment to use
that controller instead.
- remove the original appinfo/AppActionButtonPreferenceController

Change-Id: I94ca072a8dfe6051853eb23efa1f96ac3e13d79d
Fixes: 80312809
Test: make RunSettingsRoboTests
2018-06-12 13:43:25 -07:00
hjchangliao
e86eec0c07 Rename SubSettingLauncher.setTitle, add java doc
For make this method usage more clear,
setTitle(charSequence) rename as setTitleText,
add java doc: it is only for user generated string
setTitle(int) rename as setTitleRes.

Change-Id: I972cb6a8ff90873dfdc25c23f6dc3d68103c8e4e
Fixes: 78347436
Test: make RunSettingsRoboTests
2018-05-09 10:00:05 +08: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
Fan Zhang
aab36de0d6 Remove wrapper for device policy manager
Bug: 76167422
Test: robotests
Change-Id: I69dc7341cf1ff408bc24c2a062586cef25b7b918
2018-03-30 20:44:20 -07:00
Fan Zhang
f7843adabd More renaming in DashboardFragment
getPreferenceControllers() -> createPreferenceControllers() for the same
reason as in ag/3647936

Bug: 73668763
Test: robotests
Change-Id: I97670a91a2a38d1c844d1b9d37f4222c5e6f45a0
2018-02-23 16:56:30 -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
Salvador Martinez
408dc41228 Update copy for battery estimate related features
Many features are using the enhanced estimates but the copy for them
has gotten out of sync. This CL moves shared strings between Settings
and SysUI to SettingsLib and also updates features that use the
strings to have consistent behavior/text.

Test: Robotests
Bug: 65656091
Bug: 66909350
Bug: 67469159
Change-Id: Ie5ef1ed65429ca9805cff374f1439e5d61eb6591
2018-02-07 10:55:15 -08:00
jackqdyulei
99a2de41ef Add restrict and unrestrict dialog
Add a fake unrestrict tip so we could reuse the BatteryTipDialogFragment
to build the unrestrict dialog.

After this cl, restrict dialog has two types:
1. dialog to only restrict one app
2. dialog to restrict more than one app

Will add dialog to restrict more than 5 apps when strings are finalized.

Bug: 72385333
Bug: 72227981
Test: RunSettingsRoboTests
Change-Id: Ib0328f0386efad525b331fd713dd15d060a1a649
2018-02-05 19:37:03 -08:00
jackqdyulei
29002aacb0 Revamp the battery detail page for each app
1. Move preferences to new postion
2. Change background activity pref from SwitchPreference to
Preference and update the controller

Bug: 72227981
Test: RunSettingsRoboTests
Change-Id: Ib18ac7523c24d19754c37ab8ac527095d9ced49c
2018-01-22 15:13:55 -08:00
jackqdyulei
e233162c3a Add metric log for anomaly.
This cl creates metric log when anomaly surfaces in battery page or
anomaly dialog.

Each anomaly action contains two fields:
1. FIELD_CONTEXT(int): determine which fragment start this action.
2. FIELD_ANOMALY_ACTION_TYPE(int): determine action type for this
anomaly.

Bug: 68215016
Test: RunSettingsRoboTests
Change-Id: I83761e2a9c206ea7a04f7d031a6961fdab7ca9a0
2017-10-30 16:00:16 -07:00
Doris Ling
dee1a22c45 Consolidate all wrappers used for testing.
- Add the wrapper package and move all wrappers to the wrapper package.
- Get rid of some wrapper interface/impl implementation and have a
wrapper class directly.

Bug: 65634579
Test: make RunSettingsRoboTests
Change-Id: Ic757d8f7bacfa7a034c7e692205bc1dc4b0e1de1
2017-09-14 18:24:49 -07:00
Suprabh Shukla
4c64777b2a Adding switch for Forced App Standby
Reusing the 'Background activity' switch found in App Info. The switch
now needs to be shown for all apps and will toggle another app op
RUN_ANY_IN_BACKGROUND which controls whether jobs or alarms are run for
background apps.
Also fixed handling of multiple packages with shared uid. The controller
was picking the first package for uid but the order of packages can
change on a reboot which would cause wrong app ops settings across
packages of the same uid.

Test: make -j32 RunSettingsRoboTests

Bug: 65176793
Change-Id: I2a9b96bc02730776172c3ae317cb7f7f890bec30
2017-09-11 14:05:26 -07: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
a211563bfb Add an overload of startBatteryDetail for BatteryUtils mock
Allow passing BatteryUtils to startBatteryDetailPage for testing
purposes.

Test: RunSettingsRoboTests
Bug: 38313557
Change-Id: Ie96bb69d50ab057e6d791e45a5eb320caec676b9
2017-07-17 14:30:34 -07:00
Tony Mantler
1d583e125f Make PreferenceController a mixin
Bug: 62912136
Test: Existing tests in BaseSearchIndexProviderTest
Change-Id: Ieda359806c09a019840b2005446c7ec8b61fdb00
2017-06-26 10:58:36 -07:00