[Galaxy Tab 7.7 Android Development] mengpo:
Here is another tutorial which will teach you how to add a powermenu to your stock rom ICS for the P6810 only.

Sources:

http://xdaforums.com/showthread.php?t=1805408

http://xdaforums.com/showthread.php?t=1208320

http://xdaforums.com/showthread.php?t=1801137

Files:

http://www.mediafire.com/?46ta4oa6woe923d,8pcaw7edzd4isk0,8n0ibr7b0127zm5

Step 0: Requirements

Java JRE, JDE and notepad++;

apktool, aapt.exe and autosign (attached in this thread) for editing framework-res.apk;

smali, baksmali;

a framework-res.apk for your device;

an android.policy.jar for your device.

Step 1: Editing framework-res.apk

Create a folder decompiling where you can put all the files.

First decompile the framework-res.apk :

open a terminal (cmd) and type

java -jar apktool.jar d framework-res.apk framework-res

you'll have a framework-res folder.

Go to

\Decompiling\framework-res\res\values\

Edit with notepad++ strings.xml and add this line

<string name="reboot_title">Reboot Options</string>

at the very end and before

sources>

then open public.xml and add this line :

<public type="string" name="reboot_title" id="0x01040695" />

The id must be the highest number of the whole file and of course must be unique.

When finished, you have to recompile it :

apktool b framework-res framework-res.apk

Then copy this file into the autosign folder and launch sign.bat

The framework-res.apk must be the only apk file !

Now you're done with this file.

Step 2: Editing android.policy.jar

open a terminal (cmd) and type

java -Xmx512m -jar baksmali.jar android.policy.jar

If everything's ok, you'll have an "out" subfolder. Go to

\out\com\android\internal\policy\impl

copy the three files : GlobalActions$99$1.smali, GlobalActions$99$2.smali, GlobalActions$99.smali. into it.

In file "GlobalActions$99.smali" there is id 0x1110008, you might want to check that this id is same in you roms public.xml (config_sf_slowBlur ). Check also that ids 0x104000a = "ok" -string and 0x104 = "cancel" -string matches in your framework.

Edit with notepad++ GlobalActions.smali

-Search mRestart and check these lines just before mRestart

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

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

the 5 could be different so just be sure to have the same line.

-Change number 6 to 99 (both of them) :

new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;

invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$99;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

Now edit with notepad++ GlobalActions$SinglePressAction.smali

-Before line "# instance fields"

paste following code :

# static fields
.field protected static rebootMode:I

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

Then after line "# direct methods"

paste following code :

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

const/4 v0, 0x3

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

const/4 v1, 0x0

const-string v2, "Reboot"

aput-object v2, v0, v1

const/4 v1, 0x1

const-string v2, "Recovery"

aput-object v2, v0, v1

const/4 v1, 0x2

const-string v2, "Download"

aput-object v2, v0, v1

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

return-void
.end method

Compile your jar :

java -Xmx512m -jar smali.jar out -o classes.dex

You'll obtain a classes.dex file. Open your android.policy.jar original and replace the classes.dex by the new one.

Now you're done !

I put the final work attached to this thread with the other files so you can test it. ;)

Maybe there's another way to do this so feel free to leave comments :)

Good luck !