summaryrefslogtreecommitdiffstats
path: root/nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java
diff options
context:
space:
mode:
authorJeff Hamilton <jham@android.com>2011-11-08 16:55:13 -0600
committerNick Pelly <npelly@google.com>2011-11-11 08:55:26 -0800
commitbb951c893973691554f49d2e725985125f866b27 (patch)
tree355d7da2f890359a8b15f07261b2f8415238041d /nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java
parentde62d9cbe00d0fcac24af9a3d89ba7a125e56eaa (diff)
downloadframeworks_base-bb951c893973691554f49d2e725985125f866b27.zip
frameworks_base-bb951c893973691554f49d2e725985125f866b27.tar.gz
frameworks_base-bb951c893973691554f49d2e725985125f866b27.tar.bz2
Changes for access control.
The package name is now required when using the NFC extras APIs so the context is stored away and used to derive the package name to be sent to the NfcService. Bug: 4515759 Change-Id: I1a3aba3fc026e0090a914b0686fc4b8dec25b927
Diffstat (limited to 'nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java')
-rw-r--r--nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java b/nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java
index 63c2de2..f47327a 100644
--- a/nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java
+++ b/nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java
@@ -16,20 +16,17 @@
package com.android.nfc_extras;
-import java.io.IOException;
-
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
-import android.content.Context;
-import android.nfc.INfcAdapterExtras;
-import android.nfc.NfcAdapter;
import android.os.Binder;
import android.os.Bundle;
-import android.os.IBinder;
import android.os.RemoteException;
+import java.io.IOException;
+
public class NfcExecutionEnvironment {
private final NfcAdapterExtras mExtras;
+ private final Binder mToken;
/**
* Broadcast Action: An ISO-DEP AID was selected.
@@ -115,6 +112,7 @@ public class NfcExecutionEnvironment {
NfcExecutionEnvironment(NfcAdapterExtras extras) {
mExtras = extras;
+ mToken = new Binder();
}
/**
@@ -133,7 +131,7 @@ public class NfcExecutionEnvironment {
*/
public void open() throws IOException {
try {
- Bundle b = mExtras.getService().open(new Binder());
+ Bundle b = mExtras.getService().open(mExtras.mPackageName, mToken);
throwBundle(b);
} catch (RemoteException e) {
mExtras.attemptDeadServiceRecovery(e);
@@ -151,7 +149,7 @@ public class NfcExecutionEnvironment {
*/
public void close() throws IOException {
try {
- throwBundle(mExtras.getService().close());
+ throwBundle(mExtras.getService().close(mExtras.mPackageName, mToken));
} catch (RemoteException e) {
mExtras.attemptDeadServiceRecovery(e);
throw new IOException("NFC Service was dead");
@@ -169,7 +167,7 @@ public class NfcExecutionEnvironment {
public byte[] transceive(byte[] in) throws IOException {
Bundle b;
try {
- b = mExtras.getService().transceive(in);
+ b = mExtras.getService().transceive(mExtras.mPackageName, in);
} catch (RemoteException e) {
mExtras.attemptDeadServiceRecovery(e);
throw new IOException("NFC Service was dead, need to re-open");