add certificate-spoof patch: fix Android Auto connection issue with MicroG builds

This commit is contained in:
inotia00 2023-03-28 21:46:55 +09:00
parent e41fc03e64
commit 2be738b75c
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,9 @@
package app.revanced.patches.music.misc.androidauto.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object CertificateCheckFingerprint : MethodFingerprint(
returnType = "Z",
parameters = listOf("L"),
strings = listOf("X509")
)

View File

@ -0,0 +1,35 @@
package app.revanced.patches.music.misc.androidauto.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.misc.androidauto.fingerprints.CertificateCheckFingerprint
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
@Patch
@Name("certificate-spoof")
@Description("Spoofs the YouTube Music certificate for Android Auto.")
@YouTubeMusicCompatibility
@Version("0.0.1")
class AndroidAutoCertificatePatch : BytecodePatch(
listOf(CertificateCheckFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
CertificateCheckFingerprint.result?.mutableMethod?.addInstructions(
0, """
const/4 v0, 0x1
return v0
"""
) ?: return CertificateCheckFingerprint.toErrorResult()
return PatchResultSuccess()
}
}