1

Disclaimer: I'm not in any way connected to the Greenify developers, nor am I trying to promote Greenify or anything. I'm actually interested in the answers to these questions.

I've found that with a lot of Android devices that I have managed, they become slower the more apps one installs on them. This is especially true with apps that perform some sort of tasks in the background. Often, devices can become so slow that they are a real pain to use.

The solution I found to this was an app called Greenify, that I use with root privileges and an Xposed module. I find that I can keep all the apps on the devices, but "Greenify" all of them. (I think this means that inactive apps are consistently "hibernated" or deprived of system resources, leaving the resources available for active apps.) This usually makes the device much snappier, yet I find that the impeding effect on the functionality of the apps is quite minimal. Needless to say, I consider Greenify a must, especially on devices with lots of resource hogging apps and/or limited hardware.

  1. Does Android do something similar to Greenify natively? (Depriving background apps of resources in order to free it up for active apps?)

  2. If yes, how is Greenify different from Android's native resource management?

I find that lots of people have Android devices that tend to slow down over time, and many of them end up just buying a new, more powerful device once every few years. But if they used Greenify (or something similar), they might have been satisfied with the performance of the older device for many, many more years. I for example, have a five year old phone, have tons of apps on it, and am quite happy with its performance when using Greenify. However, without Greenify (and with all my apps), the phone is so slow that it's barely usable.

  1. Is there any native Android way to prevent apps from running in the background and hogging system resources?

For example, in GNU/Linux distros like Debian and Ubuntu, apps don't run or consume any resources at all unless you explicitly launch them (or have them set to launch at startup.) It's the same with OS X and Windows. And when you shut a program completely down, it can no longer consume any resources. I think even iOS automatically kills background apps when it needs the resources for something else.

I've used manual task killers, but after a while, I find that all the apps are back up running in the background again, even if I haven't launched them at all.

  1. Is it true that Android is somewhat unique in allowing apps to run in the background, consuming resources?
  • It has already been argued that performance manager apps are more of a damage than an advantage, on Android devices. The fact is, that the kernel of an Android device is a derivation of the Linux kernel, so devices should already know how to manage their resources without the need for external apps. Furthermore, on the topic of killing an app, there's one enormous downside: anytime you start it again, the battery usage amounts to more than the usage you would experience by letting it hanging in background. This is because most Android devices already know how to handle themselves. – Death Mask Salesman Mar 23 '16 at 15:14
  • The command: am force-stop PACKAGE. That's it. – Firelord Mar 23 '16 at 15:35
  • 1
    @Firelord Is it true that Greenify is a bit more advanced than a normal task killer? What does it do with its root privileges and Xposed module? – Revetahw Mar 23 '16 at 15:43
  • 1
    This is an old post but may still be relevant: forum.xda-developers.com/… – Firelord Mar 23 '16 at 15:45
  • @Firelord Very relevant indeed. – Revetahw Mar 23 '16 at 16:19
3
  1. Android actually closes some background apps, but only when system ressources are missing (you open a massive game, for example)

  2. Greenify differ from the Android memory management by the fact that it kills all apps you specified at will or after a certain time, not only when ressources are missing.

  3. Nope. If some system apps that you do not use are running in background, you can disable them or remove them completely with a root app or the adb shell

  4. Here's the list of things that I know can start a background activity and keep it opened:

    • The apps can start an activity automatically at system startup with a permission.
    • It can also start one when opened.
    • A vulnerability in Android 4.3 and before allows app to keep them active, even when the Android task killer tries to kill apps, but Greenify can workaround this (see the experimental settings).

And @DeathMaskSalesman, a HTC Wildfire S running KitKat needs Greenify, or else it'll run incredibely slow and drain a lot of battery, more than what needed to start an app.

4

From the Android developer site:

  • If an activity has lost focus but is still visible (that is, a new non-full-sized or transparent activity has focus on top of your activity), it is paused. A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations.
  • If an activity is completely obscured by another activity, it is stopped. It still retains all state and member information, however, it is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere.
  • If an activity is paused or stopped, the system can drop the activity from memory by either asking it to finish, or simply killing its process. When it is displayed again to the user, it must be completely restarted and restored to its previous state.

Also:

So, as the system runs low on memory, it may kill processes [...] beginning with the process least recently used, but also giving some consideration toward which processes are most memory intensive.

As far as technical implementation goes, the system calls into apps to let them know that they need to release memory or risk being killed:

Also, when your app process is currently cached, you may receive one of the following levels from onTrimMemory():

  • TRIM_MEMORY_BACKGROUND

    The system is running low on memory and your process is near the beginning of the LRU list. Although your app process is not at a high risk of being killed, the system may already be killing processes in the LRU cache. You should release resources that are easy to recover so your process will remain in the list and resume quickly when the user returns to your app.

  • TRIM_MEMORY_MODERATE

    The system is running low on memory and your process is near the middle of the LRU list. If the system becomes further constrained for memory, there's a chance your process will be killed.

  • TRIM_MEMORY_COMPLETE

    The system is running low on memory and your process is one of the first to be killed if the system does not recover memory now. You should release everything that's not critical to resuming your app state.

So to directly answer your questions:

  1. No, Android does not clean anything up for apps, but it lets them know to do so themselves and kills them if they don't (or if it's not enough).

  2. Greenify appears to do "on-the-fly" disabling of apps, so it is not allowed to run anything when in the background (and can't be started automatically when not running), but can still do anything when in the foreground. This is completely different from how Android does it as you see above.

  3. Yes — disable them (from Settings → Applications → <App Name>) (though you will have to re-enable when you want to run them manually). Or, for those that don't have automatically restarting services, simply kill them (i.e., long press the Menu button and swipe them away). The latter will not prevent them from restarting if the system delivers an Intent to them, etc.

  4. No, not at all. True multitasking has long been available on mobile devices — the original iPhone was an oddity when it launched without that ability.

  • This system sounds very good ln theory. So how is it that many devices become slower the more apps you install on them? Such as the examples described by me and Charles.milette? Shouldn't the described system prevent that tendency? – Revetahw Mar 23 '16 at 18:37
  • 2
    @Fiksdal The fault mainly lies with app developers who don't know how to appropriately suspend tasks / release memory / use low-power listeners. However, some apps truly require active receivers (like an app for custom gestures that needs to receive your input at any time) or will have notification services, etc. No matter how lightweight these are, they will add up if you install many of them. No different than installing a lot of applications with updater services, tray interfaces, etc. on a desktop OS. – Matthew Read Mar 23 '16 at 18:43
  • 2
    If you want to keep such apps for manual use but don't want the automatic stuff draining your battery when you're not actively using them, Greenify is a decent solution (but comes with its own overhead, since it has to run a service in order to manage apps "live"). – Matthew Read Mar 23 '16 at 18:46
  • Alright, that makes sense – Revetahw Mar 23 '16 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.