[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] sk8223:
How to flash Magisk + pass SafetyNet and bypass root detection | Camera 60fps guide

Since a lot of people are asking this question, I made a short guide.

1. Download your Magisk package. If your ROM is a Treble ROM, you must you a custom Treble Magisk package. Regular Magisk won't work.

You can get a custom Treble Magisk package from this ROM's OP, or from the LineageOS thread. [MENTION=4857012]feherneoh[/MENTION] creates Magisk packages and shares them in the LineageOS 15.1 thread. I think the OP of that thread also updates it with new Treble Magisk releases, so keep an eye out.

You only need new versions of Magisk for SafetyNet hiding. If you don't care about SafetyNet or Magisk Hide, just use the Magisk file from this ROM's OP.

2. Place the file in the root of your phone, or in any folder. Just make sure it's on your phone. You can flash Magisk at any time, only after setting up the ROM! Don't flash Magisk before setting your ROM up, especially if you care about SafetyNet and Magisk Hide.

3. Flash your ROM, flash your Gapps, boot into system. Ignore this step if you've already done that.

4. Boot into the ROM, set the ROM up, sign in, and download at least 1 or 2 apps from the Play Store. Go to Play Store Settings and scroll all the way to the bottom. The Device certification section should say Certified. If it's missing, just continue setting the ROM up and wait until it appears. It may take an hour or more. Don't panic.

You can still flash Magisk even if the Device certification section isn't apparent. But you won't be able to download your paid apps in the Play Store app unless and until that section appears. They'll always show up as unpaid and will request you to buy them.

If it absolutely refuses to show up, go into Settings and factory reset the ROM.

5. Now that your ROM is set up a bit, boot into recovery. Flash your Treble Magisk file. Boot into system. If it doesn't show up, just reboot and it should show up. Search for the app in your app drawer and it should appear. If you don't care about root detection and SafetyNet, stop here.

6. Magisk should pass SafetyNet by default once it's installed. You can test it in the app itself. If there's an app you want to use that detects root, you'll have to add it to Magisk Hide. Open up the menu to the left in Magisk and go to Magisk Hide. Hide the app in question.

7. Then go to Magisk Settings and hide the Magisk package. This is crucial. Once hidden, Magisk will go back into the app drawer if it was on your home screen. You can put it back after.

8. Remove Magisk from your recents and browse to the problematic app in Settings > Apps. Clear the cache and remove it from your recents. Now open up the app (do not open up Magisk + the app together). It should work. If it doesn't, you'll probably need a newer version of Magisk, or it detects the most recent version of Magisk. This is generally a rare case.

Some apps even look for other apps associated with root. Like Xposed. There's no way to hide Xposed, even systemless Xposed so don't bother with it if you need root detection.

60fps (technically just 59fps) recording on the Redmi Note 4 in Oreo 8.1 ***WARNING: may not work for Omnivision sensors***

Tested on a Note 4 with a Samsung rear sensor and it works. There are other ways to get 60fps working, but I found this the easiest. Let me know what you use.

Haven't figured out how to get that 1 fps back, but 59fps is better than nothing.

Of course, you won't get a standard 59fps all the time. In low light situations your frames will drop. I get 53fps in my room with the blinds open.

1. If you flashed Gapps and included the stock Google Camera, go into Settings and disable it. You might even have to uninstall it (via Titanium Backup or some other app) for the Gcam port to work. The Gcam port takes over the Google Camera app, so both can't be installed at the same time.

2. Download a Gcam port. I recommend UriKill's latest port since it's very stable.

3. Then download this package and flash it in TWRP after installing and setting up Magisk. Boot into system and check your Magisk modules. It should show up there with a checkmarked box next to it. Open up your Gcam app and check the video settings. When you switch to 60fps, the motion should be visibly quicker.

This phone's camera sucks, but you might as well make the most out of it. Special thanks to [MENTION=8281574]rap1do[/MENTION] and others for introducing me to this and sticking by me when I needed help. Do consult his thread if you want more information. If you want slow-motion (no sound), you can use Snapdragon Camera (camera.zip in the OP). I did manage to record 60fps using it, but there was no sound, and the sound fix didn't work.