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
diff --git a/core/java/android/nfc/INfcAdapterExtras.aidl b/core/java/android/nfc/INfcAdapterExtras.aidl
index 8677a50..0c2a2fd 100755
--- a/core/java/android/nfc/INfcAdapterExtras.aidl
+++ b/core/java/android/nfc/INfcAdapterExtras.aidl
@@ -16,7 +16,6 @@
 
 package android.nfc;
 
-import android.nfc.ApduList;
 import android.os.Bundle;
 
 
@@ -29,6 +28,5 @@
     Bundle transceive(in byte[] data_in);
     int getCardEmulationRoute();
     void setCardEmulationRoute(int route);
-    void registerTearDownApdus(String packageName, in ApduList apdu);
-    void unregisterTearDownApdus(String packageName);
+    void authenticate(in byte[] token);
 }
diff --git a/nfc-extras/java/com/android/nfc_extras/NfcAdapterExtras.java b/nfc-extras/java/com/android/nfc_extras/NfcAdapterExtras.java
index 6001be9..e0c38b1 100644
--- a/nfc-extras/java/com/android/nfc_extras/NfcAdapterExtras.java
+++ b/nfc-extras/java/com/android/nfc_extras/NfcAdapterExtras.java
@@ -18,7 +18,6 @@
 
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
-import android.nfc.ApduList;
 import android.nfc.INfcAdapterExtras;
 import android.nfc.NfcAdapter;
 import android.os.RemoteException;
@@ -208,17 +207,18 @@
         return sEmbeddedEe;
     }
 
-    public void registerTearDownApdus(String packageName, ApduList apdus) {
+    /**
+     * Authenticate the client application.
+     *
+     * Some implementations of NFC Adapter Extras may require applications
+     * to authenticate with a token, before using other methods.
+     *
+     * @param a implementation specific token
+     * @throws a {@link java.lang.SecurityException} if authentication failed
+     */
+    public void authenticate(byte[] token) {
         try {
-            sService.registerTearDownApdus(packageName, apdus);
-        } catch (RemoteException e) {
-            attemptDeadServiceRecovery(e);
-        }
-    }
-
-    public void unregisterTearDownApdus(String packageName) {
-        try {
-            sService.unregisterTearDownApdus(packageName);
+            sService.authenticate(token);
         } catch (RemoteException e) {
             attemptDeadServiceRecovery(e);
         }