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 {
override fun getClasses(): Set<ClassDef> {
// this is a slow workaround for now
val mutableClassList = cache.classes.toMutableList()
val classes = cache.classes.toMutableSet()
cache.classProxy
.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 {