Add sanity check method for BatteryTip

This method is used to check whether data in battery tip is still
valid. If not, try recover the data or dismiss the tip.

Change-Id: Idc9e4d49f99e33d3f5e82e694dc78227fc1da41c
Fixes: 111218723
Test: RunSettingsRoboTests
This commit is contained in:
Lei Yu
2018-07-09 14:53:55 -07:00
committed by jackqdyulei
parent 636cc6caf9
commit b07d1f34c6
4 changed files with 54 additions and 0 deletions

View File

@@ -107,6 +107,7 @@ public class BatteryTipPreferenceController extends BasePreferenceController {
mPreferenceGroup.removeAll();
for (int i = 0, size = batteryTips.size(); i < size; i++) {
final BatteryTip batteryTip = mBatteryTips.get(i);
batteryTip.sanityCheck(mContext);
if (batteryTip.getState() != BatteryTip.StateType.INVISIBLE) {
final Preference preference = batteryTip.buildPreference(mPrefContext);
mBatteryTipMap.put(preference.getKey(), batteryTip);