How to get the device specific source code for Sony Xperia Z5 statusbar/policy - Xposed Framework Development

I am new to Xposed development. I figured out that we can override most methods in android. And from a famous tutorial I found out a way to change the clock to a smiley. Now, that android source code was different and My device's source code is different. I have a sony xperia z5. How do I reasearch my z5's 6.0.1 java code so that i can come up with a new xposed module??? Like where do I find my device's source code?
Please helpp......

thetitanium said:
I am new to Xposed development. I figured out that we can override most methods in android. And from a famous tutorial I found out a way to change the clock to a smiley. Now, that android source code was different and My device's source code is different. I have a sony xperia z5. How do I reasearch my z5's 6.0.1 java code so that i can come up with a new xposed module??? Like where do I find my device's source code?
Please helpp......
Click to expand...
Click to collapse
If OEM of your device does not provide source code repositories, the only way is to use apktool to decompile existing system components (e.g. SystemUI.apk for status bar). You'll get decompiled source in smali format which is quite hard to read and makes reverse engineering complicated. There are also tools which can convert smali to better looking representation which is close to java code but you still won't get the exact source code from which system was built. But it should give you basic info where your hooks have to be applied. In the past, I tried using Virtuous Ten Studio which is an all-in-one tool for reverse engineering but it was a long time ago thus not sure what the current state of the project is.

C3C076 said:
If OEM of your device does not provide source code repositories, the only way is to use apktool to decompile existing system components (e.g. SystemUI.apk for status bar). You'll get decompiled source in smali format which is quite hard to read and makes reverse engineering complicated. There are also tools which can convert smali to better looking representation which is close to java code but you still won't get the exact source code from which system was built. But it should give you basic info where your hooks have to be applied. In the past, I tried using Virtuous Ten Studio which is an all-in-one tool for reverse engineering but it was a long time ago thus not sure what the current state of the project is.
Click to expand...
Click to collapse
Thanks a lot! Ya I decompiled the apks and found some pointers that helped me a lot. Ya, sony provides developer sources but I was unable to convert the code into readable format... Can you help me with that?
Here is the link.... https://developer.sonymobile.com/do...rchives/open-source-archive-for-44-1-a-0-169/

thetitanium said:
Thanks a lot! Ya I decompiled the apks and found some pointers that helped me a lot. Ya, sony provides developer sources but I was unable to convert the code into readable format... Can you help me with that?
Here is the link.... https://developer.sonymobile.com/do...rchives/open-source-archive-for-44-1-a-0-169/
Click to expand...
Click to collapse
I'm not sure what that package contains since I did not download it due to its size but it's a packed image. You have to unzip and untar to get to the files.

Got it! Thanks anyways @C3C3C076. All I had to do was pull boot.oat and then use oat2dex. This gave me several dex files, and then there was this beautiful framework.dex and framework-classes.dex. The two things I needed to do look into.

Related

Modifying Android's built-in apps

Hi guys!
I'm wondering what I'd have to do if I wanted to modify the built in apps inside Android..
I've got a HTC Hero running FroydVillain 1.5.0. Let's say... I want to modify the messaging app that's included, MMS.apk. I wouldn't know how to go about this, and I have a few questions...
Firstly, what sources exactly are used for building the built in apps for a given ROM? The source code link in the FroydVillain post, for example, is just for the kernel. The rest of the OS isn't there.
Secondly, I hear that in order to modify a built in app, you need to build the entire OS. If I just download all the code from Google official repo, and compile that, will it just... work on my phone, provided I use a kernel that is specific to my phone?
Lastly, are there any tips anyone has for someone who just wants to modify a couple of the built in apps? Is it possible to build them as standalone apps? Or import them into Eclipse?
I've had a search around the forum and the internets in general, and people have asked similear questions, but I've yet to find a good answer. This thread comes to mind: http://forum.xda-developers.com/showthread.php?t=635197
If anyone could help me, or point me in the direction of any help, that'd be awesome! Thanks!!
FunkTrooper said:
Hi guys!
I'm wondering what I'd have to do if I wanted to modify the built in apps inside Android..
I've got a HTC Hero running FroydVillain 1.5.0. Let's say... I want to modify the messaging app that's included, MMS.apk. I wouldn't know how to go about this, and I have a few questions...
Firstly, what sources exactly are used for building the built in apps for a given ROM? The source code link in the FroydVillain post, for example, is just for the kernel. The rest of the OS isn't there.
Secondly, I hear that in order to modify a built in app, you need to build the entire OS. If I just download all the code from Google official repo, and compile that, will it just... work on my phone, provided I use a kernel that is specific to my phone?
Lastly, are there any tips anyone has for someone who just wants to modify a couple of the built in apps? Is it possible to build them as standalone apps? Or import them into Eclipse?
I've had a search around the forum and the internets in general, and people have asked similear questions, but I've yet to find a good answer. This thread comes to mind: http://forum.xda-developers.com/showthread.php?t=635197
If anyone could help me, or point me in the direction of any help, that'd be awesome! Thanks!!
Click to expand...
Click to collapse
1) The whole sources for everything are there
http://github.com/ninpo
2) You can import the sources to eclipse, but I think you will need to build the entire tree, as opposed to just what you change
3) Apktool lets you do smali and resource edits on an APK. Without knowing what you aim to do, it's hard to guide you specifically.
Most apps are based on the sources provided by google. I assume you are talking about Froyo Hero ROMs (i.e. FroydVillain), which apps are generally built from the source of CyanogenMod. Specifically for FroydVillain, if you look around ninpo github you will see some packages with some changes to their code, although it does seem that many of the changes in recent releases are not there. I have actually PMed ninpo about this and hopefully this is only a technicality.... I assume that the other packages and apps (most of them) he just compiled off the CM sources without changes.
In any case, if you compile an app either from the CM source or from google's original sources, it should work just to copy the apk file - just make sure you use an appropriate ROM (i.e. Froyo ROM if you built it from Froyo sources). The reason to want the CM sources, is that if they have incorporated further fixes (over the google sources) you may want them.
Finally, some more practical advice: I would start with the google sources: http://source.android.com/source/index.html since I have found these instructions and explanations easier to begin with - it should be quite straight forward to build these sources on a linux machine (or VM).
Then you can also try to tackle the cyanogen source: http://wiki.cyanogenmod.com/index.php?title=Building_from_source currently missing instructions on how to build for hero. But if you only want to copy apks out of it, you can just build a generic build (like in the google souce).
If you have specific problems, ask and I'll try to help you.
Good luck.
pulser_g2 said:
1) The whole sources for everything are there
http://github.com/ninpo
Click to expand...
Click to collapse
For example where are all the changes to the dalvik code? I do not follow closely enough the changes in Froyd to point out other things which might be missing (if at all), but there are relatively few committed changes to the CM code. Specifically the dalvik code, ninpo mentioned hundreds of changes which caught my interest and are definitively not there.
The kernel sources do seem to be up to date always - been following that one closely .
Thanks for the advice I love this forum!
What I'm trying to do, in case you're wondering, ultimately, is to modify the built-in messaging application to give the user the option of sending a message by the normal method, or by using their provider's free webtext service, something that all the carriers seem to offer here in Ireland.
So, for example, you'd press the Send button, and you'd be able to select one of those methods. (of course, you'd have to have a data connection for the webtext). There's also be an interface for entering your login credentials for your carrier's website.
I'm doing this party because it would be very useful. I also feel that it would give me a good introduction to how you'd go about modifying Android. I mean, from a programming point of view, it shouldn't be *too* hard to do. I already have a simple standalone app that I made which can send a text message via an Irish carrier's webtext service. But it's all good experience to try to modify other people big codebases.
I have a good bit of experience with web application development, but my experience with other programming is a little more limited. I usually use PHP, where there's none of this compiling nonsense. You just write scripts and off they go!
So I'm gonna go off and see if I can set up an environment where I can build.. the OS, I guess.
If I was to take the vanilla official Google sources, would they work on my phone? Or would I have to use an official Google developer phone... or the emulator? Or maybe if I stopped writing here and investigated those links you've provided, I'd know that by know.
Brb, investigating
Yeh investigating and just trying to do it is usually the best way
To clarify what I was trying to say above: All the java code is obvious very portable - one of the big advantages of java. In the case of android it is compiled to an .apk file and this file should be, at the very least, portable to all android "devices" running this android version. So the apk you build (for example from the vanilla 2.2 sources) should work on the emulator (good for initial debugging) and any 2.2 ROMs.
erasmux said:
For example where are all the changes to the dalvik code? I do not follow closely enough the changes in Froyd to point out other things which might be missing (if at all), but there are relatively few committed changes to the CM code. Specifically the dalvik code, ninpo mentioned hundreds of changes which caught my interest and are definitively not there.
The kernel sources do seem to be up to date always - been following that one closely .
Click to expand...
Click to collapse
I'm currently on "vacation" from any and all Android development for a week. I'll be back after the weekend, at which time my modifications will be cleaned up and committed to git. The kernel is always current with my latest kernel release due to GPL obligations. The extra time away has also highlighted some changes I need to make both to the kernel and to my Android modifications when I get back.
Hacre said:
I'm currently on "vacation" from any and all Android development for a week. I'll be back after the weekend, at which time my modifications will be cleaned up and committed to git. The kernel is always current with my latest kernel release due to GPL obligations. The extra time away has also highlighted some changes I need to make both to the kernel and to my Android modifications when I get back.
Click to expand...
Click to collapse
Thanks Ninpo

[Q]compile rom w/ specific apps

How do I compile a rom with specific apps I want and exclude the ones I don't want?
Put the apps you want in system/app of the rom your compiling. Same thing for removing them. For removal just take them out of system/app. Hope this helps.
DINC|CM7|INCREDIKERNEL
Yeah, I know how to do that already, thanks for the reply! Actually, I want to compile from the source code via terminal. I have my own repository I'm using with some minor changes made to theme it a little. I just want to include specific apps in the compilation and was wondering what I had to do with my repository in order to achieve this?
Treken said:
Yeah, I know how to do that already, thanks for the reply! Actually, I want to compile from the source code via terminal. I have my own repository I'm using with some minor changes made to theme it a little. I just want to include specific apps in the compilation and was wondering what I had to do with my repository in order to achieve this?
Click to expand...
Click to collapse
You will need to edit the vendor tree. If you want it to add apps that are already compiled such as ones you have from the market then you can put them in with the proprietary files and then just add some lines in the inc.mk file or in the blobs mk file in the vendor tree to copy those files from where they are into out/target/product/inc/system/app/ (I'm going from memory there so double check the path) You can look through that inc.mk file to see how it copies other files and just use that same syntax.
Ah, now that sounds more promising. Thanks!

[Q] AOSP changing applications from source

Hi,
I'm trying to change the Phone.apk application from google GIT source code. but when i import the application to Eclipse, I'm getting a lot of errors even after loading the correct android.jar file.
1) what is the right way to MOD application from google source code?
2) How can I know which libraries am i missing?
Thanks a lot,
Idan
Try in the q&a forum or general dev forum.
One hint you don't mod it through eclipse.
Sent from my phone using my Thumbs!
thanks for the reply,
I dont mean changing it through apktool or equivalent, I mean compiling the app from the google java source code...
you have the "correct" android.jar with hidden apis?
link or it did not happen .-.
i suppose nobody told me about this android.jar.
where can i get it then?

[Q] RIL Development sgh-t999

Hi everyone,
recently I have built and flashed on my sgh-t999 (galaxy S3 US tmobile version) CM11 Nightly. For my pro0ject however I need to modify two libraries of the Radio Interface Layer (RIL), libril.so and libreference-ril.so. I tried to modify the ones in the forlder /hardware/ril/ and build everything again with no results. Any change that I made to those files (such as ril.cpp in the folder libril) would not affect the functionality of the phone.
Finally yesterday I understood that when I build those libraries for the target cm-d2tmo-eng, those files that I have modified are not considered at all! When the libraries are built indeed, the system automatically takes the libril.so and libreference.so present in the vendor folder!
The problem is that those libraries in the vendor folder and already compiled and I cannot modify them. The question is:
Is there any way that I compile those libraries from the source code that I have modified?
Thanks,
brok85
Given that there is a unified D2LTE Build on CM, can you elaborate on what changes you wish to make to these libraries ?
To answer your question, You can do one of two things.
Grab the CM Source Code from the Device Tree of D2LTE. Make your relevant changes and check in the changes if they boot ok on your device. That way those changes will be included in future builds of CM and other Roms that use it.
If you do not wish to do so, then you will have to compile those libraries using C++ Compiler on a *NIX box and replace them in the Vendor folder.
Perseus71 said:
Given that there is a unified D2LTE Build on CM, can you elaborate on what changes you wish to make to these libraries ?
Click to expand...
Click to collapse
Well, as fisrt I just wanted to insert some log to be able to follow the code execution from the logcat or do something similar.
Perseus71 said:
To answer your question, You can do one of two things.
Grab the CM Source Code from the Device Tree of D2LTE. Make your relevant changes and check in the changes if they boot ok on your device. That way those changes will be included in future builds of CM and other Roms that use it.
Click to expand...
Click to collapse
Sorry but I am kind of new on this things. I have already downloaded the source code from the device tree and made my modifications in the files ril.cpp contained in [path-to-android-source]/hardware/ril/libril/ril.cpp. What I did was commenting the whole code within the function RIL_onUnsolicitedResponse() and listenCallback() such that in theory, the phone is not able to display incoming calls for example. However after flashing the re-built android I am still able to receve calls. How can I "check in the changes if they boot ok on my device"?
Perseus71 said:
If you do not wish to do so, then you will have to compile those libraries using C++ Compiler on a *NIX box and replace them in the Vendor folder.
Click to expand...
Click to collapse
I tried to remove the libril.so in the vendor folder and compile again using
# . build/envsetup.sh
# lunch (and select d2tmo)
# mmm [path-to-android-source]/hardware/ril/libril".
The problem is that when I indicate the target after lunch, the compiler looks for the vendor libraries and stop the build. What I am doing wrong?
Sounds like Compiler Dependacy path is set different from the code base. I will look further before commenting.
For when your changes are for the benefit of the community of users, you check in the changed code back to the Device Tree with detailed comments within the code and while checking in.
Perseus71 said:
Given that there is a unified D2LTE Build on CM, can you elaborate on what changes you wish to make to these libraries ?
To answer your question, You can do one of two things.
Grab the CM Source Code from the Device Tree of D2LTE. Make your relevant changes and check in the changes if they boot ok on your device. That way those changes will be included in future builds of CM and other Roms that use it.
If you do not wish to do so, then you will have to compile those libraries using C++ Compiler on a *NIX box and replace them in the Vendor folder.
Click to expand...
Click to collapse
Perseus71 said:
Sounds like Compiler Dependacy path is set different from the code base. I will look further before commenting.
For when your changes are for the benefit of the community of users, you check in the changed code back to the Device Tree with detailed comments within the code and while checking in.
Click to expand...
Click to collapse
Actually this is what I get after deleting
libril.so in vendor/samsung/d2tmo/proprietary/lib/
and after executing mmm /hardware/ril/libril :
No private recovery resources for TARGET_DEVICE d2tmo
make: *** No rule to make target `vendor/samsung/d2tmo/proprietary/lib/libril.so', needed by `/home/brok85/Documents/android/system/out/target/product/d2tmo/system/lib/libril.so'. Stop.
make: Leaving directory `/home/brok85/Documents/android/system'
If u want to build from source, delete the line that copies in vendor-blobs.mk
If u want to copy the blob instead of building it from source, keep the line
It'll be better if u provide us the device and vendor trees links
blackbeard said:
If u want to build from source, delete the line that copies in vendor-blobs.mk
If u want to copy the blob instead of building it from source, keep the line
It'll be better if u provide us the device and vendor trees links
Click to expand...
Click to collapse
I am not sure to understand what should I provide Sorry, as I said I'm kind of new here...
Also, I can not find vendor-blobs.mk...Where it should be?
brok85 said:
I am not sure to understand what should I provide Sorry, as I said I'm kind of new here...
Also, I can not find vendor-blobs.mk...Where it should be?
Click to expand...
Click to collapse
You said you built a cm11 for ur device. So for that you needed the device and the vendor trees. Give the link of those, if they are on the git
And vendor-blobs.mk would be present in the vendor folder under your device folder
blackbeard said:
You said you built a cm11 for ur device. So for that you needed the device and the vendor trees. Give the link of those, if they are on the git
Click to expand...
Click to collapse
Well I have followed the guide in the following page
http://wiki.cyanogenmod.org/w/Build_for_d2tmo
The link from where I have obtained the repository is
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
and then
$ breakfast d2tmo
blackbeard said:
And vendor-blobs.mk would be present in the vendor folder under your device folder
Click to expand...
Click to collapse
Actually now I think I was able to compile the library following your instructions. Unfortunatly, when I have built and flashed everything in the galaxy S3, I was not able to use the network. Probably some compatibility issue?
When I compiled libril.so, I have obtained it from the folder /hardware/ril/libril which should contain google source code, maybe not compatibale with my device...is it right?
thanks a lot for the help guys
brok85 said:
Actually now I think I was able to compile the library following your instructions. Unfortunatly, when I have built and flashed everything in the galaxy S3, I was not able to use the network. Probably some compatibility issue?
When I compiled libril.so, I have obtained it from the folder /hardware/ril/libril which should contain google source code, maybe not compatibale with my device...is it right?
Click to expand...
Click to collapse
You know, silly question. But just so we can rule out. Did you at any point compiled the CM11 code as is and flashed to the phone ? How did Network behave ? Was everything ok ?
Galaxy S3 is a very open platform with standard hardware and chipsets. So the Default google code should work out of box with it. If you have network issues, then just for kicks you can flash a custom Kernel on top of your compiled CM 11. See how that goes.
Perseus71 said:
You know, silly question. But just so we can rule out. Did you at any point compiled the CM11 code as is and flashed to the phone ? How did Network behave ? Was everything ok ?
Click to expand...
Click to collapse
No silly question at all
I have compiled CM11 as it is and worked perfectly. I could use the network.
Perseus71 said:
Galaxy S3 is a very open platform with standard hardware and chipsets. So the Default google code should work out of box with it. If you have network issues, then just for kicks you can flash a custom Kernel on top of your compiled CM 11. See how that goes.
Click to expand...
Click to collapse
The procedure I have followed is the following one:
1) Delete the llibril.so and libreference-ril.so from the vendor library. These are the pre-compiled vendor libraries that I need to modify.
2) commented the lines from the vendor-blobs.mk that were including those two precompiled libraries.
3) go to android/system/ and run "mmm /hardware/ril/libril" and "mmm /hardware/ril/reference-ril" to obtain the modified libril.so and libreference-ril.so respectively.
4) copied the new libraries just obtained in the vendor folder where the pre-compiled libraries were
5) re-include the lines commented in point 2).
6) run brunch d2tmo
7) flash the .zip obtained
Any mistake?
Perseus71 said:
You know, silly question. But just so we can rule out. Did you at any point compiled the CM11 code as is and flashed to the phone ? How did Network behave ? Was everything ok ?
Click to expand...
Click to collapse
No silly question at all. Yes I have built everything out of the box and worked perfectly. I could use the network.
Perseus71 said:
Galaxy S3 is a very open platform with standard hardware and chipsets. So the Default google code should work out of box with it. If you have network issues, then just for kicks you can flash a custom Kernel on top of your compiled CM 11. See how that goes.
Click to expand...
Click to collapse
I followed the following procedure to include my modified libraries:
1) Eliminate precompiled vendor libraries: libril.so and libreference-ril.so from the vendor folder
2) comment lines in the vendor-blobs.mk that included those two precompiled libraries
3) from /android/system/ executed command "mmm /hardware/ril/librail" and "mmm /hardware/ril/reference-ril" to obtain the modified libril.so and libreference-ril.so
4) copied the new libraries in the vendor folder in the same places were the precompiled libraries were positioned
5) re-include the two lines that were commented in point 2)
6) build everything again with brunch d2tmo
7) flash the .zip obtained
Any mistake?
Unless I am having a brain fart that process seems about right. I wonder if your RIL changes are related to the network
What kind of issues do you see ?
Perseus71 said:
Unless I am having a brain fart that process seems about right. I wonder if your RIL changes are related to the network
What kind of issues do you see ?
Click to expand...
Click to collapse
It cannot even find the network operators. It says that it is impossible to connect and to try later...
mine is the Tmobile version of S3. May this influence?
That would depend on the changes you made. But otherwise not really. The underlying Device tree is unified for all US S3 devices.

Updated VTS

Hello decompilers
I am a long-time hobby VTS user. Since "stock" VTS is quite outdated, I have updated the included binaries to support decompiling of newer apks. Base version is the latest available, 3.6.30.14100.
updated binaries:
apk tool
smali and baksmali
procyon java decompiler
adb
dex2jar
since apktool has changed commandline arguments, I had to modify VTS itself (ToolWrapper.dll). Therefore this version only works with newer versions of apktool
If you have trouble opening it, you will probably have to bypass signature checking (will help on request, as I don't remember how to do it)
Full updated VTS: (106.5 MB)
https://mega.nz/file/m4oAGYbC#GfD-xo9bHMgWUXCncJg_YegfFzJK-KTTcBiGXamuUok
Update patch: (51.2 MB)
https://mega.nz/file/Lt4SjIiT#IcGkqT259M95DbpVIhShR-nTSvZuWvOkMm-cF7SLQpc
Thanks for the modification, really sad to see it not getting updates anymore :/
For some reasons though, when I try to create a new project, I cant press on "finish", no matter which configuration I choose.
I set the Java-path in the settings, I also added a framework and tried to replace the apktool and smali jars you provided with freshly downloaded ones, but this did not seem to work.
I also dont get any error in the logs, so Im pretty much out of ideas. Is this error know to you or do you have asolution?
trogper said:
Hello decompilers
I am a long-time hobby VTS user. Since "stock" VTS is quite outdated, I have updated the included binaries to support decompiling of newer apks. Base version is the latest available, 3.6.30.14100.
updated binaries:
apk tool
smali and baksmali
procyon java decompiler
adb
dex2jar
since apktool has changed commandline arguments, I had to modify VTS itself (ToolWrapper.dll). Therefore this version only works with newer versions of apktool
If you have trouble opening it, you will probably have to bypass signature checking (will help on request, as I don't remember how to do it)
Full updated VTS: (106.5 MB)
https://mega.nz/file/m4oAGYbC#GfD-xo9bHMgWUXCncJg_YegfFzJK-KTTcBiGXamuUok
Update patch: (51.2 MB)
https://mega.nz/file/Lt4SjIiT#IcGkqT259M95DbpVIhShR-nTSvZuWvOkMm-cF7SLQpc
Click to expand...
Click to collapse
Thanks for this update
But there is a problem that I hope you will solve.
The problem is that when decompiling the apk, the program only decompiling the main classes.dex.. but classes2.dex and classes3.dex do not unpack it.
Dark_Lion64 said:
Thanks for the modification, really sad to see it not getting updates anymore :/
For some reasons though, when I try to create a new project, I cant press on "finish", no matter which configuration I choose.
I set the Java-path in the settings, I also added a framework and tried to replace the apktool and smali jars you provided with freshly downloaded ones, but this did not seem to work.
I also dont get any error in the logs, so Im pretty much out of ideas. Is this error know to you or do you have asolution?
Click to expand...
Click to collapse
In the import wizard, there is one step where you set path where to save the project. There are 4 input fields (project name, solution name, something, path). You have to fill them all. I have spent some time on this issue too...
abo2sadam said:
Thanks for this update
But there is a problem that I hope you will solve.
The problem is that when decompiling the apk, the program only decompiling the main classes.dex.. but classes2.dex and classes3.dex do not unpack it.
Click to expand...
Click to collapse
Sorry, I don't use VTS anymore. I have found a replacement, APK Lab for visual studio code.

Categories

Resources