We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我参照这ServiceHookTransform写了一个ActivityHookTransform,但是没有hook到,反编译activity发现也没有插入自定义的代码 test
class ActivityHookTransform: BaseHookTransform() { override fun ignoreClass(context: TransformContext, klass: ClassNode): Boolean { var ignore = super.ignoreClass(context, klass) if (klass.isInterface) { return true } if (!ignore) { ignore = !PrivacyPluginUtil.privacyPluginUtil.isActivity(klass.formatName(), klass.formatSuperName()) } return ignore } override fun transform( project: Project, privacyExtension: PrivacyExtension, context: TransformContext, klass: ClassNode ): ClassNode { println("onCreate tranform"+klass.formatName()) HookedDataManger.MANAGER.addHookService(klass.formatName()) val onStartCommandMethod = klass.methods.find { it.name == "onCreate" } if(onStartCommandMethod!=null){ println("onCreate tranform"+klass.formatName()) } onStartCommandMethod?.instructions?.iterator()?.asSequence()?.forEach { if (it is InsnNode) { if (it.opcode == Opcodes.RETURN || it.opcode == Opcodes.IRETURN) { val newInstructions = InsnList() newInstructions.add(LdcInsnNode("xxxxx") ) newInstructions.add(LdcInsnNode("onCreate end======") ) newInstructions.add(MethodInsnNode(Opcodes.INVOKESTATIC, "android/util/Log", "i", "(Ljava/lang/String;Ljava/lang/String;)I", false) ) newInstructions.add(InsnNode(Opcodes.POP)) onStartCommandMethod.instructions.insertBefore(it, newInstructions) } } } return klass } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我参照这ServiceHookTransform写了一个ActivityHookTransform,但是没有hook到,反编译activity发现也没有插入自定义的代码
test
The text was updated successfully, but these errors were encountered: