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

Commit 63df1df1 authored by DvTonder's avatar DvTonder Committed by Steve Kondik
Browse files

Framework: Add ability to disable Power menu screenshot (Part 1/2)

Change-Id: Iae3890e7d63a1d69720c3f8ef91ae5e1de06ff88
parent 6c859c0b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -2663,11 +2663,17 @@ public final class Settings {
        public static final String STATUS_BAR_NOTIF_COUNT = "status_bar_notif_count";

        /**
         * Show the pending notification counts as overlays on the status bar
         * Whether System profiles are enabled
         * @hide
         */
        public static final String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled";

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

        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
@@ -2748,6 +2754,8 @@ public final class Settings {
            QUIET_HOURS_STILL,
            QUIET_HOURS_DIM,
            LOCKSCREEN_ALWAYS_SHOW_BATTERY,
            SYSTEM_PROFILES_ENABLED,
            POWER_MENU_SCREENSHOT_ENABLED,
        };

        // Settings moved to Settings.Secure
+18 −14
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
    private Profile mChosenProfile;

    private static final String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled";
    private static final String POWER_MENU_SCREENSHOT_ENABLED = "power_menu_screenshot_enabled";

    /**
     * @param context everything needs a context :(
@@ -274,7 +275,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
                }
            });

        // next: profile - only shown if enabled, which is true by default
        // next: profile - only shown if enabled, enabled by default
        if (Settings.System.getInt(mContext.getContentResolver(), SYSTEM_PROFILES_ENABLED, 1) == 1) {
            mItems.add(
                new ProfileChooseAction() {
@@ -296,7 +297,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
                });
        }

        // next: screenshot
        // next: screenshot - only shown if enabled, disabled by default
        if (Settings.System.getInt(mContext.getContentResolver(),
                POWER_MENU_SCREENSHOT_ENABLED, 0) == 1) {
            mItems.add(
                new SinglePressAction(R.drawable.ic_lock_screenshot, R.string.global_action_screenshot) {
                    public void onPress() {
@@ -311,6 +314,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
                        return true;
                    }
                });
        }

        // next: airplane mode
        mItems.add(mAirplaneModeOn);