Add simple-force-redefine agent

This adds as an agent 'libforceredefine' that will redefine classes
for us on demand. This can be used to test the behavior of
class-redefinition on apps in various compilation states.

This agent takes an argument a file that contains a new-line separated
list of fully qualified class names (see jni FindClass documentation).
These classes will be redefined to add a NOP before every function.
This transformation will be reapplied if any additional transforms are
performed.

Test: adb shell am attach-agent $(adb shell pidof com.antonioleiva.bandhookkotlin) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist; \
      adb shell am attach-agent $(adb shell pidof com.antonioleiva.bandhookkotlin) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist; \
      adb shell am attach-agent $(adb shell pidof com.antonioleiva.bandhookkotlin) /data/local/tmp/libforceredefine.so=/data/local/tmp/classlist
Bug: 127477438

Change-Id: I0af60ab31970a68abf8e08e6036cc48e2e4438ac
3 files changed