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

Commit 6855c96e authored by AustinSchulz's avatar AustinSchulz Committed by Gerrit Code Review
Browse files

Allow airplane and silent power toggle (2/2)

Based upon the system already in place by DvTonder

Change-Id: Ibf2587da48679c039f335085fe9b78d493eac158
parent 56c014f2
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -2728,6 +2728,18 @@ public final class Settings {
         */
        public static final String POWER_MENU_PROFILES_ENABLED = "power_menu_profiles_enabled";

        /**
         * Whether power menu airplane toggle is enabled
         * @hide
         */
        public static final String POWER_MENU_AIRPLANE_ENABLED = "power_menu_airplane_enabled";

        /**
         * Whether power menu silent mode is enabled
         * @hide
         */
        public static final String POWER_MENU_SILENT_ENABLED = "power_menu_silent_enabled";

        /**
         * Whether to enable custom rebindings of the actions performed on
         * certain key press events.
@@ -2895,6 +2907,8 @@ public final class Settings {
            POWER_MENU_SCREENSHOT_ENABLED,
            POWER_MENU_REBOOT_ENABLED,
            POWER_MENU_PROFILES_ENABLED,
            POWER_MENU_AIRPLANE_ENABLED,
            POWER_MENU_SILENT_ENABLED,
            LOCKSCREEN_VIBRATE_ENABLED,
        };

+7 −2
Original line number Diff line number Diff line
@@ -325,7 +325,10 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
        }

        // next: airplane mode
        if (Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.POWER_MENU_AIRPLANE_ENABLED, 1) == 1) {
            mItems.add(mAirplaneModeOn);
        }

        // next: users
        List<UserInfo> users = mContext.getPackageManager().getUsers();
@@ -365,7 +368,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
        }

        // last: silent mode
        if (SHOW_SILENT_TOGGLE) {
        if ((Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.POWER_MENU_SILENT_ENABLED, 1) == 1) &&
                (SHOW_SILENT_TOGGLE)) {
            mItems.add(mSilentModeAction);
        }