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

Commit 4a55b755 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari Committed by Automerger Merge Worker
Browse files

Merge "Handle back shortcuts in native and remove home shortcut handling" into...

Merge "Handle back shortcuts in native and remove home shortcut handling" into udc-dev am: 054486ae

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/21548190



Change-Id: I8d371bf5d930f241e4c76bac9da13c08b1bf34c1
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 8e6c21d2 054486ae
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -4036,18 +4036,20 @@ void InputDispatcher::notifyConfigurationChanged(const NotifyConfigurationChange

/**
 * If one of the meta shortcuts is detected, process them here:
 *     Meta + Backspace -> generate BACK
 *     Meta + Enter -> generate HOME
 * This will potentially overwrite keyCode and metaState.
 *     Meta + Backspace; Meta + Grave; Meta + Left arrow -> generate BACK
 * Most System shortcuts are handled in PhoneWindowManager.java except 'Back' shortcuts. Unlike
 * Back, other shortcuts DO NOT need to be sent to applications and are fully handled by the system.
 * But for Back key and Back shortcuts, we need to send KEYCODE_BACK to applications which can
 * potentially handle the back key presses.
 * Note: We don't send any Meta based KeyEvents to applications, so we need to convert to a KeyEvent
 * where meta modifier is off before sending. Currently only use case is 'Back'.
 */
void InputDispatcher::accelerateMetaShortcuts(const int32_t deviceId, const int32_t action,
                                              int32_t& keyCode, int32_t& metaState) {
    if (metaState & AMETA_META_ON && action == AKEY_EVENT_ACTION_DOWN) {
        int32_t newKeyCode = AKEYCODE_UNKNOWN;
        if (keyCode == AKEYCODE_DEL) {
        if (keyCode == AKEYCODE_DEL || keyCode == AKEYCODE_GRAVE || keyCode == AKEYCODE_DPAD_LEFT) {
            newKeyCode = AKEYCODE_BACK;
        } else if (keyCode == AKEYCODE_ENTER) {
            newKeyCode = AKEYCODE_HOME;
        }
        if (newKeyCode != AKEYCODE_UNKNOWN) {
            std::scoped_lock _l(mLock);