Rooted Android Devices Only
In this instance, I’m using a device that has three capacitive buttons (Menu, Home, and Back). We are going to swap Menu and Back and here are the steps:
Key 139 MENU WAKE_DROPPED
Key 172 HOME
Key 172 MENU WAKE_DROPPED
Key 139 HOME
That’s it. You should see that the buttons are swapped.
The home button will now begin to do all the functionalities of the menu button (including the short and long press actions) and vice versa.
Keep in mind that the changes you made don't affect the soft keys.
For remapping capacitive buttons, you need to edit Generic.kl file. So just follow the steps in above Swap section to open the file.
Within the file, choose the capacitive button that you want to remap.
In this instance, I want to remap menu button. I want the menu button to open Phone app.
So all we need to do here is changing the action of the capacitive button. Keep in mind that we need to know the exact name of the action to make this work.
Find the Menu and here is it look like
Key 139 MENU WAKE_DROPPED
Just change the action of the menu like this (CALL is the action that will open Phone app)
Key 139 CALL WAKE_DROPPED
Save the file; reboot the phone.
From now on, the menu button will open Phone app.
The changes will only affect capacitive buttons; not soft keys.
Keep in mind that the above steps only change the short click action. The long press action of the menu button is intact.
For that’s what you need to take a look at the following section.
Adding or Changing Actions to Capacitive Buttons
Typically the back button long press won’t have any functionalities. If you wish, you can change or add new functionalities to the buttons.
In this instance, let’s see the steps to add long press functionality to the back button and change the long press action of the Menu button (the default long press action of menu button is Search).
Next, we are gonna change the default long press action of the menu button.
That’s it. The new action completely changes the default one and from now on, menu long press will show power menu.
In case, if you want to revert back to default, just choose “Default".
You can play with the options and customize each one as per your wish.
Keep in mind that the changes to the actions you’ve made using GravityBox apply to the soft keys of your device too.
You also need to another important thing: if you are trying this method after remapped capacitive buttons, then this won't work.
For instance: Above we have remapped menu to open Phone app. If you now try to change the long press of the menu using this method, then it won't work.