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

@@ -52,6 +52,7 @@ public class BatteryTipPreferenceController extends BasePreferenceController {
private Map<String, BatteryTip> mBatteryTipMap;
private SettingsActivity mSettingsActivity;
private MetricsFeatureProvider mMetricsFeatureProvider;
private boolean mNeedUpdate;
@VisibleForTesting
PreferenceGroup mPreferenceGroup;
@VisibleForTesting
@@ -71,6 +72,7 @@ public class BatteryTipPreferenceController extends BasePreferenceController {
mFragment = fragment;
mSettingsActivity = settingsActivity;
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
mNeedUpdate = true;
}
@Override
@@ -111,6 +113,7 @@ public class BatteryTipPreferenceController extends BasePreferenceController {
mBatteryTipMap.put(preference.getKey(), batteryTip);
mPreferenceGroup.addPreference(preference);
batteryTip.log(mContext, mMetricsFeatureProvider);
mNeedUpdate = batteryTip.needUpdate();
break;
}
}
@@ -153,6 +156,10 @@ public class BatteryTipPreferenceController extends BasePreferenceController {
outState.putParcelableList(KEY_BATTERY_TIPS, mBatteryTips);
}
public boolean needUpdate() {
return mNeedUpdate;
}
/**
* Listener to give the control back to target fragment
*/