Force update all suggestions but app restriction

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
This commit is contained in:
Lei Yu
2018-04-17 11:07:47 -07:00
parent 70bd0c6d00
commit 710d5fc886
6 changed files with 57 additions and 15 deletions

View File

@@ -107,7 +107,8 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
BatteryHeaderPreferenceController mBatteryHeaderPreferenceController;
@VisibleForTesting
boolean mNeedUpdateBatteryTip;
private BatteryTipPreferenceController mBatteryTipPreferenceController;
@VisibleForTesting
BatteryTipPreferenceController mBatteryTipPreferenceController;
private int mStatsType = BatteryStats.STATS_SINCE_CHARGED;
@VisibleForTesting
@@ -213,8 +214,8 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
mAnomalySparseArray = new SparseArray<>();
restartBatteryInfoLoader();
mNeedUpdateBatteryTip = icicle == null;
mBatteryTipPreferenceController.restoreInstanceState(icicle);
updateBatteryTipFlag(icicle);
}
@Override
@@ -382,6 +383,11 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
}
}
@VisibleForTesting
void updateBatteryTipFlag(Bundle icicle) {
mNeedUpdateBatteryTip = icicle == null || mBatteryTipPreferenceController.needUpdate();
}
@Override
public boolean onLongClick(View view) {
showBothEstimates();