Editing smali code. - Android Q&A, Help & Troubleshooting

Hey you gurus out there. Any extra ordinary person out there? Help me edit some smali code to add the buttons in my rom.
I av added the resources to framework-res.apk added the images and added the necessary values in the strings.xml, public.xml. damn those files are hard to edit. I had to do vb.net application to scan available item ids. But wen it comes to editing the smali files it really hard for me. Would be happy if anyone help me out
Sent from my TECNO N3S

Related

Beginner Battery MOD Question

Im beginning to learn a few basics about modding the systemui.apk.
I can use the AUTO APK TOOL to decompile my SystemUI.apk, decompile the classes.dex file into smali code, use dex2Jar & jd-gui to view the classes.dex file in java.
As a project for teaching myself about the android system i'm looking into modding the battery icon. I have followed a few guides/tutorials and have a basic knowledge/understanding on what files to change/add in SystemUI.apk (stat_sys_battery.xml, stat_sys_battery_charge.xml, battery-con png files in 'drawable-xhdpi', then recompile and push to my phone (SGS3).
My questions are:
1. Do all Mods that change system settings/layout have to be baked into the SystemUI.apk? Or in this example is it possible to develop a small application using Eclipse, which when a button is clicked it change's the battery icon dynamically?
Hope it makes sense

[REQ] Modification of framework-res

Hello. I wish someone could help me with editing my framework file. I have some problems with apktool Basically I need someobe who could edit some files in res/values. Enable on screen buttons and change their height to 24 pixels. Enable 'ShowNavigationBar' in bools.xml and 'NavigationBarHeight' in dimens.xml. Every helpful post in this thread will be thanked
Edit: oops, there is the link http://db.tt/Dlu60svI

[Q] [Advanced question] Editing framework

I'm recently trying to edit my framework with this mod
http://forum.xda-developers.com/show....php?t=1916094
Well actually the steps in that thread are very simple, but since I'm trying to apply that to my Xperia Ray so it must have slightly different steps
What I want to ask :
- In framework/res, I found drawable-.........( mdpi,hdmpi,ldpi,etc.). If I'm going to replace the .9png's picture in there, should I make the picture as same as the original picture dimension? I'm using Dev-Drawable app in the Play Store ( it makes picture to drawable- hdpi,mdpi,etc. ), the result of using it is it gives me the mdpi version of the picture but with different dimesion from the original picture.
- I found errors and it says that I have errors in the /res/values/public.xml
I found this :
Code:
Don't do that! I think I should explain the purpose of public.xml file in the project wiki, because many people are confused. Note that you don't need this file when you build an apk from sources and apktool building mechanisms are very similar, so guess what: you could remove this file from decoded application and apktool will rebuild it without any problems. I had a reason why to generate public.xml - it's a feature, not a bug!
Well, the reason is: there may be references to resources in the application code. If resources ids will change after build, then code will reference different resources than in original apk. public.xml file gives us sureness that resources will get same ids after build - it's the only one reason to use this file. And you want to manually modify these ids
Adding or removing new resources is somewhat tricky. Yeah, I should write about that in the wiki.
You could remove any line from public.xml (even making a "hole" in the ids) at any moment, but you must be sure, that resource isn't referenced in the code.
There is never much sense in modifying ids in public.xml, because then modified lines lose their purpose.
If you want to add new resources, e.g. drawables and use them in the XML files you don't have to change anything in the public.xml file.
If you want to add new resources and use them in your code, then you have to add them into public.xml, because you need to reference them somehow. Or you could use Resources.getIdentifier() method, but this is ugly.
And now the most tricky part: if you want to remove some resources, you have to remove info about them from public.xml as well. So first you have to be sure that they aren't referenced in the code. But there is also this "hole" problem, so:
If these resources are at the end of ids stack, then there is no problem.
If resources are near the end of ids stack and you are sure, that all resources after them aren't referenced in the code as well, then you could just remove them all. Actually you have did virtually the same, cause after modifying ids you made these lines totally useless, you broke them, so you could just remove them.
If you want to remove some resources, but add same or greater quantity of new ones (of the same type), then there is no problem - new resources will automatically fill in "holes" in ids. You don't have to add them to public.xml .
If none of above conditions are met, then you have holes and you have to fill them by something. But you don't have to add "useless .pngs" - just add:
Code:
<item type="drawable" name="DUMMY1" />
<item type="drawable" name="DUMMY2" />
<item type="drawable" name="DUMMY3" />
...
Like above, you don't have to add these resources to the public.xml .
And because I'm a newbie I don't really get what that mean. So I just delete the files that I'm going to replace and I can re-compile the framework, but I got bootloop, LOL.
I confused about :
1."You could remove any line from public.xml (even making a "hole" in the ids) at any moment, but you must be sure, that resource isn't referenced in the code."
What are the "holes" and " referenced in the code" mean?
2. Because I want to add .png's picture to the drawable-mdpi folder, Do I need to add dummies to the public.xml ?
3. I'm using the tricky signing method ( open archive in the original framework, copy meta-inf & android manifest and replace those files to the modded framework). Is this cause me an error?
Help me mateee
Why do you post this thread 2 times?
mihahn said:
Why do you post this thread 2 times?
Click to expand...
Click to collapse
Cause no one reply & help meee:crying:
RivaultUser said:
What I want to ask :
- In framework/res, I found drawable-.........( mdpi,hdmpi,ldpi,etc.). If I'm going to replace the .9png's picture in there, should I make the picture as same as the original picture dimension? I'm using Dev-Drawable app in the Play Store ( it makes picture to drawable- hdpi,mdpi,etc. ), the result of using it is it gives me the mdpi version of the picture but with different dimesion from the original picture.
Click to expand...
Click to collapse
It's best to keep the original dimensions yes although not essential, but some images will look strange if not.
RivaultUser said:
- I found errors and it says that I have errors in the /res/values/public.xml
I found this :
Code:
Don't do that! I think I should explain the purpose of public.xml file in the project wiki, because many people are confused. Note that you don't need this file when you build an apk from sources and apktool building mechanisms are very similar, so guess what: you could remove this file from decoded application and apktool will rebuild it without any problems. I had a reason why to generate public.xml - it's a feature, not a bug!...
I confused about :
1."You could remove any line from public.xml (even making a "hole" in the ids) at any moment, but you must be sure, that resource isn't referenced in the code."
What are the "holes" and " referenced in the code" mean?
Click to expand...
Click to collapse
It means you can remove lines so long as they don't point to anything in the drawables folder for example.
RivaultUser said:
2. Because I want to add .png's picture to the drawable-mdpi folder, Do I need to add dummies to the public.xml ?
Click to expand...
Click to collapse
No.
RivaultUser said:
3. I'm using the tricky signing method ( open archive in the original framework, copy meta-inf & android manifest and replace those files to the modded framework). Is this cause me an error?
Click to expand...
Click to collapse
No. If you're doing it like in my guide you should be fine. Re read the bold quoted text above.

Help with public.xml editing! Please!

Hey guys if any of you are experienced with editing the public.xml file. Please let me know, i need to give these items new id's in the public.xml but everything i can think of is used up or out of range and causes it not to compile. I always get stumped on these id's and have no idea how to edit this properly.
This is adding 3 button tab's to a Sense modded Settings menu thats the form of AOSP. Any ideas on what the next id's can be and wouldn't cause a problem?
Public.xml (Need help finishing) http://pastebin.com/En6sjvpe
Strings.xml (Complete at bottom) http://pastebin.com/0KGQg4aa
ids.xml (Complete at bottom) http://pastebin.com/Ln1pc8nH
Res/XML/settings_headers.xml (Complete with edits) http://pastebin.com/Xv9dhvYp
Really stumped here guys please help me

How to Add Java codes to Decompiled Files?

I decompiled an Apk file and I want to add some code to the java classes,but it seems that the javaclasses are different from the way they are written,for example those who edit WhatsApp and make WhatsApp plus ,how did they decompile WhatsApp to get dull source code and add some java codes to add features ?really frustrating !
The apk is most likely obfuscated with some program such as proguard because the developers do not want you looking at their source code..

Categories

Resources