1. Are you ready for the Galaxy S20? Here is everything we know so far!

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

Discussion in 'Android Devices' started by t.burninator, Jan 1, 2013.

  1. t.burninator

    t.burninator Well-Known Member
    Thread Starter


    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!


    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 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.


    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.


    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
    [/HIGH]Now that you have it open, make the following edits to:

    [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:

    [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:

    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]

    , 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]


    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!

  2. I'm giving this a try. I'll know more as time goes on but this worked to disable menu key, now search is menu. Great idea better than getting a replacement and loosing critical data. Thank You
    Titchener17 and t.burninator like this.
  3. Need to make a sticky out of this thread.
    t.burninator likes this.
  4. Codegerm

    Codegerm Android Expert

    Good workaround. I'm glad I don't have this problem. I would send mine back if I did. All my data is backed up.
    Titchener17 and t.burninator like this.
  5. SelfElevated2

    SelfElevated2 Android Expert

    Posted in the one stop shop under known issues and fixes
    Titchener17 and t.burninator like this.
  6. I'm backed up too, but they only send a refurbished phone back not your original phone. If a brand new one sure, but refurb no way, I'm just odd that way.
    t.burninator likes this.
  7. Codegerm

    Codegerm Android Expert

    A refurbished one wouldn't bother me if I was past the warranty period. Now if my phone is in the warranty period, it will be new or I will give them hell.
    t.burninator likes this.
  8. chavezcjc1

    chavezcjc1 Lurker

    I have a boost gs2 touch baked bean rom, It says virtual not wake and if I try to change the way its posted my home button will not work even if i paste my backup from esfile.
  9. Mechman02

    Mechman02 Newbie

    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.
  10. SelfElevated2

    SelfElevated2 Android Expert

    Flash a rom. Or reflash what your on and you wont even have to wipe data
  11. Mechman02

    Mechman02 Newbie

    Thanks for the help. I reflashed the Rom, and my buttons work again. Unfortunately, I have the phantom menu problem still. Does anyone know the correct file to edit to disable the menu button and reassign it to the search button? Sec_touching. kl doesn't exist.
  12. SelfElevated2

    SelfElevated2 Android Expert

    I am on gb08 as well. I couldn't get it working either. So I found a a file that looked like it needed to be changed but it didn't work. Ill just deal with it
  13. t.burninator

    t.burninator Well-Known Member
    Thread Starter

    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.
    Titchener17 likes this.
  14. Codegerm

    Codegerm Android Expert

    Did you check the file permissions after you edited it? They have to match what the file had before for a change to work.
  15. t.burninator

    t.burninator Well-Known Member
    Thread Starter

    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.
  16. Codegerm

    Codegerm Android Expert

    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.
  17. t.burninator

    t.burninator Well-Known Member
    Thread Starter

    Oh no kidding, the modified files changed from 644 to 666. I didn't even notice. Why would this only be an concern on a custom rom? The stock builds don't seem to care if the write flags are set or not.
  18. Codegerm

    Codegerm Android Expert

    After editing, es file explorer has a bad habit of removing read privileges from group and other, and that does cause problems.
  19. t.burninator

    t.burninator Well-Known Member
    Thread Starter

    Interesting, they must have fixed that. Mine are all rw-rw-rw- after editing.
  20. s1234w

    s1234w Lurker

    I have a Sprint S2 D710 with the Phantom Menu Key problem. I am running JB and have looked through the files and have not found one with just the 4 hardware keys listed. Has anyone had success with JB?
  21. Codegerm

    Codegerm Android Expert

    how long have you had the phone? If you haven't had it long I would have it replaced.
  22. s1234w

    s1234w Lurker

    I bought it off CL about two months ago so my guess is sprint won't help me.
  23. t.burninator

    t.burninator Well-Known Member
    Thread Starter

    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.
  24. Codegerm

    Codegerm Android Expert

    wow, I could never bring myself to buy something like a Galaxy S2 off of CL. That requires way more trust than I have...
  25. s1234w

    s1234w Lurker

    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

    Thanks OP!

Samsung Galaxy S2 Forum

The Samsung Galaxy S2 release date was April 2011. Features and Specs include a 4.3" inch screen, 8MP camera, 1GB RAM, Exynos 4210 Dual processor, and 1650mAh battery.

April 2011
Release Date

Share This Page