FORUMS
Remove All Ads from XDA

[Guide] Long press menu button to kill app

981 posts
Thanks Meter: 3,381
 
By majdinj, Senior Member on 31st May 2013, 01:12 AM
Post Reply Email Thread
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 20 Users Say Thank You to majdinj For This Useful Post: [ View ] Gift majdinj Ad-Free
 
 
31st May 2013, 10:32 AM |#2  
ocujos's Avatar
Senior Member
Flag Sydney
Thanks Meter: 711
 
More
Is it possible to control delay before an app gets killed?

Sent from my GT-N7000 using Tapatalk HD
31st May 2013, 12:07 PM |#3  
majdinj's Avatar
OP Senior Member
Flag AlAhsa
Thanks Meter: 3,381
 
More
Quote:
Originally Posted by ocujos

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..
1st June 2013, 01:02 PM |#4  
majdinj's Avatar
OP Senior Member
Flag AlAhsa
Thanks Meter: 3,381
 
More
Quote:
Originally Posted by ocujos

Is it possible to control delay before an app gets killed?

Sent from my GT-N7000 using Tapatalk HD

Quote:
Originally Posted by majdinj

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: [ View ] Gift majdinj Ad-Free
7th June 2013, 09:12 PM |#5  
Senior Member
Thanks Meter: 14
 
More
Quote:
Originally Posted by majdinj

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!
9th June 2013, 05:42 PM |#6  
Senior Member
Thanks Meter: 14
 
More
Quote:
Originally Posted by mikempower

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
11th June 2013, 06:56 PM |#7  
majdinj's Avatar
OP Senior Member
Flag AlAhsa
Thanks Meter: 3,381
 
More
Quote:
Originally Posted by mikempower

nobody?

Inviato dal mio GT-N7100 con Tapatalk 2

I think it is the same buddy
11th June 2013, 09:30 PM |#8  
Senior Member
Thanks Meter: 14
 
More
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
12th June 2013, 06:59 PM |#9  
Senior Member
Flag Boituva - SP
Thanks Meter: 590
 
Donate to Me
More
Quote:
Originally Posted by mikempower

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)
12th June 2013, 09:58 PM |#10  
Senior Member
Thanks Meter: 14
 
More
Quote:
Originally Posted by projeto56

Google

(But only if it exists)

very funny!
but if i could find it on google,i would have not asked for it.
13th June 2013, 03:35 PM |#11  
Senior Member
Flag Boituva - SP
Thanks Meter: 590
 
Donate to Me
More
Quote:
Originally Posted by mikempower

very funny!
but if i could find it on google,i would have not asked for it.

Then it's safe to presume it doesn't exist

You could follow the steps on the OP, then make a flashable zip with the modded files, open a new thread and get a million thanks
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes