yashsingh1/xdaforums huggingface dataset:
[Samsung Galaxy Nexus] madquack:
Greetings everybody!

I'm an amateur smali hacker trying to manually add just the reboot option to my power menu on AOSP JSS15J for Maguro, so far I've gotten to the point where the reboot option shows up but still haven't modified it to do the actual rebooting or change the title so it still shows up as the shutdown option as the picture shows.

Basically how I have my setup like most of the other people that have made extended power menus.

In GlobalActions.smali I have it call up GlobalActions$11.smali but haven't modified it yet to do the actual rebooting, still in the process of learning that haha. I am NOT looking for anyone to do this, I HATE people that whine and beg for other people to do things for them so I am a firm believer in doing things myself but at some point everyone hits a stuck point.

Anyone have any pointers? I've been going off this -> https://docs.google.com/document/d/11a7ghZpdTcZbeDtneTnEHkHLn5_XQ9k2FDFFh-os-q0/mobilebasic?pli=1

If you take a look at it, somethings are different but for the most part, it's similar and it seems like most of the work is done in the method -> method public onLongPress()Z This is a part of GlobalActions$11.smali.

# virtual methods
.method public onLongPress()Z
.locals 2

.prologue
const/4 v1, 0x1

.line 250
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions$11;->this$0:Lcom/android/internal/policy/impl/GlobalActions;

#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mWindowManagerFuncs:Landroid/view/WindowManagerPolicy$WindowManagerFuncs;
invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$500(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/view/WindowManagerPolicy$WindowManagerFuncs;

move-result-object v0

invoke-interface {v0, v1}, Landroid/view/WindowManagerPolicy$WindowManagerFuncs;->rebootSafeMode(Z)V

.line 251
return v1
.end method

Edit, now that I think about too, my navbar looks a little jacked up haha, does the back button look a little further away from the home button than the menu button or is it just me?
[Samsung Galaxy Nexus] DoesntPostAThing:
I get it for maguro too? Although I'm using kevdliu's toggle mod as well, so that could be why.
[Samsung Galaxy Nexus] xIC-MACIx:
Yeah, it's not working yet, I didn't have a chance to work on it today. Just power menu only till then.

In order for this mod to only install one file, android.policy.jar, I had to use existing images and strings for the reboot dialog. Looks like something changed in version 4.3. That or the ROM dev changed/removed something. I'll have some time to work on it tomorrow!

[MENTION=2034647]capychimp[/MENTION], in the past (since the release of 4.1, actually) it worked fine on my toro gnex. That is the only string that can be used without modifying frameworks-res.apk to add it myself. Of course, the whole point of me doing it this way, was so only one file needed to be flashed.

Also guys,

Let me clarify, ODEX files are device specific! This means that I can't actually make an odex version all devices. That's why I put together a DIY odex package.
[Samsung Galaxy Nexus] capychimp:
Yeah I remember when I used to make APM on sense Roms ;) do you know where the signature hack is in framework on gnex? So we can resign apks and they won't get rejected? I forgot which file it was. On sense it was a simple edit in services.jar
[Samsung Galaxy Nexus] xIC-MACIx:
I'm not sure, but "services/java/com/android/server/am/FactoryErrorDialog" might be the cause. The only problem is services.jar is device-specific.

I think this a build issue. Since 4.3 was just officially released, ppl are still using the leaked builds or un-official builds. I haven't had a chance to test on toro, but it works fine on my Nexus 10. (which is running a deodexed build based off of the latest 4.3 OTA)
[Samsung Galaxy Nexus] xIC-MACIx:
Agreed. The best way to learn this stuff is to DIY. I'm guessing that this isn't the same source my mod uses. (no longpress on mine) You are actually almost there. To make a button that simply reboots:

Basically, what you need to do is point the button you added in GlobalActions.smali to a single GlobalActions$##.smali file. (I'll use $99 to avoid confusion) The best way is to take the file used for shutdown (GlobalActions$2 on JB 4.3) then copy and rename it to GlobalActions$99. From there, you just change the shutdown action to reboot instead and then you can add longpress action after.

Search for this code in GlobalActions$99 file you just created:

const/4 v1, 0x1

invoke-interface {v0, v1}, Landroid/view/WindowManagerPolicy$WindowManagerFuncs;->shutdown(Z)V

And replace it with this:

const/4 v1, 0x1

const-string v2, "now"

invoke-static {v0, v2, v1}, Landroid/view/WindowManagerPolicy$WindowManagerFuncs;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V

Now, the only thing here is the above code for reboot is from Gingerbread, (I just added the correct path) so you might not need the "const-string v2, "now" part.

If you want long press action for the other reboot options, you can do the same thing, but you will also need to change the rebootSafemode piece of code (from the code in your post) to point to "rebootOptions" and then point that longpress action to GlobalActions$11$1 & 11$2 from my source. You are basically taking the "method onpress" part of GlobalActions$11 and putting it in the "method longpress" part of GlobalActions$99. Although, it might not be that simple, I've never tried this myself.

PM me if you need more help,

- Mac
[Samsung Galaxy Nexus] capychimp:
Well the APM works fine. It was just the other hack I forgot where was on Google factory Roms ;) I will find it again
[Samsung Galaxy Nexus] xIC-MACIx:
I took a look through the smali and public.xml and I'm pretty sure it is just a public.xml issue with the JSS15J build of 4.3, the public.xml must be different from JWR66V.

- Mac
[Samsung Galaxy Nexus] jjhiza:
The JSS15J branch is for the N7,while the JWR66V branch is for existing devices (N4, GNex, etc), as per JBQ. That may be where the issues are coming from.
[Samsung Galaxy Nexus] DoesntPostAThing:
No wonder I've been getting various issues with JSS15J such as location services not working properly, lag everywhere (comparable to 4.2.2), and in general things have been very glitchy. Went back to my JWR66V backup and everything sped right back up to the 4.3 I've come to know and love.
[Samsung Galaxy Nexus] xIC-MACIx:
That definitely makes sense b/c the recent 4.3 leaks where from the new N7. A separate version was also needed for the N7 on 4.2.

If anyone wants to send me android.policy.jar for the Nexus 7, I'll get a JSS15J version uploaded.

- Mac
[Samsung Galaxy Nexus] mwalt2:
I've attached the AOSP JSS15J version I made using the same changes you make (ie this one has already been edited).
[Samsung Galaxy Nexus] daniel57:
When the odex version for stock rom 4.3 will be released please ?
[Samsung Galaxy Nexus] noodles2224:
It's already made here http://xdaforums.com/showthread.php?p=44082376 there's also a zip to flash back to stock in the thread.. :)

Sent from my Nexus 4
[Samsung Galaxy Nexus] daniel57:
I have Gnex and it's for N4
[Samsung Galaxy Nexus] noodles2224:
That, I don't know if you can interact with each other..

Sent from my Nexus 4
[Samsung Galaxy Nexus] daniel57:
I didn't understand i'm not english
[Samsung Galaxy Nexus] Joelogs:
Look here http://xdaforums.com/showthread.php?p=44063473
[Samsung Galaxy Nexus] daniel57:
It works. Thanks bro
[Samsung Galaxy Nexus] Joelogs:
You're welcome!:thumbup:
[Samsung Galaxy Nexus] eric-filth:
I tried on my nexus 7 android 4.3 worked but icons for "Reboot" and "AirPlane" are wrong.

Anyone know the code to correct this? or if i need put any .png inside framework-res.apk?

Thanks
[Samsung Galaxy Nexus] DoesntPostAThing:
This mod IS made for the GNex and not the N7...
[Samsung Galaxy Nexus] xIC-MACIx:
Which version did you download? Right now there are two different 4.3 builds.
[Samsung Galaxy Nexus] jjhiza:
You'd need a mod made with the policy.jar from an N7 JSS15J base. My advice is to upload a copy of your policy.jar here, and ask the dev, kindly, to modify it. That might be your best bet. :thumbup:
[Samsung Galaxy Nexus] eric-filth:
Hi i tried this version 4.3 DEODEX Multi Reboot Only (JWR66V)

I tried to compile my own android.policy using your source and i had same error with images from Airplane and

I will try another version and return here to tell if works
[Samsung Galaxy Nexus] xIC-MACIx:
Nexus 7 uses JSS15J build of 4.3, try that one instead.

As for compiling your own, all you need to change after merging my edits from my source is the public.xml hex codes in GlobalActions.smali

- Mac
[Samsung Galaxy Nexus] joytsay:
volume skip

So, will we get volume skip mod in 4.3?:cyclops:
[Samsung Galaxy Nexus] gpvecchi:
Deleted
[Samsung Galaxy Nexus] hardstyle86:
Thanks!
[Samsung Galaxy Nexus] gpvecchi:
I would like to change icons of multireboot, may anyhone help, please?
[Samsung Galaxy Nexus] vincentallen2:
Can you please reupload the 4.2 epm for the multi-reboot & volume skip zip? It's showing a "file doesn't exist" when trying to download.
[Samsung Galaxy Nexus] SerkSerk:
Is there any zip for 4way reboot+song skip for nexus4 4.3 odexed ?

Thanks
[Samsung Galaxy Nexus] sudov:
It works on my GN 4.3 STOCK,things become convenient now. Thanks bro!

I am a chinese user,but the four menus ("reboot""hot bot""bootloader"and"recovery") are still displayed in English but not Chinese,so I want to change the four English words of menus into those displayed in Chinese.How should I do?

Do these codes below matter?

GlobalActions$SinglePressAction.smali

# direct methods
.method static constructor <clinit>()V
.locals 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, "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
[Samsung Galaxy Nexus] Ghisy:
Just wondering if this works with the newest JWR66Y update. Thanks!
[Samsung Galaxy Nexus] gpvecchi:
Yup, I did it on mine (italian). Just change that words to your native language.
[Samsung Galaxy Nexus] thomasyke:
Does not work with JWR66Y and breaks OTA (known to do that)
[Samsung Galaxy Nexus] humaxnet:
Jwr66y compatibility

Please upgrade it to JWR66Y.

Regards

Humaxnet
[Samsung Galaxy Nexus] roberto18:
do you have maybe the stock power menu for nexus 4 stock 4.3 ?i want to get back to the stock menu
[Samsung Galaxy Nexus] Kryston:
Yes, i would like to have that too, anyone can do it?
[Samsung Galaxy Nexus] capychimp:
If I get some spare time I will look into it if no one does it
[Samsung Galaxy Nexus] WaPeR32:
Im looking for a 4.3 (JWR66Y) version, is the 4.3 (JWR66V) version compatible?

Thanks!
[Samsung Galaxy Nexus] humaxnet:
No. Read last messages....:crying:
[Samsung Galaxy Nexus] capychimp:
JWR66Y reboot

its for JWR66Y deodexed

NOTE it is NOT flashable

For stock rom

Maguro only
[Samsung Galaxy Nexus] bulin23:
Have no any changing here.
[Samsung Galaxy Nexus] capychimp:
OK hmmm sounds like you didn't get the file in. I just tested and it works
[Samsung Galaxy Nexus] kleinfeld:
Hi, I just tried flashing the 4.3 odexed nexus 4 version and now I can't get past the boot screen with the X.

Like an idiot I didn't do a backup either.

Please help :crying:
[Samsung Galaxy Nexus] horst0815:
you flashed something belonging to the gnex onto your nexus 4? congrats....

but ask in the n4 forums, they can help you.
[Samsung Galaxy Nexus] sga999:
If you look under the odexed versions, there are files for the Nexus 4, not just the Galaxy Nexus. However, I believe I tried this version a few weeks ago, and only the deodexed version worked for Nexus 4, 4.3 JWR66Y, not the odexed. I've gone on to using other methods to get the advanced power menu, so I'm not going back to prove this now.
[Samsung Galaxy Nexus] kleinfeld:
Did you also get stuck booting, if so how did you recover from it? I have a feeling my only option is to factory reset :(
[Samsung Galaxy Nexus] sga999:
I did get a bootloop, but I had a good backup, so it was no big deal. Do you have any old backup at all? If not, can't you use recovery to install a "good zip" of the rom from your sdcard? You may already have one there, or you can put it there through adb. With certain versions of TWRP, you can even flash a zip from the external sdcard. Sorry, I'm not very good at explaining this....I can do it myself if I get in trouble, but writing about it isn't my forte. But if you have a specific question, I'll try to answer.
[Samsung Galaxy Nexus] kleinfeld:
Thanks for your help with this :good:

I tried a factory reset, cache & dalvik cache wipe but this seemed to have no effect. In the end I transfered a flashable stock rom using ADB, flashed it & it's working again.

Lesson learned: always backup before flashing anything.

Thanks again.
[Samsung Galaxy Nexus] sga999:
You're welcome...glad you got it working! Yes, backing up is a good lesson to learn. Mistakes can be good...we usually do better the next time.
[Samsung Galaxy Nexus] WaPeR32:
Yeah!

I had the same problem 3 weeks ago and toke 1 hour and a half to make things work and recover pictures and vids.

;)
[Samsung Galaxy Nexus] WaPeR32:
Finally I found what I've wanted!

[STOCK][4.2.2] & [4.3] kill all recents & soporte h+ & Power Menu (in spanish)

;)
[Samsung Galaxy Nexus] thomasyke:
Can someone please reconfirm if it works with JWR66Y?
[Samsung Galaxy Nexus] Emeraldscorpion:
I don't get it... Is there a volume skip for 4.3 or not??? OP isn't saying anything as far I can see.
[Samsung Galaxy Nexus] lambofgod13:
Thanks
[Samsung Galaxy Nexus] thomasyke:
Can OP update one last time for 4.3 JWR66Y please?
[Samsung Galaxy Nexus] skyleth:
odexed version for galaxy nexus not working on stock 4.3 caused bootloop

deodexed version not working, nothing happened
[Samsung Galaxy Nexus] ramon20:
can you edit the source for remove the option "Hot Reboot"?
[Samsung Galaxy Nexus] cujo6801:
If you want to save your power button there's an app in the Play Store call quick boot check it out

Sent from the "DOG" pound
[Samsung Galaxy Nexus] ramon20:
no, thanks ;) i really want the sourcer edited
[Samsung Galaxy Nexus] xIC-MACIx:
Good to hear, and thanks!

Well technically no, but you do need to be deodexed.

That will be the case for most of the mods here too.
[Samsung Galaxy Nexus] lazerin:
Ahhh....dedeox. That's the problem then.
[Samsung Galaxy Nexus] kong:
AFAIK, it's nothing to do with the kernel. The hot boot option normally uses the command pkill, which is available via busybox.

So if your ROM has busybox installed properly (by "properly" I mean there are symlinks for every commands to the busybox binary), the hot boot option will work.

In other words, just create a symlink named pkill to the busybox binary and the hot boot option should work :silly:
[Samsung Galaxy Nexus] xIC-MACIx:
Thanks, I was just making a guess lol :o I'll give that a shot.

-Mac
[Samsung Galaxy Nexus] kahvitahra:
Thanks! That is 100% correct :)
[Samsung Galaxy Nexus] xIC-MACIx:
Hot boot works for me now lol :D

I'm glad you pointed that out Kong, a simple busybox update was all that was needed, thanks man. (Didn't even have the pkill applet for some reason)
[Samsung Galaxy Nexus] kong:
Yeah it depends on those *$10*.smali files whether they just call the pkill command directly or they call busybox pkill. If you say just updating busybox fixes it then I guess it's the latter case :fingers-crossed:
[Samsung Galaxy Nexus] xIC-MACIx:
It uses pkill actually. Idk why but I was missing tons of the busybox applets so I just did an advanced install and made sure everything symlinked on install.
[Samsung Galaxy Nexus] Frenix27:
Can I flash it on stock 4.1.1 deodexed and airkernel? Thanks!
[Samsung Galaxy Nexus] zidaneism:
It was perfect but can you explain why everytime I flash one of your mod and this

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

only one mod can survive at last? lol, thanks
[Samsung Galaxy Nexus] xIC-MACIx:
Yupp should be fine, make sure and back up your stock untouched android.policy.jar just in case.

They modify the same .jar file. So when you flash one over the other, the previous mod is overwritten.
[Samsung Galaxy Nexus] Frenix27:
Where can I find this file?
[Samsung Galaxy Nexus] zidaneism:
So how can I have these two mod working together? What procedure should I do? Many thanks!!
[Samsung Galaxy Nexus] xIC-MACIx:
Located in /system/framework directory

You need to decompile both w/ Smali tool, and find out what files were edited on volume thread and merge the changes. (my edited files are listed a page or two back)
[Samsung Galaxy Nexus] phone_user:
Thank you very much! Your MOD works well with Peter Alfonso :)
[Samsung Galaxy Nexus] jawonder:
Thanks much bro was looking for a power menu that doesn't mess with the framework to go with a GSIII addon for JB 4.1.1 Galaxy Nexus, all the others i've tried causes FC this works perfectly .
[Samsung Galaxy Nexus] Itzik68:
Any chance its possible to make it work on .odex rom?
[Samsung Galaxy Nexus] xIC-MACIx:
Ya it's possible, busy studying for summer biz calculus right now though. Might be able to do it later tonight...

-Mac
[Samsung Galaxy Nexus] kong:
So I merged xIC-MACIx's Advanced Power Menu into evilisto's mod. This should work on any JB ROM that is compatible with it :highfive:

Download: http://www.mediafire.com/?fa8c1ia80tfim2z
[Samsung Galaxy Nexus] Itzik68:
Thanks man, you're awesome!
[Samsung Galaxy Nexus] xIC-MACIx:
OP Updated with Volume Skip Mod to long press volume to skip music tracks. (Thanks Kahvitahra!)

Also provided options to have both or just one.

-Mac
[Samsung Galaxy Nexus] Paragon_X:
Going to flash. I'm on jellybelly awesomebeats rom, oh man I pray this is the fix I need!
[Samsung Galaxy Nexus] xIC-MACIx:
Running the toro version of Jelly Belly 3.6 and no issues, dont have awesome beats but it shouldn't interfere.

Android.policy.jar is still the only file editied.
[Samsung Galaxy Nexus] Paragon_X:
Hey mate so just flashed. I have the volume skip working which is great but no reboot to recovery which I guess is ok because I do have romtoolbox. I hate to ask but are you using a battery mod? I flashed one that wrecked everything, lookin for something stable
[Samsung Galaxy Nexus] xIC-MACIx:
I flashed each one to test before upload.

Your problem is Jelly Belly from Awesome already has a power menu mod which most likely changed some framework resources. I didn't realize till now that the Jelly Belly on Rootzwiki is not the same one in the GSM dev section :o...

I have the battery mod I made for personal use (screenshot in OP shows it) but I can't guarantee it will work on your phone. Especially since I noticed that Jelly Belly w/ Beats isn't the same ROM I run which I got on Rootzwiki for toro
[Samsung Galaxy Nexus] xI mEzMeRiZe Ix:
I really want to use the Power Menu mod, but I want to make sure it is safe to use once installed. Does this shut the system down properly and safely, so we avoid long boots due to JB checking partitions at boot? Or does it just kill the system instantly and then launcher the desired task (reboot, recovery, etc.)? If it is the latter, I don't want to use it because I have run into major problems.

edit: Also, going to be trying this on Bugless Beast, if that makes any difference.
[Samsung Galaxy Nexus] Paragon_X:
Updating that everything is great with the mod. I was a fool and didn't click the reboot button to see the other options were in a sub menu. ALL IS GREAT, CHEERS
[Samsung Galaxy Nexus] malibu_23:
took me 15 whole minutes to figure out that the volume button skip ONLY WORKS WHEN THE SCREEN IS OFF...lol.
[Samsung Galaxy Nexus] kahvitahra:
Reboot, reboot to recovery and bootloader uses "com/android/server/pm/ShutdownThread;->reboot" method. So AFAIK it correctly shuts system down and then reboot to wanted place. I think every APM/EPM mod uses that same method.
[Samsung Galaxy Nexus] xI mEzMeRiZe Ix:
Thanks.
[Samsung Galaxy Nexus] xI mEzMeRiZe Ix:
So this is working well on 7/14 Bugless Beast.
[Samsung Galaxy Nexus] Arturo777:
Man, THANKS A LOT FOR THIS, i can finally die in peace... now my jelly bean is perfect... beyond perfect with the Volume Rocker, the APM and the lock is the best thing ever... You can expect to have +8 thanks tomorrow. a big BIG thank You.:fingers-crossed:
[Samsung Galaxy Nexus] npalmy:
Thank you working perfect for me. :angel:
[Samsung Galaxy Nexus] niamul:
Any way to undo this?
[Samsung Galaxy Nexus] walkamake:
xIC-MACIx, can you say which code (or numbers of lines of code) and which files reboot phone into download mode? I want to remove this part of code properly, because I don't need this.

And can you say which code is resposible for volume skip in phone window manager?

Thanks!
[Samsung Galaxy Nexus] Basian Mile:
What png is used to show for "Reboot"? I cant find it and its not some "ic_lock_..." png. Can anybody tell it to me? / Edit: Its "stat_sys_warning.png" or "stat_notify_error.png" :-)

And is it possible to add a Screenshot Option to that?

Oh, and pls tell me how to add Volume Skip to android.Policy.

Am i right with this one?

"com\android\internal\policy\impl\PhoneWindowManager.smali"
[Samsung Galaxy Nexus] kahvitahra:
Here is source files for volume rocker. Contains two extra files and phonewindowmanager.smali. Files made for 4.1.1 ( BuglessBeast ), so difference changes to that version and you'll find right lines.
[Samsung Galaxy Nexus] Basian Mile:
Thank you. The one i have from OP is working fine on JellyBelly too.

XCan you tell me what png is used to show for Reboot Option? It seems both i tried are wrong.
[Samsung Galaxy Nexus] kong:
Just re-flash your ROM without wiping anything.
[Samsung Galaxy Nexus] xIC-MACIx:
yeah sure, flash your original android.policy.jar. (system/framework)

Its "ic_dialog_alert_holo_dark” and for the string for reboot is "factorytest_reboot". (As long as the image is 64x64 it'll look fine. I use "ic_popup_sync_1" edited with white reboot icon for personal use; my goal is to not add any strings or images to framework.

Edit: stat-sys-warning is 48x48, the one above is 64x64.

Yeah screenshot is pretty easy since ICS and JB have screenshot built in; add screenshot using the same method for reboot to the list in global actions. You would also have to find the register argument for the array list and increase it by 1 for it to work. Although adding screenshot option would require the addtion of a camera image and string since there are no existing "screenshot" strings, but there is one camera image, "perm_group_camera," that would work.
[Samsung Galaxy Nexus] Basian Mile:
Its just that i cant find the right one. All but not for reboot :-(

For the other PowerMenu it was the right png.

I wish you could add screenshot to that. Is it ok for you?

Gesendet von meinem Galaxy Nexus
[Samsung Galaxy Nexus] xIC-MACIx:
I haven't tried removing any options, but in GlobalActions$SinglePressAction.smali is where the array list is located under #direct methods If you remove an option you have to change the array size to reflect that too. Also there is code that tells these options what to boot to. I think the const values for that is in globalactions10$1 after inside the "onClick" method
[Samsung Galaxy Nexus] xIC-MACIx:
That image in the screenshot above is ic_dialog_alert_holo_dark, or atleast that's the image I used in mine.

And are you asking if I can add a screenshot option, or take a screenshot? Sorry, a little lost in translation here man lol
[Samsung Galaxy Nexus] Basian Mile:
Thx. So i can replace it tommorow after work with blue one.

Or can you tell me how to add another png instead this one. Somewhere in the smali it says to use the one right. ??

Iam asking you to add the option pls. I tried it but i was really not able to do it.

Gesendet von meinem Galaxy Nexus