summaryrefslogtreecommitdiffstats
path: root/src/com/android/nfc/nxp/NativeNfcSecureElement.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/nfc/nxp/NativeNfcSecureElement.java')
-rwxr-xr-xsrc/com/android/nfc/nxp/NativeNfcSecureElement.java46
1 files changed, 37 insertions, 9 deletions
diff --git a/src/com/android/nfc/nxp/NativeNfcSecureElement.java b/src/com/android/nfc/nxp/NativeNfcSecureElement.java
index 768ad2f..88f9b9d 100755
--- a/src/com/android/nfc/nxp/NativeNfcSecureElement.java
+++ b/src/com/android/nfc/nxp/NativeNfcSecureElement.java
@@ -16,6 +16,8 @@
package com.android.nfc.nxp;
+import android.content.Context;
+import android.content.SharedPreferences;
/**
@@ -24,16 +26,42 @@ package com.android.nfc.nxp;
* {@hide}
*/
public class NativeNfcSecureElement {
-
- public NativeNfcSecureElement() { }
-
- public native int doOpenSecureElementConnection();
-
- public native boolean doDisconnect(int handle);
-
+
+ static final String PREF_SE_WIRED = "se_wired";
+
+ private final Context mContext;
+
+ SharedPreferences mPrefs;
+ SharedPreferences.Editor mPrefsEditor;
+
+ public NativeNfcSecureElement(Context context) {
+ mContext = context;
+
+ mPrefs = mContext.getSharedPreferences(NativeNfcManager.PREF, Context.MODE_PRIVATE);
+ mPrefsEditor = mPrefs.edit();
+ }
+
+ private native int doNativeOpenSecureElementConnection();
+
+ public int doOpenSecureElementConnection() {
+ mPrefsEditor.putBoolean(PREF_SE_WIRED, true);
+ mPrefsEditor.apply();
+
+ return doNativeOpenSecureElementConnection();
+ }
+
+ private native boolean doNativeDisconnectSecureElementConnection(int handle);
+
+ public boolean doDisconnect(int handle) {
+ mPrefsEditor.putBoolean(PREF_SE_WIRED, false);
+ mPrefsEditor.apply();
+
+ return doNativeDisconnectSecureElementConnection(handle);
+ }
+
public native byte[] doTransceive(int handle, byte[] data);
-
+
public native int[] doGetTechList(int handle);
-
+
public native byte [] doGetUid(int handle);
}