refactor: Replacing original classes with mutated ones

This commit is contained in:
oSumAtrIX 2022-03-31 18:56:36 +02:00
parent e6c2501539
commit 1dd3394ea3
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -29,12 +29,13 @@ class Patcher(
val newDexFile = object : DexFile { val newDexFile = object : DexFile {
override fun getClasses(): Set<ClassDef> { override fun getClasses(): Set<ClassDef> {
// this is a slow workaround for now // this is a slow workaround for now
val mutableClassList = cache.classes.toMutableList() val classes = cache.classes.toMutableSet()
cache.classProxy cache.classProxy
.filter { it.proxyUsed }.forEach { proxy -> .filter { it.proxyUsed }.forEach { proxy ->
mutableClassList[proxy.originalIndex] = proxy.mutatedClass classes.remove(classes.elementAt(proxy.originalIndex))
classes.add(proxy.mutatedClass)
} }
return mutableClassList.toSet() return classes
} }
override fun getOpcodes(): Opcodes { override fun getOpcodes(): Opcodes {