Skip to content

Commit 17523ab

Browse files
author
Nick Pelly
committed
NFC Adapter Extras API update.
Remove o registerTearDownApdus() o deregisterTearDownApdus() They were already NO-OPS, and don't work in the general case. Add o authenticate(byte[] token) This future proofs us for a more flexible access control scheme. Change-Id: I4cb67ceeb63d61cbc333c9b244a96d8687402168
1 parent d76baeb commit 17523ab

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

core/java/android/nfc/INfcAdapterExtras.aidl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package android.nfc;
1818

19-
import android.nfc.ApduList;
2019
import android.os.Bundle;
2120

2221

@@ -29,6 +28,5 @@ interface INfcAdapterExtras {
2928
Bundle transceive(in byte[] data_in);
3029
int getCardEmulationRoute();
3130
void setCardEmulationRoute(int route);
32-
void registerTearDownApdus(String packageName, in ApduList apdu);
33-
void unregisterTearDownApdus(String packageName);
31+
void authenticate(in byte[] token);
3432
}

nfc-extras/java/com/android/nfc_extras/NfcAdapterExtras.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import android.annotation.SdkConstant;
2020
import android.annotation.SdkConstant.SdkConstantType;
21-
import android.nfc.ApduList;
2221
import android.nfc.INfcAdapterExtras;
2322
import android.nfc.NfcAdapter;
2423
import android.os.RemoteException;
@@ -208,17 +207,18 @@ public NfcExecutionEnvironment getEmbeddedExecutionEnvironment() {
208207
return sEmbeddedEe;
209208
}
210209

211-
public void registerTearDownApdus(String packageName, ApduList apdus) {
212-
try {
213-
sService.registerTearDownApdus(packageName, apdus);
214-
} catch (RemoteException e) {
215-
attemptDeadServiceRecovery(e);
216-
}
217-
}
218-
219-
public void unregisterTearDownApdus(String packageName) {
210+
/**
211+
* Authenticate the client application.
212+
*
213+
* Some implementations of NFC Adapter Extras may require applications
214+
* to authenticate with a token, before using other methods.
215+
*
216+
* @param a implementation specific token
217+
* @throws a {@link java.lang.SecurityException} if authentication failed
218+
*/
219+
public void authenticate(byte[] token) {
220220
try {
221-
sService.unregisterTearDownApdus(packageName);
221+
sService.authenticate(token);
222222
} catch (RemoteException e) {
223223
attemptDeadServiceRecovery(e);
224224
}

0 commit comments

Comments
 (0)