rovo89 / android_art

Android ART with modifications for the Xposed framework.
Other
371 stars 211 forks source link

[LP] ART inlines very simple methods #4

Closed rovo89 closed 9 years ago

rovo89 commented 9 years ago

From @DavisNT on February 25, 2015 6:58

In current Xposed for Lollipop alpha it is not possible to hook very simple methods (e.g. method2() from unmodified code sample https://github.com/DavisNT/XposedLollipopTests/ ). Most likely this happens due to inlining of very simple methods (when uncommenting Log.i() inside method2() the method becomes hookable).

Copied from original issue: rovo89/Xposed#21

rovo89 commented 9 years ago

@DavisNT I moved the issue here because I think that this is the spot where it needs to be fixed.

rovo89 commented 9 years ago

I can reproduce it, method2() is indeed inlined. This is probably also the reason for issues like this: http://forum.xda-developers.com/xposed/hooking-t3030626 (and the workaround to use Boolean instead of boolean probably works because the former isn't simple enough)

@vladpolkovnik had contacted me with his approach (including code), which also contained some changes in the compiler. I'll wait for his update to see which of them should be included in Xposed.

rovo89 commented 9 years ago

On a side note: @DavisNT, Eclipse automatically bundles jars in the libs folder into the APK, that's why it's getting huge. Try calling the folder lib or something for those libraries that you only want to reference (like the Xposed API).

DavisNT commented 9 years ago

Offtopic: Thanks for the side note! IMHO leaving unneeded android-support-v4.jar in Xposed modules is a really common mistake - I have even reported this to other developers (and done this in my own released Xposed modules).