diff --git a/patches/api/patches.api b/patches/api/patches.api index 31d0d5d72..fdb8c1cf2 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -268,6 +268,10 @@ public final class app/revanced/patches/iconpackstudio/misc/pro/UnlockProPatchKt public static final fun getUnlockProPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } +public final class app/revanced/patches/idaustria/detection/deviceintegrity/RemoveDeviceIntegrityChecksPatchKt { + public static final fun getRemoveDeviceIntegrityChecksPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/idaustria/detection/root/RootDetectionPatchKt { public static final fun getRootDetectionPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/Fingerprints.kt new file mode 100644 index 000000000..c8ebd86df --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/Fingerprints.kt @@ -0,0 +1,22 @@ +package app.revanced.patches.idaustria.detection.deviceintegrity + +import app.revanced.patcher.fingerprint +import com.android.tools.smali.dexlib2.AccessFlags + +internal val isDeviceBootloaderOpenFingerprint = fingerprint { + accessFlags(AccessFlags.PUBLIC) + returns("Ljava/lang/Object;") + custom { method, classDef -> + method.name == "isDeviceBootloaderOpen" && + classDef.endsWith("/DeviceIntegrityCheckProviderImpl;") + } +} + +internal val isDeviceRootedFingerprint = fingerprint { + accessFlags(AccessFlags.PUBLIC) + returns("Z") + custom { method, classDef -> + method.name == "isDeviceRooted" && + classDef.endsWith("/DeviceIntegrityCheckProviderImpl;") + } +} diff --git a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/RemoveDeviceIntegrityChecksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/RemoveDeviceIntegrityChecksPatch.kt new file mode 100644 index 000000000..3c72e69f3 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/RemoveDeviceIntegrityChecksPatch.kt @@ -0,0 +1,30 @@ +package app.revanced.patches.idaustria.detection.deviceintegrity + +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions +import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly + + +@Suppress("unused") +val removeDeviceIntegrityChecksPatch = bytecodePatch( + name = "Remove device integrity checks", + description = "Removes the check for root permissions and unlocked bootloader.", +) { + compatibleWith("at.gv.oe.app") + + execute { + isDeviceRootedFingerprint.method.returnEarly(false) + + isDeviceBootloaderOpenFingerprint.method.apply { + addInstructions( + 0, + """ + const/4 v0, 0x0 + invoke-static { v0 }, Lkotlin/coroutines/jvm/internal/Boxing;->boxBoolean(Z)Ljava/lang/Boolean; + move-result-object v0 + return-object v0 + """ + ) + } + } +} diff --git a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/Fingerprints.kt deleted file mode 100644 index 38f814f6d..000000000 --- a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/Fingerprints.kt +++ /dev/null @@ -1,31 +0,0 @@ -package app.revanced.patches.idaustria.detection.root - -import app.revanced.patcher.fingerprint -import com.android.tools.smali.dexlib2.AccessFlags - -internal val attestationSupportedCheckFingerprint = fingerprint { - accessFlags(AccessFlags.PUBLIC) - returns("V") - custom { method, classDef -> - method.name == "attestationSupportCheck" && - classDef.endsWith("/DeviceIntegrityCheck;") - } -} - -internal val bootloaderCheckFingerprint = fingerprint { - accessFlags(AccessFlags.PUBLIC) - returns("Z") - custom { method, classDef -> - method.name == "bootloaderCheck" && - classDef.endsWith("/DeviceIntegrityCheck;") - } -} - -internal val rootCheckFingerprint = fingerprint { - accessFlags(AccessFlags.PUBLIC) - returns("V") - custom { method, classDef -> - method.name == "rootCheck" && - classDef.endsWith("/DeviceIntegrityCheck;") - } -} diff --git a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt index 07874bac7..cfb7e8d68 100644 --- a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt @@ -1,22 +1,10 @@ package app.revanced.patches.idaustria.detection.root import app.revanced.patcher.patch.bytecodePatch -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 +import app.revanced.patches.idaustria.detection.deviceintegrity.removeDeviceIntegrityChecksPatch +@Deprecated("Patch was superseded", ReplaceWith("removeDeviceIntegrityChecksPatch")) @Suppress("unused") -val rootDetectionPatch = bytecodePatch( - name = PATCH_NAME_REMOVE_ROOT_DETECTION, - description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION -) { - compatibleWith("at.gv.oe.app") - - execute { - setOf( - attestationSupportedCheckFingerprint, - bootloaderCheckFingerprint, - rootCheckFingerprint, - ).forEach { it.method.returnEarly(true) } - } +val rootDetectionPatch = bytecodePatch { + dependsOn(removeDeviceIntegrityChecksPatch) }