5,606,347 Members 32,928 Now Online
XDA Developers Android and Mobile Development Forum

[FRAMEWORK ONLY!] Xposed - ROM modding without modifying APKs (2.5.1)(12.04.2014)

Tip us?
 
rovo89
Old
(Last edited by svetius; 17th April 2014 at 03:06 PM.)
#1  
rovo89's Avatar
Recognized Developer - OP
Thanks Meter 11161
Posts: 1,938
Join Date: Jan 2012
Smile [FRAMEWORK ONLY!] Xposed - ROM modding without modifying APKs (2.5.1)(12.04.2014)

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)!

Quote:
Quick guide what kind of posts is allowed in this thread and what is not allowed.
If you don't follow the rules, you might get notified (sometimes friendly, sometimes angrily) that you're doing it wrong, but your post might as well be ignored.


NO posts without reading at least the first two posts and searching the thread => I and other people have spent hundreds of hours developing and supporting Xposed, we expect at least this much of respect
NO support for any modules here => use the module's forum instead, don't even try to post here
NO questions whether there is a module for XYZ exists => check the builtin repository and this thread: http://forum.xda-developers.com/show....php?t=2327541
NO requests for new modules => check this thread if it has been requested before, otherwise ask nicely there: http://forum.xda-developers.com/show....php?t=2327541
NO, you don't get any support via PM either => for the points above, do as pointed out, for allowed things always post in this thread (unless you want to share logs with sensitive data)
YES, you can report bugs for the framework => make sure that you followed the instructions and can reproduce it without any active modules
YES, you can get support if you have issues with the Xposed Installer (e.g. you can't install the framework) => make sure you read the instructions and searched in the thread for similar problems
YES, I will support module developers with specific questions (e.g. how to hook a certain method) => you must have read the development tutorial and give as much context as needed to make it easy for me or others to answer (code always helps!)
YES, you can suggest new features for the API (as a module developer) or the Xposed Installer here => again, no requests about modules

For a quick start, have a look at XDA's "Android Basics 101" on Xposed: http://www.youtube.com/watch?v=uRR0Flqx9M8

Some technical details:
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 one for system services) 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. 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! Also replacing or adding resources is easy.

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.

Download:
You can download the installer from http://dl.xposed.info/latest.apk. The attached disabler zip is only needed if you are in a boot loop.
An experimental version for Gingerbread made by liudongmiao can be found here: http://forum.xda-developers.com/show...4#post44034334 (no support from my side though)

How to install:
First step for everything you do: Create a nandroid backup and make sure you know how to restore it!
I'm not responsible for anything you do with your phone/tablet/rice cooker.
There is also the risk to soft-brick your device. In such a case, restoring a backup is the easiest way to get rid of it (other possibilities mentioned below).

For the framework:
  1. Download the Xposed Installer APK and install it
  2. Launch the Xposed Installer, go to the "Framework" section and click on "Install/Update"
    In case you get a Segmentation Fault error, please install this additional app (not needed if the installation worked fine).
  3. Reboot
  4. Done!

You can verify this by starting the Xposed Installer again. If app_process jumped back to an older version (or none at all), you probably have a ROM with S-On or similar, which reverts any changes to /system after a reboot. Use installation via recovery in such cases.

For any modules you want to install:
  1. Download <module>.apk and install it
  2. Launch the Xposed Installer and go to the "Modules" section (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!
(note that you can install the framework and enable/disable multiple modules at once and reboot afterwards)

In case you get into a boot loop:
First, try using the safemode by pressing any hardware key repeatedly. You can find a short explanation how it works here.
If that doesn't work, you can flash the attached Xposed-Disabler-Recovery.zip by Tungstwenty. It will be copied to your (external) SD card when you install Xposed as well. The only thing it does is copying /system/bin/app_process.orig back to /system/bin/app_process, which you can also do yourself (e.g. with adb shell in recovery mode).

Modules:
The official repository for Xposed modules, which can also be access from within the app itself (with download/update support), can be found at http://repo.xposed.info
You can also have a look at this index: http://forum.xda-developers.com/show....php?t=2327541
Please don't use this thread for problems with modules! Use the thread of the module instead.

How to write a module:
If you are an interested developer, give it a try. The development tutorial will help you get started. Further documentation (e.g. how to replace resources) is here. And of course, you can ask your development questions in this thread.
If you have suggestions for new functions the framework could provide (which means they should be useful for more than your module), you can do this here as well. However, requests that I or somewhen else should write a module for xyz are NOT allowed here. Again, this thread is only about the framework.

Changelog:
1.0: Initial version
1.1: ???
1.2: Installer
1.5: Resource replacing
1.6: Some fixes and improvements [629 downloads]
2.0 rc2: Lots of thing redone. Supports (temporarily) replacing native libraries, lots of additions and changes for developers. [3,234 downloads]
2.0: Removed the native library replacement again, support for 4.1 and 4.2, Instagram crash fixed, ... [631 downloads]
2.0.1: Fixed a crash when a module tries to hook a function with "long" or "double" parameters [930 downloads]
2.0.2: Fixed a problem which resulted in a boot loop [4,310 downloads]
2.1: Various improvements, e.g. earlier callbacks for module loading. For details, see this post. [345 downloads]
2.1.1: Fixed a bug in drawable replacements [5,421 downloads]
2.1.2: Small fixes, added Chinese and Russian translations [11,415 downloads]
2.1.3: Reverted a change in 2.1.2 that caused bootloops; new translations and some more fixes [46,803 downloads]
2.1.4: Support for Galaxy S4 and HTC One plus a few minor fixes/enhancements (details) [208,176 downloads]
2.2: Builtin updater/module downloader, extended UI, support for Android 4.3 and more (details) [241,267 downloads]
2.3: x86, Knox, MIUI support (experimental), context menu in modules list and more (details) [18,219 downloads]
2.3.1: "Segmentation fault" during installation fixed [679,333 downloads]
2.4: Support for Android 4.4, performance improvements, log viewer, active check (details) [101,613 downloads]
2.4.1: Fixed bootloop on some x86 ROMs [2,537,642 downloads]
2.5: Rewritten installation, safemode, more compatibility (details) [821,792 downloads]
2.5.1: Compatibility with new CM11 nightlies and LG G2 theming engine

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)

Thanks to:
Tungstwenty for his many contributions, both in code and thoughts
XDA admins, news writers and supporters for making Xposed known to so many people
All those volunteers who help answering questions about Xposed
The people who donated to get me a Nexus 5 for earlier KitKat support

Translators:
[ar] Arabic: aljohanei
[az] Azerbaijani: hero355
[bg] Bulgarian: Stefan Stefanov
[ca] Catalan: Albert Samaniego, David Vaz Guijarro
[cs] Czech: Aleš Berka, Petr Reznícek
[de] German: rovo89, Nils Wasser
[el] Greek: Theodore Keloglou
[es] Spanish: David Vaz Guijarro
[fr] French: tonymanou
[gl] Galician: David Vaz Guijarro
[hu] Hungarian: Adam77Root
[id] Indonesian: AngSanley
[it] Italian: Vincenzo Cerminara
[iw] Hebrew: DubelBoom
[ja] Japanese: Noumi Ryoko
[ko] Korean: marbulas
[ms] Malay: Abe Atok
[nb] Norwegian Bokmål: rosaage
[nl] Dutch: Gert-Jan Anema, Leonard Simonse, Martin Coulon
[pl] Polish: czeci
[pt-rBR] Portuguese (Brazil): Marcio Andrade
[ro] Romanian: razorsbk
[ru] Russian: michfood
[sk] Slovak: pyler
[sr] Serbian: maleksa
[sv] Swedish: Fredrik Lundberg
[tr] Turkish: TheNorth34
[vi] Vietnamese: alienyd
[zh-rCN] Chinese (China): Cye3s, liveasx, Yeechan Lu
[zh-rTW] Chinese (Taiwan): Cye3s

If you want to contribute more translations please use this file as a template. I can't accept translations based on decompiled APKs. Submissions on GitHub as pull request are preferred because it's easier for me.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2013-09-03-21-41-04.jpg
Views:	239020
Size:	35.9 KB
ID:	2232598   Click image for larger version

Name:	Screenshot_2013-09-03-21-41-18.jpg
Views:	204142
Size:	20.0 KB
ID:	2232599   Click image for larger version

Name:	Screenshot_2013-09-03-21-41-41.jpg
Views:	200169
Size:	46.2 KB
ID:	2232600   Click image for larger version

Name:	Screenshot_2013-09-03-21-42-01.jpg
Views:	189327
Size:	45.9 KB
ID:	2232601   Click image for larger version

Name:	Screenshot_2013-09-03-21-42-17.jpg
Views:	174521
Size:	40.9 KB
ID:	2232602  

Click image for larger version

Name:	Screenshot_2013-09-03-21-42-30.jpg
Views:	164711
Size:	21.8 KB
ID:	2232603   Click image for larger version

Name:	Screenshot_2013-09-03-21-43-14.jpg
Views:	163428
Size:	33.7 KB
ID:	2232604  
Attached Files
File Type: zip Xposed-Disabler-Recovery.zip - [Click for QR Code] (4.2 KB, 17226 views)
The Following 3,865 Users Say Thank You to rovo89 For This Useful Post: [ Click to Expand ]
 
rovo89
Old
(Last edited by rovo89; 14th April 2014 at 05:31 PM.)
#2  
rovo89's Avatar
Recognized Developer - OP
Thanks Meter 11161
Posts: 1,938
Join Date: Jan 2012
Default Xposed Framework FAQ

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 devices/ROMs does it work?
I develop the Xposed framework based on the AOSP sources. I'm personally using CM10.2 on an I9100 (Samsung Galaxy S2, bought in Germany). Basically, it should work on any phone which with a ROM based on Android 4.0 or later and an ARM or x86 processor (this is the processor architecture, almost all smart phones and tablets have either of those). Exceptions might be ROMs which are different from the original Android code in some very internal, central code parts (which don't need to be touched for most theming and enhancement modifications). But this is related to the ROM, not the phone itself.

The modules target higher-level code, so they are more likely to be incompatible with your ROM. Basically, the question is whether the methods and resources which the module modifies are similar on your ROM and on the developer's ROM. Let's say a module needs to modify the result of a certain method call. For this, it needs to specify the exact name and parameters that identify that method. If the in your ROM, an additional parameter has been added, the module can't find the method anymore and won't work. If the method can still be found, it will probably work (unless the rest of the app/ROM has changed too much).

There is not definite answer whether it will work. Just try it (of course, making a nandroid backup before is never a bad idea). If it doesn't work, just disable the module. You might want to inform the module developer (not me!) about this fact and provide details (e.g. a logcat and/or the content of /data/data/de.robv.android.xposed.installer/log/debug.log).

After installing Xposed, the runtime gets reset from ART to Dalvik. Can you stop it please?
You can be glad that I implemented this, otherwise you would be in a bootloop know. Xposed isn't compatible with ART (yet). It's a completely different architecture with pretty much no documentation. Rewriting Xposed for the ART runtime requires understanding the concept, the code structure and many details to know how it works. I have already spent dozens of hours on that and some things are working. But still it's a long way ahead. Don't expect even a test version in the near future. So please don't ask when it will be available - you will surely know when it is ready. I have nothing else to say about that.

Update: ART might be become the default runtime environment in the next Android version. You can read my thoughts about this here.

What about Gingerbread? Or any other Android version before 4.0.3?
An experimental version for Gingerbread made by liudongmiao can be found here: http://forum.xda-developers.com/show...4#post44034334.
Note that I cannot give any support for it, please direct your feedback to @liudongmiao.

Are there known incompatibilities?
There seem to be issues with AOKP nightlies. For more details, please read this post.

If you are on x86 and you see the message cannot locate symbol "_Z15dvmChangeStatusP6Thread12ThreadStatus", I'm afraid that Xposed won't work with your ROM. It has an additional parameter for a central method which breaks compatibility. As I don't know what the parameter stands for (and what other incompatible changes the ROM contains), this will rather not be fixed. However, it could work on other ROMs for the device. Details can be found here.
These ROMs are known to be affected:
Asus ME302C, android version 4.2.2, kernel 3.4.21, Rom 4.7.1 WW
Chinese Tablet (Ramos i9) with a Z2580 chipset on stock rom.
If have access to the source code (dalvik/vm/Thread.cpp) of these ROMs or any other ROM with a third parameter for dvmChangeStatus, please let me know.

Some ZOPO/THL devices ship with ROMs that are based on an incompatible Android fork called "Aliyun OS". These ROMs are incompatible with Xposed, no chance to add support for them.

There seem to be issues (bootloops) with the Oppo Framework, I don't have a fix yet.

On some HTC One phones with CM11, the System UI force crashes. This seems to be caused by SELinux restrictions. Executing "restorecon /system/bin/app_process" (as root, e.g. with adb shell) should help against the FCs, but Xposed might not work due to other SELinux restrictions. If you have the possibility to disable SELinux enforcing mode, you can try that.
If you are an SELinux expert and would like to help, please contact me.

Apart from that, obviously it won't work if the conditions mention above aren't met, e.g. if your phone isn't rooted or it is running on a pre-ICS ROM.

Final Fantasy (or some other Square Enix game) doesn't work while Xposed is enabled, can you fix it?
After spending some hours analysing what's going on, I don't think so. For details, read this post: http://forum.xda-developers.com/show...postcount=1701
Your only option is to disable Xposed (i.e. press the uninstall button and reboot) while you play and enable it again afterwards.

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.

Does Xposed get disabled if I flash a new ROM?
Yes, because the file it modifies, /system/bin/app_process, is part of every ROM and will be overwritten when you flash a ROM. However, as long as you don't wipe data, the Xposed Installer app will still be installed, so you can just click on "install/update" again in the Framework section and reboot.

For CyanogenMod-based ROMs, there is an easy solution: [1] and [2]. This will reactivate Xposed automatically after you flash a new ROM/nightly.
For other ROMs, you can try this one. Be careful, it will disable Xposed again if you flash it twice!

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. Then read this extensive tutorial.

Why isn't the Xposed Installer available via Play Store?
I have several reasons for that. I wrote about it in this post. And as I learned, Google does indeed sometimes remove apps which interfere with other apps.

From my point of view, you are free to publish the modules you develop on Play Store (at your own risk - Google might remove them). However, be careful if you plan to get money from them. Paid apps are stored in encrypted containers, which means Xposed can't load them at boot time.

Where can I donate some money to support you?
I'm doing ok with my full-time development job. Xposed is a hobby and I want it to stay like this. If I accepted money for it, it would somehow feel like a second job, it builds up expectations for more support etc.
So please donate to charity instead, they need the money more than I do. Or if you can't afford to spend money, donate happiness to the people around you with some random acts of kindness. Thank you!

Am I allowed to fork Xposed and publish my own version? What should I consider?
I have written this down in a separate post: http://forum.xda-developers.com/show...postcount=4372

Can I include Xposed in my ROM?
First of all: One reason why I developed Xposed was to avoid the need to flash anything just for a few small changes. So Xposed is designed to work on top of ROMs, not as a part of them.

That said, I don't forbid you to include it. Here are the conditions:
  1. I won't support you in the process of including it. You'll have to figure out the best way to do it yourself. The easiest way (which will also cause the least problems) is probably to simply put the installer and the modules into /system/app, then your users just need to click the "install/update" button, activate the modules they want and reboot.
    There might be ways to really pre-install Xposed so that it's working out of the box, but I don't recommend that. You have to be very careful about file permissions, so there is a good chance it won't work. Again, absolutely no support for this.
  2. I won't support your users with problems which might have been caused by using the included version instead of installing it normally.
  3. When your users report problems which are probably not related to including Xposed in the ROM, please try to give them some support yourself. If you can't find a solution, send them to the correct help thread. For example, this thread is only for the framework. Not for any modules, not even my own.
  4. I expect you to include the latest versions, which are usually the ones working best. I won't support older versions.
  5. Your users must be able to update to the latest version, preferably without installing a new version of your ROM. Again, I won't support older versions.
  6. From the previous point, it follows that you need to include the original APKs, otherwise updating is not possible due to a certificate mismatch. This is even more important since updates are possible from within the app. It also avoids confusion, like users wanting support for any modifications you might have made.
  7. You probably want to include some modules. There are many modules that are not written by myself. Therefore, you need to get permission from the module authors as well. For modules written by myself, the same conditions which you are just reading apply.
  8. Please give proper credit (which includes a link to this thread for the framework). Don't sell it as your own work.

You might have the impression now that I'm not a big fan of including Xposed in a ROM. This impression is correct. It's not too hard to install Xposed and any attempts to pre-install Xposed will just cause additonal support requests.
Why don't you just recommend Xposed in your ROM thread, along with the place where they can download it (this thread) and some instructions how to get the most out of it for your ROM? Give your users some choice!
The Following 1,214 Users Say Thank You to rovo89 For This Useful Post: [ Click to Expand ]
 
Siberian Tiger
Old
#3  
Siberian Tiger's Avatar
Forum Moderator
Thanks Meter 5105
Posts: 3,937
Join Date: Dec 2010
Location: Piraeus

 
DONATE TO ME
Sounds interesting.I hope that you make a apk that simplifies things for simple user like rom control in AOKP
Keep up the good work my friend
The Following 10 Users Say Thank You to Siberian Tiger For This Useful Post: [ Click to Expand ]
 
Krendelrus
Old
#4  
Senior Member
Thanks Meter 421
Posts: 602
Join Date: Nov 2010
That's great, decompiling/compiling apks is not really my cup of tea lol thanks rovo89
The Following 4 Users Say Thank You to Krendelrus For This Useful Post: [ Click to Expand ]
 
Razer(x)
Old
(Last edited by Razer(x); 31st March 2012 at 05:22 PM.)
#5  
Razer(x)'s Avatar
Recognized Themer
Thanks Meter 4710
Posts: 7,115
Join Date: Sep 2010
Location: Bologna

 
DONATE TO ME
May be useful for my themes, keep working on it
The Following 4 Users Say Thank You to Razer(x) For This Useful Post: [ Click to Expand ]
 
sangosnip69
Old
#6  
sangosnip69's Avatar
Senior Member
Thanks Meter 366
Posts: 570
Join Date: Dec 2010
Location: Lyon

 
DONATE TO ME
Very interesting... Will try soon.
Developer of SaNgO Vizion



If I've helped you, please press the thanks button!
This encourage me to continue my work!
The Following 16 Users Say Thank You to sangosnip69 For This Useful Post: [ Click to Expand ]
 
ukdtweak
Old
#7  
Senior Member
Thanks Meter 23
Posts: 261
Join Date: Aug 2010
Location: Ballyhalbert
This looks like a really great idea and could help reduce the need for dev's being pestered by users for mod's every time a new rom is leaked/released, well done sir, hope to see this take off
Samsung Galaxy S4
GoldenEye 4.4.2
----------------------------------
Asus Transformer TF300T 32gb Wifi +32gb Class 10 Ext.
Running ota Jellybean.
The Following 8 Users Say Thank You to ukdtweak For This Useful Post: [ Click to Expand ]
 
rotsj
Old
#8  
rotsj's Avatar
Member
Thanks Meter 4
Posts: 34
Join Date: Oct 2009
I will definitely have a swing at this over the next few days. This looks like fun!

**This message will self-destruct**
I'm just a little schizophrenic, nothing to worry about. 'Who said that?'
The Following 2 Users Say Thank You to rotsj For This Useful Post: [ Click to Expand ]
 
rovo89
Old
(Last edited by rovo89; 2nd April 2012 at 10:21 PM.)
#9  
rovo89's Avatar
Recognized Developer - OP
Thanks Meter 11161
Posts: 1,938
Join Date: Jan 2012
Thanks for the "thanks" everyone. I decided to create an installer first before looking into the other things. This way, I hope a few people can test whether it works on their device (see first post for the APK).

Some notes about this:
  • The installer holds the app_process executable and the XposedBridge.jar as assets and can install it to the correct locations (root permissions required!).
  • It will automatically create a backup of /system/bin/app_process at /system/bin/app_process.orig, which can be restored either via the app or via shell (e.g. adb, works in recovery as well).
  • I have only tested it on ICS (LPQ Stock). Honestly, I do not have the time to test it with anything below that. If somebody wants to do this, I can help you to get started with the code. app_process was not changed very often, so chances are rather good that it will work with only few changes.
  • The installer requires SDK15 (4.0.3) for the same reason.
  • Improvements for any part of the code are welcome! It should be easy to use for both users and developers.
  • (Un-)Installing the installer app alone does not change anything (at least not now). Please use the buttons inside the app.
The next step should now really be to load modules dynamically, I hope I can use standard installable APKs for that (although the framework will probably request enabling confirmation for technical and security reasons).
The Following 105 Users Say Thank You to rovo89 For This Useful Post: [ Click to Expand ]
 
rovo89
Old
#10  
rovo89's Avatar
Recognized Developer - OP
Thanks Meter 11161
Posts: 1,938
Join Date: Jan 2012
Quote:
Originally Posted by siberian tiger View Post
I hope that you make a apk that simplifies things for simple user like rom control in AOKP
From what I read, Rom Control seems to be something like the Settings app for ROM-specific stuff? I am not so sure yet whether I want to implement generic settings in the framework.
Having a standard interface for setting loading/saving (like or using Android's Shared Preferences) would probably make sense. But the settings themself can be very different from module to module, so I would rather let those bring their own settings menus.

What I did though was to implement an installer. My idea how it should ideally work for end users:
  1. Install the Xposed Installer
  2. Click the "Install/Update" button in the installer
  3. Install one or more modules
  4. Configure the modules (if necessary)
  5. Have fun!

Where "install" would mean that you can download the app from the Play Store or a website and install it with the usual package manager. At least for steps 1 and 2, this is working already. For the others, I have to see.

The Following 72 Users Say Thank You to rovo89 For This Useful Post: [ Click to Expand ]
Tags
don't ask questions about modules here!!!, framework, xposed
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes