[Samsung Epic 4G Touch] tdunham:
Long Press Back to Kill in JB

Credits to Mirko DDD in i9100 thread for the original guide for this.

Android.policy.jar changes

Add attached file PhoneWindowManager$KillConcept.smali to:

com/android/internal/policy/impl/

Smali edit:

com/android/internal/policy/impl/PhoneWindowManager.smali

Before:

.field final mAllowSystemUiDelay:Ljava/lang/Runnable;

.field mAssistKeyLongPressed:Z

After:

.field final mAllowSystemUiDelay:Ljava/lang/Runnable;

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

Before:

.line 1667
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;->mBackLongPress:Ljava/lang/Runnable;

After:

.line 1667
[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
[/COLOR]
iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPress:Ljava/lang/Runnable;

Before:

.line 7480
iput-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBootMsgDialog:Landroid/app/ProgressDialog;

.line 7619
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$35;

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

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

After:

.line 7480
iput-object v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBootMsgDialog:Landroid/app/ProgressDialog;

[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]
.line 7619
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$35;

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

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

Before:

.line 3292
:cond_1cf
const/16 v47, 0x3

move/from16 v0, v27

move/from16 v1, v47

After:

.line 3292
:cond_1cf
[COLOR="Red"]const/16 v35, 0x4

move/from16 v0, v35

move/from16 v1, v27

if-ne v1, v0, :cond_mi

if-nez v9, :cond_mi

.line 1741
and-int/lit8 v35, v12, 0x20

if-nez v35, :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 v35, v0

move-object/from16 v0, p0

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

move-object/from16 v1, v35

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

.line 1743
add-int/lit8 v35, v12, 0x20

move-object/from16 v0, p2

move/from16 v1, v35

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

.line 1744
const/16 v35, 0x0

move/from16 v0, v35

move-object/from16 v1, p0

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

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

move/from16 v0, v27

move/from16 v1, v47

Before:

.line 3680
.end local v10 #e:Landroid/os/RemoteException;
:cond_6ed
const/16 v47, 0xdb

move/from16 v0, v27

move/from16 v1, v47

After:

.line 3680
.end local v10 #e:Landroid/os/RemoteException;
:cond_6ed
[COLOR="Red"]const/16 v35, 0x4

move/from16 v0, v35

move/from16 v1, v27

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 v35, v0

if-nez v35, :cond_mirko

if-eqz v9, :cond_mirko

if-nez v36, :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 v46, v0

move-object/from16 v0, p0

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

move-object/from16 v47, v0

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

move-result-wide v48

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

.line 1865
const/16 v34, 0x1

move/from16 v0, v35

move-object/from16 v1, p0

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

.line 1875
:cond_mirko[/COLOR]
const/16 v47, 0xdb

move/from16 v0, v27

move/from16 v1, v47

Before:

.line 6695
:cond_931
move-object/from16 v0, p0

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

move/from16 v29, v0

if-eqz v29, :cond_6a

move-object/from16 v0, p0

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

move/from16 v29, v0

if-eqz v29, :cond_6a

After:

.line 6695
:cond_931
move-object/from16 v0, p0

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

move/from16 v29, v0

[COLOR="Red"]if-eqz v29, :cond_968[/COLOR]

move-object/from16 v0, p0

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

move/from16 v29, v0

[COLOR="Red"]if-eqz v29, :cond_968[/COLOR]