Need some .Java asssistance [for Tab+] - Samsung Galaxy Tab Plus

This can be moved to development if needed.
^prob some Android exp needed as well, but if you're here reading this I assume you have some.^
I am interested in adding an extended power menu, among other things (CRT anim ON if possible, and maybe a few other small ones.)
(yes Im looking at you guys @garyd and @Entropy, j/k you guys work hard enough Im sure.)
While I am reading my intro to Java Programming. I understand Basic programming, Java is what I need to learn. I am also studying .dex in hopes of one day being able to at least edit it.
If anyone would like to help , I have managed to decompile .dex into .jar and from .jar got all the .classes, etc. and then decompiled to .java, which is so much more readable than .smali. ( as it should be)
I have followed the few guides I could find for extended power menu, trying a few different things as I understand all devices are different. flashed and booted, but power button does nothing.
From what I understand it is actually possible to compile .java to .smali to .dex
from what I can gather this involes adding a mReboot:I options to reboot or reboot recovery. Then adding the array to the power menu, then adding the drawable ids and string ids (which I know how to make with apktool).
I saw one thread stating an entry in build.prop ro.mot.deep.sleep.enabled=true was also required.
PM me or reply if interested. I can upload .java files.
--just trying to get some fresh "development options going"
my next book will liekly be the : 6-in-1 building an android app, which I have done with the google App Inventor. It was fun.
*small donation can be made*

Related

Compressed Resources (resources.arsc) Decompressor

First time poster, but long-time lurker and avid Android Developer here.
I'm putting the finishing touches on a tool that decompresses resource files (including the ARSC and any compressed XML files). It's something I sort of took interest in in my spare time, as a learning experience, and I think it would be helpful to the community. It could probably be used to make modifications to compressed layouts in a ROM, such as HTC Sense-based ROMs (decompress the resources, make edits, compress, sign...).
Anyways, I figured I'd ask first... does a tool like this already exist? If so, whatever, this was a learning experience anyways. If not, I'd like to get it out there for all of you geniuses to use.
I'd also like to know what kind of options might be good to have on this tool. Right now it's command-line-based (and might stay that way... I think a UI might be overkill). Let me know. I'll be watching!
That's great!
In which language is it written? Will you open-source it? If so, on which license?
I'm asking cause I need such tool for my Omnipatcher project and I intended to make it myself
Java. I'll probably open-source it once I clean it up enough. I mean, nothing's really a secret in there. I figured out everything I needed from the Android sources.
Brut.all said:
That's great!
In which language is it written? Will you open-source it? If so, on which license?
I'm asking cause I need such tool for my Omnipatcher project and I intended to make it myself
Click to expand...
Click to collapse
When?
When will you relase this?
Oh, good work!!!
Any news?
itanczos said:
Oh, good work!!!
Any news?
Click to expand...
Click to collapse
Sorry guys, I'm really eager to get this out, I'm just struggling to pay the bills, too. I hesitate to make promises, but it should be out sometime this month. I'm just as excited as you probably are to use it. I can't wait to see what kind of themes/mods sprout up once you all get your hands on this.
That sound cool, I was also thinking in creating such a tool or maybe just a shell script that uses aapt to get all the infos and generate an xml out of it but if you already have something in the pipe for doing this... I hope it's finished (or better said at a release stage) soon.
rac2030 said:
That sound cool, I was also thinking in creating such a tool or maybe just a shell script that uses aapt to get all the infos and generate an xml out of it but if you already have something in the pipe for doing this... I hope it's finished (or better said at a release stage) soon.
Click to expand...
Click to collapse
Doesn't aapt only compile the resources, and not the other way around? I didn't think aapt gave us all the information we needed to go back to the original XML.
binarybulge said:
Doesn't aapt only compile the resources, and not the other way around? I didn't think aapt gave us all the information we needed to go back to the original XML.
Click to expand...
Click to collapse
It has dump command and output looks like full XML data just in different (easy to parse) format:
Code:
N: android=http://schemas.android.com/apk/res/android
E: manifest (line=44)
A: android:sharedUserId(0x0101000b)="com.google.android.apps.maps" (Raw: "com.google.android.apps.maps")
A: android:versionCode(0x0101021b)=(type 0x10)0xcf6
A: android:versionName(0x0101021c)="3.3.1" (Raw: "3.3.1")
A: package="com.google.android.apps.maps" (Raw: "com.google.android.apps.maps")
E: uses-sdk (line=54)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x4
E: uses-permission (line=58)
A: android:name(0x01010003)="android.permission.CALL_PHONE" (Raw: "android.permission.CALL_PHONE")
binarybulge said:
Doesn't aapt only compile the resources, and not the other way around? I didn't think aapt gave us all the information we needed to go back to the original XML.
Click to expand...
Click to collapse
Code:
aapt dump xmltree xxx.apk AndroidManifest.xml
This does output some sort of xml like output... at least as far I have analyzed the output, it should be possible with some parsing code to recover or better said reconstruct a working xml ;-)
Of course, just implementing a complete encoder/decoder would be a nicer solution and as you said, theoretically all the needed framework stuff is on git so it wouldn't be hard to implement it if you have time... I though that this was what you have done or not?
rac2030 said:
Code:
aapt dump xmltree xxx.apk AndroidManifest.xml
This does output some sort of xml like output... at least as far I have analyzed the output, it should be possible with some parsing code to recover or better said reconstruct a working xml ;-)
Of course, just implementing a complete encoder/decoder would be a nicer solution and as you said, theoretically all the needed framework stuff is on git so it wouldn't be hard to implement it if you have time... I though that this was what you have done or not?
Click to expand...
Click to collapse
Haha, yeah it is what I have done. You guys just kind of worried me a little making me think I was reinventing the wheel.
aapt would have been one approach, but I'm still not sure it covers all bases. For example, the strings.xml, arrays.xml, etc files. Those obviously aren't handled the same as layout files. Their contents get compressed into the arsc file. I'm also handling some more complex cases, such as one package referencing drawables from another package.
My goal of course is to restore all input XML, including things like strings.xml, and all of those in various configuration-specific folders (orientation, locales, screen sizes...).
is there any public source of this Compressed Resources (resources.arsc) Decompressor?
i'd like to test it!
Hello Binarybulge!
News?
Is this dead or what?
I'm working on such tool on my own, have managed to decode XMLs (using Android source, not parsing aapt dumps) and now I know, what binarybulge was talking about:
binarybulge said:
aapt would have been one approach, but I'm still not sure it covers all bases. For example, the strings.xml, arrays.xml, etc files. Those obviously aren't handled the same as layout files. Their contents get compressed into the arsc file. I'm also handling some more complex cases, such as one package referencing drawables from another package.
My goal of course is to restore all input XML, including things like strings.xml, and all of those in various configuration-specific folders (orientation, locales, screen sizes...).
Click to expand...
Click to collapse
binarybulge: please, let me know, whether you have quit, don't have time, died or what? Currently I'm working on decoding @ids and /res/values/ and I don't want to reinvent the wheel, if you have done this so far and just don't have time to continue your work.
I'm interested in pitching in. I want an easy tool for decoding a binary .xml file, edit it including adding new elements and then convert it back to binary xml.
I'm pretty familiar with Android low level stuff. One example of my work:
http://forum.xda-developers.com/showthread.php?p=5475283
If I can help in any way, let me know. I don't want to reinvent the wheel either.
jonasl said:
I'm interested in pitching in. I want an easy tool for decoding a binary .xml file, edit it including adding new elements and then convert it back to binary xml.
I'm pretty familiar with Android low level stuff. One example of my work:
http://forum.xda-developers.com/showthread.php?p=5475283
If I can help in any way, let me know. I don't want to reinvent the wheel either.
Click to expand...
Click to collapse
Just for curiosity: how did you do it? Hex edited xml's and resources.arsc?
I'm still working on this tool and have made some progress
Everything that's been done on the keyboard linked above has been done in code. You of all people need no introduction to smail/baksmali
I've rewritten the configuration system (HTC's settings provider is missing in non sense roms), rewritten the parts that interfaces with google voice recognition service and some other tweaks, but it's all code mods.
To fix some remaining issues I must edit xml layouts. Just changing some color code etc. is doable in any hex editor, but adding and removing elements and attributes is kind of hard. I'm stuck at this point and was looking for a tool to convert own xml to binary xml. Since I didn't find such tool I was thinking about creating one and ran into this thread...
I've just successfully and fully automatically decoded all resources for simple HelloWorld apk, then edited them, packaged again using aapt and run on a device It's early alpha and is unusable for now cause it still doesn't support many types of resources, but I have a proof of concept, that it is possible to repackage resources
Brut.all said:
I've just successfully and fully automatically decoded all resources for simple HelloWorld apk, then edited them, packaged again using aapt and run on a device It's early alpha and is unusable for now cause it still doesn't support many types of resources, but I have a proof of concept, that it is possible to repackage resources
Click to expand...
Click to collapse
Yay! Cool! Waiting for release!
Greets!

Decompiling Dalvik to Java, why so many inconsistencies?

I used dex2jar and JD-gui on the dex file of an application, although at several parts of the code, it did not make sense and there were error in term of decompilation.
Although when I used backsmali on the dex file, the code was correct but I would prefer to read Java code than Smali to understand how a big app works.
First of all, why so many inconsistencies in the Java code? Is this a problem with dex2jar or JD-gui? Any other alternatives?
Thanks.
Mainly because you're converting from dalvik (which is not quite the same as normal java byte code) and then decompiling that. Aside from that, the the tools in question are not totally bug free and complete. I know dex2jar had some open issues last I checked and I dont think the underlying layer to DJ-gui has been updated a ton in some years (JAD).
Perhaps try thinking of it this way--take something in English, convert it to Mandarin Chinese, convert it to Russian and then back to English. Do you think it will look 100% the same if done by a computer translation?
Converting between them is just a guide to avoid having to suffer through reading the byte code directly, but not a replacement for it 100%
In your pasted code it thinks that a goto is a loop (GOTOs or jumps being the standard way to move around code in assembly like languages). My guess is it takes much more complexity to figure out if the jump is a conditional statement or a loop and that's why it does not translate it in the way a human would intend it to be.

.java/.smali help (small donation)

This can be moved to development if needed.
^prob some Android exp needed as well, but if you're here reading this I assume you have some.^
I am interested in adding an extended power menu, among other things (CRT anim ON if possible, and maybe a few other small ones.)
While I am reading my intro to Java Programming. I understand Basic programming, Java is what I need to learn. I am also studying .dex in hopes of one day being able to at least edit it.
If anyone would like to help , I have managed to decompile .dex into .jar and from .jar got all the .classes, etc. and then decompiled to .java, which is so much more readable than .smali. ( as it should be)
I have followed the few guides I could find for extended power menu, trying a few different things as I understand all devices are different. flashed and booted, but power button does nothing.
From what I understand it is actually possible to compile .java to .smali to .dex
from what I can gather this involes adding a mReboot:I options to reboot or reboot recovery. Then adding the array to the power menu, then adding the drawable ids and string ids (which I know how to make with apktool).
I saw one thread stating an entry in build.prop ro.mot.deep.sleep.enabled=true was also required.
PM me or reply if interested. I can upload .java files.
--just trying to get some fresh "development options going"
my next book will liekly be the : 6-in-1 building an android app, which I have done with the google App Inventor. It was fun.
*small donation can be made*

[Q] To which language does the following code belong to ?

Hey Guys,
Recently I was planning to learn to code android apps, so I decompiled an app I wanted to modify & was going through the source code. All of the .smali files were un-encrypted. I would like to know if this code is Objective-C or Java.
I tried to add the code snippets & also tried to pastie it but apparently the posts doesn't seem to accept foreign links so I'll try to post it in the comments.
File Names: h, h$a
Also, I wanted to know what do these file names represent & what does the "dollar" sign stand for in the file names.
Thanks in Advance,
Netguy
Update: I tried posting it via comments but it wasn't possible. Let me know how can I share the code over here. Thanks.
Smali is disassembled Dalvik virtual machine byte code.
The source of it is Java, although you can't easily reconstruct the original source.
MyClass.smali is the class file for MyClass
MyClass$SubClass.smali is the class file for the nested subclass SubClass
MyClass$1.smali is the class file for an anonymous nested subclass.
ab.smali and ab$bd.smali are obfuscated file names.
Some companies rename everything using automatic tools to hide the intent.
Yes, you can write in smali if you like.
Usually such use is limited to small changes in an existing program.
Thanks a lot for the information Renate NST. While digging through some of the smali files, I found some URLs related to the google ads. So will changing the URL to something else disable the ads or will it just result in malfunctioning of the app ? Thanks a lot once again.

Recompiling with additional resources and activities

Hello All,
I have an application that I want to add some features to in the form of an additional activity. I have decompiled it with APK tool and attempted to add my own smali files (from the decompiled 2nd app that I developed). I immediately run into problems with the dependencies of my app being different than those of the original app. For example, my app uses the google Easy Permissions lib to ask for permissions. What is the right strategy to help de-conflict the res/values/*.xml files between two apps that both have their own resources? Are there any tools that can assist in this? What about layout and drawable resources?
I started writing a python script to merge public.xml and the others, re-map the ID's for those resources, and then search the smali files to change the values there. That seems error-prone, and I am not even sure if that is the right thing to do.
I had a second thought that perhaps aapt2 compilation of resources could perhaps be modified to give me a different package ID for the app I created and control source to (such as 0x80... instea of 0x7f...) but I am not sure exactly how to go about that, or if that would even work either
Any advice or tools I should be looking at?

Categories

Resources