diff options
-rwxr-xr-x | AndroidManifest.xml | 8 | ||||
-rw-r--r-- | CleanSpec.mk | 2 | ||||
-rw-r--r-- | jni/com_android_nfc_NativeNfcManager.cpp | 131 | ||||
-rw-r--r-- | migrate_nfc.txt | 6 | ||||
-rwxr-xr-x | res/values/strings.xml | 1 | ||||
-rwxr-xr-x | src/com/android/nfc/NfcService.java | 1 | ||||
-rw-r--r-- | src/com/android/nfc/P2pEventManager.java | 2 | ||||
-rw-r--r-- | src/com/android/nfc/SendUi.java | 2 | ||||
-rw-r--r-- | tests/AndroidManifest.xml | 2 |
9 files changed, 77 insertions, 78 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 3ce49b8..b896e07 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.nfc3" + package="com.android.nfc" android:sharedUserId="android.uid.nfc" android:sharedUserLabel="@string/nfcUserLabel" > @@ -20,7 +20,7 @@ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <uses-permission android:name="android.permission.VIBRATE" /> - <application android:name="com.android.nfc.NfcService" + <application android:name=".NfcService" android:icon="@drawable/icon" android:label="@string/app_name" android:persistent="true" @@ -29,13 +29,13 @@ <meta-data android:name="com.google.android.backup.api_key" android:value="AEdPqrEAAAAIEXGvR1H2lq6SEOC7O7rGHoAmAf-GHCR_EhLqzg" /> - <activity android:name="com.android.nfc.TechListChooserActivity" + <activity android:name=".TechListChooserActivity" android:theme="@*android:style/Theme.Dialog.Alert" android:finishOnCloseSystemDialogs="true" android:excludeFromRecents="true" android:multiprocess="true" /> - <activity android:name="com.android.nfc.NfcRootActivity" + <activity android:name=".NfcRootActivity" android:theme="@*android:style/Theme.Translucent.NoTitleBar" android:excludeFromRecents="true" android:noHistory="true" diff --git a/CleanSpec.mk b/CleanSpec.mk index c236495..fc12f05 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -49,3 +49,5 @@ # ************************************************ $(call add-clean-step, rm -f $(PRODUCT_OUT)/system/app/Nfc.apk) +$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/app/NfcGoogle.apk) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/NfcGoogle_intermediates) diff --git a/jni/com_android_nfc_NativeNfcManager.cpp b/jni/com_android_nfc_NativeNfcManager.cpp index 70c60bb..d0a6ed2 100644 --- a/jni/com_android_nfc_NativeNfcManager.cpp +++ b/jni/com_android_nfc_NativeNfcManager.cpp @@ -68,9 +68,15 @@ static void nfc_jni_init_callback(void *pContext, NFCSTATUS status); static void nfc_jni_deinit_callback(void *pContext, NFCSTATUS status); static void nfc_jni_discover_callback(void *pContext, NFCSTATUS status); static void nfc_jni_se_set_mode_callback(void *context, - phLibNfc_Handle handle, NFCSTATUS status); + phLibNfc_Handle handle, NFCSTATUS status); static void nfc_jni_llcpcfg_callback(void *pContext, NFCSTATUS status); static void nfc_jni_start_discovery_locked(struct nfc_jni_native_data *nat); +static void nfc_jni_Discovery_notification_callback(void *pContext, + phLibNfc_RemoteDevList_t *psRemoteDevList, + uint8_t uNofRemoteDev, NFCSTATUS status); +static void nfc_jni_transaction_callback(void *context, + phLibNfc_eSE_EvtType_t evt_type, phLibNfc_Handle handle, + phLibNfc_uSeEvtInfo_t *evt_info, NFCSTATUS status); /* * Deferred callback called when client thread must be exited @@ -327,6 +333,30 @@ static int nfc_jni_unconfigure_driver(struct nfc_jni_native_data *nat) return result; } +static short get_p2p_mode() { + char value[PROPERTY_VALUE_MAX]; + property_get("debug.nfc.NXP_NFCI_MODE", value, ""); + if (value[0]) { + short mode; + mode = atoi(value); + LOGD("debug.nfc.NXP_NFCI_MODE = %X", mode); + return mode; + } + return phNfc_eP2P_ALL; // default +} + +static bool get_p2p_target_disable() { + char value[PROPERTY_VALUE_MAX]; + property_get("debug.nfc.TARGET_DISABLE", value, ""); + if (value[0]) { + int mode; + mode = atoi(value); + LOGD("debug.nfc.TARGET_DISABLE = %d", mode); + return mode; + } + return FALSE; // default +} + /* Initialization function */ static int nfc_jni_initialize(struct nfc_jni_native_data *nat) { struct timespec ts; @@ -564,6 +594,44 @@ force_download: goto clean_and_return; } + /* ===== DISCOVERY ==== */ + nat->discovery_cfg.NfcIP_Mode = get_p2p_mode(); //initiator + nat->discovery_cfg.Duration = 300000; /* in ms */ + nat->discovery_cfg.NfcIP_Tgt_Disable = get_p2p_target_disable(); + + TRACE("****** NFC Config Mode Reader ******"); + + /* Register for the reader mode */ + REENTRANCE_LOCK(); + ret = phLibNfc_RemoteDev_NtfRegister(&nat->registry_info, nfc_jni_Discovery_notification_callback, (void *)nat); + REENTRANCE_UNLOCK(); + if(ret != NFCSTATUS_SUCCESS) + { + LOGD("pphLibNfc_RemoteDev_NtfRegister returned 0x%02x",ret); + goto clean_and_return; + } + TRACE("phLibNfc_RemoteDev_NtfRegister(%s-%s-%s-%s-%s-%s-%s-%s) returned 0x%x\n", + nat->registry_info.Jewel==TRUE?"J":"", + nat->registry_info.MifareUL==TRUE?"UL":"", + nat->registry_info.MifareStd==TRUE?"Mi":"", + nat->registry_info.Felica==TRUE?"F":"", + nat->registry_info.ISO14443_4A==TRUE?"4A":"", + nat->registry_info.ISO14443_4B==TRUE?"4B":"", + nat->registry_info.NFC==TRUE?"P2P":"", + nat->registry_info.ISO15693==TRUE?"R":"", ret); + + /* Register for the card emulation mode */ + REENTRANCE_LOCK(); + ret = phLibNfc_SE_NtfRegister(nfc_jni_transaction_callback,(void *)nat); + REENTRANCE_UNLOCK(); + if(ret != NFCSTATUS_SUCCESS) + { + LOGD("pphLibNfc_RemoteDev_NtfRegister returned 0x%02x",ret); + goto clean_and_return; + } + TRACE("phLibNfc_SE_NtfRegister returned 0x%x\n", ret); + + /* ====== END ======= */ LOGI("NFC Initialized"); @@ -1345,31 +1413,6 @@ static void nfc_jni_se_set_mode_callback(void *pContext, * NFCManager methods */ -static short get_p2p_mode() { - char value[PROPERTY_VALUE_MAX]; - property_get("debug.nfc.NXP_NFCI_MODE", value, ""); - if (value[0]) { - short mode; - mode = atoi(value); - LOGD("debug.nfc.NXP_NFCI_MODE = %X", mode); - return mode; - } - return phNfc_eP2P_ALL; // default -} - -static bool get_p2p_target_disable() { - char value[PROPERTY_VALUE_MAX]; - property_get("debug.nfc.TARGET_DISABLE", value, ""); - if (value[0]) { - int mode; - mode = atoi(value); - LOGD("debug.nfc.TARGET_DISABLE = %d", mode); - return mode; - } - return FALSE; // default -} - - static void nfc_jni_start_discovery_locked(struct nfc_jni_native_data *nat) { NFCSTATUS ret; @@ -1386,42 +1429,6 @@ static void nfc_jni_start_discovery_locked(struct nfc_jni_native_data *nat) /* Reset device connected flag */ device_connected_flag = 0; - nat->discovery_cfg.NfcIP_Mode = get_p2p_mode(); //initiator - nat->discovery_cfg.Duration = 300000; /* in ms */ - nat->discovery_cfg.NfcIP_Tgt_Disable = get_p2p_target_disable(); - - TRACE("****** NFC Config Mode Reader ******"); - - /* Register for the reader mode */ - REENTRANCE_LOCK(); - ret = phLibNfc_RemoteDev_NtfRegister(&nat->registry_info, nfc_jni_Discovery_notification_callback, (void *)nat); - REENTRANCE_UNLOCK(); - if(ret != NFCSTATUS_SUCCESS) - { - LOGD("pphLibNfc_RemoteDev_NtfRegister returned 0x%02x",ret); - goto clean_and_return; - } - TRACE("phLibNfc_RemoteDev_NtfRegister(%s-%s-%s-%s-%s-%s-%s-%s) returned 0x%x\n", - nat->registry_info.Jewel==TRUE?"J":"", - nat->registry_info.MifareUL==TRUE?"UL":"", - nat->registry_info.MifareStd==TRUE?"Mi":"", - nat->registry_info.Felica==TRUE?"F":"", - nat->registry_info.ISO14443_4A==TRUE?"4A":"", - nat->registry_info.ISO14443_4B==TRUE?"4B":"", - nat->registry_info.NFC==TRUE?"P2P":"", - nat->registry_info.ISO15693==TRUE?"R":"", ret); - - /* Register for the card emulation mode */ - REENTRANCE_LOCK(); - ret = phLibNfc_SE_NtfRegister(nfc_jni_transaction_callback,(void *)nat); - REENTRANCE_UNLOCK(); - if(ret != NFCSTATUS_SUCCESS) - { - LOGD("pphLibNfc_RemoteDev_NtfRegister returned 0x%02x",ret); - goto clean_and_return; - } - TRACE("phLibNfc_SE_NtfRegister returned 0x%x\n", ret); - /* Start Polling loop */ TRACE("****** Start NFC Discovery ******"); REENTRANCE_LOCK(); diff --git a/migrate_nfc.txt b/migrate_nfc.txt index 6db107c..00e0d12 100644 --- a/migrate_nfc.txt +++ b/migrate_nfc.txt @@ -1,7 +1,3 @@ -# Migrate the mytag file from the old pacakge name -com.android.nfc3:com.android.nfc - files - # Migrate the prefs from the old package name -com.android.nfc3:com.android.nfc +com.android.nfc:com.android.nfc3 shared_prefs diff --git a/res/values/strings.xml b/res/values/strings.xml index 0963dc7..3fcf047 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">Nfc Service</string> - <string name="nfcUserLabel">Nfc</string> <!-- A notification description string informing the user that contact details were received over NFC [CHAR-LIMIT=64] --> <string name="inbound_me_profile_title">Contact received over NFC</string> diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index f94f5b0..03e39c2 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -23,7 +23,6 @@ import com.android.nfc.DeviceHost.NfcDepEndpoint; import com.android.nfc.DeviceHost.TagEndpoint; import com.android.nfc.nxp.NativeNfcManager; import com.android.nfc.nxp.NativeNfcSecureElement; -import com.android.nfc3.R; import android.app.Application; import android.app.KeyguardManager; diff --git a/src/com/android/nfc/P2pEventManager.java b/src/com/android/nfc/P2pEventManager.java index 6a00b43..5677a6f 100644 --- a/src/com/android/nfc/P2pEventManager.java +++ b/src/com/android/nfc/P2pEventManager.java @@ -23,8 +23,6 @@ import android.os.Handler; import android.os.Message; import android.os.Vibrator; -import com.android.nfc3.R; - /** * Manages vibration, sound and animation for P2P events. */ diff --git a/src/com/android/nfc/SendUi.java b/src/com/android/nfc/SendUi.java index 37ac6e0..6fc24d5 100644 --- a/src/com/android/nfc/SendUi.java +++ b/src/com/android/nfc/SendUi.java @@ -16,8 +16,6 @@ package com.android.nfc; -import com.android.nfc3.R; - import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml index 035bb4c..f33d622 100644 --- a/tests/AndroidManifest.xml +++ b/tests/AndroidManifest.xml @@ -31,7 +31,7 @@ "adb shell am instrument -w com.android.email.tests/android.test.InstrumentationTestRunner" --> <instrumentation android:name="android.test.InstrumentationTestRunner" - android:targetPackage="com.android.nfc3" + android:targetPackage="com.android.nfc" android:label="Tests for Nfc."/> </manifest> |