Skip to content

Commit 787dd59

Browse files
0xrxLKobeW50inotia00
authored
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 10661b8. * 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 <[email protected]> Co-authored-by: inotia00 <[email protected]>
1 parent 9982245 commit 787dd59

8 files changed

+76
-37
lines changed

src/main/kotlin/app/revanced/patches/shared/ads/BaseAdsPatch.kt

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import app.revanced.patcher.fingerprint.MethodFingerprintResult
99
import app.revanced.patcher.patch.BytecodePatch
1010
import app.revanced.patcher.patch.PatchException
1111
import app.revanced.patcher.util.smali.ExternalLabel
12+
import app.revanced.patches.shared.ads.fingerprints.AdvertisingIdFingerprint
1213
import app.revanced.patches.shared.ads.fingerprints.MusicAdsFingerprint
14+
import app.revanced.patches.shared.ads.fingerprints.SSLGuardFingerprint
1315
import app.revanced.patches.shared.ads.fingerprints.VideoAdsFingerprint
1416
import app.revanced.patches.shared.integrations.Constants.PATCHES_PATH
1517
import app.revanced.util.getReference
@@ -29,7 +31,9 @@ abstract class BaseAdsPatch(
2931
) : BytecodePatch(
3032
setOf(
3133
MusicAdsFingerprint,
32-
VideoAdsFingerprint
34+
VideoAdsFingerprint,
35+
AdvertisingIdFingerprint,
36+
SSLGuardFingerprint,
3337
)
3438
) {
3539
private companion object {
@@ -58,15 +62,36 @@ abstract class BaseAdsPatch(
5862
}
5963
}
6064

61-
VideoAdsFingerprint.resultOrThrow().let {
65+
setOf(
66+
VideoAdsFingerprint,
67+
SSLGuardFingerprint,
68+
).forEach { fingerprint ->
69+
fingerprint.resultOrThrow().let {
70+
it.mutableMethod.apply {
71+
addInstructionsWithLabels(
72+
0, """
73+
invoke-static {}, $classDescriptor->$methodDescriptor()Z
74+
move-result v0
75+
if-nez v0, :show_ads
76+
return-void
77+
""", ExternalLabel("show_ads", getInstruction(0))
78+
)
79+
}
80+
}
81+
}
82+
83+
AdvertisingIdFingerprint.resultOrThrow().let {
6284
it.mutableMethod.apply {
85+
val insertIndex = it.scanResult.stringsScanResult!!.matches.first().index
86+
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
87+
6388
addInstructionsWithLabels(
64-
0, """
89+
insertIndex, """
6590
invoke-static {}, $classDescriptor->$methodDescriptor()Z
66-
move-result v0
67-
if-nez v0, :show_ads
91+
move-result v$insertRegister
92+
if-nez v$insertRegister, :enable_id
6893
return-void
69-
""", ExternalLabel("show_ads", getInstruction(0))
94+
""", ExternalLabel("enable_id", getInstruction(insertIndex))
7095
)
7196
}
7297
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package app.revanced.patches.shared.ads.fingerprints
2+
3+
import app.revanced.patcher.fingerprint.MethodFingerprint
4+
import com.android.tools.smali.dexlib2.util.MethodUtil
5+
6+
internal object AdvertisingIdFingerprint : MethodFingerprint(
7+
returnType = "V",
8+
strings = listOf("a."),
9+
customFingerprint = { methodDef, classDef ->
10+
MethodUtil.isConstructor(methodDef) &&
11+
classDef.fields.find { it.type == "Lcom/google/android/libraries/youtube/innertube/model/ads/InstreamAd;" } != null
12+
}
13+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package app.revanced.patches.shared.ads.fingerprints
2+
3+
import app.revanced.patcher.extensions.or
4+
import app.revanced.patcher.fingerprint.MethodFingerprint
5+
import com.android.tools.smali.dexlib2.AccessFlags
6+
7+
internal object SSLGuardFingerprint : MethodFingerprint(
8+
returnType = "V",
9+
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
10+
strings = listOf("Cannot initialize SslGuardSocketFactory will null"),
11+
)

src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportPatch.kt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import app.revanced.patches.shared.gms.BaseGmsCoreSupportPatch.Constants.PERMISS
1515
import app.revanced.patches.shared.gms.BaseGmsCoreSupportResourcePatch.Companion.ORIGINAL_PACKAGE_NAME_YOUTUBE
1616
import app.revanced.patches.shared.gms.BaseGmsCoreSupportResourcePatch.Companion.ORIGINAL_PACKAGE_NAME_YOUTUBE_MUSIC
1717
import app.revanced.patches.shared.gms.fingerprints.CastContextFetchFingerprint
18+
import app.revanced.patches.shared.gms.fingerprints.CastDynamiteModuleFingerprint
19+
import app.revanced.patches.shared.gms.fingerprints.CastDynamiteModuleV2Fingerprint
1820
import app.revanced.patches.shared.gms.fingerprints.CertificateFingerprint
1921
import app.revanced.patches.shared.gms.fingerprints.GmsCoreSupportFingerprint
20-
import app.revanced.patches.shared.gms.fingerprints.GmsServiceBrokerFingerprint
2122
import app.revanced.patches.shared.gms.fingerprints.GooglePlayUtilityFingerprint
2223
import app.revanced.patches.shared.gms.fingerprints.PrimesApiFingerprint
2324
import app.revanced.patches.shared.gms.fingerprints.PrimesBackgroundInitializationFingerprint
@@ -71,8 +72,9 @@ abstract class BaseGmsCoreSupportPatch(
7172
fingerprints = setOf(
7273
// Google Play Services.
7374
CastContextFetchFingerprint,
75+
CastDynamiteModuleFingerprint,
76+
CastDynamiteModuleV2Fingerprint,
7477
GmsCoreSupportFingerprint,
75-
GmsServiceBrokerFingerprint,
7678
GooglePlayUtilityFingerprint,
7779
PrimesApiFingerprint,
7880
PrimesBackgroundInitializationFingerprint,
@@ -93,7 +95,6 @@ abstract class BaseGmsCoreSupportPatch(
9395

9496
var gmsCoreVendor = "app.revanced"
9597
var checkGmsCore = true
96-
var disableGmsServiceBroker = false
9798
var packageNameYouTube = "com.google.android.youtube"
9899
var packageNameYouTubeMusic = "com.google.android.apps.youtube.music"
99100

@@ -132,7 +133,6 @@ abstract class BaseGmsCoreSupportPatch(
132133
override fun execute(context: BytecodeContext) {
133134
gmsCoreVendor = getStringPatchOption("GmsCoreVendorGroupId")
134135
checkGmsCore = getBooleanPatchOption("CheckGmsCore")
135-
disableGmsServiceBroker = getBooleanPatchOption("DisableGmsServiceBroker")
136136
packageNameYouTube = getStringPatchOption("PackageNameYouTube")
137137
packageNameYouTubeMusic = getStringPatchOption("PackageNameYouTubeMusic")
138138

@@ -156,12 +156,11 @@ abstract class BaseGmsCoreSupportPatch(
156156
// Return these methods early to prevent the app from crashing.
157157
val returnEarly = mutableListOf(
158158
CastContextFetchFingerprint,
159+
CastDynamiteModuleFingerprint,
160+
CastDynamiteModuleV2Fingerprint,
159161
GooglePlayUtilityFingerprint,
160162
ServiceCheckFingerprint
161163
)
162-
if (disableGmsServiceBroker) {
163-
returnEarly += GmsServiceBrokerFingerprint
164-
}
165164
returnEarly.returnEarly()
166165

167166
transformPrimeMethod()
@@ -431,11 +430,9 @@ abstract class BaseGmsCoreSupportPatch(
431430
"com.google.android.gms.feedback.internal.IFeedbackService",
432431

433432
// cast
433+
"com.google.android.gms.cast.firstparty.START",
434434
"com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE",
435435

436-
// chimera
437-
"com.google.android.gms.chimera",
438-
439436
// fonts
440437
"com.google.android.gms.fonts",
441438

@@ -455,7 +452,6 @@ abstract class BaseGmsCoreSupportPatch(
455452
"com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE",
456453
"com.google.android.gms.icing.INDEX_SERVICE",
457454
"com.google.android.gms.mdm.services.START",
458-
"com.google.android.gms.clearcut.service.START",
459455

460456
// potoken
461457
"com.google.android.gms.potokens.service.START",

src/main/kotlin/app/revanced/patches/shared/gms/BaseGmsCoreSupportResourcePatch.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@ abstract class BaseGmsCoreSupportResourcePatch(
5252
required = true,
5353
)
5454

55-
private val DisableGmsServiceBroker by booleanPatchOption(
56-
key = "DisableGmsServiceBroker",
57-
default = false,
58-
title = "Disable GmsService Broker",
59-
description = """
60-
Disabling GmsServiceBroker will somewhat improve crashes caused by unimplemented GmsCore services.
61-
62-
For YouTube, the 'Spoof streaming data' setting is required.
63-
""".trimIndentMultiline(),
64-
required = true,
65-
)
66-
6755
internal val PackageNameYouTube = stringPatchOption(
6856
key = "PackageNameYouTube",
6957
default = DEFAULT_PACKAGE_NAME_YOUTUBE,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package app.revanced.patches.shared.gms.fingerprints
2+
3+
import app.revanced.patcher.fingerprint.MethodFingerprint
4+
5+
internal object CastDynamiteModuleFingerprint : MethodFingerprint(
6+
strings = listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl")
7+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package app.revanced.patches.shared.gms.fingerprints
2+
3+
import app.revanced.patcher.fingerprint.MethodFingerprint
4+
5+
internal object CastDynamiteModuleV2Fingerprint : MethodFingerprint(
6+
strings = listOf("Failed to load module via V2: ")
7+
)

src/main/kotlin/app/revanced/patches/shared/gms/fingerprints/GmsServiceBrokerFingerprint.kt

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)