refactor(orfon): RemoveRootDetectionPatch

This commit is contained in:
Pun Butrach
2026-01-11 23:29:48 +07:00
parent 52ae070369
commit b6d1f1c62a
2 changed files with 15 additions and 14 deletions

View File

@@ -1,13 +1,16 @@
package app.revanced.patches.orfon.detection.root
import app.revanced.patcher.fingerprint
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.accessFlags
import app.revanced.patcher.definingClass
import app.revanced.patcher.name
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
import com.android.tools.smali.dexlib2.AccessFlags
internal val isDeviceRootedFingeprint = fingerprint {
internal val BytecodePatchContext.isDeviceRootedMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PUBLIC)
returns("Z")
custom { method, classDef ->
method.name == "isDeviceRooted" &&
classDef.endsWith("/RootChecker;")
}
name("isDeviceRooted")
definingClass("/RootChecker;"::endsWith)
returnType("Z")
}

View File

@@ -1,18 +1,16 @@
package app.revanced.patches.orfon.detection.root
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.creatingBytecodePatch
import app.revanced.patches.shared.PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION
import app.revanced.patches.shared.PATCH_NAME_REMOVE_ROOT_DETECTION
import app.revanced.util.returnEarly
@Suppress("unused")
val removeRootDetectionPatch = bytecodePatch(
name = PATCH_NAME_REMOVE_ROOT_DETECTION,
@Suppress("unused", "ObjectPropertyName")
val `Remove root detection` by creatingBytecodePatch(
description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION
) {
compatibleWith("com.nousguide.android.orftvthek")
apply {
isDeviceRootedFingeprint.method.returnEarly(false)
isDeviceRootedMethod.returnEarly(false)
}
}
}