[NFC Hacking] 1653020:
I'm in the process of creating a HCE service but am experiencing difficulties routing commands to this service.

I have a Nokia 7 Plus running Android 9, and a smart card reader which I've programmed to send a select command matching the Application ID I've specified for my service. However when I initiate a connection and send the command, I'm receiving a response from the device but it is not one that I processed - something else is responding to the command.

I do not believe it is a problem with my pipeline, as everything works as expected when I use an Motorola Nexus running Android 7.1.1.

The following is the log cat when I send the select command. Can someone assist with understanding what is going wrong? Is it the secure element that is responding to the command? If so, any ideas on how to prevent that? Docs say it should be handled automatically.

2020-02-04 09:39:01.144 794-4075/? D/NxpTml: PN54X - I2C Read successful.....len = 4
2020-02-04 09:39:01.144 794-4075/? D/NxpTml: PN54X - Posting read message.....
2020-02-04 09:39:01.144 794-4075/? D/NxpNciR: len = 4 <= 600701A1
2020-02-04 09:39:01.144 794-4078/? D/NxpHal: read successful status = 0x0
2020-02-04 09:39:01.146 3529-3990/? I/BrcmNfcNfa: NFC received ntf gid:0
2020-02-04 09:39:01.146 3529-3990/? I/BrcmNfcNfa: nci_proc_core_ntf opcode:0x7
2020-02-04 09:39:01.146 3529-3990/? I/BrcmNfcNfa: nfa_dm_nfc_response_cback () NFC_GEN_ERROR_REVT(0x500d)
2020-02-04 09:39:01.147 794-4075/? D/NxpTml: PN54X - Read requested.....
2020-02-04 09:39:01.147 794-4075/? D/NxpTml: PN54X - Invoking I2C Read.....
2020-02-04 09:39:01.400 794-4075/? D/NxpTml: PN54X - I2C Read successful.....len = 4
2020-02-04 09:39:01.400 794-4075/? D/NxpTml: PN54X - Posting read message.....
2020-02-04 09:39:01.400 794-4075/? D/NxpNciR: len = 4 <= 600701A1
2020-02-04 09:39:01.400 794-4078/? D/NxpHal: read successful status = 0x0
2020-02-04 09:39:01.401 3529-3990/? I/BrcmNfcNfa: NFC received ntf gid:0
2020-02-04 09:39:01.401 3529-3990/? I/BrcmNfcNfa: nci_proc_core_ntf opcode:0x7
2020-02-04 09:39:01.401 3529-3990/? I/BrcmNfcNfa: nfa_dm_nfc_response_cback () NFC_GEN_ERROR_REVT(0x500d)
2020-02-04 09:39:01.401 794-4075/? D/NxpTml: PN54X - Read requested.....
2020-02-04 09:39:01.401 794-4075/? D/NxpTml: PN54X - Invoking I2C Read.....
2020-02-04 09:39:01.430 794-4075/? D/NxpTml: PN54X - I2C Read successful.....len = 4
2020-02-04 09:39:01.430 794-4075/? D/NxpTml: PN54X - Posting read message.....
2020-02-04 09:39:01.430 794-4075/? D/NxpNciR: len = 4 <= 600701A1
2020-02-04 09:39:01.430 794-4078/? D/NxpHal: read successful status = 0x0
2020-02-04 09:39:01.431 3529-3990/? I/BrcmNfcNfa: NFC received ntf gid:0
2020-02-04 09:39:01.431 3529-3990/? I/BrcmNfcNfa: nci_proc_core_ntf opcode:0x7
2020-02-04 09:39:01.431 3529-3990/? I/BrcmNfcNfa: nfa_dm_nfc_response_cback () NFC_GEN_ERROR_REVT(0x500d)
2020-02-04 09:39:01.431 794-4075/? D/NxpTml: PN54X - Read requested.....
2020-02-04 09:39:01.431 794-4075/? D/NxpTml: PN54X - Invoking I2C Read.....
2020-02-04 09:39:02.575 794-4075/? D/NxpTml: PN54X - I2C Read successful.....len = 4
2020-02-04 09:39:02.575 794-4075/? D/NxpTml: PN54X - Posting read message.....
2020-02-04 09:39:02.575 794-4075/? D/NxpNciR: len = 4 <= 600701A1
2020-02-04 09:39:02.575 794-4078/? D/NxpHal: read successful status = 0x0
2020-02-04 09:39:02.577 3529-3990/? I/BrcmNfcNfa: NFC received ntf gid:0
2020-02-04 09:39:02.577 3529-3990/? I/BrcmNfcNfa: nci_proc_core_ntf opcode:0x7
2020-02-04 09:39:02.577 3529-3990/? I/BrcmNfcNfa: nfa_dm_nfc_response_cback () NFC_GEN_ERROR_REVT(0x500d)
2020-02-04 09:39:02.581 794-4075/? D/NxpTml: PN54X - Read requested.....
2020-02-04 09:39:02.581 794-4075/? D/NxpTml: PN54X - Invoking I2C Read.....
2020-02-04 09:39:03.310 794-4075/? D/NxpTml: PN54X - I2C Read successful.....len = 4
2020-02-04 09:39:03.310 794-4075/? D/NxpTml: PN54X - Posting read message.....
2020-02-04 09:39:03.310 794-4075/? D/NxpNciR: len = 4 <= 61070100
2020-02-04 09:39:03.310 794-4078/? D/NxpHal: read successful status = 0x0
2020-02-04 09:39:03.311 3529-3990/? I/BrcmNfcNfa: NFC received ntf gid:1
2020-02-04 09:39:03.311 3529-3990/? I/BrcmNfcNfa: nfc_ncif_proc_rf_field_ntf
2020-02-04 09:39:03.311 3529-3990/? I/BrcmNfcNfa: nfa_dm_nfc_response_cback () NFC_RF_FIELD_REVT(0x5007)
2020-02-04 09:39:03.311 3529-3990/? D/BrcmNfcJni: nfaDeviceManagementCallback: enter; event=0x5
2020-02-04 09:39:03.311 3529-3990/? D/BrcmNfcJni: checkforTranscation: enter; event=0x3 transaction_data.current_transcation_state = 0x0
2020-02-04 09:39:03.311 3529-3990/? D/BrcmNfcJni: checkforTranscation: exit; event=0x3 transaction_data.current_transcation_state = 0x0
2020-02-04 09:39:03.311 3529-3990/? D/BrcmNfcJni: nfaDeviceManagementCallback: NFA_DM_RF_FIELD_EVT; status=0x0; field status=0
2020-02-04 09:39:03.311 3529-3990/? D/BrcmNfcJni: SecureElement::notifyRfFieldEvent: enter; is active=0
2020-02-04 09:39:03.313 3529-3990/? D/BrcmNfcJni: setCLState: Entry setCLState
2020-02-04 09:39:03.313 3529-3990/? D/BrcmNfcJni: setCLState: Exit setCLState = 0
2020-02-04 09:39:03.313 3529-3990/? D/BrcmNfcJni: SecureElement::notifyRfFieldEvent: exit
2020-02-04 09:39:03.313 3529-3529/? D/NfcService: SE FIELD DEACTIVATED
2020-02-04 09:39:03.313 3529-3990/? D/BrcmNfcJni: transactionEnd: Transaction ended : RF_FIELD_EVT
2020-02-04 09:39:03.314 794-4075/? D/NxpTml: PN54X - Read requested.....
2020-02-04 09:39:03.314 794-4075/? D/NxpTml: PN54X - Invoking I2C Read.....
2020-02-04 09:39:03.315 3529-3529/? D/NfcService: NFCINTENT sendNfcEeAccessProtectedBroadcast
2020-02-04 09:39:03.318 3529-3529/? D/NfcService: SE FIELD DEACTIVATED
2020-02-04 09:39:03.319 3529-24247/? D/BrcmNfcJni: Inside transactionAbortTimerCb
2020-02-04 09:39:03.319 3529-24247/? D/BrcmNfcJni: lastRequestResume
2020-02-04 09:39:03.320 3529-24248/? D/BrcmNfcJni: enableThread: enter
2020-02-04 09:39:03.320 3529-24248/? D/BrcmNfcJni: get_lastScreenStateRequest: 0
2020-02-04 09:39:03.320 3529-3529/? D/NfcService: NFCINTENT sendNfcEeAccessProtectedBroadcast
2020-02-04 09:39:03.320 3529-24248/? D/BrcmNfcJni: transactionTerminate: Enter. Requested by : exec_pending_req
2020-02-04 09:39:03.321 3529-24248/? D/BrcmNfcJni: transactionTerminate: Transaction terminated : exec_pending_req
2020-02-04 09:39:03.321 3529-24248/? D/BrcmNfcJni: No request pending
2020-02-04 09:39:03.321 3529-24248/? D/BrcmNfcJni: enableThread: exit

Can post code snippets if desired.