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

Commit 7bbc6eb4 authored by Michael Bestas's avatar Michael Bestas Committed by Steve Kondik
Browse files

Cleanup button wake settings (2/2)

Change-Id: Ie37136cbd57c4c334321abbfa4543727e940bc43
parent fcbbb25d
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -2196,13 +2196,6 @@ public final class Settings {
         */
        public static final String VOLUME_MASTER_MUTE = "volume_master_mute";

        /**
         * Whether to wake the screen with the volume keys, the value is boolean.
         *
         * @hide
         */
        public static final String VOLUME_WAKE_SCREEN = "volume_wake_screen";

        /**
         * Whether or not volume button music controls should be enabled to seek media tracks
         * @hide
@@ -3092,6 +3085,24 @@ public final class Settings {
         */
        public static final String HOME_WAKE_SCREEN = "home_wake_screen";

        /**
         * Whether to wake the screen with the back key, the value is boolean.
         * @hide
         */
        public static final String BACK_WAKE_SCREEN = "back_wake_screen";

        /**
         * Whether to wake the screen with the menu key, the value is boolean.
         * @hide
         */
        public static final String MENU_WAKE_SCREEN = "menu_wake_screen";

        /**
         * Whether to wake the screen with the volume keys, the value is boolean.
         * @hide
         */
        public static final String VOLUME_WAKE_SCREEN = "volume_wake_screen";

        /**
         * Whether the phone ringtone should be played in an increasing manner
         * @hide
+17 −2
Original line number Diff line number Diff line
@@ -788,7 +788,7 @@
    -->
    <integer name="config_longPressOnMenuBehavior">3</integer>

    <!-- Hardware 'face' keys present on the device, stored as a bit field.
    <!-- Hardware keys present on the device, stored as a bit field.
         This integer should equal the sum of the corresponding value for each
         of the following keys present:
             1 - Home
@@ -797,9 +797,24 @@
             8 - Assistant (search)
            16 - App switch
            32 - Camera
            64 - Volume rocker
         For example, a device with Home, Back and Menu keys would set this
         config to 7. -->
    <integer name="config_deviceHardwareKeys">15</integer>
    <integer name="config_deviceHardwareKeys">79</integer>

    <!-- Hardware keys present on the device with the ability to wake, stored as a bit field.
         This integer should equal the sum of the corresponding value for each
         of the following keys present:
             1 - Home
             2 - Back
             4 - Menu
             8 - Assistant (search)
            16 - App switch
            32 - Camera
            64 - Volume rocker
         For example, a device with Home, Back and Menu keys would set this
         config to 7. -->
    <integer name="config_deviceHardwareWakeKeys">79</integer>

    <!-- Minimum screen brightness setting allowed by the power manager.
         The user is forbidden from setting the brightness below this level. -->
+1 −0
Original line number Diff line number Diff line
@@ -1514,6 +1514,7 @@
  <java-symbol type="integer" name="config_defaultUiModeType" />
  <java-symbol type="integer" name="config_deskDockRotation" />
  <java-symbol type="integer" name="config_deviceHardwareKeys" />
  <java-symbol type="integer" name="config_deviceHardwareWakeKeys" />
  <java-symbol type="integer" name="config_doubleTapOnHomeBehavior" />
  <java-symbol type="integer" name="config_lidKeyboardAccessibility" />
  <java-symbol type="integer" name="config_lidNavigationAccessibility" />
+24 −11
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private static final int KEY_MASK_ASSIST = 0x08;
    private static final int KEY_MASK_APP_SWITCH = 0x10;
    private static final int KEY_MASK_CAMERA = 0x20;
    private static final int KEY_MASK_VOLUME = 0x40;

    /**
     * These are the system UI flags that, when changing, can cause the layout
@@ -393,11 +394,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mTranslucentDecorEnabled = true;
    int mBackKillTimeout;

    // Behavior of home wake
    boolean mHomeWakeScreen;

    int mDeviceHardwareKeys;

    // Button wake control flags
    boolean mHomeWakeScreen;
    boolean mBackWakeScreen;
    boolean mMenuWakeScreen;
    boolean mVolumeWakeScreen;

    int mPointerLocationMode = 0; // guarded by mLock

    int mLongPressPoweronTime = DEFAULT_LONG_PRESS_POWERON_TIME;
@@ -405,9 +409,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    WindowState mFocusedWindow;
    IApplicationToken mFocusedApp;

    // Volume wake control flag
    boolean mVolumeWakeScreen;

    // Behavior of volbtn music controls
    boolean mVolBtnMusicControls;
    boolean mIsLongPress;
@@ -746,6 +747,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.HOME_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.BACK_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.MENU_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.VOLUME_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
@@ -1624,6 +1631,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    UserHandle.USER_CURRENT);
            mHomeWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.HOME_WAKE_SCREEN, 1, UserHandle.USER_CURRENT) == 1);
            mBackWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.BACK_WAKE_SCREEN, 0, UserHandle.USER_CURRENT) == 1);
            mMenuWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.MENU_WAKE_SCREEN, 0, UserHandle.USER_CURRENT) == 1);
            mVolumeWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.VOLUME_WAKE_SCREEN, 0, UserHandle.USER_CURRENT) == 1);
            mVolBtnMusicControls = (Settings.System.getIntForUser(resolver,
                    Settings.System.VOLBTN_MUSIC_CONTROLS, 1, UserHandle.USER_CURRENT) == 1);

@@ -1700,11 +1713,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            if (mImmersiveModeConfirmation != null) {
                mImmersiveModeConfirmation.loadSetting(mCurrentUserId);
            }

            // Volume wake
            mVolumeWakeScreen = (Settings.System.getIntForUser(resolver,
                    Settings.System.VOLUME_WAKE_SCREEN, 0, UserHandle.USER_CURRENT) == 1);

            PolicyControl.reloadFromSetting(mContext);
        }
        if (updateRotation) {
@@ -5205,6 +5213,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case KeyEvent.KEYCODE_CAMERA:
            case KeyEvent.KEYCODE_FOCUS:
                return false;

            case KeyEvent.KEYCODE_BACK:
                return mBackWakeScreen;
            case KeyEvent.KEYCODE_MENU:
                return mMenuWakeScreen;
        }
        return true;
    }