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

@@ -86,17 +86,23 @@ public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable {
protected int mType;
protected int mState;
protected boolean mShowDialog;
/**
* Whether we need to update battery tip when configuration change
*/
protected boolean mNeedUpdate;
BatteryTip(Parcel in) {
mType = in.readInt();
mState = in.readInt();
mShowDialog = in.readBoolean();
mNeedUpdate = in.readBoolean();
}
BatteryTip(int type, int state, boolean showDialog) {
mType = type;
mState = state;
mShowDialog = showDialog;
mNeedUpdate = true;
}
@Override
@@ -109,6 +115,7 @@ public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable {
dest.writeInt(mType);
dest.writeInt(mState);
dest.writeBoolean(mShowDialog);
dest.writeBoolean(mNeedUpdate);
}
public abstract CharSequence getTitle(Context context);
@@ -144,6 +151,10 @@ public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable {
return mShowDialog;
}
public boolean needUpdate() {
return mNeedUpdate;
}
public String getKey() {
return KEY_PREFIX + mType;
}