[Q] "smali" files on the I727? Can they be edited without Baksmali (Deodex)? - AT&T Samsung Galaxy S II Skyrocket SGH-I727

[Q] "smali" files on the I727? Can they be edited without Baksmali (Deodex)?
I've been looking into the coding on this phone for a while. I've made a couple of posts trying to figure out how to get Nfc enabled on this phone with no luck. So I am trying to look into it a bit further myself. I'm learning as I go, but I am trying to compare other phones files (and custom ROM files) with working Nfc with the stock ROM files on the SkyRocket to try and find clues as to which files are needed to start working on this. One thing I notice (difference) is there doesn't seem to be any "smali" files or code on the SkyRocket stock ROM. Can someone please tell me where they are located (I am rooted and use Root Explorer) on the Stock ROM or which files are used in their place?
Thanks.
**Edit**
OK, I've done a little more research and found out the "smali" code in an Odexed ROM is located in the Odexes. In order to work on them I am guessing they would need to be DeOdexed? Or is there a way to view and edit them without Baksmali?

typically bc
an odex file is renamed to class.dex and combined into the same apk
deodexing basically works likethis
every apk needs a set of instructions
thats the odex
so by removing the odex and turning it to a classes.dex
file we can remove the unwanted odex file
and speed up access to the files instructions
opens faster closes and caches faster i do beleive i could be wrong
but i know the general idea

Related

Ways to make a rom

By any chance could someone tell me the best way to make a rom, I have a droid 3 and really want to make a rom but I don't know where to start, thanks in advance
Sent from my DROID3 using XDA App
The best roms start with 3 eggs and little bit of milk to make them fluffy. Whisk briskly!
If you want to jump in, this is a good place to start http://source.android.com/source/index.html
If you just want to dip your toe in the water, then you could start with modding roms, such as adding/removing apks, theming, writing update scripts.
Find a rom and unzip it. Look inside, poke around. Don't be shy-take things apart. Peel back the layers until you find xml and png files. Then, put it all back together and see if you can get it to flash.
Thanks
Sent from my DROID3 using XDA App
thanks so much for the info!
If you download a rom and unzip it, there will be a META-INF folder- look in here- there will be some crypto certs and a com/google/android/ folder which will have the updater-script and update-binary. The script is how the phone knows what to do with the rom. Read through the script and try to decipher what it is actually doing. It will be different for some roms. For example, the cyanogen roms will back up some system apps and replace them after flashing.
You might also come across a boot.img in the root directory of the rom. If you do, there will be some instructions in the updater-script for what to do with it.
Next look in the system/app directory- you'll find a bunch of apk files. These are actually in zip format, so you could unzip them to see what is inside.
A basic test would be to add or remove an apk to the system apps and then get it to flash. Of course you'll need a rooted phone and maybe jarsigner or signapk. Signing a rom will put all those CERT.RSA files back into the META-INF/ folder, which contain crypto hashes of all the files and the names of the files. Some recoveries will allow you to flash an unsigned rom, but you might as well figure out how to sign them. It's in the android link I posted earlier.
Good luck!
Thank you for that also this is very helpful I was kinda confused on where to start with aosp, also that the droid 3 has a locked bootloader
Sent from my DROID3 using XDA App
By any chance would you know how to do some theming? If I understand right it has to do with decompiling the framework-res and systemui apks, and replacing some pngs and xmls with others right?
Sent from my DROID3 using XDA App
I just got started with this so I am by no means an expert. I think you'll want to start by deodexing a rom so that you can make changes to the res, xml, etc. I think most stock apps come as a two part package- an .apk file and an .odex file, both with the same names. Find a stock app and look in the framework and app folders. De-odex-ing takes the odex file, de-compiles it, and then recompiles it into a classes.dex file that is put back into the apk or jar file. This configuration will should allow you to make changes without having to compile the rom from scratch... at least that is my understanding.
Find an apk that doesn't have an odex file and look for the classes.dex file inside. Then take a peak in the res folder in the apk. In the res folder you'll find all sorts of xml and png files.
To get started with decompiling, you'll want baksmali http://code.google.com/p/smali/wiki/DeodexInstructions
Take a look at the issues. JesusFreke wrote some interesting comments in issue 61.
I think there are a few other packages that will do the same thing, and there are certainly a few scripts that will work too.
I ran into some issues with deodexing honeycomb- I outlined the process here http://forum.xda-developers.com/showthread.php?t=1324653.
This is also a good source http://wiki.sdx-developers.com/index.php/How_to_deodex_a_ROM
Good info, thanks.
thank you you have been extremely helpful, im gonna try to get my rom out by sometime this week thank you
I just did some mini-theming. I have an ASUS Transformer- the stock rom has it's own back/menu/home buttons. I wanted a more complete honeycomb look, so I grabbed the stock honeycomb versions from a xoom rom, and added them into my deodexed stock ASUS SystemUI.apk. Oddly enough, if I signed the apk, it wouldn't work, but if I left it unsigned, it works fine.
thats odd, i thought you needed to sign it for it to work

HELP with Decompiling APK (using APKTOOL)

I've looked around for some good tutorials on decompiling APKs using APKTool but haven't been able to get a few questions answered. Hoping someone can guide me with this process a bit since I'm really new at it.
A few things first: I am running CM 7.1 on a Droid Incredible (orig) and I'm also on Windows, not Linux. I'm looking to make some changes to the code of an APK and have APKtool downloaded. Questions I have so far are:
1) Do I need to use the CM 7.1 framework-res.apk file for any decompiling / /recompiling work on this 3rd party APK? Or can I do all the work without it? No one seems to have a clear answer on that and I'm not sure exactly what the framework-res.apk is for exactly.
2) After I decompile an APK and make code changes to a SMALI file, is there anything I need to do special before running the compile command?
3) After I have a newly compiled APK, what do I need to do to make this work on my phone? If I do nothing, the overall file size of the compiled APK seems much smaller than the original one that I decompiled so it seems like something is wrong. Plus it won't install. I saw one video where the newly compiled APK is renamed to .ZIP and the contents are put into the ORIGINAL APK (also renamed to .zip), overwriting all the original contents. Is this required?
4) I've also read that APKs need to be signed to install on Android. Is this correct? I found "SignApk" online which seems like it just asks you to rename your APK to app.apk and it does the signing by running a .BAT file. Is that all I have to do before installing the APK on my phone?
Would really appreciate any help on this. Or if there's a great tutorial out there on doing this, I'd be happy to read through.
Thanks for any help in advance!
I want to know these too! Hope someone helps

[Q] Guide Request-- How to Implement Krylon's CIQ Removal

Hello. I would like to know if anyone has an actual beginner's guide to CIQ removal. For a minute, there was a guide that didn't quite have all the bugs worked out of it, but it was removed. I've been trying to follow Krylon's thread on rootzwiki, but it seems to stop short of telling people how to actually recompile everything and push it back to the phone. It would be helpful and informative to be walked through this process once the CIQ files have been deleted from the decompressed classes.dex files and .xml manifest.
Thanks
Note: So far, I have figured out that autosmali can be used to smali the files back into a classes.dex file, which can be reincorporated into the associated .jar files using 7zip. Seems simple enough. However, the process of getting framework-res updated seems to be more complicated, and requires answering some questions about. Specifically: 1. Option 11 asks (a) Is this a system apk? (b) Aside from the signature, would you like to copy over any additional files that you didn't modify from the original apk in order to ensure least # of errors? I have answered "yes" to 1.(a) and "yes" to 1.(b), which told me to delete the .xml and the resources.arcs file from a temp directory before completing the compile. This whole process has left me with three modified files (framework.jar, android.policy.jar, and framework-res.apk (unsigned)). Now what do I do with them?
Note 2: Looks like I can sign the framework-res.apk file using option 12.
Once you are done modifying the files you need to either put them in an update.zip and flash or push them with adb to their respective folders.
As for someone giving a step by step I doubt that will happen. It seems like the ones that do know how to do alot of the modifications to roms, are pretty vague when they post how to's. Most of the time it seems like they just don't want to share the information. Why I don't know, but that is just my opinion. I am sure I will probably get flamed for saying this but again this is just my opinion.
You can search the forums and find most of the information here and there. Then you need to put it all together and hope it works.
My thought's would be to have a seperate area in the forum to post just Tips, Techniques and How To's. Then alot of the people that want to learn how to theme and build roms would have an better source to find their answers than having to search all the forums. Again just my .02 cents worth...
Hope no one is offended by this as that is not my intention.... XDA is a great source for information...
quick steps..
Decompile Framework.jar, delete the entire carrieriq dir and all it's contents, recompile.
delete /system/xbin/iqbridger
DONE
Makes the rest dead code.
tablador said:
Hello. I would like to know if anyone has an actual beginner's guide to CIQ removal. For a minute, there was a guide that didn't quite have all the bugs worked out of it, but it was removed. I've been trying to follow Krylon's thread on rootzwiki, but it seems to stop short of telling people how to actually recompile everything and push it back to the phone. It would be helpful and informative to be walked through this process once the CIQ files have been deleted from the decompressed classes.dex files and .xml manifest.
Thanks
Note: So far, I have figured out that autosmali can be used to smali the files back into a classes.dex file, which can be reincorporated into the associated .jar files using 7zip. Seems simple enough. However, the process of getting framework-res updated seems to be more complicated, and requires answering some questions about. Specifically: 1. Option 11 asks (a) Is this a system apk? (b) Aside from the signature, would you like to copy over any additional files that you didn't modify from the original apk in order to ensure least # of errors? I have answered "yes" to 1.(a) and "yes" to 1.(b), which told me to delete the .xml and the resources.arcs file from a temp directory before completing the compile. This whole process has left me with three modified files (framework.jar, android.policy.jar, and framework-res.apk (unsigned)). Now what do I do with them?
Note 2: Looks like I can sign the framework-res.apk file using option 12.
Click to expand...
Click to collapse
Don't use option 12.
NEVER SIGN A SYSTEM APK
krylon360 said:
Don't use option 12.
NEVER SIGN A SYSTEM APK
Click to expand...
Click to collapse
Thanks krylon for the quick fix.
If, for completeness, I wanted to put all of these modified files on my phone (unsigned), how would I do it? Last time I tried, I used a root file explorer and my phone started bootlooping immediately after placing framework-res.apk on the phone. Adb was not available, so I had to reflash in order to put the file back the way it was. I was thinking maybe to adp push the file instead of copying it with the explorer.
adb push then reboot.
but, it's best to do it as a fresh install.
Thanks, I will give that a try.
Followed these directions 3x, but when I boot up my phone with these changes, the Android System process stops responding every time i boot my phone. I can bypass the error message fine, though.
edit: Well, after reflashing it 2 more times with the exact same rom, it doesn't happen anymore. MEH, who knows?
One of Raver's ROMs did that too. I think it is a dependency to something you removed. It was fine on the ROM. One FC when you boot ROM and that was it.

Remove Battery Indicator Icon

Is it possible to remove/hide the battery icon? I'm on a Samsung Epic 4G Touch with a stock ROM that's been rooted.
I don't want to replace it with something else (I've already done that). I want to remove it, so it doesn't take up space in the notification toolbar.
Thanks for any help.
you could ask Master&Slave(tm) . as you can see in this thread he made some statusbar mods before and maybe he knows how to do that
there is a tut in second post of this thread:
forum.xda-developers.com/showthread.php?t=1371330
i havent tried it, since my rom has this option built in
t0mas_ said:
there is a tut in second post of this thread:
forum.xda-developers.com/showthread.php?t=1371330
i havent tried it, since my rom has this option built in
Click to expand...
Click to collapse
^^^I second this^^^
I have previously used this method on the t-mobile sgsII. Worked great!
I tried following that exact post last night, but I ended up with a missing status bar. The issue I'm having is that none of the instructions I've seen are for an odexed system. I'm running the stock rom, so all my .apk files have corresponding .odex files, rather than containing a classes.dex file within the .apk file. I'm not sure, but I suspect this could be the reason I haven't gotten it to work.
Basically, I'm doing the same thing as the instructions say, but instead of extracting classes.dex from the SystemUI.apk, I'm using SystemUI.odex, since SystemUI.apk doesn't contain classes.dex. I baksmali SystemUI.odex file to extract the code, modify the code, then smali it back into a new SystemUI.odex, and replace the existing SystemUI.odex with the new one.
Any reason why this shouldn't be working? One possible error that I thought of is that I think I pointed smali to one level too far up in the code directory structure when generating the new SystemUI.odex. Using baksmali produced "out/com/android/systemui/...". In the smali command, I used "out/com", but I think I should have used just "out". I'm going to try again tonight and see if that was the problem. Otherwise I'm out of ideas.
i dont think it is possible to edit odexed apks. not sure though...

How to re-odex?

Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
[mini HOW-TO] Re-Odex (or create a new .odex file)
Fall of Enosis said:
Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
It all needs to be done on your phone, live.. with adb.
Here's how I accomplished it - I will use the services.jar in this example. Just change the file name and path to existing .odex accordingly for other files (not sure if all steps are required exactly, but it has worked for me multiple times with different jars and SysUI apk):
Requirements:
Odexed system
adb
dexopt-wrapper
Put this dexopt-wrapper file (unzip first) in /system/bin with 775 permissions:
X X X
X....X
X....X
Probably a good idea to reboot after pushing that file, if you use root explorer (like I did).
Put the deodexed services.jar (or other jar/apk file you want to make an new odex of) on your sd card.
Go to /system folder (with root explorer or equal) and mount it R/W (not sure if this is necessary - but won't hurt)
Put your USB connection to "Charge only" mode.
Go here (big props and credit to jhotmann for this) and follow steps 8-12 (I've recreated the steps with the A2's bootclasspath below).
The bootclass path is located in the /init.rc file at the root of your phone.
Connect with adb (do a adb devices check to make sure you're all good).
To create the new odex:
Code:
adb shell
su
cd /sdcard/
dexopt-wrapper services.jar new.odex /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar
I know it's a long entry for those who don't work with command lines often (like me), but double check your entry before hitting enter.
To copy the signature from the existing odex (change path to /system/app/.. if necessary):
Code:
busybox dd if=/system/framework/services.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
Done! Rename new.odex (created on your /sdcard) to services.odex since that is your new signed odex file...
You can then get that on your odexed system by your choice of method (adb push, update.zip, root explorer push, etc.. - note: please know what you are doing before trying to push files with root explorer! - you cannot simply copy and paste!)
Or, if you want to deodex it right away again for some odd reason like I did (personal issues )... Take the services.jar and the new services.odex from your sdcard and put them on your computer - and open the services.jar with 7-zip (maybe winzip) and delete the classes.dex file from the 7-zip window. Now you have a fresh new set of .jar/.odex files ready for deodexing (I did this all with the SystemUI.apk last night, that's why I elaborated and re-typed this whole thing today..).
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Fall of Enosis said:
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
Not a prob.
And, I updated the dexopt-wrapper link so it's easier to download - just unzip it first..
Good luck on your quest.. let me know if you catch any snags along the way - and i'll try and help you out.
Sent from my mind using XDA
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Fall of Enosis said:
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Click to expand...
Click to collapse
So, you have a deodexed services.jar (with an unedited classes.dex inside)? And, you also have an edited classes.dex (the new modded one). Just drag and drop the new modded classes.dex into the services.jar file with 7-zip to overwrite the old one.
Then I would check out the mods on a deodexed system, and provided they work, then go through the re-odexing process (separating that classes.dex from the apk and creating a new odex file) as described above to get it working on odexed systems.
Hope that helps.. Good luck!
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Fall of Enosis said:
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Click to expand...
Click to collapse
Not sure about the details of that.. I know the signatures can be tricky, but I've modded a few apks/jars similarly with no problems... when you say "can't install.." is that it wouldn't flash in recovery, or you bootlooped?
Just wouldn't flash at all.
And thanks for all your help man.
Sent from my MB865 using xda premium
I've updated the 2nd post with more detail on creating a new odex file...
Not to be a "rooster" (replace with your word of choice) or anything, but maybe this info has a place somewhere besides the general threads..?:angel: (and what is up with these new Smilies and posting reply layout?) - it just seems so hard to come by good literature on this process (which, I suppose, is a process so rarely needed though...)
So I need to perform the processes above while running in an odexed environment correct? Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK? I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Didact74 said:
So I need to perform the processes above while running in an odexed environment correct?
YES.
Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK?
(Yes, it will create a new odex file that you will need to rename, but..)NO. You will need to take the classes.dex out of the deodexed apk/jar - use something like 7-zip. Unless you only edited smali, then you really only need the new odex file.
I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Click to expand...
Click to collapse
I broke up your quote with my best answers...
As for what your're left with is a new.odex file, properly signed, if all goes well. You are going to need to do it for each of your deodexed files.
Rename them, remove the classes.dex from the deodexed files you used, and get them on your phone however you choose (I prefer zip packages and a restore.zip in case something goes wrong).
Also note that the bootclass path is different from GB to ICS.. and among different devices of course. Check init.rc file if need be. I posted the one to use for A2 ICS (think it may be the same for razr too) here: http://forum.xda-developers.com/showthread.php?t=1753659
I can't garuntee you won't have problems, but good luck... if you do you could try the dexopt-wrapper from here: http://forum.xda-developers.com/showthread.php?t=1645950 - just unzip it first obviously (but I think it's the exact same file though..)
Btw, it's all done with adb, one line at a time.. not really a script, but thank you for the idea - maybe a batch file?
Sent from my phone's mind
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Didact74 said:
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Click to expand...
Click to collapse
But, you deodexed them to edit the smali files in the classes.dex right? So, no, you will need to use the new odex files that are created from the modded deodexed files you used..
If you never edited any of the smali files, then you didn't need to deodex in the first place... you only need to deodex in order to mod the smali files - everything else in the apk can be modded as is on odexed systems.
Sent from my phone's mind
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Didact74 said:
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Click to expand...
Click to collapse
Updated the link in Post #2 with a zip file - you need to unzip it first then move it.
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Didact74 said:
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Click to expand...
Click to collapse
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
alteredlikeness said:
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
Click to expand...
Click to collapse
Yes, all .jar files listed in my bootclass were located in the framework directory.
Nevermind...my mistake. I had an issue with my files not being deodexed correctly from the start. I went back and deodexed, made the edits to res and smali then odexed using the method above again and all went well!
Thanks!

Categories

Resources