mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-05 06:44:25 +02:00
chore: merge branch dev
to main
(#213)
This commit is contained in:
commit
254912438a
27
CHANGELOG.md
27
CHANGELOG.md
@ -1,3 +1,30 @@
|
|||||||
|
# [13.0.0-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v13.0.0-dev.2...v13.0.0-dev.3) (2023-08-14)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* decode in correct order ([8fb2f2d](https://github.com/ReVanced/revanced-patcher/commit/8fb2f2dc1d3b9b1e9fd13b39485985d2886d52ae))
|
||||||
|
* only enable logging for ReVanced ([783ccf8](https://github.com/ReVanced/revanced-patcher/commit/783ccf8529f5d16aa463982da6977328306232bb))
|
||||||
|
|
||||||
|
# [13.0.0-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v13.0.0-dev.1...v13.0.0-dev.2) (2023-08-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* disable correct loggers ([c2d89c6](https://github.com/ReVanced/revanced-patcher/commit/c2d89c622e06e58e5042e1a00ef67cee8a246e53))
|
||||||
|
* get framework ids to compile resources ([f2cb7ee](https://github.com/ReVanced/revanced-patcher/commit/f2cb7ee7dffa573c31df497cf235a3f5d120f91f))
|
||||||
|
* set package metadata correctly ([02d6ff1](https://github.com/ReVanced/revanced-patcher/commit/02d6ff15fe87c2352de29749610e9d72db8ba418))
|
||||||
|
|
||||||
|
# [13.0.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v12.1.1...v13.0.0-dev.1) (2023-08-11)
|
||||||
|
|
||||||
|
|
||||||
|
* build(Needs bump)!: Bump dependencies ([d5f89a9](https://github.com/ReVanced/revanced-patcher/commit/d5f89a903f019c199bdb27a50287124fc4b4978e))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* This bump updates smali, a crucial dependency
|
||||||
|
|
||||||
## [12.1.1](https://github.com/ReVanced/revanced-patcher/compare/v12.1.0...v12.1.1) (2023-08-03)
|
## [12.1.1](https://github.com/ReVanced/revanced-patcher/compare/v12.1.0...v12.1.1) (2023-08-03)
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,20 +10,23 @@ val githubPassword: String = project.findProperty("gpr.key") as? String ?: Syste
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven {
|
google()
|
||||||
url = uri("https://maven.pkg.github.com/revanced/multidexlib2")
|
listOf("multidexlib2", "apktool").forEach { repo ->
|
||||||
credentials {
|
maven {
|
||||||
username = githubUsername
|
url = uri("https://maven.pkg.github.com/revanced/$repo")
|
||||||
password = githubPassword
|
credentials {
|
||||||
|
username = githubUsername
|
||||||
|
password = githubPassword
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("xpp3:xpp3:1.1.4c")
|
implementation("xpp3:xpp3:1.1.4c")
|
||||||
implementation("app.revanced:smali:2.5.3-a3836654")
|
implementation("com.android.tools.smali:smali:3.0.3")
|
||||||
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
implementation("app.revanced:multidexlib2:3.0.3.r2")
|
||||||
implementation("app.revanced:apktool-lib:2.8.2-1")
|
implementation("app.revanced:apktool-lib:2.8.2-3")
|
||||||
|
|
||||||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.22")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.22")
|
||||||
testImplementation("org.jetbrains.kotlin:kotlin-test:1.8.20-RC")
|
testImplementation("org.jetbrains.kotlin:kotlin-test:1.8.20-RC")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 12.1.1
|
version = 13.0.0-dev.3
|
||||||
|
@ -10,25 +10,26 @@ import app.revanced.patcher.patch.*
|
|||||||
import brut.androlib.AaptInvoker
|
import brut.androlib.AaptInvoker
|
||||||
import brut.androlib.ApkDecoder
|
import brut.androlib.ApkDecoder
|
||||||
import brut.androlib.Config
|
import brut.androlib.Config
|
||||||
|
import brut.androlib.apk.ApkInfo
|
||||||
|
import brut.androlib.apk.UsesFramework
|
||||||
import brut.androlib.res.Framework
|
import brut.androlib.res.Framework
|
||||||
import brut.androlib.res.ResourcesDecoder
|
import brut.androlib.res.ResourcesDecoder
|
||||||
import brut.androlib.res.decoder.AndroidManifestResourceParser
|
import brut.androlib.res.decoder.AndroidManifestResourceParser
|
||||||
import brut.androlib.res.decoder.ResAttrDecoder
|
|
||||||
import brut.androlib.res.decoder.XmlPullStreamDecoder
|
import brut.androlib.res.decoder.XmlPullStreamDecoder
|
||||||
import brut.androlib.res.util.ExtMXSerializer
|
|
||||||
import brut.androlib.res.util.ExtXmlSerializer
|
|
||||||
import brut.androlib.res.xml.ResXmlPatcher
|
import brut.androlib.res.xml.ResXmlPatcher
|
||||||
import brut.directory.ExtFile
|
import brut.directory.ExtFile
|
||||||
|
import com.android.tools.smali.dexlib2.Opcodes
|
||||||
|
import com.android.tools.smali.dexlib2.iface.DexFile
|
||||||
|
import com.android.tools.smali.dexlib2.writer.io.MemoryDataStore
|
||||||
import lanchon.multidexlib2.BasicDexFileNamer
|
import lanchon.multidexlib2.BasicDexFileNamer
|
||||||
import lanchon.multidexlib2.DexIO
|
import lanchon.multidexlib2.DexIO
|
||||||
import lanchon.multidexlib2.MultiDexIO
|
import lanchon.multidexlib2.MultiDexIO
|
||||||
import org.jf.dexlib2.Opcodes
|
|
||||||
import org.jf.dexlib2.iface.DexFile
|
|
||||||
import org.jf.dexlib2.writer.io.MemoryDataStore
|
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
import java.util.logging.Level
|
||||||
|
import java.util.logging.LogManager
|
||||||
|
|
||||||
internal val NAMER = BasicDexFileNamer()
|
internal val NAMER = BasicDexFileNamer()
|
||||||
|
|
||||||
@ -37,23 +38,42 @@ internal val NAMER = BasicDexFileNamer()
|
|||||||
* @param options The options for the patcher.
|
* @param options The options for the patcher.
|
||||||
*/
|
*/
|
||||||
class Patcher(private val options: PatcherOptions) {
|
class Patcher(private val options: PatcherOptions) {
|
||||||
private val logger = options.logger
|
|
||||||
private val opcodes: Opcodes
|
|
||||||
private var resourceDecodingMode = ResourceDecodingMode.MANIFEST_ONLY
|
|
||||||
private var mergeIntegrations = false
|
|
||||||
val context: PatcherContext
|
val context: PatcherContext
|
||||||
|
|
||||||
|
private val logger = options.logger
|
||||||
|
|
||||||
|
private val opcodes: Opcodes
|
||||||
|
|
||||||
|
private var resourceDecodingMode = ResourceDecodingMode.MANIFEST_ONLY
|
||||||
|
|
||||||
|
private var mergeIntegrations = false
|
||||||
|
|
||||||
private val config = Config.getDefaultConfig().apply {
|
private val config = Config.getDefaultConfig().apply {
|
||||||
|
useAapt2 = true
|
||||||
aaptPath = options.aaptPath
|
aaptPath = options.aaptPath
|
||||||
frameworkDirectory = options.frameworkDirectory
|
frameworkDirectory = options.frameworkDirectory
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
// Disable unwanted logging.
|
||||||
|
LogManager.getLogManager().let { manager ->
|
||||||
|
manager.getLogger("").level = Level.OFF // Disable root logger.
|
||||||
|
// Enable only ReVanced logging.
|
||||||
|
manager.loggerNames
|
||||||
|
.toList()
|
||||||
|
.filter { it.startsWith("app.revanced") }
|
||||||
|
.map { manager.getLogger(it) }
|
||||||
|
.forEach { it.level = Level.INFO }
|
||||||
|
}
|
||||||
|
|
||||||
logger.info("Reading dex files")
|
logger.info("Reading dex files")
|
||||||
|
|
||||||
// read dex files
|
// read dex files
|
||||||
val dexFile = MultiDexIO.readDexFile(true, options.inputFile, NAMER, null, null)
|
val dexFile = MultiDexIO.readDexFile(true, options.inputFile, NAMER, null, null)
|
||||||
|
|
||||||
// get the opcodes
|
// get the opcodes
|
||||||
opcodes = dexFile.opcodes
|
opcodes = dexFile.opcodes
|
||||||
|
|
||||||
// finally create patcher context
|
// finally create patcher context
|
||||||
context = PatcherContext(dexFile.classes.toMutableList(), File(options.resourceCacheDirectory))
|
context = PatcherContext(dexFile.classes.toMutableList(), File(options.resourceCacheDirectory))
|
||||||
|
|
||||||
@ -84,61 +104,61 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
fun save(): PatcherResult {
|
fun save(): PatcherResult {
|
||||||
var resourceFile: File? = null
|
var resourceFile: File? = null
|
||||||
|
|
||||||
when (resourceDecodingMode) {
|
if (resourceDecodingMode == ResourceDecodingMode.FULL) {
|
||||||
ResourceDecodingMode.FULL -> {
|
logger.info("Compiling resources")
|
||||||
logger.info("Compiling resources")
|
|
||||||
|
|
||||||
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
||||||
val aaptFile = cacheDirectory.resolve("aapt_temp_file").also {
|
val aaptFile = cacheDirectory.resolve("aapt_temp_file").also {
|
||||||
Files.deleteIfExists(it.toPath())
|
Files.deleteIfExists(it.toPath())
|
||||||
}.also { resourceFile = it }
|
}.also { resourceFile = it }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AaptInvoker(
|
AaptInvoker(
|
||||||
config,
|
config,
|
||||||
context.packageMetadata.apkInfo
|
context.packageMetadata.apkInfo
|
||||||
).invokeAapt(
|
).invokeAapt(
|
||||||
aaptFile,
|
aaptFile,
|
||||||
cacheDirectory.resolve("AndroidManifest.xml").also {
|
cacheDirectory.resolve("AndroidManifest.xml").also {
|
||||||
ResXmlPatcher.fixingPublicAttrsInProviderAttributes(it)
|
ResXmlPatcher.fixingPublicAttrsInProviderAttributes(it)
|
||||||
},
|
},
|
||||||
cacheDirectory.resolve("res"),
|
cacheDirectory.resolve("res"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
context.packageMetadata.apkInfo.usesFramework.let { usesFramework ->
|
context.packageMetadata.apkInfo.usesFramework.let { usesFramework ->
|
||||||
usesFramework.ids.map { id ->
|
usesFramework.ids.map { id ->
|
||||||
Framework(config).getFrameworkApk(id, usesFramework.tag)
|
Framework(config).getFrameworkApk(id, usesFramework.tag)
|
||||||
}.toTypedArray()
|
}.toTypedArray()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} finally {
|
} finally {
|
||||||
cacheDirectory.close()
|
cacheDirectory.close()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else -> logger.info("Not compiling resources because resource patching is not required")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Creating new dex file")
|
|
||||||
val newDexFile = object : DexFile {
|
|
||||||
override fun getClasses() = context.bytecodeContext.classes.also { it.replaceClasses() }
|
|
||||||
override fun getOpcodes() = this@Patcher.opcodes
|
|
||||||
}
|
|
||||||
|
|
||||||
// write modified dex files
|
|
||||||
logger.info("Writing modified dex files")
|
logger.info("Writing modified dex files")
|
||||||
val dexFiles = mutableMapOf<String, MemoryDataStore>()
|
|
||||||
MultiDexIO.writeDexFile(
|
|
||||||
true, -1, // core count
|
|
||||||
dexFiles, NAMER, newDexFile, DexIO.DEFAULT_MAX_DEX_POOL_SIZE, null
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatcherResult(
|
return mutableMapOf<String, MemoryDataStore>().apply {
|
||||||
dexFiles.map {
|
MultiDexIO.writeDexFile(
|
||||||
app.revanced.patcher.util.dex.DexFile(it.key, it.value.readAt(0))
|
true,
|
||||||
},
|
-1, // Defaults to amount of available cores.
|
||||||
context.packageMetadata.apkInfo.doNotCompress?.toList(),
|
this,
|
||||||
resourceFile
|
NAMER,
|
||||||
)
|
object : DexFile {
|
||||||
|
override fun getClasses() = context.bytecodeContext.classes.also { it.replaceClasses() }
|
||||||
|
override fun getOpcodes() = this@Patcher.opcodes
|
||||||
|
},
|
||||||
|
DexIO.DEFAULT_MAX_DEX_POOL_SIZE,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}.let { dexFiles ->
|
||||||
|
PatcherResult(
|
||||||
|
dexFiles.map {
|
||||||
|
app.revanced.patcher.util.dex.DexFile(it.key, it.value.readAt(0))
|
||||||
|
},
|
||||||
|
context.packageMetadata.apkInfo.doNotCompress?.toList(),
|
||||||
|
resourceFile
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,73 +198,59 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
* @param mode The [ResourceDecodingMode] to use when decoding.
|
* @param mode The [ResourceDecodingMode] to use when decoding.
|
||||||
*/
|
*/
|
||||||
private fun decodeResources(mode: ResourceDecodingMode) {
|
private fun decodeResources(mode: ResourceDecodingMode) {
|
||||||
val extInputFile = ExtFile(options.inputFile)
|
val apkInfo = ApkInfo(ExtFile(options.inputFile)).also { context.packageMetadata.apkInfo = it }
|
||||||
try {
|
|
||||||
val resourcesDecoder = ResourcesDecoder(config, extInputFile)
|
|
||||||
|
|
||||||
|
// Needed to record uncompressed files.
|
||||||
|
val apkDecoder = ApkDecoder(config, apkInfo)
|
||||||
|
|
||||||
|
// Needed to decode resources.
|
||||||
|
val resourcesDecoder = ResourcesDecoder(config, apkInfo)
|
||||||
|
|
||||||
|
try {
|
||||||
when (mode) {
|
when (mode) {
|
||||||
ResourceDecodingMode.FULL -> {
|
ResourceDecodingMode.FULL -> {
|
||||||
val outDir = File(options.resourceCacheDirectory)
|
|
||||||
if (outDir.exists()) {
|
|
||||||
logger.info("Deleting existing resource cache directory")
|
|
||||||
if (!outDir.deleteRecursively()) logger.error("Failed to delete existing resource cache directory")
|
|
||||||
}
|
|
||||||
|
|
||||||
outDir.mkdirs()
|
|
||||||
|
|
||||||
logger.info("Decoding resources")
|
logger.info("Decoding resources")
|
||||||
|
|
||||||
resourcesDecoder.decodeManifest(outDir)
|
val outDir = options.recreateResourceCacheDirectory()
|
||||||
resourcesDecoder.decodeResources(outDir)
|
|
||||||
|
|
||||||
context.packageMetadata.also {
|
resourcesDecoder.decodeResources(outDir)
|
||||||
it.apkInfo = resourcesDecoder.apkInfo
|
resourcesDecoder.decodeManifest(outDir)
|
||||||
}.apkInfo.doNotCompress = ApkDecoder(config, extInputFile).recordUncompressedFiles(
|
|
||||||
context.packageMetadata.apkInfo, resourcesDecoder.resFileMapping
|
apkDecoder.recordUncompressedFiles(resourcesDecoder.resFileMapping)
|
||||||
)
|
|
||||||
|
apkInfo.usesFramework = UsesFramework().apply {
|
||||||
|
ids = resourcesDecoder.resTable.listFramePackages().map { it.id }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ResourceDecodingMode.MANIFEST_ONLY -> {
|
ResourceDecodingMode.MANIFEST_ONLY -> {
|
||||||
logger.info("Decoding AndroidManifest.xml only, because resources are not needed")
|
logger.info("Decoding app manifest")
|
||||||
|
|
||||||
// Instead of using resourceDecoder.decodeManifest which decodes the whole file
|
// Decode manually instead of using resourceDecoder.decodeManifest
|
||||||
// use the XmlPullStreamDecoder in order to get necessary information from the manifest
|
// because it does not support decoding to an OutputStream.
|
||||||
// used below.
|
XmlPullStreamDecoder(
|
||||||
XmlPullStreamDecoder(AndroidManifestResourceParser().apply {
|
AndroidManifestResourceParser(resourcesDecoder.resTable),
|
||||||
attrDecoder = ResAttrDecoder().apply { this.resTable = resourcesDecoder.resTable }
|
resourcesDecoder.resXmlSerializer
|
||||||
}, ExtMXSerializer().apply {
|
|
||||||
setProperty(
|
|
||||||
ExtXmlSerializer.PROPERTY_SERIALIZER_INDENTATION, " "
|
|
||||||
)
|
|
||||||
setProperty(
|
|
||||||
ExtXmlSerializer.PROPERTY_SERIALIZER_LINE_SEPARATOR,
|
|
||||||
System.getProperty("line.separator")
|
|
||||||
)
|
|
||||||
setProperty(
|
|
||||||
ExtXmlSerializer.PROPERTY_DEFAULT_ENCODING,
|
|
||||||
"utf-8"
|
|
||||||
)
|
|
||||||
setDisabledAttrEscape(true)
|
|
||||||
}
|
|
||||||
).decodeManifest(
|
).decodeManifest(
|
||||||
extInputFile.directory.getFileInput("AndroidManifest.xml"),
|
apkInfo.apkFile.directory.getFileInput("AndroidManifest.xml"),
|
||||||
// Older Android versions do not support OutputStream.nullOutputStream()
|
// Older Android versions do not support OutputStream.nullOutputStream()
|
||||||
object : OutputStream() { override fun write(b: Int) { /* do nothing */ } }
|
object : OutputStream() {
|
||||||
|
override fun write(b: Int) { /* do nothing */
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the package name and version from the manifest using the XmlPullStreamDecoder.
|
// Get the package name and version from the manifest using the XmlPullStreamDecoder.
|
||||||
// XmlPullStreamDecoder.decodeManifest() sets metadata.apkInfo.
|
// XmlPullStreamDecoder.decodeManifest() sets metadata.apkInfo.
|
||||||
context.packageMetadata.let { metadata ->
|
context.packageMetadata.let { metadata ->
|
||||||
metadata.apkInfo = resourcesDecoder.apkInfo
|
metadata.packageName = resourcesDecoder.resTable.packageRenamed
|
||||||
|
apkInfo.versionInfo.let {
|
||||||
metadata.packageName = resourcesDecoder.resTable.currentResPackage.name
|
metadata.packageVersion = it.versionName ?: it.versionCode
|
||||||
resourcesDecoder.apkInfo.versionInfo.let {
|
}
|
||||||
metadata.packageVersion = it.versionName ?: it.versionCode
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
extInputFile.close()
|
apkInfo.apkFile.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import app.revanced.patcher.data.*
|
|||||||
import app.revanced.patcher.logging.Logger
|
import app.revanced.patcher.logging.Logger
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
import app.revanced.patcher.util.ClassMerger.merge
|
import app.revanced.patcher.util.ClassMerger.merge
|
||||||
import org.jf.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
data class PatcherContext(
|
data class PatcherContext(
|
||||||
|
@ -18,4 +18,15 @@ data class PatcherOptions(
|
|||||||
internal val aaptPath: String? = null,
|
internal val aaptPath: String? = null,
|
||||||
internal val frameworkDirectory: String? = null,
|
internal val frameworkDirectory: String? = null,
|
||||||
internal val logger: Logger = NopLogger
|
internal val logger: Logger = NopLogger
|
||||||
)
|
) {
|
||||||
|
fun recreateResourceCacheDirectory() = File(resourceCacheDirectory).also {
|
||||||
|
if (it.exists()) {
|
||||||
|
logger.info("Deleting existing resource cache directory")
|
||||||
|
|
||||||
|
if (!it.deleteRecursively())
|
||||||
|
logger.error("Failed to delete existing resource cache directory")
|
||||||
|
}
|
||||||
|
|
||||||
|
it.mkdirs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,8 +2,8 @@ package app.revanced.patcher.data
|
|||||||
|
|
||||||
import app.revanced.patcher.util.ProxyBackedClassList
|
import app.revanced.patcher.util.ProxyBackedClassList
|
||||||
import app.revanced.patcher.util.method.MethodWalker
|
import app.revanced.patcher.util.method.MethodWalker
|
||||||
import org.jf.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import org.jf.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import org.w3c.dom.Document
|
import org.w3c.dom.Document
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.extensions
|
package app.revanced.patcher.extensions
|
||||||
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import org.jf.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a label for the instruction at given index.
|
* Create a label for the instruction at given index.
|
||||||
|
@ -4,12 +4,12 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
|||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patcher.util.smali.toInstruction
|
import app.revanced.patcher.util.smali.toInstruction
|
||||||
import app.revanced.patcher.util.smali.toInstructions
|
import app.revanced.patcher.util.smali.toInstructions
|
||||||
import org.jf.dexlib2.builder.BuilderInstruction
|
import com.android.tools.smali.dexlib2.builder.BuilderInstruction
|
||||||
import org.jf.dexlib2.builder.BuilderOffsetInstruction
|
import com.android.tools.smali.dexlib2.builder.BuilderOffsetInstruction
|
||||||
import org.jf.dexlib2.builder.Label
|
import com.android.tools.smali.dexlib2.builder.Label
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
import org.jf.dexlib2.builder.instruction.*
|
import com.android.tools.smali.dexlib2.builder.instruction.*
|
||||||
import org.jf.dexlib2.iface.instruction.Instruction
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
|
|
||||||
object InstructionExtensions {
|
object InstructionExtensions {
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@ import app.revanced.patcher.fingerprint.Fingerprint
|
|||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
import app.revanced.patcher.util.proxy.ClassProxy
|
import app.revanced.patcher.util.proxy.ClassProxy
|
||||||
import org.jf.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import org.jf.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import org.jf.dexlib2.iface.instruction.Instruction
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.reference.StringReference
|
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||||
import org.jf.dexlib2.util.MethodUtil
|
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
private typealias StringMatch = MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult.StringMatch
|
private typealias StringMatch = MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult.StringMatch
|
||||||
|
@ -79,10 +79,10 @@ class PatchOptions(vararg options: PatchOption<*>) : Iterable<PatchOption<*>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A [Patch] option.
|
* A [Patch] option.
|
||||||
* @param key Unique identifier of the option. Example: _`settings.microg.enabled`_
|
* @param key Unique identifier of the option. Example: _`settings`_
|
||||||
* @param default The default value of the option.
|
* @param default The default value of the option.
|
||||||
* @param title A human-readable title of the option. Example: _MicroG Settings_
|
* @param title A human-readable title of the option. Example: _Patch Settings_
|
||||||
* @param description A human-readable description of the option. Example: _Settings integration for MicroG._
|
* @param description A human-readable description of the option. Example: _Settings for the patches._
|
||||||
* @param required Whether the option is required.
|
* @param required Whether the option is required.
|
||||||
*/
|
*/
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
|
@ -15,9 +15,9 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableField
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import org.jf.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import org.jf.dexlib2.util.MethodUtil
|
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
import kotlin.reflect.KFunction2
|
import kotlin.reflect.KFunction2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util
|
package app.revanced.patcher.util
|
||||||
|
|
||||||
import app.revanced.patcher.util.proxy.ClassProxy
|
import app.revanced.patcher.util.proxy.ClassProxy
|
||||||
import org.jf.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that represents a set of classes and proxies.
|
* A class that represents a set of classes and proxies.
|
||||||
|
@ -2,10 +2,10 @@ package app.revanced.patcher.util.method
|
|||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import org.jf.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
import org.jf.dexlib2.util.MethodUtil
|
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a method from another method via instruction offsets.
|
* Find a method from another method via instruction offsets.
|
||||||
|
@ -6,7 +6,7 @@ import app.revanced.patcher.data.Context
|
|||||||
import app.revanced.patcher.extensions.AnnotationExtensions.findAnnotationRecursively
|
import app.revanced.patcher.extensions.AnnotationExtensions.findAnnotationRecursively
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
import org.jf.dexlib2.DexFileFactory
|
import com.android.tools.smali.dexlib2.DexFileFactory
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URLClassLoader
|
import java.net.URLClassLoader
|
||||||
import java.util.jar.JarFile
|
import java.util.jar.JarFile
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy
|
package app.revanced.patcher.util.proxy
|
||||||
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
||||||
import org.jf.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A proxy class for a [ClassDef].
|
* A proxy class for a [ClassDef].
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes
|
package app.revanced.patcher.util.proxy.mutableTypes
|
||||||
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotationElement.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotationElement.Companion.toMutable
|
||||||
import org.jf.dexlib2.base.BaseAnnotation
|
import com.android.tools.smali.dexlib2.base.BaseAnnotation
|
||||||
import org.jf.dexlib2.iface.Annotation
|
import com.android.tools.smali.dexlib2.iface.Annotation
|
||||||
|
|
||||||
class MutableAnnotation(annotation: Annotation) : BaseAnnotation() {
|
class MutableAnnotation(annotation: Annotation) : BaseAnnotation() {
|
||||||
private val visibility = annotation.visibility
|
private val visibility = annotation.visibility
|
||||||
|
@ -2,9 +2,9 @@ package app.revanced.patcher.util.proxy.mutableTypes
|
|||||||
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue
|
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue.Companion.toMutable
|
||||||
import org.jf.dexlib2.base.BaseAnnotationElement
|
import com.android.tools.smali.dexlib2.base.BaseAnnotationElement
|
||||||
import org.jf.dexlib2.iface.AnnotationElement
|
import com.android.tools.smali.dexlib2.iface.AnnotationElement
|
||||||
import org.jf.dexlib2.iface.value.EncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.EncodedValue
|
||||||
|
|
||||||
class MutableAnnotationElement(annotationElement: AnnotationElement) : BaseAnnotationElement() {
|
class MutableAnnotationElement(annotationElement: AnnotationElement) : BaseAnnotationElement() {
|
||||||
private var name = annotationElement.name
|
private var name = annotationElement.name
|
||||||
|
@ -4,10 +4,10 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotation.Companion.
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import com.google.common.collect.Iterables
|
import com.google.common.collect.Iterables
|
||||||
import org.jf.dexlib2.base.reference.BaseTypeReference
|
import com.android.tools.smali.dexlib2.base.reference.BaseTypeReference
|
||||||
import org.jf.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import org.jf.dexlib2.util.FieldUtil
|
import com.android.tools.smali.dexlib2.util.FieldUtil
|
||||||
import org.jf.dexlib2.util.MethodUtil
|
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||||
|
|
||||||
class MutableClass(classDef: ClassDef) : ClassDef, BaseTypeReference() {
|
class MutableClass(classDef: ClassDef) : ClassDef, BaseTypeReference() {
|
||||||
// Class
|
// Class
|
||||||
|
@ -3,9 +3,9 @@ package app.revanced.patcher.util.proxy.mutableTypes
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotation.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotation.Companion.toMutable
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue
|
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue.Companion.toMutable
|
||||||
import org.jf.dexlib2.HiddenApiRestriction
|
import com.android.tools.smali.dexlib2.HiddenApiRestriction
|
||||||
import org.jf.dexlib2.base.reference.BaseFieldReference
|
import com.android.tools.smali.dexlib2.base.reference.BaseFieldReference
|
||||||
import org.jf.dexlib2.iface.Field
|
import com.android.tools.smali.dexlib2.iface.Field
|
||||||
|
|
||||||
class MutableField(field: Field) : Field, BaseFieldReference() {
|
class MutableField(field: Field) : Field, BaseFieldReference() {
|
||||||
private var definingClass = field.definingClass
|
private var definingClass = field.definingClass
|
||||||
|
@ -2,10 +2,10 @@ package app.revanced.patcher.util.proxy.mutableTypes
|
|||||||
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotation.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotation.Companion.toMutable
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethodParameter.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethodParameter.Companion.toMutable
|
||||||
import org.jf.dexlib2.HiddenApiRestriction
|
import com.android.tools.smali.dexlib2.HiddenApiRestriction
|
||||||
import org.jf.dexlib2.base.reference.BaseMethodReference
|
import com.android.tools.smali.dexlib2.base.reference.BaseMethodReference
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
import org.jf.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
|
|
||||||
class MutableMethod(method: Method) : Method, BaseMethodReference() {
|
class MutableMethod(method: Method) : Method, BaseMethodReference() {
|
||||||
private var definingClass = method.definingClass
|
private var definingClass = method.definingClass
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes
|
package app.revanced.patcher.util.proxy.mutableTypes
|
||||||
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotation.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotation.Companion.toMutable
|
||||||
import org.jf.dexlib2.base.BaseMethodParameter
|
import com.android.tools.smali.dexlib2.base.BaseMethodParameter
|
||||||
import org.jf.dexlib2.iface.MethodParameter
|
import com.android.tools.smali.dexlib2.iface.MethodParameter
|
||||||
|
|
||||||
// TODO: finish overriding all members if necessary
|
// TODO: finish overriding all members if necessary
|
||||||
class MutableMethodParameter(parameter: MethodParameter) : MethodParameter, BaseMethodParameter() {
|
class MutableMethodParameter(parameter: MethodParameter) : MethodParameter, BaseMethodParameter() {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotationElement.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableAnnotationElement.Companion.toMutable
|
||||||
import org.jf.dexlib2.base.value.BaseAnnotationEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseAnnotationEncodedValue
|
||||||
import org.jf.dexlib2.iface.AnnotationElement
|
import com.android.tools.smali.dexlib2.iface.AnnotationElement
|
||||||
import org.jf.dexlib2.iface.value.AnnotationEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.AnnotationEncodedValue
|
||||||
|
|
||||||
class MutableAnnotationEncodedValue(annotationEncodedValue: AnnotationEncodedValue) : BaseAnnotationEncodedValue(),
|
class MutableAnnotationEncodedValue(annotationEncodedValue: AnnotationEncodedValue) : BaseAnnotationEncodedValue(),
|
||||||
MutableEncodedValue {
|
MutableEncodedValue {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableEncodedValue.Companion.toMutable
|
||||||
import org.jf.dexlib2.base.value.BaseArrayEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseArrayEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.ArrayEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.ArrayEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.EncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.EncodedValue
|
||||||
|
|
||||||
class MutableArrayEncodedValue(arrayEncodedValue: ArrayEncodedValue) : BaseArrayEncodedValue(), MutableEncodedValue {
|
class MutableArrayEncodedValue(arrayEncodedValue: ArrayEncodedValue) : BaseArrayEncodedValue(), MutableEncodedValue {
|
||||||
private val _value by lazy {
|
private val _value by lazy {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseBooleanEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseBooleanEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.BooleanEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.BooleanEncodedValue
|
||||||
|
|
||||||
class MutableBooleanEncodedValue(booleanEncodedValue: BooleanEncodedValue) : BaseBooleanEncodedValue(),
|
class MutableBooleanEncodedValue(booleanEncodedValue: BooleanEncodedValue) : BaseBooleanEncodedValue(),
|
||||||
MutableEncodedValue {
|
MutableEncodedValue {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseByteEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseByteEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.ByteEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.ByteEncodedValue
|
||||||
|
|
||||||
class MutableByteEncodedValue(byteEncodedValue: ByteEncodedValue) : BaseByteEncodedValue(), MutableEncodedValue {
|
class MutableByteEncodedValue(byteEncodedValue: ByteEncodedValue) : BaseByteEncodedValue(), MutableEncodedValue {
|
||||||
private var value = byteEncodedValue.value
|
private var value = byteEncodedValue.value
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseCharEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseCharEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.CharEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.CharEncodedValue
|
||||||
|
|
||||||
class MutableCharEncodedValue(charEncodedValue: CharEncodedValue) : BaseCharEncodedValue(), MutableEncodedValue {
|
class MutableCharEncodedValue(charEncodedValue: CharEncodedValue) : BaseCharEncodedValue(), MutableEncodedValue {
|
||||||
private var value = charEncodedValue.value
|
private var value = charEncodedValue.value
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseDoubleEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseDoubleEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.DoubleEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.DoubleEncodedValue
|
||||||
|
|
||||||
class MutableDoubleEncodedValue(doubleEncodedValue: DoubleEncodedValue) : BaseDoubleEncodedValue(),
|
class MutableDoubleEncodedValue(doubleEncodedValue: DoubleEncodedValue) : BaseDoubleEncodedValue(),
|
||||||
MutableEncodedValue {
|
MutableEncodedValue {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.ValueType
|
import com.android.tools.smali.dexlib2.ValueType
|
||||||
import org.jf.dexlib2.iface.value.*
|
import com.android.tools.smali.dexlib2.iface.value.*
|
||||||
|
|
||||||
interface MutableEncodedValue : EncodedValue {
|
interface MutableEncodedValue : EncodedValue {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseEnumEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseEnumEncodedValue
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||||
import org.jf.dexlib2.iface.value.EnumEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.EnumEncodedValue
|
||||||
|
|
||||||
class MutableEnumEncodedValue(enumEncodedValue: EnumEncodedValue) : BaseEnumEncodedValue(), MutableEncodedValue {
|
class MutableEnumEncodedValue(enumEncodedValue: EnumEncodedValue) : BaseEnumEncodedValue(), MutableEncodedValue {
|
||||||
private var value = enumEncodedValue.value
|
private var value = enumEncodedValue.value
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.ValueType
|
import com.android.tools.smali.dexlib2.ValueType
|
||||||
import org.jf.dexlib2.base.value.BaseFieldEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseFieldEncodedValue
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||||
import org.jf.dexlib2.iface.value.FieldEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.FieldEncodedValue
|
||||||
|
|
||||||
class MutableFieldEncodedValue(fieldEncodedValue: FieldEncodedValue) : BaseFieldEncodedValue(), MutableEncodedValue {
|
class MutableFieldEncodedValue(fieldEncodedValue: FieldEncodedValue) : BaseFieldEncodedValue(), MutableEncodedValue {
|
||||||
private var value = fieldEncodedValue.value
|
private var value = fieldEncodedValue.value
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseFloatEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseFloatEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.FloatEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.FloatEncodedValue
|
||||||
|
|
||||||
class MutableFloatEncodedValue(floatEncodedValue: FloatEncodedValue) : BaseFloatEncodedValue(), MutableEncodedValue {
|
class MutableFloatEncodedValue(floatEncodedValue: FloatEncodedValue) : BaseFloatEncodedValue(), MutableEncodedValue {
|
||||||
private var value = floatEncodedValue.value
|
private var value = floatEncodedValue.value
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseIntEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseIntEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.IntEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.IntEncodedValue
|
||||||
|
|
||||||
class MutableIntEncodedValue(intEncodedValue: IntEncodedValue) : BaseIntEncodedValue(), MutableEncodedValue {
|
class MutableIntEncodedValue(intEncodedValue: IntEncodedValue) : BaseIntEncodedValue(), MutableEncodedValue {
|
||||||
private var value = intEncodedValue.value
|
private var value = intEncodedValue.value
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseLongEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseLongEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.LongEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.LongEncodedValue
|
||||||
|
|
||||||
class MutableLongEncodedValue(longEncodedValue: LongEncodedValue) : BaseLongEncodedValue(), MutableEncodedValue {
|
class MutableLongEncodedValue(longEncodedValue: LongEncodedValue) : BaseLongEncodedValue(), MutableEncodedValue {
|
||||||
private var value = longEncodedValue.value
|
private var value = longEncodedValue.value
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseMethodEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseMethodEncodedValue
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
import org.jf.dexlib2.iface.value.MethodEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.MethodEncodedValue
|
||||||
|
|
||||||
class MutableMethodEncodedValue(methodEncodedValue: MethodEncodedValue) : BaseMethodEncodedValue(),
|
class MutableMethodEncodedValue(methodEncodedValue: MethodEncodedValue) : BaseMethodEncodedValue(),
|
||||||
MutableEncodedValue {
|
MutableEncodedValue {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseMethodHandleEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseMethodHandleEncodedValue
|
||||||
import org.jf.dexlib2.iface.reference.MethodHandleReference
|
import com.android.tools.smali.dexlib2.iface.reference.MethodHandleReference
|
||||||
import org.jf.dexlib2.iface.value.MethodHandleEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.MethodHandleEncodedValue
|
||||||
|
|
||||||
class MutableMethodHandleEncodedValue(methodHandleEncodedValue: MethodHandleEncodedValue) :
|
class MutableMethodHandleEncodedValue(methodHandleEncodedValue: MethodHandleEncodedValue) :
|
||||||
BaseMethodHandleEncodedValue(),
|
BaseMethodHandleEncodedValue(),
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseMethodTypeEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseMethodTypeEncodedValue
|
||||||
import org.jf.dexlib2.iface.reference.MethodProtoReference
|
import com.android.tools.smali.dexlib2.iface.reference.MethodProtoReference
|
||||||
import org.jf.dexlib2.iface.value.MethodTypeEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.MethodTypeEncodedValue
|
||||||
|
|
||||||
class MutableMethodTypeEncodedValue(methodTypeEncodedValue: MethodTypeEncodedValue) : BaseMethodTypeEncodedValue(),
|
class MutableMethodTypeEncodedValue(methodTypeEncodedValue: MethodTypeEncodedValue) : BaseMethodTypeEncodedValue(),
|
||||||
MutableEncodedValue {
|
MutableEncodedValue {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseNullEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseNullEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.ByteEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.ByteEncodedValue
|
||||||
|
|
||||||
class MutableNullEncodedValue : BaseNullEncodedValue(), MutableEncodedValue {
|
class MutableNullEncodedValue : BaseNullEncodedValue(), MutableEncodedValue {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseShortEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseShortEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.ShortEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.ShortEncodedValue
|
||||||
|
|
||||||
class MutableShortEncodedValue(shortEncodedValue: ShortEncodedValue) : BaseShortEncodedValue(), MutableEncodedValue {
|
class MutableShortEncodedValue(shortEncodedValue: ShortEncodedValue) : BaseShortEncodedValue(), MutableEncodedValue {
|
||||||
private var value = shortEncodedValue.value
|
private var value = shortEncodedValue.value
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseStringEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseStringEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.ByteEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.ByteEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.StringEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.StringEncodedValue
|
||||||
|
|
||||||
class MutableStringEncodedValue(stringEncodedValue: StringEncodedValue) : BaseStringEncodedValue(),
|
class MutableStringEncodedValue(stringEncodedValue: StringEncodedValue) : BaseStringEncodedValue(),
|
||||||
MutableEncodedValue {
|
MutableEncodedValue {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
package app.revanced.patcher.util.proxy.mutableTypes.encodedValue
|
||||||
|
|
||||||
import org.jf.dexlib2.base.value.BaseTypeEncodedValue
|
import com.android.tools.smali.dexlib2.base.value.BaseTypeEncodedValue
|
||||||
import org.jf.dexlib2.iface.value.TypeEncodedValue
|
import com.android.tools.smali.dexlib2.iface.value.TypeEncodedValue
|
||||||
|
|
||||||
class MutableTypeEncodedValue(typeEncodedValue: TypeEncodedValue) : BaseTypeEncodedValue(), MutableEncodedValue {
|
class MutableTypeEncodedValue(typeEncodedValue: TypeEncodedValue) : BaseTypeEncodedValue(), MutableEncodedValue {
|
||||||
private var value = typeEncodedValue.value
|
private var value = typeEncodedValue.value
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package app.revanced.patcher.util.smali
|
package app.revanced.patcher.util.smali
|
||||||
|
|
||||||
import org.jf.dexlib2.iface.instruction.Instruction
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that represents a label for an instruction.
|
* A class that represents a label for an instruction.
|
||||||
|
@ -4,14 +4,14 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
|||||||
import org.antlr.runtime.CommonTokenStream
|
import org.antlr.runtime.CommonTokenStream
|
||||||
import org.antlr.runtime.TokenSource
|
import org.antlr.runtime.TokenSource
|
||||||
import org.antlr.runtime.tree.CommonTreeNodeStream
|
import org.antlr.runtime.tree.CommonTreeNodeStream
|
||||||
import org.jf.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcodes
|
import com.android.tools.smali.dexlib2.Opcodes
|
||||||
import org.jf.dexlib2.builder.BuilderInstruction
|
import com.android.tools.smali.dexlib2.builder.BuilderInstruction
|
||||||
import org.jf.dexlib2.writer.builder.DexBuilder
|
import com.android.tools.smali.dexlib2.writer.builder.DexBuilder
|
||||||
import org.jf.smali.LexerErrorInterface
|
import com.android.tools.smali.smali.LexerErrorInterface
|
||||||
import org.jf.smali.smaliFlexLexer
|
import com.android.tools.smali.smali.smaliFlexLexer
|
||||||
import org.jf.smali.smaliParser
|
import com.android.tools.smali.smali.smaliParser
|
||||||
import org.jf.smali.smaliTreeWalker
|
import com.android.tools.smali.smali.smaliTreeWalker
|
||||||
import java.io.InputStreamReader
|
import java.io.InputStreamReader
|
||||||
|
|
||||||
private const val METHOD_TEMPLATE = """
|
private const val METHOD_TEMPLATE = """
|
||||||
|
@ -11,13 +11,13 @@ import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import org.jf.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.BuilderOffsetInstruction
|
import com.android.tools.smali.dexlib2.builder.BuilderOffsetInstruction
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21s
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21s
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
@ -15,20 +15,20 @@ import app.revanced.patcher.usage.resource.patch.ExampleResourcePatch
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import com.google.common.collect.ImmutableList
|
import com.google.common.collect.ImmutableList
|
||||||
import org.jf.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Format
|
import com.android.tools.smali.dexlib2.Format
|
||||||
import org.jf.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction11x
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction11x
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c
|
||||||
import org.jf.dexlib2.immutable.ImmutableField
|
import com.android.tools.smali.dexlib2.immutable.ImmutableField
|
||||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodImplementation
|
||||||
import org.jf.dexlib2.immutable.reference.ImmutableFieldReference
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableFieldReference
|
||||||
import org.jf.dexlib2.immutable.reference.ImmutableStringReference
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableStringReference
|
||||||
import org.jf.dexlib2.immutable.value.ImmutableFieldEncodedValue
|
import com.android.tools.smali.dexlib2.immutable.value.ImmutableFieldEncodedValue
|
||||||
import org.jf.dexlib2.util.Preconditions
|
import com.android.tools.smali.dexlib2.util.Preconditions
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("example-bytecode-patch")
|
@Name("example-bytecode-patch")
|
||||||
|
@ -2,8 +2,8 @@ package app.revanced.patcher.usage.bytecode
|
|||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import org.jf.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
@FuzzyPatternScanMethod(2)
|
@FuzzyPatternScanMethod(2)
|
||||||
object ExampleFingerprint : MethodFingerprint(
|
object ExampleFingerprint : MethodFingerprint(
|
||||||
|
@ -5,14 +5,14 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
|
|||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.newLabel
|
import app.revanced.patcher.extensions.newLabel
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import org.jf.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.BuilderInstruction
|
import com.android.tools.smali.dexlib2.builder.BuilderInstruction
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21t
|
||||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||||
import org.jf.dexlib2.immutable.reference.ImmutableStringReference
|
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableStringReference
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
Loading…
x
Reference in New Issue
Block a user