One doesn't usually associate the concept of dual booting with smartphones. Usually, the feature is reserved for power users who want to get the best of two separate platforms on a single device. It makes sense with a device like a MacBook, as Apple lets you install Windows on it without any difficulties, and switching between the two is fairly easy. While it is technically possible to dual boot two ROMs on a smartphone, it isn't 'true' dual booting, meaning that switching between ROMs requires a fair bit of work every time. Now, the developers of popular custom recovery tool TWRP have developed a special version of the application that lets OnePlus 7 and OnePlus 7 Pro users seamlessly switch between two ROMs on their devices.
A brief history of dual-booting ROMs on Android phones
Dual-booting has been around on Android since as early as 2015. Some of the early solutions involved using tools such as MultiROM, SafeStrap, and DualBoot Patcher. MultiROM, as the name suggests, lets you sideload multiple operating systems onto your device. Even the (long dead) Firefox OS and Ubuntu Touch worked fine on compatible devices. However, MultiROM's development has been mostly dead, and the list of devices supported officially is over five years old at this point, but you can still install it on your OnePlus 5. Take a look at MultiROM in action (via XDA Developers)
Android Nougat introduced us to the concept of A/B partitions
Before Nougat, Android phones came with just one primary partition which contained everything ranging from the kernel to the user's data. Nougat split that up into an 'active' and 'inactive' partitions. For example, your phone could be running Android 9.0 on the A partition, and the B partition would remain inactive. Once you download and install an update to Android 10, that would be installed on the B partition. Upon successful reboot, the phone would now deem the B partition as primary, as it has newer software, and the A partition would be the inactive one.
There are several advantages to this approach. For starters, it lets your device fall back to a stable software version, should you install a botched update. It also has a host of other advantages, and one of them was that it made dual-booting ROMs a lot easier. Naturally, OEMs won't allow users to dual-boot ROMs willy nilly, so the process is still fairly difficult.
OnePlus 7, OnePlus 7 Pro and OnePlus 7 Pro 5G need a custom version of TWRP to be able to dual-boot
Team Win Recovery Project aka TWRP —one of the most versatile custom recoveries out there— works fairly well with devices that have A/B partitions. Developers have also made it possible to create a third C partition; one that is accessible via both the A and B partition. It has modified for true dual-booting by splitting the 'Userdata' partition into A/B slots. There is even a script that lets you choose which ROM you want to boot into.
The process is fairly cumbersome, and you'll need a rooted phone with an unlocked bootloader to get started. The developer also recommends that you should have a stable version of TWRP running on your phone in order to install the modified version. Additionally, it is best if you install the modified TWRP file via ADB sideload. Once you sideload and install the ZIP, you'll be greeted by a lot of prompts, and it is important that you go through each one thoroughly. You can read more about the process in its entirety on this forum post.
News Source: XDA Developers