XposedTools icon indicating copy to clipboard operation
XposedTools copied to clipboard

Integrating Xposed to AOSP source tree

Open abforce opened this issue 7 years ago • 5 comments

I'd need to integrate/merge Xposed to AOSP source tree such that when I issue make at the AOSP root, it creates system.img shipping Xposed framework out-of-the-box.

Current installation steps kinda patches an existing non-Xposed image and makes it Xposed installed (via update-binaries scripts).

Could you please point me out to the way I could approach my goal?

abforce avatar Jun 11 '17 08:06 abforce

I haven't tried this myself, and I'm not planning to support pre-installed Xposed officially. However, the installation scripts are open source, so you can check what they do. Feel free to document your progress here.

rovo89 avatar Jun 12 '17 07:06 rovo89

To build a pre-installed Xposed ROM, I can think of two different approaches: (assuming Android 5+)

Approach 1

  • Replacing frameworks/base/cmds/app_process by xposed and change all LOCAL_MODULE to app_process. This will build the modified app_process and put it in the right place.
  • Replacing art with the modified art. (LOCAL_MODULEs don't need to change)
  • Creating a prebuilt Jar subproject in prebuilts/misc/common/XposedBridge to copy the XposedBridge.jar in the right place.

Approach 2

  • Without touching the original app_process, git cloning the xposed in frameworks/base/cmds/xposed. (exactly like Xposed official docs suggest)
  • Without touching the original art/, git cloning the android_art in art_exposed/ and change all make files to generate binaries with _xposed at the end of their names. e.g. libart_xposed.so, dex2oat_xposed and so forth.
  • That prebuilt XposedBridge.jar subproject (exactly like the first approach's)
  • Change the source tree make files to replace original art binaries with Xposed binaries (having names ending in _xposed) right before system.img is being packed.

I tried the first one, but unfortunately the modified host dex2oat (not sure maybe something else) malfunctions and lots of errors show up. So, I'm heading for the second one.

@rovo89

Q1: In your opinion which approach is better?

Q2: With approach 2, I don't know which make files should be changed. Could you please help me to get this done?

abforce avatar Jun 13 '17 06:06 abforce

I think I'd try to follow the official docs as close as possible, i.e. check out xposed to frameworks/base/cmds/xposed and android_art to art, and then have some special make file which puts the files in the same places as the official installation script does. Ideally, you'd end up with a ROM that looks exactly like your base ROM after installation the official ZIP.

rovo89 avatar Jun 13 '17 13:06 rovo89

I tried this way, but checking out android_art to art is the source of many problems I think. The issue I've linked to in my previous post is because of this.

My only feeling on the matter is that the host dex2oat built by android_art fails during the make process. Here's one of those errors shown up for me: https://github.com/rovo89/android_art/issues/64#issuecomment-307718646

So, that's why I decided to switch to the second way. However since you have a pretty good insight on how Xposed works and compiles, could you please test this way yourself and let us know the result?

Thank you @rovo89

abforce avatar Jun 14 '17 06:06 abforce

No sorry, I'll have to stop here. I don't have any time to try to compile a ROM this way, nor to investigate why it might fail. If you want to do this, feel free to do so, that's one of the nice things of open source. But you'll have to analyze and fix the errors yourself.

rovo89 avatar Jun 14 '17 06:06 rovo89