yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Themes and Apps] kahvitahra:
Hi!

Yea, sure that is possible. Then you have to make strings for those to framework-res and make translates also to "all" languages. Then you just call that specified strings id from signlepressaction.smali. Title is in globalactions99.smali. You can see how "ok" and "cancel" buttons texts are called in $99.smali for example :)
[Galaxy S II Themes and Apps] coccolino_dbro:
Unfortunately I don't know anything about coding, and it shows (I managed to combine the mods by puting together bits and pieces from several related topics)... I tried this for example, in the singlepressaction.smali file:

replace

const/4 v1, 0x0
[B]const-string v2, "Reboot"[/B]
aput-object v2, v0, v1

with

const/4 v1, 0x0
[B]const v2, 0x1040513[/B]
aput-object v2, v0, v1

where the ID is the one assigned in public.xml (from framework-res) after recompile, for the reboot string.

Ofcourse it couldn't be simple as that :D ...it didn't work.

PS: I just noticed that the reboot options window is not visible if you try to use it with the screen locked, but after you unlock it, it's there. Default behaviour or just in my case?
[Galaxy S II Themes and Apps] kahvitahra:
About that PS. yes, i did notice that too, so it's not just you. Unwanted feature that is :).

You know that I'm not expert on coding ether. I just try things up, run logcats and google problems. Google and logcat are your friend :). I'm not sure how you should do that. But i think that you have to invoke that constant, then move result object to that v2. Or then again i might be totally wrong.. just guessing here.. lol
[Galaxy S II Themes and Apps] coccolino_dbro:
Status update: I have managed to make the title automatically localize, plus add an icon to it, by modifying this (in GlobalActions$99.smali):

.method public onPress()V
.registers 7

const/4 v5, 0x5

new-instance v1, Landroid/app/AlertDialog$Builder;

iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions$99;->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$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

move-result-object v2

invoke-direct {v1, v2}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

const-string v2, "Shutdown Method"

invoke-virtual {v1, v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

move-result-object v1

to this

.method public onPress()V
.registers 7

[B].prologue[/B]
const/4 v5, 0x5

new-instance v1, Landroid/app/AlertDialog$Builder;

iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions$9;->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$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;

move-result-object v2

invoke-direct {v1, v2}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

[B] const v2, 0x1080429 # reboot dialog icon ID from framework-res

invoke-virtual {v1, v2}, Landroid/app/AlertDialog$Builder;->setIcon(I)Landroid/app/AlertDialog$Builder;[/B]

[B] move-result-object v1

const v2, 0x1040512 # window title string ID from framework-res

invoke-virtual {v1, v2}, Landroid/app/AlertDialog$Builder;->setTitle(I)Landroid/app/AlertDialog$Builder;[/B]

move-result-object v1

Added a screenshot with the result.

As far as the submenu options go, I think I can't change to a resource ID because of this line

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

I'm thinking this sets the array type as string array, and it should be another type of array to accept resource IDs...
[Galaxy S II Themes and Apps] kahvitahra:
You might be right. That array list might have to be build different way. But since only thing it does here is it adds strings, then that type should do the trick. Otherwise you might have to rebuild that $99. But im sure youll find solution. Great work so far :)

That title was build that way, but i wanted to make it free from framework-res changes. Thats why i removed icon.
[Galaxy S II Themes and Apps] pfcsabre:
Nice mod, makes me want to dive into customizing ROMs again :D

If anyone wants the LPS version of samsung lockscreen with decrease home button lag and no Swipe Screen to Unlock text, with this mod, attached.
[Galaxy S II Themes and Apps] austrie:
Two lines have 4, change both to 99?
[Galaxy S II Themes and Apps] kahvitahra:
Yes, in gingerbread roms.
[Galaxy S II Themes and Apps] nitsuajd:
kahvitahra maybe you can help me...

I'm trying to do this to a Galaxy Nexus ICS 4.04 but don't work for me.

The first step in my case is add reboot option in GlobalActions (Native ICS don't have reboot option) this works fine, after get this I start work in change to get the 4 way reboot options

Therefore I was changed this...

new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$8;

const v2, 0x10805e4

const v3, 0x10404cb

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

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

to (The hex values are correct)

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

const v2, 0x10805e4

const v3, 0x10404cb

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

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

After this I add the static fields and the new constructor method to GlobalActions$SinglePressAction.smali

# static fields
.field protected static rebootMode:I

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

# instance fields
.field private final mIconResId:I

.field private final mMessageResId:I

# 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, "Reboot"

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, "Download"

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

After this I added the 3 files (99's) to my .smali folder (impl) but after compile and send files to phone, if I press the power button I can see the list with the new option, but if I touch the reboot option, the phone freezes... and go to bootanimation restarting the phone (yes the option works fine, the phone reboots... xD)

The error says method not found

E/AndroidRuntime( 5196): java.lang.NoSuchMethodError: com.android.internal.polic
y.impl.GlobalActions.access$000

But If I search in GlobalActions. smali the method exists...

Can you take a look and give me a hand please?

Thanks in advance

ps: I know, I need study english... I hope you can excuse me

ps2: The attached file includes, the logcat, GlobalActions and GlobalActions$SinglePressAction
[Galaxy S II Themes and Apps] kahvitahra:
Hi!

I can't open your .zip file. It might be corrupted. Can you upload again?

EDIT. Even thought you have that $000, you might have to look that it's right. It should be getter for this (called from $99):

Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
[Galaxy S II Themes and Apps] nitsuajd:
The previous attached file
[Galaxy S II Themes and Apps] kahvitahra:
Your .method static synthetic access$000 in globalactions.smali is

.method static synthetic access$000(Lcom/android/internal/policy/impl/GlobalActions;)Z
.locals 1

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

return v0
.end method

Right one would be $100

.method static synthetic access$100(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
.locals 1

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

return-object v0
.end method

So in those globalactions$99x files change lines that contains access$000 to access$100. I think there is 4 of them in all of those three files.
[Galaxy S II Themes and Apps] nitsuajd:
It works! thanks so much kahvitahra
[Galaxy S II Themes and Apps] nitsuajd:
Khavitahra, please just a last question. Is possible to change Hot Boot or Download reboot mode with Bootloader?

I've tried to do it but not seems to work...

I've changed in "singlepressaction" the value "Download" with "Bootloader" The menu shows the option correctly but only reboots ¿is needed any other change?

Thanks for your patience
[Galaxy S II Themes and Apps] kahvitahra:
I'm not sure. 4-way boot for miui that method was done like this.

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

const-string v2, "Droid"

sget-object v3, Landroid/os/Build;->MODEL:Ljava/lang/String;

invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-nez v2, :cond_3b

const-string v2, "GT-I9000"

sget-object v3, Landroid/os/Build;->MODEL:Ljava/lang/String;

invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-nez v2, :cond_3b

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, "GT-I9100"

sget-object v3, Landroid/os/Build;->MODEL:Ljava/lang/String;

invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v2

if-nez v2, :cond_2f

const-string v2, "Bootloader"

goto :goto_31

:cond_2f
const-string v2, "Download"

:goto_31
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;

goto :goto_4f

:cond_3b
const/4 v0, 0x3

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, "Recovery"

aput-object v2, v0, v1

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

:goto_4f
return-void
.end method

So that string was only thing iirc what was changed. But it can be that your phone needs some else changes also. can't tell.
[Galaxy S II Themes and Apps] nitsuajd:
Thanks for fast reply, i'll continue searching...

Edit: Using constructor method from miui works fine... thanks again
[Galaxy S II Themes and Apps] sept20:
so finally did you guys figure out how to translate the 4 ways words into another language without rewrite the whole script?
[Galaxy S II Themes and Apps] creepyncrawly:
@kahvitahra,

Nice tutorial.

If you're still paying attention to this thread, I hope you could help me out a little bit. I have a little programming experience, but not on java or android. I wanted to start learning some of these things, so the other day I spent some time on your tutorial. I learned how to use smali and baksmali for jar files, and how to use apk multi-tools to decompile and recompile apk's. I tried to make your MOD work on my phone which is AT&T SGS2, I777 running the AT&T ICS leak UCLD3, but so far I've been unsuccessfull. I figured that the code will be pretty similar between the two phones. I followed the instructions in post #13. Here's what I have done so far:

Decompile android.policy.jar and add the three smali files from link in OP.

"In file "GlobalActions$99.smali" there is id 0x1110008" -- so I looked in public.xml from my framework-res.apk and find that the code there is 0x01110008. If I understand hex notation correctly, that should be identical, but I change the notation in GlobalActions$99.smali to add the leading 0.

I changed "new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$6;" to "new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;" in GlobalActions.smali.

In "GlobalActions$SinglePressAction.smali" I added the "# static fields" and the additional method under "# direct methods".

Recompiled and replaced android.policy.jar. The phone boots fine, and runs fine in all respects I can see, except when you long press the power button, the power menu does not appear. You get the brief haptic feedback but nothing appears, and you have to reboot the phone because it will no longer take input.

On our phone the power menu has only 4 items:

It is missing the data toggle. So I reasoned that the correct line might be the one ending in 5. I tried replacing the 5 with 99 and putting the 6 back on the other line. This gave exactly the same results, however.

In your instruction you say: "some roms might have different number on reboot button. You find right one by for example tracking mRestart. See example below." However, I don't see which example you are referring to, and I don't have enough background to follow through and determine the correct line for the reboot button.

Further, I don't know for sure if your mod should work on this phone, although it seems logical that it should. Could you give me a little assistance with this?

I know it's probably about midnight where you live. I'm in the eastern time zone of the USA, so I'm not expecting an answer immediately.

Thanks in advance.
[Galaxy S II Themes and Apps] kahvitahra:
Hello!

That id you should change back, because when you look at id's at public.xml then those all are 0x0xxxxx something, but in smali you remove that first 0 after x.

If you search line "mrestart" from globalactions.smali does that give any results? If yes, then there is invoked some numbered globalactions files before there is put to that mrestart. Remember that you have to change two numbers, there are few lines between these, but look at my example and you get the picture.

If you dont have that "mrestart" then you can look trought those numbered golabalactions$1/2/3 etc. smali files and search for word "reboot" ( not sure about this in your phone ). One that contains that word should be right number to change in globalactions.smali.

Hope this helped a little.
[Galaxy S II Themes and Apps] creepyncrawly:
My error was that I didn't replace both instances of $6 with $99.

I reinstalled UCLD3 on my phone, because putting the damaged android.policy.jar on the phone caused some persistent problems, even after I replaced the original stock android.policy.jar.

I started with a new stock android.policy.jar and redid the whole project. It worked this time, since I replaced both lines, but the result is wrong.

On the stock UCLD3, pressing restart from the device options menu produces this submenu:

However, with the modified android.policy.jar installed, pressing restart from the device options menu produces this submenu:

The four mod options are missing for some reason.

Tried tracing through the code, but I don't know enough yet to follow it through.

I'm also getting this pesky issue with the modified android.policy.jar installed: every time the phone restarts, it gives the "Android is upgrading... Optomizing applications (1 to 45) of 45" dialog while it rebuilds dalvik or something.

Any suggestions?
[Galaxy S II Themes and Apps] kahvitahra:
If you have everything correct in singlepressaction, then it can be that some call isnt correct.

I would guess that first one since that array is build in that singlepressaction.smali. Have you looked up logcat, that is there any error that could help?

And that dalvik-cache is reboild everytime you push/flas new framework file. It should only do that once after flash.
[Galaxy S II Themes and Apps] brolee93:
Edit : I have galaxy note in ICS version samsung ZLP6

I have same probleme ...

Can you help us ?
[Galaxy S II Themes and Apps] kahvitahra:
I wont be at home for few days. If you send baksmalid .dexs, then i could take a look with phone. Maybe there is some simple fix for that, cant just quess it right now.

But same question to you, if you take logcat after pressed that restart is there any error?

EDIT. I did get it baksmalid with while i was on other pc... By quick look atleast your ids for those positive and negative buttons are wrong. in globalactions$99 id "const v2, 0x104000a" should be "const v2, 0x1040013" and the other one "const/high16 v2, 0x104" should be "const v2, 0x1040009"

Not sure would this cause that, but you should try.
[Galaxy S II Themes and Apps] chudy_85:
problem witch this mod

hi i use your tutorial and do it evryfing that same as ics on lps android.police.jar and i have that same problem in 44 post

can you now how help me???

thx for this tutorial good work
[Galaxy S II Themes and Apps] brolee93:
i go to test thanks for reply bro

HUm not work when i recompile i have error grr have you other idea ?
[Galaxy S II Themes and Apps] creepyncrawly:
There don't appear to be any errors in the logcat. Look at logcat2.txt to see it. I made it by adb: clear log (adb logcat -c) --> start logging --> long press power button --> touch restart --> touch OK --> stop logging.

Here are the relevant smali files if you want to take a look at them.
[Galaxy S II Themes and Apps] customr:
I think there is an error on ICS release.

GlobalActions$99$1.smali:

.line 291
:cond_1b
:goto_1b
return-void

alse it seems that there is ":goto_18" without ":cond_27", at least i cant see.

see atached zip for working GlobalActions$99 (tested on ICS LP8).
[Galaxy S II Themes and Apps] kahvitahra:
If this lps is for sgs2 then i take a look at it sunday and hopefully can reprocedure that error. Then maybe get answer to that error.

if you have error recompiling, then you did something wrong. Spot what it is and change it. Those ids you should check. There can be that there is something else in this, since all of you who have that error have glabalactions build same way. I have couple of things in mind what to try when im home and hopefully can reprocedure that. Too complicated to trying to write ideas with phone here :)

you also have those ids wrong, like mate what i quoted previously. You should also check correct ids and tell does that have any effect. If not then there might be needed some changes in globalactions$99.

All those are correct in those sources i shared. Even thought they would not be, then smali gives error.
[Galaxy S II Themes and Apps] brolee93:
hum i dont understand can you explain me what should I do now for work lol ?

Okay I wait that you are at home to help me Thanks
[Galaxy S II Themes and Apps] kahvitahra:
Yea, but i mean that if smaling gives you an error, then there is something wrong with changes you made. It also gives you line number where error is. You should try (if you will)with those correct ids since your framework have different ids than mine.
[Galaxy S II Themes and Apps] brolee93:
hum i decompile my framework-res.apk and look in VALUES/public.xml ?
[Galaxy S II Themes and Apps] brolee93:
In public.xml i have this :0x01110008 but in your file smali99 it is 0x1110008 ?

It is serious problem ?
[Galaxy S II Themes and Apps] kahvitahra:
No :) you remove that leading zero when its called from smali ( so when you copy resource id from smali and search it from puplic.xml, then you have to add that 0). What i mean by checking that ids are correct is that you take my framework-res.apks public.xml ( i cant send it now, but dl some lp8 rom from sgs2 section )and see where those ids point at. Then correct values that is wrong for your framework to smali code.

Those two ids for buttons i mentioned earlier are atleast wrong. I did post right ones also, but you can check that those where right.
[Galaxy S II Themes and Apps] creepyncrawly:
I assume you mean this:

I made those two changes in globalactions$99 but still get same result as shown in post #44.

Here's current globalactions99.7z for a look.
[Galaxy S II Themes and Apps] wisefreakz:
Hi Guys.... maybe someone can help me.

I own a GNex and using a barely stock rom.

I tried follow step by step and first i found a difference in the code:

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

and had to add the INIT

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

The Gnex does not have a RESTART option, so instead of changing the $6 to $99 i have added the whole thing.

The rest followed as expect. The phones reboots normally but when i long press the power button, the phone restars as a hot reboot.

Logcat shows nothing... any hint from the masters?

Thanks in advance.
[Galaxy S II Themes and Apps] chudy_85:
mod lps

hi

i do it this mod for lps here you have if you want

link ---> http://xdaforums.com/showthread.php?t=1624935

thx for tutorial
[Galaxy S II Themes and Apps] kahvitahra:
If you add that then remember to add image and string to framework-res. I would suggest that you do that like in tutorial for gb version where you change power off button. That way you dont have to add nothing to framework.

Thanks.

For guys who have same problem, please tell what you did differently. That way everyone will learn.
[Galaxy S II Themes and Apps] wisefreakz:
I tried both... will restart from scratch... and let u know.

Tks

My globalaction and single pressaction files are a bit different than yours...
[Galaxy S II Themes and Apps] chudy_85:
so i change

hello

I did everything the same as in the tutorial but the only thing that changed the files GlobalActions$99, GlobalActions$99$1, GlobalActions$99$2 from mod lp7 / 8 and your tutorial is one space between the lines and should be two

I add screenshots

http://www.imgshare.pl/view.php?id=47YN

http://www.imgshare.pl/view.php?id=8CVX

When you copy text from your tutoralu tu smali it created a one space lock your screenshot

http://www.imgshare.pl/view.php?id=5SZD

Now compare my two of your screen and you'll see that in your lack of a space

I greet all
[Galaxy S II Themes and Apps] kahvitahra:
Hmm, so it seams. I did not notice that. I edited tutorial now. Thanks.
[Galaxy S II Themes and Apps] wisefreakz:
No deal my friends.. i'm adding my GlobalActions.smali and GlobalActions$SinglePressAction. smali to see if someone can tell what my problem could be.

These files are the stock one.

Appreciate every single help.

Thanks
[Galaxy S II Themes and Apps] kahvitahra:
Have you checked that ids match? If you phone hot boots when you try to show powermenu then logcat will give error.

Edit. What is the number for you shutdown buttons smali file? Some of those have been called from construction method.
[Galaxy S II Themes and Apps] wisefreakz:
Shutdown ID is:

const v2, 0x1080030

const v3, 0x104012f (Only this ID is different but i also keep it when doing the changes)

same as your post
[Galaxy S II Themes and Apps] ZduneX25:
Oh i started to think more and just found values i was overlooking ::)

edit: doesn't work with aosp ics rom i did everything right, it wasn't my first time adding x-ways reboot
[Galaxy S II Themes and Apps] kahvitahra:
What do you mean exactly? Some error in log or what does it do?
[Galaxy S II Themes and Apps] ZduneX25:
Nothing changed :p in power menu.

I already added rebot option in the different way.
[Galaxy S II Themes and Apps] kahvitahra:
Hmmh. Can't be possible, because if you make android.policy to call different file than original, then there is no way that it will be same as it was before. But good that you got it other way around.
[Galaxy S II Themes and Apps] ZduneX25:
I know right, but got it and it works:

download mode and recovery never work with xperia phones since we have recovery placed in kernel, so i just needed reboot option
[Galaxy S II Themes and Apps] kahvitahra:
Aah, ok :)