Custom Keycodes

 

Here are detailed steps to be able to remap custom keycodes without rooting your phone. You only need to do most of this setup once, but you will need to run the adb shell command every time you reboot your phone.

1. Install Button Mapper from the Play Store and follow the directions to enable the Accessibility service

2. Download adb and Install on your PC

3. Enable USB Debugging Mode on your phone.  Go to System Settings and type “Build number” in the searchbar.  Select “Build number” from the list, then tap it seven times to enable Developer Options.  Go back to Settings, scroll to the bottom of the list and select Developer Options. In Developer Options, enable USB debugging.

4. Connect your phone to your PC with the USB cable.  A dialog will pop up when the phone connects to the PC, be sure to allow USB Debugging

5. On your phone, open Button Mapper, select “Simulate Key Codes.”  A dialog will pop up asking to enable permissions.

6. On your PC, open a command prompt (or PowerShell) and type the following exactly:

adb shell sh /data/data/flar2.homebutton/keycode.sh

7. Back on your phone, close the dialog and click on Simulate Key Codes again.  This time the switch will turn on.

Now you can remap buttons to any keycode you want. This will also expand the actions you have to pick from, such as scroll up/down, Select/Enter action, in-app search and native screenshots.