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

Commit defba0ca authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Only give WebTextView keys if it has focus.

Bug:3460690
Change-Id: Iab82dc2c6e07a83062338ede8428e9d81ef0b949
parent 90e71167
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -5275,7 +5275,6 @@ public class WebView extends AbsoluteLayout

    @Override
    public boolean dispatchKeyEvent(KeyEvent event) {
        boolean dispatch = true;
        switch (event.getAction()) {
            case KeyEvent.ACTION_DOWN:
                mKeysPressed.add(Integer.valueOf(event.getKeyCode()));
@@ -5288,7 +5287,7 @@ public class WebView extends AbsoluteLayout
                if (location == -1) {
                    // We did not receive the key down for this key, so do not
                    // handle the key up.
                    dispatch = false;
                    return false;
                } else {
                    // We did receive the key down.  Handle the key up, and
                    // remove it from our pressed keys.
@@ -5300,18 +5299,13 @@ public class WebView extends AbsoluteLayout
                // action is added to KeyEvent.
                break;
        }
        if (dispatch) {
            if (inEditingMode()) {
        if (inEditingMode() && mWebTextView.isFocused()) {
            // Ensure that the WebTextView gets the event, even if it does
            // not currently have a bounds.
            return mWebTextView.dispatchKeyEvent(event);
        } else {
            return super.dispatchKeyEvent(event);
        }
        } else {
            // We didn't dispatch, so let something else handle the key
            return false;
        }
    }

    // Here are the snap align logic: