Inside Android

Ed. note: Sorry for the problem, everybody. The column's now here in its entirety.

Hey everybody. This week lets talk about the thorn in Android's side – efficient task management.

Before we get started, yes I'm one of those people who will say “Stop using the task killer” as a first response to some weird questions. Lots of other pretty knowledgeable folks will say the same thing. They (we) are right. Task killer applications tend to cause a lot of problems simply because using them properly can be a bit confusing, especially with all the conflicting information out there. Follow us after the break and let's figure this out once and for all.

A few days ago we had a front page post with Android Central Editors' application picks. Our Editor-in-Chief Dieter Bohn picked TasKiller Pro.  Of course the second or third reply in the comments was quick to point out that task killers “screw up the phone.” This just reinforced my thought that we really need to discuss this together, and let each person decide their needs rather than bash task killers as a whole.

Android's Memory management 

Android was designed to be a multitasking, fire-breathing beast. It allows applications to keep their spot in device RAM, and stay ready to jump back into focus when the user needs them. The OS also is very good at sharing libraries between applications, so that app coders have a great set of functions already built to choose from. In a perfect world (perfect for developers anyway) we all would use the same applications for the same reasons and that would be the end of it.

But nothing's perfect

We all use different apps, at different times, in different ways. When you consider that nightmare for developers, it's surprising that Android (or any mobile operating system) handles the job as well as it does. Let's take a quick and hopefully easy to understand look at what goes on behind that screen.

An application starts, either because you started it or the developer sees a benefit in having it run behind the scenes. Some examples of the last bit -

  • When you add or remove an application, Google Voice starts (if it was not running). It scans the application to see if needs to use or share any functions with it. Install a new text-to-speech engine? Google Voice will use it.
  • Copy some pictures from your SD card to your computer? The gallery needs to start up when you remount your SD card to check for new pictures or videos so it can scan them and have them ready to show in the right spot.

This all sounds great. What we aren't considering above is that these apps will stay in the device memory until they are told to close. They won't use any other resources, just sit idle and be ready to re-draw themselves on your screen. In today's age of 1Ghz+ processors and high speed data transfer, we get impatient when we want to load a NEW application and it's not instant. We want our device to zoom between screens. We want our device to snap new applications into focus. We want our device to perform in ways it wasn't really designed to do. Using a task killer the correct way can get close to those goals.

A quick study here on just how Android manages memory - Each application has a number (from 1-6) assigned to it, depending of the type of app and it's state. Android assigns a level of minimum free RAM for each category and kills off what it thinks is no longer needed in each once that threshold is reached. This is a pretty technical discussion, and I'm just going to mention it here for those that are interested. If you would like to manipulate these numbers yourself, feel free to give me a holler and I'll point you in the right direction. But let's not clutter up this any more than necessary, as this is a pretty advanced discussion.

The task killer interface

Each application looks and acts a little different, and task killers are no exception. I'll be using Advanced Task Manager for my examples. I am not recommending this above any others. It suits my needs and was well worth the $0.99, so I stopped looking for alternatives. Your choice could look a bit different, but should have the same functionality. Just have a look through the settings and you'll find where to make the same changes and choices.

Below you're looking at a list of running application that the task killer has permission to kill once you give it the go-ahead. You're not seeing every running process, and reading a little further will explain why that's a good thing.  We'll refer back to this image in a bit, but take a second and look over it for now.

Manually killing tasks

The best easiest least complicated way to use a task killer is to open it and manually kill off things you're sure you don't need whenever you feel things have slowed down. The trick is knowing what else won't work if you kill off an app. Things like games, web browsers, dictionaries or other stand alone apps are usually a safe bet to kill off if you find them running. In the example above Astro File Manager is running because I was looking for a file I had downloaded. I'm done with Astro, so there is no need for it to stay running. I could safely kill it off, and nothing else would be affected.

Note – It's a popular misconception that using the back button to exit an application will close it and remove it from memory. This is only true if the app was coded to work this way. Some will, some won't. This is not a universal standard in Android. It doesn't hurt anything, but it's a lot of work to close some apps this way. Entirely your call. I use the Home button because I'm just too lazy to hit back enough times to see my homescreen :)  I'm mentioning it here because Astro is one of those apps that will eventually kill itself if you back up enough times.

You can't see it in my screenshot above, but the Market is also running. I haven't opened the Market in a while, but I'm not going to kill it off. Why? Because if I do, then notification of updates for my installed Market apps won't come in. There are many apps that need to stay alive to use all of their features. You'll have to do a bit of thinking before you decide if you can just kill off an app. Here's a general idea of what to think about:

  • Apps that remind you of something – I use Astrid to help me remember tasks and deadlines. Astrid can fire off a notification to remind me when events are coming up. If I kill it off, I won't get any reminders.  Then I get lost in my computer and nothing ever gets done.
  • Apps that look for updates - In the previous example, I left the Market running so it can notify me of any application updates. Any apps that periodically look for outside data need to stay alive if you want them to find any of that data.
  • Apps that are still doing something – In my example Connectbot is running. I happen to have an active connection to a server in the garage that I'm updating. I can quickly switch over and see the progress as well as issue the commands right from my phone. If I kill it off, I'll have to reopen and connect again each time.

AutoKilling 

Task managers usually come with a function to periodically kill off apps. This is where things get dangerous. Thankfully, most also come with some sort of whitelist of apps that do not get killed during this auto-killfest. While some common sense is still needed, some apps will always need to be on this list

  • Any application that has the manufacturer or carriers name in it should never be killed.
  • Any application that has the word android. (yes the period is there on purpose) should never be killed.
  • Any application that keeps time should never be killed.
  • Any application that has a widget that updates should never be killed.
  • Any application that is not installed on /data (this is where user apps go) should never be killed.
  • If you can't figure out exactly what an application is, it should never be killed.
  • Home replacements, whether from the Market or your manufacturer never should be killed. This also means Sense, Blur, and Touchwiz. They also have dependencies that should stay alive, refer to numbers 1, 5 and 6 above. Of course if you're a tinkerer, and know which parts of the system you don't need running on your particular installation, feel free to experiment.  And share your results. 

This narrows things down quite a bit. Mark all your games to be killed. Mark all your “stand alone apps” (things like Astro in the example above) to be killed. Mark the things you need occasionally, but do not want to run behind the scenes to be killed. Read through what's left, and see if it fits into any of the above categories. If it does, mark it to never be killed.  Remember to consider things like ConnectBot in my example.  I don't want it to run all the time, but while I'm using it I'd like it to stay alive in the background, so I will mark it to NOT be autokilled by the task manager.  Of course, you'll have to set the task killer itself so it stays alive.

If your task killer has a setting to determine how often to kill off apps, set it to do so as often as possible. I don't see any sense in having the task killer running and not using it, as this the reason for using one in the first place.

Once that's done, hit the Home button and ignore everything for a while. Use the phone as you normally would, but pay attention if something starts not working as it used to. If things start to get out of whack, have a look at your whitelist and be sure the app in question isn't set to be killed off.   I will say right off the bat – don't ever kill your clock if you want to use the alarm, last minute seats on a plane because you missed your flight are much more expensive than ones purchased through your ticket agent a week ahead of time. :)

One last thing to keep in mind – When/if you have issues with your device and are seeking help, be sure to mention that you're using a task killer and how you're using it. “Help with alarm on Cliq – using ATK but not killing clock” is a great example of this. You'll still get replies telling you to stop using task killers, but you also might get something useful. Letting people know that you're using a task killer but are aware of the “correct” use will weed out some of the negativity.  Also, using nice descriptive thread titles will always help out our forum moderators and make things easy to search for the next person who has the same issues.

A special section here for the rooted/ROM'd/Mad Scientist types

There's a new breed of task killer out there in the wilds of the Market. These adjust the lowmemorykiller kernel parameters and let things run as usual rather than have the user (that's me and you) try to manage each and every application. It makes sense once you consider that the code for the lowmemorykiller and it's settings haven't been changed since Android 1.0 . If you're willing to take the time to adjust the settings according to your needs, these work great. It's also very easy to pass these settings to the system without an application by writing specific values to the system settings. If this interests you (and if you're a tweeker it should!) it would be a great subject for a thread in the hacking forums, and one that I'd love to participate in.  Yeah that's a hint :)

Until next time,

Jerry