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

Commit 9b5cc049 authored by Daniel Tschinder's avatar Daniel Tschinder
Browse files

Do not wake screen with volume keys when no lockscreen active

If lockscreen is completelly disabled or timeouts are used
it was possible to wake the phone with volume keys while
there was no lockscreen, even if the option
"wake wit volume" in CMParts was disabled.

This was due to the fact, that the flag WAKE is enabled on
most phones for volume keys in the file <phone>-keylout.kl

This patch fixes that and checks the option.

Change-Id: Ie7c3f84b2db268a1d111f76fa42b317144e695b8
parent 252b59a3
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -2054,12 +2054,21 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            // to wake the device but don't pass the key to the application.
            result = 0;

            final boolean isWakeKey = (policyFlags
            boolean isWakeKey = (policyFlags
                    & (WindowManagerPolicy.FLAG_WAKE | WindowManagerPolicy.FLAG_WAKE_DROPPED)) != 0
                    || ((keyCode == BTN_MOUSE) && mTrackballWakeScreen)
                    || ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) && mVolumeWakeScreen)
                    || ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) && mVolumeWakeScreen);

            // Don't wake the screen if we have not set the option "wake with volume" in CMParts
            // regardless if WAKE Flag is set in keylayout
            if (!isScreenOn
                    && isWakeKey
                    && !mVolumeWakeScreen
                    && ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN))) {
                isWakeKey = false;
            }

            // make sure keyevent get's handled as power key on volume-wake
            if(!isScreenOn && mVolumeWakeScreen && isWakeKey && ((keyCode == KeyEvent.KEYCODE_VOLUME_UP)
                    || (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)))