System Classes Import - Xposed Framework Development

I've observed that some modules source code have system package specific imports
example:
Code:
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.NotificationData.Entry;
I've picked this code from serajr blurred systemui module.
I'm using android studio but even in eclipse I cant import them
but I've tried lots of methods but I coudn't find a way for importing it, it says that it's not there, can someone help me please?
thank you

Depends on the SDK version you're targeting.
If I recall correctly before Lollipop (or maybe KitKat?) you could simply import system classes by adding private Andoid libraries to classpath in your IDE.
But for never Androids you need to move all your Class loading to handleLoadPackage in the module because of ClassLoader changes, or else your module isn't gonna work even if it compiles right.

XspeedPL said:
Depends on the SDK version you're targeting.
If I recall correctly before Lollipop (or maybe KitKat?) you could simply import system classes by adding private Andoid libraries to classpath in your IDE.
But for never Androids you need to move all your Class loading to handleLoadPackage in the module because of ClassLoader changes, or else your module isn't gonna work even if it compiles right.
Click to expand...
Click to collapse
I solved it by adding the hidden libs and decompiling systemui, picking the dex file, converting it to jar and adding provide dependency on android studio, but thanks anyway

Xiaomi Poco F1 [ROM] [8.1.0] ResurrectionRemix v6.2.1
I installed xposed v90beta3, I can not start the module, it gives an error.
Help solve the problem
zygote64(3278): ClassLoaderContext size mismatch. expected=1, actual=2 (PCL[] | PCL[];PCL[/data/dalvik-cache/xposed_XResourcesSuperClass.dex*2802528989:/data/dalvik-cache/xposed_XTypedArraySuperClass.dex*708326108])

Related

Help! framework.jar modification causes bootloop

I appreciate the time you are taking to read this. I searched a lot, but could not find an answer to my problem.
I am trying to implement a recent patch to bidi text rendering that was created for CM rom and runs on Nexus 1. I downloaded the vanilla source code to 2.1, and compiled it with and without the patch. Then I disassembled framework.jar and compared the smali files, to discover that the following ones were modified:
android/graphics/Canvas.smali
android/graphics/Canvas$EdgeType.smali
android/graphics/Canvas$VertexMode.smali
android/text/Layout.smali
android/text/SpannableStringBuilder.smali
android/text/Styled.smali
android/widget/TextView$CharWrapper.smali
My idea was that if I run baksmali on the framework.jar file from my Desire, replace these files with the new ones, run smali on the result, repack it as framework.jar and upload it to the device - the fix will be implemented.
This actually worked very well for a previous fix, which involved only the file StaticLayout.smali. It worked without having to sign framework.jar; however, that fix did not change the file size, whereas the current one does change it - especially for Canvas.smali. I did not try to sign framework.jar - I don't really know how to and if it is necessary.
The result was a bootloop. Logcat showed that the device is unable to load a native library:
Code:
D/AndroidRuntime( 103): --- registering native functions ---
W/dalvikvm( 103): Unable to register: not native: Landroid/graphics/Canvas;.drawText (Ljava/lang/String;FFLandroid/graphics/Paint;)V
E/JNIHelp ( 103): RegisterNatives failed for 'android/graphics/Canvas'
E/AndroidRuntime( 103): Unable to register all android natives
This is where I am stuck. What I really wanted to do was to create a script-based fix that would work on any device running 2.1. It was possible for the StaticLayout fix. Now I'll settle for figuring out how to make it work for the Desire.
I am attaching Canvas.smali, the file I think is responsible for the problem, in 2 forms: vanilla is compiled from source with no modification, patched is compiled from source after the patch. It seems that the other Canvas files were unchanged by the modification.
Thank you very much in advance!
I am a fool - you would need, of course, the smali file that actually works on the device. Attached here.
ClassicalDude said:
I am a fool - you would need, of course, the smali file that actually works on the device. Attached here.
Click to expand...
Click to collapse
this is a bit off topic but how to change in .jar file? thanks
jullejul said:
this is a bit off topic but how to change in .jar file? thanks
Click to expand...
Click to collapse
http://www.villainrom.co.uk/viewtopic.php?f=61&t=921&start=0
this will teach you how to patch a jar file..
hi thanxxxx

[CM13 question] Using ALSA instead of tinyalsa?

Hey guys
Right now I've succesfully built CM13 from sources for the Z00A but I need to change a few things for a project here at work. We need to use ALSA instead of tinyalsa because of some hard-coded things in that mentioned project, that doesn't work with tinyalsa but with ALSA.
Till now I used alsa-lib and alsa-utils from the Marshmallow branch of Android x86 project as external packages. They compiled without any big bug and here comes my problem: All of those little ALSA tools (aplay, amixer, arecord, etc) aren't build through the make-process and won't be integrated into the image as a result. When I compile them separately and copy them into /system/bin with corresponding access rights, they can't be used in the shell. It tell's me they cant be found - even with correctly installed libasound.so.
Any hint or tipp what I'm doing wrong?

[Library] AppListManager

Windows APIs for retrieving list of apps work very slowly, and also they don't show installed legacy apps (WP8 xap packages). This library solves these issues.
This library includes a built-in caching mechanism; so after the first scan, It'll take only a few seconds to refresh data. Also, this library extracts information about legacy apps by calling a legacy API and then extracting information manually from each app's files.
I'm already using this in the new version of App Data Manage Tool (You can compare the app start speed between version 2.1.0 and 1.5.4)
License: You can use this library in your apps and modify it to fit your needs, as long as you mention the name `AppListManager` and the name of the publisher `Mahdi Ghiasi` with a link to the repository in Github.
GitHub repository link: https://github.com/mghiasi75/AppListManager
Thanks for writing this! I've been considering writing something that would scrape the registry for installed apps, because (as you say) the public APIs are bad. I may just use your library instead. Thank you for open sourcing it!
Library updated with a better way to load legacy apps info, thanks to @gus33000.

How to get the device specific source code for Sony Xperia Z5 statusbar/policy

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.

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