Skip to content

Commit 733649c

Browse files
MonkopediaAndroid (Google) Code Review
authored andcommitted
Merge "Fix DND conditional null state" into nyc-dev
2 parents 5a9f7d6 + 095d9e3 commit 733649c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/com/android/settings/dashboard/conditional/DndCondition.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@
2222
import android.content.Context;
2323
import android.content.Intent;
2424
import android.graphics.drawable.Icon;
25+
import android.os.PersistableBundle;
2526
import android.provider.Settings;
27+
import android.provider.Settings.Global;
2628
import android.service.notification.ZenModeConfig;
2729
import com.android.internal.logging.MetricsProto.MetricsEvent;
2830
import com.android.settings.R;
2931

3032
public class DndCondition extends Condition {
3133

3234
private static final String TAG = "DndCondition";
35+
private static final String KEY_STATE = "state";
3336

3437
private int mZen;
3538
private ZenModeConfig mConfig;
@@ -52,6 +55,18 @@ public void refreshState() {
5255
setActive(zenModeEnabled);
5356
}
5457

58+
@Override
59+
boolean saveState(PersistableBundle bundle) {
60+
bundle.putInt(KEY_STATE, mZen);
61+
return super.saveState(bundle);
62+
}
63+
64+
@Override
65+
void restoreState(PersistableBundle bundle) {
66+
super.restoreState(bundle);
67+
mZen = bundle.getInt(KEY_STATE, Global.ZEN_MODE_OFF);
68+
}
69+
5570
@Override
5671
protected Class<?> getReceiverClass() {
5772
return Receiver.class;

0 commit comments

Comments
 (0)