rovo89 / XposedTools

These tools can be used to compile and package the Xposed framework.
475 stars 251 forks source link

Installation on Android emulator #7

Open mingwayzhang opened 8 years ago

mingwayzhang commented 8 years ago

Hi rovo89,

I appreciate the nice feature Xposed framework has provided. Recently, I try to compile xposed with AOSP Marshmallow (6.0.1) using XposedTools. I followed the manual installation in README by replacing art directory, adding xposed into AOSP source tree and then using "./build.pl -t arm:23". The compile was successful. However, when running it inside emulator. The emulator hangs with no connection reachable from using adb, so there is no way that I can provide feedback using logcat. In addition, I also tried by removing those modifications to AOSP. The emulator works.

Appreciate it if any feedback could be provided. Thanks.

rovo89 commented 8 years ago

Your claim in the title can easily be proven wrong: Xposed does work fine on Marshmallow.

However, you mention that you tried it on the emulator. I don't know if this is supported, I haven't tried it.

How did you flash the ZIP file that the build script created? On Genymotion, it's as simple as dropping it on the emulator window. It's important that the installation script runs successfully, as it needs to set correct permissions etc.

Or did you build a new emulator image with Xposed included? Then you're at least missing XposedBridge.jar that is installed by the ZIP file.

mingwayzhang commented 8 years ago

You are right. Xposed does work for Marshmallow. I have proved it on my phone. Thanks a lot for that. The issue is really related with compiling xposed into the AOSP. I did not checked the emulator image yet. So how could I flash the image with XposedBridge.jar? I did not use Genymotion because it does not provide sms send/receive feature in their free version, nor does it allow me to change AOSP as needed.

mingwayzhang commented 8 years ago

Now I understand what XposedTools is doing. The output is actually the zip file to be flushed into the image. What I expected was that xposed will be integrated into the generated AOSP image. So, would it be possible to add this feature into XposeTools? Integrating xposed into emulator with customized android could also be a very cool functionality. Thanks.

CorruptComputer commented 8 years ago

Like an Xposed ROM? Or just a base for other ROMers to extend?

rovo89 commented 8 years ago

What I expected was that xposed will be integrated into the generated AOSP image.

Not sure how you got this idea. The README is pretty clear about what the build scripts do, and I think they meet the general expectation to recreate those files which I publish.

So, would it be possible to add this feature into XposeTools?

Maybe. If you find a way, feel free to share and I'll see how I can add it to the README. I don't have the time to support you with this though. I also doubt that many people would use it - seriously, how many people compile the emulator image themselves? I think a way to flash the ZIP into an existing emulator would be much more useful, and offering multiple ways for installation also multiplies the potential issues.

Besides that, I'm generally against publishing ROMs with Xposed already integrated. The preinstalled Xposed version will soon be outdated and people might have a hard time updating it (e.g. because they don't know where to get updates from). For emulator images, similar thoughts apply, although developers downloading them probably know what they're doing.

mingwayzhang commented 8 years ago

Xposed framework has been flashed on my emulator now! Following the options, there is a "-f" option in build.pl that allows flashing the image. So, to avoid waiting for a brand new build, I simply grab the code piece in build.pl out and execute it as a new script. The only issue is that "su -c" is not needed on a rooted emulator. In fact, if adding this, the whole command won't be executed with error message: su: invalid uid/gid '-c'. If you don't mind, could I submit a patch to add a script such as flash.pl?

mingwayzhang commented 8 years ago

Looks like I run into problems. The first step I want to do is to make the updated emulator image persistent, i.e., all changes to /system remain on the disk. I know that /system is stored in file system.img which is ex4 format for emulator. So I directly mount it to /mnt and copy files extracted from the zip file (xposed-v80-arm.zip). Note that I only copied files in system sub directory in zip. However, it does not work, since the xposedinstall.apk complains that XposedFramework is not there, even if I find the XposedBridge.jar in the /system/framework. This means that all the changes to system.img are persistent, but it is not just simply updating binaries.

So, I checked how the zip file is really applied in build.pl and I find that everything is handled by "update-binary" located in zipstatic directory. So, the question comes to what exactly the binary "update-binary" does at runtime? I checked and find it is a language interpreter for recovery purpose, but looks like its source code is not available. So, it seems that I cannot apply the patch offline to the emulator. Could you please share a pointer as what this specific "update-binary" does? Thanks.

rovo89 commented 8 years ago

The update-binary is a slightly modified version of BusyBox: https://github.com/rovo89/android_external_busybox See also: https://github.com/rovo89/android_external_busybox/commit/939c39ff312e3be1120aef3ed1893f7217383225