How to handle multi-keycode keys on Android with a bluetooth keyboard? I have a Microsoft Mobile Wedge keyboard. I've connected it to my Nexus 9 and after setting the language in the settings it works almost perfectly. Almost!
There are 4 keys on it that don't work, because they're multi-keycode keys. They're the "magnifier glass"-key, the "3 dots on a ring"-key, the "black rectangle intersecting with rectangle border"-key and the "gears/settings"-key.

So far I've found out with

getevent -lt /dev/input/event4


that the Linux keycodes they send are

KEY_LEFTSHIFT
KEY_LEFTMETA
KEY_F21

KEY_LEFTALT
KEY_LEFTMETA
KEY_F21

KEY_LEFTCTRL
KEY_LEFTMETA
KEY_F21

KEY_LEFTMETA
KEY_F21


I've created the 2 files from their Generic.kl and Generic.kcm counterparts

/system/usr/keylayout/Vendor_045e_Product_0790.kl
/system/usr/keychars/Vendor_045e_Product_0790.kcm


and made sure with

dumpsys input


that they're used.

I tried to enable F21 in the layout first, but that didn't work because there's no Android keycode for F21. So I bound it to INSERT instead, because it's an unused key.
Then I went into the character map and tried making an INSERT key (which is actually F21) and applying the right modifiers to it. 

key INSERT {
    base:           'a'
    lmeta:          'A'
}


The above being for the key that only had 2 keycodes. Unfortunately this didn't work. Nothing happened. So now I'm here to pick your brain.

Does anyone know how to do multi-keycode keys?

Thank you very much in advance.
I am not sure if your way works or not, but try and see if this works. I have linked all the necessary stuff, have a look and try and se if it works.

Android Keyboard Devices (Scroll to the bottom of the page for all the key codes)

Keytest Apk (Use to show keycodes when pressed)

How to map android keys to your USB/Bluetooth Keyboard

Map android keys to any Keyboard

Android key Maps (User Blog)

Keyboard shortcuts and navigation, these may help with your problem or not (also extras for users who are reading this)


ESC = go back
CTRL + ESC = menu
CTRL + ALT + DEL = restart (no questions asked)
ALT + SPACE = search page (say “OK Google” to voice search)
ALT + TAB (ALT + SHIFT + TAB) = switch tasks


Also, if you have designated volume function keys, those will probably work too. There’s also some dedicated app shortcuts like calculator, Gmail, and a few others:

Android Keyboard Shortcuts: Apps


CMD (Windows key) + A = calculator
CMD + C = contacts
CMD + E = e-mail
CMD + G = Gmail
CMD + L = Calendar
CMD + P = Play Music
CMD + Y = YouTube


Others keys that are useful include:

Android Keyboard Shortcuts: Scrolling


Spacebar: Page down in any Web page/document view
Shift + Spacebar: Page up in any Web page/document view


Android Keyboard Shortcuts: Typing


Alt + Spacebar: Insert a special character
Shift + Del: Delete the character to the right of the cursor
Alt + Del: Delete an entire line
Shift + Shift (press it twice): Activate caps-lock; press shift once more to exit
Alt + Trackball (Mouse) -Left: Move cursor to beginning of line
Alt + Trackball-Right: Move cursor to end of line
Alt + Trackball-Up: Move cursor to top of page
Alt + Trackball-Down: Move cursor to bottom of page
Shift + Trackball-Left/Right: Highlight text for cutting or copying
Menu + X: Cut text (will cut all text on-screen unless specific characters are highlighted)
Menu + C: Copy text to clipboard (will copy all text on-screen unless specific characters are highlighted)
Menu + V: Paste text from clipboard
Menu + A: Select all text in the current field


Android Keyboard Shortcuts: Browsing


Menu + I: Zoom in
Menu + O: Zoom out
Menu + J: Go back a page
Menu + K: Go forward a page
Menu + R: Refresh current page
Menu + F: Find on page
Menu + B: Open bookmarks
Menu + S: Open social network sharing menu
Menu + H: View browsing history
Menu + S: Open browser settings


Android Keyboard Shortcuts: Gmail


F: Forward current message (works only while inside the message)
R: Reply to current message (works only while inside the message)
A: Reply-all to current message (works only while inside the message)
Y: Archive message (works from within message or while on main inbox list)
Menu + U: Refresh inbox
Menu + C: Compose new e-mail
Enter: Open an e-mail (from the main inbox list)
Alt + Trackball-Up: Jump to top of inbox
Alt + Trackball-Down: Jump to bottom of inbox