MuntashirAkon / AppManager

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

Preventing an app from restarting after killing it #1067

Closed 2011 closed 1 year ago

2011 commented 1 year ago

Describe the existing feature/documentation

For this example, I will use the app com.duckduckgo.mobile.android. It keeps restarting, with the log showing entries such as this:

[05-16 15:19:40.123 474:474 I/ActivityManager]
Start proc 1819:com.duckduckgo.mobile.android/u0a146 for service com.duckduckgo.mobile.android/androidx.work.impl.background.systemjob.SystemJobService

In AppManager, I have disabled System Job Service (in the Services tab) - the exact one mentioned whenever the app restarts (androidx.work.impl.background.systemjob.SystemJobService)

Two questions:

  1. Why doesn't disabling this service prevent the app from restarting?

  2. Would you recommend any other methods to prevent apps from constantly restarting?

Describe your problem(s)

No response

Additional context

No response

MuntashirAkon commented 1 year ago

1. Why doesn't disabling this service prevent the app from restarting?

It's difficult to assess anything only through a single log entry. But if this component is disabled and the app is force-stopped (not killed because Android isn't exactly Linux and, therefore, kill won't work for Android processes), the app should not wake up unless there's already a pending job in the Alarm/work manager.

2. Would you recommend any other methods to prevent apps from constantly restarting?

Yes. You can disable running the app in the background if it's supported by your device. If you can't, disable the receivers that you suspect might schedule such jobs. But you cannot still prevent the jobs from being scheduled if you actively use the apps because they can be scheduled from anywhere.

But if you ask me, I don't see any reason for anybody stopping an app from running in the background. This threat model is a rather lousy threat model. Because it means that the user is confused about the app and cannot decide what to do with it. A good threat model would be either to stop using the app altogether or use freeze/unfreeze cycle, that is, only use the app when needed and freeze it again after you're done. The latter saves a lot of battery too, in a way, since these sort of apps usually run a lot in the background.

2011 commented 1 year ago

I don't see any reason for anybody stopping an app from running in the background.

Thank you for your reply.

My biggest problem comes from the fact that so many of these apps want to run in the background, which eventually consumes all of the memory on my device. Then when I want to start a different app, it takes an inordinate amount of time to start up, and (a good percentage of the time) the memory manager will kill something like the VPN (which I don't ever want killed) instead of background applications.

I don't consider this much of a security threat (maybe a bigger privacy threat), but above all else, I hate that apps running in the background simply slow down my devices. I would prefer that when I exit an app that it stops and releases all of the memory immediately

MuntashirAkon commented 1 year ago

Memory management has always been problematic in Android. Vendors have made it even worse by customising it to supposedly improve memory usage. If you're running an Android < 7.0, you're basically out of luck because Android does not provide any options to control per-app background operation. However, you could still limit background apps by going to Settings > Developer options > Background process limit.