[Galaxy Note II Q&A, Help & Troubleshooting] FredFS456:
Guide - Root & Gapps on N7102ZCUENB1

On the past couple pages, there have been many posts asking basic questions about how to root/put Gapps on the N7102 with the "N7102ZCUENB1" firmware. After doing this for my friend tonight successfully, I'm going to write a completely guide on how I did it. This guide should get the Gapps on the N7102 working in a reasonable state.

UPDATE 11/08/14: It seems like Samsung released a new firmware while I wasn't looking. The procedure for N7102ZCUENI2 should be similar - I don't have an N7102 to confirm anymore, so that's that. Reply below if you have any problems. I'm also gonna update the link to the firmware (Terafile got taken down, but Sammobile seems to have gotten their stuff together).

Unresolved Problems

The only problem unresolved so far is a series of com.google.process.gapps and Google Partner Setup crashing on boot. However, no other problems have been found yet.

UPDATE 9/13/14: I have a new theory that the crashes are because of SElinux not being disabled exactly at boot. The app that I have linked to simply makes a script that runs on boot, and if that doesn't run soon enough after boot, we would have crashes. I'm not sure how to change that though, so I'm investigating changing SElinux policies (I'm not sure if that's even possible post-compilation) or disabling with a quicker method.

UPDATE 9/13/14-2: I've done research, and it looks like it's not really worth the time. I doubt that the kernel on this device would support init.d, so I'm not going to try that route. There seems to be other obscure routes to setting SElinux to 'permissive' on boot, such as init.rc (?) but I don't think it's worth the time. It'll be a little annoyance, I guess.

Some important points before we start

-"N7102ZCUENB1" is the most recent 4.3 ROM from Samsung, released Feb. 2014

-The stock ROM hosted on sammobile.com for this recent update is NOT valid. See downloads section below to get the actual ROM.

-I'm going to assume you're starting on a completely clean flash of "N7102ZCUENB1" at the beginning of the guide, with a factory reset done though the stock recovery. That's what I started with, and if you didn't start with this and run into a problem not described here, please try that first. Refer to the "Restarting from Scratch" section down below.

-I provide a link to TriangleAway, but if you want a zero flash counter, you'll have to look up the guide to do that elsewhere in this thread. I haven't done it myself yet.

-when asked to 'fix root' on exit from Philz Touch, press NO

Downloads

Odin3 (3.09): https://mega.co.nz/#!UdRRyCAT!H4FyVxYynNWvXqRNmnpMGQRCP-dG3uykgP2pT4rh8Ek

Stock N7102CHNENI2 firmware: http://www.sammobile.com/firmwares/download/37347/N7102ZCUENI2_N7102CHNENI2_CHN.zip/ [UPDATED FIRMWARE LINK] (you'll have to register)

CF-Auto-Root: http://autoroot.chainfire.eu/

SuperSU (most recent version, I used v2.02): http://download.chainfire.eu/supersu

Philz Touch 5.15.0: http://d-h.st/users/philz_touch/?fld_id=16053#files

gapps-jb-20130813-signed.zip: http://wiki.cyanogenmod.org/w/Google_Apps

AROMA file manager: http://xdaforums.com/showthread.php?t=1646108

SE Linux Mode Changer: http://xdaforums.com/showthread.php?t=2524485

Triangle Away: http://xdaforums.com/galaxy-s2/orig-development/2014-01-15-triangleaway-v3-26-t1494114

Booting into Recovery

The procedure for booting into recovery elsewhere in this thread is actually incorrect. Noticing that it wasn't reliable, I searched up the generic Note 2, and the sequence for it also works for us.

1. (powered off) Hold VOL UP + HOME + POWER

2. (a second or so after the "Note II" logo comes up) Release POWER

3. Continue holding VOL UP + HOME until recovery shows up

Booting into Download Mode (for Odin3)

Documented elsewhere in the thread, but I'll put it here for completeness' sake

1. (powered off) Hold VOL DOWN + HOME + POWER

2. (on the chinese-filled screen with two options) Press VOL UP

Flashing anything on Odin3

1. Start Odin3

2. Put your n7102 into download mode

3. Connect the phone using USB and make sure a COM port is enumerated

4. Load any image (tar.md5) file into the AP or PDA (depending on version) button of Odin (may lag while it's checking the MD5 sum)

5. Make sure nothing is checked in the boxes except for:

- Auto Reboot

- F. Reset Time

6. Press Start and relax for a couple minutes

Using Aroma FM from Philz Touch 5

1. (recovery) Go to "Philz Settings"

2. select Aroma file manager

Main Procedure

> Root using CF-Auto-Root

1. Flash the CF-Auto-Root package above via Odin3

2. Let it reboot

> Solving problems with SuperSU

1. Transfer latest SuperSU APK over to internal storage using USB

2. Use File manger to run APK

3. When prompted for security stuff, press 'settings' and check 'unknown sources', uncheck 'initial installation' checkbox on popup

4. Wait for it to finish installing, then open the app

5. Update binary when asked, through 'normal' method

6. Press 'yes' for disabling knox (this will cause a forever-loop)

7. Close app & reboot phone (even if SuperSU still doing stuff)

8. Open SuperSU, disable knox (this time it'll work)

Congratulations, you now have root.

> Custom Recovery

1. Flash Philz Touch 5.15 via Odin3

2. Reboot into recovery to check that it's custom (remember to press NO for 'fix root' on exit)

> Flash Gapps & fix problems with it

1. Open the gapps zip from above, go to /system/app/ and delete SetupWizard.apk

2. Transfer the modified zip as well as the SELinuxModeChanger.apk into the phone's internal memory

3. Rename the AROMA file manager zip to "aroma.zip" and put in /sdcard/clockworkmod/aroma/

4. Reboot into Recovery & flash the gapps zip

5. mount /system/

6. Using AROMA FM, add a '.bak' onto the end of the names of these files in /system/framework/

com.google.widevine.software.drm.jar

com.google.widevine.software.drm.odex

This will eliminate the forever "Android is Upgrading" window.

7. Reboot into Android

Don't be worried about the 'XXX has stopped working'. We're going to fix that now.

8. Install SELinuxModeChanger.apk

9. Run it, then grant it root permissions

10. Change the mode to "permissive"

TADA! You're all done.

Restarting from Scratch

What I like to do when I'm messing around with something like this, is that I like to have a game plan if anything goes wrong. If I mess up along the way, I like to be able to nuke everything and restart from scratch. This is the procedure for this phone.

1. Flash stock firmware

> Factory reset to wipe all user data

1. Reboot the phone into recovery (stock/custom, doesn't matter)

2. Highlight the option of "Factory Reset"

3. Scroll down to "yes"

4. Select option

Congrats, now you can restart from scratch.

Speculation regarding SELinux

So I was really frustrated for some hours trying to figure out the Gapps crashing problem that other users have been reporting, and so I decided to take a logcat. Indeed, all off the lines relating to the google apps were "could not open xxx because of permission denied" or something like that. I figured that it couldn't hurt to change SELinux to permissive mode, and so I tried it. Lo and behold, it actually worked. I guess between the last firmware and this one Samsung decided to enable and set SElinux to "enforcing" or something, because the history of the thread shows that there were no such crashing problems before the current firmware upgrade. I guess SELinux doesn't allow for new system apps to be just written into the directory like that.