[Samsung Galaxy Nexus] irotsoma:
I haven't posted enough on XDA to be able to reply to the appropriate development forum post, so I decided to post here. I'm running CM10 on a Sprint Galaxy Nexus (toroplus), and I had been in need of a way to use NFC while the screen was locked, but couldn't find one for the latest build of CM10. I found this thread http://xdaforums.com/showthread.php?t=1709586 but the latest updates only had one for screen off (which is a little less secure IMHO), and when I used it, I would have to turn NFC off and then back on almost every time I used it, which defeated the purpose. I also saw that someone else was having the same issue, so I decided to compile one myself using the latest CM10 source. This was built from source as of 10/31/2012 and has only been tested on the nightly build with the same date. I figured I'd share it with everyone that might be needing the same.

Disclaimers: This requires a rooted phone! This has only been tested on the Sprint Galaxy Nexus running CM10 nightly dated 10/31/2012, but may work with other versions. Do a backup! I'm not responsible for any problems resulting from these files, so backup first!

To install, copy to your SD card. Reboot into recovery. DO A BACKUP! Install the zip from the SD Card. Reboot.

There are two versions I created. One is for when the screen is on, but locked. The other is for when the screen is off.

Update 1/2/2013:

I compiled a version of the screen locked for CM10.1 (Android v4.2.1) for anyone who would like it. I was getting mixed results with the previous file on 10.1. This one is working on my toroplus with the latest CM10.1 nightly. I'll build a screen off version later. I was having some problems with my build VM, so I didn't get to it yet. The new file for CM10.1 is called NFC_Screen_Locked_CM10.1.zip.

Update 1/3/2013:

The CM10.1 version of the screen off version is now posted. File name is NFC_Screen_Off_CM10.1.zip

Update 1/16/2013:

Previous version of NFC_Screen_Off_CM10.1.zip was not working. Should be working now.

Update 1/16/2013:

Added a patch that can be used against CM10 or 10.1 source code to add an option to the settings to switch between screen on, locked, or off NFC. You must build the entire thing from scratch to use this patch. There are logs of guides for building CM. Here's a link to the CM wiki article for toroplus for example. Before executing brunch, copy this file to the root of where you created the repo (the article uses the ~/android/system/ folder for instance) then execute the following two commands:

tar -xzf nfc-patch.tar.gz
./apply-nfc-patch.sh

Or in the use package manager to untar all of the files (maintaining the directory structure) and then double click and run the apply-nfc-patch.sh file. This will patch all of the necessary files in the build. Then continue with the instructions in the build guide and flash the resulting ROM.

Disclaimer Again: This could break your phone. I'm not responsible for any damages this may cause. This has only been briefly tested on my toroplus with the latest CM10.1 code from the repository.

Credits: Rick C who originally submitted most of this to the CM repository but was rejected.

Update 1/21/2013:

Looks like a recent commit to the repository broke one of the diffs in the patch. Uploaded a new version.

Update 2/13/2013:

Another update to fix an issue with the patch files. I also added a reset script that will do a hard reset for git repos of the affected packages. Don't use this script if you have made any other customizations to the Settings app, NFC app or the frameworks/base code as you will lose them. Just do things in this order:

1) run reset script

2) run repo sync

3) extract tar again

4) run apply script

5) run brunch again

You can use this sequence every time you want to grab the latest code.

If you get errors when running the apply script you can use this command to delete the error files that come up. These files might show up even if the patch works, but the code wasn't exactly what the patch was expecting, but enough to apply anyway.

find . \( -name \*.orig -o -name \*.rej \) -delete

This set of commands should do the trick for most people to get the latest code, apply the patch and build:

./reset-nfc-patch-repos.sh
repo sync
tar -xzf nfc-patch.tar.gz
./apply-nfc-patch.sh
source build/envsetup.sh && brunch <your-device-name>

Update 2/27/2013:

Made some fixes to the notes in the previous update based on feedback from mrplowdan.

Update 3/15/2013:

Compiled a new version of the CM10.1 files for those having issues.

Update 10/21/2013:

Added a test version of the screen locked version for CM10.2 now that toroplus has an official CM10.2 nightly. Let me know if there are any issues. I'll add a screen off version when I have some time.

Update 11/19/2013:

Finally getting around to adding a screen off version for CM10.2. The screen locked version has been running well on my toroplus for the last month with no issues.