summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-07-25 15:07:43 -0700
committerMartijn Coenen <maco@google.com>2012-08-01 12:35:17 -0700
commita3f98c286444a9fb009cf6c6753ae67bdf51ac6b (patch)
tree7605a600a5e31de8af113c9f9939a73d60e24fd0 /src/com
parent96c08a7d49a8dcd33a5acac1c7c73fe3711bd9bd (diff)
downloadpackages_apps_nfc-a3f98c286444a9fb009cf6c6753ae67bdf51ac6b.zip
packages_apps_nfc-a3f98c286444a9fb009cf6c6753ae67bdf51ac6b.tar.gz
packages_apps_nfc-a3f98c286444a9fb009cf6c6753ae67bdf51ac6b.tar.bz2
NFC: Initial NCI DeviceHost and JNI implementation. (DO NOT MERGE)
From partner drop at 07/20. Modified to fit into our new JNI/DH split. New build config that builds two targets, Nfc and NfcNci, each with their own dependencies. Product config files have to specify either Nfc or NfcNci in their packages config. Change-Id: I348a3aad7167195ca03baf9636408ab8e4c55fce
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/nfc/DeviceHost.java4
-rwxr-xr-xsrc/com/android/nfc/NfcService.java24
2 files changed, 11 insertions, 17 deletions
diff --git a/src/com/android/nfc/DeviceHost.java b/src/com/android/nfc/DeviceHost.java
index 047e3d5..a78a136 100644
--- a/src/com/android/nfc/DeviceHost.java
+++ b/src/com/android/nfc/DeviceHost.java
@@ -216,5 +216,9 @@ public interface DeviceHost {
boolean getExtendedLengthApdusSupported();
+ boolean enablePN544Quirks();
+
+ byte[][] getWipeApdus();
+
String dump();
}
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index 3e7a6b5..c42bdc0 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -101,8 +101,6 @@ public class NfcService extends Application implements DeviceHostListener {
static final String PREF_FIRST_BOOT = "first_boot";
static final String PREF_AIRPLANE_OVERRIDE = "airplane_override";
- static final boolean PN544_QUIRK_DISCONNECT_BEFORE_RECONFIGURE = true;
-
static final int MSG_NDEF_TAG = 0;
static final int MSG_CARD_EMULATION = 1;
static final int MSG_LLCP_LINK_ACTIVATION = 2;
@@ -160,19 +158,6 @@ public class NfcService extends Application implements DeviceHostListener {
public static final String EXTRA_MIFARE_BLOCK =
"com.android.nfc_extras.extra.MIFARE_BLOCK";
- //TODO: dont hardcode this
- private static final byte[][] EE_WIPE_APDUS = {
- {(byte)0x00, (byte)0xa4, (byte)0x04, (byte)0x00, (byte)0x00},
- {(byte)0x00, (byte)0xa4, (byte)0x04, (byte)0x00, (byte)0x07, (byte)0xa0, (byte)0x00,
- (byte)0x00, (byte)0x04, (byte)0x76, (byte)0x20, (byte)0x10, (byte)0x00},
- {(byte)0x80, (byte)0xe2, (byte)0x01, (byte)0x03, (byte)0x00},
- {(byte)0x00, (byte)0xa4, (byte)0x04, (byte)0x00, (byte)0x00},
- {(byte)0x00, (byte)0xa4, (byte)0x04, (byte)0x00, (byte)0x07, (byte)0xa0, (byte)0x00,
- (byte)0x00, (byte)0x04, (byte)0x76, (byte)0x30, (byte)0x30, (byte)0x00},
- {(byte)0x80, (byte)0xb4, (byte)0x00, (byte)0x00, (byte)0x00},
- {(byte)0x00, (byte)0xa4, (byte)0x04, (byte)0x00, (byte)0x00},
- };
-
// NFC Execution Environment
// fields below are protected by this
private NativeNfcSecureElement mSecureElement;
@@ -585,7 +570,12 @@ public class NfcService extends Application implements DeviceHostListener {
void executeEeWipe() {
// TODO: read SE reset list from /system/etc
- byte[][]apdus = EE_WIPE_APDUS;
+ byte[][]apdus = mDeviceHost.getWipeApdus();
+
+ if (apdus == null) {
+ Log.d(TAG, "No wipe APDUs found");
+ return;
+ }
boolean tempEnable = mState == NfcAdapter.STATE_OFF;
if (tempEnable) {
@@ -1412,7 +1402,7 @@ public class NfcService extends Application implements DeviceHostListener {
try {
watchDog.start();
- if (PN544_QUIRK_DISCONNECT_BEFORE_RECONFIGURE && mScreenState == SCREEN_STATE_OFF) {
+ if (mDeviceHost.enablePN544Quirks() && mScreenState == SCREEN_STATE_OFF) {
/* TODO undo this after the LLCP stack is fixed.
* Use a different sequence when turning the screen off to
* workaround race conditions in pn544 libnfc. The race occurs