MuntashirAkon / AppManager

A full-featured package manager and viewer for Android
https://muntashirakon.github.io/AppManager/
Other
4.91k stars 277 forks source link

Automatically disable tracking components on app install #40

Open Atrate opened 4 years ago

Atrate commented 4 years ago

Related to: #28, #35, #39

AppManager could utilize the android.intent.action.PACKAGE_ADDED broadcast receiver to automatically disable tracker components in apps the moment they are installed.

MuntashirAkon commented 4 years ago

But doesn't this mean that it needs to run a service all the time?

Atrate commented 4 years ago

Can't an app be woken up by a broadcast without having a persistent bg service?

MuntashirAkon commented 4 years ago

So, I will provide an option in the settings which will be disabled by default. It will block trackers only if it's enabled.

Detecting new package installation is not heard but detecting the package itself is a bit difficult. So, what I'll do is fetch all the packages and sort it using the date installed updated and only apply the blocking in the last one.

MuntashirAkon commented 4 years ago

Can't an app be woken up by a broadcast without having a persistent bg service?

Unfortunately, no. After API 26, most of the system broadcasts has been hidden (I can detect package uninstalls though as it's not yet hidden). So, a background service is required. The alternative is to mark the last app launch time and find the newly installed/updated apps between that time and apply the action, which I think is better than running persistent services.

MuntashirAkon commented 4 years ago

Related to #61

Atrate commented 4 years ago

Now that AM can install APKs directly from file managers, this feature could be implemented more easily, at least only for apps installed through AM.

The alternative is to mark the last app launch time and find the newly installed/updated apps between that time and apply the action, which I think is better than running persistent services.

Since AM is going to have a firewall function, running an installation watchdog could be coupled with the FW service.

MuntashirAkon commented 4 years ago

Now that AM can install APKs directly from file managers, this feature could be implemented more easily, at least only for apps installed through AM.

Yes, this could be possible.

Since AM is going to have a firewall function, running an installation watchdog could be coupled with the FW service.

Firewall won't use any service for root users, at least, for now. I do not intend to make it a complicated firewall system like AFWall+ or Netguard. It will have the basic internet blocking features, import/export (like any other rules) and, probably, hosts blocking and will be available throughout the app as batch ops and routine ops (the ecosystem is already very complicated in the backend). I may also add logging capabilities in future. Most users should be satisfied with only these features. Besides, merging root/no-root firewall is going to be a difficult job.

MuntashirAkon commented 3 years ago

Since App Manager uses server-client mechanism and server (which doesn't have any impact on battery) runs in the background all the time, this can be achieved more easily (since it's only specific to root users) in the following way:

  1. Run AM server on boot instead of only when AM is running
  2. Register a broadcast receiver for PACKAGE_ADDED.
  3. When an app is installed ie. PACKAGE_ADDED is called, another explicit broadcast will be sent to AM (which will wake up AM for a few seconds).
  4. AM will run a job to block the tracking components and a notification will be displayed.
MuntashirAkon commented 3 years ago

Now that AM can install APKs directly from file managers, this feature could be implemented more easily, at least only for apps installed through AM.

This feature has been implemented in fb691608.

EkriirkE commented 1 year ago

I looked and poked around but could not find anything on this aspect - can arbitrary components also be added to auto revoke on install (eg I want to automatically disable anything with the word "lytic" or "metric" in it), and other permissions like network; defaulting anything new to POLICY_REJECT_ALL