mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-23 02:31:03 +00:00
fix(YouTube - GmsCore Support): Fix patch exception by using correct patch offset (#3543)
This commit is contained in:
committed by
GitHub
parent
b84e6afebd
commit
3d0d94b6c8
@@ -18,7 +18,7 @@ import app.revanced.patches.shared.misc.gms.fingerprints.GooglePlayUtilityFinger
|
|||||||
import app.revanced.patches.shared.misc.gms.fingerprints.ServiceCheckFingerprint
|
import app.revanced.patches.shared.misc.gms.fingerprints.ServiceCheckFingerprint
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import app.revanced.util.returnEarly
|
import app.revanced.util.returnEarly
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
||||||
@@ -115,15 +115,16 @@ abstract class BaseGmsCoreSupportPatch(
|
|||||||
|
|
||||||
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
|
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
|
||||||
mainActivityOnCreateFingerprint.result?.mutableMethod?.apply {
|
mainActivityOnCreateFingerprint.result?.mutableMethod?.apply {
|
||||||
val setContextIndex = indexOfFirstInstructionOrThrow {
|
// Temporary fix for Google photos integration.
|
||||||
val reference = getReference<MethodReference>() ?: return@indexOfFirstInstructionOrThrow false
|
var setContextIndex = indexOfFirstInstruction {
|
||||||
|
val reference = getReference<MethodReference>() ?: return@indexOfFirstInstruction false
|
||||||
|
|
||||||
reference.toString() == "Lapp/revanced/integrations/shared/Utils;->setContext(Landroid/content/Context;)V"
|
reference.toString() == "Lapp/revanced/integrations/shared/Utils;->setContext(Landroid/content/Context;)V"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add after setContext call, because this patch needs the context.
|
// Add after setContext call, because this patch needs the context.
|
||||||
addInstructions(
|
addInstructions(
|
||||||
setContextIndex + 1,
|
if (setContextIndex < 0) 0 else setContextIndex + 1,
|
||||||
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
|
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
|
||||||
"checkGmsCore(Landroid/app/Activity;)V",
|
"checkGmsCore(Landroid/app/Activity;)V",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user