[FRAMEWORK] Xposed - ROM modding without modifying APKs/flashing (2.0rc1)(04.07.2012)

In this thread, I'm presenting a framework which gives you the possibility to modify your ROM - without modifying any APK (developers) or flashing (users)!
Credit to rovo89
Some technical details:
Instead, I extended the /system/bin/app_process executable to load a JAR file on startup. The classes of this file will sit in every process (including the system_server) and can act with their powers. And even more: I have implemented something that allows developers to replace any method in any class (may it be in the framework, systemui or a custom app). This makes Xposed very powerful, it is basically running in "god mode". You can change parameters for the method call, modify the return value or skip the call to the method completely - it's all up to you!



Advantages:
  • No need to modify any APKs. This means:
    • No need to decompile, change things in smali, compile, sign, ...
    • It will work for odexed and deodexed ROMs.
    • Your mod is not bound to a specific version of the ROM. Unless there is a major change in the methods called for a certain functionality, your mod will continue to work even when you upgrade your ROM. Hell, it will probably even work with different ROMs.
    • Multiple mods can be installed at the same time, even if they change the same package. So you can use these battery icons and those quick toggles. Even hooking the same method twice is possible. Of course, this only works properly if the mods are not trying to do incompatible things.
  • It does its magic at runtime. That means you can implement options to let the user decide if they prefer the bikeshed to be painted in red or blue. Or you can have some extra logic for certain ROMs without building different mod versions.
  • It can be disabled easily without having to reflash.
  • It's open source.

Current status:
I have implemented a powerful framework and tested it (on stock LPQ). I have plans to further extend it to provide more helpers for developers, but you can already do many things. Therefore, I will try to involve a few interested developers and will also develop some mods myself.
A big tutorial on how to implement a module can be found here.

What's up next:
  1. Implement mod loading. Right now, the mods would have to be compiled into the Xposed jar file. Very soon, you should be able to create your own JAR file that will be loaded by Xposed. done!
  2. Build a flashable archive. I currently use SSH/adb to push updates to my device. Alternative: Create an app that can install it and install mods (actually my preferred choice). done!
  3. Find some interested mod developers to create some easy mods for Xposed.
  4. Look into resource loading/replacing. Developers should get an easy way to replace e.g. icons, layouts etc. done!

Source code:
https://github.com/rovo89/Xposed (the C++ part)
https://github.com/rovo89/XposedBridge (the Java part)
https://github.com/rovo89/XposedInstaller (Installer app)
https://github.com/rovo89/XposedMods (my modules)

Download:
You can download the installer from the attachment. I have also attached an example module that changes the color of the status bar clock to red (as seen in the screenshots).

Modules:

How to install:
For the framework:
  1. Download XposedInstaller.apk and install it
  2. Launch the Xposed Installer and click on "Install/Update"
  3. Reboot
  4. Done!

For any modifications/modules you want to install:
  1. Download .apk and install it
  2. Launch the Xposed Installer and go to the "Modules" tab (you will also get there if you click on the notification warning you that the module is not enabled yet)
  3. Enable the module by checking the checkbox
  4. Reboot
  5. Done!

Changelog:
1.0: Initial version
1.1: ???
1.2: Installer
1.5: Resource replacing
1.6: Some fixes and improvements [629 downloads]
2.0: Lots of thing redone. Supports (temporarily) replacing native libraries, lots of additions and changes for developers.


Attached Files
File Type: apk XposedInstaller.apk -  (383.7 KB, 160 views)
File Type: jar XposedBridgeApi.jar -  (77.8 KB, 52 views)

Does this require root access?
Yes, because it replaces a file in /system/bin. Once the framework is installed, it should work without root access.

For which ROMs does it work?
I develop Xposed based on the AOSP sources and tested it with Stock LPQ. Diliban reported that it also works for XXLPS SENSATION ROM ICS V 3.2. The framework itself should work for any ICS Stock or AOSP ROM. I do not know about CM9, but it looks like they are using the same code that Xposed is based on. So that might work in CM9 without changing anything as well.
The modules will work for different ROMs as well if the same classes and methods are used for the feature you are modding. For the clock example, the method "updateClock()" is hooked in class "com.android.systemui.statusbar.policy.Clock". This method exists and is used for the same purpose in Stock, AOSP and CM9. So I see no reason why it shouldn't work in all of those ROMs.
Even if there should be small differences, a simple if-condition in the code can probably make a module compatible with all ROMs.

What about GB?
I haven't looked into it. The concept in general should work there as well, but it will probably need some adoptions. If somebody want to try making it work, I can assist a bit, but it is very unlikely that I will flash GB again on my phone.

How can I install it?
See the first post. The framework installation needs to be done only once (and on updates), then it can be used for any modules.

I can't install Xposed. I get an error message "dirname: not found" or "Value too large for defined data type"
Try updating BusyBox, for example with this app.

Isn't this insecure?
In a way, yes. With great power comes great risk. On the other hand, other ways of modifying your phone are also open to malicious coding. For more details see this post.

Why do I have to enable a module after installing it? Couldn't you skip this additional step?
This is for security reasons (see the question above). By making you confirm that you want to use a module, apps cannot contain hidden Xposed modules. The same could be done with an additional permission, but I'm not sure if everyone would recognize that and it is harder to implement. As a bonus, this toggle allows you to temporarily disable a modification or to ship an app that contains an optional Xposed module.

How do I develop my own modification using the Xposed framework?
First make sure that Xposed is working fine for you (e.g. with the example module). Then read this extensive tutorial.
via

No comments:

Post a Comment

We love to hear from you! Leave us a comment.