yashsingh1/xdaforums huggingface dataset:
[XPERIA X10 Android Development] dettofatto:
And so I'll have 0x4 and 0x6 without 0x5?

Or I must put all your new lines under 0x5?

Because my. 232 line starts with constant 0x5...

And so I thought that the new screenshot has 0x6...

Or new lines start before 0x5?

Tomorrow I'll try all these options and I'll see!

I'm wrong?

Thank you...

Sent from My Motosola....
[XPERIA X10 Android Development] dettofatto:
No...

Rebooted.. I'll try again...

Ah! I'm on motorola device...

.line 232
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$11;

const v1, 0x1080452

const v2, 0x10404f5

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

iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

const/4 v0, 0x5

new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
[XPERIA X10 Android Development] Tof37:
Would you upload and attach your globalaction.smali please?
[XPERIA X10 Android Development] dettofatto:
Yes!!! I'll do tomorrow! The original file? Yes... I think so...

Thank you!

Sent from My Motosola....
[XPERIA X10 Android Development] Tof37:
The one you modded please ;)

thanks
[XPERIA X10 Android Development] dettofatto:
This is my file!
[XPERIA X10 Android Development] Tof37:
Add a quick look at your file and there are some errors in it ...;)

that's why it doesn't work ;) will attach your file later to show the errors
[XPERIA X10 Android Development] dettofatto:
Thank you again!!!

Sent from My Motosola....
[XPERIA X10 Android Development] Tof37:
Have a look at the file ;)

I attached mine as model in OP so you can compare ;)
[XPERIA X10 Android Development] blueowl0708:
I don't suppose you know how to change the order of the power menu?
[XPERIA X10 Android Development] Tof37:
That can be done ;)

Lines must placed in the order you want them...
[XPERIA X10 Android Development] blueowl0708:
Care to be more specific?:rolleyes:
[XPERIA X10 Android Development] Tof37:
;)

So I'll try to be as clear as possible ...

each command starts with this line :

const/4 v1, 0x...

and ends with :

aput-object ....

the first line (const/4 v1, 0x3 for eg) says where what is following is placed in the grid ...

In this example const/4 v1, 0x3 the option is in 3rd position ...

If you want to change the position of an option, just move the commands to the wanted position ...example :

if you want to change the position it will become :

Hope I made it clear ;)
[XPERIA X10 Android Development] dettofatto:
I've done again, without success.. But now I can see my screenshot option, then my phone reboot.. :-(

My issue:

1) What is the name of your png?

semc_ic_dialog_screenshot.png?

2) In public.xml I've 3 lines with screenshot, is it normal? I've Choosed as string's id (for globalaction) this 0x01040509 (renamed to 0x1040509)... Correct?

Line 2863: <public type="string" name="global_action_screenshot_txt" id="0x01040509" />
Line 2885: <public type="string" name="global_action_screenshot" id="0x010404f5" />
Line 4313: <public type="drawable" name="semc_ic_dialog_screenshot" id="0x01080503" />
Search "screenshot" (2 hits in 1 files)

3) In GlobalAction you wrote:

Find this line

invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/ObjectLjava/util/ArrayList;

just above add

const/4 v1, 0x3

iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

aput-object v2, v0, v1

const/4 v1, 0x4

I've 2 lines with: invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object......

And I have, also, 1 const/4 v1, 0x4 for GlobalAction$10 (reboot option)

So I must write this?:

const/4 v1, 0x5

iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

aput-object v2, v0, v1

const/4 v1, 0x6

invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList;

Thank You!!!!!!!!!!!!!!!!!

I Can do it... :-)
[XPERIA X10 Android Development] Tof37:
Hi ,

1) yes

2) One line has nothing to do in public.xml ;) but have to be in strings.xml ... just to help all txt are in strings.xml

3) What you wrote is right ... just beware with const/4 v1, 0x5 alignement ... just move it on the right to be like the other lines ;)

You're near the full working ;)
[XPERIA X10 Android Development] dettofatto:
I'm sorry.... I think now it is ok, but my phone gone into bootloop...

Maybe I must edit another file? Editing the power menu, for adding reboot option, I hade similar issue, because I must edit also another file..

This is my globalaction, strings and public again..

Where is my issue?

Thank you for your help!
[XPERIA X10 Android Development] Tof37:
In strings.xml all is ok

In public.xml delete this line

<public type="string" name="global_action_screenshot" id="0x010404f5" />

Your android policy seems fine ....

When you mean bootloop it's when phone starts or when you press power menu ?
[XPERIA X10 Android Development] dettofatto:
Before when I pressed power menù...

Now (with these files) I can see my desktop, but all apps have force close and then my phone reboot...

I think that now it is framework-res related...

Tomorrow I'll try again!

Thank you, again!!!

Sent from My Motosola....
[XPERIA X10 Android Development] dettofatto:
Sorry for double post...!

Nothing...! I have force close for all apps (launcher, usb, phone, etc...etc..) If i press power button, I can see my new option!, but with force close for all apps)

I've also found that when i have added reboot option, I've modified also framework.jar...

see this post (http://xdaforums.com/showthread.php?t=1406207)

Maybe?
[XPERIA X10 Android Development] Tof37:
Ok ;-) For the x10 I have made it but I realized it worked without doing it... I'll send you the line I added in framework.jar so that you should see what to write ;-)
[XPERIA X10 Android Development] dettofatto:
Great! The simbolic donation has some issues... for you!! But I would like tell you that your work, is very important ;)

Thank you again....!

Sent from My Motosola....
[XPERIA X10 Android Development] Tof37:
Hi,

Sorry for long time answer ... was quite busy those last days ....

In framework.jar find in com/android/internal/app a file named shutdownthread.smali

Find this line :

sget v1, Lcom/android/internal/app/ShutdownThread;->mReboot:I

What is following is looking like that :

Modify it to be like that :

Hope it'll work ;)
[XPERIA X10 Android Development] RedSpyderX:
Exactly what I was looking for. I will try it tonight and I will get back to you.
[XPERIA X10 Android Development] dettofatto:
I'll try in this week! Thank you!

Sent from My Motosola....
[XPERIA X10 Android Development] championswimmer:
really nice of you to make such a easy tutorial ...

i love it when people share there development knowledge so that others can also learn :)
[XPERIA X10 Android Development] RedSpyderX:
My rom has const/4 v0, 0x6 :

-Header: Device Options

-Silent Mode

-Data Network Mode

-Airplane Mode

-Power Off

-Restart

Since I'll be adding one more option, do I have to modify const/4 v0. 0x6 to 0x7?

Also, my drawable section seems to have all the memory values used up, and some of them are reserved for APKTOOL DUMMY or something like that. Can I assign one of those to my new drawable line?

Thanks in advance
[XPERIA X10 Android Development] encik_racun:
Can someone make it for me? The screenshot in power menu...

My pc broke down :(
[XPERIA X10 Android Development] Tof37:
Hello,

For the first question : your're right you have to modify const/4 v0. 0x6 to 0x7

For the other question: don't touch apktool dummy id...if you correctly add your lines in strings.XML and got the png in drawable-hdpi folder you just have to add the lines in public.xml like writen in op ;-)
[XPERIA X10 Android Development] jsthorpe:
I'll second that. I CWM-flashable ZIP would be nice.
[XPERIA X10 Android Development] sparkplugDev:
I probably missed something really obvious but what part of the utility do you use to decompile android.policy.jar? I finished decompiling, editing, and recompiling framework-res.apk with the apk re-engineering tool but when I went to try to use the same tool to work on android.policy.jar it occured to me that it wouldn't work because it isn't an apk. like i said this is probably something really simple but could someone please point me into the right direction? thanks :)
[XPERIA X10 Android Development] Tof37:
The option to edit jar files is choice 9 (7 re-engeneering) ;)
[XPERIA X10 Android Development] Ticklefish:
Thanks for this, I'll try it on my Mini Pro when I get a spare moment. Just wanted to say that we don't need to edit public.xml...at all!

Once the icon has been added into the drawable-whateverdpi folder, and the string has been put into strings.xml, compile framework-res.apk and apktool assigns the correct id's automatically. Saves a lot of time...especially if public.xml is huge and not in sequence.

The only time we need to edit public.xml is if you're deleting an image, or a string or anything else that's mentioned there. Then apktool will complain that something is missing.
[XPERIA X10 Android Development] THeLogiC:
Will this mod work on cm7zmod ???( stock based but has all cm7.1 features but there's no screenshot option).
[XPERIA X10 Android Development] alkhafaf:
Can I apply this mod with the 4-way boot mod ? I am using i9000 sgs
[XPERIA X10 Android Development] Tof37:
hmmm ...it'll work ;)

yes you can ;) just beware to get the good number fr the const that tells the system how many lines you got in your power menu
[XPERIA X10 Android Development] alkhafaf:
Hello Tof37

I tried to make this mod, but didn't work, when I hold the Power button the menu doesn't apear and the system freezes then make a fast reboot, I hope u can check my files in the attachments (GlobalActions.smali and Public.xml)

thank you very much
[XPERIA X10 Android Development] Tof37:
I'll have a look at your files ;)

Many reason may cause fast reboot : - wrong id

- missing smali file

- ....

Will look at your files and will get you on the good path ;)
[XPERIA X10 Android Development] THeLogiC:
having same problem here to lol

I also have attached my files too.

Also I already have 5 option my power menu. screenshot being sixth.
[XPERIA X10 Android Development] alkhafaf:
Does the Screenshot option appear when I only modify the framework-res.apk ? without the need to edit the android.policy.jar ?
[XPERIA X10 Android Development] THeLogiC:
Didnt try it but i dont think it should appear as it needs android policy editing

Sent from my X10
[XPERIA X10 Android Development] geva28:
Hi, I using galaxy gio with stock 2.3.6, If I use screencaptureservice.apk didn't use cm screenshot apk, what file I have to be edited...I trying moded global action smali, global action$8 smali, string and public value in framework-res.apk, with results, screenshot option added in power menu but didn't work...:(

edited: solved....;)
[XPERIA X10 Android Development] xSkArx:
How can I make CWM or xRecovery flashable zip whit this files?

Edit: Bootloop on Kernel Logo :C
[XPERIA X10 Android Development] alkhafaf:
Anyone succeeded in making this mod ?

Tof37 seems to be unavailable these days.
[XPERIA X10 Android Development] xSkArx:
I try to recompile android.policy.jar because when I do it I get a corrupt file and get bootloop when I flashed

Edit: a suggestion, you should put which you have to extract the file classes.dex without decompressing android.policy.jar and decompile classes.dex, after recompiling, add the new classes.dex into android.policy.jar

Sorry Bad English
[XPERIA X10 Android Development] chriscx:
thanks for this thread, could someone make a flashable zip for CM9 roms ?
[XPERIA X10 Android Development] xSkArx:
I do it but when I press "Take Screenshot" say "Screenshot is saved at null"
[XPERIA X10 Android Development] xSkArx:
Me but Screenshot is not saved

Edit: I did it :victory: fix permission "/bin/screenshot" :D
[XPERIA X10 Android Development] dzingga:
reserved
[XPERIA X10 Android Development] Tof37:
Hi all,

Sorry to have been away so long ...

I'll be more often here now ...

This can be made but won't be available on all rom ...As every rom as its own framework-res.apk ....And as far as I remember screenshot option is already in cm9 ? (or I've been away from xda longer than I thought :silly: )
[XPERIA X10 Android Development] Mr_Element:
Hi Tof37,

I am currently trying to do this MOD you provided. I am having a hard time finding where this line of code has to go.

It looks similar to THIS one:

But in that case that must mean that either of them is wrong OR that both of them are correct and the FIRST quote has to be placed somewhere you didn't define! Sorry If I sound a bit confusing and as always thanks for your amazing work.
[XPERIA X10 Android Development] Tof37:
Hello,

Thanks for your post ... thought this thread had fallen into xda deep :)

but no ... some people still be interested with it :)

To be quick and clear ...

the firtst quote you made :

nvoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$8

Was juste here to explain what meant this line ... it's not supposed to be include as it in the .smali ... or it won"t work ...

the "full" version is the one you quoted in 2 and the one you need :

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

To be clear with what I understood ;) (I'm not a java dev )....

"Lcom/android/internal/policy/impl/GlobalActions" means the GlobalActions$8 depends of the main GlobalActions file ...

and when you want the phone to do something that is described in this GlobalActions.smali, it's "driving" the system to the right GlobalActions$XX.smali if existing ... which tells how to execute what you asked it to do ....

Hope it's clear enough ;)
[XPERIA X10 Android Development] oSandmaNo:
Hello!!!

I cant find line 195 in GlobalActions.smali! (rooted, deodexed, stock 2.3.6 Motorola Defy+ ROM)

I've reached so far and want to move further !! :D
[XPERIA X10 Android Development] Tof37:
Hello !

I sent you a pm ;)
[XPERIA X10 Android Development] jijox05:
i got this message while recompiling..

i don't know why...

i use tutorial on first post...

btw, i use apktool for decompile... :)

hope somebody can help...

DonutHD 2.3 framework-res.apk..

regards
[XPERIA X10 Android Development] Tof37:
Your 0x108057f id is wrong....you have to search the last one and use the next one.

This can happen too if you forgot to get the png in the fitting folder.
[XPERIA X10 Android Development] jijox05:
thank you...

it's DONE... :D

screenshot working perfect,

but got crash while set sound/display on setting.. :(
[XPERIA X10 Android Development] n00BXperia:
:(

Edit : will it work on any ROM...ie : 2.3.5 ?

got error while building *apk

C:\APKTool>apktool b framework-res
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
C:\APKTool\framework-res\res\values\public.xml:3422: error: Public symbol drawab
le/semc_ic_dialog_screenshot declared here is not defined.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, -F, C:\Users\ADMINI~1\AppData\Local\Tem
p\APKTOOL867588158992219347.tmp, -x, -S, C:\APKTool\framework-res\res, -M, C:\AP
KTool\framework-res\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:193)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
at brut.androlib.Androlib.buildResources(Androlib.java:248)
at brut.androlib.Androlib.build(Androlib.java:171)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:182)
at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\U
sers\ADMINI~1\AppData\Local\Temp\APKTOOL867588158992219347.tmp, -x, -S, C:\APKTo
ol\framework-res\res, -M, C:\APKTool\framework-res\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:191)
... 6 more

C:\APKTool>

hope you guys will help me :( :mad:
[XPERIA X10 Android Development] Tof37:
Hello,

Why it shouldn't :)

For your error look at this : C:\APKTool\framework-res\res\values\public.xml:3422: error: Public symbol drawable/semc_ic_dialog_screenshot declared here is not defined.

You must be missing something :

you missed the .png in drawable-hpdi folder I think :)

Check it and be sure the name you got in public.xml is the same that the file in drawable-hpdi folder
[XPERIA X10 Android Development] dgoby:
I am still very noob at building and was wondering if you can tell me where I'm going wrong with this. Thank you in advance

edit: X10 by the way
[XPERIA X10 Android Development] arocker:
Thank you very much for this tutorial! I have been looking for this!

I would like to add this to a stock touchwiz rom.

Following these instructions I have been able to modify and recompile frameworkres easily.

I have run into a problem with modifying globalactions.smali

I do not have .line 195, I am using .line 399. Is this ok?

The big issue is that I do not have this code in globalactions.smali

invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/ObjectLjava/util/ArrayList;

Instead I have this code:

invoke-static {v1}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/ObjectLjava/util/ArrayList;

Please help, I am new to this and I am so close to finish this mod.

I have attached my globalactions.smali

Thank you in advance!
[XPERIA X10 Android Development] NuriJ:
Sv: [HOW TO] Add screenshot option in power menu for every rom

Forget about .line numbers.. That's for logs only. All roms and phones have different numbers.

And about the code you have instead - i think that would do, atleast you can try.

And this is for x10 running 2.3 only. Maybe you should look for other tutorials for touchwiz :)
[XPERIA X10 Android Development] arocker:
Thank you very much for your responce and advice. Im going to use your suggestions.

I have been looking for a how to like yours for touchwiz but have not found any in this forum. I was aware this was for Sony X10 but did not know it was for 2.3. All other threads about power menu screenshot how to in this forum link to yours. If you are aware of any others like your thread i would be interested to know.

Thank you once again. :)
[XPERIA X10 Android Development] cbucz24:
hey, did you ever get this working on your tw rom??

Search the line 195
It must be like this in stock rom :

Quote:
.line 195
const/4 v0, 0x3

new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;

const/4 v1, 0x0

iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

aput-object v2, v0, v1
If there's const/4 v0, 0x4 : this tell the system how many options you've got in the power menu (here 4)

Just under .line 195 add these lines

i have looked thru my file and i know its here, probably just in a different format...

but im trying to edit a touchwiz rom too. i found the second part (line 399 is about the same as yours) but i cant find the first part to add in the first section??
[XPERIA X10 Android Development] mhashim6:
Plz [MENTION=2070333]Tof37[/MENTION]

i have galaxy ace , there's no .line 195 in androidpolicy.jar , how to add screenshot line :confused:
[XPERIA X10 Android Development] TheTrakO:
How to decompile android.policy.jar on windows 7?
[XPERIA X10 Android Development] Asmy Yuh:
GlobalActions$8.zip is Corrupted :(

can someone upload good GlobalActions$8.zip?
[XPERIA X10 Android Development] Tof37:
[MENTION=5178544]Asmy Yuh[/MENTION]

Hello,

just change the .zip in .smali :)

BTW didn't have time to have a look at your files ... I'm really busy with professional job ...
[XPERIA X10 Android Development] Asmy Yuh:
ok thanks a lot sir

i'll do it myself...if i have problem i'll ask u
[XPERIA X10 Android Development] Asmy Yuh:
i have done all the process but i got these problem
[XPERIA X10 Android Development] Tof37:
Check permissions as shown in op;)
[XPERIA X10 Android Development] Asmy Yuh:
Success!!!
[XPERIA X10 Android Development] shinjarey:
global action smali $8 is broken files zip...

global action smali$8.zip is broken files could you pls update this,,, tnx:(:rolleyes::p:laugh:
[XPERIA X10 Android Development] Tof37:
hmm link seems to work ... just rename it in .smali instead of .zip ;)
[XPERIA X10 Android Development] shinjarey:
thanks...

thank you sir i will try....:o:):):D

---------- Post added at 10:23 PM ---------- Previous post was at 09:33 PM ----------

i try to rename the globalaction8zip to smali but dsame problem encounter error its not readable... can you share your globalaction8.smali pls
[XPERIA X10 Android Development] shinjarey:
edit got it but.. another error comes...

sir i got it phones open after reboot...screenshots icon showing in power menu But when i take a screenshoots this errors come...

error unable to save screenshoots:Mbitmap=null........

sir pls reply if you have tym... tnx:angel::angel:
[XPERIA X10 Android Development] Tof37:
Check the permission of the name screensnhot in /bin

The permission have to be like I wrote in op
[XPERIA X10 Android Development] shinjarey:
convert to letter pls

sir im newbie in android theming i didnt no the value of 4775 in permission.. pls convert it to letters like rwrr or else...pls sir.. because i only push the bin file to system ....thanks:angel:
[XPERIA X10 Android Development] Tof37:
try this post
[XPERIA X10 Android Development] shinjarey:
not working for me..

tnx for this sir but its not working for me..error running exe command system bin screenshoots... btw my phone is alcatel 918n..

any solution sir..tnx:rolleyes::rolleyes:
[XPERIA X10 Android Development] Sahil Kundu:
framework editing

Never find .line 195 in my framework

What to do now
[XPERIA X10 Android Development] Chikkka:
Sorry for necrobumping...can someone help me with this one?.. my phone always get into bootloop whenever I do this... I don't know how to do it :(
[Fascinate Q&A, Help & Troubleshooting] bollorr:
Hi guys,

I'm afraid my emmc is fried. After occasional crashes/freezes/FC's in different apps/Android modules in CM7 over a few months, one day I opened this site in the browser, and the browser FC'ed and then kept FC'ing when opened. When rebooting, the phone gets stuck looping in the CM7 animated start-up logo. When I boot in Clockworkmod (v4.0.1.0) , I get this error:

E: Can't mount /cache/recovery/command

E: Can't mount /cache/recovery/log

E: Can't open /cache/recovery/log

E: Can't mount /cache/recovery/last_log

E: Can't open /cache/recovery/last_log

and I can't use Clockworkmod. Cannot mount/wipe cache, cannot install anything. I tried checking the eMMC with ADB and FASTBOOT, but they can't see the device, though Heimdall does see it as I was able to flash recovery.bin again in d/l mode (but without fixing the problem). Please help, I've run out of ideas and have no phone...:(
[Fascinate Q&A, Help & Troubleshooting] droidstyle:
you need to get into recovery via the power menu...depending on what kernel version your running, three fingering into recovery will cause a bootloop. the same thing applies to all ICS roms. If you can no longer get the phone to boot up then simply odin cwm4 fixed for cm7, three finger into recovery, wipe data, then reflash the rom. Make sure everything is backed up first. More information can be found in section 3 here:

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