Skip to content
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

feat: Add Disable analytics and telemetry patches #3448

Draft
wants to merge 21 commits into
base: dev
Choose a base branch
from

Conversation

patchink0
Copy link
Contributor

Added generic patches to disable multiple analytics and telemetry SDKs: ComScore, AppsFlyer, MoEngage, Segment, Statsig, Facebook SDK, Google Analytics, Firebase Crashlytics, Firebase Logging

Those are all the SDKs included in the SoundCloud app, and the patches were developed and tested on it but should work for any app.

This greatly increases privacy but also performance, more specifically regarding the startup time. SoundCloud initializes and opens up noticeably faster using those patches.

Copy link
Member

@oSumAtrIX oSumAtrIX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on first sight. Once the couple style/refactor issues are addressed it lgtm. I do not know if each patch works here as expected, were they all been tested? The readme of the repository should be changed in this pr as well to include privacy patches as a feature, given this pr introduces pretty much all the common ones.

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Jul 17, 2024

What other apps has this been tested on?

I wonder if it would be simpler if all of these were bundled together into a single universal patch.

Since not all sub patches will work for every app, it could not throw ugly exceptions and instead print to the console what patches succeeded and what did not.

Something like:

INFO: Disable telemetry: Crashlytics patched
INFO: Disable telemetry: Facebook SDK not found, not patched
INFO: Disable telemetry success

(See the remove share targets patch for how to log)

And add patch options to turn off each sub patch if someone wanted (but I think most users would want everything included by default if they chose this patch).

@oSumAtrIX
Copy link
Member

That sounds like a good idea indeed.

@cyberboh
Copy link

To make simpler logs, could be instead of not patched would be nice if using skipping...
eg:

INFO: Disable telemetry: Crashlytics patched
INFO: Disable telemetry: Facebook SDK not found, skipping
INFO: Disable telemetry succeeded

README.md Outdated Show resolved Hide resolved
@oSumAtrIX oSumAtrIX self-requested a review July 28, 2024 14:10
README.md Outdated Show resolved Hide resolved
@LisoUseInAIKyrios
Copy link
Contributor

Are there any todo's left for this PR?

Just for reference, what apps has this been tested on and it works?

@oSumAtrIX
Copy link
Member

oSumAtrIX commented Aug 16, 2024

I am locally refactoring this PR. I'll push it soon

@oSumAtrIX oSumAtrIX changed the title feat: Add multiple analytics SDK disabling patches feat: Add Disable analytics and telemetry patches Aug 24, 2024
Copy link
Member

@oSumAtrIX oSumAtrIX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please test the refactoring changes & my review. Otherwise LGTM

val applicationNode = getNode("application") as Element
applicationNode.getElementsByTagName(META_DATA_TAG)
.asSequence()
.first { it.attributes.getNamedItem(NAME_ATTRIBUTE).nodeValue == nodeName }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced firstOrNull with first here when refactoring. Correct this if it should be firstOrNull. If it should, then the try captch block above isn't necessary which was present before I refactored.

object DisableAnalyticsAndTelemetryThroughManifestPatch : ResourcePatch() {
private val logger = Logger.getLogger(this::class.java.name)

private val disableFirebaseTelemetry by option("Firebase telemetry")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged the two firebase patches to one.

Comment on lines +22 to +24
private val disableFirebaseTelemetry by option("Firebase telemetry")
private val disableFacebookSdk by option("Facebook SDK")
private val disableGoogleAnalytics by option("Google Analytics")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GAnalytics patch also exists in the bytecode patch, why is it present here as well? Also, can't the firebase & facebook patches be converted to bytecode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants