Download the zip which below which contains the necessary files to implement this port.
GlobalActions9.smali.zip
Next, get android.policy.jar from the latest MIUI and decompile using smali/baksmali.
Copy GlobalActions$9.smali, GlobalActions$9$1. and GlobalActions$9$2.smali into android.policy.jar/com/android/internal/policy/impl from the ones in GlobalActions9.smali.zip found above.
In your decompiled android.policy.jar, browse to com/android/internal/policy/impl and make the following edits.
NOTE: The lines numbers I provided are from the stock smali files in build 1.1.7. They will change as you make the edits. These will also change as MIUI makes changes. They are just there to help.
GlobalActions$SinglePressAction.smali
Code:
After the following code: (approx lines 14 - 17)
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x40a
name = "SinglePressAction"
.end annotation
Add the following code:
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
-----------------------------------------------------------------------
After the following code: (approx line 23)
.field private final mMessageResId:I
Add the following code:
# direct methods
.method static constructor <clinit>()V
.registers 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 Boot"
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
GlobalActions.smali
Code:
After the following code: (appox lines 416 - 420)
.method private createDialog()Landroid/app/AlertDialog;
.registers 12
.prologue
const/4 v10, 0x1
Remove the following code:
const/4 v9, 0x4
-----------------------------------------------------------------------
After the following code: (approx lines 488 - 490)
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mPrivacyModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v2, v0, v1
Add the following code:
const/4 v1, 0x1
---------
And change the following code:
iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v1, v0, v10
To the following code:
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v2, v0, v1
---------
It should look like this when you are done:
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mPrivacyModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v2, v0, v1
const/4 v1, 0x1
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v2, v0, v1
-----------------------------------------------------------------------
Change the following code from: (approx line 504)
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$4;
To the following code:
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$9;
-----------------------------------------------------------------------
Change the following code from: (approx line 510)
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$4;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
To the following code:
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$9;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
-----------------------------------------------------------------------
After the following code: (approx line 512)
aput-object v2, v0, v1
Add the following code:
const/4 v9, 0x4
-----------------------------------------------------------------------
Change the following code from: (approx line 590)
if-nez v0, :cond_bb
To the following code:
if-nez v0, :cond_bc
-----------------------------------------------------------------------
Change the following code from: (approx line 600)
:cond_bb
To the following code:
:cond_bc
Now all you have to do is compile android.policy.jar and place it in /system/framework.