Saturday, September 17, 2016

EXCLUSIVE: Pixel Software Updates, Partition Changes, Dual Booting & Seamless Custom ROM Updates

During this year’s Google I/O, Google officially introduced Android Nougat which has brought several much-needed usability enhancements to those of us lucky enough to own a modern Nexus device. There were some features Google outlined during Google I/O that didn’t find their way into final Nougat production builds for current Nexus devices, most notably seamless updates.

Many users were disappointed by the revelation that seamless updates would only be present on devices that ship with Android Nougat, but for those of us planning on upgrading to the next Nexus Pixel devices we have an awesome new feature to look forward to. However, since Google I/O we haven’t really seen any additional details about this new feature.

That hasn’t stopped some of the more inquisitive among us from figuring out how exactly Google plans on making seamless updates work, though. Ethan Yonker, who goes by the screenname Dees_Troy and is best known for his work as the lead developer on the Team Win Recovery Project, dove right into the Nougat source code released by Google in order to understand what he’s dealing with when the Pixel devices are inevitably released. Google has made some interesting changes to the partition layout of the upcoming Pixel devices – and with some crafty work by the developers on our forums, Dees_Troy surmises that dual-boot may be possible.


Google’s Pixel Phones and their Partitions

Partitions

Nexus 6P Partition Table

In case you aren’t aware, your phone’s storage is divided into several standard internal memory partitions. The partitions you’re probably most familiar with are /boot, /system, /data, /recovery, and /cache, though if you’re interested you can look up the actual partition table on your device. The amount of storage space available to you, the user, is determined by the size allocated to the /data partition. On the other hand, /system is where most of the Android operating system files reside. Resizing these two partitions to appropriate space for more user apps or perhaps a new version of Android is definitely possible, but the process can be risky and in general isn’t something you should ever expect out of your device.

I’m greatly simplifying how updates work, but generally when you update only files within /system are modified and updates are applied at the block level, so that dm-verity is left unbroken. What you know as a “dirty flash” involves flashing a new ROM’s system files on top of your current ROM’s system files, without performing a factory reset. On the other hand, a “clean flash” involves updating both your /system and your /data partition (without touching /data/media, which is where your pictures, music, documents, and other personal files reside).

Whenever you are updating your device, you generally aren’t able to actively use it at all. Instead, you have to wait for the recovery to modify all of the necessary files within each partition. This is to prevent any potential issues from the Android operating system attempting to access a file that is currently being updated, but on the flip side means that users have to sit through several minutes of watching the Android recovery logo apply an update.

 Before Android Nougat, each device would only ever ship with one copy of each partition. This makes sense for most Android smartphones – storage space is at a premium (or so we’re led to believe), so why bother with the redundancy of multiple backup partitions? The answer to that is seamless updates. Google’s other foray into operating systems – Chrome OS – has proven to be wildly successful. Android actually borrows the concept of seamless updates from Chrome OS. Chrome OS achieves seamless updates by updating a set of redundant, inactive partitions in the background and then immediately swapping these partitions with the currently active ones before booting.
Chrome OS Update Workflow

Chrome OS Update Workflow – Presumably Android will follow something similar

Initially, we believed that phones shipping with Nougat pre-installed would only come with a secondary /system partition. According to Dees_Troy, the Pixel phones will ship with two copies of most, if not all partitions on the device.

The new Pixel phones will have 2 system partitions, 2 boot partitions, 2 vendor partitions, 2 modem partitions, etc. One set of partitions will be active — the set of partitions that are currently used to boot the device. When an update is published, the update will be applied to the second set in the background. Once the update has been applied, a prompt will appear asking to reboot. The reboot will not include booting to recovery. Instead, the device will switch which set of partitions are used to the second set and you will quickly, perhaps nearly instantly, boot an updated device. – Dees_Troy


Dual-Booting Pixel Phones and Seamless Custom ROM Updates?

With two copies of every partition, Dees_Troy predicts that we may be able to hijack the second set of partitions to dual-boot. If you are on one of the very few devices that supports the MultiROM project, you may be familiar with the prospect of dual-booting ROMs. If you’ve messed with MultiROM before, then you’re definitely aware that the methods that they use are basically one giant set of hacks to get it working on Android. In every XDA thread providing MultiROM on a device, there is a large disclaimer near the top warning users that “none of these systems are made with multibooting in mind” which that “it is possible that something goes wrong and you will have to flash factory images again.” But with Google graciously providing us with a second set of partitions to work with, Dees_Troy expects that we may be able to get dual-boot running on the Pixel phones with some cooperation between various members of the ROM community.

If we can hijack the second partition set to dual-boot, then we could also potentially use these secondary partitions to implement seamless updates for custom ROMs as well. So if you’re one of the many dedicated Cyanogenmod nightly users, then you may be able to update to the latest nightly without having to reboot your phone into recovery every night. Even though TWRP’s Open Recovery Scripting and the various delta updating tools have greatly reduced the time and effort required to perform a nightly update, seamlessly updating your ROM in the background definitely beats out all other options.

Do note that we can’t be sure these features will work until we actually have working devices in hand, but given Dees_Troy’s extensive work on TWRP and his research into Nougat’s source code, we believe that this speculation is highly credible.

While all of these upcoming and probable features sound positive, we also uncovered a lot of changes that complicate development on upcoming Pixel devices. We’ll be detailing these in another article scheduled for tomorrow, but in the mean time please keep your hype in check!

HostGator Web Hosting

0 comments:

Post a Comment