summaryrefslogtreecommitdiff
path: root/core/java/android/nfc/NfcAdapter.java
diff options
context:
space:
mode:
authorAndres Morales <anmorales@google.com>2014-05-20 09:25:07 -0700
committerAndres Morales <anmorales@google.com>2014-06-20 10:05:52 -0700
commit3b33fd283c32a8fb707a23d25f3f3cf13e8b046f (patch)
treee571b1afcee1f5dd0410f8fe7a498b1cccb36ec4 /core/java/android/nfc/NfcAdapter.java
parent9285d1bf9c57e5f1da8f8d8ef7a6a38b2f0e4ec3 (diff)
Framework changes to support NFC trustlet.
Adds a system-only ability to register for receiving tags from NfcService at the lockscreen. Change-Id: I4b50941031e8d1f40ebb6314211226e70a2ad187
Diffstat (limited to 'core/java/android/nfc/NfcAdapter.java')
-rw-r--r--core/java/android/nfc/NfcAdapter.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index dd8e41c0067b..899106639dd7 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -380,6 +380,16 @@ public final class NfcAdapter {
public Uri[] createBeamUris(NfcEvent event);
}
+
+ /**
+ * A callback to be invoked when an application has registered for receiving
+ * tags at the lockscreen.
+ */
+ public interface NfcLockscreenDispatch {
+ public boolean onTagDetected(Tag tag);
+ }
+
+
/**
* Helper to check if this device has FEATURE_NFC, but without using
* a context.
@@ -1417,6 +1427,23 @@ public final class NfcAdapter {
}
}
+ public boolean registerLockscreenDispatch(final NfcLockscreenDispatch lockscreenDispatch,
+ int[] techList) {
+ try {
+ sService.registerLockscreenDispatch(new INfcLockscreenDispatch.Stub() {
+ @Override
+ public boolean onTagDetected(Tag tag) throws RemoteException {
+ return lockscreenDispatch.onTagDetected(tag);
+ }
+ }, techList);
+ } catch (RemoteException e) {
+ attemptDeadServiceRecovery(e);
+ return false;
+ }
+
+ return true;
+ }
+
/**
* @hide
*/