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

Commit 46eb2c5e authored by Danny Baumann's avatar Danny Baumann Committed by Steve Kondik
Browse files

fw/base: allow home button to wake device [1/2]

Change-Id: I2b79561dcfa7e569b2e24bbabfffb11517d4d313
parent 30e6747f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3040,6 +3040,12 @@ public final class Settings {
         */
        public static final String KEY_APP_SWITCH_LONG_PRESS_ACTION = "key_app_switch_long_press_action";

        /**
         * Whether to wake the screen with the home key, the value is boolean.
         * @hide
         */
        public static final String HOME_WAKE_SCREEN = "home_wake_screen";

        /**
         * Whether the phone ringtone should be played in an increasing manner
         * @hide
+14 −0
Original line number Diff line number Diff line
@@ -394,6 +394,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mTranslucentDecorEnabled = true;
    int mBackKillTimeout;

    // Behavior of home wake
    boolean mHomeWakeScreen;

    int mDeviceHardwareKeys;

    int mPointerLocationMode = 0; // guarded by mLock
@@ -721,6 +724,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.DEV_FORCE_SHOW_NAVBAR), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.HOME_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);

            updateSettings();
        }
@@ -1600,6 +1606,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR,
                    Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT,
                    UserHandle.USER_CURRENT);
            mHomeWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.HOME_WAKE_SCREEN, 1, UserHandle.USER_CURRENT) == 1);

            // Configure wake gesture.
            boolean wakeGestureEnabledSetting = Settings.Secure.getIntForUser(resolver,
@@ -4926,6 +4934,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                break;
            }

            case KeyEvent.KEYCODE_HOME:
                if (down && !interactive && mHomeWakeScreen) {
                    isWakeKey = true;
                }
                break;

            case KeyEvent.KEYCODE_ENDCALL: {
                result &= ~ACTION_PASS_TO_USER;
                if (down) {