[OnePlus 3T Guides, News, & Discussion] shadeau:
[IMG="Dual Boot Patcher Logo"]https://dbp.noobdev.io/res/images/logo.png[/IMG]​

I have looked around and haven't seen anyone mention this so I thought I would post about it. I hope others find this useful. I've used this tool on my Galaxy Note 4 to have two different OS's running (mostly due to bluetooth problems on CM, but I digress). This allows the user to dual boot and maintain safetynet with Magisk. I've used this a lot and was really excited to see that it is compatible with this amazing phone!

The thread that caught my interest on the subject (for Note 4): http://xdaforums.com/note-4/general/dual-boot-n910f-snap-dragon-variant-t3065211

The original thread quoted by [MENTION=5132493]aukhan[/MENTION] (for S4, but most of the discussion is here too): http://xdaforums.com/showthread.php?t=2447534

All credit goes to the original developers for this tool, I had nothing to do with its development. This thread is made to troubleshoot our specific device without clogging up their threads for other devices.

Thanks to [MENTION=5132493]aukhan[/MENTION], [MENTION=3145598]rlorange[/MENTION], [MENTION=4277844]chenxiaolong[/MENTION] , and other contributors.

Download the Dual Boot Patcher snapshot apk from here. That is the only app that you should need to complete the process. Click on the latest build link and then click on the android file that ends in "snapshot.apk". The snapshots are the recommended version at the moment.

I made a video walkthrough of this process for the Note 4. A lot of it is similar, but I will try to get a new video up for the OP3T when I have time.

Basically you patch all of the .zip files that you would have flashed normally and then you flash them to a new ROM slot. If there are more questions that the video and my more specific instructions below don't answer I'll be happy to answer them or post a better walkthrough if needed.

It should be noted that to switch back and forth you'll need to install the Dual Boot Patcher apk on both ROMs. This does not affect TWRP Recovery.

So far I've only done this once on the 3T and I haven't had any issues. Obviously the 5 second delay is a little annoying when booting between ROMs, but I can get over that. I currently have RR Official installed as my primary with Open Beta 6 as my secondary. Normally the stock ROM is recommended for the primary boot slot, but this seems to work fine.

More Specific Instructions for recommended Data Slot:

1) Download all .zip files that you would flash if you were going to flash the ROM normally (ex. LOS, Gapps, SuperSu, XPosed, kernels, etc)

2) Download the Dual Boot Patcher apk: https://snapshots.noobdev.io/, install it on your phone, set the kernel, and update the ramdisk (ROMs page, three dots on Primary, scroll to bottom)

3) Open Dual Boot Patcher app and tap the three lines in the upper left then select "Patch Zip File"

4) Tap the plus button and find each of the .zip files that you will be flashing. After selecting one make sure to change "Partition Configuration" to "Data slot" and enter a number (be consistent with each file). Push continue.

5) A file browser will now open. Navigate to the place you'd like to save the file and select the location.

6) You may now repeat steps 4 and 5 to add the rest of the zip files

7) Tap the check mark in the upper right to "Patch" all of the .zip files

8) Tap the three lines in the upper left again and select ROMs

-Installation

--Option 1

9) Tap the phone icon in the lower right and push okay

10) Tap the plus button in the lower right and navigate to where you saved your patched files. Select the main ROM (the ROM you want to dual boot to) and tap "keep location" (this will put all data in the location it specified ie /data/multiboot/data-slot-1 for this case)

11) Repeat step 10 until all zips are added in the order you want them flashed (the order is important so get your ROM before your Gapps etc). If you mess up swipe the one that's in the wrong order to the right to remove it from the list

12) Tap the check mark in the upper right. A console should appear and it should virtually flash the ROM as you would expect in TWRP

13) Once it says "x/x completed" in cyan text and it has stopped you can just tap the back arrow in the upper left

14) If you go back to the ROMs page there should now be a "Secondary" ROM. To test it out you'll need to select it and then reboot the phone.

15) Once it has booted and you are past the setup you'll need to enable "unknown sources" in the menu and install Dual Boot Patcher. Once it's installed, open it. It should find the two ROMs and you'll be able to select Primary from the ROMs menu and reboot back

--Option 2 (best if your ROM doesn't report your device name like RR)

9) After patching the files reboot into TWRP

10) Flash the patched files like you would normally flash a ROM (order is important so flash the ROM before Gapps, su, etc)

11) Once the process has completed reboot into system

12) Since you haven't selected the secondary ROM at this point it should boot to your primary ROM (although I can't remember at the moment). Open Dual Boot Patcher, select the ROMs page, select the secondary ROM, and reboot your phone

13) It should reboot to your newly installed ROM where you can set it up and install DBP to boot back between ROMs.

This process can be done using any of the partition configurations listed when patching a Zip file. Secondary and Multi Slots go to the System partition and data slot goes to internal storage. I recommend not using the Multi Slots since more than two ROMs is a lot on the system partition. I would recommend the data slots.

If you have problems make sure to set the kernel and update the ramdisk before flashing

In the event of a bootloop you can recover your primary ROM by entering TWRP, tapping install, selecting image in the bottom right corner, navigating to the /sdcard/MultiBoot/primary folder, and selecting the "boot.img" file. This will return your phone back to the primary ROM.

There is a multiboot.log file that is very useful for debugging. Please post it if you have issues (found in the /sdcard folder)

If you later want to flash anything to the ROM that you're "dual booting" into then all you have to do is patch the zip files and flash them like before except you're flashing to a slot that already has a ROM now.

Tasker Integration

I've been using RR as my daily driver, but the BT doesn't work in my car. I did a lot of research to enable ROM switching in Tasker so that I could easily switch over ROMs when I get into my car. I use my android watch to trigger the task into my OOS ROM and then when BT disconnects I have it trigger a task to switch back to RR. Here it is:

Add action>system>send intent

Under "Action" enter

com.github.chenxiaolong.dualbootpatcher.SWITCH_ROM

Under "Cat": Default

Under the first "Extra" enter

rom_id:primary

(change primary to dual or whatever your other slot name is)

Under the second "Extra" enter

reboot:true

(this tells the app to reboot right after switching the ROM to the desired one)

Under "Target": Activity

I have found that the intent will trigger if the phone is locked, but won't do anything until the phone is unlocked. With swipe or smart lock enabled you can use secure settings to wake the screen and then run a shell with root to swipe up on the lock screen (Command: "input swipe X1 Y1 X2 Y2" replace the X's and Y's with numbers for your screen. Use developer settings to figure out where the start and stop should be.)

All of this allows me to trigger a ROM switch and reboot from my watch without taking my phone out of my pocket (i.e. while driving).

Backup/Restore/Move ROMs from/to specified slots

Edit: Turns out I didn't look hard enough. There is a thread that has already been created to discuss this tool on this wonderful phone and it fixes an issue where some ROMs with 3/3T support won't flash in dual-boot.