diff options
| -rw-r--r-- | nfc/java/android/nfc/INfcAdapter.aidl | 2 | ||||
| -rw-r--r-- | nfc/java/android/nfc/NfcAdapter.java | 34 |
2 files changed, 36 insertions, 0 deletions
diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl index 286cf2890eea..1faaf1b9883a 100644 --- a/nfc/java/android/nfc/INfcAdapter.aidl +++ b/nfc/java/android/nfc/INfcAdapter.aidl @@ -97,4 +97,6 @@ interface INfcAdapter WlcLDeviceInfo getWlcLDeviceInfo(); void updateDiscoveryTechnology(IBinder b, int pollFlags, int listenFlags); + + void notifyPollingLoop(in Bundle frame); } diff --git a/nfc/java/android/nfc/NfcAdapter.java b/nfc/java/android/nfc/NfcAdapter.java index 8219d2f873de..d50a9a2b2397 100644 --- a/nfc/java/android/nfc/NfcAdapter.java +++ b/nfc/java/android/nfc/NfcAdapter.java @@ -26,6 +26,7 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SuppressLint; import android.annotation.SystemApi; +import android.annotation.TestApi; import android.annotation.UserIdInt; import android.app.Activity; import android.app.PendingIntent; @@ -2752,6 +2753,38 @@ public final class NfcAdapter { } } + /** + * Notifies the system of a new polling loop. + * + * @param frame is the new frame. + * + * @hide + */ + @TestApi + @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) + public void notifyPollingLoop(@NonNull Bundle frame) { + try { + if (sService == null) { + attemptDeadServiceRecovery(null); + } + sService.notifyPollingLoop(frame); + } catch (RemoteException e) { + attemptDeadServiceRecovery(e); + // Try one more time + if (sService == null) { + Log.e(TAG, "Failed to recover NFC Service."); + return; + } + try { + sService.notifyPollingLoop(frame); + } catch (RemoteException ee) { + Log.e(TAG, "Failed to recover NFC Service."); + } + } + } + + + /** * Sets NFC charging feature. * <p>This API is for the Settings application. @@ -2767,6 +2800,7 @@ public final class NfcAdapter { } try { return sService.enableWlc(enable); + } catch (RemoteException e) { attemptDeadServiceRecovery(e); // Try one more time |