diff options
| author | 2024-11-21 20:11:54 +0000 | |
|---|---|---|
| committer | 2024-11-21 20:11:54 +0000 | |
| commit | effb976b326529c1d3b1f702402544004f96be70 (patch) | |
| tree | 3717d8d56ecf199969fbcc6a85bed8ad7892dd41 | |
| parent | f45fcd2ee6c7eecf879e29d50d5be2d4053376f9 (diff) | |
| parent | 5aedc45f0661e4593a924da9475b2160c17fd658 (diff) | |
Merge "Merge "[framework] Add an API to get max pause polling timeout." into main am: 82c09059e2 am: 5b4907661f" into main
| -rw-r--r-- | nfc/api/system-current.txt | 3 | ||||
| -rw-r--r-- | nfc/java/android/nfc/INfcAdapter.aidl | 3 | ||||
| -rw-r--r-- | nfc/java/android/nfc/NfcOemExtension.java | 19 |
3 files changed, 20 insertions, 5 deletions
diff --git a/nfc/api/system-current.txt b/nfc/api/system-current.txt index 031ed73e18ea..3ed9b7667be7 100644 --- a/nfc/api/system-current.txt +++ b/nfc/api/system-current.txt @@ -58,6 +58,7 @@ package android.nfc { method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void clearPreference(); method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public int forceRoutingTableCommit(); method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull public java.util.Map<java.lang.String,java.lang.Integer> getActiveNfceeList(); + method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public long getMaxPausePollingTimeoutMills(); method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public android.nfc.RoutingStatus getRoutingStatus(); method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public java.util.List<android.nfc.NfcRoutingTableEntry> getRoutingTable(); method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull public android.nfc.T4tNdefNfcee getT4tNdefNfcee(); @@ -66,7 +67,7 @@ package android.nfc { method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean isTagPresent(); method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void maybeTriggerFirmwareUpdate(); method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void overwriteRoutingTable(int, int, int, int); - method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public int pausePolling(int); + method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public int pausePolling(long); method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void registerCallback(@NonNull java.util.concurrent.Executor, @NonNull android.nfc.NfcOemExtension.Callback); method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public int resumePolling(); method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setAutoChangeEnabled(boolean); diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl index 5ae1be201088..ac0a5aaaa195 100644 --- a/nfc/java/android/nfc/INfcAdapter.aidl +++ b/nfc/java/android/nfc/INfcAdapter.aidl @@ -53,7 +53,7 @@ interface INfcAdapter int getState(); boolean disable(boolean saveState, in String pkg); boolean enable(in String pkg); - int pausePolling(int timeoutInMs); + int pausePolling(long timeoutInMs); int resumePolling(); void setForegroundDispatch(in PendingIntent intent, @@ -124,4 +124,5 @@ interface INfcAdapter int commitRouting(); boolean isTagIntentAllowed(in String pkg, in int Userid); IT4tNdefNfcee getT4tNdefNfceeInterface(); + long getMaxPausePollingTimeoutMs(); } diff --git a/nfc/java/android/nfc/NfcOemExtension.java b/nfc/java/android/nfc/NfcOemExtension.java index f1198ed92cff..f78161e7cad0 100644 --- a/nfc/java/android/nfc/NfcOemExtension.java +++ b/nfc/java/android/nfc/NfcOemExtension.java @@ -748,15 +748,16 @@ public final class NfcOemExtension { /** * Pauses NFC tag reader mode polling for a {@code timeoutInMs} millisecond. * In case of {@code timeoutInMs} is zero or invalid polling will be stopped indefinitely. - * Use {@link #resumePolling() to resume the polling. - * @param timeoutInMs the pause polling duration in millisecond, ranging from 0 to 40000. + * Use {@link #resumePolling()} to resume the polling. + * Use {@link #getMaxPausePollingTimeoutMs()} to check the max timeout value. + * @param timeoutInMs the pause polling duration in millisecond. * @return status of the operation * @throws IllegalArgumentException if timeoutInMs value is invalid * (0 < timeoutInMs < max). */ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) - public @PollingStateChangeStatusCode int pausePolling(@DurationMillisLong int timeoutInMs) { + public @PollingStateChangeStatusCode int pausePolling(@DurationMillisLong long timeoutInMs) { return NfcAdapter.callServiceReturn(() -> NfcAdapter.sService.pausePolling(timeoutInMs), POLLING_STATE_CHANGE_ALREADY_IN_REQUESTED_STATE); @@ -776,6 +777,18 @@ public final class NfcOemExtension { } /** + * Gets the max pause polling timeout value in millisecond. + * @return long integer representing the max timeout + */ + @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) + @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) + @DurationMillisLong + public long getMaxPausePollingTimeoutMills() { + return NfcAdapter.callServiceReturn(() -> + NfcAdapter.sService.getMaxPausePollingTimeoutMs(), 0L); + } + + /** * Set whether to enable auto routing change or not (enabled by default). * If disabled, routing targets are limited to a single off-host destination. * |