mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-08 02:24:35 +02:00
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:
parent
9982245ff2
commit
787dd5990e
@ -9,7 +9,9 @@ import app.revanced.patcher.fingerprint.MethodFingerprintResult
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
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.SSLGuardFingerprint
|
||||
import app.revanced.patches.shared.ads.fingerprints.VideoAdsFingerprint
|
||||
import app.revanced.patches.shared.integrations.Constants.PATCHES_PATH
|
||||
import app.revanced.util.getReference
|
||||
@ -29,7 +31,9 @@ abstract class BaseAdsPatch(
|
||||
) : BytecodePatch(
|
||||
setOf(
|
||||
MusicAdsFingerprint,
|
||||
VideoAdsFingerprint
|
||||
VideoAdsFingerprint,
|
||||
AdvertisingIdFingerprint,
|
||||
SSLGuardFingerprint,
|
||||
)
|
||||
) {
|
||||
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 {
|
||||
val insertIndex = it.scanResult.stringsScanResult!!.matches.first().index
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
insertIndex, """
|
||||
invoke-static {}, $classDescriptor->$methodDescriptor()Z
|
||||
move-result v0
|
||||
if-nez v0, :show_ads
|
||||
move-result v$insertRegister
|
||||
if-nez v$insertRegister, :enable_id
|
||||
return-void
|
||||
""", ExternalLabel("show_ads", getInstruction(0))
|
||||
""", ExternalLabel("enable_id", getInstruction(insertIndex))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
)
|
@ -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"),
|
||||
)
|
@ -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_MUSIC
|
||||
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.GmsCoreSupportFingerprint
|
||||
import app.revanced.patches.shared.gms.fingerprints.GmsServiceBrokerFingerprint
|
||||
import app.revanced.patches.shared.gms.fingerprints.GooglePlayUtilityFingerprint
|
||||
import app.revanced.patches.shared.gms.fingerprints.PrimesApiFingerprint
|
||||
import app.revanced.patches.shared.gms.fingerprints.PrimesBackgroundInitializationFingerprint
|
||||
@ -71,8 +72,9 @@ abstract class BaseGmsCoreSupportPatch(
|
||||
fingerprints = setOf(
|
||||
// Google Play Services.
|
||||
CastContextFetchFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
GmsCoreSupportFingerprint,
|
||||
GmsServiceBrokerFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
PrimesApiFingerprint,
|
||||
PrimesBackgroundInitializationFingerprint,
|
||||
@ -93,7 +95,6 @@ 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"
|
||||
|
||||
@ -132,7 +133,6 @@ abstract class BaseGmsCoreSupportPatch(
|
||||
override fun execute(context: BytecodeContext) {
|
||||
gmsCoreVendor = getStringPatchOption("GmsCoreVendorGroupId")
|
||||
checkGmsCore = getBooleanPatchOption("CheckGmsCore")
|
||||
disableGmsServiceBroker = getBooleanPatchOption("DisableGmsServiceBroker")
|
||||
packageNameYouTube = getStringPatchOption("PackageNameYouTube")
|
||||
packageNameYouTubeMusic = getStringPatchOption("PackageNameYouTubeMusic")
|
||||
|
||||
@ -156,12 +156,11 @@ abstract class BaseGmsCoreSupportPatch(
|
||||
// Return these methods early to prevent the app from crashing.
|
||||
val returnEarly = mutableListOf(
|
||||
CastContextFetchFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
ServiceCheckFingerprint
|
||||
)
|
||||
if (disableGmsServiceBroker) {
|
||||
returnEarly += GmsServiceBrokerFingerprint
|
||||
}
|
||||
returnEarly.returnEarly()
|
||||
|
||||
transformPrimeMethod()
|
||||
@ -431,11 +430,9 @@ abstract class BaseGmsCoreSupportPatch(
|
||||
"com.google.android.gms.feedback.internal.IFeedbackService",
|
||||
|
||||
// cast
|
||||
"com.google.android.gms.cast.firstparty.START",
|
||||
"com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE",
|
||||
|
||||
// chimera
|
||||
"com.google.android.gms.chimera",
|
||||
|
||||
// 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.INDEX_SERVICE",
|
||||
"com.google.android.gms.mdm.services.START",
|
||||
"com.google.android.gms.clearcut.service.START",
|
||||
|
||||
// potoken
|
||||
"com.google.android.gms.potokens.service.START",
|
||||
|
@ -52,18 +52,6 @@ abstract class BaseGmsCoreSupportResourcePatch(
|
||||
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,
|
||||
|
@ -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")
|
||||
)
|
@ -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: ")
|
||||
)
|
@ -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")
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user