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

Commit 26abdab7 authored by Michael Bestas's avatar Michael Bestas Committed by Abhisek Devkota
Browse files

Allow disabling Search/Recents button wake (2/2)

Change-Id: I6a2ac064efc4fe85413bf0b935c28aa7bde5d672
parent dbab953b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3106,6 +3106,18 @@ public final class Settings {
         */
        public static final String MENU_WAKE_SCREEN = "menu_wake_screen";

        /**
         * Whether to wake the screen with the assist key, the value is boolean.
         * @hide
         */
        public static final String ASSIST_WAKE_SCREEN = "assist_wake_screen";

        /**
         * Whether to wake the screen with the app switch key, the value is boolean.
         * @hide
         */
        public static final String APP_SWITCH_WAKE_SCREEN = "app_switch_wake_screen";

        /**
         * Whether to wake the screen with the volume keys, the value is boolean.
         * @hide
+18 −0
Original line number Diff line number Diff line
@@ -401,6 +401,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mHomeWakeScreen;
    boolean mBackWakeScreen;
    boolean mMenuWakeScreen;
    boolean mAssistWakeScreen;
    boolean mAppSwitchWakeScreen;
    boolean mVolumeWakeScreen;

    // During wakeup by volume keys, we still need to capture subsequent events
@@ -763,6 +765,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.MENU_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.ASSIST_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.APP_SWITCH_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.VOLUME_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
@@ -1652,6 +1660,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            mMenuWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.MENU_WAKE_SCREEN, 0, UserHandle.USER_CURRENT) == 1) &&
                    ((mDeviceHardwareWakeKeys & KEY_MASK_MENU) != 0);
            mAssistWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.ASSIST_WAKE_SCREEN, 0, UserHandle.USER_CURRENT) == 1) &&
                    ((mDeviceHardwareWakeKeys & KEY_MASK_ASSIST) != 0);
            mAppSwitchWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.APP_SWITCH_WAKE_SCREEN, 0, UserHandle.USER_CURRENT) == 1) &&
                    ((mDeviceHardwareWakeKeys & KEY_MASK_APP_SWITCH) != 0);
            mVolumeWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.VOLUME_WAKE_SCREEN, 0, UserHandle.USER_CURRENT) == 1) &&
                    ((mDeviceHardwareWakeKeys & KEY_MASK_VOLUME) != 0);
@@ -5303,6 +5317,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                return mBackWakeScreen;
            case KeyEvent.KEYCODE_MENU:
                return mMenuWakeScreen;
            case KeyEvent.KEYCODE_ASSIST:
                return mAssistWakeScreen;
            case KeyEvent.KEYCODE_APP_SWITCH:
                return mAppSwitchWakeScreen;
        }
        return true;
    }