javassist-android icon indicating copy to clipboard operation
javassist-android copied to clipboard

insertBefore, insertAfter into Android framework methods?

Open vliux opened this issue 9 years ago • 1 comments

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.

vliux avatar Nov 17 '15 06:11 vliux

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.

crimsonwoods avatar Nov 18 '15 05:11 crimsonwoods