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

Commit 051faec5 authored by DvTonder's avatar DvTonder
Browse files

Feature request 5852: Option to toggle items in shutdown menu (2/2)

This allows for the selective switching of the various CM additions on the
power menu.  Reboot and Profiles are enabled by default, Screenshot is
disabled.

This is the completion of the feature that was merged while still partially
complete

Change-Id: I397ac32509d30ffc1cf18263d8a000cb6f9ccdd1
parent 133416fe
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -2675,12 +2675,24 @@ public final class Settings {
         */
        public static final String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled";

        /**
         * Whether power menu screenshot is enabled
         * @hide
         */
        public static final String POWER_MENU_REBOOT_ENABLED = "power_menu_reboot_enabled";

        /**
         * Whether power menu screenshot is enabled
         * @hide
         */
        public static final String POWER_MENU_SCREENSHOT_ENABLED = "power_menu_screenshot_enabled";

        /**
         * Whether power menu screenshot is enabled
         * @hide
         */
        public static final String POWER_MENU_PROFILES_ENABLED = "power_menu_profiles_enabled";

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

+28 −20
Original line number Diff line number Diff line
@@ -254,6 +254,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
            });

        // next: reboot
        // only shown if enabled, enabled by default
        if (Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.POWER_MENU_REBOOT_ENABLED, 1) == 1) {
            mItems.add(
                new SinglePressAction(R.drawable.ic_lock_reboot, R.string.global_action_reboot) {
                    public void onPress() {
@@ -273,10 +276,14 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
                        return true;
                    }
                });
        }

        // next: profile - only shown if enabled, enabled by default
        if (Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.SYSTEM_PROFILES_ENABLED, 1) == 1) {
        // next: profile
        // only shown if both system profiles and the menu item is enabled, enabled by default
        if ((Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.SYSTEM_PROFILES_ENABLED, 1) == 1) &&
                (Settings.System.getInt(mContext.getContentResolver(),
                        Settings.System.POWER_MENU_PROFILES_ENABLED, 1) == 1)) {
            mItems.add(
                new ProfileChooseAction() {
                    public void onPress() {
@@ -297,7 +304,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
                });
        }

        // next: screenshot - only shown if enabled, disabled by default
        // next: screenshot
        // only shown if enabled, disabled by default
        if (Settings.System.getInt(mContext.getContentResolver(),
                POWER_MENU_SCREENSHOT_ENABLED, 0) == 1) {
            mItems.add(