yashsingh1/xdaforums huggingface dataset:
[Vibrant Android Development] ImSherlocked:
Hi thanks for the guide, but I'm struggling with getting this to work on Gingerbread ROM.

I couldn't find this path/file: com\android\internal\app\ShutdownThread.smali .

Also what option to choose when compiling framework?

Is this system APK? I chose yes

And if you would like to copy other files....? I chose no.
[Vibrant Android Development] distan7:
There are several files :

framework-res.apk

framework.jar

android.policy.jar

don't confuse the framework-res.apk with framework.jar

Sent from my Samsung Galaxy Mini S5570 running Andro-ID Gingerbread 2.3.3 by tj_style
[Vibrant Android Development] ImSherlocked:
Thanks for reply.

So I just have to put these files in "place-apk-here-for-modding" folder of apk manager and decompile, right?

Will these .jar files also get decompiled?

Also which decompile option should I choose out of following?
[Vibrant Android Development] Br1cK'd:
Apk manager will only work for apks. In order to decompile the .jar files, you need to open the archive with 7zip, and drag the classes.dex to your sdk/tools folder. You also need the smali and baksmali commands in your tools folder, and run those commands against the classes.dex in order to decompile and then recompile it. Im not at my pc right now or Id offer clearer steps and links. If you search, google even, decompile classes.dex, you will find the java commands (smali and baksmali) and detailed instructions on what you need to do. There is also a thread here in the Vibrant section, started by Jellette I beleive, that gives instructions for the smali and baksmali steps. I think Jellette even created a script to do it for you. If memory serves correctly, the thread containing those scripts should be titled "2.2.1 Dev Tips" or something like that, but dont be thrown off by the 2.2.1 designation, its the same for GB.

Use option 9 to decompile your framework-res.apk in apkmanager, and set the compression level to 0. If you get errors, use option 10 and use the twframework-res.apk as the dependee.

Edit - here is a link to the thread I spoke of. Best of luck.

http://xdaforums.com/showthread.php?t=998574
[Vibrant Android Development] v4nelle:
Guys i use Perkamod v2 which support Extended power menu.

On perkamod v2 are there only android.policy.jar and framework-res.apk.

Not framework.jar

Extended power menu works perfectly.How that is possible?

My framework.jar is the JVR one,deodexed and fixed(Browser) by me.No other code inside
[Vibrant Android Development] lingfude:
Hello boys and girls,

I followed the instructions in the first post and made the changes in my ROM (some line number did not correspond).

When I updated the framework-res.apk, framework.jar, android.policy.jar and reboot the phone, the phone did not start, got stuck on the initial screen.

My phone is a Chinese clone with Android 2.2.1.

Someone can help me solve this (add rebbot and recovery in my phone)?

Regards
[Vibrant Android Development] lingfude:
I have this problem to (when I push the power button the phone restart instade of show shutdown menu), but I don´t changed anything in GlobalActions$3.smali.

I followed the instruction in the first post.

Can anyone help me with this?

Thanks in advance.
[Vibrant Android Development] Rahulrulez:
I'm getting this error while re-compiling framework-res.apk

Could Not Find E:\Galaxy S\ROMS\App Edits\apk_manager_4.9\place-apk-here-for-mod
ding\../place-apk-here-for-modding/signedframework-res.apk
Could Not Find E:\Galaxy S\ROMS\App Edits\apk_manager_4.9\place-apk-here-for-mod
ding\../place-apk-here-for-modding/unsignedframework-res.apk
I: Loading resource table...
I: Decoding resources...
I: Copying assets and libs...
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
E:\Galaxy S\ROMS\App Edits\apk_manager_4.9\other\..\projects\framework-res.apk\r
es\values\public.xml:3867: error: Public symbol drawable/reboot declared here is
not defined.
E:\Galaxy S\ROMS\App Edits\apk_manager_4.9\other\..\projects\framework-res.apk\r
es\values\public.xml:3869: error: Public symbol drawable/reboot_download declare
d here is not defined.
E:\Galaxy S\ROMS\App Edits\apk_manager_4.9\other\..\projects\framework-res.apk\r
es\values\public.xml:3868: error: Public symbol drawable/reboot_recovery declare
d here is not defined.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, -F, C:\Users\Rahul\AppData\Local\Temp\A
PKTOOL1346966482257528266.tmp, -x, -S, E:\Galaxy S\ROMS\App Edits\apk_manager_4.
9\other\..\projects\framework-res.apk\res, -M, E:\Galaxy S\ROMS\App Edits\apk_ma
nager_4.9\other\..\projects\framework-res.apk\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(Unknown Source)
at brut.androlib.Androlib.buildResourcesFull(Unknown Source)
at brut.androlib.Androlib.buildResources(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.apktool.Main.cmdBuild(Unknown Source)
at brut.apktool.Main.main(Unknown Source)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\U
sers\Rahul\AppData\Local\Temp\APKTOOL1346966482257528266.tmp, -x, -S, E:\Galaxy
S\ROMS\App Edits\apk_manager_4.9\other\..\projects\framework-res.apk\res, -M, E:
\Galaxy S\ROMS\App Edits\apk_manager_4.9\other\..\projects\framework-res.apk\And
roidManifest.xml]
at brut.util.OS.exec(Unknown Source)
... 7 more
Press any key to continue . . .
[Vibrant Android Development] Dan_Aykroyd:
Removing Prompt Confirmation

Do you know what I have to edit to remove the prompts for "Reboot", "Recovery" and "Download" of the Extended Power Menu that ask if I REALLY want to do the action?

Since the "Power off" action of the original menu doesn't ask for confirmation, I think it'd be more consistent to have these from the extended menu do the same as well!

Thanks
[Vibrant Android Development] Br1cK'd:
What firmware are you working with. I have personally implemented this mod on both froyo and gb, and haven't had a confirmation pop up.

Has anyone else encountered this?

Sent from my ZenDroid, meditating on the XDA App
[Vibrant Android Development] Orochi77:
Not with this mod, but on some roms there is a confirmation. If i am not mistaken CM7 has it.
[Vibrant Android Development] Br1cK'd:
OIC. I am one of the few who doesn't use CM. I tried it once, for about an hour. Not knocking it, just not my flavor, but that would explain why I haven't encountered the confirmation popups.
[Vibrant Android Development] Dan_Aykroyd:
On all stock I've tried the prompt shows up.

Now I'm on XXJVT and it shows up; previously I was in XXJVS, XXJVP the it still showed up :rolleyes:

Thanks for your interest in my question!
[Vibrant Android Development] here.david:
A 2nd way

I use GScript for this as well as other things...must be rooted...
[Vibrant Android Development] Orochi77:
CM wasn't my cup of tea either. ;)
[Vibrant Android Development] pvyParts:
you have duplicated a public id or put the public id in wrong.

check the id on the drawable/reboot in the public.xml

or it is duplicated on lines 3866 and 3863

Pvy.
[Vibrant Android Development] Br1cK'd:
The way I read your error, it seems that the drawable/reboot is already defined on line 3863, and conflicting with line 3866 (three lines below it) giving you the duplicate entry error.

Is it possible you are trying to add an entry that already exists?
[Vibrant Android Development] Br1cK'd:
post your edited public.xml up here, let us take a look at it
[Vibrant Android Development] Br1cK'd:
Just to clarify, this is your edited public.xml?

As far as I can tell, it should be the same identifier as you posted in the error, 0x010803d6, thats the next available identifier for the type drawable. The one you posted has 0x01080493 as the value, but try the 803d6 value, that shold be the right one.

Try it again, being sure to take your time. If you are getting frustrated, it never hurts to walk away from it for a little while to let your brain refresh.
[Vibrant Android Development] Br1cK'd:
Sorry man, my day got seriously busy at work.

I have ported this to GB, I know it works if you're following the steps to the letter. If you're looping at boot, something is wrong for sure. I recommend trying the mod again, from scratch, and following the steps to the letter.
[Vibrant Android Development] Br1cK'd:
I see one big problem right off the bat, you skipped step 2, or got confused. This may explain why you didn't find the "invoke-static {}, Landroid/os/Power;->shutdown()V" string.

In step two of the OP, you are supposed to decompile the framework.jar to add those edits. The zip you posted only contains the android.policy.jar and the framework-res.apk, that leads me to believe you missed the entire step two of the OP.

Hope this helps.
[Vibrant Android Development] Br1cK'd:
If you're following their method, maybe you should ask for help in that thread. I know this works for the Vibrant if you follow the steps in this thread's OP, I'm not sure about the other method you posted.

If you're trying to blend the two methods, that might be your problem.

You should stick with the method that is for your phone, whichever device you have.

EDIT - Also, there is a problem with your android-policy.jar you posted, seems to have gone corrupt. I cannot even open it to drag out the classes.dex. I did redownload the file, but the problem persists.
[Vibrant Android Development] Br1cK'd:
Look dude, I am reading, and I'm trying to help you, but the android.policy you posted is borked, it won't decompile on either my home or work pcs. Thats probably your problem with the reboots, is that somehow you managed to completely break the android.policy you were editing.

I got nothin else in reference to your files man, if I can't look at what you tried to do, I can't help. Simple as that.

I don't know how you were decompiling the android.policy, but you may want to follow the steps in post 2 of the linked thread, even use the attached autosmali that jellette put together, to help you work with the classes.dex in your android.policy. This will work for the framework.jar as well, any .jar file for that matter can use the same steps to classout the classes.dex, and put it back together after editing.

http://xdaforums.com/showthread.php?t=998574
[Vibrant Android Development] toadlife:
Thank you so much for taking the time to write out this guide. After several failures (the code for my phone is significant differences from the examples!) I was finally able to mod my power menu on my Epic 4G.
[Vibrant Android Development] Br1cK'd:
Files I can decompile, that is a good thing, now I can be helpful, I think. :p

Your framework.jar and framework-res.apk look great, but in the android.policy.jar there are a few problems.

Since you are only adding reboot to the menu, you only need parts of the code to edit your smalis. In the first step in the android.policy, you have added calls for all 6 entries that would be present is you did the full mod.

So in the code, where you change "const/4 v0, 0x3" to "const/4 v0, 0x6" as per the OP and whats in your edited files, you really only need to put const/4 v0, 0x4" (that would mean four total entries on your power menu in that string)

How many GlobalActions$ smalis are in your stock android.policy.jar before you edit it?

Better yet, can you post your stock android.policy.jar for me to compare? I might be able to edit it for you real quick.

EDIT - It also looks like you missed a part of the third step, and didn't create the GlobalActions$9 smali that your code is calling for, try the attached android.policy, I edited it for you, and let me know if it works.
[Vibrant Android Development] Br1cK'd:
I'll give it a run with this stock file. Although you cleared up some confusion I was having. When you referenced the resource ids in the GlobalActions.smali, you referenced them to GlobalActions$9 which does not exist in your edited android.policy.
[Vibrant Android Development] Br1cK'd:
Here you go, this is the edited from the stock file you posted earlier. Flash it with your other framework files, it should work.

*crosses fingers*
[Vibrant Android Development] Actura:
is there any tool to identify my icon's resource id ?
[Vibrant Android Development] Mikekelso421:
i followed the steps and when i try hold the power button down,the phone just reboots itself...no dialog box or anything...any idea what i could have missed for it to just reboot itself like that?:confused:
[Vibrant Android Development] x-dira:
how to convert deodex to odex?

I need convert android.policy.jar to android.policy.jar+android.policy.odex .....flash in stock rom

sory! my english so bad :(

thanks very much!
[Vibrant Android Development] lingfude:
Follow this instructions (http://xdaforums.com/showthread.php?t=841287):
[Vibrant Android Development] Peteragent5:
Could someone upload a video tutorial based on this? Thanks :)
[Vibrant Android Development] klin1344:
Thanks for the guide :D

this was my first time smali editing so I was very skeptical that it wouldn't work.

But it turns out I got it to work!
[Vibrant Android Development] DarkNiz:
How does one edit framework.jar on an odexed ROM? If I open it with 7zip, all I see is a META-INF folder with MANIFEST.MF inside and outside the folder, all I see is a "preloaded-classes" file :confused:
[Vibrant Android Development] PAROVOZ!:
Can you give me plz extend power menu on XWKT7 2.3.6?
[Vibrant Android Development] migof:
It works in Motorola devices? Thanks
[Vibrant Android Development] iwillkillyou:
Would this method work for the screenshot in the power menu? ICS and gingerbread roms have it. I miss that feature greatly.
[Vibrant Android Development] pvyParts:
Sortof. You need different commands in the smali but the principal is the same

Pvy

Sent from my TEAM powered Arc S
[Vibrant Android Development] Rookie407:
trying to get this to work on a samsung galaxy precedent AOSP ROM. having an issue with step 2 in the shutdownthread.smali. more specificaly this part

:reboot

const-string v4, "now"

invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V

return-void

:rebootRecovery

const-string v4, "recovery"

invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V

return-void

:rebootDownload

const-string v4, "download"

invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V

return-void

should i change the parts where it says (exp. :rebootDownload) to the string id? and if i do i get this error when compiling (mismatched input '0x010404bd' expecting END_METHOD_DIRECTIVE)

if i try to change the corrisponding parts from the code inserted above it i get this error

(AutoSmali_In\com\android\internal\app\ShutdownThread.smali[2337,18] no viable alternative at input '0x010404bd'

AutoSmali_In\com\android\internal\app\ShutdownThread.smali[2341,18] no viable alternative at input '0x010404bb'

AutoSmali_In\com\android\internal\app\ShutdownThread.smali[2345,18] no viable alternative at input '0x010404bc'

AutoSmali_In\com\android\internal\app\ShutdownThread.smali[2352,4] mismatched input '0x010404bd' expecting END_METHOD_DIRECTIVE)

any clue on a fix?
[Vibrant Android Development] pvyParts:
reread the TUt, specifically step 3 you don't put the resID's there they go in the globalActions ;)

Pvy.
[Vibrant Android Development] Rookie407:
i got that part... i was just wondering if it would be diff cus its a diff phone. i know with LG phones you dont have to edit the shutdownthread.smali at all and it works just fine.
[Vibrant Android Development] pvyParts:
If you follow the tut it will work. If the stuff is already there don't re add it.

But you were editing the wrong area. The IDs don't go where you put them.

Pvy.
[Vibrant Android Development] Rookie407:
if the stuff was there i wouldnt be doing this... and if it worked i wouldnt be posting... like i said before this is the sammy precedent im working n 100% AOSP. would u like the logcat errors?
[Vibrant Android Development] pvyParts:
sure go for it it may shed more light as to what the problem was :) i have a feeeling we are on 2 different pages...

100% AOSP as in your are compiling it first? then decompiling it to add mods? O_O

Pvy.
[Vibrant Android Development] lingfude:
Hi Rookie407,

I remember when I made this mod in my rom I had some errors at the first few times I tested this.

The errors were because I add the resources idds in the "public.xml" but I forgot to add the reboot and recovery images in the resource file.

Don't know if this is your case but...
[Vibrant Android Development] Rookie407:
thats deff not the case. the images and the lines come up just fine after i push the power button but it does a FC vibration thingy when i click to select an option other then the original 3...

why do i sound like a broken record here. =\
[Vibrant Android Development] pvyParts:
can you post the smali from the shutdownThread file too :)

Pvy.
[Vibrant Android Development] Rookie407:
done
[Vibrant Android Development] lingfude:
The file is corrupt.

I can't open it.
[Vibrant Android Development] pvyParts:
Open the file in notepad xda is returning a 404 on it ;)

Pvy
[Vibrant Android Development] Rookie407:
its gotta be yall i dl'd it just fine just tested it... xda wont let me upload it as a txt it keeps failing.
[Vibrant Android Development] pvyParts:
Try This!

downloading now. xda does that sometimes :D

will update soon if i find somehting

Edit 1

you have two variables with the same name.

.field public static mReboot:I

.field private static mReboot:Z

Edit 2

Ok my 2 cents worth.

Change

".field public static mReboot:I"

to

".field public static mRebootInt:I"

in these places (red parts)

shutdown thread

line 29

[B]".field public static[COLOR="Red"] mRebootInt:I[/COLOR]"[/B]

line 2332

sget v1, Lcom/android/internal/app/ShutdownThread;->[COLOR="red"][B]mRebootInt:I[/B][/COLOR]

then in the global action files that you made as well in this step (copy pasted from the OP

see how that goes. if you do all that and it still don't work link the new crash log and all the shutdownthread and globalactions files (zip them together and i will look at just them) ;) dont need the entire frameworks

Pvy
[Vibrant Android Development] Rookie407:
works perfect man thanks for all your help!!! ill be sure your added into the credits of our rom. =)
[Vibrant Android Development] pvyParts:
Glad we got it sorted. ;)

Pvy.
[Vibrant Android Development] lingfude:
Great!
[Vibrant Android Development] Actura:
i am trying to do the step 1, and it gives me error :(

i have checked if wheter the id like "0x01040391" is used or not, and if it's used i would change it into unused id

but still it gives me an error :eek:

the screenshot of error is uploaded on this post, please help me :D

could anyone here help me ? :confused:

i am not using samsung vibrant but maybe if you have successfully compiled the framework-res.apk you could help me with this

thanks in advance, any suggestion will be appreciated :D
[Vibrant Android Development] bigfau:
The 4 Way Reboot mod is a lot easier. A lot easier.The only modification for 4Way is to androidpolicy.jar. No edits or modifications to framework-res.apk at all. Told you it was easy. Lol. My 2¢ cent.

http://xdaforums.com/showthread.php?p=24235582
[Vibrant Android Development] Crackion:
HI, help?

Hi, i could help you if you upload your original framework-res.apk file , it seems 0x0140391/0x0140392 are not free id's, are you tried to ensure thats those id's are not asigned to another string?, upload

framewokr-res.apk

public.xml

strings.xml

originals to check them,;)

---------- Post added at 08:01 AM ---------- Previous post was at 07:57 AM ----------

Hi, bigfau, how did you add menu's icons in android.policy? i've already gotten the EPM, but without icons, and did you changed default "Shutdown" string to Restart?

---------- Post added at 08:08 AM ---------- Previous post was at 08:01 AM ----------

Hi i have that lines in my .smali too, originaly there's only

.field public static mReboot:I

when i add the second line, they look just like you described, must i to do excactly you have said for Rookie407
[Vibrant Android Development] Crackion:
Question about sizes

Even when my framework-res.apk "edited" has more lines than my framework-res.apk "original",, The first one's size is less than original... Why?, Is this because the compression level? what do you say guys!
[Vibrant Android Development] Crackion:
Icon in shutdown method menu

Hey guys look at this hahahahah im trying to add an icon to Shutdown Method Menu and I got this:

http://i49.tinypic.com/347zpr5.png

Almost get it ñ.ñ
[Vibrant Android Development] Yahyailham:
excuse me sir, I have a problem when try to make this EPM in my framework-res, the download selection is blank(like in the attachment), can u help me solve this problem? my framework-res in Attachment and my phone is Galaxy Y thats in LDPI screen, plz help me.. :(

thanks before... :)
[Vibrant Android Development] n00BXperia:
will it work on any GB ROM ?
[Vibrant Android Development] projectmax:
can't find

this part is the one am having trouble cause this code "invoke-static {}, Landroid/os/Power;->shutdown()V" doesn't exist in my shutdownThread.xml. can you please help me on this one..Thank sir for the help..

this is my shutdownThread.xml from my stock 2.3.6 rom in my alcatel ot-918N phone.

ShutdownThread
[Vibrant Android Development] viijay4b7:
I have started to add reboot and recovery options to my phone MMX a110

The following thread has details of what I've done. Please suggest me to move further.

I am stuck at globalAction.smali

http://xdaforums.com/showthread.php?p=36944844#post36944844
[Vibrant Android Development] Br1cK'd:
Hate to be the one to burst your bubble. This tutorial hasn't applied to any firmware after GingerBread. From ICS and up, the google code changed, and these steps won't work. Sorry, wish I had better news for you.

Edit - Come to think of it, these exact steps didn't work on GB either, eclipse and froyo with a TWIZ interface they did, but since then a lot of the code has changed.

Give a man a fish and he will eat for a day, teach that same man to use Google Search, and he can answer his own questions for the rest of his life.
[Vibrant Android Development] jeboo:
One of my favorite threads...I posted a new thread for S4 ATT:

http://xdaforums.com/showthread.php?t=2298771
[Vibrant Android Development] PrimeNexes:
This didn't worked for me :( the parameters are not matching :( can anyone help ?
[Vibrant Android Development] jrongi1:
If you didn't notice this is obsolete. It's over 3yrs old.

What are you trying to do?

PSX Mako 4.4
[Vibrant Android Development] PrimeNexes:
I want to add CWM Recovery to Power Option . It has the Restart option so I need only the Reboot to Recovery option.

LOL I didn't noticed it was 3 years old :laugh:
[Vibrant Android Development] Stevethegreat:
If you're on cm/aosp. Settings -> Developers options -> Advanced Reboot (enable it)
[Vibrant Android Development] PrimeNexes:
I am creating my own ROM so I want to add it to my ROM .
[Vibrant Android Development] jrongi1:
What are you using as a base?

PSX Mako 4.4
[Vibrant Android Development] PrimeNexes:
Stock ROM
[Vibrant Android Development] jrongi1:
By stock do you mean 2.2?

PSX Mako 4.4
[Vibrant Android Development] PrimeNexes:
I have a android 4.2.2 JB Stock ROM
[Vibrant Android Development] jrongi1:
Can I ask what repos you use?

PSX Mako 4.4
[Vibrant Android Development] PrimeNexes:
Repos ? I didn't understood you :confused: Sorry I am just a newbie here so :D
[Vibrant Android Development] jrongi1:
For the Vibrant files so you can build for a specific phone.
[Vibrant Android Development] PrimeNexes:
You mean like source ? No I did a system Dump . Sorry if I am wrong
[Vibrant Android Development] chinittoh:
im stuck on step 2...cant find com folder on framework
[Vibrant Android Development] Ticklefish:
Either your apk isn't deodexed...or it wasn't decompiled.
[Vibrant Android Development] chinittoh:
oh!mybad..i thought framwork word on step 2 is still framework-res.apk....

thank you sir