Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e677d711 authored by John Spurlock's avatar John Spurlock
Browse files

Introduce zen mode.

 - New global zen mode setting with three values:
   ZEN_MODE_OFF, ZEN_MODE_LIMITED, ZEN_MODE_FULL
 - Status bar icon (on lhs)  when in _LIMITED / _FULL
 - Rules are hardcoded for now:
   _LIMITED = intercept all notifications except calls/alarms
   _FULL = intercept everything
 - UI affordance in shade to set mode
 - Only one exit condition: "Until you delete this"
 - Intercepted notifications:
   - appear darker in the shade
   - do not cause sound/vibration
   - do not fire fullScreenIntents
   - do not contribute an icon to the status bar

Change-Id: Ic36c95982b483432006bf9dab102a31370382aa9
parent 94b5ca81
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -6081,6 +6081,24 @@ public final class Settings {
        public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS =
                "lock_screen_show_notifications";

        /**
         * Defines global zen mode.  One of ZEN_MODE_OFF, ZEN_MODE_LIMITED, ZEN_MODE_FULL.
         *
         * @hide
         */
        public static final String ZEN_MODE = "zen_mode";

        /** @hide */ public static final int ZEN_MODE_OFF = 0;
        /** @hide */ public static final int ZEN_MODE_LIMITED = 1;
        /** @hide */ public static final int ZEN_MODE_FULL = 2;

        /** @hide */ public static String zenModeToString(int mode) {
            if (mode == ZEN_MODE_OFF) return "ZEN_MODE_OFF";
            if (mode == ZEN_MODE_LIMITED) return "ZEN_MODE_LIMITED";
            if (mode == ZEN_MODE_FULL) return "ZEN_MODE_FULL";
            throw new IllegalArgumentException("Invalid zen mode: " + mode);
        }

        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
+408 B
Loading image diff...
+745 B
Loading image diff...
+614 B
Loading image diff...
+293 B
Loading image diff...
Loading