Project Mainline for Android 10: What it is, what it isn't, and how it works
Android is a fantastic bit of software. It brings a good mix of convenience and security features to the table as well as power-user features that nobody would have ever imagined having on a phone just a few years ago. It really is a leap forward towards having a complete personal computer in your pocket.
A big part of the reason it can do this is because of the smart people who write the code. Google maintains Android's code, but the project is open source and filled with juicy features and functionality from names like Samsung, Motorola, LG, Huawei, and even Microsoft and Apple. From the low-level code that crunches all the numbers to make all the things work to the rounded icons and animations, Android is the product of the people and companies who know mobile best.
The open source nature of Android has also accomplished something else; a thing that's not so elegant and pretty: fragmentation. When 100 different companies grab the source code and build 100 slightly different versions of Android, keeping the devices all up to date is a mountain of work. It also depends on the company who made a phone because technically they also made the operating system. The extra cool features that phone manufacturers add are a double-edged sword — they make the software better, but they also make updating it a lot more work.
Google has done a lot to try and tame Android updates and make them something that it can manage on its own. Project Treble was an initiative to help companies that make component microprocessors like Qualcomm and NVIDIA able to update their portions of software quickly, and it worked really well. Android Pie adoption is 2.5 times higher than Android Oreo over the first months, and security patches reach 84% more users now. That's an impressive turnaround in just a year, but Google has higher goals with Project Mainline.
Mainline is a way to update the core parts of Android directly from Google in a way that you already are familiar with: the Google Play Store. It's a lofty goal, but I think it's going to help.
What is Project Mainline?
Mainline is another change that will help Android phones get critical and essential updates a lot sooner because none of the changes will require a system update from the phone manufacturer.
You might be familiar with seeing a security patch come in or even a version update and installing it through the notification. That update required a lot of work. Google and all of the OEM partners made the changes to the base Android code, the company who built your phone made changes so it all worked with their version, then it was tested and sent out as an over the air update. While some changes require so many hands working on them, others are behind the scene changes that really don't need so many developers working on them. Google made the changes already, so if they were just able to plug right into every phone, two things happen:
Get the top Black Friday deals right in your inbox: Sign up now!
Receive the hottest deals and product recommendations alongside the biggest tech news from the Android Central team straight to your inbox!
- You get updates for security and bug fixes, as well as functionality enhancements, a lot faster.
- The company who built your phone doesn't have to spend time and resources doing work that has already been done by Google.
Building something like this wasn't easy. Android wasn't designed in a modular way in the beginning, so converting things took a lot of time and work. It also required a change or two in how a phone expects these core components to update. It's also really cool from a software development standpoint; seeing Google work so hard to "fix" the mistakes of the past is fascinating.
How does Mainline work?
Mainline takes 12 core components of Android and makes them a little more modular. Previously these components required a full system update if any changes were made, but with Mainline they can be updated through the Play Store. Google breaks these 12 components into three categories:
- Security: Media Codecs, Media Framework Components, DNS Resolver, Conscrypt
- Privacy: Documents UI, Permission Controller, ExtServices
- Consistency: Timezone data, ANGLE (developers opt-in), Module Metadata, Networking components, Captive Portal Login, Network Permission Configuration
These are low-level functions that need to be working right in order for your phone to work at all. We can already update things like the camera app or the keyboard through Google Play, but those are apps that run on top of these bits of code. In fact, these things are fundamentals of the operating system that should never need to be customized by the company who built your phone. It makes sense for the updates to come directly from Google, but there was never a way to do it before.
Mainline brings a new file container that Google calls APEX. It stands for Android Pony EXpress, and the files are distributed the same way an app is. You see the update in the Play Store and tap the button or have automatic updates enabled, and it downloads to your phone where a bit of software that knows how to handle them gets to work.
Once that happens, though, things get a lot different. Where an app is just scanned for integrity then copied to the correct place on your phone's storage, APEX files actually decompress into a miniature system image which is mounted and put to work to make sure everything is kosher. Then the right files and data are moved from that image to your phone's actual system, the APEX image is unmounted, and the image gets tossed out. It's a novel way to overcome a problem that has plagued Android forever.
Here's the coolest part — companies like Samsung who is heavily invested in Android work with Google to make sure these updates are going to work with its devices. Every other OEM is able to do the same. That means you shouldn't ever get an update that makes things worse. In fact, you should never notice that you got an update at all if everything goes right.
Because not everything will go right all of the time, there are some safeguards in place. If things don't work as expected, the new software inside the APEX file isn't applied. If some bug surfaces after everything is installed, google's gradual rollout system does its job and halts the update until it can be fixed. If you were unlucky enough to get the "bad" update, your phone just reverses the changes through a backup that's kept by the system. And you still should never know anything happened unless you want to.
Google has tried and tried to get a handle on Android updates for years. Plenty of the things it has done worked, but not well enough — nobody wants every Android phone to be on the latest version more than Google does. It's important for the two billion or so Android phones to all be using the same set of software APIs and have the same core features. Project Mainline looks to be more than a Band-Aid and should do a lot to reach that goal.
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 Threads.