summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Hamilton <jham@android.com>2010-11-10 14:29:00 -0600
committerJeff Hamilton <jham@android.com>2010-11-11 20:44:34 -0600
commit5df484a6c94aebd8b79a0c3ec96da372063aeffd (patch)
tree0ac437d290d0dd083b5e1d3341b709ce6e06ff76
parentd65348455ae09a467f288d65dbf924fc60c8d290 (diff)
downloadpackages_apps_nfc-5df484a6c94aebd8b79a0c3ec96da372063aeffd.zip
packages_apps_nfc-5df484a6c94aebd8b79a0c3ec96da372063aeffd.tar.gz
packages_apps_nfc-5df484a6c94aebd8b79a0c3ec96da372063aeffd.tar.bz2
Remove dead code.
NativeNfcTag contains the NDEF read/write and NativeNdefTag is not used anywhere. Change-Id: Ic3f7c3c792419468ea9c02f3d08df2761627137e
-rw-r--r--jni/Android.mk1
-rw-r--r--jni/com_android_nfc.cpp2
-rw-r--r--jni/com_android_nfc.h1
-rw-r--r--jni/com_android_nfc_NativeNdefTag.cpp154
-rwxr-xr-xsrc/com/android/nfc/NativeNdefTag.java28
5 files changed, 0 insertions, 186 deletions
diff --git a/jni/Android.mk b/jni/Android.mk
index d492f65..fb092e5 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -8,7 +8,6 @@ LOCAL_SRC_FILES:= \
com_android_nfc_NativeLlcpConnectionlessSocket.cpp \
com_android_nfc_NativeLlcpServiceSocket.cpp \
com_android_nfc_NativeLlcpSocket.cpp \
- com_android_nfc_NativeNdefTag.cpp \
com_android_nfc_NativeNfcManager.cpp \
com_android_nfc_NativeNfcTag.cpp \
com_android_nfc_NativeP2pDevice.cpp \
diff --git a/jni/com_android_nfc.cpp b/jni/com_android_nfc.cpp
index d971b71..848a678 100644
--- a/jni/com_android_nfc.cpp
+++ b/jni/com_android_nfc.cpp
@@ -35,8 +35,6 @@ jint JNI_OnLoad(JavaVM *jvm, void *reserved)
return JNI_ERR;
if (android::register_com_android_nfc_NativeNfcTag(e) == -1)
return JNI_ERR;
- if (android::register_com_android_nfc_NativeNdefTag(e) == -1)
- return JNI_ERR;
if (android::register_com_android_nfc_NativeP2pDevice(e) == -1)
return JNI_ERR;
if (android::register_com_android_nfc_NativeLlcpSocket(e) == -1)
diff --git a/jni/com_android_nfc.h b/jni/com_android_nfc.h
index 032fc48..ae361f7 100644
--- a/jni/com_android_nfc.h
+++ b/jni/com_android_nfc.h
@@ -167,7 +167,6 @@ phLibNfc_Handle nfc_jni_get_nfc_socket_handle(JNIEnv *e, jobject o);
int register_com_android_nfc_NativeNfcManager(JNIEnv *e);
int register_com_android_nfc_NativeNfcTag(JNIEnv *e);
-int register_com_android_nfc_NativeNdefTag(JNIEnv *e);
int register_com_android_nfc_NativeP2pDevice(JNIEnv *e);
int register_com_android_nfc_NativeLlcpConnectionlessSocket(JNIEnv *e);
int register_com_android_nfc_NativeLlcpServiceSocket(JNIEnv *e);
diff --git a/jni/com_android_nfc_NativeNdefTag.cpp b/jni/com_android_nfc_NativeNdefTag.cpp
deleted file mode 100644
index e236d00..0000000
--- a/jni/com_android_nfc_NativeNdefTag.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <semaphore.h>
-
-#include "com_android_nfc.h"
-
-static sem_t *nfc_jni_ndef_tag_sem;
-static phLibNfc_Data_t nfc_jni_ndef_rw;
-static NFCSTATUS nfc_jni_cb_status = NFCSTATUS_FAILED;
-
-/* Shared with NfcTag module */
-extern uint8_t nfc_jni_is_ndef;
-extern uint8_t * nfc_jni_ndef_buf;
-extern uint32_t nfc_jni_ndef_buf_len;
-
-namespace android {
-
-static void nfc_jni_tag_rw_callback(void *pContext, NFCSTATUS status)
-{
- LOG_CALLBACK("nfc_jni_tag_rw_callback", status);
-
- nfc_jni_cb_status = status;
-
- sem_post(nfc_jni_ndef_tag_sem);
-}
-
-static jbyteArray com_android_nfc_NativeNdefTag_doRead(JNIEnv *e,
- jobject o)
-{
- phLibNfc_Handle handle = 0;
- jbyteArray buf = NULL;
- NFCSTATUS status;
-
- CONCURRENCY_LOCK();
-
- handle = nfc_jni_get_nfc_tag_handle(e, o);
-
- nfc_jni_ndef_rw.length = nfc_jni_ndef_buf_len;
- nfc_jni_ndef_rw.buffer = nfc_jni_ndef_buf;
-
- TRACE("phLibNfc_Ndef_Read()");
- REENTRANCE_LOCK();
- status = phLibNfc_Ndef_Read( handle,
- &nfc_jni_ndef_rw,
- phLibNfc_Ndef_EBegin,
- nfc_jni_tag_rw_callback,
- (void *)e);
- REENTRANCE_UNLOCK();
- if(status != NFCSTATUS_PENDING)
- {
- LOGE("phLibNfc_Ndef_Read() returned 0x%04x[%s]", status, nfc_jni_get_status_name(status));
- goto clean_and_return;
- }
- TRACE("phLibNfc_Ndef_Read() returned 0x%04x[%s]", status, nfc_jni_get_status_name(status));
-
- /* Wait for callback response */
- sem_wait(nfc_jni_ndef_tag_sem);
-
- if(nfc_jni_cb_status != NFCSTATUS_SUCCESS)
- {
- goto clean_and_return;
- }
-
- buf = e->NewByteArray(nfc_jni_ndef_rw.length);
- e->SetByteArrayRegion(buf, 0, nfc_jni_ndef_rw.length,
- (jbyte *)nfc_jni_ndef_rw.buffer);
-
-clean_and_return:
- CONCURRENCY_UNLOCK();
- return buf;
-}
-
-static jboolean com_android_nfc_NativeNdefTag_doWrite(JNIEnv *e,
- jobject o, jbyteArray buf)
-{
- NFCSTATUS status;
- jboolean result = JNI_FALSE;
-
- CONCURRENCY_LOCK();
-
- phLibNfc_Handle handle = nfc_jni_get_nfc_tag_handle(e, o);
-
- nfc_jni_ndef_rw.length = (uint32_t)e->GetArrayLength(buf);
- nfc_jni_ndef_rw.buffer = (uint8_t *)e->GetByteArrayElements(buf, NULL);
-
- TRACE("phLibNfc_Ndef_Write()");
- REENTRANCE_LOCK();
- status = phLibNfc_Ndef_Write(handle, &nfc_jni_ndef_rw,nfc_jni_tag_rw_callback, (void *)e);
- REENTRANCE_UNLOCK();
- if(status != NFCSTATUS_PENDING)
- {
- LOGE("phLibNfc_Ndef_Write() returned 0x%04x[%s]", status, nfc_jni_get_status_name(status));
- goto clean_and_return;
- }
- TRACE("phLibNfc_Ndef_Write() returned 0x%04x[%s]", status, nfc_jni_get_status_name(status));
-
- /* Wait for callback response */
- sem_wait(nfc_jni_ndef_tag_sem);
-
- if(nfc_jni_cb_status != NFCSTATUS_SUCCESS)
- {
- goto clean_and_return;
- }
-
- result = JNI_TRUE;
-
-clean_and_return:
- if (result != JNI_TRUE)
- {
- e->ReleaseByteArrayElements(buf, (jbyte *)nfc_jni_ndef_rw.buffer, JNI_ABORT);
- }
-
- CONCURRENCY_UNLOCK();
-
- return result;
-}
-
-/*
- * JNI registration.
- */
-static JNINativeMethod gMethods[] =
-{
- {"doRead", "()[B",
- (void *)com_android_nfc_NativeNdefTag_doRead},
- {"doWrite", "([B)Z",
- (void *)com_android_nfc_NativeNdefTag_doWrite},
-};
-
-int register_com_android_nfc_NativeNdefTag(JNIEnv *e)
-{
- nfc_jni_ndef_tag_sem = (sem_t *)malloc(sizeof(sem_t));
- if(sem_init(nfc_jni_ndef_tag_sem, 0, 0) == -1)
- return -1;
-
- return jniRegisterNativeMethods(e,
- "com/android/nfc/NativeNdefTag",
- gMethods, NELEM(gMethods));
-}
-
-} // namespace android
diff --git a/src/com/android/nfc/NativeNdefTag.java b/src/com/android/nfc/NativeNdefTag.java
deleted file mode 100755
index 45ae189..0000000
--- a/src/com/android/nfc/NativeNdefTag.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.nfc;
-
-/**
- * Native interface to the NDEF tag functions
- */
-public class NativeNdefTag {
- private int mHandle;
-
- public native byte[] doRead();
-
- public native boolean doWrite(byte[] buf);
-}