generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Digitales Amt): Bump compatibility to
3.0.2
(#3217)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
- Loading branch information
Showing
7 changed files
with
73 additions
and
37 deletions.
There are no files selected for viewing
17 changes: 11 additions & 6 deletions
17
src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
package app.revanced.patches.idaustria.detection.root | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.idaustria.detection.root.fingerprints.RootDetectionFingerprint | ||
import app.revanced.patches.idaustria.detection.root.fingerprints.AttestationSupportedCheckFingerprint | ||
import app.revanced.patches.idaustria.detection.root.fingerprints.BootloaderCheckFingerprint | ||
import app.revanced.patches.idaustria.detection.root.fingerprints.RootCheckFingerprint | ||
import app.revanced.util.Utils.returnEarly | ||
|
||
@Patch( | ||
name = "Remove root detection", | ||
description = "Removes the check for root permissions and unlocked bootloader.", | ||
compatiblePackages = [CompatiblePackage("at.gv.oe.app", ["2.7.1"])] | ||
compatiblePackages = [CompatiblePackage("at.gv.oe.app", ["3.0.2"])] | ||
) | ||
@Suppress("unused") | ||
object RootDetectionPatch : BytecodePatch( | ||
setOf(RootDetectionFingerprint) | ||
setOf(AttestationSupportedCheckFingerprint, BootloaderCheckFingerprint, RootCheckFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) = | ||
RootDetectionFingerprint.result!!.mutableMethod.addInstruction(0, "return-void") | ||
override fun execute(context: BytecodeContext) = listOf( | ||
AttestationSupportedCheckFingerprint, | ||
BootloaderCheckFingerprint, | ||
RootCheckFingerprint | ||
).returnEarly(true) | ||
} |
13 changes: 13 additions & 0 deletions
13
...ced/patches/idaustria/detection/root/fingerprints/AttestationSupportedCheckFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.idaustria.detection.root.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object AttestationSupportedCheckFingerprint : MethodFingerprint( | ||
"V", | ||
accessFlags = AccessFlags.PUBLIC.value, | ||
customFingerprint = { methodDef, _ -> | ||
methodDef.name == "attestationSupportCheck" && | ||
methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") | ||
} | ||
) |
13 changes: 13 additions & 0 deletions
13
.../app/revanced/patches/idaustria/detection/root/fingerprints/BootloaderCheckFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.idaustria.detection.root.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object BootloaderCheckFingerprint : MethodFingerprint( | ||
"Z", | ||
accessFlags = AccessFlags.PUBLIC.value, | ||
customFingerprint = { methodDef, _ -> | ||
methodDef.name == "bootloaderCheck" && | ||
methodDef.definingClass.endsWith("/DeviceIntegrityCheck;") | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package app.revanced.util | ||
|
||
import app.revanced.extensions.exception | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
|
||
object Utils { | ||
/** | ||
* Return the resolved methods of [MethodFingerprint]s early. | ||
*/ | ||
fun List<MethodFingerprint>.returnEarly(bool: Boolean = false) { | ||
val const = if (bool) "0x1" else "0x0" | ||
this.forEach { fingerprint -> | ||
fingerprint.result?.let { result -> | ||
val stringInstructions = when (result.method.returnType.first()) { | ||
'L' -> """ | ||
const/4 v0, $const | ||
return-object v0 | ||
""" | ||
'V' -> "return-void" | ||
'I', 'Z' -> """ | ||
const/4 v0, $const | ||
return v0 | ||
""" | ||
else -> throw Exception("This case should never happen.") | ||
} | ||
|
||
result.mutableMethod.addInstructions(0, stringInstructions) | ||
} ?: throw fingerprint.exception | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters