Are all Androids created equal? Software makes a big difference

We've talked about how the hardware inside your phone can make a difference when it comes to the user experience. Now it's time to talk about the software.

Software is the single-most important piece of any computer. Whether we're talking about the small computer you keep in your pocket or the room-sized clusters that do things like manage space missions, without software all of those circuits and wires and chips would do nothing. It even takes software to turn your phone on and start it up before you can see it doing anything. No matter how expensive or new the hardware inside your phone is, it would be useless without all the work that went into programming it to do something.

We're going to focus on Android with this because that's what we do here, but a lot of the ideas we're going to talk about are the same for any computer you can buy or make yourself. The biggest differences (and challenges) are that our phones are mobile devices that aren't very big, and that means everything is done with an eye for power efficiency. Extreme power efficiency. After the right parts are designed and assembled to try and provide the best user experience with a tiny power supply, it's time for the software teams to get to work.

What is Android

This is Android

Image credit: Android Open Source Project.

We've mentioned this before, but it's worth covering again — Android probably isn't what you think it is. The word gets used in quite a few different ways — Android is a brand, Android is an operating system and Android is source code. What Android is, at the basic level, is a bunch of code that can be used to run applications. It comes with a basic user interface to its core features but it requires a lot of time and development to make it run on whatever device it's intended to run on.

While everything you need to have to create a bootable software image is included in the Android source code, you can't create a single image and installer that can be used for all hardware. Support for the specific hardware needs to be declared before you try to build it into something that will actually run. Once that is done you can build a running Linux operating system and install it to the intended target.

Before you can ship anything, though, you'll need to tweak and twiddle a lot of it — that's what we mean when we say optimization.

The operating system

AT&T Galaxy S7

There are two levels of software — the operating system and its associated extras and applications that are installed to run on it. The people who made your phone not only have to worry about making the operating system perform well, but have to maintain compatibility with a million or so applications. Notice we said "maintain compatibility," not optimize anything for third-party apps. That's an entirely different matter, and Google does most of the work there with the Android application framework — all the phone manufacturer needs to do is try not to break any of it. And that is more work than you think it is, because of the way these companies change the way Android looks and feels.

Every Android model is running different software.

No two Android models are the same. Even phones from the same manufacturer with the same name can run different software in different regions (or for different customers — your phone company), and they do. And that makes sense. We don't have gigabytes of storage space so support for every different model of Samsung Galaxy S7 — there are more than 30 versions of that one phone — built into one piece of software isn't practical. This is why, for example, you can't download the Verizon update for the S7 and use it on your AT&T model. But outside of the small changes made for different SKUs of the same model, the base software used across every Galaxy S7 (with the Qualcomm CPU) is the same.

To keep with our Galaxy S7 example, you need to remember also that "Touchwiz" is not a skin or a launcher. It is the operating system. Samsung takes that base software provided from Google and changes it to better suit its needs. The way it looks, the features it has and the options and settings are all built by Samsung and added into Android in a way that will still allow third-party apps to install and run. There are a lot of parts of the Android code that Samsung doesn't alter (or can't alter) because Google requires certain things to be kept in order to use their store and applications. It's up to Google to improve and maintain those portions, but a large part of the operating system is left to Samsung to optimize for the specific hardware it is to be installed on.

What is optimization?

source code

Software optimization is a necessary evil. It's time-consuming and difficult. But without it, the user experience would suffer. Google continuously optimizes Android code on a hardware-independent level. Techniques like loop unrolling, using fewer function calls and more memory efficient routines are things that benefit every device that runs Android. But Samsung (in our example) has to further these for the hardware they are using to reduce the total instruction path length (the number of CPU cycles required goes down with fewer instructions) and reduce the memory footprint, as well as build on things like scheduling and cache optimization for their specific model of CPU. All while adding more features and functions to the user and maintaining compatibility with Google Play. Generally, the process goes something like this:

  • Decide what features your customers want. Then throw 80% of them away and decide what features are feasible.
  • Define the specific hardware that will be used.
  • Build a bootable version of the operating system with the required features all working.
  • Find the bottlenecks, try to fix them, rinse and repeat.

Finding those bottlenecks is difficult. Fixing them is even more difficult. And there are several ways to tackle it all. One way is to not add features to the operating system that create overhead, which gives you fewer things that can go wrong. That's where the 2015 Moto G shined. It was a very basic phone, with very basic software. After a talented team optimized the software that shipped on the phone, it was one of the most fluid Android experiences of the year — until you added a handful of apps from Google Play into the mix. Then it was apparent that the hardware inside wasn't as capable of doing many things at once as more expensive phones were. The hardware used was inexpensive so that the phone could be inexpensive, and the software optimization on just the operating system was excellent.

A second way is to continue to optimize your platform while not stripping out any important features, and letting better hardware help minimize the impact. The Galaxy S7 is a product of every bit of work the software development team at Samsung has done since the original Galaxy S was introduced, running atop hardware powerful enough to deliver it in a smooth and friendly package. The result is a phone that is universally praised by both the industry and users alike. Missteps with memory management and sluggishness we saw up and including the Galaxy S6 are all but gone, and whether you love or hate the final product you can't say that it's not one of the best Android phones you can buy today when it comes to performance.

Memory management

RAM management

We can't walk away from this topic without addressing memory management. It's one of those terms that gets thrown around because some people see some sort of problem when they are doing some things, and the bandwagon gets rolling. It can (and has) been a real issue, though.

The operating system decides when to kill (as in close and not run in the background) applications and processes that are stored in the RAM. Writing to and reading from RAM is fast — much faster than writing and reading from storage. But it's limited. Even a phone with 6GB of RAM still has to have parameters set for best performance. And not all of the RAM installed inside of your phone is available for the operating system to use. Portions are reserved for the kernel to run in, the GPU to use and the cellular radio. At boot-time, it's common to see at least 512MB (or more) of RAM in use and unavailable. That's a good thing — those functions need "instant" access to the CPU.

What's left is managed in a tiered way. Certain apps and processes have a higher priority than others, and they will be assigned to a higher tier than other, sometimes optional, things that are running in the background. When the total amount of free RAM shrinks to a pre-defined level, processes are killed according to priority. The goal is to keep as many things alive in the background as possible while leaving enough room to start new things. While those new things are starting, RAM is flushed until they have enough to load and a free buffer is maintained. That's why you hear people say "free RAM is wasted RAM" when talking about Linux — Android runs atop the Linux kernel.

Tweaking RAM management is a trial and error process. Then more trial and error. It's hard.

All these parameters (outside of the reserved area for the kernel) are adjustable by the people who built the operating system. They can decide how much RAM needs to stay free, and how much RAM can be used by each tier of processes. They also can write their software so that portions are assigned to a specific tier in the tree. A handy trick is to keep the launcher — what you see on the home screen(s) and application drawer — in RAM at all times. This means that the user interface for the things you're likely to spend the most time interacting with are always stored in the RAM and will be more fluid because no time is spent reading from storage and writing to the RAM when you are swiping and tapping.

Issues can happen when too much or too little RAM is kept free or too many things are "marked" as essential and kept resident in RAM. That's why, for example, you can start typing something into a form on a web page, switch to another app, and come back to see everything you wrote is gone because the page had to refresh. The system still will try to keep the things you use the most in RAM, but it's unable to do so.

This is all fixable, provided there is enough RAM installed. It's another part of the optimization process, and a difficult one to get right.

All Androids are not created equal

And we shouldn't want them to be. The software is tailored to the specific hardware used, and trial and error and Red Bull are part of the optimization process. This is part of what makes every Android phone unique and allows a choice for everyone.

Jerry Hildenbrand
Senior Editor — Google Ecosystem

Jerry is an amateur woodworker and struggling shade tree mechanic. There's nothing he can't take apart, but many things he can't reassemble. You'll find him writing and speaking his loud opinion on Android Central and occasionally on Twitter.