Skip to content

Commit ffc2f21

Browse files
lingqiqi5211Sevtinge
authored andcommitted
opt: add disable the local watermark removal
1 parent 64c9281 commit ffc2f21

2 files changed

Lines changed: 51 additions & 4 deletions

File tree

library/hook/src/main/java/com/sevtinge/hyperceiler/hook/module/rules/camera/CloudWatermark.kt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.sevtinge.hyperceiler.hook.module.base.dexkit.DexKit
2323
import io.github.kyuubiran.ezxhelper.core.finder.MethodFinder.`-Static`.methodFinder
2424
import io.github.kyuubiran.ezxhelper.xposed.dsl.HookFactory.`-Static`.createHook
2525
import org.json.JSONObject
26+
import org.luckypray.dexkit.query.enums.StringMatchType
2627
import java.lang.reflect.Method
2728
import java.lang.reflect.Modifier
2829

@@ -46,6 +47,22 @@ object CloudWatermark : BaseHook() {
4647
} as Method?
4748
}
4849

50+
private val cloudDelete by lazy {
51+
// 仅支持 6.2 及以上版本,用于强制获取云下发的新水印内容
52+
DexKit.findMember("deleteCloud") {
53+
it.findClass {
54+
matcher {
55+
addUsingString("watermark_enable", StringMatchType.Equals)
56+
}
57+
}.findMethod {
58+
matcher {
59+
addInvoke("Ljava/util/List;->isEmpty()Z")
60+
returnType = "void"
61+
}
62+
}.single()
63+
} as Method?
64+
}
65+
4966
override fun init() {
5067
if (cloudMethod == null) {
5168
logD(TAG, lpparam.packageName, "maybe not support this version")
@@ -56,6 +73,16 @@ object CloudWatermark : BaseHook() {
5673
returnConstant(true)
5774
}
5875

76+
runCatching {
77+
cloudDelete?.createHook {
78+
before {
79+
it.result = null
80+
}
81+
}
82+
}.onFailure {
83+
logW(TAG, lpparam.packageName, "hook deleteCloud failed, maybe not support this version")
84+
}
85+
5986
JSONObject::class.java.methodFinder()
6087
.filterByName("optJSONObject")
6188
.first()

library/hook/src/main/java/com/sevtinge/hyperceiler/hook/module/rules/mediaeditor/CustomWatermark.kt

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,31 @@ object CustomWatermark : BaseHook() {
4343
}
4444
}
4545

46+
private val searchNew by lazy<Method> {
47+
// 2.2.0.1.6 开始混淆类名和字符串
48+
DexKit.findMember("CustomWatermarkNew") {
49+
it.findClass {
50+
matcher {
51+
addUsingString("check geocode selectable", StringMatchType.Contains)
52+
}
53+
}.findMethod {
54+
matcher {
55+
addInvoke("Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;")
56+
returnType = "java.lang.String"
57+
}
58+
}.single()
59+
}
60+
}
61+
4662
override fun init() {
47-
logD(TAG, lpparam.packageName, "[CustomWatermark] search method is $search")
48-
search.createHook {
49-
// 当前只能修改后缀
50-
returnConstant(name)
63+
runCatching {
64+
search.createHook {
65+
returnConstant(name)
66+
}
67+
}.onFailure {
68+
searchNew.createHook {
69+
returnConstant(name)
70+
}
5171
}
5272

5373
/*SystemProperties.methodFinder()

0 commit comments

Comments
 (0)