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

Commit b5ed5703 authored by Martin Brabham's avatar Martin Brabham Committed by Steve Kondik
Browse files

Android Policy: handle volume key event as wake key when preference is set

Change-Id: If9a61cd65553bf00f0efda1a75b1ab75b9129090
parent 1814ad52
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1860,6 +1860,9 @@ public class KeyEvent extends InputEvent implements Parcelable {
            case KeyEvent.KEYCODE_STEM_1:
            case KeyEvent.KEYCODE_STEM_2:
            case KeyEvent.KEYCODE_STEM_3:
            case KeyEvent.KEYCODE_VOLUME_UP:
            case KeyEvent.KEYCODE_VOLUME_DOWN:
            case KeyEvent.KEYCODE_VOLUME_MUTE:
                return true;
        }
        return false;
+12 −2
Original line number Diff line number Diff line
@@ -531,6 +531,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mVolBtnMusicControls;
    boolean mIsLongPress;

    // Volume wake control flag
    boolean mVolumeWakeScreen;

    PointerLocationView mPointerLocationView;

    // The current size of the screen; really; extends into the overscan area of
@@ -954,7 +957,9 @@ 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.VOLUME_WAKE_SCREEN), false, this,
                    UserHandle.USER_ALL);
            updateSettings();
        }

@@ -2257,6 +2262,11 @@ 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);

        }
        synchronized (mWindowManagerFuncs.getWindowManagerLock()) {
            PolicyControl.reloadFromSetting(mContext);
@@ -6293,7 +6303,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case KeyEvent.KEYCODE_VOLUME_UP:
            case KeyEvent.KEYCODE_VOLUME_DOWN:
            case KeyEvent.KEYCODE_VOLUME_MUTE:
                return mDockMode != Intent.EXTRA_DOCK_STATE_UNDOCKED;
                return mVolumeWakeScreen || mDockMode != Intent.EXTRA_DOCK_STATE_UNDOCKED;

            // ignore media and camera keys
            case KeyEvent.KEYCODE_MUTE: