mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 01:01:56 +01:00
fix(Google Photos - GmsCore support): Fix by checking first if a method exists before trying to patch it
This commit is contained in:
parent
ebbcac74fd
commit
acf38cafae
1 changed files with 9 additions and 3 deletions
|
@ -56,7 +56,7 @@ abstract class BaseGmsCoreSupportPatch(
|
||||||
) : BytecodePatch(
|
) : BytecodePatch(
|
||||||
name = "GmsCore support",
|
name = "GmsCore support",
|
||||||
description = "Allows patched Google apps to run without root and under a different package name " +
|
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(
|
dependencies = setOf(
|
||||||
ChangePackageNamePatch::class,
|
ChangePackageNamePatch::class,
|
||||||
gmsCoreSupportResourcePatch::class,
|
gmsCoreSupportResourcePatch::class,
|
||||||
|
@ -100,7 +100,13 @@ abstract class BaseGmsCoreSupportPatch(
|
||||||
primeMethodFingerprint?.let { transformPrimeMethod(packageName) }
|
primeMethodFingerprint?.let { transformPrimeMethod(packageName) }
|
||||||
|
|
||||||
// Return these methods early to prevent the app from crashing.
|
// 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) {
|
if (GooglePlayUtilityFingerprint.result != null) {
|
||||||
GooglePlayUtilityFingerprint.returnEarly()
|
GooglePlayUtilityFingerprint.returnEarly()
|
||||||
}
|
}
|
||||||
|
@ -109,7 +115,7 @@ abstract class BaseGmsCoreSupportPatch(
|
||||||
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
|
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
0,
|
0,
|
||||||
"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",
|
||||||
) ?: throw mainActivityOnCreateFingerprint.exception
|
) ?: throw mainActivityOnCreateFingerprint.exception
|
||||||
|
|
||||||
// Change the vendor of GmsCore in ReVanced Integrations.
|
// Change the vendor of GmsCore in ReVanced Integrations.
|
||||||
|
|
Loading…
Reference in a new issue