Themes / Apps / Mods [MOD/magisk/root] Magisk module to disable app Ads/Analytics/Firebase/Crashlytics

Search This thread

foobar66

Senior Member
Jan 8, 2011
2,136
2,221
Brussels
Google Pixel 6 Pro
Attached is a (simple) Magisk module which allows you to disable:

- app measurement
- app analytics
- app firebase tracking
- app crashlytics

In short, each APK (system app or user app) may have background services to do all sorts of tracking and ad handling. Module allows you to disable (or enable) those services.

You must obviously be rooted and have a working Magisk.

How to install:
Code:
a) download attached zip file
b) push the zip file to your /sdcard folder (use: adb push dss.zip /sdcard)
c) open Magisk
d) in the panel at the bottom, tap the "modules" icon
e) at the top, select "install downloaded module"
f) navigate to your /sdcard folder
g) select dss.zip
h) tap the reboot button

After installation:
The script must be run manually using the command line. First, open a shell using adb:
Code:
> adb shell
$ su
#
The script has the following syntax:
Code:
dss {disable|enable} {user|system} <package-name>
You must provide 2 or 3 arguments to the script:
a) first argument is "disable" or "enable" (by default Analytics/Firebase/etc services are enabled)
b) second argument is "user" or "system" (use "user" for any app wich you installed using an APK or installed from play store; use "system" for apps which come as part of the official Google image, e.g. contacts/dialer/messaging)
c) the third argument is optional and - if present - contains the name of a specific package (e.g. com.banking.mybankapp)

Examples:

1) disable analytics/firebase/etc for ALL user apps
Code:
# dss disable user
2) enable analytics/firebase/etc for ALL system apps (this is the default)
Code:
# dss enable system
3) disable analytics/firebase/etc for Feedly
Code:
# dss disable user com.devhd.feedly
The script will show you output of the services which get disabled, for example for the Feedly case:
Code:
Component {com.devhd.feedly/com.facebook.internal.FacebookInitProvider} new state: disabled
Component {com.devhd.feedly/com.google.android.gms.analytics.AnalyticsJobService} new state: disabled
Component {com.devhd.feedly/com.google.android.gms.analytics.AnalyticsReceiver} new state: disabled
Component {com.devhd.feedly/com.google.android.gms.analytics.AnalyticsService} new state: disabled
Occasionally it can happen that after disabling Analytics/Firebase/etc, the app no longer works. Then just "enable" again. Apps should - in principle - be resilient but some are not coded properly. Alternatively, you can try to figure out exactly which of the services causes the crash and (manuall) re-enable that service (but you will need to look into the source code a bit). When you run this on Feedly for example, you will find that it crashes afterwards (reason is that the script disabled com.devhd.feedly/com.facebook.internal.FacebookInitProvider). You can re-enable that service individually using:
Code:
pm enable com.devhd.feedly/com.facebook.internal.FacebookInitProvider
or just do:
Code:
# dss enable user com.devhd.feedly
(that will re-enable all the services previously disabled)

You can also disable stuff for system apps, e.g. com.android.contacts (Contacts), com.android.vending (Play store app), etc ...
However, one BIG WARNING. If you disable this for system apps, make sure to re-run the script with the 'enable system' argument BEFORE running a Play-systemupdate otherwise that may bootloop. So, to be on the safe side, if you have used the script to disable services in system APKs, then run:
Code:
# dss enable system
before doing the Play-systemupdate.

I you want to check the source code (simple sh script), just unzip the dss.zip in a new directory and check out the file system/bin/dss. It's not complicated ...

This will save you (a tiny litte bit) of battery, but more importantly, a lot of nasty "tracking" (which you don't need).

Changes are persistent across reboots.

github: https://github.com/foobar66/dss
 

Attachments

  • dss.zip
    6.4 KB · Views: 779
Last edited:

foobar66

Senior Member
Jan 8, 2011
2,136
2,221
Brussels
Google Pixel 6 Pro
Last edited:
207 user packages got disabled.

  1. Do I have to also run "dss enable system" after the initial "dss disable user"?
  2. Will I have to re-run this after an app updates?
  3. Will I have to re-run this after a monthly android update?

Also:
You should implement that the module saves the output of the disabled packages.
That way you can easily (and safer) restore those packages e.g. when uninstalling the module?

Same goes for all your other modules:
They tinker with the system but how can I safely restore the original form and uninstall the module?
 
  • Like
Reactions: foobar66

s3axel

Senior Member
Mar 4, 2013
750
478
Samsung Galaxy S23 Ultra
Also:
You should implement that the module saves the output of the disabled packages.
That way you can easily (and safer) restore those packages e.g. when uninstalling the module?

Same goes for all your other modules:
They tinker with the system but how can I safely restore the original form and uninstall the module?
Well, as this is commandline based its basically all there in OP ;)

BTW saving the output is easy, just expand the commandline by "> filename.log" (without the "")

And the safe way back before uninstalling is just dss enable user / dss enable system
 
  • Like
Reactions: foobar66
Well, as this is commandline based its basically all there in OP ;)

BTW saving the output is easy, just expand the commandline by "> filename.log" (without the "")

And the safe way back before uninstalling is just dss enable user / dss enable system

What I was trying to say is that the module should use the output for when restoring / enabling.

If you have looked at the source code of the module, then you will see that it basically works by creating an array of queried packages to disable/enable. I could imagine that due to what ever fault / later update / package changes / ... the "enable query" might look different than the "disable query" that was run months before. Meaning that there is a chance that not everything that got disabled will get enabled again.
 
  • Like
Reactions: s3axel and foobar66

foobar66

Senior Member
Jan 8, 2011
2,136
2,221
Brussels
Google Pixel 6 Pro
What I was trying to say is that the module should use the output for when restoring / enabling.

If you have looked at the source code of the module, then you will see that it basically works by creating an array of queried packages to disable/enable. I could imagine that due to what ever fault / later update / package changes / ... the "enable query" might look different than the "disable query" that was run months before. Meaning that there is a chance that not everything that got disabled will get enabled again.
Indeed ... that would be a very good improvement ... I´ll have a look at implementing that.
Thanks for the suggestion.
 
  • Like
Reactions: Utini
Indeed ... that would be a very good improvement ... I´ll have a look at implementing that.
Thanks for the suggestion.

It would also be useful for re-running the module after installing some new apps.

E.g. re-running dss disable user will try to disable all user apps even if 90% of them was disabled previously already.

If there was a "file" or "log" to compare what was disabled already, then it could only care about what is now newly installed :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 22
    Attached is a (simple) Magisk module which allows you to disable:

    - app measurement
    - app analytics
    - app firebase tracking
    - app crashlytics

    In short, each APK (system app or user app) may have background services to do all sorts of tracking and ad handling. Module allows you to disable (or enable) those services.

    You must obviously be rooted and have a working Magisk.

    How to install:
    Code:
    a) download attached zip file
    b) push the zip file to your /sdcard folder (use: adb push dss.zip /sdcard)
    c) open Magisk
    d) in the panel at the bottom, tap the "modules" icon
    e) at the top, select "install downloaded module"
    f) navigate to your /sdcard folder
    g) select dss.zip
    h) tap the reboot button

    After installation:
    The script must be run manually using the command line. First, open a shell using adb:
    Code:
    > adb shell
    $ su
    #
    The script has the following syntax:
    Code:
    dss {disable|enable} {user|system} <package-name>
    You must provide 2 or 3 arguments to the script:
    a) first argument is "disable" or "enable" (by default Analytics/Firebase/etc services are enabled)
    b) second argument is "user" or "system" (use "user" for any app wich you installed using an APK or installed from play store; use "system" for apps which come as part of the official Google image, e.g. contacts/dialer/messaging)
    c) the third argument is optional and - if present - contains the name of a specific package (e.g. com.banking.mybankapp)

    Examples:

    1) disable analytics/firebase/etc for ALL user apps
    Code:
    # dss disable user
    2) enable analytics/firebase/etc for ALL system apps (this is the default)
    Code:
    # dss enable system
    3) disable analytics/firebase/etc for Feedly
    Code:
    # dss disable user com.devhd.feedly
    The script will show you output of the services which get disabled, for example for the Feedly case:
    Code:
    Component {com.devhd.feedly/com.facebook.internal.FacebookInitProvider} new state: disabled
    Component {com.devhd.feedly/com.google.android.gms.analytics.AnalyticsJobService} new state: disabled
    Component {com.devhd.feedly/com.google.android.gms.analytics.AnalyticsReceiver} new state: disabled
    Component {com.devhd.feedly/com.google.android.gms.analytics.AnalyticsService} new state: disabled
    Occasionally it can happen that after disabling Analytics/Firebase/etc, the app no longer works. Then just "enable" again. Apps should - in principle - be resilient but some are not coded properly. Alternatively, you can try to figure out exactly which of the services causes the crash and (manuall) re-enable that service (but you will need to look into the source code a bit). When you run this on Feedly for example, you will find that it crashes afterwards (reason is that the script disabled com.devhd.feedly/com.facebook.internal.FacebookInitProvider). You can re-enable that service individually using:
    Code:
    pm enable com.devhd.feedly/com.facebook.internal.FacebookInitProvider
    or just do:
    Code:
    # dss enable user com.devhd.feedly
    (that will re-enable all the services previously disabled)

    You can also disable stuff for system apps, e.g. com.android.contacts (Contacts), com.android.vending (Play store app), etc ...
    However, one BIG WARNING. If you disable this for system apps, make sure to re-run the script with the 'enable system' argument BEFORE running a Play-systemupdate otherwise that may bootloop. So, to be on the safe side, if you have used the script to disable services in system APKs, then run:
    Code:
    # dss enable system
    before doing the Play-systemupdate.

    I you want to check the source code (simple sh script), just unzip the dss.zip in a new directory and check out the file system/bin/dss. It's not complicated ...

    This will save you (a tiny litte bit) of battery, but more importantly, a lot of nasty "tracking" (which you don't need).

    Changes are persistent across reboots.

    github: https://github.com/foobar66/dss
    3
    Flashed and disabled analytics on ProtonAOSP. Thank you for the tool.
    3
    wow, thanks OP
    I did disable analytics/firebase/etc for ALL user apps and scrolling facebook on Chrome no longer jittery.
    3
    207 user packages got disabled.

    1. Do I have to also run "dss enable system" after the initial "dss disable user"?
    2. Will I have to re-run this after an app updates?
    3. Will I have to re-run this after a monthly android update?