While building roms for the Samsung Galaxy Note Edge (TBLTETMO, TBLTEXX) I ran into an issue where the recents button was not working. So, I pulled a logcat, and here is what I saw:
KeyEvent { action=ACTION_UP, keyCode=KEYCODE_UNKNOWN, scanCode=254, metaState=0, flags=0x208, repeatCount=0, eventTime=182478, downTime=182375, deviceId=18, source=0x101 }
This lead me on a wild goose chase accross the internet, but praise God, I caught that goose!
Here is the article that helped me the most:
https://chris.boyle.name/blog/2010/08/android-keymaps/
However, it was only close to solving my issue. Sometime between 2010 and now, Android stopped using qwerty.kl as the main file for setting the keymap. So, I also had to edit Generic.kl to make it work.
Here is the whole thing if you are doing this on your phone:
Using ES File Explorer or similar, open /system/usr/keylayout/Generic.kl.
Go down past “key 226 HEADSETHOOK”
and add “key 254 MENU”
Save and close that.
Then, open /system/usr/keylayout/qwerty.kl.
Go down past “key 212 CAMERA”
and add “key 254 MENU”
Save and close that.
Then, open /system/usr/keylayout/sec_touchkey.kl.
Edit “key 254 MENU”
Save and close that.
Now, reboot your phone and the recents button will be a menu button!
If you are editing your source code, you can see the commit I did and do likewise, here:
https://github.com/alaskalinuxuser/aokp_device_samsung_tblte-common/commit/ef9f1d600f372e69c15b05bb40771e9ba4aa7a61
Essentially, I added the Generic.kl file from my phone to my build, and made the build copy it over when making a rom. Pretty simple, once you know what to do!
Linux – keep it simple.