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):
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):
5. now we need to take a look in .method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J
after :cond_13c we need to add some code (note: :cond_13c may be different depending on your compiler) and we will get:
6. into the same method look for: .line 2495:
we ll add a code here too, getting:
7. add the new subclass attached in the directory of the smali we edited
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
Last edited: