Root cause:
RequestIgnoreBatteryOptimizations adds package in
PowerWhitelistManager#addToWhitelist for intent
Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS.
Settings UI uses PowerAllowlistBackend to check if
an APP is in power allow list. Each UI component should
PowerAllowlistBackend#refreshList() or UI will get
a stale result.
Solution:
This change fixes below display problems by refreshing
allow list from DeviceIdleController service.
1. Battery optimization summary in Battery usage details.
2. Battery optimization list.
BYPASS_INCLUSIVE_LANGUAGE_REASON=I need the object name
to describe the root cause.
Bug: 171064162
Test: make RunSettingsRoboTests ROBOTEST_FILTER=BatteryOptimizationPreferenceControllerTest
manual
Switch battery optimazion of a APP and observer the UI display.
Change-Id: I75b269eec5d1b904dcaa71948798f169d4e4ddfa
Having consistent import order will reduce chance of merge
conflict between internal and external master
Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
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
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