I did
./adb shell cmd appops set com.whatsapp RUN_IN_BACKGROUND ignore
for lots of apps in my android. However, when I go into the app settings, I still can press "force stop". Does that mean the app is still running in the background, even if I setted it to ignore?
How can I see the apps running? adb shell ps
shows too much thing and I don't know which ones are the apps.
Also, will these settings work after reboot?
RUN_IN_BACKGROUND
definitely works. Android relies on this AppOp for its internal functionality (Restricted Apps in Battery Manager settings). ButRUN_IN_BACKGROUND
doesn't guarantee that the app won't have its native process running. App's background activity is stopped within Java stack by Android's ActivityManagerService. That's whatcached
state of an app is.RUN_IN_BACKGROUND
is not working.cgroups
and other subsystems), controls their activity (through manifest permissions), and may keep them incached
or background state even when the apps are completely idle. Or may kill them if resources (RAM in particular) are needed. If you want to change this behavior you need to modify the Android framework.