Skip to content

Commit

Permalink
feat(YouTube/YT - GmsCore support): add patch option `Disable GmsServ…
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Oct 20, 2024
1 parent cae2f6c commit 19a8677
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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")

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 19a8677

Please sign in to comment.