diff options
Diffstat (limited to 'src/com/android')
-rwxr-xr-x | src/com/android/nfc/nxp/NativeNfcManager.java | 3 | ||||
-rwxr-xr-x | src/com/android/nfc/nxp/NativeNfcTag.java | 11 |
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(); } |