Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,813,666 Members 39,873 Now Online
XDA Developers Android and Mobile Development Forum

[Guide] Long press menu button to kill app

Tip us?
 
majdinj
Old
(Last edited by majdinj; 11th September 2013 at 12:47 PM.)
#1  
majdinj's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 2,970
Posts: 980
Join Date: Nov 2006
Location: AlAhsa
Lightbulb [Guide] Long press menu button to kill app

This mod will make you able to instantly kill app activity by long press on menu button

Quote:
The original mod is done by maskerwsk, who modifies Mirko_ddd method
Needed tools:
1) Backsmali/Smali program from here
2) Notepad++ program from here
3) WinRAR or 7-zip archiver

The procedure:
- Backsmali android.policy.jar
- Navigate to classout/com/android/internal/policy/impl/ folder and open PhoneWindowManager.smali file
- Locate the following code by tracking "mMenuLongPress" and do the following changes:
before:
Code:
    .line 1674
    new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$9;

    invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$9;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

    iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mMenuLongPress:Ljava/lang/Runnable;
after:
Code:
    .line 1674
    new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;

    invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$KillConcept;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

    iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mMenuLongPress:Ljava/lang/Runnable;
Quote:
N.B: $9 might be differ according to ROM, but track "mMenuLongPress" to locate the wanted code portion
- Save changes.
- Now add this new file (PhoneWindowManager$KillConcept.smali) to classout/com/android/internal/policy/impl/ folder. You can download it from here.
Quote:
You should make sure that the id in PhoneWindowManager$KillConcept.smali is linked to "permlab_forceBack" id in framework-res.apk public.xml. See post #15 to know exactly how it is done.
- Now recompile (smali) the classout folder and open android.policy.jar by WinRAR or 7-zip and substitute classes.dex inside android.policy.jar with the new classes.dex file.. now push the modified android.policy.jar to your device and fix permissions to chmod 644.

Extra step:
To adjust timeout delay, backsmali framework.jar and navigate to classout/android/view/ folder and open ViewConfiguration.smali and search for this method and change RED text value:
Code:
.method public static getGlobalActionKeyTimeout()J
    .registers 2

    .prologue
    .line 669
    const-wide/16 v0, 0x1f4

    return-wide v0
.end method
As you can see, this hex value means 500; i.e, 0.5 second.. So we will change it to which delay we want:
0x1f4 = 0.5 second (default value)
0x2ee = 0.75 second
0x3e8 = 1 second
0x4e2 = 1.25 second
0x5dc = 1.5 second
0x6d6 = 1.75 second
0x7d0 = 2 second
Quote:
N.B: applying this change, will affect the timeout delay across OS!!
Now you can open any app and then long press the menu button to exit instantly..
The Following 17 Users Say Thank You to majdinj For This Useful Post: [ Click to Expand ]
 
ocujos
Old
#2  
ocujos's Avatar
Senior Member
Thanks Meter 104
Posts: 416
Join Date: Feb 2010
Location: Sydney
Is it possible to control delay before an app gets killed?

Sent from my GT-N7000 using Tapatalk HD
Note 3 ★C-RoM Kang★ [v1.8] | Galaxy Note - Omni ROM 4.4.4 | Nexus 4 - Stock Google AOSP | Galaxy Nexus - BeanStalk 4.3.1 | Nexus One - QND MIUI 2.3.30
 
majdinj
Old
#3  
majdinj's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 2,970
Posts: 980
Join Date: Nov 2006
Location: AlAhsa
Quote:
Originally Posted by ocujos View Post
Is it possible to control delay before an app gets killed?

Sent from my GT-N7000 using Tapatalk HD
No in the meantime,,, but may be in future, since it involves complicated coding and decompiling other system app..
 
majdinj
Old
(Last edited by majdinj; 1st June 2013 at 06:34 PM.)
#4  
majdinj's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 2,970
Posts: 980
Join Date: Nov 2006
Location: AlAhsa
Quote:
Originally Posted by ocujos View Post
Is it possible to control delay before an app gets killed?

Sent from my GT-N7000 using Tapatalk HD
Quote:
Originally Posted by majdinj View Post
No in the meantime,,, but may be in future, since it involves complicated coding and decompiling other system app..
I have found a short way to do that,,, I will update OP soon after I come back home

Edit:
Added extra step
The Following 3 Users Say Thank You to majdinj For This Useful Post: [ Click to Expand ]
 
mikempower
Old
#5  
Senior Member
Thanks Meter 14
Posts: 341
Join Date: Sep 2007
Quote:
Originally Posted by majdinj View Post
I have found a short way to do that,,, I will update OP soon after I come back home

Edit:
Added extra step
hi guys this mod is fantastic...

is there something same for the Galaxy note II?

thank's to all for the ansewers!
 
mikempower
Old
#6  
Senior Member
Thanks Meter 14
Posts: 341
Join Date: Sep 2007
Quote:
Originally Posted by mikempower View Post
hi guys this mod is fantastic...

is there something same for the Galaxy note II?

thank's to all for the ansewers!
nobody?

Inviato dal mio GT-N7100 con Tapatalk 2
 
majdinj
Old
#7  
majdinj's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 2,970
Posts: 980
Join Date: Nov 2006
Location: AlAhsa
Quote:
Originally Posted by mikempower View Post
nobody?

Inviato dal mio GT-N7100 con Tapatalk 2
I think it is the same buddy
 
mikempower
Old
#8  
Senior Member
Thanks Meter 14
Posts: 341
Join Date: Sep 2007
for galaxy note i flashed a zip wich made all in one step.
where a can i find it for note II? (if it exists?)

Inviato dal mio GT-N7100 con Tapatalk 2
 
projeto56
Old
#9  
Senior Member
Thanks Meter 579
Posts: 1,550
Join Date: Apr 2011
Location: Boituva - SP

 
DONATE TO ME
Quote:
Originally Posted by mikempower View Post
for galaxy note i flashed a zip wich made all in one step.
where a can i find it for note II? (if it exists?)

Inviato dal mio GT-N7100 con Tapatalk 2
Google

(But only if it exists)
XDA Developers

What is XDA about? | How to ask for help?

I don't has bad english. You are drunk!

Use dropbox and make us both happy
 
mikempower
Old
#10  
Senior Member
Thanks Meter 14
Posts: 341
Join Date: Sep 2007
Quote:
Originally Posted by projeto56 View Post
Google

(But only if it exists)
very funny!
but if i could find it on google,i would have not asked for it.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes