Skip to content

Commit 6cc0658

Browse files
authored
feat: Implemented ignore list on Fingerprint, first release
chore: Merge branch `dev` to `main`
2 parents ead701b + d8c3280 commit 6cc0658

File tree

6 files changed

+455
-15
lines changed

6 files changed

+455
-15
lines changed

CHANGELOG.md

+419
Large diffs are not rendered by default.

api/revanced-patcher.api renamed to api/jadx-plugin-revanced-patcher.api

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
public final class app/revanced/patcher/Fingerprint {
2+
public final fun addMethodToIgnore (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/Method;)V
23
public final fun getClassDef (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;
34
public final fun getClassDefOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;
45
public final fun getMethod (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;
@@ -17,6 +18,7 @@ public final class app/revanced/patcher/Fingerprint {
1718
public final fun matchOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/Match;
1819
public final fun matchOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/Match;
1920
public final fun matchOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/Match;
21+
public final fun popMethodFromIgnoreList (Lapp/revanced/patcher/patch/BytecodePatchContext;)V
2022
}
2123

2224
public final class app/revanced/patcher/FingerprintBuilder {
@@ -150,7 +152,7 @@ public final class app/revanced/patcher/patch/BytecodePatch : app/revanced/patch
150152
}
151153

152154
public final class app/revanced/patcher/patch/BytecodePatchBuilder : app/revanced/patcher/patch/PatchBuilder {
153-
public synthetic fun build$revanced_patcher ()Lapp/revanced/patcher/patch/Patch;
155+
public synthetic fun build$jadx_plugin_revanced_patcher ()Lapp/revanced/patcher/patch/Patch;
154156
public final fun extendWith (Ljava/lang/String;)Lapp/revanced/patcher/patch/BytecodePatchBuilder;
155157
public final fun getExtensionInputStream ()Ljava/util/function/Supplier;
156158
public final fun setExtensionInputStream (Ljava/util/function/Supplier;)V
@@ -386,15 +388,15 @@ public final class app/revanced/patcher/patch/RawResourcePatch : app/revanced/pa
386388
}
387389

388390
public final class app/revanced/patcher/patch/RawResourcePatchBuilder : app/revanced/patcher/patch/PatchBuilder {
389-
public synthetic fun build$revanced_patcher ()Lapp/revanced/patcher/patch/Patch;
391+
public synthetic fun build$jadx_plugin_revanced_patcher ()Lapp/revanced/patcher/patch/Patch;
390392
}
391393

392394
public final class app/revanced/patcher/patch/ResourcePatch : app/revanced/patcher/patch/Patch {
393395
public fun toString ()Ljava/lang/String;
394396
}
395397

396398
public final class app/revanced/patcher/patch/ResourcePatchBuilder : app/revanced/patcher/patch/PatchBuilder {
397-
public synthetic fun build$revanced_patcher ()Lapp/revanced/patcher/patch/Patch;
399+
public synthetic fun build$jadx_plugin_revanced_patcher ()Lapp/revanced/patcher/patch/Patch;
398400
}
399401

400402
public final class app/revanced/patcher/patch/ResourcePatchContext : app/revanced/patcher/patch/PatchContext {

build.gradle.kts

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
signing
88
}
99

10-
group = "app.revanced"
10+
group = "app.brosssh"
1111

1212
tasks {
1313
processResources {
@@ -71,7 +71,7 @@ publishing {
7171
repositories {
7272
maven {
7373
name = "GitHubPackages"
74-
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
74+
url = uri("https://maven.pkg.github.com/brosssh/revanced-patcher")
7575
credentials {
7676
username = System.getenv("GITHUB_ACTOR")
7777
password = System.getenv("GITHUB_TOKEN")
@@ -98,15 +98,15 @@ publishing {
9898
}
9999
developers {
100100
developer {
101-
id = "ReVanced"
102-
name = "ReVanced"
103-
101+
id = "Brosssh"
102+
name = "Brosssh"
103+
email = ""
104104
}
105105
}
106106
scm {
107-
connection = "scm:git:git://github.com/revanced/revanced-patcher.git"
108-
developerConnection = "scm:git:[email protected]:revanced/revanced-patcher.git"
109-
url = "https://github.com/revanced/revanced-patcher"
107+
connection = "scm:git:git://github.com/brosssh/revanced-patcher.git"
108+
developerConnection = "scm:git:[email protected]:brosssh/revanced-patcher.git"
109+
url = "https://github.com/brosssh/revanced-patcher"
110110
}
111111
}
112112
}

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
org.gradle.parallel = true
22
org.gradle.caching = true
3-
version = 21.0.0
3+
version = 1.0.0-dev.3

settings.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = "revanced-patcher"
1+
rootProject.name = "jadx-plugin-revanced-patcher"

src/main/kotlin/app/revanced/patcher/Fingerprint.kt

+21-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class Fingerprint internal constructor(
4747
@Suppress("ktlint:standard:backing-property-naming")
4848
// Backing field needed for lazy initialization.
4949
private var _matchOrNull: Match? = null
50+
private var _ignoreList: ArrayDeque<Method> = ArrayDeque()
5051

5152
/**
5253
* The match for this [Fingerprint]. Null if unmatched.
@@ -77,7 +78,11 @@ class Fingerprint internal constructor(
7778
}?.minByOrNull { it.size }?.let { methodClasses ->
7879
methodClasses.forEach { (classDef, method) ->
7980
val match = matchOrNull(classDef, method)
80-
if (match != null) return@let match
81+
if (match != null && !this._ignoreList.any {
82+
match.method.name == it.name &&
83+
match.classDef.toString() == it.definingClass
84+
})
85+
return@let match
8186
}
8287

8388
null
@@ -170,6 +175,7 @@ class Fingerprint internal constructor(
170175
val stringMatches: List<Match.StringMatch>? =
171176
if (strings != null) {
172177
buildList {
178+
if (method in _ignoreList) return null
173179
val instructions = method.instructionsOrNull ?: return null
174180

175181
val stringsList = strings.toMutableList()
@@ -197,6 +203,7 @@ class Fingerprint internal constructor(
197203
}
198204

199205
val patternMatch = if (opcodes != null) {
206+
if (method in _ignoreList) return null
200207
val instructions = method.instructionsOrNull ?: return null
201208

202209
fun patternScan(): Match.PatternMatch? {
@@ -408,6 +415,18 @@ class Fingerprint internal constructor(
408415
context(BytecodePatchContext)
409416
val stringMatches
410417
get() = match.stringMatches
418+
419+
context(BytecodePatchContext)
420+
fun addMethodToIgnore(match: Method) {
421+
_ignoreList.add(match)
422+
_matchOrNull = null
423+
}
424+
425+
context(BytecodePatchContext)
426+
fun popMethodFromIgnoreList() {
427+
_ignoreList.removeLastOrNull()
428+
_matchOrNull = null
429+
}
411430
}
412431

413432
/**
@@ -596,4 +615,4 @@ class FingerprintBuilder internal constructor(
596615
fun fingerprint(
597616
fuzzyPatternScanThreshold: Int = 0,
598617
block: FingerprintBuilder.() -> Unit,
599-
) = FingerprintBuilder(fuzzyPatternScanThreshold).apply(block).build()
618+
) = FingerprintBuilder(fuzzyPatternScanThreshold).apply(block).build()

0 commit comments

Comments
 (0)