File tree Expand file tree Collapse file tree
src/com/android/settings/dashboard/conditional Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222import android .content .Context ;
2323import android .content .Intent ;
2424import android .graphics .drawable .Icon ;
25+ import android .os .PersistableBundle ;
2526import android .provider .Settings ;
27+ import android .provider .Settings .Global ;
2628import android .service .notification .ZenModeConfig ;
2729import com .android .internal .logging .MetricsProto .MetricsEvent ;
2830import com .android .settings .R ;
2931
3032public 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 ;
You can’t perform that action at this time.
0 commit comments