fix: remove chimera reference and disable advertising id (#97)

* ci: workflow to ping Discord users when patches are released (#72)

* init: Workflow to notify discord users of releases

* Rename workflow

* chore (Background playback): Shorten description

* Revert "chore (Background playback): Shorten description"

This reverts commit 10661b870f0c9c670c5d522f9b2ca7cc82d32772.

* Change message contents

* Remove chimera ref

* feat: remove patch option `DisableGmsServiceBroker`

* feat: revert `Cast service v2 disabler`

* feat(Hide ads): disable advertising id

---------

Co-authored-by: KobeW50 <84587632+KobeW50@users.noreply.github.com>
Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
This commit is contained in:
0xrxL 2024-12-04 04:01:38 +01:00 committed by GitHub
parent 9982245ff2
commit 787dd5990e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 76 additions and 37 deletions

View File

@ -9,7 +9,9 @@ import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.ads.fingerprints.AdvertisingIdFingerprint
import app.revanced.patches.shared.ads.fingerprints.MusicAdsFingerprint import app.revanced.patches.shared.ads.fingerprints.MusicAdsFingerprint
import app.revanced.patches.shared.ads.fingerprints.SSLGuardFingerprint
import app.revanced.patches.shared.ads.fingerprints.VideoAdsFingerprint import app.revanced.patches.shared.ads.fingerprints.VideoAdsFingerprint
import app.revanced.patches.shared.integrations.Constants.PATCHES_PATH import app.revanced.patches.shared.integrations.Constants.PATCHES_PATH
import app.revanced.util.getReference import app.revanced.util.getReference
@ -29,7 +31,9 @@ abstract class BaseAdsPatch(
) : BytecodePatch( ) : BytecodePatch(
setOf( setOf(
MusicAdsFingerprint, MusicAdsFingerprint,
VideoAdsFingerprint VideoAdsFingerprint,
AdvertisingIdFingerprint,
SSLGuardFingerprint,
) )
) { ) {
private companion object { private companion object {
@ -58,15 +62,36 @@ abstract class BaseAdsPatch(
} }
} }
VideoAdsFingerprint.resultOrThrow().let { setOf(
VideoAdsFingerprint,
SSLGuardFingerprint,
).forEach { fingerprint ->
fingerprint.resultOrThrow().let {
it.mutableMethod.apply {
addInstructionsWithLabels(
0, """
invoke-static {}, $classDescriptor->$methodDescriptor()Z
move-result v0
if-nez v0, :show_ads
return-void
""", ExternalLabel("show_ads", getInstruction(0))
)
}
}
}
AdvertisingIdFingerprint.resultOrThrow().let {
it.mutableMethod.apply { it.mutableMethod.apply {
val insertIndex = it.scanResult.stringsScanResult!!.matches.first().index
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
addInstructionsWithLabels( addInstructionsWithLabels(
0, """ insertIndex, """
invoke-static {}, $classDescriptor->$methodDescriptor()Z invoke-static {}, $classDescriptor->$methodDescriptor()Z
move-result v0 move-result v$insertRegister
if-nez v0, :show_ads if-nez v$insertRegister, :enable_id
return-void return-void
""", ExternalLabel("show_ads", getInstruction(0)) """, ExternalLabel("enable_id", getInstruction(insertIndex))
) )
} }
} }

View File

@ -0,0 +1,13 @@
package app.revanced.patches.shared.ads.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.util.MethodUtil
internal object AdvertisingIdFingerprint : MethodFingerprint(
returnType = "V",
strings = listOf("a."),
customFingerprint = { methodDef, classDef ->
MethodUtil.isConstructor(methodDef) &&
classDef.fields.find { it.type == "Lcom/google/android/libraries/youtube/innertube/model/ads/InstreamAd;" } != null
}
)

View File

@ -0,0 +1,11 @@
package app.revanced.patches.shared.ads.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
internal object SSLGuardFingerprint : MethodFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
strings = listOf("Cannot initialize SslGuardSocketFactory will null"),
)

View File

@ -15,9 +15,10 @@ import app.revanced.patches.shared.gms.BaseGmsCoreSupportPatch.Constants.PERMISS
import app.revanced.patches.shared.gms.BaseGmsCoreSupportResourcePatch.Companion.ORIGINAL_PACKAGE_NAME_YOUTUBE import app.revanced.patches.shared.gms.BaseGmsCoreSupportResourcePatch.Companion.ORIGINAL_PACKAGE_NAME_YOUTUBE
import app.revanced.patches.shared.gms.BaseGmsCoreSupportResourcePatch.Companion.ORIGINAL_PACKAGE_NAME_YOUTUBE_MUSIC import app.revanced.patches.shared.gms.BaseGmsCoreSupportResourcePatch.Companion.ORIGINAL_PACKAGE_NAME_YOUTUBE_MUSIC
import app.revanced.patches.shared.gms.fingerprints.CastContextFetchFingerprint import app.revanced.patches.shared.gms.fingerprints.CastContextFetchFingerprint
import app.revanced.patches.shared.gms.fingerprints.CastDynamiteModuleFingerprint
import app.revanced.patches.shared.gms.fingerprints.CastDynamiteModuleV2Fingerprint
import app.revanced.patches.shared.gms.fingerprints.CertificateFingerprint import app.revanced.patches.shared.gms.fingerprints.CertificateFingerprint
import app.revanced.patches.shared.gms.fingerprints.GmsCoreSupportFingerprint import app.revanced.patches.shared.gms.fingerprints.GmsCoreSupportFingerprint
import app.revanced.patches.shared.gms.fingerprints.GmsServiceBrokerFingerprint
import app.revanced.patches.shared.gms.fingerprints.GooglePlayUtilityFingerprint import app.revanced.patches.shared.gms.fingerprints.GooglePlayUtilityFingerprint
import app.revanced.patches.shared.gms.fingerprints.PrimesApiFingerprint import app.revanced.patches.shared.gms.fingerprints.PrimesApiFingerprint
import app.revanced.patches.shared.gms.fingerprints.PrimesBackgroundInitializationFingerprint import app.revanced.patches.shared.gms.fingerprints.PrimesBackgroundInitializationFingerprint
@ -71,8 +72,9 @@ abstract class BaseGmsCoreSupportPatch(
fingerprints = setOf( fingerprints = setOf(
// Google Play Services. // Google Play Services.
CastContextFetchFingerprint, CastContextFetchFingerprint,
CastDynamiteModuleFingerprint,
CastDynamiteModuleV2Fingerprint,
GmsCoreSupportFingerprint, GmsCoreSupportFingerprint,
GmsServiceBrokerFingerprint,
GooglePlayUtilityFingerprint, GooglePlayUtilityFingerprint,
PrimesApiFingerprint, PrimesApiFingerprint,
PrimesBackgroundInitializationFingerprint, PrimesBackgroundInitializationFingerprint,
@ -93,7 +95,6 @@ abstract class BaseGmsCoreSupportPatch(
var gmsCoreVendor = "app.revanced" var gmsCoreVendor = "app.revanced"
var checkGmsCore = true var checkGmsCore = true
var disableGmsServiceBroker = false
var packageNameYouTube = "com.google.android.youtube" var packageNameYouTube = "com.google.android.youtube"
var packageNameYouTubeMusic = "com.google.android.apps.youtube.music" var packageNameYouTubeMusic = "com.google.android.apps.youtube.music"
@ -132,7 +133,6 @@ abstract class BaseGmsCoreSupportPatch(
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
gmsCoreVendor = getStringPatchOption("GmsCoreVendorGroupId") gmsCoreVendor = getStringPatchOption("GmsCoreVendorGroupId")
checkGmsCore = getBooleanPatchOption("CheckGmsCore") checkGmsCore = getBooleanPatchOption("CheckGmsCore")
disableGmsServiceBroker = getBooleanPatchOption("DisableGmsServiceBroker")
packageNameYouTube = getStringPatchOption("PackageNameYouTube") packageNameYouTube = getStringPatchOption("PackageNameYouTube")
packageNameYouTubeMusic = getStringPatchOption("PackageNameYouTubeMusic") packageNameYouTubeMusic = getStringPatchOption("PackageNameYouTubeMusic")
@ -156,12 +156,11 @@ abstract class BaseGmsCoreSupportPatch(
// Return these methods early to prevent the app from crashing. // Return these methods early to prevent the app from crashing.
val returnEarly = mutableListOf( val returnEarly = mutableListOf(
CastContextFetchFingerprint, CastContextFetchFingerprint,
CastDynamiteModuleFingerprint,
CastDynamiteModuleV2Fingerprint,
GooglePlayUtilityFingerprint, GooglePlayUtilityFingerprint,
ServiceCheckFingerprint ServiceCheckFingerprint
) )
if (disableGmsServiceBroker) {
returnEarly += GmsServiceBrokerFingerprint
}
returnEarly.returnEarly() returnEarly.returnEarly()
transformPrimeMethod() transformPrimeMethod()
@ -431,11 +430,9 @@ abstract class BaseGmsCoreSupportPatch(
"com.google.android.gms.feedback.internal.IFeedbackService", "com.google.android.gms.feedback.internal.IFeedbackService",
// cast // cast
"com.google.android.gms.cast.firstparty.START",
"com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE", "com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE",
// chimera
"com.google.android.gms.chimera",
// fonts // fonts
"com.google.android.gms.fonts", "com.google.android.gms.fonts",
@ -455,7 +452,6 @@ abstract class BaseGmsCoreSupportPatch(
"com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE", "com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE",
"com.google.android.gms.icing.INDEX_SERVICE", "com.google.android.gms.icing.INDEX_SERVICE",
"com.google.android.gms.mdm.services.START", "com.google.android.gms.mdm.services.START",
"com.google.android.gms.clearcut.service.START",
// potoken // potoken
"com.google.android.gms.potokens.service.START", "com.google.android.gms.potokens.service.START",

View File

@ -52,18 +52,6 @@ abstract class BaseGmsCoreSupportResourcePatch(
required = true, 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( internal val PackageNameYouTube = stringPatchOption(
key = "PackageNameYouTube", key = "PackageNameYouTube",
default = DEFAULT_PACKAGE_NAME_YOUTUBE, default = DEFAULT_PACKAGE_NAME_YOUTUBE,

View File

@ -0,0 +1,7 @@
package app.revanced.patches.shared.gms.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
internal object CastDynamiteModuleFingerprint : MethodFingerprint(
strings = listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl")
)

View File

@ -0,0 +1,7 @@
package app.revanced.patches.shared.gms.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
internal object CastDynamiteModuleV2Fingerprint : MethodFingerprint(
strings = listOf("Failed to load module via V2: ")
)

View File

@ -1,8 +0,0 @@
package app.revanced.patches.shared.gms.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
internal object GmsServiceBrokerFingerprint : MethodFingerprint(
returnType = "V",
strings = listOf("mServiceBroker is null, client disconnected")
)