[Sprint HTC EVO 4G LTE] swagstr:
All Swagged Out Project

The goal of ASOP is to provide every user with the chance to tweak their phones exactly how they like. At the same time, ASOP gives up and coming devs a place to learn how to get their hands dirty and add mods the old fashioned way.

Background

android.policy.jar is a framework file that controls a lot of things. The three mods that will be covered today include the Advanced Power Menu, Volume Rocker Mod (to skip tracks) and Long-press Back to Kill. These mods were created a long time ago and have been used on many devices. A big props does have to be given to mikmik user one_love_420 for bringing this to the HTC EVO 4G LTE's latest OTA.

Remember

This is for the HTC EVO 4G LTE running OTA 3.15, Android 4.1.1, Sense 4+ and nothing else. We are assuming you are starting with a stock android.policy.jar.

ADVANCED POWER MENU

The Mod

Long-press the Power button and be met with an advanced menu. Including, 4-in-1 Reboot Menu, sound profiles, airplane mode.

Decompile

You gotta figure this one out! Learn how to use apktool, baksmali or VTS. It is HIGHLY recommended that if you are decompiling with apktool or baksmali to add "-b" modifier. If using VTS, uncheck the smali debug code. This will make your smali code MUCH smaller - less system space = MORE RAM.

What Needs to Be Added

This mod requires two smali files that do not exist in the stock android.policy.jar you will find them attached at the bottom of this post.

GlobalActions$5$1.smali

GlobalActions$5$2.smali

They go in \com\android\internal\policy\impl\

What needs to Be Changed [The long part]

Using Notepad++ or a similar text editor (ie not Notepad) navigate to \com\android\internal\policy\impl\GlobalActions.smali

SEARCH FOR:

.method private changeAirplaneModeSystemSetting(Z)V

AFTER THIS METHOD ENDS, ADD THE FOLLOWING METHODS IN GREEN

.end method

[COLOR="SeaGreen"].method private createDialog()Lcom/htc/widget/HtcAlertDialog;
.locals 24

move-object/from16 v0, p0

iget-boolean v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mHasVibrator:Z

if-nez v3, :cond_14c

new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$SilentModeToggleAction;

move-object/from16 v0, p0

invoke-direct {v3, v0}, Lcom/android/internal/policy/impl/GlobalActions$SilentModeToggleAction;-><init>(Lcom/android/internal/policy/impl/GlobalActions;)V

move-object/from16 v0, p0

iput-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeAction:Lcom/android/internal/policy/impl/GlobalActions$Action;

:goto_11
new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$1;

const v5, 0x402002a

const v6, 0x402002a

const v7, 0x104013e

const v8, 0x104013f

const v9, 0x1040140

const/4 v10, 0x0

move-object/from16 v4, p0

invoke-direct/range {v3 .. v10}, Lcom/android/internal/policy/impl/GlobalActions$1;-><init>(Lcom/android/internal/policy/impl/GlobalActions;IIIIIZ)V

move-object/from16 v0, p0

iput-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->onAirplaneModeChanged()V

new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$2;

const v5, 0x402003f

const v6, 0x402003f

const v7, 0x4070029

const v8, 0x4070028

const v9, 0x4070027

const/4 v10, 0x1

move-object/from16 v4, p0

invoke-direct/range {v3 .. v10}, Lcom/android/internal/policy/impl/GlobalActions$2;-><init>(Lcom/android/internal/policy/impl/GlobalActions;IIIIIZ)V

move-object/from16 v0, p0

iput-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mVibrationModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$3;

const v5, 0x402003d

const v6, 0x402003d

const v7, 0x407002a

const v8, 0x407002c

const v9, 0x407002b

const/4 v10, 0x1

move-object/from16 v4, p0

invoke-direct/range {v3 .. v10}, Lcom/android/internal/policy/impl/GlobalActions$3;-><init>(Lcom/android/internal/policy/impl/GlobalActions;IIIIIZ)V

move-object/from16 v0, p0

iput-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mMobileNetworkModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

new-instance v3, Ljava/util/ArrayList;

invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

move-object/from16 v0, p0

iput-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->isSense2Mode()Z

move-result v3

if-eqz v3, :cond_163

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const-string v4, "powerOptions_power_off_status"

const-string v5, "string"

const-string v6, "com.htc.framework"

invoke-virtual {v3, v4, v5, v6}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

move-result v17

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const-string v4, "powerOptions_restart"

const-string v5, "string"

const-string v6, "com.htc.framework"

invoke-virtual {v3, v4, v5, v6}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

move-result v20

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const-string v4, "powerOptions_restart_status"

const-string v5, "string"

const-string v6, "com.htc.framework"

invoke-virtual {v3, v4, v5, v6}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

move-result v19

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

new-instance v4, Lcom/android/internal/policy/impl/GlobalActions$4;

const v5, 0x402003e

const v6, 0x104013a

move-object/from16 v0, p0

move/from16 v1, v17

invoke-direct {v4, v0, v5, v6, v1}, Lcom/android/internal/policy/impl/GlobalActions$4;-><init>(Lcom/android/internal/policy/impl/GlobalActions;III)V

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

new-instance v4, Lcom/android/internal/policy/impl/GlobalActions$5;

const v5, 0x4020044

move-object/from16 v0, p0

move/from16 v1, v20

move/from16 v2, v19

invoke-direct {v4, v0, v5, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$5;-><init>(Lcom/android/internal/policy/impl/GlobalActions;III)V

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

:goto_e0
move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

move-result-object v3

invoke-virtual {v3}, Landroid/content/pm/PackageManager;->getUsers()Ljava/util/List;

move-result-object v23

invoke-interface/range {v23 .. v23}, Ljava/util/List;->size()I

move-result v3

const/4 v4, 0x1

if-le v3, v4, :cond_1fd

:try_start_f3
invoke-static {}, Landroid/app/ActivityManagerNative;->getDefault()Landroid/app/IActivityManager;

move-result-object v3

invoke-interface {v3}, Landroid/app/IActivityManager;->getCurrentUser()Landroid/content/pm/UserInfo;
:try_end_fa
.catch Landroid/os/RemoteException; {:try_start_f3 .. :try_end_fa} :catch_1dd

move-result-object v12

:goto_fb
invoke-interface/range {v23 .. v23}, Ljava/util/List;->iterator()Ljava/util/Iterator;

move-result-object v14

:goto_ff
invoke-interface {v14}, Ljava/util/Iterator;->hasNext()Z

move-result v3

if-eqz v3, :cond_1fd

invoke-interface {v14}, Ljava/util/Iterator;->next()Ljava/lang/Object;

move-result-object v22

check-cast v22, Landroid/content/pm/UserInfo;

if-nez v12, :cond_1e5

move-object/from16 v0, v22

iget v3, v0, Landroid/content/pm/UserInfo;->id:I

if-nez v3, :cond_1e1

const/16 v16, 0x1

:goto_115
new-instance v21, Lcom/android/internal/policy/impl/GlobalActions$8;

const v4, 0x108031d

new-instance v5, Ljava/lang/StringBuilder;

invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

move-object/from16 v0, v22

iget-object v3, v0, Landroid/content/pm/UserInfo;->name:Ljava/lang/String;

if-eqz v3, :cond_1f5

move-object/from16 v0, v22

iget-object v3, v0, Landroid/content/pm/UserInfo;->name:Ljava/lang/String;

:goto_129
invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v5

if-eqz v16, :cond_1f9

const-string v3, " \u2714"

:goto_131
invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v3

invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v3

move-object/from16 v0, v21

move-object/from16 v1, p0

move-object/from16 v2, v22

invoke-direct {v0, v1, v4, v3, v2}, Lcom/android/internal/policy/impl/GlobalActions$8;-><init>(Lcom/android/internal/policy/impl/GlobalActions;ILjava/lang/CharSequence;Landroid/content/pm/UserInfo;)V

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

move-object/from16 v0, v21

invoke-virtual {v3, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

goto :goto_ff

:cond_14c
new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$SilentModeTriStateAction;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

move-object/from16 v0, p0

iget-object v5, v0, Lcom/android/internal/policy/impl/GlobalActions;->mAudioManager:Landroid/media/AudioManager;

move-object/from16 v0, p0

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

invoke-direct {v3, v4, v5, v6}, Lcom/android/internal/policy/impl/GlobalActions$SilentModeTriStateAction;-><init>(Landroid/content/Context;Landroid/media/AudioManager;Landroid/os/Handler;)V

move-object/from16 v0, p0

iput-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeAction:Lcom/android/internal/policy/impl/GlobalActions$Action;

goto/16 :goto_11

:cond_163
sget-short v3, Lcom/htc/htcjavaflag/HtcBuildFlag;->Htc_DEVICE_flag:S

const/16 v4, 0x9

if-ne v3, v4, :cond_1a6

sget-short v3, Lcom/htc/htcjavaflag/HtcBuildFlag;->Htc_PROJECT_flag:S

const/16 v4, 0xd1

if-ne v3, v4, :cond_1a6

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

new-instance v4, Lcom/android/internal/policy/impl/GlobalActions$6;

const v5, 0x402003d

const v6, 0x104013a

move-object/from16 v0, p0

invoke-direct {v4, v0, v5, v6}, Lcom/android/internal/policy/impl/GlobalActions$6;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeAction:Lcom/android/internal/policy/impl/GlobalActions$Action;

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mVibrationModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mMobileNetworkModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

goto/16 :goto_e0

:cond_1a6
move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

new-instance v4, Lcom/android/internal/policy/impl/GlobalActions$7;

const v5, 0x402003d

const v6, 0x104013a

move-object/from16 v0, p0

invoke-direct {v4, v0, v5, v6}, Lcom/android/internal/policy/impl/GlobalActions$7;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeAction:Lcom/android/internal/policy/impl/GlobalActions$Action;

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mVibrationModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

goto/16 :goto_e0

:catch_1dd
move-exception v18

const/4 v12, 0x0

goto/16 :goto_fb

:cond_1e1
const/16 v16, 0x0

goto/16 :goto_115

:cond_1e5
iget v3, v12, Landroid/content/pm/UserInfo;->id:I

move-object/from16 v0, v22

iget v4, v0, Landroid/content/pm/UserInfo;->id:I

if-ne v3, v4, :cond_1f1

const/16 v16, 0x1

goto/16 :goto_115

:cond_1f1
const/16 v16, 0x0

goto/16 :goto_115

:cond_1f5
const-string v3, "Primary"

goto/16 :goto_129

:cond_1f9
const-string v3, ""

goto/16 :goto_131

:cond_1fd
new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$MyAdapter;

const/4 v4, 0x0

move-object/from16 v0, p0

invoke-direct {v3, v0, v4}, Lcom/android/internal/policy/impl/GlobalActions$MyAdapter;-><init>(Lcom/android/internal/policy/impl/GlobalActions;Lcom/android/internal/policy/impl/GlobalActions$1;)V

move-object/from16 v0, p0

iput-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mAdapter:Lcom/android/internal/policy/impl/GlobalActions$MyAdapter;

new-instance v11, Lcom/htc/widget/HtcAlertDialog$Builder;

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

invoke-direct {v11, v3}, Lcom/htc/widget/HtcAlertDialog$Builder;-><init>(Landroid/content/Context;)V

invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->isSense2Mode()Z

move-result v3

if-eqz v3, :cond_278

move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const-string v4, "global_actions"

const-string v5, "string"

const-string v6, "android"

invoke-virtual {v3, v4, v5, v6}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

move-result v15

:goto_22a
move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mAdapter:Lcom/android/internal/policy/impl/GlobalActions$MyAdapter;

move-object/from16 v0, p0

invoke-virtual {v11, v3, v0}, Lcom/htc/widget/HtcAlertDialog$Builder;->setAdapter(Landroid/widget/ListAdapter;Landroid/content/DialogInterface$OnClickListener;)Lcom/htc/widget/HtcAlertDialog$Builder;

move-result-object v3

const/4 v4, 0x1

invoke-virtual {v3, v4}, Lcom/htc/widget/HtcAlertDialog$Builder;->setInverseBackgroundForced(Z)Lcom/htc/widget/HtcAlertDialog$Builder;

move-result-object v3

invoke-virtual {v3, v15}, Lcom/htc/widget/HtcAlertDialog$Builder;->setTitle(I)Lcom/htc/widget/HtcAlertDialog$Builder;

invoke-virtual {v11}, Lcom/htc/widget/HtcAlertDialog$Builder;->create()Lcom/htc/widget/HtcAlertDialog;

move-result-object v13

invoke-virtual {v13}, Lcom/htc/widget/HtcAlertDialog;->getListView()Landroid/widget/ListView;

move-result-object v3

const/4 v4, 0x1

invoke-virtual {v3, v4}, Landroid/widget/ListView;->setItemsCanFocus(Z)V

invoke-virtual {v13}, Lcom/htc/widget/HtcAlertDialog;->getListView()Landroid/widget/ListView;

move-result-object v3

const/4 v4, 0x1

invoke-virtual {v3, v4}, Landroid/widget/ListView;->setLongClickable(Z)V

invoke-virtual {v13}, Lcom/htc/widget/HtcAlertDialog;->getListView()Landroid/widget/ListView;

move-result-object v3

new-instance v4, Lcom/android/internal/policy/impl/GlobalActions$9;

move-object/from16 v0, p0

invoke-direct {v4, v0}, Lcom/android/internal/policy/impl/GlobalActions$9;-><init>(Lcom/android/internal/policy/impl/GlobalActions;)V

invoke-virtual {v3, v4}, Landroid/widget/ListView;->setOnItemLongClickListener(Landroid/widget/AdapterView$OnItemLongClickListener;)V

invoke-virtual {v13}, Lcom/htc/widget/HtcAlertDialog;->getWindow()Landroid/view/Window;

move-result-object v3

const/16 v4, 0x7d8

invoke-virtual {v3, v4}, Landroid/view/Window;->setType(I)V

move-object/from16 v0, p0

invoke-virtual {v13, v0}, Lcom/htc/widget/HtcAlertDialog;->setOnDismissListener(Landroid/content/DialogInterface$OnDismissListener;)V

invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->isSense2Mode()Z

move-result v3

if-eqz v3, :cond_277

move-object/from16 v0, p0

invoke-virtual {v13, v0}, Lcom/htc/widget/HtcAlertDialog;->setOnKeyListener(Landroid/content/DialogInterface$OnKeyListener;)V

:cond_277
return-object v13

:cond_278
move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;

invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v3

const-string v4, "global_actions"

const-string v5, "string"

const-string v6, "android"

invoke-virtual {v3, v4, v5, v6}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

move-result v15

goto :goto_22a
.end method[/COLOR]

.method private getWindowManager()Landroid/view/IWindowManager;

Navigate to \com\android\internal\policy\impl\GlobalActions$5.smali

SEARCH FOR:

.method public onPress()V

AFTER REPLACE THE REST OF THE FILE WITH

.locals 6

const/4 v5, 0x4

new-instance v1, Lcom/htc/widget/HtcAlertDialog$Builder;

iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions$5;->this$0:Lcom/android/internal/policy/impl/GlobalActions;

#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

move-result-object v2

invoke-direct {v1, v2}, Lcom/htc/widget/HtcAlertDialog$Builder;-><init>(Landroid/content/Context;)V

const v2, 0x1080027

invoke-virtual {v1, v2}, Lcom/htc/widget/HtcAlertDialog$Builder;->setIcon(I)Lcom/htc/widget/HtcAlertDialog$Builder;

move-result-object v1

const v2, 0x20400cd

invoke-virtual {v1, v2}, Lcom/htc/widget/HtcAlertDialog$Builder;->setTitle(I)Lcom/htc/widget/HtcAlertDialog$Builder;

move-result-object v1

sget-object v2, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;

const/4 v3, 0x0

new-instance v4, Lcom/android/internal/policy/impl/GlobalActions$5$2;

invoke-direct {v4, p0}, Lcom/android/internal/policy/impl/GlobalActions$5$2;-><init>(Lcom/android/internal/policy/impl/GlobalActions$5;)V

invoke-virtual {v1, v2, v3, v4}, Lcom/htc/widget/HtcAlertDialog$Builder;->setSingleChoiceItems([Ljava/lang/CharSequence;ILandroid/content/DialogInterface$OnClickListener;)Lcom/htc/widget/HtcAlertDialog$Builder;

move-result-object v1

const v2, 0x2040151

new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$5$1;

invoke-direct {v3, p0}, Lcom/android/internal/policy/impl/GlobalActions$5$1;-><init>(Lcom/android/internal/policy/impl/GlobalActions$5;)V

invoke-virtual {v1, v2, v3}, Lcom/htc/widget/HtcAlertDialog$Builder;->setPositiveButton(ILandroid/content/DialogInterface$OnClickListener;)Lcom/htc/widget/HtcAlertDialog$Builder;

move-result-object v1

const/high16 v2, 0x104

const/4 v3, 0x0

invoke-virtual {v1, v2, v3}, Lcom/htc/widget/HtcAlertDialog$Builder;->setNegativeButton(ILandroid/content/DialogInterface$OnClickListener;)Lcom/htc/widget/HtcAlertDialog$Builder;

move-result-object v1

invoke-virtual {v1}, Lcom/htc/widget/HtcAlertDialog$Builder;->create()Lcom/htc/widget/HtcAlertDialog;

move-result-object v0

invoke-virtual {v0}, Lcom/htc/widget/HtcAlertDialog;->getWindow()Landroid/view/Window;

move-result-object v1

const/16 v2, 0x7d8

invoke-virtual {v1, v2}, Landroid/view/Window;->setType(I)V

iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions$5;->this$0:Lcom/android/internal/policy/impl/GlobalActions;

#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v1}, Lcom/android/internal/policy/impl/GlobalActions;->access$200(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

move-result-object v1

invoke-virtual {v1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v1

const v2, 0x1110009

invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

if-nez v1, :cond_60

invoke-virtual {v0}, Lcom/htc/widget/HtcAlertDialog;->getWindow()Landroid/view/Window;

move-result-object v1

invoke-virtual {v1, v5, v5}, Landroid/view/Window;->setFlags(II)V

:cond_60
invoke-virtual {v0}, Lcom/htc/widget/HtcAlertDialog;->show()V

return-void
.end method

.method public showBeforeProvisioning()Z
.locals 1

const/4 v0, 0x1

return v0
.end method

.method public showDuringKeyguard()Z
.locals 1

const/4 v0, 0x1

return v0
.end method

Navigate to \com\android\internal\policy\impl\GlobalActions$6.smali

REPLACE

.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions;[COLOR="Red"]II[/COLOR])V

WITH

.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions;[COLOR="red"]III[/COLOR])V

REPLACE

invoke-direct {[COLOR="red"]p0, p2, p3[/COLOR]}, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;-><init>([COLOR="red"]II[/COLOR])V

WITH

invoke-direct {[COLOR="red"]p0, p2, p3, p4[/COLOR]}, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;-><init>([COLOR="red"]III[/COLOR])V

REPLACE

const/4 v1, 0x[COLOR="red"]1[/COLOR]

invoke-static {v0, v1}, Lcom/htc/app/HtcShutdownThread;->[COLOR="red"]shutdown[/COLOR](Landroid/content/Context;Z)V

WITH

const/4 v1, 0x[COLOR="red"]0[/COLOR]

invoke-static {v0, v1}, Lcom/htc/app/HtcShutdownThread;->[COLOR="red"]hibernate[/COLOR](Landroid/content/Context;Z)V

Navigate to \com\android\internal\policy\impl\GlobalActions$SinglePressAction.smali

ADD GREEN TEXT

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/android/internal/policy/impl/GlobalActions;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x40a
name = "SinglePressAction"
.end annotation

[COLOR="SeaGreen"]# static fields
.field protected static rebootMode:I

.field protected static final rebootOptions:[Ljava/lang/String;[/COLOR]

# instance fields
.field private final mIconResId:I

.field private final mMessage:Ljava/lang/CharSequence;

.field private final mMessageResId:I

.field private final mStatusResId:I

SEARCH FOR

# direct methods

ADD AFTER

.method static constructor <clinit>()V
.locals 3

const/4 v0, 0x4

new-array v0, v0, [Ljava/lang/String;

const/4 v1, 0x0

const-string v2, "Normal"

aput-object v2, v0, v1

const/4 v1, 0x1

const-string v2, "Hot restart"

aput-object v2, v0, v1

const/4 v1, 0x2

const-string v2, "Bootloader"

aput-object v2, v0, v1

const/4 v1, 0x3

const-string v2, "Recovery"

aput-object v2, v0, v1

sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;

return-void
.end method

The Final Step

Now that all the smali files have been edited, recompile your .jar, rename your file to android.policy.jar and push to /system/framework/android.policy.jar. Smali files are stored in classes.dex inside of .apks and .jars, I have uploaded some classes.dexs that include the other mods listed here as well as modified/unmodified smalis. Enjoy!

EXTRA FILES

GlobalActions$5$1.smali

GlobalActions$5$2.smali

STOCK FILES

GlobalActions.smali

GlobalActions$5.smali

GlobalActions$6.smali

GlobalActions$SinglePressAction.smali

classes.dex

android.policy.jar

APM FILES

GlobalActions.smali

GlobalActions$5.smali

GlobalActions$6.smali

GlobalActions$SinglePressAction.smali

classes.dex

android.policy.jar

APM + VOL-TRACK + BACK-KILL FILES

classes.dex

android.policy.jar

#ASOP