[MOD][HOW-TO] Back to kill for TW ROMs **updated 25 NOV 2012** LSJ #2post

Search This thread

Mirko ddd

Inactive Recognized Developer
Nov 7, 2010
1,734
5,000
Piazza Armerina
Hello xda'ers,
is me again, sorry to bother but today I bring to you a famous mod from AOKP: back longpress to kill.

HOW TO:

1. we need to decompile android.policy.jar;

2. then let s edit android.policy.jar/smali/com/android/internal/policy/impl/PhoneWindowManager.smali

3. adding fields on "# instance fields" (red is what you add):

Code:
# instance fields
.field mAccelerometerDefault:I

.field mAllowAllRotations:I

.field mAllowHdmiRotation:Z

.field mAllowLockscreenWhenOn:Z

.field final mAllowSystemUiDelay:Ljava/lang/Runnable;

[COLOR="Red"].field mBackKillTimeout:Z[/COLOR]

[COLOR="Red"].field mBackLongPress:Ljava/lang/Runnable;[/COLOR]

.field mBootMsgDialog:Landroid/app/ProgressDialog;

...

.field mLockScreenTimeout:I

.field mLockScreenTimerActive:Z

[COLOR="Red"].field mLongPressBackKill:Z[/COLOR]

.field private mLongPressOnHomeBehavior:I

...

4. add a new instance in the last lines of .method public constructor <init>()V to recall our new subclass (red is what to add):

Code:
...
[COLOR="Red"]    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;->mBackLongPress:Ljava/lang/Runnable;[/COLOR]

    new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$25;

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

    iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenLockTimeout:Ljava/lang/Runnable;

    .line 5754
    return-void
.end method

5. now we need to take a look in .method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J

Code:
    :cond_13c

    const/16 v39, 0x3

    move/from16 v0, v21

    move/from16 v1, v39

    if-ne v0, v1, :cond_15a

    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeKeyConsumedByScreenshotChord:Z

after :cond_13c we need to add some code (note: :cond_13c may be different depending on your compiler) and we will get:

Code:
    :cond_13c
[COLOR="Red"]    const/16 v28, 0x4

    move/from16 v0, v28

    move/from16 v1, v21

    if-ne v1, v0, :cond_mi

    if-nez v8, :cond_mi

    .line 1741
    and-int/lit8 v28, v11, 0x20

    if-nez v28, :cond_mi

    .line 1742
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

    move-object/from16 v28, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;

    move-object/from16 v1, v28

    invoke-virtual {v1, v0}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 1743
    add-int/lit8 v28, v11, 0x20

    move-object/from16 v0, p2

    move/from16 v1, v28

    invoke-static {v0, v1}, Landroid/view/KeyEvent;->changeFlags(Landroid/view/KeyEvent;I)Landroid/view/KeyEvent;

    .line 1744
    const/16 v28, 0x0

    move/from16 v0, v28

    move-object/from16 v1, p0

    iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackKillTimeout:Z

    .line 1752
    :cond_mi[/COLOR]
    const/16 v39, 0x3

    move/from16 v0, v21

    move/from16 v1, v39

    if-ne v0, v1, :cond_15a

    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeKeyConsumedByScreenshotChord:Z

6. into the same method look for: .line 2495:

Code:
    .end local v9           #e:Landroid/os/RemoteException;
    :cond_45c

    const/16 v39, 0xd4

    move/from16 v0, v21

    move/from16 v1, v39

    if-eq v0, v1, :cond_46c

    const/16 v39, 0xd5

    move/from16 v0, v21

    move/from16 v1, v39

    if-ne v0, v1, :cond_489

we ll add a code here too, getting:

Code:
    .end local v9           #e:Landroid/os/RemoteException;
    :cond_45c
[COLOR="Red"]    const/16 v28, 0x4

    move/from16 v0, v28

    move/from16 v1, v21

    if-ne v1, v0, :cond_mirko

    .line 1863
    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackKillTimeout:Z

    move/from16 v28, v0

    if-nez v28, :cond_mirko

    if-eqz v8, :cond_mirko

    if-nez v29, :cond_mirko

    .line 1864
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

    move-object/from16 v38, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;

    move-object/from16 v39, v0

    invoke-static {}, Landroid/view/ViewConfiguration;->getGlobalActionKeyTimeout()J

    move-result-wide v40

    invoke-virtual/range {v38 .. v41}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 1865
    const/16 v28, 0x1

    move/from16 v0, v28

    move-object/from16 v1, p0

    iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackKillTimeout:Z

    .line 1875
    :cond_mirko[/COLOR]
    const/16 v39, 0xd4

    move/from16 v0, v21

    move/from16 v1, v39

    if-eq v0, v1, :cond_46c

    const/16 v39, 0xd5

    move/from16 v0, v21

    move/from16 v1, v39

    if-ne v0, v1, :cond_489

7. add the new subclass attached in the directory of the smali we edited
 

Attachments

  • PhoneWindowManager$KillConcept.rar
    1.9 KB · Views: 1,009
Last edited:

Mirko ddd

Inactive Recognized Developer
Nov 7, 2010
1,734
5,000
Piazza Armerina
LSJ back to kill

I found really hard do it from scratch because samsung is using longpress back to show/hide the flash bar (for multiwindows feature), so i decided to use that method simply switching the subclass from $10 (flashbar show-hide) to $killconcept (back to kill).
This meant back to kill works only when mutiwindows is on, so i needed to recall the subclass even when multiwindow was off.
following the diff:

-1 switch $10 subclass to $KillConcept subclass

find
Code:
    .line 1618
    new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$10;

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

    iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;

will become
Code:
    .line 1618
    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;->mBackLongPress:Ljava/lang/Runnable;

this will let u use back to kill ONLY when multiwindows is on. So let s make it for every case, multiwindows on and off.

find
Code:
    .line 6320
    :cond_91a
    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsMultiWindowUIEnabled:Z

    move/from16 v27, v0

    [B][U]if-eqz v27, :cond_68[/U][/B]

    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mEnableMultiWindowUISetting:I

    move/from16 v27, v0

   [B][U] if-eqz v27, :cond_68[/U][/B]

focus on bolded underlined conds, we need to switch them with cond_951 so we will have:
Code:
    .line 6320
    :cond_91a
    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsMultiWindowUIEnabled:Z

    move/from16 v27, v0

    [B][U]if-eqz v27, :cond_951[/U][/B]

    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mEnableMultiWindowUISetting:I

    move/from16 v27, v0

   [B][U] if-eqz v27, :cond_951[/U][/B]

cond_951 may be different depending on your compiler, but we need to recall the cond that gives this:
Code:
    .line 6325
    [B][U]:cond_951[/U][/B]
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

    move-object/from16 v27, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;

    move-object/from16 v28, v0

    invoke-static {}, Landroid/view/ViewConfiguration;->getGlobalActionKeyTimeout()J

    move-result-wide v29

    invoke-virtual/range {v27 .. v30}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    goto/16 :goto_68

add the attached subclass and recompile.

NOTE: is in beta phase, has to be improved so if some dev wanna help me in debugging is welcome.
 

Attachments

  • PhoneWindowManager$KillConcept.rar
    1.9 KB · Views: 330
Last edited:

maanz "L"

Senior Member
Sep 12, 2010
1,059
780
singapore
Samsung Galaxy Note 10+
Hello xda'ers,
is me again, sorry to bother but today I bring to you a famous mod from AOKP: back longpress to kill.

You can find the how to into my github here

It really easy to do and port an any other samsung rom, simply check out github commit, it s very clear.

I made it for salesale's neat rom, u can find a flashable zip here

Would be appreciate to make a nandroid backup, just in case.

If u have requests for other roms please ask to your rom developer to contact me.

Cheers

Credits to:
AOKP
CM
xda sharing

this mod will be a great addition, mate..;)
 
  • Like
Reactions: lasic.2000

Many40

Senior Member
Nov 25, 2009
5,598
17,884
Thanks Mirko. Installed on NeatromLite 3.5 and so far works as expected. Especially Tapatalk app annoyed me much - after closing it always stayed as running process for nothing. Now I can get rid of this by one long press. Great.
I gonna observe if it doesn't influence badly any other features of the rom (there were some issues with similar feature in Jkay's mod). Regards

Sent from my GT-I9100 using xda premium
 
  • Like
Reactions: _Sale_

friccc81

Senior Member
Apr 18, 2012
67
16
Mirko, flashed Sale's Neatrom lite v3.3 (LPX). your mod works very well but i think better idea is "long press to kill ALL apps". With your mood I can kill only the latest application where I am.

Thanks

Sorry for my English
 

geroxx

Senior Member
Nov 24, 2011
139
467
This is exactly what was i looking for. Thank you very much :)

I used the guide with Chameleon-ROM and it worked like a charm. But is there a way to change the longpressduration til the app gets killed?

- geroxx -
 

bobdoblo

Senior Member
Apr 26, 2012
6,963
19,662
Been waiting for long time for this!
Thanks very much, agree that a kill all button is needed for recent applications when the home button is held down though!
But very happy with this mod, thanks!:thumbup:

NeatROM -The Best!
Salesale - True Super-Dev!
 

Mirko ddd

Inactive Recognized Developer
Nov 7, 2010
1,734
5,000
Piazza Armerina
Let me be the first to say thanks for your efforts on this Mirko and welcome to the NeatROM crew :)

:) thanks Aprilia






this mod will be a great addition, mate..;)

Since i cannot build my own rom at least i give a little of mine in many others xD





Thanks Mirko. Installed on NeatromLite 3.5 and so far works as expected. Especially Tapatalk app annoyed me much - after closing it always stayed as running process for nothing. Now I can get rid of this by one long press. Great.
I gonna observe if it doesn't influence badly any other features of the rom (there were some issues with similar feature in Jkay's mod). Regards

Sent from my GT-I9100 using xda premium




code is not 100% perfect but is bugless, tested almist 2days with logcats ;)


Mirko, flashed Sale's Neatrom lite v3.3 (LPX). your mod works very well but i think better idea is "long press to kill ALL apps". With your mood I can kill only the latest application where I am.

Thanks

Sorry for my English


well that s the mod, to kill all app check out my systemui with kill all recents, or clear ram with task manager :)




This is exactly what was i looking for. Thank you very much :)

I used the guide with Chameleon-ROM and it worked like a charm. But is there a way to change the longpressduration til the app gets killed?

- geroxx -




yes timeout can be set into smalis :)


Great work Mirko. You got 5 star from me.


thx Greg :)




Been waiting for long time for this!
Thanks very much, agree that a kill all button is needed for recent applications when the home button is held down though!
But very happy with this mod, thanks!:thumbup:

NeatROM -The Best!
Salesale - True Super-Dev!

Answered two posts ago :)

Inviato dal mio GT-I9100 con Tapatalk 2
 

maanz "L"

Senior Member
Sep 12, 2010
1,059
780
singapore
Samsung Galaxy Note 10+
This is exactly what was i looking for. Thank you very much :)

I used the guide with Chameleon-ROM and it worked like a charm. But is there a way to change the longpressduration til the app gets killed?

- geroxx -



Originally Posted by Mirko ddd
yes timeout can be set into smalis :)


Inviato dal mio GT-I9100 con Tapatalk 2


looking forward to the smali edits, mate..:good:
 

Mirko ddd

Inactive Recognized Developer
Nov 7, 2010
1,734
5,000
Piazza Armerina
looking forward to the smali edits, mate..:good:
ooh ok mate :D how many ms we have to set? i think is good enough, faster would be annoying because we could kill app mistaking, slower.. would be annoying too, but hey, i m not the boss here :silly:
5+5=10! where are my 10 stars? all fallen? make a wish! mmh, i made my wish but.. (check out my signature to better understand Salesale :eek:)
I love you <3 (no homo ;) )

nice to see tdunham friends here, you are welcome!
 

Goldie

Inactive Recognized Developer
Oct 16, 2010
9,965
22,759
Good job buddy. Thanks for the heads up :)

Sent from my GT-I9100 using Tapatalk 2
 

Mirko ddd

Inactive Recognized Developer
Nov 7, 2010
1,734
5,000
Piazza Armerina
Good job buddy. Thanks for the heads up :)

Sent from my GT-I9100 using Tapatalk 2
;)
I've been waiting for this! Thanks Mirko.

Could you add battery bar mod to your to do list?
you're welcome.
battery bar mod u mean aokp style or miui style?
I sincerily see this feature har to port without using romcontrol stuffs and miui stuffs.. if i remember well leomar made it for gingerbread, i will take a look, but i don t promise anything about :silly:
 

Mirko ddd

Inactive Recognized Developer
Nov 7, 2010
1,734
5,000
Piazza Armerina
thanks :D
However i am not really good in java-developing. So can you please tell me which values i must change to set the timeout.

- geroxx -

really no need to be good in java developing :D
if u take a look in the code (differences posted on github, u used to get it on chamaleon) u will have to focus on:
Code:
    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;

    move-object/from16 v39, v0

    invoke-static {}, Landroid/view/ViewConfiguration;->[B][COLOR="Red"]getGlobalActionKeyTimeout[/COLOR][/B]()J

this means we are recalling a method with this path:

Landroid/view/ViewConfiguration

so it s in framework jar/android/view/Viewconfiguration.smali

Open this smali file and look for the method getGlobalActionKeyTimeout

method say:
Code:
.method public static getGlobalActionKeyTimeout()J
    .registers 2

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

    return-wide v0
.end method

let s focus on bolded, this is the value in ms (i guess)

0x1f4 it s the time.
I really have problems with ex numbers so i google it and see this corresponding to 500ms (half second)

So we have two ways we can follow:
or edit the method
or repace this method with a convenient one (which have the timeout we want)

first is an asshole thing, because we will change the timeout of other things like power menu timeout, presshome timeout etc..
Second is more handy, so we can use an existing method (so no need to create nu) to our aim.

Let s investigate to find a nice timeout time :highfive: (Mirko wth are u talkin 'bout :eek:)
If I can you a can, only need to waste some time and have a passion for :D

Hope this will help you, for questions i m here, but don t forget to thank (i ignore people who don t support my efforts)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 94
    Hello xda'ers,
    is me again, sorry to bother but today I bring to you a famous mod from AOKP: back longpress to kill.

    HOW TO:

    1. we need to decompile android.policy.jar;

    2. then let s edit android.policy.jar/smali/com/android/internal/policy/impl/PhoneWindowManager.smali

    3. adding fields on "# instance fields" (red is what you add):

    Code:
    # instance fields
    .field mAccelerometerDefault:I
    
    .field mAllowAllRotations:I
    
    .field mAllowHdmiRotation:Z
    
    .field mAllowLockscreenWhenOn:Z
    
    .field final mAllowSystemUiDelay:Ljava/lang/Runnable;
    
    [COLOR="Red"].field mBackKillTimeout:Z[/COLOR]
    
    [COLOR="Red"].field mBackLongPress:Ljava/lang/Runnable;[/COLOR]
    
    .field mBootMsgDialog:Landroid/app/ProgressDialog;
    
    ...
    
    .field mLockScreenTimeout:I
    
    .field mLockScreenTimerActive:Z
    
    [COLOR="Red"].field mLongPressBackKill:Z[/COLOR]
    
    .field private mLongPressOnHomeBehavior:I
    
    ...

    4. add a new instance in the last lines of .method public constructor <init>()V to recall our new subclass (red is what to add):

    Code:
    ...
    [COLOR="Red"]    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;->mBackLongPress:Ljava/lang/Runnable;[/COLOR]
    
        new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$25;
    
        invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$25;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
    
        iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenLockTimeout:Ljava/lang/Runnable;
    
        .line 5754
        return-void
    .end method

    5. now we need to take a look in .method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J

    Code:
        :cond_13c
    
        const/16 v39, 0x3
    
        move/from16 v0, v21
    
        move/from16 v1, v39
    
        if-ne v0, v1, :cond_15a
    
        move-object/from16 v0, p0
    
        iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeKeyConsumedByScreenshotChord:Z

    after :cond_13c we need to add some code (note: :cond_13c may be different depending on your compiler) and we will get:

    Code:
        :cond_13c
    [COLOR="Red"]    const/16 v28, 0x4
    
        move/from16 v0, v28
    
        move/from16 v1, v21
    
        if-ne v1, v0, :cond_mi
    
        if-nez v8, :cond_mi
    
        .line 1741
        and-int/lit8 v28, v11, 0x20
    
        if-nez v28, :cond_mi
    
        .line 1742
        move-object/from16 v0, p0
    
        iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
    
        move-object/from16 v28, v0
    
        move-object/from16 v0, p0
    
        iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;
    
        move-object/from16 v1, v28
    
        invoke-virtual {v1, v0}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
    
        .line 1743
        add-int/lit8 v28, v11, 0x20
    
        move-object/from16 v0, p2
    
        move/from16 v1, v28
    
        invoke-static {v0, v1}, Landroid/view/KeyEvent;->changeFlags(Landroid/view/KeyEvent;I)Landroid/view/KeyEvent;
    
        .line 1744
        const/16 v28, 0x0
    
        move/from16 v0, v28
    
        move-object/from16 v1, p0
    
        iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackKillTimeout:Z
    
        .line 1752
        :cond_mi[/COLOR]
        const/16 v39, 0x3
    
        move/from16 v0, v21
    
        move/from16 v1, v39
    
        if-ne v0, v1, :cond_15a
    
        move-object/from16 v0, p0
    
        iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeKeyConsumedByScreenshotChord:Z

    6. into the same method look for: .line 2495:

    Code:
        .end local v9           #e:Landroid/os/RemoteException;
        :cond_45c
    
        const/16 v39, 0xd4
    
        move/from16 v0, v21
    
        move/from16 v1, v39
    
        if-eq v0, v1, :cond_46c
    
        const/16 v39, 0xd5
    
        move/from16 v0, v21
    
        move/from16 v1, v39
    
        if-ne v0, v1, :cond_489

    we ll add a code here too, getting:

    Code:
        .end local v9           #e:Landroid/os/RemoteException;
        :cond_45c
    [COLOR="Red"]    const/16 v28, 0x4
    
        move/from16 v0, v28
    
        move/from16 v1, v21
    
        if-ne v1, v0, :cond_mirko
    
        .line 1863
        move-object/from16 v0, p0
    
        iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackKillTimeout:Z
    
        move/from16 v28, v0
    
        if-nez v28, :cond_mirko
    
        if-eqz v8, :cond_mirko
    
        if-nez v29, :cond_mirko
    
        .line 1864
        move-object/from16 v0, p0
    
        iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
    
        move-object/from16 v38, v0
    
        move-object/from16 v0, p0
    
        iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;
    
        move-object/from16 v39, v0
    
        invoke-static {}, Landroid/view/ViewConfiguration;->getGlobalActionKeyTimeout()J
    
        move-result-wide v40
    
        invoke-virtual/range {v38 .. v41}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
    
        .line 1865
        const/16 v28, 0x1
    
        move/from16 v0, v28
    
        move-object/from16 v1, p0
    
        iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackKillTimeout:Z
    
        .line 1875
        :cond_mirko[/COLOR]
        const/16 v39, 0xd4
    
        move/from16 v0, v21
    
        move/from16 v1, v39
    
        if-eq v0, v1, :cond_46c
    
        const/16 v39, 0xd5
    
        move/from16 v0, v21
    
        move/from16 v1, v39
    
        if-ne v0, v1, :cond_489

    7. add the new subclass attached in the directory of the smali we edited
    29
    LSJ back to kill

    I found really hard do it from scratch because samsung is using longpress back to show/hide the flash bar (for multiwindows feature), so i decided to use that method simply switching the subclass from $10 (flashbar show-hide) to $killconcept (back to kill).
    This meant back to kill works only when mutiwindows is on, so i needed to recall the subclass even when multiwindow was off.
    following the diff:

    -1 switch $10 subclass to $KillConcept subclass

    find
    Code:
        .line 1618
        new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$10;
    
        invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$10;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
    
        iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;

    will become
    Code:
        .line 1618
        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;->mBackLongPress:Ljava/lang/Runnable;

    this will let u use back to kill ONLY when multiwindows is on. So let s make it for every case, multiwindows on and off.

    find
    Code:
        .line 6320
        :cond_91a
        move-object/from16 v0, p0
    
        iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsMultiWindowUIEnabled:Z
    
        move/from16 v27, v0
    
        [B][U]if-eqz v27, :cond_68[/U][/B]
    
        move-object/from16 v0, p0
    
        iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mEnableMultiWindowUISetting:I
    
        move/from16 v27, v0
    
       [B][U] if-eqz v27, :cond_68[/U][/B]

    focus on bolded underlined conds, we need to switch them with cond_951 so we will have:
    Code:
        .line 6320
        :cond_91a
        move-object/from16 v0, p0
    
        iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsMultiWindowUIEnabled:Z
    
        move/from16 v27, v0
    
        [B][U]if-eqz v27, :cond_951[/U][/B]
    
        move-object/from16 v0, p0
    
        iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mEnableMultiWindowUISetting:I
    
        move/from16 v27, v0
    
       [B][U] if-eqz v27, :cond_951[/U][/B]

    cond_951 may be different depending on your compiler, but we need to recall the cond that gives this:
    Code:
        .line 6325
        [B][U]:cond_951[/U][/B]
        move-object/from16 v0, p0
    
        iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;
    
        move-object/from16 v27, v0
    
        move-object/from16 v0, p0
    
        iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;
    
        move-object/from16 v28, v0
    
        invoke-static {}, Landroid/view/ViewConfiguration;->getGlobalActionKeyTimeout()J
    
        move-result-wide v29
    
        invoke-virtual/range {v27 .. v30}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
    
        goto/16 :goto_68

    add the attached subclass and recompile.

    NOTE: is in beta phase, has to be improved so if some dev wanna help me in debugging is welcome.
    3
    thanks :D
    However i am not really good in java-developing. So can you please tell me which values i must change to set the timeout.

    - geroxx -

    really no need to be good in java developing :D
    if u take a look in the code (differences posted on github, u used to get it on chamaleon) u will have to focus on:
    Code:
        iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;
    
        move-object/from16 v39, v0
    
        invoke-static {}, Landroid/view/ViewConfiguration;->[B][COLOR="Red"]getGlobalActionKeyTimeout[/COLOR][/B]()J

    this means we are recalling a method with this path:

    Landroid/view/ViewConfiguration

    so it s in framework jar/android/view/Viewconfiguration.smali

    Open this smali file and look for the method getGlobalActionKeyTimeout

    method say:
    Code:
    .method public static getGlobalActionKeyTimeout()J
        .registers 2
    
        .prologue
        .line 669
        [B]const-wide/16 v0, 0x1f4[/B]
    
        return-wide v0
    .end method

    let s focus on bolded, this is the value in ms (i guess)

    0x1f4 it s the time.
    I really have problems with ex numbers so i google it and see this corresponding to 500ms (half second)

    So we have two ways we can follow:
    or edit the method
    or repace this method with a convenient one (which have the timeout we want)

    first is an asshole thing, because we will change the timeout of other things like power menu timeout, presshome timeout etc..
    Second is more handy, so we can use an existing method (so no need to create nu) to our aim.

    Let s investigate to find a nice timeout time :highfive: (Mirko wth are u talkin 'bout :eek:)
    If I can you a can, only need to waste some time and have a passion for :D

    Hope this will help you, for questions i m here, but don t forget to thank (i ignore people who don t support my efforts)
    3
    looking forward to the smali edits, mate..:good:
    ooh ok mate :D how many ms we have to set? i think is good enough, faster would be annoying because we could kill app mistaking, slower.. would be annoying too, but hey, i m not the boss here :silly:
    5+5=10! where are my 10 stars? all fallen? make a wish! mmh, i made my wish but.. (check out my signature to better understand Salesale :eek:)
    I love you <3 (no homo ;) )

    nice to see tdunham friends here, you are welcome!
    2
    Let me be the first to say thanks for your efforts on this Mirko and welcome to the NeatROM crew :)

    :) thanks Aprilia






    this mod will be a great addition, mate..;)

    Since i cannot build my own rom at least i give a little of mine in many others xD





    Thanks Mirko. Installed on NeatromLite 3.5 and so far works as expected. Especially Tapatalk app annoyed me much - after closing it always stayed as running process for nothing. Now I can get rid of this by one long press. Great.
    I gonna observe if it doesn't influence badly any other features of the rom (there were some issues with similar feature in Jkay's mod). Regards

    Sent from my GT-I9100 using xda premium




    code is not 100% perfect but is bugless, tested almist 2days with logcats ;)


    Mirko, flashed Sale's Neatrom lite v3.3 (LPX). your mod works very well but i think better idea is "long press to kill ALL apps". With your mood I can kill only the latest application where I am.

    Thanks

    Sorry for my English


    well that s the mod, to kill all app check out my systemui with kill all recents, or clear ram with task manager :)




    This is exactly what was i looking for. Thank you very much :)

    I used the guide with Chameleon-ROM and it worked like a charm. But is there a way to change the longpressduration til the app gets killed?

    - geroxx -




    yes timeout can be set into smalis :)


    Great work Mirko. You got 5 star from me.


    thx Greg :)




    Been waiting for long time for this!
    Thanks very much, agree that a kill all button is needed for recent applications when the home button is held down though!
    But very happy with this mod, thanks!:thumbup:

    NeatROM -The Best!
    Salesale - True Super-Dev!

    Answered two posts ago :)

    Inviato dal mio GT-I9100 con Tapatalk 2