feat(YouTube/YT - GmsCore support): add patch option Disable GmsService Broker https://github.com/inotia00/ReVanced_Extended/issues/2442#issuecomment-2424694043

This commit is contained in:
inotia00 2024-10-20 20:53:52 +09:00
parent cae2f6cab6
commit 19a8677c73
2 changed files with 21 additions and 3 deletions

View File

@ -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()

View File

@ -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,