Commit Graph

23 Commits

Author SHA1 Message Date
Edgar Wang
a8742aa7ab Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual
Change-Id: Ia8625091a107fc3fb652d3ba3f75ea3cc1a8d9f5
2020-08-12 11:29:07 +08:00
Edgar Wang
f480c1c3fc Update language to comply with Android's inclusive language guidance
Refactor PowerWhitelistBackend to PowerAllowlistBackend
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual
Change-Id: I3d56e6dac1515b49a89f59c34edf403ecb891420
2020-08-04 15:47:57 +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
fd0c472bdc Disable bg restriction for "Disallow apps control"
Use RestrictedPreference so it could handle it automatically

Change-Id: Ibf58934639677b88316366b2e00790f9556d0966
Fixes: 64474641
Test: Robotests
2018-08-14 15:56:51 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Fan Zhang
7e395e1a00 Plumb context object to PowerWhitelistBackend.
Change-Id: Ice0d037625d47f1f668b00499a7f1ad2302cc0ba
Fixes: 76435804
Test: robotests
2018-05-29 22:32:22 +00:00
Lei Yu
563727631c Merge "When restrict, use uid inside AppInfo" into pi-dev am: 4376993a87
am: 0a084dadc2

Change-Id: I649e128ef5070562349de6951c9b3c2f1fbc1a76
2018-05-21 22:30:58 -07:00
Lei Yu
d06d1165eb When restrict, use uid inside AppInfo
Before this CL, we use packageManager to get uid for battery
restriction. However it may not be correct all the time.

For example, RestrictedAppDetails will be opened as main user
however inside we also show work profile apps, in this case
we can't get correct uid by only using normal API in PackageManager.

This CL change it to use uid from AppInfo, which is correct all
the time.

Bug: 79992590
Test: RunSettingsRoboTests
Change-Id: Id33a5f6409d6bace0d756e5ac06432acb8b2cf65
2018-05-22 02:02:06 +00:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -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
Lei Yu
2b6e422ca1 Add log for battery tip action.
For each action, we add log when it is triggered.

RestrictAppAction could be triggered in multiple locations
(main page vs battery app detail page), so we add metricsKey to
distinguish them

Bug: 73888115
Test: RunSettingsRoboTests
Change-Id: I08f28431c4e891bf90816ce91f551edc671579cd
2018-03-16 11:37:30 -07: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
0fb2d68f97 Add restrict app detail page
1. Move force standby action to BatteryUtils
2. Add click action for restricted preference(go to detail page)
3. Build app list in detail page using packageOps list

Bug: 71502850
Test: RunSettingsRoboTests
Change-Id: I1e6733e5402e7a854b07a8bbb43a86255276bfaa
2018-01-19 09:59:53 -08:00
Tony Mantler
bf25160090 Move PowerWhitelistBackend to SettingsLib
Bug: 70716754
Test: RunSettingsRoboTests
Change-Id: I897ce3469bb2d72a0cbe96b16b8de1a565ba4e64
2017-12-15 12:58:34 -08: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
jackqdyulei
00015fbf50 Add device/profile app check in background check
If app is device or profile app, we disable the background check
toggle. This cl also create an util method for this check and
remove duplicate code

Bug: 64665807
Test: RunSettingsRoboTests
Change-Id: Id8336eadaac8832327bc3653aaa7dfbacde352ac
2017-08-29 16:10:36 -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
jackqdyulei
60607da120 Update summary when toggle background activity
In previous code, it didn't update summary when preference is changed.
This cl adds it and also updates the title for Battery Optimization.

Bug: 37163617
Test: RunSettingsRoboTests
Change-Id: I276d9a267379104794998a605a8e258660dcf350
2017-04-13 16:23:45 -07:00
Christopher Tate
65cb0d6488 Use bg appop ALLOWED, not DEFAULT
DEFAULT is not actually the right thing; it's a subtlety used for
other things that have compound state.  ALLOWED is the proper
outright "let this thing run free" state for this appop.

Also, set the appop only for the target package, not for the
entire uid.

Bug 37226920
Bug 37242946
Test: make RunSettingsRoboTests

Change-Id: I8c0a995b9519f980685e8573da946dcc93ac4e7c
2017-04-11 14:07:00 -07:00
jackqdyulei
ddba966700 Revamp the battery usage details page.
This cl adds AdvancedPowerUsageDetail to show the usage details page.
The AdvancedPowerUsageDetail contains all the needed ui components:
1. App Header
2. Two buttons
3. Usage breakdown preference category
4. Power management preference category

This cl also adds preference controller for two buttons but the
detail implementation will be added in the following cl.

Following cl will also remove previous detail page.

Bug: 35810915
Test: RunSettingsRoboTests
Change-Id: I17f95d1288762094671c0f148fa73367e51f175e
2017-03-24 20:58:44 -07:00
jackqdyulei
391bf71ba2 Add background activity toggle in Battery settings
We will show this preference only if the app is target prior to O
(targetSdk < O)

Bug: 33454801
Test: RunSettingsRoboTests
Change-Id: Ibd6a2147b8e7b49d2b7e3176296dd9b91ee4cc6f
2017-03-08 15:07:24 -08:00