diff options
| -rw-r--r-- | nfc/java/android/nfc/INfcAdapter.aidl | 1 | ||||
| -rw-r--r-- | nfc/java/android/nfc/NfcAdapter.java | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl index fd77820afc81..90ca92f299a4 100644 --- a/nfc/java/android/nfc/INfcAdapter.aidl +++ b/nfc/java/android/nfc/INfcAdapter.aidl @@ -104,6 +104,7 @@ interface INfcAdapter void notifyPollingLoop(in PollingFrame frame); void notifyHceDeactivated(); + void notifyTestHceData(in int technology, in byte[] data); int sendVendorNciMessage(int mt, int gid, int oid, in byte[] payload); void registerVendorExtensionCallback(in INfcVendorNciCallback callbacks); void unregisterVendorExtensionCallback(in INfcVendorNciCallback callbacks); diff --git a/nfc/java/android/nfc/NfcAdapter.java b/nfc/java/android/nfc/NfcAdapter.java index 1dfc81e2108e..9ce1c8257c17 100644 --- a/nfc/java/android/nfc/NfcAdapter.java +++ b/nfc/java/android/nfc/NfcAdapter.java @@ -2857,6 +2857,33 @@ public final class NfcAdapter { } /** + * Notifies the system of new HCE data for tests. + * + * @hide + */ + @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) + public void notifyTestHceData(int technology, byte[] data) { + try { + if (sService == null) { + attemptDeadServiceRecovery(null); + } + sService.notifyTestHceData(technology, data); + } catch (RemoteException e) { + attemptDeadServiceRecovery(e); + // Try one more time + if (sService == null) { + Log.e(TAG, "Failed to recover NFC Service."); + return; + } + try { + sService.notifyTestHceData(technology, data); + } catch (RemoteException e2) { + Log.e(TAG, "Failed to recover NFC Service."); + } + } + } + + /** * Notifies the system of a an HCE session being deactivated. * * * @hide |