[Google Pixel 2 XL Guides, News, & Discussion] Felosis:
Intro

I decided to put together this all-in-one guild compiling all the research and testing I've done. I've seen a lot of the same questions and misunderstandings come up over and over in the various threads, most of which I had myself. I've spent lots of time, since I got my new Google Pixel 2 XL, searching XDA, following all the guides the fine folks here put together, flashing, restoring, testing, etc. I've been using Android since my Google Nexus One, so I've been messing around with all this for quite some time now. The Android community is amazing and I've learned a lot over the years, so it's my turn to hopefully help someone out. :D

I'll also share some of the caveats, issues and fixes I had to do with this setup. This was all done with a Google Pixel 2 XL on Project Fi with an eSIM & physical SIM, so this guide was written and tested with that, however it should work the same in theory with other carriers, but your results may vary.

NOTE: I am not a developer by any means. I've toyed with creating my own custom ROM, but I'm not a ROM or Kernel developer. I just got really good at using the stuff the other amazing smart people here developed and shared with the community.

NOTE 2: Following these steps WILL wipe your device, so make backups if needed!

Thanks

I would like to give thanks to the following folks for the guides, development and help; [MENTION=4470081]topjohnwu[/MENTION], [MENTION=6842057]nathanchance[/MENTION], [MENTION=912474]Dees_Troy[/MENTION], [MENTION=8472040]luciusfox[/MENTION], [MENTION=3297454]thedude420[/MENTION], [MENTION=3563640]Quinny899[/MENTION], [MENTION=2690621]airmaxx23[/MENTION], [MENTION=2988397]matt1313[/MENTION], [MENTION=1434592]sharkie405[/MENTION], [MENTION=5346465]Tulsadiver[/MENTION], and [MENTION=6398836]zachman1750[/MENTION]. Please forgive me if I forgot to mention you directly as I've gone through many threads and guides at this point. I also thank the community for helping each other out and providing their experiences and testing as well.

Why Root?

I get the same question from everybody all the time, "why do you root your phone?" Well, many reasons, which I'll list a few below, but because I spent a lot of money on my phone and I feel I should have full access to it. If your phone is leased or company owned, I understand why you wouldn't, but if you own it outright, why not have full access to do what you want with it? I mean, how would you feel if you purchased a computer (I'll use Windows in this analogy) and it came with one user account that was only part of the "Users" group, no local Administrator or account part of the Administrators group and no way to grant your one user account Admin rights? I'd be upset as I wouldn't be able to do much with it including; remove bloatware, install my own applications, replace the stock AV/Malware software, upgrade my video driver or even start from scratch. I mean the first thing I do when I get a new computer is format the HDD lol. I know it might be a silly analogy, but I don't see how it's any different than having root access on my phone.

- Remove bloatware (system apps you don't want/need)

- Custom Kernels (though the stock kernel on this phone is amazing out to the box, custom gives us more access to manage wakelocks, color control, vibrations, among other kernel items) (EXKM and Kernel Adiutor are a couple great apps to tweak your custom kernel)

- Customer recovery (easy backup/recovery, easy flashing of Zips, etc...)

- Untethered system theming including; custom fonts, launcher tweaks, status/navbar tweaks, etc...)

- System wide ad blocking

- Full system backup/restore (Titanium Backup is amazing for full system backups and then upload to cloud storage of your choice)

- Terminal root access (every have horrible battery drain and can't figure out exactly why quick and easy? Drop to terminal, elevate using su, then run top and and see what app is hogging the CPU)

- Xposed modules for system customizations (I've used a lot over the years, but not on this phone yet. You will also FAIL SafetyNet if you use the Xposed Framework.)

- AUDIO MODS! I honestly don't know how I lived my life without apps like ViPER and Dolby on my phone

A/B Partitions

To hopefully help clear up some confusion here, I'll list some important points to take note of. :)

- The whole point of the dual partition setup is to make OTA updating easier, allowing for updating the OS in the background

- There are two system, two boot and two vendor partitions, but only one data partition

- Only one system and its corresponding boot partition are active at one time

- Whichever system/boot partition is active will use the one data partition

- Flashing a custom kernel, mod zip or Magisk will flash to the current active slot from recovery, however flashing the Google Image or a custom rom will flash to the inactive slot

- The recovery is part of the boot partition, meaning anytime you flash the stock or custom kernel, for example, you'll need to reflash your custom recovery again (unless you install a kernel zip created with AnyKernel2 by [MENTION=4544860]osm0sis[/MENTION])

My Build

Sharing these details as if you are on a different image, kernel, carrier, etc... your results may vary.

Phone: Google Pixel XL 2 Black 128GB - purchased from Google Store / Hardware Version: rev_10

Carrier: Project Fi with eSIM & physical SIM

Android Version: Official 8.1.0 / Security Patch Level: February 5, 2018

Build Number: OPM1.171019.018

Kernel: 4.4.119-FlashKernel-Taimen-v2.20 (clang version 6.0.0)

Root: Magisk Manager 5.6.1(105) (patched dtbo NOT preserving "force encryption" or "AVB2.0/dm-verity") & Magisk 16.0(1600) / Modules: Busybox for Android NDK 1.28.1, Magisk Manager for Recovery Mode (mm) 2018.1.31, Single User Mod 1.4, ViPER4Android FX Materialized 1.5.1 (2.5.0.5)

Recovery: TWRP 3.2.1-0

APKs: SELinuxModeChanger v11.0, AdAway 3.2-60, Dolby, MinitBatteryResrouces

Convenient Play Store Apps: 3Minit Battery Settings, FiSwitch, Kernel Adiutor, Light Manager, Root Explorer, substratum (Swift Black), TiBu Pro (I do scheduled backups of my phone to my Google Drive) & Terminal Emulator (great to use Busybox commands like "traceroute" or "top" to find that app killing your battery!)

Android Platform Tools Install

1. Download the latest version for your computer OS (PC/Mac/Linux) from Google: https://developer.android.com/studio/releases/platform-tools.html

2. Unzip the downloaded file to your hard drive somewhere and:

- Windows: add to your PATH (google "add adb to path")

- Mac/Linux: From terminal of your choice "sudo install adb /usr/local/bin && sudo install fastboot /usr/local/bin" (run from within the extracted directory and enter your password when prompted)

- Windows 10 & macOS High Sierra detect the phone automatically, but older versions you may need Android Device Drivers. Just Google what you might need and how to do it if your phone is not detected automatically.

Unlocking

1. Turn your phone off.

2. Press and hold Volume Down, then press and hold Power.

3. Plug your phone into your computer.

4. From command prompt/terminal on your computer (run Command Prompt as Admin in Windows throughout this guide):

- fastboot flashing unlock

- fastboot flashing unlock_critical

NOTE: I've read a lot of back and forth on if we should unlock_critial or not. This is just my opinion, but if you're here to do all this stuff to your phone, want complete access to do whatever you want to it, just do it. It's better to be ready now for the future because every time you unlock or relock, it will factory reset your phone. I've been unlocked both regular and critical since the first boot when I took my phone out of the box. I'll also mention, I’m not entirely sure what steps will work or not work in this guide if you don't since I've never not been unlocked with critical.

5. Follow the instructions on the phone screen to do the factory reset.

Clean Start

1. Download the "taimen" for Pixel 2 XL factory image [8.1.0 (OPM1.171019.018, Feb 2018)]: https://developers.google.com/android/images

2. Turn your phone off.

3. Press and hold Volume Down, then press and hold Power.

4. Plug your phone into your computer.

5. Unzip the downloaded file to your hard drive somewhere and from the directory you extracted the files (CMD/Terminal):

- Windows: flash-all.bat

- Mac/Linux: ./flash-all.sh

- Unplug your phone from your computer

Initial Config/Prep

1. Go through the initial phone setup steps.

- Make sure you setup your Google account so you have access to the Play Store and you can activate your eSIM if that's what you're using.

NOTE: When setting up with only an eSIM, I ran into some bugs and caveats I had to figure out on my own as Google support couldn't figure it out let alone understand what I was trying to explain to them. I ordered a physical SIM and now have both an eSIM and a physical SIM installed and can switch between them.

Verizon SIM: As [MENTION=4345388]jrbxx7[/MENTION] was kind enough to share below; if running a Verizon SIM, wait till after setup is complete before inserting it. That way the vzw apps don't get installed on google setup.

eSIM Caveat: If you have 2 Step Authentication turned on for your Google account and your phone is your only device with the Google Authenticator App or Google Prompt, you will have to use one of your backup codes to log back into your account as your phone will not be activated until it's completed in the Project Fi application.

eSIM Bug: After you go through the initial phone setup, let Play Store finish its updates and don't reboot yet. Open Play Store and search for "Project Fi", then click "Enable", but DON'T update it. Just open Project Fi, complete the activation then reboot your phone. You can update the Project Fi app after the activation is successful. I've tested this through three factory restores and the result is the same every time.

Physical SIM: No issues since your phone will just be activated after boot so you can receive SMS codes.

2. Enable Developer Mode: tap "Build number" under "About phone" 7 times.

3. Under "Developer options", enable "USB debugging".

4. Download necessary files:

- Magisk 16.0(1600): https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

- SELinuxModeChanger 11.0: https://f-droid.org/en/packages/com.mrbimc.selinux/

- AdAway 3.2-60: https://f-droid.org/en/packages/org.adaway/

- Dolby: https://xdaforums.com/pixel-2-xl/how-to/viper-dd-atom-t3724096

- Kernel. I use [MENTION=6842057]nathanchance[/MENTION] Flash Kernel: https://xdaforums.com/pixel-2-xl/development/taimen-flash-kernel-1-00-t3702057

NOTE: You can use whatever kernel you want, but I've only used/tested with Flash. Flash Kernel also has the proper drives to resolve the TWRP touch issues. I've read other custom kernels do as well.

- TWRP 3.2.1-0 (image & installer): https://xdaforums.com/pixel-2-xl/development/twrp-alpha-pixel-2-xl-t3698148

5. Plug your phone into your computer.

- If prompted on your phone, save and allow USB Authorization for your computer.

6. Push downloaded files to your phone (CMD/Terminal):

- adb push <path_to_Magisk_file>.zip /sdcard/Download

- adb push <path_to_SELinuxModeChanger_file>.apk /sdcard/Download

- adb push <path_to_AdAway_file>.apk /sdcard/Download

- adb push <path_to_Dolby_file>.zip /sdcard/Download

- adb push <path_to_Kernel_zip_file>.zip /sdcard/Download

- adb push <path_to_TWRP_image_file>.img /sdcard/Download

- adb push <path_to_TWRP_installer_file>.zip /sdcard/Download

Install Kernel & TWRP

NOTE: As of the Google February security image release, TWRP will no longer decrypt. You have three options to flash in TWRP until it's fixed; disable security before booting to TWRP, use USB storage via your OTG adapter, or put the files you need in the /data partition.

1. adb reboot bootloader (CMD/Terminal while your phone is still plugged into your computer)

2. Flash TWRP:

- fastboot boot <path_to_TWRP_image_file>.img

- Once in TWRP, install the TWRP_installer.zip file

- Reboot into TWRP

- Install Kernel.zip file

- Install the Magisk_16.0(1600).zip file

- Reboot to System.

3. Configure Magisk:

- Open Magisk Manager

- (OPTIONAL) Patch dtbo by unchecking both "force encryption" and "AVB2.0/dm-verity", tap "Install", tap "Install", tap "Direct Install (Recommended), then reboot

NOTE: By patching dtbo, you will receive a message on every boot that says something along the lines of "There's an internal problem with your device". This is perfectly normal when patching the dtbo and can be ignored as nothing is broken. Now, to be honest, I patch dtbo as I can't get certain things to work properly without, like Dolby, and the message doesn't bother me as it's only on boot up. I know patching dtbo is necessary for some things. For example, I don't think you can do manual build.prop edits without editing dtbo, if I'm not mistaken. I have had a few others on other threads say they were able to get Dolby to work without patching dtbo and just using SELinux in "permissive" mode, but I couldn't. Up to you, hence the "optional" part. :) If you decide to patch dtbo and want to go back, just flash the stock dtbo image file in fastboot or TWRP.

- Open Magisk Manager

- Goto Settings and tap "Hide Magisk Manager"

- Reopen Magisk after it's done

- Goto Settings and make sure "Magisk Hide" and "Systemless hosts" are both enabled

- Gogo Magisk Hide and check the applications you need to hide from Root (banking apps, authenticators, etc...)

4. If Play Store is not showing as "Certified" under Play Store Settings, clear Data and Cache on the Play Store under Phone Settings. Your Play Store will now be "Certified" under the Play Store Settings.

Install/Configure SELinuxModeChanger and AdAway

NOTE: It's my understanding that SELinux does not need to be set to "permissive" for ViPER and Dolby to work, but I can't get them to work otherwise. My Dolby will FC without setting SELinux to "permissive", which is why I'm adding it to my guide in case someone else is having the same issue. You can use the Magisk Module script if you want, but I like the convenience of the App to turn on and off easily.

1. Open "Downloads" from the App Launcher on your phone.

2. Install both SELinuxModeChanger.apk and AdAway.apk.

3. Open SELinuxModeChanger:

- Tap "Permissive"

- Tap "Automatically start on boot"

4. Open AdAway:

- Open Preferences and make sure "Enable systemless mode" is enabled". It's normal to be Greyed out. This is verification from the Magisk Settings you set above.

- Tap "Download files and apply ad blocking"

5. Reboot phone.

Install & Configure Magisk Modules / Dolby

1. Open Magisk Manager and go to Downloads:

- Download "Busybox for Android NDK" (some root apps need this, but it's also nice to have these utilities)

- Download "Single User Mod" (needed for latest TWRP install to my understanding, but it worked for me without. I like this anyway because I don't share my phone)

- Download "ViPER4Android FX" (make sure to get the v1.5.1(2.5.0.5) version) / during install you will be asked what version and theme, chose the 2.5.0.5 driver version and the Materialized version (needed for Dolby).

- Reboot Phone

2. Open ViPER 4 Android FX application:

- Under Settings tap "Turn on developer mode" then tap "Disable SELinux"

3. Reboot Phone.

- After reboot, open ViPER 4 Android FX application and enable/configure the effects you want.

NOTE: Be patient after a phone reboot. It sometimes takes a minute for the Magisk modules to load.

4. Reboot to TWRP.

- Install Dolby.zip file

- Reboot into System

5. Open Dolby, and if it force closes, make sure your SELinux is "permissive" first and if you still have force closes, patch dtbo following instructions above.

Themes & Mods

- Screenshots attached below!

I use substratum and Swift Black from the Play Store for my system wide theme. I use Light Manager from the Play Store for custom status lights for applications, etc... You can also get more customization of what icons to show or not show on your status bar by pulling down the notifications at the top of the phone and holding down the Settings gear icon until you feel a vibrate. You'll now have "System UI Tuner" under Settings->System. I'm also using the following Mods:

- SearchLess Launcher: https://xdaforums.com/pixel-2-xl/themes/mod-pixel-2-xl-launcher-mods-8-1-0-dp1-t3701939

- Rosemary Font: https://xdaforums.com/pixel-2-xl/themes/font-flashable-ubuntu-font-zip-pixel-2-t3710892

- Various Mods Aroma w/ 3Minit Battery: https://xdaforums.com/pixel-2-xl/themes/various-mods-8-1-december-update-t3721741

- Substatum /w Swift Black (I dont theme System UI or System UI Navigation as part of my setup with the Various Mods Aroma)

- ViPER w/ Audiophile X profile & Dolby using Music profile (Volume Leveler / Surround Virtualizer / Intelligent EQ: Open)

Updating

I'm going to keep these steps kind of generic and provide the order in which things have to be done (order is important), however for the details just follow the steps for each part above. You shouldn’t have to do the setup for Magisk Modules again unless:

- You ran into issues and needed to do a clean start with Magisk using the Magisk Uninstaller

- You are doing a Google Image update

Magisk - Push the updated Magisk Zip to your /sdcard/Download folder, boot into TWRP, flash new Magisk Zip, reboot into System, go through Magisk setup steps again.

Kernel – Push the updated Kernel Zip file to your /sdcard/Download folder, make sure you have the Magisk Zip file in your /sdcard/Download folder as well. Reboot to TWRP, flash new Kernel, flash Magisk, boot System and setup Magisk again.

TWRP – Push the updated TWRP Zip to your /sdcard/Download folder, reboot to TWRP, flash new TWRP Zip, boot into TWRP to test, boot System.

Google -

1. Disable any screen security you have.

2. Disable and uninstall Substratum themes, if you have any.

3. Full backup of some sort recommended!

4. Boot to Bootloader and do a flash-all (without -w) of 8.1 factory image, boot to System and allow the update to finish.

5. Boot back to Bootloader, boot TWRP, install TWRP, reboot to TWRP, install Kernel Zip file, install Magisk Zip file, boot back to System.

6. Complete Magisk setup steps (Magisk hide, App hide, systemless, etc..), check SafetyNet.

7. Apply any mods and themes in Substratum.

Have fun!