When there is configuration change(icicle is not null), still
force update all suggestion except app restriction.
App restriction is not stateless: state HANDLED only happens when
there is anomaly and it disappear in next cycle. So we should only
update it when necessary.
Change-Id: Ifb7a1c477962a0c78b5455a5fbc078590fd408f2
Fixes: 77973093
Test: RunSettingsRoboTests
When battery page is launched, BatteryTipLoader will start running.
If we rotate the screen before loader is finished, it will store null
to Bundle and will crash when restoring from that Bundle.
In this cl, we add null pointer check for tip list to avoid the crash.
Also remove a TODO since it is obsolete.
Change-Id: Ic59bc20c633f3a7467f7b5e95da062160bcb4e93
Fixes: 77534165
Test: RunSettingsRoboTests
1. When device is rotated, don't update the battery tip
2. When user go back to battery main page from other page, start
battery tip update process
3. In RestrictAppTip, if there aren't restricted apps anymore,
hide the tip.
Bug: 74467010
Test: RunSettingsRobotests
Change-Id: I300bcc5b487d587f6618e340ac074fe416dcc1b2
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
Also change SummaryTip to store the time data, which is used
in the dialog. If "Full last charge" time is available, show
normal message otherwise show message without it.
Bug: 72997971
Test: RunSettingsRoboTests
Change-Id: I4ce94f0935465a18275edb13e3be343313427c3b
For each visible battery tip, logs its type and state. For battery tip
with app list, also log that list:
1. HighUsageTip: apps that used too much battery
2. RestrictAppTip: apps with anomaly, also logs the anomaly type
Bug: 73888115
Test: RunSettingsRoboTests
Change-Id: I1b61eb1d793d979baab4864d2d652e12260b590d
This action is used to go to the anomaly detail page.
This cl also refactored the RestrictedAppDetails to take AppInfo
as the input, not AppOpsManager.PackageOps.
Bug: 72385333
Test: RunSettingsRoboTests
Change-Id: I5b4481091635e1250629ea21c2b650db929c18ed
1. Update the order for each tip.
2. Change BatteryTipPreferenceController and only show one precedent
tip.
3. Update the SummaryDetector since now it doesn't need visibleTips
Bug: 70570352
Test: RunSettingsRoboTests
Change-Id: I9e2b8e72aad263f8a210c9320e0ea1eaaf8d5042
Also move the action method from BatteryTip to TipAction. Since it
need extra data that we don't want to store it in parcel.
Bug: 71502850
Test: RunSettingsRoboTests
Change-Id: Ib658426725158d26fcdd437fa8bf6bf24e9a8c14
This DialogFragment handles all the tip related dialogs. This cl makes:
1. All the tips parcelable.
2. Add dialog for HighUsageTip. It also need adapter to populate app
list in dialog.
3. Add and update tests
Bug: 70570352
Test: RunSettingsRoboTests
Change-Id: Ie4c986172cfc73d8746abc7457d966c8600c6145
This cl adds the basic structure for battery tip:
1. BaseBatteryTip: Model class to represent the tip and build
preference and dialog
2. SummaryTip: Display a general battery summary(i.e. your battery
is good..)
3. BatteryTipLoader: AsyncLoader to load the battery tips.
4. BatteryTipPreferenceController: preference controller for
preference group to display battery tips
This cl also:
1. Remove the anomaly code in PowerUsageSummary and we will add it
to app restriction in future.
2. Add preference_category_no_title.xml to avoid the extra 32dp
blank at the top.
Bug: 70570352
Test: RunSettingsRoboTests
Change-Id: If91a553888e2eb91d55fb1d0d7bbea69652f144c