One of the coolest features Google showed off at Google I/O 2016 that will be part of Android 7.0 Nougat are seamless updates. While it's not going to be flashy or have much to show on the user-facing side, the details on how it's done are interesting, and actually so simple you wonder why it took so long to happen.
Let's have a look.
What are Seamless Updates?
The way Android updates work up to Marshmallow involves some user interaction and takes plenty of time. You get a notification that there's an update waiting for you, and when you say OK it begins to download. Once you get everything downloaded, the one big file unpacks itself in the cache partition and the system checks the integrity of all the individual image files to make sure they are all signed with the correct key and came from the right place. You're then prompted to reboot, but not into Android.
You end up in the device's recovery software where the images are flashed to the correct places on your phone's internal storage. This takes a fairly long time because of the way the files are copied and moved — it's a bit-by-bit transfer. The files actually are moved to memory in chunks, erased from their original position and rewritten to the new position. This is the best way to make sure nothing gets corrupted while it's being installed.
Once everything is in place, your phone reboots and you wait for the runtime component to look through the system and "upgrade" your apps to the latest version. What it's doing is optimizing the apps for the specific version of the Android runtime. Android apps don't run from the single file you download and install, and are pre-compiled into odex files. That way apps can load faster and the boot process (not counting the first boot after and update) will be much faster.
Then you get to use your phone again.
While most of the time for most people the 10 to 15 minutes it takes to upgrade your operating system doesn't cause too much trouble, any way that can minimize downtime is a better way. Your phone should be available in case of an emergency whenever you need or want it to be available. Enter seamless updates.
With Android 7.0 Nougat, your phone can (not will — more on that later) update like Chrome OS updates. All the downloading and copying of files is done in the background while you're using your phone, and once it's finished you will be notified that your system will upgrade the next time you reboot your phone. And changes to the runtime compiler mean that you won't have to sit through the process of updating all of your apps when you reboot.
That sounds cool — how does it work?
Seamless updates work by having two different system partitions on your phone. When using a phone that can perform seamless updates, all the unpacking and transferring is done while one system partition is running, and things are copied and moved into the second partition. The way Android is divided into individual partitions means the data portion — where all the information you've entered about an app, things like address books or settings or game save progress — are stored in a separate spot outside of the place where the actual system files live. This is good for system security (the data partition can have its own set of file and folder permissions) and it makes things pretty convenient for seamless updates.
Once all this is done, you can reboot and use the new system partition. This is done without moving the partitions or renaming them because they are numbered. A configuration file used during the boot process (equivalent to /etc/fstab for the Linux nerds in the house) is read that tells the kernel and boot process where each partition starts and stops. This file is changed to point to the new system partition instead of the current one. The next time you update, the other system partition will be wiped and used. They swap back and forth seamlessly.
This isn't new. If you have the Chrome browser on your computer or have a Chromebook, this is exactly how those systems or apps update. But it's new for Android and does two things. It keeps you from having too much downtime (and there are plenty of folks who will dismiss an upgrade notification because they don't want to fool with the current process). And it is better for security because it can happen automatically when you reboot your phone.
Other important stuff to know
- Seamless updates aren't a requirement for manufacturers. Your existing phone isn't partitioned correctly and won't be able to perform seamless updates. And you don't want a future update to try and repartition it — the internal memory was designed to have its record (a map of where each partition lives) written once and never changed. That means the people who make your next phone might not use the seamless update feature because they don't have to. We know that the 2016 Nexus phones will have it enabled, but nothing beyond that.
- There should be some opt-out settings so the process isn't automated if you don't want it to be. I don't have the full details but I was assured by Google that there will be a setting of some sort. This won't be a Windows 10 style fiasco. We'll find it and tell you where to look as soon as we have a phone that uses it in our hot little hands.
- This will use more space on your phone's internal storage. It uses a complete second system partition. Expect a couple of gigabytes to be used and reserved for it.
This is just one of the many great under-the-hood improvements that come with Android 7.0 Nougat. We'll talk more about the changes and what to expect in future instalments of this series, and you can head into the forums to discuss it all.
Get the Android Central Newsletter
Instant access to breaking news, the hottest reviews, great deals and helpful tips.