Example usage for android.view.inputmethod InputConnection clearMetaKeyStates

List of usage examples for android.view.inputmethod InputConnection clearMetaKeyStates

Introduction

In this page you can find the example usage for android.view.inputmethod InputConnection clearMetaKeyStates.

Prototype

boolean clearMetaKeyStates(int states);

Source Link

Document

Clear the given meta key pressed states in the given input connection.

Usage

From source file:com.volosyukivan.WiFiInputMethod.java

void resetModifiers() {
    InputConnection conn = getCurrentInputConnection();
    if (conn == null) {
        return;/* w w w  .j ava  2 s.  c  o  m*/
    }
    conn.clearMetaKeyStates(KeyEvent.META_ALT_ON | KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON);
}

From source file:research.sg.edu.edapp.kb.KbSoftKeyboard.java

/**
 * Use this to monitor key events being delivered to the application.
 * We get first crack at them, and can either resume them or let them
 * continue to the app./*from w  ww .  j a  v a 2s.c  o  m*/
 */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    String s = "" + event.getUnicodeChar();
    Log.d("CAME HERE", "CAME HERE");
    switch (keyCode) {
    case KeyEvent.KEYCODE_BACK:
        // The InputMethodService already takes care of the back
        // key for us, to dismiss the input method if it is shown.
        // However, our keyboard could be showing a pop-up window
        // that back should dismiss, so we first allow it to do that.

        if (event.getRepeatCount() == 0 && mInputView != null) {
            if (mInputView.handleBack()) {
                return true;
            }
        }
        break;

    case KeyEvent.KEYCODE_DEL:
        // Special handling of the delete key: if we currently are
        // composing text for the user, we want to modify that instead
        // of let the application to the delete itself.
        if (mComposing.length() > 0) {
            onKey(Keyboard.KEYCODE_DELETE, null);
            return true;
        }
        break;

    case KeyEvent.KEYCODE_ENTER:
        // Let the underlying text editor always handle these.
        return false;

    default:
        // For all other keys, if we want to do transformations on
        // text being entered with a hard keyboard, we need to process
        // it and do the appropriate action.

        if (PROCESS_HARD_KEYS) {
            //*********added changes here
            if (event.getAction() == KeyEvent.ACTION_DOWN) {
                swipe += (char) event.getUnicodeChar();
                Log.d("msg", swipe);
                System.out.println(swipe);
                // keyDownUp(keyCode);
                //   return true;
            }
            //*********done
            if (keyCode == KeyEvent.KEYCODE_SPACE && (event.getMetaState() & KeyEvent.META_ALT_ON) != 0) {
                // A silly example: in our input method, Alt+Space
                // is a shortcut for 'android' in lower case.
                InputConnection ic = getCurrentInputConnection();
                if (ic != null) {
                    // First, tell the editor that it is no longer in the
                    // shift state, since we are consuming this.
                    ic.clearMetaKeyStates(KeyEvent.META_ALT_ON);
                    keyDownUp(KeyEvent.KEYCODE_A);
                    keyDownUp(KeyEvent.KEYCODE_N);
                    keyDownUp(KeyEvent.KEYCODE_D);
                    keyDownUp(KeyEvent.KEYCODE_R);
                    keyDownUp(KeyEvent.KEYCODE_O);
                    keyDownUp(KeyEvent.KEYCODE_I);
                    keyDownUp(KeyEvent.KEYCODE_D);
                    // And we consume this event.
                    return true;
                }

            }

            if (mPredictionOn && translateKeyDown(keyCode, event)) {
                return true;
            }

        }
    }

    return super.onKeyDown(keyCode, event);
}

From source file:com.volosyukivan.WiFiInputMethod.java

void sendKey(int code, boolean down, boolean resetModifiers) {
    long time = System.currentTimeMillis();
    if (time - lastWake > 5000) {
        wakeLock.acquire();/*from   w ww . j  a  va2s . c o m*/
        wakeLock.release();
        lastWake = time;
    }
    InputConnection conn = getCurrentInputConnection();
    if (conn == null) {
        //      Debug.d("connection closed");
        return;
    }
    if (code < 0) {
        if (down == false)
            return;
        switch (code) {
        case KEY_HOME:
            keyHome(conn);
            break;
        case KEY_END:
            keyEnd(conn);
            break;
        case KEY_DEL:
            keyDel(conn);
            break;
        }
        return;
    }

    if (code == KeyEvent.KEYCODE_DPAD_LEFT && pressedKeys.contains(KEY_CONTROL)) {
        if (down == false)
            return;
        wordLeft(conn);
        return;
    } else if (code == KeyEvent.KEYCODE_DPAD_RIGHT && pressedKeys.contains(KEY_CONTROL)) {
        if (down == false)
            return;
        wordRight(conn);
        return;
    } else if (code == KeyEvent.KEYCODE_DPAD_CENTER) {
        if (pressedKeys.contains(KEY_CONTROL)) {
            if (!down)
                return;
            copy(conn);
            return;
        }
        if (pressedKeys.contains(KeyEvent.KEYCODE_SHIFT_LEFT)) {
            if (!down)
                return;
            paste(conn);
            return;
        }
    }

    //    if (pressedKeys.contains(KEY_CONTROL)) {
    //      if (down == false) return;
    //      switch (code) {
    //      case KeyEvent.KEYCODE_A: selectAll(conn); break;
    //      case KeyEvent.KEYCODE_X: cut(conn); break;
    //      case KeyEvent.KEYCODE_C: copy(conn); break;
    //      case KeyEvent.KEYCODE_V: paste(conn); break;
    //      }
    //      return;
    //    }

    conn.sendKeyEvent(new KeyEvent(down ? KeyEvent.ACTION_DOWN : KeyEvent.ACTION_UP, code));
    if (resetModifiers) {
        conn.clearMetaKeyStates(KeyEvent.META_ALT_ON | KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON);
    }
}

From source file:com.yek.keyboard.anysoftkeyboard.AnySoftKeyboard.java

private void switchToNextPhysicalKeyboard(InputConnection ic) {
    // consuming the meta keys
    if (ic != null) {
        ic.clearMetaKeyStates(Integer.MAX_VALUE);// translated, so
        // we also take
        // care of the
        // metakeys.
    }//from  www  . jav a2  s.  c  o  m
    mMetaState = 0;
    // only physical keyboard
    nextKeyboard(getCurrentInputEditorInfo(), KeyboardSwitcher.NextKeyboardType.AlphabetSupportsPhysical);
}

From source file:com.anysoftkeyboard.AnySoftKeyboard.java

private void switchToNextPhysicalKeyboard(InputConnection ic) {
    // consuming the meta keys
    if (ic != null) {
        ic.clearMetaKeyStates(Integer.MAX_VALUE);// translated, so
        // we also take
        // care of the
        // metakeys.
    }/*from  w ww. j  a  va 2s .  c  o  m*/
    mMetaState = 0;
    // only physical keyboard
    nextKeyboard(getCurrentInputEditorInfo(), NextKeyboardType.AlphabetSupportsPhysical);
}

From source file:com.anysoftkeyboard.AnySoftKeyboard.java

private void setInputConnectionMetaStateAsCurrentMetaKeyKeyListenerState() {
    InputConnection ic = getCurrentInputConnection();
    if (ic != null) {
        int clearStatesFlags = 0;
        if (MyMetaKeyKeyListener.getMetaState(mMetaState, MyMetaKeyKeyListener.META_ALT_ON) == 0)
            clearStatesFlags += KeyEvent.META_ALT_ON;
        if (MyMetaKeyKeyListener.getMetaState(mMetaState, MyMetaKeyKeyListener.META_SHIFT_ON) == 0)
            clearStatesFlags += KeyEvent.META_SHIFT_ON;
        if (MyMetaKeyKeyListener.getMetaState(mMetaState, MyMetaKeyKeyListener.META_SYM_ON) == 0)
            clearStatesFlags += KeyEvent.META_SYM_ON;
        ic.clearMetaKeyStates(clearStatesFlags);
    }/*from   w  w  w  . jav a 2  s  .c o  m*/
}

From source file:org.distantshoresmedia.keyboard.LatinIME.java

public void updateShiftKeyState(EditorInfo attr) {
    InputConnection ic = getCurrentInputConnection();
    if (ic != null && attr != null && mKeyboardSwitcher.isAlphabetMode()) {
        int oldState = getShiftState();
        boolean isShifted = mShiftKeyState.isChording();
        boolean isCapsLock = (oldState == Keyboard.SHIFT_CAPS_LOCKED || oldState == Keyboard.SHIFT_LOCKED);
        boolean isCaps = isCapsLock || getCursorCapsMode(ic, attr) != 0;
        //Log.i(TAG, "updateShiftKeyState isShifted=" + isShifted + " isCaps=" + isCaps + " isMomentary=" + mShiftKeyState.isMomentary() + " cursorCaps=" + getCursorCapsMode(ic, attr));
        int newState = Keyboard.SHIFT_OFF;
        if (isShifted) {
            newState = (mSavedShiftState == Keyboard.SHIFT_LOCKED) ? Keyboard.SHIFT_CAPS : Keyboard.SHIFT_ON;
        } else if (isCaps) {
            newState = isCapsLock ? getCapsOrShiftLockState() : Keyboard.SHIFT_CAPS;
        }/*w  w w  .ja  v  a2  s  .  c om*/
        //Log.i(TAG, "updateShiftKeyState " + oldState + " -> " + newState);
        mKeyboardSwitcher.setShiftState(newState);
    }
    if (ic != null) {
        // Clear modifiers other than shift, to avoid them getting stuck
        int states = KeyEvent.META_FUNCTION_ON | KeyEvent.META_ALT_MASK | KeyEvent.META_CTRL_MASK
                | KeyEvent.META_META_MASK | KeyEvent.META_SYM_ON;
        ic.clearMetaKeyStates(states);
    }
}

From source file:org.distantshoresmedia.keyboard.LatinIME.java

public void sendModifiableKeyChar(char ch) {
    // Support modified key events
    boolean modShift = isShiftMod();
    if ((modShift || mModCtrl || mModAlt || mModMeta) && ch > 0 && ch < 127) {
        InputConnection ic = getCurrentInputConnection();
        if (isConnectbot()) {
            if (mModAlt) {
                // send ESC prefix
                ic.commitText(Character.toString((char) 27), 1);
            }// w w w .  jav  a2 s  .c  o  m
            if (mModCtrl) {
                int code = ch & 31;
                if (code == 9) {
                    sendTab();
                } else {
                    ic.commitText(Character.toString((char) code), 1);
                }
            } else {
                ic.commitText(Character.toString(ch), 1);
            }
            handleModifierKeysUp(false, false);
            return;
        }

        // Non-ConnectBot

        // Restrict Shift modifier to ENTER and SPACE, supporting Shift-Enter etc.
        // Note that most special keys such as DEL or cursor keys aren't handled
        // by this charcode-based method.

        int combinedCode = asciiToKeyCode[ch];
        if (combinedCode > 0) {
            int code = combinedCode & KF_MASK;
            boolean shiftable = (combinedCode & KF_SHIFTABLE) > 0;
            boolean upper = (combinedCode & KF_UPPER) > 0;
            boolean letter = (combinedCode & KF_LETTER) > 0;
            boolean shifted = modShift && (upper || shiftable);
            if (letter && !mModCtrl && !mModAlt && !mModMeta) {
                // Try workaround for issue 179 where letters don't get upcased
                ic.commitText(Character.toString(ch), 1);
                handleModifierKeysUp(false, false);
            } else {
                sendModifiedKeyDownUp(code, shifted);
            }
            return;
        }
    }

    if (ch >= '0' && ch <= '9') {
        //WIP
        InputConnection ic = getCurrentInputConnection();
        ic.clearMetaKeyStates(KeyEvent.META_SHIFT_ON | KeyEvent.META_ALT_ON | KeyEvent.META_SYM_ON);
        //EditorInfo ei = getCurrentInputEditorInfo();
        //Log.i(TAG, "capsmode=" + ic.getCursorCapsMode(ei.inputType));
        //sendModifiedKeyDownUp(KeyEvent.KEYCODE_0 + ch - '0');
        //return;
    }

    // Default handling for anything else, including unmodified ENTER and SPACE.
    sendKeyChar(ch);
}

From source file:com.yek.keyboard.anysoftkeyboard.AnySoftKeyboard.java

@Override
public boolean onKeyDown(final int keyEventKeyCode, @NonNull KeyEvent event) {
    InputConnection ic = getCurrentInputConnection();
    if (handleSelectionExpending(keyEventKeyCode, ic, mGlobalSelectionStartPosition, mGlobalCursorPosition))
        return true;
    final boolean shouldTranslateSpecialKeys = isInputViewShown();

    //greater than zero means it is a physical keyboard.
    //we also want to hide the view if it's a glyph (for example, not physical volume-up key)
    if (event.getDeviceId() > 0 && event.isPrintingKey())
        onPhysicalKeyboardKeyPressed();/* w w w .  j  a  va2s.  co  m*/

    mHardKeyboardAction.initializeAction(event, mMetaState);

    switch (keyEventKeyCode) {
    /****
     * SPECIAL translated HW keys If you add new keys here, do not forget
     * to add to the
     */
    case KeyEvent.KEYCODE_CAMERA:
        if (shouldTranslateSpecialKeys && mAskPrefs.useCameraKeyForBackspaceBackword()) {
            handleBackWord(getCurrentInputConnection());
            return true;
        }
        // DO NOT DELAY CAMERA KEY with unneeded checks in default mark
        return super.onKeyDown(keyEventKeyCode, event);
    case KeyEvent.KEYCODE_FOCUS:
        if (shouldTranslateSpecialKeys && mAskPrefs.useCameraKeyForBackspaceBackword()) {
            handleDeleteLastCharacter(false);
            return true;
        }
        // DO NOT DELAY FOCUS KEY with unneeded checks in default mark
        return super.onKeyDown(keyEventKeyCode, event);
    case KeyEvent.KEYCODE_VOLUME_UP:
        if (shouldTranslateSpecialKeys && mAskPrefs.useVolumeKeyForLeftRight()) {
            sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_LEFT);
            return true;
        }
        // DO NOT DELAY VOLUME UP KEY with unneeded checks in default
        // mark
        return super.onKeyDown(keyEventKeyCode, event);
    case KeyEvent.KEYCODE_VOLUME_DOWN:
        if (shouldTranslateSpecialKeys && mAskPrefs.useVolumeKeyForLeftRight()) {
            sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_RIGHT);
            return true;
        }
        // DO NOT DELAY VOLUME DOWN KEY with unneeded checks in default
        // mark
        return super.onKeyDown(keyEventKeyCode, event);
    /****
     * END of SPECIAL translated HW keys code section
     */
    case KeyEvent.KEYCODE_BACK:
        if (event.getRepeatCount() == 0 && getInputView() != null) {
            if (getInputView().handleBack()) {
                // consuming the meta keys
                if (ic != null) {
                    // translated, so we also take care of the metakeys
                    ic.clearMetaKeyStates(Integer.MAX_VALUE);
                }
                mMetaState = 0;
                return true;
            }
        }
        break;
    case 0x000000cc:// API 14: KeyEvent.KEYCODE_LANGUAGE_SWITCH
        switchToNextPhysicalKeyboard(ic);
        return true;
    case KeyEvent.KEYCODE_SHIFT_LEFT:
    case KeyEvent.KEYCODE_SHIFT_RIGHT:
        if (event.isAltPressed() && Workarounds.isAltSpaceLangSwitchNotPossible()) {
            switchToNextPhysicalKeyboard(ic);
            return true;
        }
        // NOTE: letting it fall-through to the other meta-keys
    case KeyEvent.KEYCODE_ALT_LEFT:
    case KeyEvent.KEYCODE_ALT_RIGHT:
    case KeyEvent.KEYCODE_SYM:
        Logger.d(TAG + "-meta-key", getMetaKeysStates("onKeyDown before handle"));
        mMetaState = MyMetaKeyKeyListener.handleKeyDown(mMetaState, keyEventKeyCode, event);
        Logger.d(TAG + "-meta-key", getMetaKeysStates("onKeyDown after handle"));
        break;
    case KeyEvent.KEYCODE_SPACE:
        if ((event.isAltPressed() && !Workarounds.isAltSpaceLangSwitchNotPossible())
                || event.isShiftPressed()) {
            switchToNextPhysicalKeyboard(ic);
            return true;
        }
        // NOTE:
        // letting it fall through to the "default"
    default:

        // Fix issue 185, check if we should process key repeat
        if (!mAskPrefs.getUseRepeatingKeys() && event.getRepeatCount() > 0)
            return true;

        AnyKeyboard.HardKeyboardTranslator keyTranslator = (AnyKeyboard.HardKeyboardTranslator) getCurrentAlphabetKeyboard();
        if (getKeyboardSwitcher().isCurrentKeyboardPhysical() && keyTranslator != null) {
            // sometimes, the physical keyboard will delete input, and then add some.
            // we'll try to make it nice.
            if (ic != null)
                ic.beginBatchEdit();
            try {
                // issue 393, backword on the hw keyboard!
                if (mAskPrefs.useBackword() && keyEventKeyCode == KeyEvent.KEYCODE_DEL
                        && event.isShiftPressed()) {
                    handleBackWord(ic);
                    return true;
                } else {
                    // http://article.gmane.org/gmane.comp.handhelds.openmoko.android-freerunner/629
                    keyTranslator.translatePhysicalCharacter(mHardKeyboardAction, this);

                    if (mHardKeyboardAction.getKeyCodeWasChanged()) {
                        final int translatedChar = mHardKeyboardAction.getKeyCode();
                        // typing my own.
                        onKey(translatedChar, null, -1, new int[] { translatedChar }, true/*faking from UI*/);
                        // my handling we are at a regular key press, so we'll update
                        // our meta-state member
                        mMetaState = MyMetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
                        Logger.d(TAG + "-meta-key", getMetaKeysStates("onKeyDown after adjust - translated"));
                        return true;
                    }
                }
            } finally {
                if (ic != null)
                    ic.endBatchEdit();
            }
        }
        if (event.isPrintingKey()) {
            // we are at a regular key press, so we'll update our
            // meta-state
            // member
            mMetaState = MyMetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
            Logger.d(TAG + "-meta-key", getMetaKeysStates("onKeyDown after adjust"));
        }
    }
    return super.onKeyDown(keyEventKeyCode, event);
}

From source file:com.anysoftkeyboard.AnySoftKeyboard.java

@Override
public boolean onKeyDown(final int keyEventKeyCode, @NonNull KeyEvent event) {
    InputConnection ic = getCurrentInputConnection();
    if (handleSelectionExpending(keyEventKeyCode, ic, mGlobalSelectionStartPosition, mGlobalCursorPosition))
        return true;
    final boolean shouldTranslateSpecialKeys = isInputViewShown();

    //greater than zero means it is a physical keyboard.
    //we also want to hide the view if it's a glyph (for example, not physical volume-up key)
    if (event.getDeviceId() > 0 && event.isPrintingKey())
        onPhysicalKeyboardKeyPressed();/*from  w w w .j  a  v  a 2  s  . com*/

    mHardKeyboardAction.initializeAction(event, mMetaState);

    switch (keyEventKeyCode) {
    /****
     * SPECIAL translated HW keys If you add new keys here, do not forget
     * to add to the
     */
    case KeyEvent.KEYCODE_CAMERA:
        if (shouldTranslateSpecialKeys && mAskPrefs.useCameraKeyForBackspaceBackword()) {
            handleBackWord(getCurrentInputConnection());
            return true;
        }
        // DO NOT DELAY CAMERA KEY with unneeded checks in default mark
        return super.onKeyDown(keyEventKeyCode, event);
    case KeyEvent.KEYCODE_FOCUS:
        if (shouldTranslateSpecialKeys && mAskPrefs.useCameraKeyForBackspaceBackword()) {
            handleDeleteLastCharacter(false);
            return true;
        }
        // DO NOT DELAY FOCUS KEY with unneeded checks in default mark
        return super.onKeyDown(keyEventKeyCode, event);
    case KeyEvent.KEYCODE_VOLUME_UP:
        if (shouldTranslateSpecialKeys && mAskPrefs.useVolumeKeyForLeftRight()) {
            sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_LEFT);
            return true;
        }
        // DO NOT DELAY VOLUME UP KEY with unneeded checks in default
        // mark
        return super.onKeyDown(keyEventKeyCode, event);
    case KeyEvent.KEYCODE_VOLUME_DOWN:
        if (shouldTranslateSpecialKeys && mAskPrefs.useVolumeKeyForLeftRight()) {
            sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_RIGHT);
            return true;
        }
        // DO NOT DELAY VOLUME DOWN KEY with unneeded checks in default
        // mark
        return super.onKeyDown(keyEventKeyCode, event);
    /****
     * END of SPECIAL translated HW keys code section
     */
    case KeyEvent.KEYCODE_BACK:
        if (event.getRepeatCount() == 0 && getInputView() != null) {
            if (getInputView().handleBack()) {
                // consuming the meta keys
                if (ic != null) {
                    // translated, so we also take care of the metakeys
                    ic.clearMetaKeyStates(Integer.MAX_VALUE);
                }
                mMetaState = 0;
                return true;
            }
        }
        break;
    case 0x000000cc:// API 14: KeyEvent.KEYCODE_LANGUAGE_SWITCH
        switchToNextPhysicalKeyboard(ic);
        return true;
    case KeyEvent.KEYCODE_SHIFT_LEFT:
    case KeyEvent.KEYCODE_SHIFT_RIGHT:
        if (event.isAltPressed() && Workarounds.isAltSpaceLangSwitchNotPossible()) {
            switchToNextPhysicalKeyboard(ic);
            return true;
        }
        // NOTE: letting it fall-through to the other meta-keys
    case KeyEvent.KEYCODE_ALT_LEFT:
    case KeyEvent.KEYCODE_ALT_RIGHT:
    case KeyEvent.KEYCODE_SYM:
        Logger.d(TAG + "-meta-key", getMetaKeysStates("onKeyDown before handle"));
        mMetaState = MyMetaKeyKeyListener.handleKeyDown(mMetaState, keyEventKeyCode, event);
        Logger.d(TAG + "-meta-key", getMetaKeysStates("onKeyDown after handle"));
        break;
    case KeyEvent.KEYCODE_SPACE:
        if ((event.isAltPressed() && !Workarounds.isAltSpaceLangSwitchNotPossible())
                || event.isShiftPressed()) {
            switchToNextPhysicalKeyboard(ic);
            return true;
        }
        // NOTE:
        // letting it fall through to the "default"
    default:

        // Fix issue 185, check if we should process key repeat
        if (!mAskPrefs.getUseRepeatingKeys() && event.getRepeatCount() > 0)
            return true;

        HardKeyboardTranslator keyTranslator = (HardKeyboardTranslator) getCurrentAlphabetKeyboard();
        if (getKeyboardSwitcher().isCurrentKeyboardPhysical() && keyTranslator != null) {
            // sometimes, the physical keyboard will delete input, and then add some.
            // we'll try to make it nice.
            if (ic != null)
                ic.beginBatchEdit();
            try {
                // issue 393, backword on the hw keyboard!
                if (mAskPrefs.useBackword() && keyEventKeyCode == KeyEvent.KEYCODE_DEL
                        && event.isShiftPressed()) {
                    handleBackWord(ic);
                    return true;
                } else {
                    // http://article.gmane.org/gmane.comp.handhelds.openmoko.android-freerunner/629
                    keyTranslator.translatePhysicalCharacter(mHardKeyboardAction, this);

                    if (mHardKeyboardAction.getKeyCodeWasChanged()) {
                        final int translatedChar = mHardKeyboardAction.getKeyCode();
                        // typing my own.
                        onKey(translatedChar, null, -1, new int[] { translatedChar }, true/*faking from UI*/);
                        // my handling we are at a regular key press, so we'll update
                        // our meta-state member
                        mMetaState = MyMetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
                        Logger.d(TAG + "-meta-key", getMetaKeysStates("onKeyDown after adjust - translated"));
                        return true;
                    }
                }
            } finally {
                if (ic != null)
                    ic.endBatchEdit();
            }
        }
        if (event.isPrintingKey()) {
            // we are at a regular key press, so we'll update our
            // meta-state
            // member
            mMetaState = MyMetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
            Logger.d(TAG + "-meta-key", getMetaKeysStates("onKeyDown after adjust"));
        }
    }
    return super.onKeyDown(keyEventKeyCode, event);
}