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

Commit 0b8f6c01 authored by Danesh Mondegarian's avatar Danesh Mondegarian
Browse files

DeviceKeyHandler : Allow handling keyevents while screen off

Some devices require the keyevents to be processed while the screen
is off, this patchset addresses that by moving the filter up in the call
hierarchy.

Change-Id: If71beecc81aa5e453dcd08aba72b7bea5c210590
parent 20623512
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -2272,18 +2272,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            mHandler.removeCallbacks(mBackLongPress);
        }

        // Specific device key handling
        if (mDeviceKeyHandler != null) {
            try {
                // The device only should consume known keys.
                if (mDeviceKeyHandler.handleKeyEvent(event)) {
                    return -1;
                }
            } catch (Exception e) {
                Slog.w(TAG, "Could not dispatch event to device key handler", e);
            }
        }

        // First we always handle the home key here, so applications
        // can never break it, although if keyguard is on, we do let
        // it handle it, because that gives us the correct 5 second
@@ -4189,6 +4177,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            return result;
        }

        // Specific device key handling
        if (mDeviceKeyHandler != null) {
            try {
                // The device only should consume known keys.
                if (mDeviceKeyHandler.handleKeyEvent(event)) {
                    return 0;
                }
            } catch (Exception e) {
                Slog.w(TAG, "Could not dispatch event to device key handler", e);
            }
        }

        // Handle special keys.
        switch (keyCode) {
            case KeyEvent.KEYCODE_ENDCALL: {