crimsonwoods / javassist-android

Javassit for Android
214 stars 42 forks source link

insertBefore, insertAfter into Android framework methods? #3

Open vliux opened 8 years ago

vliux commented 8 years ago

Is it possible to insertBefore/insertAfter a small portion of code into any method inside Android framework, and apply the change at runtime? Say, android.widget.TextView.setText().

I have tried it with CodeConverter with HotSwapper but with no luck. As I know the framework classes are all forked from Zygote in Android which is very different from traditional Java.

crimsonwoods commented 8 years ago

We cannot modify any methods inside of Android Framework or imported prebuilt/installed library at runtime. Because Dalvik/ART runtime is not a standard JVM and Instrumentation is not supported. To modify that methods, we should be able to modify the binary image (machine code) loaded on the memory dynamically. But, it cannot. No easy way.