• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root (How to) Remap/refunction/retask hardware keys (such as search)

j61101

Well-Known Member
Dec 7, 2011
111
13
I found this very useful, as I never use the search key anyway.

*DISCLAIMER*:
I AM NOT RESPONSIBLE IF YOU F*** UP YOUR KEY MAPPING OR PHONE.
ALWAYS MAKE A BACK UP BEFORE MODIFYING ANYTHING.

I am not the discoverer of this, I just modified it for my liking on my phone. I am using Megatron rom. I don't know if this will work on stock root. Credit goes to whoever found it first, possibly this post ? also I found this first.

Now that that is out of the way, lets get to the cool stuff. :)

So, with your rooted file explorer:
1. Navigate to /system/usr/keylayout
2. Copy the contents of /system/usr/keylayout to your SD card or any location that you feel is safe.
3. Open the contents of these files in a text editor: Broadcom_Blutooth_HID.kl
msm_tma300_ts.kl
qwerty.kl
vital2-kepad.kl

4. Find the key that you would like to modify, I modified the search key.
The search key is key 217 and key 127
5. Find and replace the SEARCH (if modifying the search key) to the command that you would like in all corresponding files. I have mine to the end call. The commands are:

HOME #Launches "Home"
MENU #Launches "Menu"
BACK #Takes you back to last activity
SEARCH #Launches search
CALL #Launches "phone" activity and corresponding .apk or initiates a call
ENDCALL #Ends a call, turns off screen (not at the same time)
CAMERA #Intiates "Camera" activity and corresponding .apk
FOCUS #Initiates auto-focus while using camera
VOLUME_UP
VOLUME_DOWN
VOICE_DIAL
--------------------------------------------------------------
MEDIA_PLAY_PAUSE
MEDIA_STOP
MEDIA_NEXT
MEDIA_PREVIOUS
MEDIA_REWIND
MEDIA_FAST_FORWARD

I saw one in there for EXPLORER, not sure what that does..

6. Save each file after modifying and reboot.

There you have it, you newly modified hard key. Enjoy! :)
If you'd like I can post my modified files for an easy copy, paste.

If I helped you or if you liked my post, hit the thanks button :) Thanks
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones