[Sprint HTC EVO 4G LTE] freeza:
First of all, a big thanks to one_love_420 for doing this modification for our EVO LTEs. Now, of course I had to pick apart the mod and figure out how to do it for myself for future reference and low and behold, it worked.

I have attached a flashable zip to make this easier. It also includes the advanced power menu and long press home for recent apps. If you use Titanium Backup to odex the system apps, you must remove odex files before flashing OR before rebooting after flashing or you will get FCs.

Another Team XPOSED exclusive!

Step 1: grab android.policy.jar and decompile it OR extract classes.dex from it and use baksmali to decompile.

Step 2: navigate to com\android\internal\policy\impl\PhoneWindowManager.smali and open that.

Before we begin, let me add a legend so that you know what commands mean what.

Command Legend

FIND: This means search for

AFTER-ADD: This means after the line you've searched for, add the following below it. You can press enter to make a few lines. I would do 3 so that you can add whatever you need to in the middle, keeping the code looking the same.

FIND-AROUND: This means that you search around the previous FIND. Somewhere in the vicinity that's not really searchable for the first time because of multiple instances. Most of the time you can search with your eyes instead of with the actual search command.

REPLACE: You completely replace whatever you are told to replace with what comes after the REPLACE command.

REPLACE-WITH: This is roughly the same as REPLACE, but is used when there is nothing to FIND-AROUND.

REMOVE: You completely remove what is said below the REMOVE command.

ADD-BEFORE: This means after the line you've searched for, add the following above it. You can press enter to make a few lines. I would do 3 so that you can add whatever you need to in the middle, keeping the code looking the same.

Let us begin with actual smali code modifications.

Step 3: FIND

.field mIsHtcDockScreenAsHome:Z

AFTER-ADD

.field mIsLongPress:Z

FIND

.field private mVolumeDownKeyTriggered:Z

AFTER-ADD

.field mVolumeDownLongPress:Ljava/lang/Runnable;

FIND

.field private mVolumeUpKeyTriggered:Z

AFTER-ADD

.field mVolumeUpLongPress:Ljava/lang/Runnable;

.field mWakeAcquired:Z

FIND

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

AFTER-ADD

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

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

(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mVolumeUpLongPress:Ljava/lang/Runnable;

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

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

(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mVolumeDownLongPress:Ljava/lang/Runnable;

iput-boolean v2, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mWakeAcquired:Z

FIND

iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;

FIND-AROUND

throw v2
.end method

ADD-AFTER

.method handleVolumeLongPress(I)V
.locals 4

const/16 v1, 0x18

if-ne p1, v1, :cond_11

iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mVolumeUpLongPress:Ljava/lang/Runnable;

:goto_6
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mHandler:Landroid/os/Handler;

invoke-static {}, Landroid/view/ViewConfiguration;->getLongPressTimeout()I

move-result v2

int-to-long v2, v2

invoke-virtual {v1, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

return-void

:cond_11
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mVolumeDownLongPress:Ljava/lang/Runnable;

goto :goto_6
.end method

.method handleVolumeLongPressAbort()V
.locals 2

iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mHandler:Landroid/os/Handler;

iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mVolumeUpLongPress:Ljava/lang/Runnable;

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

iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mHandler:Landroid/os/Handler;

iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mVolumeDownLongPress:Ljava/lang/Runnable;

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

return-void
.end method

FIND

:cond_215
const/16 v20, 0x0

goto :goto_201

:sswitch_218
const/16 v20, 0x19

FIND-AROUND

:sswitch_218

ADD-AFTER

if-nez v7, :cond_245

invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>handleVolumeLongPressAbort()V

move-object/from16 v0, p0

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

if-eqz v1, :cond_232

const-string v1, "lyapota"

const-string v2, "media_key WakeLock release"

invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

iget-object v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;

invoke-virtual {v1}, Landroid/os/PowerManager$WakeLock;->release()V

const/4 v2, 0x0

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

:cond_232
move-object/from16 v0, p0

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

if-nez v0, :cond_245

and-int/lit8 v20, v18, 0x1

if-nez v20, :cond_245

const/16 v20, 0x3

move-object/from16 v0, p0

move/from16 v1, v20

invoke-virtual {v0, v1, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V

:cond_245

FIND

invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z

FIND-AROUND

if-eqz v20, :cond_2c

ADD-AFTER

move-object/from16 v0, p0

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

if-nez v1, :cond_320

const-string v1, "lyapota"

const-string v2, "media_key WakeLock acquire"

invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

iget-object v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mBroadcastWakeLock:Landroid/os/PowerManager$WakeLock;

invoke-virtual {v1}, Landroid/os/PowerManager$WakeLock;->acquire()V

const/4 v2, 0x1

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

:cond_320

FIND

and-int/lit8 v20, v18, 0x1

if-nez v20, :cond_2c

FIND-AROUND

const/16 v20, 0x3

REPLACE

const/16 v20, 0x3

WITH

const/4 v1, 0x0

FIND

move-object/from16 v0, p0

move/from16 v1, v20

REMOVE

move/from16 v1, v20

FIND

invoke-virtual {v0, v1, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V

REPLACE-WITH

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

invoke-virtual {v0, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress

(I)V

FIND

.method setAttachedWindowFrames(Landroid/view/WindowManagerPolicy

$WindowState;IILandroid/view/WindowManagerPolicy

$WindowState;ZLandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;)V

ADD-BEFORE

.method protected sendMediaButtonEvent(I)V
.locals 13

invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

move-result-wide v1

new-instance v11, Landroid/content/Intent;

const-string v4, "android.intent.action.MEDIA_BUTTON"

const/4 v5, 0x0

invoke-direct {v11, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

new-instance v0, Landroid/view/KeyEvent;

const/4 v5, 0x0

const/4 v7, 0x0

move-wide v3, v1

move v6, p1

invoke-direct/range {v0 .. v7}, Landroid/view/KeyEvent;-><init>(JJIII)V

const-string v4, "android.intent.extra.KEY_EVENT"

invoke-virtual {v11, v4, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)

Landroid/content/Intent;

iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mContext:Landroid/content/Context;

const/4 v5, 0x0

invoke-virtual {v4, v11, v5}, Landroid/content/Context;->sendOrderedBroadcast

(Landroid/content/Intent;Ljava/lang/String;)V

new-instance v12, Landroid/content/Intent;

const-string v4, "android.intent.action.MEDIA_BUTTON"

const/4 v5, 0x0

invoke-direct {v12, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

new-instance v3, Landroid/view/KeyEvent;

const/4 v8, 0x1

const/4 v10, 0x0

move-wide v4, v1

move-wide v6, v1

move v9, p1

invoke-direct/range {v3 .. v10}, Landroid/view/KeyEvent;-><init>(JJIII)V

const-string v4, "android.intent.extra.KEY_EVENT"

invoke-virtual {v12, v4, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)

Landroid/content/Intent;

iget-object v4, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;-

>mContext:Landroid/content/Context;

const/4 v5, 0x0

invoke-virtual {v4, v12, v5}, Landroid/content/Context;->sendOrderedBroadcast

(Landroid/content/Intent;Ljava/lang/String;)V

return-void
.end method

Step 4: Save file and compile android.policy.jar or use smali to compile classes.dex and replace inside of android.policy.jar

Step 5: Reboot into recovery and push to phone, clear Dalvik and if you use Titanium Backup to odex, you will have to remove the odex files from /system/app/ in adb by doing "adb shell rm /system/app/*.odex"

Step 6: Reboot and prosper!