summaryrefslogtreecommitdiffstats
path: root/src/com/android/nfc/nxp/NativeNfcSecureElement.java
diff options
context:
space:
mode:
authorSunil Jogi <sunil.jogi@nxp.com>2012-04-11 13:11:03 -0700
committerMartijn Coenen <maco@google.com>2012-04-20 12:18:29 -0700
commit37058bf7b59def2f9a565ae5b16aae54e80e9e95 (patch)
treee9e3e692da9608a3cd6d2e295e5fac2be3451bcd /src/com/android/nfc/nxp/NativeNfcSecureElement.java
parent290a6967a04f49dc3969dced9f82c1636a7e7902 (diff)
downloadpackages_apps_nfc-37058bf7b59def2f9a565ae5b16aae54e80e9e95.zip
packages_apps_nfc-37058bf7b59def2f9a565ae5b16aae54e80e9e95.tar.gz
packages_apps_nfc-37058bf7b59def2f9a565ae5b16aae54e80e9e95.tar.bz2
Added shared prefs for SE wired mode
When SE is in wired mode shared prefs sets the se_wired to true, when SE is no more in wired mode shared prefs sets se_wired to false. Default value for se_wired is false. se_wired shared pref is set during the NFC initialization. Change-Id: I9a3565c23035802895c8e99c671483c808312e0e
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);
}