summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android')
-rwxr-xr-xsrc/com/android/nfc/nxp/NativeNfcManager.java3
-rwxr-xr-xsrc/com/android/nfc/nxp/NativeNfcTag.java11
2 files changed, 11 insertions, 3 deletions
diff --git a/src/com/android/nfc/nxp/NativeNfcManager.java b/src/com/android/nfc/nxp/NativeNfcManager.java
index 9a62cc0..1a50805 100755
--- a/src/com/android/nfc/nxp/NativeNfcManager.java
+++ b/src/com/android/nfc/nxp/NativeNfcManager.java
@@ -238,7 +238,8 @@ public class NativeNfcManager implements DeviceHost {
@Override
public boolean canMakeReadOnly(int ndefType) {
- return (ndefType == Ndef.TYPE_1 || ndefType == Ndef.TYPE_2);
+ return (ndefType == Ndef.TYPE_1 || ndefType == Ndef.TYPE_2 ||
+ ndefType == Ndef.TYPE_MIFARE_CLASSIC);
}
@Override
diff --git a/src/com/android/nfc/nxp/NativeNfcTag.java b/src/com/android/nfc/nxp/NativeNfcTag.java
index 53e1312..8996dfb 100755
--- a/src/com/android/nfc/nxp/NativeNfcTag.java
+++ b/src/com/android/nfc/nxp/NativeNfcTag.java
@@ -21,6 +21,7 @@ import com.android.nfc.DeviceHost.TagEndpoint;
import android.nfc.FormatException;
import android.nfc.NdefMessage;
import android.nfc.tech.IsoDep;
+import android.nfc.tech.MifareClassic;
import android.nfc.tech.MifareUltralight;
import android.nfc.tech.Ndef;
import android.nfc.tech.NfcA;
@@ -350,13 +351,19 @@ public class NativeNfcTag implements TagEndpoint {
return result;
}
- native boolean doMakeReadonly();
+ native boolean doMakeReadonly(byte[] key);
@Override
public synchronized boolean makeReadOnly() {
if (mWatchdog != null) {
mWatchdog.pause();
}
- boolean result = doMakeReadonly();
+ boolean result;
+ if (hasTech(TagTechnology.MIFARE_CLASSIC)) {
+ result = doMakeReadonly(MifareClassic.KEY_DEFAULT);
+ } else {
+ // No key needed for other technologies
+ result = doMakeReadonly(new byte[] {});
+ }
if (mWatchdog != null) {
mWatchdog.doResume();
}