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

[GUIDE] [FIXES BOTH: ICS & JB] ~~~ Phantom menu keypress EASY FIX!!! ~~~

t.burninator

Well-Known Member
Oct 10, 2011
149
37
high altitude
[BACKGROUND]


Hey guys, if you have been experiencing "phantom keypress" of the menu key, this guide is for you. I bought my SII the first week it came out for Boost and I've been dealing with this defect since the second day I had my phone. It is most definitely a physical problem with the phone, and if you've got it you know it can be extremely frustrating at times. I've never felt like sending back my phone for warranty service so the phantom keypress problem has just never gone away. Until now!


This guide is easier than it is long! It really is easy!






[SUMMARY]


PURPOSE:
You will disable your faulty menu key and turn your search key into your new menu key. You will no longer have a search key, however, you will no longer experience phantom menu keypresses.


STEP 0: SKIP THIS ENTIRE GUIDE and send your phone back to Samsung if it's:
a. Still under warranty
b. Non-rooted with stock ROM
c. And you don't mind sending your phone back to Samsung for repair or possible replacement with a refurb.
d. Especially if it's also producing phantom SEARCH keypresses!


STEP 1: Ensure phone is rooted (NOTE: This will probably void your warranty.)
STEP 2: Backup: /system/usr/keylayout/.
STEP 3a: (ICS BUILDS ONLY!) Modify: /system/usr/keylayout/sec_touchkey.kl
STEP 3b: (ICS BUILDS ONLY!) Modify: /system/usr/keylayout/melfas-touchkey.kl
STEP 3c: (JB BUILDS ONLY!) Modify: /system/usr/keylayout/Generic.kl
STEP 4: Revert file permissions to: rw-r--r-- (644)
STEP 5: Reboot!






[STEP 1]


IF YOU ARE RUNNING THE LATEST ANDROID "ICE CREAM SANDWICH" BUILD:

If you do not already have root, try pushing "SuperSU" to your phone using the "Frodo" exploit in Framaroot. The Framaroot APK is available for download below and will root your ICS phone without having to flash any kind of ROM or kernel.



IF YOU ARE RUNNING AN EARLIER ANDROID "ICE CREAM SANDWICH" BUILD:

Framaroot will probably work to root your phone, however, you can definitely root your phone through the "Exynos" exploit in ExynosAbuse. The ExynosAbuse APK is available for download below and will root your (EARLIER BUILD) ICS phone without having to flash any kind of ROM or kernel.



IF YOU ARE RUNNING AN ANDROID "JELLY BEAN" BUILD:

Framaroot probably won't root your phone, but an updated version might. Until then I don't know of an exploit that will root your phone without having to flash some kind of ROM or kernel. If you're running JB then I hope your phone is already rooted, and when I learn of an exploit that works I'll try to update the guide again and post it.



Download: Framaroot APK @ forum.xda-developers.com

Download: ExynosAbuse APK @ forum.xda-developers.com

(Once you install the APK on your phone, run the program, then root. Wait about 10 seconds, and you will have a superuser dialog pop up and you're done! Excellent!!! I recommend downloading Busybox from the Play market sometime afterwards.)






[STEP 2]


This step is optional/recommended. How to backup your current keylayout folder:


I use ES File Explorer for this (ES File Explorer has a built-in text editor and you're going to need one of those for step 3). Now that you have working root, open up ES File Explorer, go into the Settings, then under "Root settings" at the bottom, make sure the 3 checkboxes at the top are checked (including "Mount File System" or you won't be able to change anything). Then, go to /system/usr/ and longpress the keylayout folder, then "Copy to" and select a location on your sdcard or external. After a second or two the folder should be copied successfully.

Of course, if you use a better backup method, do that. If you accidentally render your softkeys useless, the previous backup method might not actually do you too much good. Stick with the guide and your phone should be just fine.






[STEP 3a - (ICS BUILDS ONLY!)]


Now for the fun part! What you're going to do now is disable the current menu key, and replace the function of the search key with that of the menu key. What that means is when you press search, you'll get menu, and when you press menu, nothing will happen. And when menu key phantom presses itself, nothing will happen (huzzah)! Now if you're very fond of the search key you'll have to make a decision - keep the search key AND the phantom keypress defect; or drop search, make search do menu, and eliminate this freaking headache. I personally never use the search key, so getting rid of its function is not a big deal at all. Here's how to patch the first file:


So once keylayout is backed up on your sdcard, open the keylayout folder in ES File Explorer (with root enabled), and long-press sec_touchkey.kl (this is the file that assigns functions to the capacitive keys), then click "Open as" followed by "Text". I recommend opening the file with "ES Note Editor" (which is included with ES File Explorer). Then you should see the following default assignments:

[HIGH]key 158 BACK WAKE
key 139 MENU WAKE
key 102 HOME WAKE
key 217 SEARCH WAKE_DROPPED
[/HIGH]Now that you have it open, make the following edits to:
/system/usr/keylayout/sec_touchkey.kl

[HIGH]key 158 BACK
#key 139 MENU
key 102 HOME
key 217 MENU
[/HIGH]You MUST use an octothorpe # to comment out the line for key 139 or this fix will NOT work!!!


As you'll see, the menu key was deleted and the search key became the new menu key. Also, the softkeys no longer wake the OS (this is my personal preference). Save the file and you're done with step 3a!





[STEP 3b - (ICS BUILDS ONLY!)]


In FI22 this step appears to be optional - but I do it anyway!! Make the exact same edits to:
/system/usr/keylayout/melfas-touchkey.kl

[HIGH]key 158 BACK
#key 139 MENU
key 102 HOME
key 217 MENU
[/HIGH]You MUST use an octothorpe # to comment out the line for key 139 or this fix will NOT work!!!



Save the file and you're almost done! Skip to STEP 4.






[STEP 3c - (JB BUILDS ONLY!)]


If you're running Android "Jelly Bean" then you might have noticed that you don't have the two files listed above. No matter; you can still apply this fix! Go into /system/usr/keylayout/ and, using the exact same method described in step 3a, you're going to modify:
/system/usr/keylayout/Generic.kl



First, find the line that begins with:

[HIGH]key 139 MENU[/HIGH]and use an octothorpe # to comment it out so it doesn't create this key assignment at boot:

[HIGH]#key 139 MENU[/HIGH]

Second
, find the line that says:

[HIGH]key 217 SEARCH[/HIGH]and edit it to read:

[HIGH]key 217 MENU[/HIGH]


(NOTE: HiredxGunz at AndroidForums was kind enough to provide a pastebin text dump of the completed modified Generic.kl file, that you can download from his tutorial on implementing this fix in JB.)



Third, save the file and you're almost done!






[STEP 4]


FOR EVERY FILE THAT YOU HAVE JUST MODIFIED:


You will need to ensure that the correct permissions have been set. From my experience, in ICS, edited file permissions had been reset to rw-rw-rw- (666), so if this is the case then STEP 4 isn't strictly necessary. HOWEVER, on the JB build I am running, after editing the file its permissions had been reset to rw------- (600). I did not realize this had happened when I did it, and then after I rebooted none of the softkeys worked - I was able to fix the permissions without resetting the phone but it was a big annoyance. A special thanks to HiredxGunz for pointing out the permissions issue.


Here's how to reset the permissions back to rw-r--r-- (644):


a. Long press on the file in ES File Explorer until the context menu for the file appears.
b. Scroll all the way down to the bottom and select "Properties".
c. Next to "Permissions:" will be a button labelled "Change". Click it.
d. To set the file back to default rw-r--r--, make sure all three "read" boxes are ticked, as well as the "write" box for "user".
e. Select "OK" and verify that the file's permissions are rw-r--r-- (644).
f. Repeat substeps a-e on the next file, if applicable.






[STEP 5]

Reboot your phone and kiss your phantom menu keypress defect goodbye!!!


You may still experience a very, very minor issue where the phone hardware continues to register the phantom menu keypresses - even though this key is no longer associated with any action. You will know that this is happening because the other softkeys (home, back, and menu/search) will lock up and stop functioning temporarily, and if you use the touch key lights function they will stay on for as long as the phantom keypress is active. This is a much, much better problem to have than the original phantom keypress issue! If your softkeys do lock up you can either wait it out, or turn the screen off and immediately on again (this always works), or sometimes you can kick the other softkeys back on by simply pressing the original menu key (the one which you disabled using this tutorial).



Please let me know if any part of this guide helps you out, thank you and enjoy!
 
I am running GB08, and I do not see sec_touchkey. kl.Am I doing something wrong?


Edit: I ended up editing generic.kl based upon a post in another forum since I can't find sec_touchkey. kl. I was successful at editing it, but all of my buttons became disabled. I restored the file, but the buttons still don't work. HELP! I don't know how to make the buttons work again.
 
Upvote 0
If you are running Jelly Bean, please post the names and contents of any keylayout files that only contain assignments for the four softkey functions (i.e. home, menu, back, and search). One or more of those keylayout files controls the softkey functions. I don't see any reason this fix can't be applied to any rom as long as the active assignments are correctly modified. I have opted to keep my phone stock or I'd be able to figure it out for you.
 
  • Like
Reactions: Titchener17
Upvote 0
The nice thing about ES File Explorer in root explorer mode is that its note editor lets you alter system files without first modifying permissions. I've used linux for a lot of years and let me say, not having to change permissions before and after saving modifications to system files is a really nice touch (I didn't even notice I didn't have to do anything with permissions until you just now said something!). I've definitely been through permission headaches in linux on the computer.

For the record, the original tutorial in this thread did not include what is now step 3b. I'm not sure why melfas-touchkey.kl exists if this fix works when only editing sec_touchkey.kl, but since the files are identical I edit both for good measure. It doesn't take long. Somebody will figure out how to make this fix work on Jelly Bean but it doesn't appear as that I'm that guy, sorry. My phone is staying stock for at least the time being.
 
Upvote 0
The nice thing about ES File Explorer in root explorer mode is that its note editor lets you alter system files without first modifying permissions. I've used linux for a lot of years and let me say, not having to change permissions before and after saving modifications to system files is a really nice touch (I didn't even notice I didn't have to do anything with permissions until you just now said something!). I've definitely been through permission headaches in linux on the computer.

For the record, the original tutorial in this thread did not include what is now step 3b. I'm not sure why melfas-touchkey.kl exists if this fix works when only editing sec_touchkey.kl, but since the files are identical I edit both for good measure. It doesn't take long. Somebody will figure out how to make this fix work on Jelly Bean but it doesn't appear as that I'm that guy, sorry. My phone is staying stock for at least the time being.

The problem is es file explorer changes the file permissions when you edit something. So, you should check the permissions settings and make sure to change them back to the way they were once you are done editing.
 
Upvote 0
I'm hoping to upgrade to JB soon, so when I do I'll see if I can figure it out and update the guide. I think I was told that generic.kl has the active assignments in GB27 but I can't confirm anything yet.


I got it working! generic.kl is the file you need to edit.
I change the permissions so that it would allow me to Write
Made the 2 edits found in the OP
Saved and changed the permissions back
Rebooted

Thanks OP!
 
Upvote 0

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