yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Themes and Apps] rcade2005:
@kahvitahra

Hery buddy, everything worked fine but i face Google play store force close now. Any idea on how to fix it?

---------- Post added at 11:33 PM ---------- Previous post was at 10:57 PM ----------

fixed playstore issue by re-flashing the app
[Galaxy S II Themes and Apps] hacbaoklhh:
Flash recovery??

9100g teamxd rom not working
[Galaxy S II Themes and Apps] kahvitahra:
Hi!

You should remove following code

const/4 v1, 0x2

const-string v2, "Download"

aput-object v2, v0, v1

Then you should change those const/4 numbers to look like following

.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, "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;

return-void
.end method

This way it should work.
[Galaxy S II Themes and Apps] EvilKing009:
I have a question,

i cannot find that line in my smali

On ICS.So should i skip this step or just add him into that ? :confused:
[Galaxy S II Themes and Apps] kahvitahra:
Hi!

I'm not 100% sure do I understand what you mean. Do you find "mRestart" from your globalactions? If you do, then that one is is the correct "number" that you should change to "$99". You can also attach here your globalactions files so I can take a look.
[Galaxy S II Themes and Apps] klemenSLO:
succesfully applied :)

I succesfully applied your mod to stock XWLSJ rom.

I had some trouble compiling back the android.policy file. (error mentioned in post #150)

Works great :)

thanks for you work.
[Galaxy S II Themes and Apps] cleverior.ipul:
Thank u very much bro ! Its works !! :good:
[Galaxy S II Themes and Apps] cleverior.ipul:
deleted :D
[Galaxy S II Themes and Apps] citymen34:
hi bro. it is possible change to translate Turkish ps,

Reboot Mode = Yeniden Baslatma

Reboot = Yeniden Baslat

Hot Boot = Hizli Baslat

Download = Download Modu

Recovery = Kurtarma Modu

İ changed but recovery mode dont work. phone only restarted.

please hepl me.. thanks.
[Galaxy S II Themes and Apps] cleverior.ipul:
just change the code with this

.method static constructor ()V
.registers 3

const/4 v0, 0x5

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

const/4 v1, 0x0

const-string v2, "Yeniden Baslat"

aput-object v2, v0, v1

const/4 v1, 0x1

const-string v2, "Hizli Baslat"

aput-object v2, v0, v1

const/4 v1, 0x2

const-string v2, "Download Modu"

aput-object v2, v0, v1

const/4 v1, 0x3

const-string v2, "Kurtarma Modu"

aput-object v2, v0, v1

const/4 v1, 0x4

const-string v2, "Shutdown"

aput-object v2, v0, v1

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

return-void
.end method
[Galaxy S II Themes and Apps] nik93:
NIce work!
[Galaxy S II Themes and Apps] cleverior.ipul:
Sir kahvitahra ..

how code that is correct if I just want to add a "hot boot" and "recovery" menu on shutdown method ?

i've try change the code with this

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

const/4 v0, 0x2

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

const/4 v1, 0x0

const-string v2, "Hot Boot"

aput-object v2, v0, v1

const/4 v1, 0x1

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

but it doesnt work.
[Galaxy S II Themes and Apps] kahvitahra:
Sorry. I have not noticed new posts in this thread.

I think that problem with that is, that you should not change hot boot and recovery const/4 values. globalactions99$1 monitors those values and it would not work if you change those.

You could just try to remove unwanted lines like you did above, but not to change values of those left two arrays.

So it would be like

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

const/4 v0, 0x2

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

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;

return-void
.end method

I'm not 100% sure will this work.. If it does not, then I suggest you leave that reboot also in that menu ;)
[Galaxy S II Themes and Apps] Tsjoklat:
I have been trying to get this working with my ROM (Android 4.1.2 P3110XXDMA2_P3110ITVDMB1_ITV) but I can't seem to figure it out. The code seems to be different in my android.policy.jar. The main conflict I am finding is when I must edit GlobalActions.smali. There is already a direct method (method static constructor <clinit>()V) in GlobalActions.smali that conflicts with the new direct method. If anyone could tell me whats wrong, I would be appreciative.

Attached is a patch i just created with my changes so far. Also, I have provided an original unchanged copy of android.policy.jar from my ROM, as an example.

Best Regards.

Edit: Got it working. I needed to add the method to GlobalActions$SinglePressAction.smali (not GlobalActions.smali). Attached is the working patch (4wayreboot.jb4.1.2-2.diff).
[Galaxy S II Themes and Apps] dolar4ik:
Hello guys.

How it`s going with translatable strings?

Looks like we need to use something like this:

const v3, 0x1040407

invoke-virtual {v2, v3}, Landroid/content/Context;->getText(I)Ljava/lang/CharSequence;

move-result-object v2
[Galaxy S II Themes and Apps] 7OH:
As I can done it once - you need to LOAD STRING-ARRAY from resources.

Android translate it for you if resources contain string for your location or return english.
[Galaxy S II Themes and Apps] dolar4ik:
Hm. Can you provide some simple example?

P.S. Привет замляк :)
[Galaxy S II Themes and Apps] 7OH:
miui4 \ android.policy.jar (from m7Parts patch) \ MiuiGlobalActions.smali and other - you can find by keywork m7RebootArray

const-string v6, "rebootArray"

const-string v7, "array"

const-string v8, "pavlyukoff.m7Parts"

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

move-result v3

.line 85
.local v3, resID:I
invoke-virtual {v4, v3}, Landroid/content/res/Resources;->[B]getStringArray[/B](I)[Ljava/lang/String;
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

move-result-object v5

.line 89
.end local v1 #manager:Landroid/content/pm/PackageManager;
.end local v2 #packName:Ljava/lang/String;
.end local v3 #resID:I
.end local v4 #resources:Landroid/content/res/Resources;
:goto_0
iput-object v5, p0, Lcom/android/internal/policy/impl/MiuiGlobalActions;->m7RebootArray:[Ljava/lang/String;

And than this m7RebootArray loaded instead of static array

In MIUI i'm load that array from OWN app - if put it to system framework - it will be better.

p.s.: Привет-привет. помогаю, чем могу - я эту фишку предлагал для miuiaustralia ещё год назад - проигнорировали.
[Galaxy S II Themes and Apps] dolar4ik:
Can you describe it a bit? I will move settings array to framework, of course.
[Galaxy S II Themes and Apps] 7OH:
You must add link to array-string to public.xml (all hex values is mine...)

<public type="array" name="rebootArray" id="0x7f05000c" />

to arrays.xml

- <string-array name="rebootArray">

<item>Reboot</item>

<item>Quick</item>

<item>Recovery</item>

<item>Bootloader</item>

</string-array>

in every needed language add to arrays.xml translated strings too

<string-array name="rebootArray">

<item>Обычно</item>

<item>Быстро</item>

<item>Рекавери</item>

<item>Загрузчик</item>

</string-array>

then in global action you call (java code)

String[] sa = resources.getStringArray(resID); <-- this need to be translate to smali

and this array you put to item of dialog
[Galaxy S II Themes and Apps] Moscow Desire:
Hey,

For my A701 JB, your steps worked great,

However, for my A501 ICS, at the first step in globalActions.smali I have this;

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

const v2, 0x1080030

const v3, 0x1040166

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

Now, I changed to $99, and the other steps.

However, I still get the normal shutdown.

So basically, it seems the shutdown doesn't get called from there for the Acer. No errors, so logcat doesn't help.

In PhoneWindowManager.smali, I see this;

Framework ID's seem to be ok.

Any thoughts?

MD
[Galaxy S II Themes and Apps] kahvitahra:
Hi!

I haven't been around here for a while. Sorry.

So, you don' t have any power menu at all? When you long press power button you just get dialog with "ok" and "cancel" buttons to shutdown your phone? Is this right?

If this is your case then there is solution to that. PowerMenu can be enabled to all android devices. I will post how to achive that when I get back to my computer. Can't remember that now.

If you have any other kind of problem, then it would be great if you would attach your android.policy here, so I could take a look, when I got spare time.
[Galaxy S II Themes and Apps] Moscow Desire:
Well, it gives me the standard shutdown menu like always. The Cancel and OK buttons. It's just that selecting the OK doesn't bring up the additional 4 way menu. It's like it totally ignores any of the changes. With JB on the Acer701, the shutdown menu works as it should in your original post. This is what puzzles me, as most of the smali's in ICS, are almost identical to what is in JB.

The "stock message" is the usual dialog after Long Press on PWR, " POWER OFF, Would you like to shut down tablet? CANCEL and OK buttons.

Things I have tried;

a. Creating an id and string in framework to call the reboot options. Result is still the same. Probably maybe I missed something.

b. Used the method by tornade69, and checked "config_longPressOnPowerBehavior" to 1" but it is already at 1.

I'll attach android.policy.jar and framework-res.

Thanks for looking into this.

MD
[Galaxy S II Themes and Apps] kiotu:
Download mode not working

Hi, been able to show the reboot option menu, everything else working except for download option (supposed to boot to bootloader menu), any idea where to look for changes in script?

Edit: nevermind, missed previous posts..tq
[Galaxy S II Themes and Apps] HASSAN EL BAGHDADI:
Thank you :cool:
[Galaxy S II Themes and Apps] Unknownforce:
I'm trying to set this up in a ROM on a Sprint Galaxy S4 and I got it to show the menu correctly, and the OK/Cancel buttons work, but no matter what option I select, the device simply hot restarts.

I've updated the access$XXX (This should be for the below code, correct?)

.method static synthetic access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
.registers 2
.parameter "x0"

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

return-object v0
.end method

I've also updated the ID's based on the public.xml extracted from the ROM's framework-res.apk. OK and cancel are the same as the id's that are in the included files, so no change needed there, but I did have to change the config_sf_slowBlur to 0x111000f, as that's the id in my public.xml:

<public type="bool" name="config_sf_slowBlur" id="0x0111000f" />

Everything is in the correct locations as described, And like I said, the menus themselves show up and work as intended, but just every option just hot boots instead of what I select.

Any ideas?

Edit: Did a logcat of it...

E/AndroidRuntime(10737): java.lang.NoClassDefFoundError: com.android.server.pm.ShutdownThread
E/AndroidRuntime(10737): at com.android.internal.policy.impl.GlobalActions$99$1.onClick(GlobalActions.java:284)
E/AndroidRuntime(10737): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:185)
E/AndroidRuntime(10737): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(10737): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(10737): at android.os.HandlerThread.run(HandlerThread.java:60)

Looks like ShutdownThread was moved again... How do I find where this is now?
[Galaxy S II Themes and Apps] kahvitahra:
Hi!

Yes, everything else looks correct, but that ShutdownThread seams to be moved again. You might just have to baksmali some files and search for that. It's in some file that is in boothclasspath. For JB it was in services.jar and for ICS it was in framework.jar, so I would look for those first.

I downloaded your rom and searched for ShutdownThread. correct path is Lcom/android/server/power/ShutdownThread. It was in Services.jar. There is two lines in $99$1.smali with call for ShutdownThread, so change those ( Yea, I know you knew this already ;) )

Great to see deving on S4 already! How is it?
[Galaxy S II Themes and Apps] Unknownforce:
Awesome, thanks for finding that! Works perfect now!

The S4 is a sweet phone, I've never done ROM development before, so this is my first run at it. I love figuring stuff out like this. ;)

If you don't mind my asking, where did you look to find it?
[Galaxy S II Themes and Apps] kahvitahra:
No problem, great that it works :)

I did get hands on that phone today and it surely have some great functions, like that "eye following".

Nothing fancy on finding that. Just baksmalid services.jar and used windows search to locate ShutdownThread.smali :)
[Galaxy S II Themes and Apps] Moscow Desire:
And so an update to what Kahvithra and I have been working on.

Case: Acer A500/501 ICS 4.0.4

We got to the point where we could call the alternate menu by doing this;

PhoneWinowsManager$3.smali

PhoneWindowManager$3.smali you'll find code (with Notepad++ or VTS (Virtual Ten Studio by XDA Diamondback)

:pswitch_data_0
.packed-switch 0x0
:pswitch_0
:pswitch_1
:pswitch_2
.end packed-switch

Change it to this:

:pswitch_data_0
.packed-switch 0x0
:pswitch_0
:pswitch_2
:pswitch_1
.end packed-switch

This should give you a different menu. It did with the Acer 4.0.4

Then in $99.smali, change the $000 to $100. There should be 4 of them.

Follow the steps in the OP.

Hope this helps.

Any 500/501 users, here is android.policy.jar

MD
[Galaxy S II Themes and Apps] Moscow Desire:
Well, I will speak for him, as he may not be online.

What we looked for, is Long_Press_Power_Button

or Long_Press_Power_Button_Behavior

It could be a little different in yours.

However, eventually we found it in Services.jar All shutdownThreads will be located in the primary system jars or apk's. More than likely in the jar files.

We actually had to change the Lcom path, to eventually narrow down the issue, this helped in logcat txts to find the core issue.

After that, we changed the path to the shutdown thread in the 99 smali files (We changed earlier to find the issues)

MD
[Galaxy S II Themes and Apps] Anthrax:
will this work with Xperia's JB?????
[Galaxy S II Themes and Apps] kahvitahra:
This mod can be done to any phone. It just might need some "tuning". Try following steps and see how it goes. In this thread is a lot of solutions to common problems.
[Galaxy S II Themes and Apps] Anthrax:
tried with this method but no use...... after pushing the .jar file and rebooting device i get FC's of lots of apps...... logcat attached....

EDIT: my mistake was not to set permissions for the modified jar....... :p

now its working but the problem is when i long press power button it directly reboots..... without any display or anything.......log cat and modified .jar files attached...
[Galaxy S II Themes and Apps] kahvitahra:
There is no error in that logcat. You need to start logging before pushing that button.

I bet that your problem is ether wrong id, or wrong path for calling mContext. All these i explained in this thread. You should check for those first.

I just realized that you said you get error after pushing button, so those I said above does not match to that situation. I decompiled your .jar. You did not change lines globalactions$2 to $99 in globalactions, like in how to. You have to look for that logcat for what is wrong.

EDIT2. You changed wrong lines to $99, lines to change are in globalactions.smali. I'll bet you see it after read that tutorial again :)
[Galaxy S II Themes and Apps] hlxanthus:
I am trying to do this for the GS2 Epic 4G Touch on the JB GB27. I get everything to compile correctly, but refuses to boot (which makes it hard to figure out the culprit. I did have to change the config_sf_softBlur hex code, and that was it there. Then I was easily able to drop in the code you reference in your guide. If you have a few minutes would you mind taking a look and seeing what I might have done wrong? I think I gave you everything here you could need

https://dl.dropboxusercontent.com/u/35358768/E4GT_GB27_files.zip
[Galaxy S II Themes and Apps] BoriKing:
Here you go GB27-Extended-Power-Menu flash via recovery.

Always,Always MAKE A BACKUP before you make any changes to your device
[Galaxy S II Themes and Apps] kahvitahra:
I don't think you done nothing wrong in code changes. If you get hang on boot, your compiled android.policy might be damaged, so maybe it's tool failure in compiling. I recommend using baksmali/smali for smali changes.
[Galaxy S II Themes and Apps] hlxanthus:
Awesome, thanks!! Of course that booted perfectly. I flashed this in first thing this morning and worked perfectly.

Well, after flashing in BoriKing's package above (just seeing it was working) I had to get my own working too. So I did as you suggested and just used smali/baksmali and it booted this time but hitting the restart button from the power menu just hot booted the device. I have to jet to work, but a quick compare of my files and BoriKing's files came up the same so I am not quite sure where I am going wrong. I will play more with it this evening.
[Galaxy S II Themes and Apps] BoriKing:
There was nothing wrong on your files but a bad compiling.
[Galaxy S II Themes and Apps] hlxanthus:
I tried updating all my tools (smali/baksmali, aapt, etc) but I still was having issues. Returned my tools to the versions I had before, rebooted my pc and started from scratch. And now it works. Anyway, got it all working!! Thanks a lot for all the support, and these excellent guides
[Galaxy S II Themes and Apps] BIBISIAH:
Thank You :good::good::good:
[Galaxy S II Themes and Apps] mrvirginia:
[MENTION=3076446]kahvitahra[/MENTION] thank you, my friend. i still refer to your mods :)
[Galaxy S II Themes and Apps] kahvitahra:
Good to see you, mate! Long time since chatting :)
[Galaxy S II Themes and Apps] mrvirginia:
yeah dude, long time indeed! will PM you.
[Galaxy S II Themes and Apps] zalzondabuzz:
Tried on my ICS tablet...

but does'nt work...

any one can help me? :rolleyes:
[Galaxy S II Themes and Apps] blackbeard:
hey i tried the same on my galaxy y gt-s5360, but i want to remove the hotboot option. how can i do that? please help
[Galaxy S II Themes and Apps] remuntada78:
the value in my public.xml for conf_sf_slowBlur is 0x1110009, I have to change the value in GlobalActions$99.smali?
[Galaxy S II Themes and Apps] h3llrais3r:
Thanks for the greate howto. I've just applied it on my GT-I8160 and it works great.

I've just followed the howto and it worked out of the box. :good:
[Galaxy S II Themes and Apps] jj one:
Where can I find a flashable file to install the 4 way reboot mod? I'm not able to decompile and recompile...

I'm on a 4.1.2 LSW stock odex rom rooted
[Galaxy S II Themes and Apps] Goldie:
I doubt you will find that. Especially for odexed. The idea of this thread is you learn a bit and do it yourself ;p
[Galaxy S II Themes and Apps] friedrich420:
Thank you so much for this!!

Works perfectly on I9505 MGA FIRMWARE (more specifically the Echoe Rom) :good:
[Galaxy S II Themes and Apps] Codename13:
I've been having trouble modifying my android.policy.jar on the latest firmware for my Galaxy Ace II X (a single sim variant of the Galaxy S Duos), which has ICS 4.0.4, unlike the Galaxy Ace 2 which has JB. On older versions of my device's firmware, this modification worked perfectly. But on this newest firmware build, when I hold down the power button to get to the power menu, the device just freezes up and seems to soft reboot several moments later. It would be much appreciated if somebody could modify my android.policy.jar to get it to work. Attached is the stock android.policy.jar (deodexed).
[Galaxy S II Themes and Apps] Darkman:
Hi!

I Work on a 4-Way Reboot MOD for the Samsung S4 Active (GT-I9295) but i get it not to work...

First i have make all like this TUT : http://xdaforums.com/showpost.php?p=38379872&postcount=184&nocache=1&z=9034375899937004

config_sf_slowBlur = 0x111000f

0x104000a = "ok"

0x104 = "cancel"

GlobalActions$5 is for Restart ...

Then i make all changes....

After recombile and flash if i push the On/Off Button nothing work ... no FC no reboot... no Display on Off...

So after check the ShutdownThread folder you wrote below i found that the same like the S4 (I9505) i must change the path to Lcom/android/server/power/ShutdownThread

Now i recombile and flash it again ...

If i push now the On/Off Button short press the Display gets on or off nice... but if i press longer for the Shutdown Menu the System freez a few seconds and the it gives a softboot / hotboot without reinput the SIM PIN. ... i can not see any Shutdown Menu or Reboot Menu

So now i stuck on it :( i have make a LogCat but i not confirmed with it...

I Hope you can help me....

This: I9295-Darkman-ORG.zip are the Original Files from my ROM (4.2.2 Samsung TW based deodexed)

This is my Logcat: I9295-Darkman-Logcat.txt

And this is my MOD how not works: 4WayBoot-I9295-Darkman-V1.0.zip

The Permission of the android.policy.jar set it right (rw-r--r--) ...

Hope you or any other can help me :eek:
[Galaxy S II Themes and Apps] :
I searched for public.xml and/or config_sf_slowBlur, but without success. Can you guide me where to find it. The basic values don't seem to fit for Galaxy Tab 3.

Edit: it was 0x1110009 that worked!
[Galaxy S II Themes and Apps] devilex94:
kahvitahra thanks for this mod. But i want to remove the hot reboot and replace the download mode with fastboot mod (or remove download mode as well).Help me :)
[Galaxy S II Themes and Apps] charles1111:
i followed your guide for ics roms and what i got was this

http://www.youtube.com/watch?v=KarP_a88TbE&feature=youtube_gdata_player

i followed all minor things..

plz help..

---------- Post added at 09:41 AM ---------- Previous post was at 09:41 AM ----------

i followed your guide for ics roms and what i got was this

http://www.youtube.com/watch?v=KarP_a88TbE&feature=youtube_gdata_player

i followed all minor things..

plz help..
[Galaxy S II Themes and Apps] Goldie:
Log it.... ;)
[Galaxy S II Themes and Apps] charles1111:
Ok
[Galaxy S II Themes and Apps] charles1111:
here is the log cat
[Galaxy S II Themes and Apps] Goldie:
Self explanatory....

*** FATAL EXCEPTION IN SYSTEM PROCESS: WindowManagerPolicy

java.lang.NoSuchMethodError: com.android.internal.policy.impl.GlobalActions.access$000

at com.android.internal.policy.impl.GlobalActions$99$1.onClick(GlobalActions.java:284)
[Galaxy S II Themes and Apps] charles1111:
yes but now what shall i do to resolve this issue
[Galaxy S II Themes and Apps] Darkman:
No one any Idea for 4-Way Mod get it running on S4 / S4 Active?
[Galaxy S II Themes and Apps] icedventimocha:
Thanks for this, worked perfect :)
[Galaxy S II Themes and Apps] android.zealot.fervor:
Can someone make it SAmsung galaxy s II plus i9105p ?
[Galaxy S II Themes and Apps] xdadroidabc:
Can anyone please help?

here attached decompiled android.policy and public.xml

I have edited as per said here

http://xdaforums.com/showpost.php?p=38379872&postcount=184

Recompiled successfully but when pressing 'Restart' from power menu, I can not see any extended menu. No any other errors, except it takes just little time after to restart after pressing restart option.

Device N9000

Thanks in advance.