Along with many other security-related updates, Android Q also changed how system partitions work for the Pixel 3 and 3a to allow the seamless installation of Generic System Images through dynamic system updates and improve general system safety. A side effect of these new logical partitions is a complete shift in the way root access can be enabled. Previously, Magisk developer John Wu stated that this would mean that Android Q couldn't be rooted on newer devices for quite some time going forward. But as always, Wu surpassed himself and announced that he achieved the first working full root on a Pixel 3XL running Android Q Beta 4.
It turns out I've done everything correctly yesterday. Just some stupid typo 🤪. So here you go, the world's first logical partition root, full Magisk support on Q beta 4, Pixel 3 XL. pic.twitter.com/z50JbJDMgw
— John Wu (@topjohnwu) June 29, 2019
At first glance, the new logical partitions give developers a lot of advantages. Before, they had to unlock their phone's bootloader and wipe their main partition to install Generic System Images (GSI), which allows Project Treble-enabled devices to run the latest AOSP version of Android for testing purposes. The logical partitions enable people to install GSIs without jumping through these hoops — not even the bootloader needs to be unlocked, and the original installation of their OS isn't touched and remains ready to be used on another partition.
The new layout makes it harder to root devices the classical way. In fact, A/B (or system-as-root) partitions like these exist since Android 7.1, but up to Android 9, it was possible to revert to the old system partition layout initramfs rootfs that makes rooting easier. Android Q doesn't support this legacy solution anymore, so finally, a proper way to root A/B partitions had to be established.
John Wu found a way to root dual partitions natively by changing how root access is achieved in the first place. Instead of importing the root directory at install time (as SuperSU did), John Wu wrote his own solution, MagiskInit, which dynamically adds the root directory to the system partition every time the device boots. This allows devices with A/B partitions (which naturally change their system/root partitions to update the system between boots) to be rooted without reverting them to the old system layout.
What makes this new method so significant is that rooted devices could support seamless system updates going forward, although that remains to be seen (this version of Magisk is in early alpha testing, after all). Also, the Pixel 3 and 3a are only the first devices coming with logical partitions — more devices should move to this new structure in the future, so they are going to profit from this new method as well. If you're interested in the technical details, you can read through his commit description in Github, but the most important information for us regular folks is, hurray, root will work on newer devices with Android Q.
- XDA Developers