generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 437
feat: Add Disable analytics and telemetry
patches
#3448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
patchink0
wants to merge
21
commits into
ReVanced:dev
Choose a base branch
from
patchink0:feat/disable-multiple-telemetry
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b137a21
Initial commit
bd5c925
Disabled patches by default
f3c3706
Updated README.md with privacy aspect
patchink0 63801d3
Removed resource patches as not accepted by maintainers
patchink0 313e2b5
First draft of universal privacy patch
patchink0 96fe5d0
Combined all patches in a single patch
patchink0 a8b6b82
Made fingerprints internal
patchink0 be63a06
Changed the emoji used to represent privacy
patchink0 1d4b437
Committed api file
patchink0 bf5a1f3
Added appsflyer plugin patching
patchink0 e5bda0d
Updated MoEngage fingerprint to better match different integrations
patchink0 e38d437
Updated skipping message
patchink0 d396637
Added back resource patches in a new separate patch
patchink0 2885981
Added Amplitude SDK patching
patchink0 6926e07
Updated MoEngage signature to resist obfuscation
patchink0 84d7c64
Updated MoEngage patch to handle more cases
patchink0 574017c
Apply suggestions from code review
oSumAtrIX a592e7c
Updated Crashlytics patch to resist obfuscation
patchink0 a02dd18
Updated FirebaseTransport patch to resist obfuscation
patchink0 6b80eb8
Updated AppsFlyer patch to increase compatibility. Now patching at th…
patchink0 e36b41d
refactor
oSumAtrIX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/app/revanced/patches/all/analytics/appsflyer/DisableAppsFlyer.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package app.revanced.patches.all.analytics.appsflyer | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.all.analytics.appsflyer.fingerprints.AppsFlyerInitFingerprint | ||
import app.revanced.util.resultOrThrow | ||
|
||
@Patch( | ||
name = "Disable AppsFlyer analytics SDK" | ||
) | ||
@Suppress("unused") | ||
object DisableAppsFlyer : BytecodePatch( | ||
setOf(AppsFlyerInitFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
AppsFlyerInitFingerprint.resultOrThrow().mutableMethod.addInstructions( | ||
0, | ||
""" | ||
sget-object p0, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit; | ||
return-object p0 | ||
""" | ||
) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...lin/app/revanced/patches/all/analytics/appsflyer/fingerprints/AppsFlyerInitFingerprint.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package app.revanced.patches.all.analytics.appsflyer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object AppsFlyerInitFingerprint : MethodFingerprint( | ||
returnType = "Ljava/lang/Object;", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.SYNTHETIC, | ||
parameters = listOf("L", "L", "L"), | ||
customFingerprint = { _, classDef -> | ||
classDef.sourceFile == "CatchingAppsFlyerLibWrapper.kt" | ||
} | ||
) |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/app/revanced/patches/all/analytics/comscore/DisableComScore.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package app.revanced.patches.all.analytics.comscore | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.all.analytics.comscore.fingerprints.ComScoreSetupFingerprint | ||
import app.revanced.util.resultOrThrow | ||
|
||
@Patch( | ||
name = "Disable ComScore analytics SDK" | ||
) | ||
@Suppress("unused") | ||
object DisableComScore : BytecodePatch( | ||
setOf(ComScoreSetupFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
ComScoreSetupFingerprint.resultOrThrow().mutableMethod.addInstructions(0, "return-void") | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...tlin/app/revanced/patches/all/analytics/comscore/fingerprints/ComScoreSetupFingerprint.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.all.analytics.comscore.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object ComScoreSetupFingerprint : MethodFingerprint( | ||
returnType = "V", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, | ||
customFingerprint = { methodDef, classDef -> | ||
classDef.type == "Lcom/comscore/util/setup/Setup;" && methodDef.name == "setUp" | ||
} | ||
) |
38 changes: 38 additions & 0 deletions
38
src/main/kotlin/app/revanced/patches/all/analytics/crashlytics/DisableCrashlytics.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package app.revanced.patches.all.analytics.crashlytics | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.all.analytics.crashlytics.fingerprints.DoConfigFetchFingerprint | ||
import app.revanced.patches.all.analytics.crashlytics.fingerprints.SettingsSpiCallFingerprint | ||
import app.revanced.util.resultOrThrow | ||
|
||
@Patch( | ||
name = "Disable Crashlytics" | ||
) | ||
@Suppress("unused") | ||
object DisableCrashlytics : BytecodePatch( | ||
setOf(SettingsSpiCallFingerprint, DoConfigFetchFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
// Neutralize the two methods responsible for requesting Crashlytics' configuration | ||
// which effectively disables the SDK | ||
|
||
SettingsSpiCallFingerprint.resultOrThrow().mutableMethod.addInstructions( | ||
0, | ||
""" | ||
const/4 p1, 0x0 | ||
return-object p1 | ||
""" | ||
) | ||
|
||
DoConfigFetchFingerprint.resultOrThrow().mutableMethod.addInstructions( | ||
0, | ||
""" | ||
sget-object p1, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit; | ||
return-object p1 | ||
""" | ||
) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...n/app/revanced/patches/all/analytics/crashlytics/fingerprints/DoConfigFetchFingerprint.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app.revanced.patches.all.analytics.crashlytics.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object DoConfigFetchFingerprint : MethodFingerprint( | ||
returnType = "L", | ||
accessFlags = AccessFlags.PUBLIC.value, | ||
customFingerprint = { methodDef, classDef -> | ||
classDef.sourceFile == "RemoteSettingsFetcher.kt" && methodDef.name == "doConfigFetch" | ||
} | ||
) |
13 changes: 13 additions & 0 deletions
13
...app/revanced/patches/all/analytics/crashlytics/fingerprints/SettingsSpiCallFingerprint.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.all.analytics.crashlytics.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object SettingsSpiCallFingerprint : MethodFingerprint( | ||
returnType = "L", | ||
accessFlags = AccessFlags.PUBLIC.value, | ||
strings = listOf("Settings request failed."), | ||
customFingerprint = { _, classDef -> | ||
classDef.sourceFile == "DefaultSettingsSpiCall.java" | ||
} | ||
) |
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/app/revanced/patches/all/analytics/facebook/DisableFacebookAnalytics.kt
LisoUseInAIKyrios marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package app.revanced.patches.all.analytics.facebook | ||
|
||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.shared.resource.AndroidManifest | ||
|
||
@Patch( | ||
name = "Disable Facebook Analytics", | ||
description = "Disables parts of the Facebook SDK responsible for data gathering." | ||
) | ||
@Suppress("unused") | ||
object DisableFacebookAnalytics : ResourcePatch() { | ||
override fun execute(context: ResourceContext) { | ||
mapOf( | ||
"com.facebook.sdk.AutoLogAppEventsEnabled" to "false", | ||
"com.facebook.sdk.AdvertiserIDCollectionEnabled" to "false", | ||
"com.facebook.sdk.MonitorEnabled" to "false", | ||
// This entry disables completely the SDK, preventing Facebook login from working, may not be desired | ||
//"com.facebook.sdk.AutoInitEnabled" to "false" | ||
// TODO Add a patch option to choose to disable the SDK completely ? | ||
).forEach { | ||
AndroidManifest.addMetadata(context, it.key, it.value) | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/app/revanced/patches/all/analytics/firebase/DisableFirebaseCollections.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package app.revanced.patches.all.analytics.firebase | ||
|
||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.shared.resource.AndroidManifest | ||
|
||
@Patch( | ||
name = "Disable Firebase collections", | ||
description = "Disables multiple Firebase data collection mechanisms." | ||
) | ||
@Suppress("unused") | ||
object DisableFirebaseCollections : ResourcePatch() { | ||
override fun execute(context: ResourceContext) { | ||
mapOf( | ||
"firebase_analytics_collection_enabled" to "false", | ||
"firebase_analytics_collection_deactivated" to "true", | ||
"firebase_crashlytics_collection_enabled" to "false", | ||
"firebase_performance_collection_enabled" to "false", | ||
"firebase_performance_collection_deactivated" to "true", | ||
"firebase_data_collection_default_enabled" to "false" | ||
).forEach { | ||
AndroidManifest.addMetadata(context, it.key, it.value) | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/app/revanced/patches/all/analytics/firebase/DisableFirebaseTransport.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package app.revanced.patches.all.analytics.firebase | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.all.analytics.firebase.fingerprints.SendFingerprint | ||
import app.revanced.util.resultOrThrow | ||
|
||
@Patch( | ||
name = "Disable Firebase transport", | ||
description = "Prevents the sending of Firebase Logging and Firebase Crashlytics logs to Google's servers." | ||
) | ||
@Suppress("unused") | ||
object DisableFirebaseTransport : BytecodePatch( | ||
setOf(SendFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
// Neutralize the method sending data to the backend | ||
SendFingerprint.resultOrThrow().mutableMethod.addInstructions(0,"return-void") | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/kotlin/app/revanced/patches/all/analytics/firebase/fingerprints/SendFingerprint.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app.revanced.patches.all.analytics.firebase.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object SendFingerprint : MethodFingerprint( | ||
returnType = "V", | ||
accessFlags = AccessFlags.PUBLIC.value, | ||
customFingerprint = { methodDef, classDef -> | ||
classDef.sourceFile == "TransportRuntime.java" && methodDef.name == "send" | ||
} | ||
) |
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/app/revanced/patches/all/analytics/google/DisableGoogleAnalytics.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package app.revanced.patches.all.analytics.google | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.all.analytics.google.fingerprints.AnalyticsInitFingerprint | ||
import app.revanced.util.resultOrThrow | ||
|
||
@Patch( | ||
name = "Disable Google Analytics" | ||
) | ||
@Suppress("unused") | ||
object DisableGoogleAnalytics : BytecodePatch( | ||
setOf(AnalyticsInitFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
// Empties the "context" argument to force an exception | ||
AnalyticsInitFingerprint.resultOrThrow().mutableMethod.addInstructions(0,"const/4 p0, 0x0") | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...ain/kotlin/app/revanced/patches/all/analytics/google/DisableGoogleAnalyticsCollections.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package app.revanced.patches.all.analytics.google | ||
|
||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.shared.resource.AndroidManifest | ||
|
||
@Patch( | ||
name = "Disable Google Analytics collections", | ||
description = "Disables multiple Google Analytics data collection mechanisms." | ||
) | ||
@Suppress("unused") | ||
object DisableGoogleAnalyticsCollections : ResourcePatch() { | ||
override fun execute(context: ResourceContext) { | ||
mapOf( | ||
"google_analytics_adid_collection_enabled" to "false", | ||
"google_analytics_default_allow_ad_personalization_signals" to "false", | ||
"google_analytics_automatic_screen_reporting_enabled" to "false", | ||
"google_analytics_default_allow_ad_storage" to "false", | ||
"google_analytics_default_allow_ad_user_data" to "false", | ||
"google_analytics_default_allow_analytics_storage" to "false", | ||
"google_analytics_sgtm_upload_enabled" to "false", | ||
"google_analytics_deferred_deep_link_enabled" to "false" | ||
).forEach { | ||
AndroidManifest.addMetadata(context, it.key, it.value) | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...kotlin/app/revanced/patches/all/analytics/google/fingerprints/AnalyticsInitFingerprint.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app.revanced.patches.all.analytics.google.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object AnalyticsInitFingerprint : MethodFingerprint( | ||
returnType = "L", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, | ||
parameters = listOf("Landroid/content/Context;"), | ||
strings = listOf("Slow initialization (ms)"), | ||
customFingerprint = { _, classDef -> | ||
classDef.sourceFile?.startsWith("com.google.android.gms:play-services-analytics-impl") == true | ||
} | ||
) |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/app/revanced/patches/all/analytics/moengage/DisableMoEngage.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package app.revanced.patches.all.analytics.moengage | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.all.analytics.moengage.fingerprints.MoEngageInitFingerprint | ||
import app.revanced.util.resultOrThrow | ||
|
||
@Patch( | ||
name = "Disable MoEngage analytics SDK" | ||
) | ||
@Suppress("unused") | ||
object DisableMoEngage : BytecodePatch( | ||
setOf(MoEngageInitFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
MoEngageInitFingerprint.resultOrThrow().mutableMethod.addInstructions(0, "return-void") | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...otlin/app/revanced/patches/all/analytics/moengage/fingerprints/MoEngageInitFingerprint.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app.revanced.patches.all.analytics.moengage.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object MoEngageInitFingerprint : MethodFingerprint( | ||
returnType = "V", | ||
accessFlags = AccessFlags.PUBLIC.value, | ||
customFingerprint = { methodDef, classDef -> | ||
classDef.sourceFile == "DefaultMoEngageSdk.kt" && methodDef.name == "init" | ||
} | ||
) |
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/app/revanced/patches/all/analytics/segment/DisableSegment.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package app.revanced.patches.all.analytics.segment | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.all.analytics.segment.fingerprints.SegmentBuilderFingerprint | ||
import app.revanced.util.resultOrThrow | ||
|
||
@Patch( | ||
name = "Disable Segment analytics SDK" | ||
) | ||
@Suppress("unused") | ||
object DisableSegment : BytecodePatch( | ||
setOf(SegmentBuilderFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
// Empties the writeKey parameter to abort initialization | ||
SegmentBuilderFingerprint.resultOrThrow().mutableMethod.addInstructions(0,"const-string p2, \"\"") | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...tlin/app/revanced/patches/all/analytics/segment/fingerprints/SegmentBuilderFingerprint.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app.revanced.patches.all.analytics.segment.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
object SegmentBuilderFingerprint : MethodFingerprint( | ||
returnType = "V", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, | ||
parameters = listOf("Landroid/content/Context;", "Ljava/lang/String;"), | ||
strings = listOf("writeKey must not be empty.") | ||
) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.