diff --git a/src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportPatch.kt index c3adcd3b29..f0cf5fd317 100644 --- a/src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportPatch.kt @@ -93,6 +93,7 @@ abstract class BaseGmsCoreSupportPatch( var gmsCoreVendor = "app.revanced" var checkGmsCore = true + var disableGmsServiceBroker = false var packageNameYouTube = "com.google.android.youtube" var packageNameYouTubeMusic = "com.google.android.apps.youtube.music" @@ -131,6 +132,7 @@ abstract class BaseGmsCoreSupportPatch( override fun execute(context: BytecodeContext) { gmsCoreVendor = getStringPatchOption("GmsCoreVendorGroupId") checkGmsCore = getBooleanPatchOption("CheckGmsCore") + disableGmsServiceBroker = getBooleanPatchOption("DisableGmsServiceBroker") packageNameYouTube = getStringPatchOption("PackageNameYouTube") packageNameYouTubeMusic = getStringPatchOption("PackageNameYouTubeMusic") @@ -152,12 +154,15 @@ abstract class BaseGmsCoreSupportPatch( } // Return these methods early to prevent the app from crashing. - listOf( + val returnEarly = mutableListOf( CastContextFetchFingerprint, - GmsServiceBrokerFingerprint, GooglePlayUtilityFingerprint, ServiceCheckFingerprint - ).returnEarly() + ) + if (disableGmsServiceBroker) { + returnEarly += GmsServiceBrokerFingerprint + } + returnEarly.returnEarly() transformPrimeMethod() diff --git a/src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportResourcePatch.kt b/src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportResourcePatch.kt index 3ebd6a7b10..87773c31d0 100644 --- a/src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportResourcePatch.kt @@ -51,6 +51,19 @@ abstract class BaseGmsCoreSupportResourcePatch( """.trimIndentMultiline(), required = true, ) + + private val DisableGmsServiceBroker by booleanPatchOption( + key = "DisableGmsServiceBroker", + default = false, + title = "Disable GmsService Broker", + description = """ + Disabling GmsServiceBroker will somewhat improve crashes caused by unimplemented GmsCore services. + + For YouTube, the 'Spoof streaming data' setting is required. + """.trimIndentMultiline(), + required = true, + ) + internal val PackageNameYouTube = stringPatchOption( key = "PackageNameYouTube", default = DEFAULT_PACKAGE_NAME_YOUTUBE,