Refine the update process of battery tip

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
This commit is contained in:
Lei Yu
2018-03-12 16:13:35 -07:00
parent 0a5367c0c4
commit 0ae2cd68f2
6 changed files with 64 additions and 8 deletions

View File

@@ -352,6 +352,14 @@ public class PowerUsageSummaryTest {
R.string.advanced_battery_title);
}
@Test
public void testRefreshUi_deviceRotate_doNotUpdateBatteryTip() {
mFragment.mNeedUpdateBatteryTip = false;
mFragment.refreshUi();
verify(mFragment, never()).restartBatteryTipLoader();
}
public static class TestFragment extends PowerUsageSummary {
private Context mContext;
@@ -364,12 +372,6 @@ public class PowerUsageSummaryTest {
return mContext;
}
@Override
protected void refreshUi() {
// Leave it empty for toggle apps menu test
}
@Override
void showBothEstimates() {
List<BatteryInfo> fakeBatteryInfo = new ArrayList<>(2);