Skip to content

Commit

Permalink
fix(Google Photos - GmsCore support): Fix by checking first if a meth…
Browse files Browse the repository at this point in the history
…od exists before trying to patch it
  • Loading branch information
oSumAtrIX committed Aug 6, 2024
1 parent ebbcac7 commit acf38ca
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ abstract class BaseGmsCoreSupportPatch(
) : BytecodePatch(
name = "GmsCore support",
description = "Allows patched Google apps to run without root and under a different package name " +
"by using GmsCore instead of Google Play Services.",
"by using GmsCore instead of Google Play Services.",
dependencies = setOf(
ChangePackageNamePatch::class,
gmsCoreSupportResourcePatch::class,
Expand Down Expand Up @@ -100,7 +100,13 @@ abstract class BaseGmsCoreSupportPatch(
primeMethodFingerprint?.let { transformPrimeMethod(packageName) }

// Return these methods early to prevent the app from crashing.
(earlyReturnFingerprints + ServiceCheckFingerprint + CastDynamiteModuleFingerprint).returnEarly()
earlyReturnFingerprints.returnEarly()
ServiceCheckFingerprint.returnEarly()
// Not all apps have CastDynamiteModule, so we need to check if it's present.
if (CastDynamiteModuleFingerprint.result != null) {
CastDynamiteModuleFingerprint.returnEarly()
}
// Google Play Utility is not present in all apps, so we need to check if it's present.
if (GooglePlayUtilityFingerprint.result != null) {
GooglePlayUtilityFingerprint.returnEarly()
}
Expand All @@ -109,7 +115,7 @@ abstract class BaseGmsCoreSupportPatch(
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
0,
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
"checkGmsCore(Landroid/app/Activity;)V",
"checkGmsCore(Landroid/app/Activity;)V",
) ?: throw mainActivityOnCreateFingerprint.exception

// Change the vendor of GmsCore in ReVanced Integrations.
Expand Down

0 comments on commit acf38ca

Please sign in to comment.