Fix DND conditional null state
Persist all of the data it needs to produce the UI. Change-Id: Ifb143b2cd3fef075cd77feaf53051eb8b7153a51 Fixes: 27664882
This commit is contained in:
@@ -22,7 +22,9 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.os.PersistableBundle;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.Global;
|
||||
import android.service.notification.ZenModeConfig;
|
||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
@@ -30,6 +32,7 @@ import com.android.settings.R;
|
||||
public class DndCondition extends Condition {
|
||||
|
||||
private static final String TAG = "DndCondition";
|
||||
private static final String KEY_STATE = "state";
|
||||
|
||||
private int mZen;
|
||||
private ZenModeConfig mConfig;
|
||||
@@ -52,6 +55,18 @@ public class DndCondition extends Condition {
|
||||
setActive(zenModeEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean saveState(PersistableBundle bundle) {
|
||||
bundle.putInt(KEY_STATE, mZen);
|
||||
return super.saveState(bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
void restoreState(PersistableBundle bundle) {
|
||||
super.restoreState(bundle);
|
||||
mZen = bundle.getInt(KEY_STATE, Global.ZEN_MODE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> getReceiverClass() {
|
||||
return Receiver.class;
|
||||
|
Reference in New Issue
Block a user