[OnePlus 3 & 3T Cross Device Development] jcadduono:
Team Win Recovery Project 3.0.4-1 (unreleased)

Notice #1: Please don't wipe your data partition if TWRP cannot decrypt it. Instead, make an effort to gather logs to help solve the issue!

Notice #2: Themes from 3.0.0 to 3.0.3 are incompatible with 3.0.4. Sorry! (small theme engine changes regarding backlight control)

This is a unified build for both the OnePlus 3 and the OnePlus 3T!

WARNING: The OnePlus 3 & 3T stock boot image has dm-verity, which prevents you from booting if you swipe to enable system modifications!

SOLUTION: Follow the full rooting steps below, in order, to allow system modifications without the risk of a boot loop!

WHAT IS TWRP?

Oh come on, you know what it is - don't try to fool me!

In case you're serious, though...

Team Win Recovery Project is a custom recovery for Android devices.

It allows you to back up and restore your data, flash custom ROMs to your device, repair broken file systems, and root your device.

Read more about TWRP here: https://twrp.me/about/

DOWNLOAD

You can find the device page here:

http://teamw.in/devices/oneplusthree.html

Use 3.0.4-1 for now, rather than the builds on twrp.me until an official release happens. You will have problems with 3.0.3 on Nougat!

For now, please download the build from:

https://build.nethunter.com/twrp/oneplus/twrp-3.0.4-1-oneplus3.img

Officially 3.0.4 has not been released yet, but it has critical fixes for this device on Nougat, so please be patient.

There is a download link there, as well as instructions on how to flash it.

You can find up to date fastboot & adb binaries here!

FULL STEPS FOR OBTAINING ROOT

Follow these instructions until someone nice comes along and makes a video from them (without ads):

Extract/install adb & fastboot to your computer.

Download TWRP for OnePlus 3 & 3T (oneplus3).

In your ROM, go to Settings -> About device. Tap 7 times on Build number to enable Developer options.

Now go to Settings -> Developer options. (above About device)

You need to enable OEM unlock, otherwise you might end up with boot problems or be unable to flash later on.

Reboot your device into fastboot mode. To do this, select reboot from the power menu and hold the [Volume Up] + [Power] buttons while your device reboots

or

boots from power off.

Once you're in fastboot mode, you need to unlock your bootloader. To do this, run the command:

fastboot oem unlock

WARNING: Unlocking your bootloader will erase all userdata on the device! Your device will be completely reset to factory defaults!

Once your bootloader is unlocked, you're ready to flash TWRP. To do this, run the command (replacing twrp.img with the actual image name):

fastboot flash recovery twrp.img

Once the image is flashed, you should use your volume keys to navigate to RECOVERY and the press the power key to select it.

At this point, you will reach the screen asking you if you want to allow system modifications.

By swiping right, you will trigger dm-verity, and if you don't follow the next step you will be unable to boot!

If you are going to root your device and follow the rest of these steps, then it is safe to swipe right and enable modifications.

If your device asks for a password to mount internal storage, and your password doesn't work or you haven't set one, see below under known issues for a fix!

If you want to be rooted with SuperSU:

Download the latest SuperSU Stable by Chainfire.

Without exiting TWRP, transfer the SuperSU zip to your device over MTP* and flash it using [Install] in TWRP.

---or (not both) ---

If you want to be rooted with something else or just want a bootable system:

Download the latest dm-verity and forced encryption disabler zip.

Without exiting TWRP, transfer the no-verity-opt-encrypt zip to your device over MTP* and flash it using [Install] in TWRP.

This will also allow you to use [Format Data] to completely disable your encryption if desired.

Go to [Reboot] -> [System].

Wait 2-5 minutes for your device to finish setting itself up. (SuperSU will reboot you a few times)

* MTP, known as Media Transfer Protocol, is the same way you transfer files from your PC to your device when booted into system.

UPDATING TWRP

To update TWRP, simply download the new twrp.img on your phone, then boot into your current TWRP and flash it.

To flash a twrp.img, navigate to [Install] -> [Flash Image] -> select your twrp.img -> [x] Recovery -> Flash!

After that, just use [Reboot] -> [Recovery] to reboot into the updated TWRP.

CHANGES

v3.0.4-1 (build.nethunter.com) - Fix crash when trying to reboot that resulted in TWRP restarting, CAF kernel updates

v3.0.4-0 (build.nethunter.com) - Capability restoration for Nougat, F2FS backport support, EXT4 decryption support

v3.0.3-0 (twrp.me) - Same as 3.0.3-1-rc2. In sync with the OnePlus 3T device tree (3.0.3-1).

v3.0.3-1-rc2 (build.nethunter.com) - Redo the device tree for OOS 4.0, including dynamic encryption support (pull libs from ROM)

FEATURES

MTP support

USB OTG storage support

Hardware Qualcomm-based full-disk encryption support

f2fs file system support (read, write, format, backup & restore)

exFAT file system support (read, write, format)

NTFS file system support (read, write, format)

ADB root

Full SELinux support

Built in android 6.0 tree

Allows OnePlus full OTA flashing

KNOWN ISSUES

F2FS takes a long time to boot, see below.

If your device is taking more than 10 minutes to boot, you probably have a misc flag enabled that disables passing cmdline, see below.

Reboot buttons don't work in TWRP (restarts TWRP) - disable Ask to install TWRP App on settings page, fix on the way. - fixed in 3.0.4-1

WHY AM I STUCK ON THE TWRP SPLASH SCREEN FOR 8 HOURS?

Be patient, wait another 8 hours.

Just kidding, try this while stuck on the loading screen:

adb shell wipe_misc; adb shell reboot recovery

Some devices might somehow get a flag set in misc that tells the bootloader to ignore the android boot image command line.

This results in the kernel not receiving the hardware name (qcom), which then confuses recovery and causes it to wait forever. FOREVER.

Personally, I'd have tried this after 15 minutes.

WHY DOES F2FS MAKE TWRP SO SLOW?

When TWRP boots up or wipes partitions and a few other scenarios, it checks each partition to see how much disk space is used. Ext4 handles disk usage calls quite efficiently and will finish this very fast. F2FS on the other hand is very slow when it comes to checking disk usage. We're unsure why this is. Every file on the F2FS formatted partition adds a little more time, and a device that is 30 GB full could take up to 10 minutes to boot TWRP!

I suggest switching your data partition to ext4 - all the f2fs hype is merely from benchmarks that don't actually represent real world use (ie. you're not writing thousands of files per second)

For someone who doesn't do lots of write access to their data partition, ext4 can actually be advantageous (it has faster access times and reads!)

WHY WON'T MY DATA DECRYPT / WHY IS MY PASSWORD INVALID IN TWRP?

In order for encryption to work in TWRP, it must pull the encryption libraries from your current ROM. It does this during TWRP boot logo. If you have no ROM installed, then it will fall back to the default OxygenOS 4.0.2 encryption libraries included in the TWRP image.

The crypto daemon in recovery will not be able to decrypt unless the version of the encryption key matches the version of the libraries. This is an unusual restriction that was added by OnePlus.

You can usually fix this by simply booting into your ROM and changing your boot up password. You can change it back or remove it if you want immediately after. This will generate a new crypto key which should be compatible when you next enter TWRP.

HOW DO I GET LOGS SO WHEN I COMPLAIN I'M NOT COMPLETELY IGNORED OR SHAMED BY OTHER USERS?

To get logs while in TWRP, you should connect your device to your PC and use adb.

adb pull /tmp/recovery.log

adb exec-out dmesg > dmesg.log

This will create 2 files in the directory your shell is currently in, recovery.log and dmesg.log. You will need to upload these somewhere such as a pastebin or Google Drive. You can also attach it to your XDA post (recommended!)

If you are having an operating system boot issue, you should gather a ramoops log instead. Do this while in TWRP after the failed boot:

adb exec-out "tar c /sys/fs/pstore 2>/dev/null" > pstore.tar

CONTACT & SUPPORT

You can find us on IRC at #twrp on chat.freenode.net.

You can also post in this thread and I will attempt to answer any questions you may have.

SOURCE CODE

TWRP: https://github.com/omnirom/android_bootable_recovery (android-7.1)

Device tree: https://github.com/TeamWin/android_device_oneplus_oneplus3 (android-6.0)

Kernel: https://github.com/jcadduono/android_kernel_oneplus_msm8996 (twrp-7.0)

CONTRIBUTIONS

Gerrit for TWRP: http://gerrit.omnirom.org/

Gerrit for officially supported devices: http://gerrit.twrp.me/

XDA:DevDB Information

Team Win Recovery Project for the OnePlus 3 & 3T, Tool/Utility for the OnePlus 3

Contributors

jcadduono, Team Win

Source Code: https://github.com/jcadduono/android_device_oneplus_oneplus3

Version Information

Status: Stable

Current Stable Version: 3.0.4-1

Stable Release Date: 2017-01-21

Created 2017-01-23

Last Updated 2017-02-07