I am wondering when exactly the NFC Service is started and stopped. The source code for android 4.0.3 seems to state that the polling is dependent on a single constant (located in NfcService.java)
/** minimum screen state that enables NFC polling (discovery) */
static final int POLLING_MODE = SCREEN_STATE_ON_UNLOCKED;
I would interpret this as "the screen light is on, therefore the nfc service is active". BUT when the screen is locked, a NFC Tag wont be recognized, altough the screen is lit.
So I am curious: Is the NFC Service already deactivated when the lock screen appears, or is it still running but not processing the Tags?
Actually, I do not think that NFC Service is deactivated. When the screen has lower value then
SCREEN_STATE_ON_UNLOCKED
a device stops to ask NFC tags around. You can see this from this code:But NFC-EE routing is enabled util screen state is higher then
SCREEN_STATE_ON_LOCKED
:The service itself is started and stopped in other parts of this class.