summaryrefslogtreecommitdiff
path: root/nci/jni
diff options
context:
space:
mode:
authorHenri Chataing <henrichataing@google.com>2024-01-05 10:34:14 +0000
committerHenri Chataing <henrichataing@google.com>2024-01-18 16:46:56 +0000
commitd57c86c3a3b0dec1714c07426065ea9428db21a0 (patch)
tree1bad163afc5d860dd514f234cc23342553923dac /nci/jni
parentd157be03ff52f0a8d67f2323d44f5b92a69c81e1 (diff)
downloadNfc-d57c86c3a3b0dec1714c07426065ea9428db21a0.tar.gz
Migrate logging from libchrome to libbase
Bug: 318833265 Test: TreeHugger Merged-In: Ic0566424ffa89fc8bec662b4c45b5c0d89b1d667 Change-Id: Ic0566424ffa89fc8bec662b4c45b5c0d89b1d667
Diffstat (limited to 'nci/jni')
-rw-r--r--nci/jni/CondVar.cpp6
-rw-r--r--nci/jni/DataQueue.cpp5
-rw-r--r--nci/jni/HciEventManager.cpp9
-rw-r--r--nci/jni/IntervalTimer.cpp2
-rw-r--r--nci/jni/Mutex.cpp6
-rw-r--r--nci/jni/NativeNfcManager.cpp356
-rw-r--r--nci/jni/NativeNfcTag.cpp250
-rw-r--r--nci/jni/NativeP2pDevice.cpp14
-rw-r--r--nci/jni/NfcDta.cpp34
-rw-r--r--nci/jni/NfcJniUtil.cpp9
-rw-r--r--nci/jni/NfcStatsUtil.cpp10
-rwxr-xr-xnci/jni/NfcTag.cpp168
-rw-r--r--nci/jni/PowerSwitch.cpp53
-rw-r--r--nci/jni/RouteDataSet.cpp102
-rwxr-xr-xnci/jni/RoutingManager.cpp212
15 files changed, 541 insertions, 695 deletions
diff --git a/nci/jni/CondVar.cpp b/nci/jni/CondVar.cpp
index e45fbbf9..f954164c 100644
--- a/nci/jni/CondVar.cpp
+++ b/nci/jni/CondVar.cpp
@@ -19,13 +19,13 @@
*/
#include "CondVar.h"
-#include "NfcJniUtil.h"
+#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
#include <errno.h>
#include <string.h>
-#include <android-base/stringprintf.h>
-#include <base/logging.h>
+#include "NfcJniUtil.h"
using android::base::StringPrintf;
diff --git a/nci/jni/DataQueue.cpp b/nci/jni/DataQueue.cpp
index 58b67650..a8e9ac37 100644
--- a/nci/jni/DataQueue.cpp
+++ b/nci/jni/DataQueue.cpp
@@ -20,12 +20,11 @@
#include "DataQueue.h"
+#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
#include <malloc.h>
#include <string.h>
-#include <android-base/stringprintf.h>
-#include <base/logging.h>
-
using android::base::StringPrintf;
/*******************************************************************************
**
diff --git a/nci/jni/HciEventManager.cpp b/nci/jni/HciEventManager.cpp
index b6e36db3..952ede96 100644
--- a/nci/jni/HciEventManager.cpp
+++ b/nci/jni/HciEventManager.cpp
@@ -14,15 +14,16 @@
* limitations under the License.
*/
#include "HciEventManager.h"
+
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <log/log.h>
#include <nativehelper/ScopedLocalRef.h>
+
#include "JavaClassConstants.h"
#include "NfcJniUtil.h"
#include "nfc_config.h"
-extern bool nfc_debug_enabled;
const char* APP_NAME = "NfcNci";
uint8_t HciEventManager::sEsePipe;
uint8_t HciEventManager::sSimPipe;
@@ -100,7 +101,7 @@ std::vector<uint8_t> HciEventManager::getDataFromBerTlv(
return std::vector<uint8_t>();
}
size_t lengthTag = berTlv[0];
- DLOG_IF(INFO, nfc_debug_enabled) << "decodeBerTlv: berTlv[0]=" << berTlv[0];
+ LOG(DEBUG) << "decodeBerTlv: berTlv[0]=" << berTlv[0];
/* As per ISO/IEC 7816, read the first byte to determine the length and
* the start index accordingly
@@ -139,7 +140,7 @@ void HciEventManager::nfaHciCallback(tNFA_HCI_EVT event,
return;
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"event=%d code=%d pipe=%d len=%d", event, eventData->rcvd_evt.evt_code,
eventData->rcvd_evt.pipe, eventData->rcvd_evt.evt_len);
diff --git a/nci/jni/IntervalTimer.cpp b/nci/jni/IntervalTimer.cpp
index c3614171..e2fb7dc4 100644
--- a/nci/jni/IntervalTimer.cpp
+++ b/nci/jni/IntervalTimer.cpp
@@ -20,8 +20,8 @@
#include "IntervalTimer.h"
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
using android::base::StringPrintf;
diff --git a/nci/jni/Mutex.cpp b/nci/jni/Mutex.cpp
index 973c435a..922f1ae4 100644
--- a/nci/jni/Mutex.cpp
+++ b/nci/jni/Mutex.cpp
@@ -19,13 +19,13 @@
*/
#include "Mutex.h"
-#include "NfcJniUtil.h"
+#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
#include <errno.h>
#include <string.h>
-#include <android-base/stringprintf.h>
-#include <base/logging.h>
+#include "NfcJniUtil.h"
using android::base::StringPrintf;
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index d3aad239..d5bc0fa4 100644
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -14,8 +14,8 @@
* limitations under the License.
*/
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <cutils/properties.h>
#include <errno.h>
#include <nativehelper/JNIPlatformHelp.h>
@@ -167,35 +167,28 @@ static bool gIsDtaEnabled = false;
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
-bool nfc_debug_enabled;
-
namespace {
void initializeGlobalDebugEnabledFlag() {
- nfc_debug_enabled =
- (NfcConfig::getUnsigned(NAME_NFC_DEBUG_ENABLED, 1) != 0) ? true : false;
-
- bool debug_enabled = property_get_bool("persist.nfc.debug_enabled", false);
+ bool nfc_debug_enabled =
+ (NfcConfig::getUnsigned(NAME_NFC_DEBUG_ENABLED, 1) != 0) ||
+ property_get_bool("persist.nfc.debug_enabled", false);
- nfc_debug_enabled = (nfc_debug_enabled || debug_enabled);
-
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: level=%u", __func__, nfc_debug_enabled);
+ android::base::SetMinimumLogSeverity(nfc_debug_enabled ? android::base::DEBUG
+ : android::base::INFO);
}
void initializeRecoveryOption() {
recovery_option = NfcConfig::getUnsigned(NAME_RECOVERY_OPTION, 0);
- DLOG_IF(INFO, nfc_debug_enabled)
- << __func__ << ": recovery option=" << recovery_option;
+ LOG(DEBUG) << __func__ << ": recovery option=" << recovery_option;
}
void initializeNfceePowerAndLinkConf() {
nfcee_power_and_link_conf =
NfcConfig::getUnsigned(NAME_ALWAYS_ON_SET_EE_POWER_AND_LINK_CONF, 0);
- DLOG_IF(INFO, nfc_debug_enabled)
- << __func__ << ": Always on set NFCEE_POWER_AND_LINK_CONF="
- << nfcee_power_and_link_conf;
+ LOG(DEBUG) << __func__ << ": Always on set NFCEE_POWER_AND_LINK_CONF="
+ << nfcee_power_and_link_conf;
}
} // namespace
@@ -270,14 +263,13 @@ static void handleRfDiscoveryEvent(tNFC_RESULT_DEVT* discoveredDevice) {
static void nfaConnectionCallback(uint8_t connEvent,
tNFA_CONN_EVT_DATA* eventData) {
tNFA_STATUS status = NFA_STATUS_FAILED;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: event= %u", __func__, connEvent);
+ LOG(DEBUG) << StringPrintf("%s: event= %u", __func__, connEvent);
switch (connEvent) {
case NFA_LISTEN_ENABLED_EVT: // whether listening successfully started
{
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_LISTEN_ENABLED_EVT:status= %u", __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_LISTEN_ENABLED_EVT:status= %u",
+ __func__, eventData->status);
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
sNfaEnableDisablePollingEvent.notifyOne();
@@ -285,8 +277,8 @@ static void nfaConnectionCallback(uint8_t connEvent,
case NFA_POLL_ENABLED_EVT: // whether polling successfully started
{
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_POLL_ENABLED_EVT: status = %u", __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_POLL_ENABLED_EVT: status = %u",
+ __func__, eventData->status);
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
sNfaEnableDisablePollingEvent.notifyOne();
@@ -294,9 +286,8 @@ static void nfaConnectionCallback(uint8_t connEvent,
case NFA_POLL_DISABLED_EVT: // Listening/Polling stopped
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_POLL_DISABLED_EVT: status = %u", __func__,
- eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_POLL_DISABLED_EVT: status = %u",
+ __func__, eventData->status);
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
sNfaEnableDisablePollingEvent.notifyOne();
@@ -304,9 +295,9 @@ static void nfaConnectionCallback(uint8_t connEvent,
case NFA_RF_DISCOVERY_STARTED_EVT: // RF Discovery started
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_RF_DISCOVERY_STARTED_EVT: status = %u",
- __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf(
+ "%s: NFA_RF_DISCOVERY_STARTED_EVT: status = %u", __func__,
+ eventData->status);
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
sNfaEnableDisablePollingEvent.notifyOne();
@@ -314,9 +305,9 @@ static void nfaConnectionCallback(uint8_t connEvent,
case NFA_RF_DISCOVERY_STOPPED_EVT: // RF Discovery stopped event
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_RF_DISCOVERY_STOPPED_EVT: status = %u",
- __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf(
+ "%s: NFA_RF_DISCOVERY_STOPPED_EVT: status = %u", __func__,
+ eventData->status);
gActivated = false;
@@ -326,8 +317,8 @@ static void nfaConnectionCallback(uint8_t connEvent,
case NFA_DISC_RESULT_EVT: // NFC link/protocol discovery notificaiton
status = eventData->disc_result.status;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_DISC_RESULT_EVT: status = %d", __func__, status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_DISC_RESULT_EVT: status = %d",
+ __func__, status);
if (status != NFA_STATUS_OK) {
NfcTag::getInstance().setNumDiscNtf(0);
LOG(ERROR) << StringPrintf("%s: NFA_DISC_RESULT_EVT error: status = %d",
@@ -339,7 +330,7 @@ static void nfaConnectionCallback(uint8_t connEvent,
break;
case NFA_SELECT_RESULT_EVT: // NFC link/protocol discovery select response
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_SELECT_RESULT_EVT: status = %d, gIsSelectingRfInterface = "
"%d, "
"sIsDisabling=%d",
@@ -360,14 +351,13 @@ static void nfaConnectionCallback(uint8_t connEvent,
break;
case NFA_DEACTIVATE_FAIL_EVT:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_DEACTIVATE_FAIL_EVT: status = %d", __func__,
- eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_DEACTIVATE_FAIL_EVT: status = %d",
+ __func__, eventData->status);
break;
case NFA_ACTIVATED_EVT: // NFC link/protocol activated
{
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_ACTIVATED_EVT: gIsSelectingRfInterface=%d, sIsDisabling=%d",
__func__, gIsSelectingRfInterface, sIsDisabling);
uint8_t activatedProtocol =
@@ -402,25 +392,23 @@ static void nfaConnectionCallback(uint8_t connEvent,
}
if (isPeerToPeer(eventData->activated)) {
if (sReaderModeEnabled) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: ignoring peer target in reader mode.", __func__);
+ LOG(DEBUG) << StringPrintf("%s: ignoring peer target in reader mode.",
+ __func__);
NFA_Deactivate(FALSE);
break;
}
sP2pActive = true;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_ACTIVATED_EVT; is p2p", __func__);
+ LOG(DEBUG) << StringPrintf("%s: NFA_ACTIVATED_EVT; is p2p", __func__);
if (NFC_GetNCIVersion() == NCI_VERSION_1_0) {
// Disable RF field events in case of p2p
uint8_t nfa_disable_rf_events[] = {0x00};
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Disabling RF field events", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Disabling RF field events", __func__);
status = NFA_SetConfig(NCI_PARAM_ID_RF_FIELD_INFO,
sizeof(nfa_disable_rf_events),
&nfa_disable_rf_events[0]);
if (status == NFA_STATUS_OK) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Disabled RF field events", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Disabled RF field events",
+ __func__);
} else {
LOG(ERROR) << StringPrintf("%s: Failed to disable RF field events",
__func__);
@@ -444,7 +432,7 @@ static void nfaConnectionCallback(uint8_t connEvent,
}
} break;
case NFA_DEACTIVATED_EVT: // NFC link/protocol deactivated
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_DEACTIVATED_EVT Type: %u, gIsTagDeactivating: %d",
__func__, eventData->deactivated.type, gIsTagDeactivating);
NfcTag::getInstance().setDeactivationState(eventData->deactivated);
@@ -473,21 +461,21 @@ static void nfaConnectionCallback(uint8_t connEvent,
} else if (sP2pActive) {
sP2pActive = false;
// Make sure RF field events are re-enabled
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_DEACTIVATED_EVT; is p2p", __func__);
+ LOG(DEBUG) << StringPrintf("%s: NFA_DEACTIVATED_EVT; is p2p",
+ __func__);
if (NFC_GetNCIVersion() == NCI_VERSION_1_0) {
// Disable RF field events in case of p2p
uint8_t nfa_enable_rf_events[] = {0x01};
if (!sIsDisabling && sIsNfaEnabled) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Enabling RF field events", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Enabling RF field events",
+ __func__);
status = NFA_SetConfig(NCI_PARAM_ID_RF_FIELD_INFO,
sizeof(nfa_enable_rf_events),
&nfa_enable_rf_events[0]);
if (status == NFA_STATUS_OK) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Enabled RF field events", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Enabled RF field events",
+ __func__);
} else {
LOG(ERROR) << StringPrintf(
"%s: Failed to enable RF field events", __func__);
@@ -501,7 +489,7 @@ static void nfaConnectionCallback(uint8_t connEvent,
case NFA_TLV_DETECT_EVT: // TLV Detection complete
status = eventData->tlv_detect.status;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_TLV_DETECT_EVT: status = %d, protocol = %d, num_tlvs = %d, "
"num_bytes = %d",
__func__, status, eventData->tlv_detect.protocol,
@@ -516,7 +504,7 @@ static void nfaConnectionCallback(uint8_t connEvent,
// if status is failure, it means the tag does not contain any or valid
// NDEF data; pass the failure status to the NFC Service;
status = eventData->ndef_detect.status;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_NDEF_DETECT_EVT: status = 0x%X, protocol = %u, "
"max_size = %u, cur_size = %u, flags = 0x%X",
__func__, status, eventData->ndef_detect.protocol,
@@ -529,22 +517,21 @@ static void nfaConnectionCallback(uint8_t connEvent,
break;
case NFA_DATA_EVT: // Data message received (for non-NDEF reads)
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_DATA_EVT: status = 0x%X, len = %d", __func__,
- eventData->status, eventData->data.len);
+ LOG(DEBUG) << StringPrintf("%s: NFA_DATA_EVT: status = 0x%X, len = %d",
+ __func__, eventData->status,
+ eventData->data.len);
nativeNfcTag_doTransceiveStatus(eventData->status, eventData->data.p_data,
eventData->data.len);
break;
case NFA_RW_INTF_ERROR_EVT:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFC_RW_INTF_ERROR_EVT", __func__);
+ LOG(DEBUG) << StringPrintf("%s: NFC_RW_INTF_ERROR_EVT", __func__);
nativeNfcTag_notifyRfTimeout();
nativeNfcTag_doReadCompleted(NFA_STATUS_TIMEOUT);
break;
case NFA_SELECT_CPLT_EVT: // Select completed
status = eventData->status;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_SELECT_CPLT_EVT: status = %d", __func__, status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_SELECT_CPLT_EVT: status = %d",
+ __func__, status);
if (status != NFA_STATUS_OK) {
LOG(ERROR) << StringPrintf("%s: NFA_SELECT_CPLT_EVT error: status = %d",
__func__, status);
@@ -552,28 +539,27 @@ static void nfaConnectionCallback(uint8_t connEvent,
break;
case NFA_READ_CPLT_EVT: // NDEF-read or tag-specific-read completed
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_READ_CPLT_EVT: status = 0x%X", __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_READ_CPLT_EVT: status = 0x%X",
+ __func__, eventData->status);
nativeNfcTag_doReadCompleted(eventData->status);
NfcTag::getInstance().connectionEventHandler(connEvent, eventData);
break;
case NFA_WRITE_CPLT_EVT: // Write completed
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_WRITE_CPLT_EVT: status = %d", __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_WRITE_CPLT_EVT: status = %d",
+ __func__, eventData->status);
nativeNfcTag_doWriteStatus(eventData->status == NFA_STATUS_OK);
break;
case NFA_SET_TAG_RO_EVT: // Tag set as Read only
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_SET_TAG_RO_EVT: status = %d", __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_SET_TAG_RO_EVT: status = %d",
+ __func__, eventData->status);
nativeNfcTag_doMakeReadonlyResult(eventData->status);
break;
case NFA_CE_NDEF_WRITE_START_EVT: // NDEF write started
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_CE_NDEF_WRITE_START_EVT: status: %d",
- __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_CE_NDEF_WRITE_START_EVT: status: %d",
+ __func__, eventData->status);
if (eventData->status != NFA_STATUS_OK)
LOG(ERROR) << StringPrintf(
@@ -582,36 +568,34 @@ static void nfaConnectionCallback(uint8_t connEvent,
break;
case NFA_CE_NDEF_WRITE_CPLT_EVT: // NDEF write completed
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: FA_CE_NDEF_WRITE_CPLT_EVT: len = %u", __func__,
- eventData->ndef_write_cplt.len);
+ LOG(DEBUG) << StringPrintf("%s: FA_CE_NDEF_WRITE_CPLT_EVT: len = %u",
+ __func__, eventData->ndef_write_cplt.len);
break;
case NFA_PRESENCE_CHECK_EVT:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_PRESENCE_CHECK_EVT", __func__);
+ LOG(DEBUG) << StringPrintf("%s: NFA_PRESENCE_CHECK_EVT", __func__);
nativeNfcTag_doPresenceCheckResult(eventData->status);
break;
case NFA_FORMAT_CPLT_EVT:
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_FORMAT_CPLT_EVT: status=0x%X", __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_FORMAT_CPLT_EVT: status=0x%X",
+ __func__, eventData->status);
nativeNfcTag_formatStatus(eventData->status == NFA_STATUS_OK);
break;
case NFA_I93_CMD_CPLT_EVT:
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_I93_CMD_CPLT_EVT: status=0x%X", __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_I93_CMD_CPLT_EVT: status=0x%X",
+ __func__, eventData->status);
break;
case NFA_CE_UICC_LISTEN_CONFIGURED_EVT:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_CE_UICC_LISTEN_CONFIGURED_EVT : status=0x%X",
- __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf(
+ "%s: NFA_CE_UICC_LISTEN_CONFIGURED_EVT : status=0x%X", __func__,
+ eventData->status);
break;
default:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: unknown event (%d) ????", __func__, connEvent);
+ LOG(DEBUG) << StringPrintf("%s: unknown event (%d) ????", __func__,
+ connEvent);
break;
}
}
@@ -631,7 +615,7 @@ static jboolean nfcManager_initNativeStruc(JNIEnv* e, jobject o) {
initializeGlobalDebugEnabledFlag();
initializeRecoveryOption();
initializeNfceePowerAndLinkConf();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
nfc_jni_native_data* nat =
(nfc_jni_native_data*)malloc(sizeof(struct nfc_jni_native_data));
@@ -692,7 +676,7 @@ static jboolean nfcManager_initNativeStruc(JNIEnv* e, jobject o) {
return JNI_FALSE;
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return JNI_TRUE;
}
@@ -709,15 +693,14 @@ static jboolean nfcManager_initNativeStruc(JNIEnv* e, jobject o) {
*******************************************************************************/
void nfaDeviceManagementCallback(uint8_t dmEvent,
tNFA_DM_CBACK_DATA* eventData) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter; event=0x%X", __func__, dmEvent);
+ LOG(DEBUG) << StringPrintf("%s: enter; event=0x%X", __func__, dmEvent);
switch (dmEvent) {
case NFA_DM_ENABLE_EVT: /* Result of NFA_Enable */
{
SyncEventGuard guard(sNfaEnableEvent);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_DM_ENABLE_EVT; status=0x%X", __func__, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_DM_ENABLE_EVT; status=0x%X", __func__,
+ eventData->status);
sIsNfaEnabled = eventData->status == NFA_STATUS_OK;
sIsDisabling = false;
sNfaEnableEvent.notifyOne();
@@ -726,16 +709,14 @@ void nfaDeviceManagementCallback(uint8_t dmEvent,
case NFA_DM_DISABLE_EVT: /* Result of NFA_Disable */
{
SyncEventGuard guard(sNfaDisableEvent);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_DM_DISABLE_EVT", __func__);
+ LOG(DEBUG) << StringPrintf("%s: NFA_DM_DISABLE_EVT", __func__);
sIsNfaEnabled = false;
sIsDisabling = false;
sNfaDisableEvent.notifyOne();
} break;
case NFA_DM_SET_CONFIG_EVT: // result of NFA_SetConfig
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_DM_SET_CONFIG_EVT", __func__);
+ LOG(DEBUG) << StringPrintf("%s: NFA_DM_SET_CONFIG_EVT", __func__);
{
SyncEventGuard guard(gNfaSetConfigEvent);
gNfaSetConfigEvent.notifyOne();
@@ -743,8 +724,7 @@ void nfaDeviceManagementCallback(uint8_t dmEvent,
break;
case NFA_DM_GET_CONFIG_EVT: /* Result of NFA_GetConfig */
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_DM_GET_CONFIG_EVT", __func__);
+ LOG(DEBUG) << StringPrintf("%s: NFA_DM_GET_CONFIG_EVT", __func__);
{
SyncEventGuard guard(gNfaGetConfigEvent);
if (eventData->status == NFA_STATUS_OK &&
@@ -761,7 +741,7 @@ void nfaDeviceManagementCallback(uint8_t dmEvent,
break;
case NFA_DM_RF_FIELD_EVT:
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_DM_RF_FIELD_EVT; status=0x%X; field status=%u", __func__,
eventData->rf_field.status, eventData->rf_field.rf_field_status);
if (!sP2pActive && eventData->rf_field.status == NFA_STATUS_OK) {
@@ -804,38 +784,37 @@ void nfaDeviceManagementCallback(uint8_t dmEvent,
e->CallVoidMethod(nat->manager,
android::gCachedNfcManagerNotifyHwErrorReported);
{
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: aborting sNfaEnableDisablePollingEvent", __func__);
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
sNfaEnableDisablePollingEvent.notifyOne();
}
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: aborting sNfaEnableEvent", __func__);
+ LOG(DEBUG) << StringPrintf("%s: aborting sNfaEnableEvent", __func__);
SyncEventGuard guard(sNfaEnableEvent);
sNfaEnableEvent.notifyOne();
}
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: aborting sNfaDisableEvent", __func__);
+ LOG(DEBUG) << StringPrintf("%s: aborting sNfaDisableEvent",
+ __func__);
SyncEventGuard guard(sNfaDisableEvent);
sNfaDisableEvent.notifyOne();
}
{
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: aborting sNfaSetPowerSubState", __func__);
+ LOG(DEBUG) << StringPrintf("%s: aborting sNfaSetPowerSubState",
+ __func__);
SyncEventGuard guard(sNfaSetPowerSubState);
sNfaSetPowerSubState.notifyOne();
}
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: aborting gNfaSetConfigEvent", __func__);
+ LOG(DEBUG) << StringPrintf("%s: aborting gNfaSetConfigEvent",
+ __func__);
SyncEventGuard guard(gNfaSetConfigEvent);
gNfaSetConfigEvent.notifyOne();
}
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: aborting gNfaGetConfigEvent", __func__);
+ LOG(DEBUG) << StringPrintf("%s: aborting gNfaGetConfigEvent",
+ __func__);
SyncEventGuard guard(gNfaGetConfigEvent);
gNfaGetConfigEvent.notifyOne();
}
@@ -844,20 +823,19 @@ void nfaDeviceManagementCallback(uint8_t dmEvent,
NfcTag::getInstance().abort();
sAbortConnlessWait = true;
{
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: aborting sNfaEnableDisablePollingEvent", __func__);
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
sNfaEnableDisablePollingEvent.notifyOne();
}
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: aborting sNfaEnableEvent", __func__);
+ LOG(DEBUG) << StringPrintf("%s: aborting sNfaEnableEvent", __func__);
SyncEventGuard guard(sNfaEnableEvent);
sNfaEnableEvent.notifyOne();
}
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: aborting sNfaDisableEvent", __func__);
+ LOG(DEBUG) << StringPrintf("%s: aborting sNfaDisableEvent",
+ __func__);
SyncEventGuard guard(sNfaDisableEvent);
sNfaDisableEvent.notifyOne();
}
@@ -886,15 +864,14 @@ void nfaDeviceManagementCallback(uint8_t dmEvent,
break;
case NFA_DM_SET_POWER_SUB_STATE_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_DM_SET_POWER_SUB_STATE_EVT; status=0x%X",
- __FUNCTION__, eventData->power_sub_state.status);
+ LOG(DEBUG) << StringPrintf(
+ "%s: NFA_DM_SET_POWER_SUB_STATE_EVT; status=0x%X", __FUNCTION__,
+ eventData->power_sub_state.status);
SyncEventGuard guard(sNfaSetPowerSubState);
sNfaSetPowerSubState.notifyOne();
} break;
default:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: unhandled event", __func__);
+ LOG(DEBUG) << StringPrintf("%s: unhandled event", __func__);
break;
}
}
@@ -1035,13 +1012,12 @@ void static nfaVSCallback(uint8_t event, uint16_t param_len, uint8_t* p_param) {
} break;
default:
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "Unknown Android sub opcode %x", android_sub_opcode);
+ LOG(DEBUG) << StringPrintf("Unknown Android sub opcode %x",
+ android_sub_opcode);
}
} break;
default:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("Unknown NFC Proprietary opcode %x", event);
+ LOG(DEBUG) << StringPrintf("Unknown NFC Proprietary opcode %x", event);
break;
}
}
@@ -1076,8 +1052,7 @@ static jboolean nfcManager_setObserveMode(JNIEnv* e, jobject, jboolean enable) {
if (status == NFA_STATUS_OK) {
gNfaVsCommand.wait();
} else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Failed to set observe mode ", __FUNCTION__);
+ LOG(DEBUG) << StringPrintf("%s: Failed to set observe mode ", __FUNCTION__);
gVSCmdStatus = NFA_STATUS_FAILED;
}
if (reenbleDiscovery) {
@@ -1100,7 +1075,7 @@ static jboolean nfcManager_setObserveMode(JNIEnv* e, jobject, jboolean enable) {
*******************************************************************************/
static jint nfcManager_doRegisterT3tIdentifier(JNIEnv* e, jobject,
jbyteArray t3tIdentifier) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
ScopedByteArrayRO bytes(e, t3tIdentifier);
uint8_t* buf =
@@ -1108,11 +1083,10 @@ static jint nfcManager_doRegisterT3tIdentifier(JNIEnv* e, jobject,
size_t bufLen = bytes.size();
int handle = RoutingManager::getInstance().registerT3tIdentifier(buf, bufLen);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: handle=%d", __func__, handle);
+ LOG(DEBUG) << StringPrintf("%s: handle=%d", __func__, handle);
if (handle != NFA_HANDLE_INVALID)
RoutingManager::getInstance().commitRouting();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return handle;
}
@@ -1131,13 +1105,12 @@ static jint nfcManager_doRegisterT3tIdentifier(JNIEnv* e, jobject,
*******************************************************************************/
static void nfcManager_doDeregisterT3tIdentifier(JNIEnv*, jobject,
jint handle) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter; handle=%d", __func__, handle);
+ LOG(DEBUG) << StringPrintf("%s: enter; handle=%d", __func__, handle);
RoutingManager::getInstance().deregisterT3tIdentifier(handle);
RoutingManager::getInstance().commitRouting();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
}
/*******************************************************************************
@@ -1152,9 +1125,9 @@ static void nfcManager_doDeregisterT3tIdentifier(JNIEnv*, jobject,
**
*******************************************************************************/
static jint nfcManager_getLfT3tMax(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("LF_T3T_MAX=%d", sLfT3tMax);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("LF_T3T_MAX=%d", sLfT3tMax);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return sLfT3tMax;
}
@@ -1178,8 +1151,7 @@ static jboolean nfcManager_doInitialize(JNIEnv* e, jobject o) {
PowerSwitch& powerSwitch = PowerSwitch::getInstance();
if (sIsNfaEnabled) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: already enabled", __func__);
+ LOG(DEBUG) << StringPrintf("%s: already enabled", __func__);
goto TheEnd;
}
@@ -1229,8 +1201,8 @@ static jboolean nfcManager_doInitialize(JNIEnv* e, jobject o) {
if (nat) {
nat->tech_mask =
NfcConfig::getUnsigned(NAME_POLLING_TECH_MASK, DEFAULT_TECH_MASK);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: tag polling tech mask=0x%X", __func__, nat->tech_mask);
+ LOG(DEBUG) << StringPrintf("%s: tag polling tech mask=0x%X", __func__,
+ nat->tech_mask);
}
// if this value exists, set polling interval.
@@ -1248,8 +1220,8 @@ static jboolean nfcManager_doInitialize(JNIEnv* e, jobject o) {
gNfaGetConfigEvent.wait();
if (gCurrentConfigLen >= 4 ||
gConfig[1] == NCI_PARAM_ID_LF_T3T_MAX) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: lfT3tMax=%d", __func__, gConfig[3]);
+ LOG(DEBUG) << StringPrintf("%s: lfT3tMax=%d", __func__,
+ gConfig[3]);
sLfT3tMax = gConfig[3];
}
}
@@ -1283,7 +1255,7 @@ TheEnd:
NFA_RegVSCback(true, &nfaVSCallback);
}
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return sIsNfaEnabled ? JNI_TRUE : JNI_FALSE;
}
@@ -1350,8 +1322,8 @@ static void nfcManager_enableDiscovery(JNIEnv* e, jobject o,
tech_mask = (tNFA_TECHNOLOGY_MASK)nat->tech_mask;
else if (technologies_mask != -1)
tech_mask = (tNFA_TECHNOLOGY_MASK)technologies_mask;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter; tech_mask = %02x", __func__, tech_mask);
+ LOG(DEBUG) << StringPrintf("%s: enter; tech_mask = %02x", __func__,
+ tech_mask);
if (sDiscoveryEnabled && !restart) {
LOG(ERROR) << StringPrintf("%s: already discovering", __func__);
@@ -1372,10 +1344,9 @@ static void nfcManager_enableDiscovery(JNIEnv* e, jobject o,
// Start P2P listening if tag polling was enabled
if (sPollingEnabled) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Enable p2pListening", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Enable p2pListening", __func__);
- if (reader_mode && !sReaderModeEnabled) {
+ if (reader_mode && !sReaderModeEnabled) {
sReaderModeEnabled = true;
NFA_DisableListening();
@@ -1396,7 +1367,7 @@ static void nfcManager_enableDiscovery(JNIEnv* e, jobject o,
}
} else {
if (!reader_mode && sReaderModeEnabled) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: if reader mode disable, enable listen again", __func__);
struct nfc_jni_native_data* nat = getNative(e, o);
sReaderModeEnabled = false;
@@ -1425,7 +1396,7 @@ static void nfcManager_enableDiscovery(JNIEnv* e, jobject o,
PowerSwitch::getInstance().setModeOn(PowerSwitch::DISCOVERY);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
}
/*******************************************************************************
@@ -1441,11 +1412,10 @@ static void nfcManager_enableDiscovery(JNIEnv* e, jobject o,
*******************************************************************************/
void nfcManager_disableDiscovery(JNIEnv* e, jobject o) {
tNFA_STATUS status = NFA_STATUS_OK;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter;", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter;", __func__);
if (sDiscoveryEnabled == false) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: already disabled", __func__);
+ LOG(DEBUG) << StringPrintf("%s: already disabled", __func__);
goto TheEnd;
}
@@ -1458,8 +1428,7 @@ void nfcManager_disableDiscovery(JNIEnv* e, jobject o) {
if (!PowerSwitch::getInstance().setModeOff(PowerSwitch::DISCOVERY))
PowerSwitch::getInstance().setLevel(PowerSwitch::LOW_POWER);
TheEnd:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit: Status = 0x%X", __func__, status);
+ LOG(DEBUG) << StringPrintf("%s: exit: Status = 0x%X", __func__, status);
}
/*******************************************************************************
@@ -1474,8 +1443,7 @@ TheEnd:
**
*******************************************************************************/
static jint nfcManager_doGetLastError(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: last error=%i", __func__, sLastError);
+ LOG(DEBUG) << StringPrintf("%s: last error=%i", __func__, sLastError);
return sLastError;
}
@@ -1491,7 +1459,7 @@ static jint nfcManager_doGetLastError(JNIEnv*, jobject) {
**
*******************************************************************************/
static jboolean nfcManager_doDeinitialize(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
sIsDisabling = true;
@@ -1505,8 +1473,7 @@ static jboolean nfcManager_doDeinitialize(JNIEnv*, jobject) {
SyncEventGuard guard(sNfaDisableEvent);
tNFA_STATUS stat = NFA_Disable(TRUE /* graceful */);
if (stat == NFA_STATUS_OK) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: wait for completion", __func__);
+ LOG(DEBUG) << StringPrintf("%s: wait for completion", __func__);
sNfaDisableEvent.wait(); // wait for NFA command to finish
} else {
LOG(ERROR) << StringPrintf("%s: fail disable; error=0x%X", __func__,
@@ -1535,7 +1502,7 @@ static jboolean nfcManager_doDeinitialize(JNIEnv*, jobject) {
NfcAdaptation& theInstance = NfcAdaptation::GetInstance();
theInstance.Finalize();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return JNI_TRUE;
}
@@ -1606,13 +1573,13 @@ static void nfcManager_doAbort(JNIEnv* e, jobject, jstring msg) {
**
*******************************************************************************/
static jboolean nfcManager_doDownload(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
NfcAdaptation& theInstance = NfcAdaptation::GetInstance();
bool result = JNI_FALSE;
theInstance.Initialize(); // start GKI, NCI task, NFC task
result = theInstance.DownloadFirmware();
theInstance.Finalize();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return result;
}
@@ -1626,7 +1593,7 @@ static jboolean nfcManager_doDownload(JNIEnv*, jobject) {
**
*******************************************************************************/
static void nfcManager_doResetTimeouts(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
NfcTag::getInstance().resetAllTransceiveTimeouts();
}
@@ -1648,8 +1615,8 @@ static bool nfcManager_doSetTimeout(JNIEnv*, jobject, jint tech, jint timeout) {
LOG(ERROR) << StringPrintf("%s: Timeout must be positive.", __func__);
return false;
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: tech=%d, timeout=%d", __func__, tech, timeout);
+ LOG(DEBUG) << StringPrintf("%s: tech=%d, timeout=%d", __func__, tech,
+ timeout);
NfcTag::getInstance().setTransceiveTimeout(tech, timeout);
return true;
}
@@ -1668,8 +1635,8 @@ static bool nfcManager_doSetTimeout(JNIEnv*, jobject, jint tech, jint timeout) {
*******************************************************************************/
static jint nfcManager_doGetTimeout(JNIEnv*, jobject, jint tech) {
int timeout = NfcTag::getInstance().getTransceiveTimeout(tech);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: tech=%d, timeout=%d", __func__, tech, timeout);
+ LOG(DEBUG) << StringPrintf("%s: tech=%d, timeout=%d", __func__, tech,
+ timeout);
return timeout;
}
@@ -1704,12 +1671,12 @@ static void nfcManager_doSetScreenState(JNIEnv* e, jobject o,
uint8_t discovry_param =
NCI_LISTEN_DH_NFCEE_ENABLE_MASK | NCI_POLLING_DH_ENABLE_MASK;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: state = %d prevScreenState= %d, discovry_param = %d",
- __FUNCTION__, state, prevScreenState, discovry_param);
+ LOG(DEBUG) << StringPrintf(
+ "%s: state = %d prevScreenState= %d, discovry_param = %d", __FUNCTION__,
+ state, prevScreenState, discovry_param);
if (prevScreenState == state) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"New screen state is same as previous state. No action taken");
return;
}
@@ -1829,8 +1796,7 @@ static void nfcManager_doSetScreenState(JNIEnv* e, jobject o,
*******************************************************************************/
static void nfcManager_doSetP2pInitiatorModes(JNIEnv* e, jobject o,
jint modes) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: modes=0x%X", __func__, modes);
+ LOG(DEBUG) << StringPrintf("%s: modes=0x%X", __func__, modes);
struct nfc_jni_native_data* nat = getNative(e, o);
tNFA_TECHNOLOGY_MASK mask = 0;
@@ -1856,8 +1822,7 @@ static void nfcManager_doSetP2pInitiatorModes(JNIEnv* e, jobject o,
**
*******************************************************************************/
static void nfcManager_doSetP2pTargetModes(JNIEnv*, jobject, jint modes) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: modes=0x%X", __func__, modes);
+ LOG(DEBUG) << StringPrintf("%s: modes=0x%X", __func__, modes);
}
static void nfcManager_doEnableScreenOffSuspend(JNIEnv* e, jobject o) {
@@ -2000,23 +1965,20 @@ static jbyteArray nfcManager_doGetRoutingTable(JNIEnv* e, jobject o) {
static void nfcManager_clearRoutingEntry(JNIEnv* e, jobject o,
jint clearFlags) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: clearFlags=0x%X", __func__, clearFlags);
+ LOG(DEBUG) << StringPrintf("%s: clearFlags=0x%X", __func__, clearFlags);
RoutingManager::getInstance().disableRoutingToHost();
RoutingManager::getInstance().clearRoutingEntry(clearFlags);
}
static void nfcManager_updateIsoDepProtocolRoute(JNIEnv* e, jobject o,
jint route) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: clearFlags=0x%X", __func__, route);
+ LOG(DEBUG) << StringPrintf("%s: clearFlags=0x%X", __func__, route);
RoutingManager::getInstance().updateIsoDepProtocolRoute(route);
}
static void nfcManager_updateTechnologyABRoute(JNIEnv* e, jobject o,
jint route) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: clearFlags=0x%X", __func__, route);
+ LOG(DEBUG) << StringPrintf("%s: clearFlags=0x%X", __func__, route);
RoutingManager::getInstance().updateTechnologyABRoute(route);
}
@@ -2036,8 +1998,8 @@ static void nfcManager_setDiscoveryTech(JNIEnv* e, jobject o, jint pollTech,
tNFA_STATUS nfaStat;
bool isRevertPoll = false;
bool isRevertListen = false;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s pollTech = 0x%x, listenTech = 0x%x", __func__, pollTech, listenTech);
+ LOG(DEBUG) << StringPrintf("%s pollTech = 0x%x, listenTech = 0x%x", __func__,
+ pollTech, listenTech);
if (pollTech < 0) isRevertPoll = true;
if (listenTech < 0) isRevertListen = true;
@@ -2070,7 +2032,7 @@ static void nfcManager_setDiscoveryTech(JNIEnv* e, jobject o, jint pollTech,
*******************************************************************************/
static void nfcManager_resetDiscoveryTech(JNIEnv* e, jobject o) {
tNFA_STATUS nfaStat;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s : enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s : enter", __func__);
nativeNfcTag_acquireRfInterfaceMutexLock();
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
@@ -2199,9 +2161,9 @@ static JNINativeMethod gMethods[] = {
**
*******************************************************************************/
int register_com_android_nfc_NativeNfcManager(JNIEnv* e) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
PowerSwitch::getInstance().initialize(PowerSwitch::UNKNOWN_LEVEL);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return jniRegisterNativeMethods(e, gNativeNfcManagerClassName, gMethods,
NELEM(gMethods));
}
@@ -2219,8 +2181,7 @@ int register_com_android_nfc_NativeNfcManager(JNIEnv* e) {
void startRfDiscovery(bool isStart) {
tNFA_STATUS status = NFA_STATUS_FAILED;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: is start=%d", __func__, isStart);
+ LOG(DEBUG) << StringPrintf("%s: is start=%d", __func__, isStart);
nativeNfcTag_acquireRfInterfaceMutexLock();
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
status = isStart ? NFA_StartRfDiscovery() : NFA_StopRfDiscovery();
@@ -2262,8 +2223,7 @@ void doStartupConfig() {
if (NfcConfig::hasKey(NAME_POLL_FREQUENCY))
polling_frequency = NfcConfig::getBytes(NAME_POLL_FREQUENCY);
if (polling_frequency.size() == 8) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: polling frequency", __func__);
+ LOG(DEBUG) << StringPrintf("%s: polling frequency", __func__);
memset(&nfa_dm_disc_freq_cfg, 0, sizeof(nfa_dm_disc_freq_cfg));
nfa_dm_disc_freq_cfg.pa = polling_frequency[0];
nfa_dm_disc_freq_cfg.pb = polling_frequency[1];
@@ -2306,8 +2266,7 @@ bool nfcManager_isNfcActive() { return sIsNfaEnabled; }
void startStopPolling(bool isStartPolling) {
tNFA_STATUS status = NFA_STATUS_FAILED;
uint8_t discovry_param = 0;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter; isStart=%u", __func__, isStartPolling);
+ LOG(DEBUG) << StringPrintf("%s: enter; isStart=%u", __func__, isStartPolling);
if (NFC_GetNCIVersion() >= NCI_VERSION_2_0) {
SyncEventGuard guard(gNfaSetConfigEvent);
@@ -2334,7 +2293,7 @@ void startStopPolling(bool isStartPolling) {
stopPolling_rfDiscoveryDisabled();
startRfDiscovery(true);
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
}
static tNFA_STATUS startPolling_rfDiscoveryDisabled(
@@ -2347,12 +2306,10 @@ static tNFA_STATUS startPolling_rfDiscoveryDisabled(
nativeNfcTag_acquireRfInterfaceMutexLock();
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enable polling", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enable polling", __func__);
stat = NFA_EnablePolling(tech_mask);
if (stat == NFA_STATUS_OK) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: wait for enable event", __func__);
+ LOG(DEBUG) << StringPrintf("%s: wait for enable event", __func__);
sPollingEnabled = true;
sNfaEnableDisablePollingEvent.wait(); // wait for NFA_POLL_ENABLED_EVT
} else {
@@ -2369,8 +2326,7 @@ static tNFA_STATUS stopPolling_rfDiscoveryDisabled() {
nativeNfcTag_acquireRfInterfaceMutexLock();
SyncEventGuard guard(sNfaEnableDisablePollingEvent);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: disable polling", __func__);
+ LOG(DEBUG) << StringPrintf("%s: disable polling", __func__);
stat = NFA_DisablePolling();
if (stat == NFA_STATUS_OK) {
sPollingEnabled = false;
@@ -2386,7 +2342,7 @@ static tNFA_STATUS stopPolling_rfDiscoveryDisabled() {
static jboolean nfcManager_doSetPowerSavingMode(JNIEnv* e, jobject o,
bool flag) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter; ", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter; ", __func__);
uint8_t cmd[] = {(NCI_MT_CMD << NCI_MT_SHIFT) | NCI_GID_PROP,
NCI_MSG_PROP_ANDROID, NCI_ANDROID_POWER_SAVING_PARAM_SIZE,
NCI_ANDROID_POWER_SAVING,
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
index 6307a552..b4aa7963 100644
--- a/nci/jni/NativeNfcTag.cpp
+++ b/nci/jni/NativeNfcTag.cpp
@@ -14,8 +14,8 @@
* limitations under the License.
*/
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <errno.h>
#include <malloc.h>
#include <nativehelper/ScopedLocalRef.h>
@@ -46,7 +46,6 @@ extern bool nfcManager_isNfcActive();
extern bool gActivated;
extern SyncEvent gDeactivatedEvent;
-extern bool nfc_debug_enabled;
/*****************************************************************************
**
@@ -139,7 +138,7 @@ static bool switchRfInterface(tNFA_INTF_TYPE rfInterface);
**
*******************************************************************************/
void nativeNfcTag_abortWaits() {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
{
SyncEventGuard g(sReadEvent);
sReadEvent.notifyOne();
@@ -183,9 +182,8 @@ void nativeNfcTag_abortWaits() {
**
*******************************************************************************/
void nativeNfcTag_doReadCompleted(tNFA_STATUS status) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: status=0x%X; is reading=%u", __func__, status,
- sIsReadingNdefMessage);
+ LOG(DEBUG) << StringPrintf("%s: status=0x%X; is reading=%u", __func__, status,
+ sIsReadingNdefMessage);
if (sIsReadingNdefMessage == false)
return; // not reading NDEF message right now, so just return
@@ -238,22 +236,21 @@ void nativeNfcTag_setActivatedRfProtocol(tNFA_INTF_TYPE rfProtocol) {
*******************************************************************************/
static void ndefHandlerCallback(tNFA_NDEF_EVT event,
tNFA_NDEF_EVT_DATA* eventData) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: event=%u, eventData=%p", __func__, event, eventData);
+ LOG(DEBUG) << StringPrintf("%s: event=%u, eventData=%p", __func__, event,
+ eventData);
switch (event) {
case NFA_NDEF_REGISTER_EVT: {
tNFA_NDEF_REGISTER& ndef_reg = eventData->ndef_reg;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_NDEF_REGISTER_EVT; status=0x%X; h=0x%X",
- __func__, ndef_reg.status, ndef_reg.ndef_type_handle);
+ LOG(DEBUG) << StringPrintf(
+ "%s: NFA_NDEF_REGISTER_EVT; status=0x%X; h=0x%X", __func__,
+ ndef_reg.status, ndef_reg.ndef_type_handle);
sNdefTypeHandlerHandle = ndef_reg.ndef_type_handle;
} break;
case NFA_NDEF_DATA_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_NDEF_DATA_EVT; data_len = %u", __func__,
- eventData->ndef_data.len);
+ LOG(DEBUG) << StringPrintf("%s: NFA_NDEF_DATA_EVT; data_len = %u",
+ __func__, eventData->ndef_data.len);
sReadDataLen = eventData->ndef_data.len;
sReadData = (uint8_t*)malloc(sReadDataLen);
memcpy(sReadData, eventData->ndef_data.p_data, eventData->ndef_data.len);
@@ -277,7 +274,7 @@ static void ndefHandlerCallback(tNFA_NDEF_EVT event,
**
*******************************************************************************/
static jbyteArray nativeNfcTag_doRead(JNIEnv* e, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
tNFA_STATUS status = NFA_STATUS_FAILED;
jbyteArray buf = NULL;
@@ -298,14 +295,12 @@ static jbyteArray nativeNfcTag_doRead(JNIEnv* e, jobject) {
if (sReadDataLen > 0) // if stack actually read data from the tag
{
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: read %u bytes", __func__, sReadDataLen);
+ LOG(DEBUG) << StringPrintf("%s: read %u bytes", __func__, sReadDataLen);
buf = e->NewByteArray(sReadDataLen);
e->SetByteArrayRegion(buf, 0, sReadDataLen, (jbyte*)sReadData);
}
} else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: create empty buffer", __func__);
+ LOG(DEBUG) << StringPrintf("%s: create empty buffer", __func__);
sReadDataLen = 0;
sReadData = (uint8_t*)malloc(1);
buf = e->NewByteArray(sReadDataLen);
@@ -318,8 +313,7 @@ static jbyteArray nativeNfcTag_doRead(JNIEnv* e, jobject) {
}
sReadDataLen = 0;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit: Status = 0x%X", __func__, status);
+ LOG(DEBUG) << StringPrintf("%s: exit: Status = 0x%X", __func__, status);
return buf;
}
@@ -381,8 +375,7 @@ static jboolean nativeNfcTag_doWrite(JNIEnv* e, jobject, jbyteArray buf) {
uint8_t* p_data = const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(
&bytes[0])); // TODO: const-ness API bug in NFA_RwWriteNDef!
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter; len = %zu", __func__, bytes.size());
+ LOG(DEBUG) << StringPrintf("%s: enter; len = %zu", __func__, bytes.size());
/* Create the write semaphore */
if (sem_init(&sWriteSem, 0, 0) == -1) {
@@ -396,8 +389,7 @@ static jboolean nativeNfcTag_doWrite(JNIEnv* e, jobject, jbyteArray buf) {
// if tag does not contain a NDEF message
// and tag is capable of storing NDEF message
if (sCheckNdefCapable) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: try format", __func__);
+ LOG(DEBUG) << StringPrintf("%s: try format", __func__);
if (0 != sem_init(&sFormatSem, 0, 0)) {
LOG(ERROR) << StringPrintf(
"%s: semaphore creation failed (errno=0x%08x)", __func__, errno);
@@ -416,7 +408,7 @@ static jboolean nativeNfcTag_doWrite(JNIEnv* e, jobject, jbyteArray buf) {
if (sFormatOk == false) // if format operation failed
goto TheEnd;
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: try write", __func__);
+ LOG(DEBUG) << StringPrintf("%s: try write", __func__);
status = NFA_RwWriteNDef(p_data, bytes.size());
} else if (bytes.size() == 0) {
// if (NXP TagWriter wants to erase tag) then create and write an empty ndef
@@ -424,13 +416,11 @@ static jboolean nativeNfcTag_doWrite(JNIEnv* e, jobject, jbyteArray buf) {
NDEF_MsgInit(buffer, maxBufferSize, &curDataSize);
status = NDEF_MsgAddRec(buffer, maxBufferSize, &curDataSize, NDEF_TNF_EMPTY,
NULL, 0, NULL, 0, NULL, 0);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: create empty ndef msg; status=%u; size=%u",
- __func__, status, curDataSize);
+ LOG(DEBUG) << StringPrintf("%s: create empty ndef msg; status=%u; size=%u",
+ __func__, status, curDataSize);
status = NFA_RwWriteNDef(buffer, curDataSize);
} else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_RwWriteNDef", __func__);
+ LOG(DEBUG) << StringPrintf("%s: NFA_RwWriteNDef", __func__);
status = NFA_RwWriteNDef(p_data, bytes.size());
}
@@ -456,8 +446,7 @@ TheEnd:
__func__, errno);
}
sWriteWaitingForComplete = JNI_FALSE;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit; result=%d", __func__, result);
+ LOG(DEBUG) << StringPrintf("%s: exit; result=%d", __func__, result);
return result;
}
@@ -509,8 +498,7 @@ void nativeNfcTag_doDeactivateStatus(int status) {
**
*******************************************************************************/
static jint nativeNfcTag_doConnect(JNIEnv*, jobject, jint targetHandle) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: targetHandle = %d", __func__, targetHandle);
+ LOG(DEBUG) << StringPrintf("%s: targetHandle = %d", __func__, targetHandle);
int i = targetHandle;
NfcTag& natTag = NfcTag::getInstance();
int retCode = NFCSTATUS_SUCCESS;
@@ -537,7 +525,7 @@ static jint nativeNfcTag_doConnect(JNIEnv*, jobject, jint targetHandle) {
if (sCurrentConnectedTargetProtocol != NFC_PROTOCOL_ISO_DEP &&
sCurrentConnectedTargetProtocol != NFC_PROTOCOL_MIFARE) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s() Nfc type = %d, do nothing for non ISO_DEP and non Mifare ",
__func__, sCurrentConnectedTargetProtocol);
retCode = NFCSTATUS_SUCCESS;
@@ -548,11 +536,11 @@ static jint nativeNfcTag_doConnect(JNIEnv*, jobject, jint targetHandle) {
sCurrentConnectedTargetType == TARGET_TYPE_ISO14443_3B) {
if (sCurrentConnectedTargetProtocol != NFC_PROTOCOL_MIFARE) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: switching to tech: %d need to switch rf intf to frame", __func__,
- sCurrentConnectedTargetType);
- retCode = switchRfInterface(NFA_INTERFACE_FRAME) ? NFA_STATUS_OK
- : NFA_STATUS_FAILED;
+ LOG(DEBUG) << StringPrintf(
+ "%s: switching to tech: %d need to switch rf intf to frame", __func__,
+ sCurrentConnectedTargetType);
+ retCode = switchRfInterface(NFA_INTERFACE_FRAME) ? NFA_STATUS_OK
+ : NFA_STATUS_FAILED;
}
} else if (sCurrentConnectedTargetType == TARGET_TYPE_MIFARE_CLASSIC) {
retCode = switchRfInterface(NFA_INTERFACE_MIFARE) ? NFA_STATUS_OK
@@ -563,8 +551,7 @@ static jint nativeNfcTag_doConnect(JNIEnv*, jobject, jint targetHandle) {
}
TheEnd:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit 0x%X", __func__, retCode);
+ LOG(DEBUG) << StringPrintf("%s: exit 0x%X", __func__, retCode);
return retCode;
}
@@ -580,9 +567,8 @@ TheEnd:
**
*******************************************************************************/
static int reSelect(tNFA_INTF_TYPE rfInterface, bool fSwitchIfNeeded) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter; rf intf = %d, current intf = %d", __func__,
- rfInterface, sCurrentRfInterface);
+ LOG(DEBUG) << StringPrintf("%s: enter; rf intf = %d, current intf = %d",
+ __func__, rfInterface, sCurrentRfInterface);
sRfInterfaceMutex.lock();
@@ -600,8 +586,7 @@ static int reSelect(tNFA_INTF_TYPE rfInterface, bool fSwitchIfNeeded) {
do {
// if tag has shutdown, abort this method
if (NfcTag::getInstance().isNdefDetectionTimedOut()) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: ndef detection timeout; break", __func__);
+ LOG(DEBUG) << StringPrintf("%s: ndef detection timeout; break", __func__);
rVal = STATUS_CODE_TARGET_LOST;
break;
}
@@ -627,8 +612,7 @@ static int reSelect(tNFA_INTF_TYPE rfInterface, bool fSwitchIfNeeded) {
SyncEventGuard g(sReconnectEvent);
gIsTagDeactivating = true;
sGotDeactivate = false;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: deactivate to sleep", __func__);
+ LOG(DEBUG) << StringPrintf("%s: deactivate to sleep", __func__);
if (NFA_STATUS_OK !=
(status = NFA_Deactivate(TRUE))) // deactivate to sleep state
{
@@ -661,8 +645,8 @@ static int reSelect(tNFA_INTF_TYPE rfInterface, bool fSwitchIfNeeded) {
SyncEventGuard g2(sReconnectEvent);
sConnectWaitingForComplete = JNI_TRUE;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: select interface %u", __func__, rfInterface);
+ LOG(DEBUG) << StringPrintf("%s: select interface %u", __func__,
+ rfInterface);
gIsSelectingRfInterface = true;
if (NFA_STATUS_OK !=
(status = NFA_Select(natTag.mTechHandles[sCurrentConnectedHandle],
@@ -698,8 +682,8 @@ static int reSelect(tNFA_INTF_TYPE rfInterface, bool fSwitchIfNeeded) {
} while (sConnectOk == false && retry < 3);
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: select completed; sConnectOk=%d", __func__, sConnectOk);
+ LOG(DEBUG) << StringPrintf("%s: select completed; sConnectOk=%d", __func__,
+ sConnectOk);
if (NfcTag::getInstance().getActivationState() != NfcTag::Active) {
LOG(ERROR) << StringPrintf("%s: tag is not active", __func__);
rVal = STATUS_CODE_TARGET_LOST;
@@ -717,8 +701,7 @@ static int reSelect(tNFA_INTF_TYPE rfInterface, bool fSwitchIfNeeded) {
gIsTagDeactivating = false;
gIsSelectingRfInterface = false;
sRfInterfaceMutex.unlock();
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit; status=%d", __func__, rVal);
+ LOG(DEBUG) << StringPrintf("%s: exit; status=%d", __func__, rVal);
return rVal;
}
@@ -738,15 +721,14 @@ static bool switchRfInterface(tNFA_INTF_TYPE rfInterface) {
if (sCurrentConnectedTargetProtocol != NFC_PROTOCOL_ISO_DEP &&
sCurrentConnectedTargetProtocol != NFC_PROTOCOL_MIFARE) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: protocol: %d not ISO_DEP and not Mifare, do nothing", __func__,
natTag.mTechLibNfcTypes[0]);
return true;
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: new rf intf = %d, cur rf intf = %d", __func__,
- rfInterface, sCurrentRfInterface);
+ LOG(DEBUG) << StringPrintf("%s: new rf intf = %d, cur rf intf = %d", __func__,
+ rfInterface, sCurrentRfInterface);
return (0 == reSelect(rfInterface, true));
}
@@ -763,7 +745,7 @@ static bool switchRfInterface(tNFA_INTF_TYPE rfInterface) {
**
*******************************************************************************/
static jint nativeNfcTag_doReconnect(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
int retCode = NFCSTATUS_SUCCESS;
NfcTag& natTag = NfcTag::getInstance();
@@ -775,8 +757,7 @@ static jint nativeNfcTag_doReconnect(JNIEnv*, jobject) {
// special case for Kovio
if (sCurrentConnectedTargetProtocol == TARGET_TYPE_KOVIO_BARCODE) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: fake out reconnect for Kovio", __func__);
+ LOG(DEBUG) << StringPrintf("%s: fake out reconnect for Kovio", __func__);
goto TheEnd;
}
@@ -789,8 +770,7 @@ static jint nativeNfcTag_doReconnect(JNIEnv*, jobject) {
retCode = reSelect(NFA_INTERFACE_MIFARE, false);
TheEnd:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit 0x%X", __func__, retCode);
+ LOG(DEBUG) << StringPrintf("%s: exit 0x%X", __func__, retCode);
return retCode;
}
@@ -808,8 +788,7 @@ TheEnd:
*******************************************************************************/
static jint nativeNfcTag_doHandleReconnect(JNIEnv* e, jobject o,
jint targetHandle) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: targetHandle = %d", __func__, targetHandle);
+ LOG(DEBUG) << StringPrintf("%s: targetHandle = %d", __func__, targetHandle);
return nativeNfcTag_doConnect(e, o, targetHandle);
}
@@ -825,7 +804,7 @@ static jint nativeNfcTag_doHandleReconnect(JNIEnv* e, jobject o,
**
*******************************************************************************/
jboolean nativeNfcTag_doDisconnect(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
tNFA_STATUS nfaStat = NFA_STATUS_OK;
NfcTag::getInstance().resetAllTransceiveTimeouts();
@@ -841,7 +820,7 @@ jboolean nativeNfcTag_doDisconnect(JNIEnv*, jobject) {
nfaStat);
TheEnd:
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return (nfaStat == NFA_STATUS_OK) ? JNI_TRUE : JNI_FALSE;
}
@@ -860,8 +839,7 @@ TheEnd:
void nativeNfcTag_doTransceiveStatus(tNFA_STATUS status, uint8_t* buf,
uint32_t bufLen) {
SyncEventGuard g(sTransceiveEvent);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: data len=%d", __func__, bufLen);
+ LOG(DEBUG) << StringPrintf("%s: data len=%d", __func__, bufLen);
if (!sWaitingForTransceive) {
LOG(ERROR) << StringPrintf("%s: drop data", __func__);
@@ -876,8 +854,8 @@ void nativeNfcTag_doTransceiveStatus(tNFA_STATUS status, uint8_t* buf,
void nativeNfcTag_notifyRfTimeout() {
SyncEventGuard g(sTransceiveEvent);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: waiting for transceive: %d", __func__, sWaitingForTransceive);
+ LOG(DEBUG) << StringPrintf("%s: waiting for transceive: %d", __func__,
+ sWaitingForTransceive);
if (!sWaitingForTransceive) return;
sTransceiveRfTimeout = true;
@@ -903,8 +881,8 @@ static jbyteArray nativeNfcTag_doTransceive(JNIEnv* e, jobject o,
jintArray statusTargetLost) {
int timeout =
NfcTag::getInstance().getTransceiveTimeout(sCurrentConnectedTargetType);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: enter; raw=%u; timeout = %d", __func__, raw, timeout);
+ LOG(DEBUG) << StringPrintf("%s: enter; raw=%u; timeout = %d", __func__, raw,
+ timeout);
bool waitOk = false;
bool isNack = false;
@@ -918,8 +896,7 @@ static jbyteArray nativeNfcTag_doTransceive(JNIEnv* e, jobject o,
*targetLost = 1; // causes NFC service to throw TagLostException
e->ReleaseIntArrayElements(statusTargetLost, targetLost, 0);
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: tag not active", __func__);
+ LOG(DEBUG) << StringPrintf("%s: tag not active", __func__);
return NULL;
}
@@ -970,8 +947,8 @@ static jbyteArray nativeNfcTag_doTransceive(JNIEnv* e, jobject o,
break;
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: response %zu bytes", __func__, sRxDataBuffer.size());
+ LOG(DEBUG) << StringPrintf("%s: response %zu bytes", __func__,
+ sRxDataBuffer.size());
if ((natTag.getProtocol() == NFA_PROTOCOL_T2T) &&
natTag.isT2tNackResponse(sRxDataBuffer.data(), sRxDataBuffer.size())) {
@@ -983,11 +960,9 @@ static jbyteArray nativeNfcTag_doTransceive(JNIEnv* e, jobject o,
// Some Mifare Ultralight C tags enter the HALT state after it
// responds with a NACK. Need to perform a "reconnect" operation
// to wake it.
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: try reconnect", __func__);
+ LOG(DEBUG) << StringPrintf("%s: try reconnect", __func__);
nativeNfcTag_doReconnect(NULL, NULL);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: reconnect finish", __func__);
+ LOG(DEBUG) << StringPrintf("%s: reconnect finish", __func__);
} else if (sCurrentConnectedTargetProtocol == NFC_PROTOCOL_MIFARE) {
uint32_t transDataLen = static_cast<uint32_t>(sRxDataBuffer.size());
uint8_t* transData = (uint8_t*)sRxDataBuffer.data();
@@ -1027,7 +1002,7 @@ static jbyteArray nativeNfcTag_doTransceive(JNIEnv* e, jobject o,
sWaitingForTransceive = false;
if (targetLost) e->ReleaseIntArrayElements(statusTargetLost, targetLost, 0);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return result.release();
}
@@ -1046,9 +1021,8 @@ static jbyteArray nativeNfcTag_doTransceive(JNIEnv* e, jobject o,
*******************************************************************************/
static jint nativeNfcTag_doGetNdefType(JNIEnv*, jobject, jint libnfcType,
jint javaType) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter; libnfc type=%d; java type=%d", __func__,
- libnfcType, javaType);
+ LOG(DEBUG) << StringPrintf("%s: enter; libnfc type=%d; java type=%d",
+ __func__, libnfcType, javaType);
jint ndefType = NDEF_UNKNOWN_TYPE;
// For NFA, libnfcType is mapped to the protocol value received
@@ -1067,8 +1041,7 @@ static jint nativeNfcTag_doGetNdefType(JNIEnv*, jobject, jint libnfcType,
/* NFA_PROTOCOL_T5T, NFA_PROTOCOL_INVALID and others */
ndefType = NDEF_UNKNOWN_TYPE;
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit; ndef type=%d", __func__, ndefType);
+ LOG(DEBUG) << StringPrintf("%s: exit; ndef type=%d", __func__, ndefType);
return ndefType;
}
@@ -1104,20 +1077,15 @@ void nativeNfcTag_doCheckNdefResult(tNFA_STATUS status, uint32_t maxSize,
}
if (flags & RW_NDEF_FL_READ_ONLY)
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: flag read-only", __func__);
+ LOG(DEBUG) << StringPrintf("%s: flag read-only", __func__);
if (flags & RW_NDEF_FL_FORMATED)
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: flag formatted for ndef", __func__);
+ LOG(DEBUG) << StringPrintf("%s: flag formatted for ndef", __func__);
if (flags & RW_NDEF_FL_SUPPORTED)
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: flag ndef supported", __func__);
+ LOG(DEBUG) << StringPrintf("%s: flag ndef supported", __func__);
if (flags & RW_NDEF_FL_UNKNOWN)
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: flag all unknown", __func__);
+ LOG(DEBUG) << StringPrintf("%s: flag all unknown", __func__);
if (flags & RW_NDEF_FL_FORMATABLE)
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: flag formattable", __func__);
+ LOG(DEBUG) << StringPrintf("%s: flag formattable", __func__);
sCheckNdefWaitingForComplete = JNI_FALSE;
sCheckNdefStatus = status;
@@ -1166,12 +1134,11 @@ static jint nativeNfcTag_doCheckNdef(JNIEnv* e, jobject o, jintArray ndefInfo) {
tNFA_STATUS status = NFA_STATUS_FAILED;
jint* ndef = NULL;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
// special case for Kovio
if (sCurrentConnectedTargetProtocol == TARGET_TYPE_KOVIO_BARCODE) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Kovio tag, no NDEF", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Kovio tag, no NDEF", __func__);
ndef = e->GetIntArrayElements(ndefInfo, 0);
ndef[0] = 0;
ndef[1] = NDEF_MODE_READ_ONLY;
@@ -1194,8 +1161,7 @@ static jint nativeNfcTag_doCheckNdef(JNIEnv* e, jobject o, jintArray ndefInfo) {
goto TheEnd;
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: try NFA_RwDetectNDef", __func__);
+ LOG(DEBUG) << StringPrintf("%s: try NFA_RwDetectNDef", __func__);
sCheckNdefWaitingForComplete = JNI_TRUE;
status = NFA_RwDetectNDef();
@@ -1241,8 +1207,8 @@ static jint nativeNfcTag_doCheckNdef(JNIEnv* e, jobject o, jintArray ndefInfo) {
e->ReleaseIntArrayElements(ndefInfo, ndef, 0);
status = NFA_STATUS_FAILED;
} else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: unknown status 0x%X", __func__, sCheckNdefStatus);
+ LOG(DEBUG) << StringPrintf("%s: unknown status 0x%X", __func__,
+ sCheckNdefStatus);
status = sCheckNdefStatus;
}
@@ -1259,8 +1225,7 @@ TheEnd:
errno);
}
sCheckNdefWaitingForComplete = JNI_FALSE;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit; status=0x%X", __func__, status);
+ LOG(DEBUG) << StringPrintf("%s: exit; status=0x%X", __func__, status);
return status;
}
@@ -1310,7 +1275,7 @@ void nativeNfcTag_doPresenceCheckResult(tNFA_STATUS status) {
**
*******************************************************************************/
static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
tNFA_STATUS status = NFA_STATUS_OK;
bool isPresent = false;
@@ -1318,8 +1283,8 @@ static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
// but was ignored so that normal tag opertions could complete. Now we
// want to process as if the deactivate just happened.
if (sCurrentConnectedTargetProtocol == TARGET_TYPE_KOVIO_BARCODE) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Kovio, force deactivate handling", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Kovio, force deactivate handling",
+ __func__);
tNFA_DEACTIVATED deactivated = {NFA_DEACTIVATE_TYPE_IDLE};
{
SyncEventGuard g(gDeactivatedEvent);
@@ -1337,13 +1302,12 @@ static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
}
if (nfcManager_isNfcActive() == false) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFC is no longer active.", __func__);
+ LOG(DEBUG) << StringPrintf("%s: NFC is no longer active.", __func__);
return JNI_FALSE;
}
if (!sRfInterfaceMutex.tryLock()) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: tag is being reSelected assume it is present", __func__);
return JNI_TRUE;
}
@@ -1351,8 +1315,7 @@ static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
sRfInterfaceMutex.unlock();
if (NfcTag::getInstance().isActivated() == false) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: tag already deactivated", __func__);
+ LOG(DEBUG) << StringPrintf("%s: tag already deactivated", __func__);
return JNI_FALSE;
}
{
@@ -1373,8 +1336,8 @@ static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
if (status == NFA_STATUS_OK) {
isPresent = sPresenceCheckEvent.wait(2000);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s(%d): isPresent = %d", __FUNCTION__, __LINE__, isPresent);
+ LOG(DEBUG) << StringPrintf("%s(%d): isPresent = %d", __FUNCTION__,
+ __LINE__, isPresent);
if (!sIsTagPresent &&
(((sCurrentConnectedTargetProtocol == NFC_PROTOCOL_ISO_DEP) &&
@@ -1390,7 +1353,7 @@ static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
NfcConfig::getUnsigned(NAME_PRESENCE_CHECK_RETRY_COUNT,
DEFAULT_PRESENCE_CHECK_RETRY_COUNT);
while (sPresCheckErrCnt <= retryCount) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s(%d): pres check failed, try again (attempt #%d/%d)",
__FUNCTION__, __LINE__, sPresCheckErrCnt, retryCount);
@@ -1398,8 +1361,8 @@ static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
if (status == NFA_STATUS_OK) {
isPresent = sPresenceCheckEvent.wait(2000);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s(%d): isPresent = %d", __FUNCTION__, __LINE__, isPresent);
+ LOG(DEBUG) << StringPrintf("%s(%d): isPresent = %d", __FUNCTION__,
+ __LINE__, isPresent);
if (!isPresent) {
break;
@@ -1414,7 +1377,7 @@ static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
}
if (isPresent && (sIsoDepPresCheckCnt == 1) && !sIsTagPresent) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s(%d): Try alternate method in case tag does not support RNAK",
__FUNCTION__, __LINE__);
@@ -1424,8 +1387,8 @@ static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
if (status == NFA_STATUS_OK) {
isPresent = sPresenceCheckEvent.wait(2000);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s(%d): isPresent = %d", __FUNCTION__, __LINE__, isPresent);
+ LOG(DEBUG) << StringPrintf("%s(%d): isPresent = %d", __FUNCTION__,
+ __LINE__, isPresent);
}
}
@@ -1434,8 +1397,7 @@ static jboolean nativeNfcTag_doPresenceCheck(JNIEnv*, jobject) {
}
if (!isPresent) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: tag absent", __func__);
+ LOG(DEBUG) << StringPrintf("%s: tag absent", __func__);
nativeNfcTag_resetPresenceCheck();
}
@@ -1508,8 +1470,7 @@ static jboolean nativeNfcTag_doIsNdefFormatable(JNIEnv* e, jobject o,
}
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: is formattable=%u", __func__, isFormattable);
+ LOG(DEBUG) << StringPrintf("%s: is formattable=%u", __func__, isFormattable);
return isFormattable;
}
@@ -1530,7 +1491,7 @@ static jboolean nativeNfcTag_doIsIsoDepNdefFormatable(JNIEnv* e, jobject o,
jbyteArray pollBytes,
jbyteArray actBytes) {
uint8_t uidFake[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
jbyteArray uidArray = e->NewByteArray(8);
e->SetByteArrayRegion(uidArray, 0, 8, (jbyte*)uidFake);
return nativeNfcTag_doIsNdefFormatable(e, o, 0, uidArray, pollBytes,
@@ -1550,13 +1511,13 @@ static jboolean nativeNfcTag_doIsIsoDepNdefFormatable(JNIEnv* e, jobject o,
**
*******************************************************************************/
static jboolean nativeNfcTag_doNdefFormat(JNIEnv* e, jobject o, jbyteArray) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
tNFA_STATUS status = NFA_STATUS_OK;
// Do not try to format if tag is already deactivated.
if (NfcTag::getInstance().isActivated() == false) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: tag already deactivated(no need to format)", __func__);
+ LOG(DEBUG) << StringPrintf("%s: tag already deactivated(no need to format)",
+ __func__);
return JNI_FALSE;
}
@@ -1568,8 +1529,7 @@ static jboolean nativeNfcTag_doNdefFormat(JNIEnv* e, jobject o, jbyteArray) {
sFormatOk = false;
status = NFA_RwFormatTag();
if (status == NFA_STATUS_OK) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: wait for completion", __func__);
+ LOG(DEBUG) << StringPrintf("%s: wait for completion", __func__);
sem_wait(&sFormatSem);
status = sFormatOk ? NFA_STATUS_OK : NFA_STATUS_FAILED;
} else
@@ -1579,10 +1539,9 @@ static jboolean nativeNfcTag_doNdefFormat(JNIEnv* e, jobject o, jbyteArray) {
if (sCurrentConnectedTargetProtocol == NFA_PROTOCOL_ISO_DEP) {
int retCode = NFCSTATUS_SUCCESS;
retCode = nativeNfcTag_doReconnect(e, o);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s Status = 0x%X", __func__, retCode);
+ LOG(DEBUG) << StringPrintf("%s Status = 0x%X", __func__, retCode);
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return (status == NFA_STATUS_OK) ? JNI_TRUE : JNI_FALSE;
}
@@ -1622,7 +1581,7 @@ static jboolean nativeNfcTag_doMakeReadonly(JNIEnv* e, jobject o, jbyteArray) {
jboolean result = JNI_FALSE;
tNFA_STATUS status;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
/* Create the make_readonly semaphore */
if (sem_init(&sMakeReadonlySem, 0, 0) == -1) {
@@ -1685,7 +1644,7 @@ TheEnd:
// register a callback to receive NDEF message from the tag
// from the NFA_NDEF_DATA_EVT;
void nativeNfcTag_registerNdefTypeHandler() {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
sNdefTypeHandlerHandle = NFA_HANDLE_INVALID;
NFA_RegisterNDefTypeHandler(TRUE, NFA_TNF_DEFAULT, (uint8_t*)"", 0,
ndefHandlerCallback);
@@ -1701,7 +1660,7 @@ void nativeNfcTag_registerNdefTypeHandler() {
**
*******************************************************************************/
void nativeNfcTag_deregisterNdefTypeHandler() {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
NFA_DeregisterNDefTypeHandler(sNdefTypeHandlerHandle);
sNdefTypeHandlerHandle = NFA_HANDLE_INVALID;
}
@@ -1716,11 +1675,9 @@ void nativeNfcTag_deregisterNdefTypeHandler() {
**
*******************************************************************************/
void nativeNfcTag_acquireRfInterfaceMutexLock() {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: try to acquire lock", __func__);
+ LOG(DEBUG) << StringPrintf("%s: try to acquire lock", __func__);
sRfInterfaceMutex.lock();
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: sRfInterfaceMutex lock", __func__);
+ LOG(DEBUG) << StringPrintf("%s: sRfInterfaceMutex lock", __func__);
}
/*******************************************************************************
@@ -1734,8 +1691,7 @@ void nativeNfcTag_acquireRfInterfaceMutexLock() {
*******************************************************************************/
void nativeNfcTag_releaseRfInterfaceMutexLock() {
sRfInterfaceMutex.unlock();
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: sRfInterfaceMutex unlock", __func__);
+ LOG(DEBUG) << StringPrintf("%s: sRfInterfaceMutex unlock", __func__);
}
/*****************************************************************************
@@ -1771,7 +1727,7 @@ static JNINativeMethod gMethods[] = {
**
*******************************************************************************/
int register_com_android_nfc_NativeNfcTag(JNIEnv* e) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
return jniRegisterNativeMethods(e, gNativeNfcTagClassName, gMethods,
NELEM(gMethods));
}
diff --git a/nci/jni/NativeP2pDevice.cpp b/nci/jni/NativeP2pDevice.cpp
index 23f5db41..efb82526 100644
--- a/nci/jni/NativeP2pDevice.cpp
+++ b/nci/jni/NativeP2pDevice.cpp
@@ -14,8 +14,8 @@
* limitations under the License.
*/
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <log/log.h>
#include <nativehelper/JNIHelp.h>
@@ -24,32 +24,30 @@
using android::base::StringPrintf;
-extern bool nfc_debug_enabled;
-
namespace android {
static jboolean nativeP2pDeviceDoConnect(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
return JNI_TRUE;
}
static jboolean nativeP2pDeviceDoDisconnect(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
return JNI_TRUE;
}
static jbyteArray nativeP2pDeviceDoTransceive(JNIEnv*, jobject, jbyteArray) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
return NULL;
}
static jbyteArray nativeP2pDeviceDoReceive(JNIEnv*, jobject) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
return NULL;
}
static jboolean nativeP2pDeviceDoSend(JNIEnv*, jobject, jbyteArray) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
+ LOG(DEBUG) << StringPrintf("%s", __func__);
return JNI_TRUE;
}
diff --git a/nci/jni/NfcDta.cpp b/nci/jni/NfcDta.cpp
index 49b5d0d5..4c52c991 100644
--- a/nci/jni/NfcDta.cpp
+++ b/nci/jni/NfcDta.cpp
@@ -16,16 +16,14 @@
#include "NfcDta.h"
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <cutils/properties.h>
#include "SyncEvent.h"
using android::base::StringPrintf;
-extern bool nfc_debug_enabled;
-
namespace android {
extern SyncEvent gNfaSetConfigEvent;
extern SyncEvent gNfaGetConfigEvent;
@@ -152,19 +150,17 @@ tNFA_STATUS NfcDta::getConfigParamValues(std::vector<uint8_t> paramIds) {
uint16_t len = gCurrentConfigLen - 2;
// First Config TLV starts from index 1 of gConfig
uint16_t index = 1;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: default_config len: %d", __func__, len);
+ LOG(DEBUG) << StringPrintf("%s: default_config len: %d", __func__, len);
while (index <= len) {
mDefaultTlv.push_back(gConfig[index++]);
}
} else {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: getConfig failed len: %d", __func__, gCurrentConfigLen);
+ LOG(DEBUG) << StringPrintf("%s: getConfig failed len: %d", __func__,
+ gCurrentConfigLen);
status = NFA_STATUS_FAILED;
}
} else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: getConfig failed", __func__);
+ LOG(DEBUG) << StringPrintf("%s: getConfig failed", __func__);
}
}
return status;
@@ -187,15 +183,14 @@ tNFA_STATUS NfcDta::setConfigParams(std::vector<uint8_t> configTlv) {
while (index < configTlv.size()) {
paramId = configTlv[index++];
len = configTlv[index++];
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: Param Id: %02X, Length: %02X", __func__, paramId, len);
+ LOG(DEBUG) << StringPrintf("%s: Param Id: %02X, Length: %02X", __func__,
+ paramId, len);
SyncEventGuard guard(gNfaSetConfigEvent);
status = NFA_SetConfig(paramId, len, &configTlv[index]);
if (status == NFA_STATUS_OK) {
gNfaSetConfigEvent.wait();
} else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: setConfig failed", __func__);
+ LOG(DEBUG) << StringPrintf("%s: setConfig failed", __func__);
break;
}
index += len;
@@ -217,11 +212,10 @@ void NfcDta::setNfccConfigParams() {
int len = 0;
len = property_get("nfc.dta.configTLV", sysPropTlvs, "");
std::string configTlvs(sysPropTlvs);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: SysProperty nfc.configTLV: %s", __func__, configTlvs.c_str());
+ LOG(DEBUG) << StringPrintf("%s: SysProperty nfc.configTLV: %s", __func__,
+ configTlvs.c_str());
if (len <= 0 || (configTlvs.empty() && mDefaultTlv.empty())) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Config TLVs not available", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Config TLVs not available", __func__);
return;
}
tNFA_STATUS status = NFA_STATUS_FAILED;
@@ -230,8 +224,8 @@ void NfcDta::setNfccConfigParams() {
if (status == NFA_STATUS_OK) {
mDefaultTlv.clear();
mUpdatedParamIds.clear();
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Restored default config params", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Restored default config params",
+ __func__);
}
return;
}
@@ -242,5 +236,5 @@ void NfcDta::setNfccConfigParams() {
if (status == NFA_STATUS_OK) {
setConfigParams(tlv);
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: Exit", __func__);
+ LOG(DEBUG) << StringPrintf("%s: Exit", __func__);
}
diff --git a/nci/jni/NfcJniUtil.cpp b/nci/jni/NfcJniUtil.cpp
index 90000f7c..10e1b5e6 100644
--- a/nci/jni/NfcJniUtil.cpp
+++ b/nci/jni/NfcJniUtil.cpp
@@ -16,8 +16,8 @@
#include "NfcJniUtil.h"
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <errno.h>
#include <log/log.h>
#include <nativehelper/JNIHelp.h>
@@ -27,8 +27,6 @@
using android::base::StringPrintf;
-extern bool nfc_debug_enabled;
-
/*******************************************************************************
**
** Function: JNI_OnLoad
@@ -41,7 +39,7 @@ extern bool nfc_debug_enabled;
**
*******************************************************************************/
jint JNI_OnLoad(JavaVM* jvm, void*) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
+ LOG(DEBUG) << StringPrintf("%s: enter", __func__);
JNIEnv* e = NULL;
LOG(INFO) << StringPrintf("NFC Service: loading nci JNI");
@@ -54,7 +52,8 @@ jint JNI_OnLoad(JavaVM* jvm, void*) {
if (android::register_com_android_nfc_NativeNfcTag(e) == -1) return JNI_ERR;
if (RoutingManager::getInstance().registerJniFunctions(e) == -1)
return JNI_ERR;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", __func__);
+
+ LOG(DEBUG) << StringPrintf("%s: exit", __func__);
return JNI_VERSION_1_6;
}
diff --git a/nci/jni/NfcStatsUtil.cpp b/nci/jni/NfcStatsUtil.cpp
index 1bbbfdaa..be2b82ad 100644
--- a/nci/jni/NfcStatsUtil.cpp
+++ b/nci/jni/NfcStatsUtil.cpp
@@ -16,8 +16,8 @@
#include "NfcStatsUtil.h"
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <log/log.h>
#include <statslog_nfc.h>
@@ -25,8 +25,6 @@
using android::base::StringPrintf;
-extern bool nfc_debug_enabled;
-
/*******************************************************************************
**
** Function: logNfcTagType
@@ -41,8 +39,8 @@ extern bool nfc_debug_enabled;
*******************************************************************************/
void NfcStatsUtil::logNfcTagType(int protocol, int discoveryMode) {
static const char fn[] = "NfcStatsUtil::logNfcTagType";
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: protocol %d, mode %d", fn, protocol, discoveryMode);
+ LOG(DEBUG) << StringPrintf("%s: protocol %d, mode %d", fn, protocol,
+ discoveryMode);
int tagType = nfc::stats::NFC_TAG_TYPE_OCCURRED__TYPE__TAG_UNKNOWN;
if (protocol == NFC_PROTOCOL_T1T) {
tagType = nfc::stats::NFC_TAG_TYPE_OCCURRED__TYPE__TAG_TYPE_1;
@@ -85,7 +83,7 @@ void NfcStatsUtil::logNfcTagType(int protocol, int discoveryMode) {
*******************************************************************************/
void NfcStatsUtil::writeNfcStatsTagTypeOccurred(int tagType) {
static const char fn[] = "NfcStatsUtil::writeNfcStatsTagTypeOccurred";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: %d", fn, tagType);
+ LOG(DEBUG) << StringPrintf("%s: %d", fn, tagType);
nfc::stats::stats_write(nfc::stats::NFC_TAG_TYPE_OCCURRED, tagType);
}
diff --git a/nci/jni/NfcTag.cpp b/nci/jni/NfcTag.cpp
index 3451be42..821d5f64 100755
--- a/nci/jni/NfcTag.cpp
+++ b/nci/jni/NfcTag.cpp
@@ -19,8 +19,8 @@
*/
#include "NfcTag.h"
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <log/log.h>
#include <nativehelper/ScopedLocalRef.h>
#include <nativehelper/ScopedPrimitiveArray.h>
@@ -33,7 +33,6 @@
using android::base::StringPrintf;
-extern bool nfc_debug_enabled;
static void deleteglobaldata(JNIEnv* e);
static jobjectArray sTechPollBytes;
static jobjectArray gtechActBytes;
@@ -154,8 +153,7 @@ void NfcTag::setDeactivationState(tNFA_DEACTIVATED& deactivated) {
mActivationState = Idle;
mNdefDetectionTimedOut = false;
if (deactivated.type == NFA_DEACTIVATE_TYPE_SLEEP) mActivationState = Sleep;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: state=%u", fn, mActivationState);
+ LOG(DEBUG) << StringPrintf("%s: state=%u", fn, mActivationState);
}
/*******************************************************************************
@@ -171,8 +169,7 @@ void NfcTag::setActivationState() {
static const char fn[] = "NfcTag::setActivationState";
mNdefDetectionTimedOut = false;
mActivationState = Active;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: state=%u", fn, mActivationState);
+ LOG(DEBUG) << StringPrintf("%s: state=%u", fn, mActivationState);
}
/*******************************************************************************
@@ -235,7 +232,7 @@ uint32_t TimeDiff(timespec start, timespec end) {
*******************************************************************************/
bool NfcTag::IsSameKovio(tNFA_ACTIVATED& activationData) {
static const char fn[] = "NfcTag::IsSameKovio";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", fn);
+ LOG(DEBUG) << StringPrintf("%s: enter", fn);
tNFC_ACTIVATE_DEVT& rfDetail = activationData.activate_ntf;
if (rfDetail.protocol != NFC_PROTOCOL_KOVIO) return false;
@@ -267,8 +264,7 @@ bool NfcTag::IsSameKovio(tNFA_ACTIVATED& activationData) {
memcpy(mLastKovioUid, mTechParams[0].param.pk.uid, mLastKovioUidLen);
}
mLastKovioTime = now;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit, is same Kovio=%d", fn, rVal);
+ LOG(DEBUG) << StringPrintf("%s: exit, is same Kovio=%d", fn, rVal);
return rVal;
}
@@ -286,7 +282,7 @@ bool NfcTag::IsSameKovio(tNFA_ACTIVATED& activationData) {
*******************************************************************************/
void NfcTag::discoverTechnologies(tNFA_ACTIVATED& activationData) {
static const char fn[] = "NfcTag::discoverTechnologies (activation)";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", fn);
+ LOG(DEBUG) << StringPrintf("%s: enter", fn);
tNFC_ACTIVATE_DEVT& rfDetail = activationData.activate_ntf;
if (mTechListTail < (MAX_NUM_TECHNOLOGY - 1)) {
@@ -356,7 +352,7 @@ void NfcTag::discoverTechnologies(tNFA_ACTIVATED& activationData) {
if (fwi >= MIN_FWI && fwi <= MAX_FWI) {
//2^MIN_FWI * 256 * 16 * 1000 / 13560000 is approximately 618
int fwt = (1 << (fwi - MIN_FWI)) * 618;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"Setting the transceive timeout = %d, fwi = %0#x", fwt, fwi);
setTransceiveTimeout(mTechList[mNumTechList], fwt);
}
@@ -392,10 +388,10 @@ void NfcTag::discoverTechnologies(tNFA_ACTIVATED& activationData) {
// is TagTechnology.NFC_V by Java API
mTechList[mNumTechList] = TARGET_TYPE_V;
} else if (NFC_PROTOCOL_KOVIO == rfDetail.protocol) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: Kovio", fn);
+ LOG(DEBUG) << StringPrintf("%s: Kovio", fn);
mTechList[mNumTechList] = TARGET_TYPE_KOVIO_BARCODE;
} else if (NFC_PROTOCOL_MIFARE == rfDetail.protocol) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: Mifare Classic", fn);
+ LOG(DEBUG) << StringPrintf("%s: Mifare Classic", fn);
mTechList[mNumTechList] =
TARGET_TYPE_ISO14443_3A; // is TagTechnology.NFC_A by Java API
mNumTechList++;
@@ -414,14 +410,14 @@ void NfcTag::discoverTechnologies(tNFA_ACTIVATED& activationData) {
mNumTechList++;
for (int i = 0; i < mNumTechList; i++) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: index=%d; tech=%d; handle=%d; nfc type=%d", fn, i,
- mTechList[i], mTechHandles[i], mTechLibNfcTypes[i]);
+ LOG(DEBUG) << StringPrintf("%s: index=%d; tech=%d; handle=%d; nfc type=%d",
+ fn, i, mTechList[i], mTechHandles[i],
+ mTechLibNfcTypes[i]);
}
mNfcStatsUtil->logNfcTagType(mTechLibNfcTypes[mTechListTail],
mTechParams[mTechListTail].mode);
TheEnd:
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", fn);
+ LOG(DEBUG) << StringPrintf("%s: exit", fn);
}
/*******************************************************************************
@@ -441,7 +437,7 @@ void NfcTag::discoverTechnologies(tNFA_DISC_RESULT& discoveryData) {
tNFC_RESULT_DEVT& discovery_ntf = discoveryData.discovery_ntf;
uint8_t index = mNumDiscNtf;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: enter: rf disc. id=%u; protocol=%u, mNumTechList=%u", fn,
discovery_ntf.rf_disc_id, discovery_ntf.protocol, mNumTechList);
if (index >= MAX_NUM_TECHNOLOGY) {
@@ -455,16 +451,15 @@ void NfcTag::discoverTechnologies(tNFA_DISC_RESULT& discoveryData) {
}
if (discovery_ntf.more != NCI_DISCOVER_NTF_MORE) {
for (int i = 0; i < mNumDiscTechList; i++) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: index=%d; handle=%d; nfc type=%d", fn, i,
- mTechHandlesDiscData[i], mTechLibNfcTypesDiscData[i]);
+ LOG(DEBUG) << StringPrintf("%s: index=%d; handle=%d; nfc type=%d", fn, i,
+ mTechHandlesDiscData[i],
+ mTechLibNfcTypesDiscData[i]);
}
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s; mNumDiscTechList=%x", fn, mNumDiscTechList);
+ LOG(DEBUG) << StringPrintf("%s; mNumDiscTechList=%x", fn, mNumDiscTechList);
TheEnd:
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", fn);
+ LOG(DEBUG) << StringPrintf("%s: exit", fn);
}
/*******************************************************************************
@@ -481,7 +476,7 @@ TheEnd:
*******************************************************************************/
void NfcTag::createNativeNfcTag(tNFA_ACTIVATED& activationData) {
static const char fn[] = "NfcTag::createNativeNfcTag";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", fn);
+ LOG(DEBUG) << StringPrintf("%s: enter", fn);
if (mNativeData == NULL) {
LOG(ERROR) << StringPrintf("%s: mNativeData is null", fn);
@@ -527,13 +522,11 @@ void NfcTag::createNativeNfcTag(tNFA_ACTIVATED& activationData) {
}
mNativeData->tag = e->NewGlobalRef(tag.get());
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s; mNumDiscNtf=%x", fn, mNumDiscNtf);
+ LOG(DEBUG) << StringPrintf("%s; mNumDiscNtf=%x", fn, mNumDiscNtf);
if (!mNumDiscNtf) {
// notify NFC service about this new tag
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: try notify nfc service", fn);
+ LOG(DEBUG) << StringPrintf("%s: try notify nfc service", fn);
e->CallVoidMethod(mNativeData->manager,
android::gCachedNfcManagerNotifyNdefMessageListeners,
tag.get());
@@ -543,11 +536,10 @@ void NfcTag::createNativeNfcTag(tNFA_ACTIVATED& activationData) {
}
deleteglobaldata(e);
} else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Selecting next tag", fn);
+ LOG(DEBUG) << StringPrintf("%s: Selecting next tag", fn);
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", fn);
+ LOG(DEBUG) << StringPrintf("%s: exit", fn);
}
/*******************************************************************************
@@ -562,14 +554,14 @@ void NfcTag::createNativeNfcTag(tNFA_ACTIVATED& activationData) {
*******************************************************************************/
static void deleteglobaldata(JNIEnv* e) {
static const char fn[] = "deleteglobaldata";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", fn);
+ LOG(DEBUG) << StringPrintf("%s: enter", fn);
if (sTechPollBytes != NULL) {
e->DeleteGlobalRef(sTechPollBytes);
}
if (gtechActBytes != NULL) {
e->DeleteGlobalRef(gtechActBytes);
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", fn);
+ LOG(DEBUG) << StringPrintf("%s: exit", fn);
}
/*******************************************************************************
@@ -587,7 +579,7 @@ static void deleteglobaldata(JNIEnv* e) {
*******************************************************************************/
void NfcTag::fillNativeNfcTagMembers1(JNIEnv* e, jclass tag_cls, jobject tag) {
static const char fn[] = "NfcTag::fillNativeNfcTagMembers1";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", fn);
+ LOG(DEBUG) << StringPrintf("%s", fn);
// create objects that represent NativeNfcTag's member variables
ScopedLocalRef<jintArray> techList(e, e->NewIntArray(mNumTechList));
@@ -639,7 +631,7 @@ void NfcTag::fillNativeNfcTagMembers1(JNIEnv* e, jclass tag_cls, jobject tag) {
void NfcTag::fillNativeNfcTagMembers2(JNIEnv* e, jclass tag_cls, jobject tag,
tNFA_ACTIVATED& /*activationData*/) {
static const char fn[] = "NfcTag::fillNativeNfcTagMembers2";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", fn);
+ LOG(DEBUG) << StringPrintf("%s", fn);
jfieldID f = e->GetFieldID(tag_cls, "mConnectedTechIndex", "I");
e->SetIntField(tag, f, (jint)0);
}
@@ -682,13 +674,13 @@ void NfcTag::fillNativeNfcTagMembers3(JNIEnv* e, jclass tag_cls, jobject tag,
}
for (int i = mTechListTail; i < mNumTechList; i++) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: index=%d; rf tech params mode=%u", fn, i, mTechParams[i].mode);
+ LOG(DEBUG) << StringPrintf("%s: index=%d; rf tech params mode=%u", fn, i,
+ mTechParams[i].mode);
if (NFC_DISCOVERY_TYPE_POLL_A == mTechParams[i].mode ||
NFC_DISCOVERY_TYPE_POLL_A_ACTIVE == mTechParams[i].mode ||
NFC_DISCOVERY_TYPE_LISTEN_A == mTechParams[i].mode ||
NFC_DISCOVERY_TYPE_LISTEN_A_ACTIVE == mTechParams[i].mode) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: tech A", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech A", fn);
pollBytes.reset(e->NewByteArray(2));
e->SetByteArrayRegion(pollBytes.get(), 0, 2,
(jbyte*)mTechParams[i].param.pa.sens_res);
@@ -705,8 +697,7 @@ void NfcTag::fillNativeNfcTagMembers3(JNIEnv* e, jclass tag_cls, jobject tag,
or 13 is Protocol Info; used by public API: NfcB.getApplicationData(),
NfcB.getProtocolInfo();
*****************/
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: tech B; TARGET_TYPE_ISO14443_3B", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech B; TARGET_TYPE_ISO14443_3B", fn);
len = mTechParams[i].param.pb.sensb_res_len;
if (len >= NFC_NFCID0_MAX_LEN) {
// subtract 4 bytes for NFCID0 at byte 2 through 5
@@ -732,7 +723,7 @@ void NfcTag::fillNativeNfcTagMembers3(JNIEnv* e, jclass tag_cls, jobject tag,
PMm: manufacture parameter; 8 bytes;
System Code: 2 bytes;
****************/
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: tech F", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech F", fn);
uint8_t result[10]; // return result to NFC service
memset(result, 0, sizeof(result));
len = 10;
@@ -740,7 +731,7 @@ void NfcTag::fillNativeNfcTagMembers3(JNIEnv* e, jclass tag_cls, jobject tag,
/****
for (int ii = 0; ii < mTechParams [i].param.pf.sensf_res_len; ii++)
{
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: tech F,
+ LOG(DEBUG) << StringPrintf("%s: tech F,
sendf_res[%d]=%d (0x%x)", fn, ii, mTechParams
[i].param.pf.sensf_res[ii],mTechParams [i].param.pf.sensf_res[ii]);
}
@@ -752,15 +743,14 @@ void NfcTag::fillNativeNfcTagMembers3(JNIEnv* e, jclass tag_cls, jobject tag,
uint16_t systemCode = *(activationData.params.t3t.p_system_codes);
result[8] = (uint8_t)(systemCode >> 8);
result[9] = (uint8_t)systemCode;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: tech F; sys code=0x%X 0x%X", fn, result[8], result[9]);
+ LOG(DEBUG) << StringPrintf("%s: tech F; sys code=0x%X 0x%X", fn,
+ result[8], result[9]);
}
pollBytes.reset(e->NewByteArray(len));
e->SetByteArrayRegion(pollBytes.get(), 0, len, (jbyte*)result);
} else if (NFC_DISCOVERY_TYPE_POLL_V == mTechParams[i].mode ||
NFC_DISCOVERY_TYPE_LISTEN_ISO15693 == mTechParams[i].mode) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: tech iso 15693", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech iso 15693", fn);
// iso 15693 response flags: 1 octet
// iso 15693 Data Structure Format Identifier (DSF ID): 1 octet
// used by public API: NfcV.getDsfId(), NfcV.getResponseFlags();
@@ -841,25 +831,23 @@ void NfcTag::fillNativeNfcTagMembers4(JNIEnv* e, jclass tag_cls, jobject tag,
}
for (int i = mTechListTail; i < mNumTechList; i++) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: index=%d", fn, i);
+ LOG(DEBUG) << StringPrintf("%s: index=%d", fn, i);
if (NFC_PROTOCOL_T1T == mTechLibNfcTypes[i] ||
NFC_PROTOCOL_T2T == mTechLibNfcTypes[i]) {
if (mTechLibNfcTypes[i] == NFC_PROTOCOL_T1T)
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: T1T; tech A", fn);
+ LOG(DEBUG) << StringPrintf("%s: T1T; tech A", fn);
else if (mTechLibNfcTypes[i] == NFC_PROTOCOL_T2T)
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: T2T; tech A", fn);
+ LOG(DEBUG) << StringPrintf("%s: T2T; tech A", fn);
actBytes.reset(e->NewByteArray(1));
e->SetByteArrayRegion(actBytes.get(), 0, 1,
(jbyte*)&mTechParams[i].param.pa.sel_rsp);
} else if (NFC_PROTOCOL_T3T == mTechLibNfcTypes[i]) {
// felica
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: T3T; felica; tech F", fn);
+ LOG(DEBUG) << StringPrintf("%s: T3T; felica; tech F", fn);
// really, there is no data
actBytes.reset(e->NewByteArray(0));
} else if (NFC_PROTOCOL_MIFARE == mTechLibNfcTypes[i]) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Mifare Classic; tech A", fn);
+ LOG(DEBUG) << StringPrintf("%s: Mifare Classic; tech A", fn);
actBytes.reset(e->NewByteArray(1));
e->SetByteArrayRegion(actBytes.get(), 0, 1,
(jbyte*)&mTechParams[i].param.pa.sel_rsp);
@@ -880,7 +868,7 @@ void NfcTag::fillNativeNfcTagMembers4(JNIEnv* e, jclass tag_cls, jobject tag,
NFC_INTERFACE_ISO_DEP) {
tNFC_INTF_PA_ISO_DEP& pa_iso =
activationData.activate_ntf.intf_param.intf_param.pa_iso;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: T4T; ISO_DEP for tech A; copy historical bytes; len=%u",
fn, pa_iso.his_byte_len);
actBytes.reset(e->NewByteArray(pa_iso.his_byte_len));
@@ -905,7 +893,7 @@ void NfcTag::fillNativeNfcTagMembers4(JNIEnv* e, jclass tag_cls, jobject tag,
NFC_INTERFACE_ISO_DEP) {
tNFC_INTF_PB_ISO_DEP& pb_iso =
activationData.activate_ntf.intf_param.intf_param.pb_iso;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: T4T; ISO_DEP for tech B; copy response bytes; len=%u", fn,
pb_iso.hi_info_len);
actBytes.reset(e->NewByteArray(pb_iso.hi_info_len));
@@ -922,7 +910,7 @@ void NfcTag::fillNativeNfcTagMembers4(JNIEnv* e, jclass tag_cls, jobject tag,
} else if (mTechList[i] ==
TARGET_TYPE_ISO14443_3A) // is TagTechnology.NFC_A by Java API
{
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: T4T; tech A", fn);
+ LOG(DEBUG) << StringPrintf("%s: T4T; tech A", fn);
actBytes.reset(e->NewByteArray(1));
e->SetByteArrayRegion(actBytes.get(), 0, 1,
(jbyte*)&mTechParams[i].param.pa.sel_rsp);
@@ -931,8 +919,7 @@ void NfcTag::fillNativeNfcTagMembers4(JNIEnv* e, jclass tag_cls, jobject tag,
}
} // case NFC_PROTOCOL_ISO_DEP: //t4t
else if (NFC_PROTOCOL_T5T == mTechLibNfcTypes[i]) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: tech iso 15693", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech iso 15693", fn);
// iso 15693 response flags: 1 octet
// iso 15693 Data Structure Format Identifier (DSF ID): 1 octet
// used by public API: NfcV.getDsfId(), NfcV.getResponseFlags();
@@ -941,8 +928,7 @@ void NfcTag::fillNativeNfcTagMembers4(JNIEnv* e, jclass tag_cls, jobject tag,
actBytes.reset(e->NewByteArray(2));
e->SetByteArrayRegion(actBytes.get(), 0, 2, (jbyte*)data);
} else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: tech unknown ????", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech unknown ????", fn);
actBytes.reset(e->NewByteArray(0));
}
e->SetObjectArrayElement(techActBytes.get(), i, actBytes.get());
@@ -979,7 +965,7 @@ void NfcTag::fillNativeNfcTagMembers5(JNIEnv* e, jclass tag_cls, jobject tag,
ScopedLocalRef<jbyteArray> uid(e, NULL);
if (NFC_DISCOVERY_TYPE_POLL_KOVIO == mTechParams[0].mode) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: Kovio", fn);
+ LOG(DEBUG) << StringPrintf("%s: Kovio", fn);
len = mTechParams[0].param.pk.uid_len;
uid.reset(e->NewByteArray(len));
e->SetByteArrayRegion(uid.get(), 0, len,
@@ -988,7 +974,7 @@ void NfcTag::fillNativeNfcTagMembers5(JNIEnv* e, jclass tag_cls, jobject tag,
NFC_DISCOVERY_TYPE_POLL_A_ACTIVE == mTechParams[0].mode ||
NFC_DISCOVERY_TYPE_LISTEN_A == mTechParams[0].mode ||
NFC_DISCOVERY_TYPE_LISTEN_A_ACTIVE == mTechParams[0].mode) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: tech A", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech A", fn);
len = mTechParams[0].param.pa.nfcid1_len;
uid.reset(e->NewByteArray(len));
e->SetByteArrayRegion(uid.get(), 0, len,
@@ -1003,7 +989,7 @@ void NfcTag::fillNativeNfcTagMembers5(JNIEnv* e, jclass tag_cls, jobject tag,
NFC_DISCOVERY_TYPE_POLL_B_PRIME == mTechParams[0].mode ||
NFC_DISCOVERY_TYPE_LISTEN_B == mTechParams[0].mode ||
NFC_DISCOVERY_TYPE_LISTEN_B_PRIME == mTechParams[0].mode) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: tech B", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech B", fn);
uid.reset(e->NewByteArray(NFC_NFCID0_MAX_LEN));
e->SetByteArrayRegion(uid.get(), 0, NFC_NFCID0_MAX_LEN,
(jbyte*)&mTechParams[0].param.pb.nfcid0);
@@ -1014,10 +1000,10 @@ void NfcTag::fillNativeNfcTagMembers5(JNIEnv* e, jclass tag_cls, jobject tag,
uid.reset(e->NewByteArray(NFC_NFCID2_LEN));
e->SetByteArrayRegion(uid.get(), 0, NFC_NFCID2_LEN,
(jbyte*)&mTechParams[0].param.pf.nfcid2);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: tech F", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech F", fn);
} else if (NFC_DISCOVERY_TYPE_POLL_V == mTechParams[0].mode ||
NFC_DISCOVERY_TYPE_LISTEN_ISO15693 == mTechParams[0].mode) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: tech iso 15693", fn);
+ LOG(DEBUG) << StringPrintf("%s: tech iso 15693", fn);
jbyte data[I93_UID_BYTE_LEN]; // 8 bytes
for (int i = 0; i < I93_UID_BYTE_LEN; ++i) // reverse the ID
data[i] = activationData.params.i93.uid[I93_UID_BYTE_LEN - i - 1];
@@ -1031,8 +1017,7 @@ void NfcTag::fillNativeNfcTagMembers5(JNIEnv* e, jclass tag_cls, jobject tag,
e->SetObjectField(tag, f, uid.get());
mTechListTail = mNumTechList;
if (mNumDiscNtf == 0) mTechListTail = 0;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s;mTechListTail=%x", fn, mTechListTail);
+ LOG(DEBUG) << StringPrintf("%s;mTechListTail=%x", fn, mTechListTail);
}
/*******************************************************************************
@@ -1051,13 +1036,12 @@ bool NfcTag::isP2pDiscovered() {
for (int i = 0; i < mNumDiscTechList; i++) {
if (mTechLibNfcTypesDiscData[i] == NFA_PROTOCOL_NFC_DEP) {
// if remote device supports P2P
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: discovered P2P", fn);
+ LOG(DEBUG) << StringPrintf("%s: discovered P2P", fn);
retval = true;
break;
}
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: return=%u", fn, retval);
+ LOG(DEBUG) << StringPrintf("%s: return=%u", fn, retval);
return retval;
}
@@ -1092,8 +1076,8 @@ void NfcTag::selectP2p() {
}
if (rfDiscoveryId > 0) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: select P2P; target rf discov id=0x%X", fn, rfDiscoveryId);
+ LOG(DEBUG) << StringPrintf("%s: select P2P; target rf discov id=0x%X", fn,
+ rfDiscoveryId);
tNFA_STATUS stat =
NFA_Select(rfDiscoveryId, NFA_PROTOCOL_NFC_DEP, NFA_INTERFACE_NFC_DEP);
if (stat != NFA_STATUS_OK)
@@ -1115,7 +1099,7 @@ void NfcTag::selectP2p() {
*******************************************************************************/
void NfcTag::resetTechnologies() {
static const char fn[] = "NfcTag::resetTechnologies";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", fn);
+ LOG(DEBUG) << StringPrintf("%s", fn);
mNumTechList = 0;
mNumDiscNtf = 0;
mNumDiscTechList = 0;
@@ -1146,9 +1130,9 @@ void NfcTag::selectFirstTag() {
tNFA_INTF_TYPE rf_intf = NFA_INTERFACE_FRAME;
for (int i = 0; i < mNumDiscTechList; i++) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: nfa target idx=%d h=0x%X; protocol=0x%X", fn, i,
- mTechHandlesDiscData[i], mTechLibNfcTypesDiscData[i]);
+ LOG(DEBUG) << StringPrintf("%s: nfa target idx=%d h=0x%X; protocol=0x%X",
+ fn, i, mTechHandlesDiscData[i],
+ mTechLibNfcTypesDiscData[i]);
if (mTechLibNfcTypesDiscData[i] != NFA_PROTOCOL_NFC_DEP) {
sLastSelectedTagId = i;
foundIdx = i;
@@ -1192,12 +1176,12 @@ void NfcTag::selectNextTagIfExists() {
return;
}
mNumDiscNtf--;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter, mNumDiscTechList=%x", fn, mNumDiscTechList);
+ LOG(DEBUG) << StringPrintf("%s: enter, mNumDiscTechList=%x", fn,
+ mNumDiscTechList);
for (int i = 0; i < mNumDiscTechList; i++) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: nfa target idx=%dh=0x%X; protocol=0x%X", fn, i,
- mTechHandlesDiscData[i], mTechLibNfcTypesDiscData[i]);
+ LOG(DEBUG) << StringPrintf("%s: nfa target idx=%dh=0x%X; protocol=0x%X", fn,
+ i, mTechHandlesDiscData[i],
+ mTechLibNfcTypesDiscData[i]);
if (((mTechHandlesDiscData[sLastSelectedTagId] !=
mTechHandlesDiscData[i]) ||
(mTechLibNfcTypesDiscData[sLastSelectedTagId] !=
@@ -1221,15 +1205,13 @@ void NfcTag::selectNextTagIfExists() {
stat = NFA_Select(mTechHandlesDiscData[foundIdx],
mTechLibNfcTypesDiscData[foundIdx], rf_intf);
if (stat == NFA_STATUS_OK) {
- DLOG_IF(ERROR, nfc_debug_enabled)
- << StringPrintf("%s: Select Success, wait for activated ntf", fn);
+ LOG(ERROR) << StringPrintf("%s: Select Success, wait for activated ntf",
+ fn);
} else {
- DLOG_IF(ERROR, nfc_debug_enabled)
- << StringPrintf("%s: fail select; error=0x%X", fn, stat);
+ LOG(ERROR) << StringPrintf("%s: fail select; error=0x%X", fn, stat);
}
} else {
- DLOG_IF(ERROR, nfc_debug_enabled)
- << StringPrintf("%s: only found NFC-DEP technology.", fn);
+ LOG(ERROR) << StringPrintf("%s: only found NFC-DEP technology.", fn);
}
}
@@ -1316,7 +1298,7 @@ bool NfcTag::isMifareUltralight() {
break;
}
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: return=%u", fn, retval);
+ LOG(DEBUG) << StringPrintf("%s: return=%u", fn, retval);
return retval;
}
@@ -1347,7 +1329,7 @@ bool NfcTag::isMifareDESFire() {
}
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: return=%u", fn, retval);
+ LOG(DEBUG) << StringPrintf("%s: return=%u", fn, retval);
return retval;
}
@@ -1387,7 +1369,7 @@ bool NfcTag::isT2tNackResponse(const uint8_t* response, uint32_t responseLen) {
else
isNack = true; // assume every value is a NACK
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: return %u", fn, isNack);
+ LOG(DEBUG) << StringPrintf("%s: return %u", fn, isNack);
return isNack;
}
@@ -1591,7 +1573,7 @@ bool NfcTag::isInfineonMyDMove() {
break;
}
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: return=%u", fn, retval);
+ LOG(DEBUG) << StringPrintf("%s: return=%u", fn, retval);
return retval;
}
@@ -1616,7 +1598,7 @@ bool NfcTag::isKovioType2Tag() {
break;
}
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: return=%u", fn, retval);
+ LOG(DEBUG) << StringPrintf("%s: return=%u", fn, retval);
return retval;
}
diff --git a/nci/jni/PowerSwitch.cpp b/nci/jni/PowerSwitch.cpp
index 0fed6795..2262a941 100644
--- a/nci/jni/PowerSwitch.cpp
+++ b/nci/jni/PowerSwitch.cpp
@@ -18,11 +18,12 @@
* Adjust the controller's power states.
*/
#include "PowerSwitch.h"
-#include "NfcJniUtil.h"
-#include "nfc_config.h"
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
+
+#include "NfcJniUtil.h"
+#include "nfc_config.h"
using android::base::StringPrintf;
@@ -31,7 +32,7 @@ void doStartupConfig();
}
extern bool gActivated;
-extern bool nfc_debug_enabled;
+
extern SyncEvent gDeactivatedEvent;
PowerSwitch PowerSwitch::sPowerSwitch;
@@ -92,13 +93,13 @@ void PowerSwitch::initialize(PowerLevel level) {
mMutex.lock();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: level=%s (%u)", fn, powerLevelToString(level), level);
+ LOG(DEBUG) << StringPrintf("%s: level=%s (%u)", fn, powerLevelToString(level),
+ level);
if (NfcConfig::hasKey(NAME_SCREEN_OFF_POWER_STATE))
mDesiredScreenOffPowerState =
(int)NfcConfig::getUnsigned(NAME_SCREEN_OFF_POWER_STATE);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: desired screen-off state=%d", fn, mDesiredScreenOffPowerState);
+ LOG(DEBUG) << StringPrintf("%s: desired screen-off state=%d", fn,
+ mDesiredScreenOffPowerState);
switch (level) {
case FULL_POWER:
@@ -151,8 +152,8 @@ bool PowerSwitch::setLevel(PowerLevel newLevel) {
mMutex.lock();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: level=%s (%u)", fn, powerLevelToString(newLevel), newLevel);
+ LOG(DEBUG) << StringPrintf("%s: level=%s (%u)", fn,
+ powerLevelToString(newLevel), newLevel);
if (mCurrLevel == newLevel) {
retval = true;
goto TheEnd;
@@ -168,8 +169,7 @@ bool PowerSwitch::setLevel(PowerLevel newLevel) {
mMutex.unlock();
SyncEventGuard g(gDeactivatedEvent);
if (gActivated) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: wait for deactivation", fn);
+ LOG(DEBUG) << StringPrintf("%s: wait for deactivation", fn);
gDeactivatedEvent.wait();
}
mMutex.lock();
@@ -198,8 +198,8 @@ bool PowerSwitch::setLevel(PowerLevel newLevel) {
break;
}
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: actual power level=%s", fn, powerLevelToString(mCurrLevel));
+ LOG(DEBUG) << StringPrintf("%s: actual power level=%s", fn,
+ powerLevelToString(mCurrLevel));
TheEnd:
mMutex.unlock();
@@ -207,9 +207,9 @@ TheEnd:
}
bool PowerSwitch::setScreenOffPowerState(ScreenOffPowerState newState) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("PowerSwitch::setScreenOffPowerState: level=%s (%u)",
- screenOffPowerStateToString(newState), newState);
+ LOG(DEBUG) << StringPrintf(
+ "PowerSwitch::setScreenOffPowerState: level=%s (%u)",
+ screenOffPowerStateToString(newState), newState);
mMutex.lock();
mDesiredScreenOffPowerState = (int)newState;
@@ -233,7 +233,7 @@ bool PowerSwitch::setModeOff(PowerActivity deactivated) {
mMutex.lock();
mCurrActivity &= ~deactivated;
retVal = mCurrActivity != 0;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"PowerSwitch::setModeOff(deactivated=0x%x) : mCurrActivity=0x%x",
deactivated, mCurrActivity);
mMutex.unlock();
@@ -255,7 +255,7 @@ bool PowerSwitch::setModeOn(PowerActivity activated) {
mMutex.lock();
mCurrActivity |= activated;
retVal = mCurrActivity != 0;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"PowerSwitch::setModeOn(activated=0x%x) : mCurrActivity=0x%x", activated,
mCurrActivity);
mMutex.unlock();
@@ -274,8 +274,7 @@ bool PowerSwitch::setModeOn(PowerActivity activated) {
*******************************************************************************/
bool PowerSwitch::setPowerOffSleepState(bool sleep) {
static const char fn[] = "PowerSwitch::setPowerOffSleepState";
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter; sleep=%u", fn, sleep);
+ LOG(DEBUG) << StringPrintf("%s: enter; sleep=%u", fn, sleep);
tNFA_STATUS stat = NFA_STATUS_FAILED;
bool retval = false;
@@ -287,7 +286,7 @@ bool PowerSwitch::setPowerOffSleepState(bool sleep) {
mExpectedDeviceMgtPowerState =
NFA_DM_PWR_MODE_OFF_SLEEP; // if power adjustment is ok, then this is
// the expected state
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: try power off", fn);
+ LOG(DEBUG) << StringPrintf("%s: try power off", fn);
stat = NFA_PowerOffSleepMode(TRUE);
if (stat == NFA_STATUS_OK) {
mPowerStateEvent.wait();
@@ -312,8 +311,7 @@ bool PowerSwitch::setPowerOffSleepState(bool sleep) {
mExpectedDeviceMgtPowerState =
NFA_DM_PWR_MODE_FULL; // if power adjustment is ok, then this is the
// expected state
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: try full power", fn);
+ LOG(DEBUG) << StringPrintf("%s: try full power", fn);
stat = NFA_PowerOffSleepMode(FALSE);
if (stat == NFA_STATUS_OK) {
mPowerStateEvent.wait();
@@ -341,8 +339,7 @@ bool PowerSwitch::setPowerOffSleepState(bool sleep) {
retval = true;
TheEnd:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit; return %u", fn, retval);
+ LOG(DEBUG) << StringPrintf("%s: exit; return %u", fn, retval);
return retval;
}
@@ -428,7 +425,7 @@ const char* PowerSwitch::screenOffPowerStateToString(
*******************************************************************************/
void PowerSwitch::abort() {
static const char fn[] = "PowerSwitch::abort";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", fn);
+ LOG(DEBUG) << StringPrintf("%s", fn);
SyncEventGuard guard(mPowerStateEvent);
mPowerStateEvent.notifyOne();
}
@@ -451,7 +448,7 @@ void PowerSwitch::deviceManagementCallback(uint8_t event,
switch (event) {
case NFA_DM_PWR_MODE_CHANGE_EVT: {
tNFA_DM_PWR_MODE_CHANGE& power_mode = eventData->power_mode;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_DM_PWR_MODE_CHANGE_EVT; status=0x%X; device mgt power "
"state=%s (0x%X)",
fn, power_mode.status,
diff --git a/nci/jni/RouteDataSet.cpp b/nci/jni/RouteDataSet.cpp
index e1756a02..3f77e796 100644
--- a/nci/jni/RouteDataSet.cpp
+++ b/nci/jni/RouteDataSet.cpp
@@ -18,8 +18,8 @@
* Import and export general routing data using a XML file.
*/
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <errno.h>
#include <sys/stat.h>
@@ -35,7 +35,6 @@
using android::base::StringPrintf;
extern std::string nfc_storage_path;
-extern bool nfc_debug_enabled;
/*******************************************************************************
**
@@ -110,13 +109,12 @@ RouteDataSet::~RouteDataSet() { deleteDatabase(); }
**
*******************************************************************************/
bool RouteDataSet::initialize() {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: enter", "RouteDataSet::initialize");
+ LOG(DEBUG) << StringPrintf("%s: enter", "RouteDataSet::initialize");
// check that the libxml2 version in use is compatible
// with the version the software has been compiled with
LIBXML_TEST_VERSION
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit; return=true", "RouteDataSet::initialize");
+ LOG(DEBUG) << StringPrintf("%s: exit; return=true",
+ "RouteDataSet::initialize");
return true;
}
@@ -130,10 +128,10 @@ bool RouteDataSet::initialize() {
**
*******************************************************************************/
void RouteDataSet::deleteDatabase() {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: default db size=%zu; sec elem db size=%zu",
- "RouteDataSet::deleteDatabase", mDefaultRouteDatabase.size(),
- mSecElemRouteDatabase.size());
+ LOG(DEBUG) << StringPrintf("%s: default db size=%zu; sec elem db size=%zu",
+ "RouteDataSet::deleteDatabase",
+ mDefaultRouteDatabase.size(),
+ mSecElemRouteDatabase.size());
Database::iterator it;
for (it = mDefaultRouteDatabase.begin(); it != mDefaultRouteDatabase.end();
@@ -158,7 +156,7 @@ void RouteDataSet::deleteDatabase() {
*******************************************************************************/
bool RouteDataSet::import() {
static const char fn[] = "RouteDataSet::import";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", fn);
+ LOG(DEBUG) << StringPrintf("%s: enter", fn);
bool retval = false;
xmlDocPtr doc;
xmlNodePtr node1;
@@ -169,7 +167,7 @@ bool RouteDataSet::import() {
doc = xmlParseFile(strFilename.c_str());
if (doc == NULL) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: fail parse", fn);
+ LOG(DEBUG) << StringPrintf("%s: fail parse", fn);
goto TheEnd;
}
@@ -178,8 +176,7 @@ bool RouteDataSet::import() {
LOG(ERROR) << StringPrintf("%s: fail root element", fn);
goto TheEnd;
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: root=%s", fn, node1->name);
+ LOG(DEBUG) << StringPrintf("%s: root=%s", fn, node1->name);
node1 = node1->xmlChildrenNode;
while (node1) // loop through all elements in <Routes ...
@@ -188,8 +185,7 @@ bool RouteDataSet::import() {
xmlChar* value = xmlGetProp(node1, (const xmlChar*)"Type");
if (value &&
(xmlStrcmp(value, (const xmlChar*)"SecElemSelectedRoutes") == 0)) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: found SecElemSelectedRoutes", fn);
+ LOG(DEBUG) << StringPrintf("%s: found SecElemSelectedRoutes", fn);
xmlNodePtr node2 = node1->xmlChildrenNode;
while (node2) // loop all elements in <Route
// Type="SecElemSelectedRoutes" ...
@@ -202,8 +198,7 @@ bool RouteDataSet::import() {
} // loop all elements in <Route Type="SecElemSelectedRoutes" ...
} else if (value &&
(xmlStrcmp(value, (const xmlChar*)"DefaultRoutes") == 0)) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: found DefaultRoutes", fn);
+ LOG(DEBUG) << StringPrintf("%s: found DefaultRoutes", fn);
xmlNodePtr node2 = node1->xmlChildrenNode;
while (node2) // loop all elements in <Route Type="DefaultRoutes" ...
{
@@ -223,8 +218,7 @@ bool RouteDataSet::import() {
TheEnd:
xmlFreeDoc(doc);
xmlCleanupParser();
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit; return=%u", fn, retval);
+ LOG(DEBUG) << StringPrintf("%s: exit; return=%u", fn, retval);
return retval;
}
@@ -256,8 +250,7 @@ bool RouteDataSet::saveToFile(const char* routesXml) {
actualWritten = fwrite(routesXml, sizeof(char), strlen(routesXml), fh);
retval = actualWritten == strlen(routesXml);
fclose(fh);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: wrote %zu bytes", fn, actualWritten);
+ LOG(DEBUG) << StringPrintf("%s: wrote %zu bytes", fn, actualWritten);
if (retval == false) LOG(ERROR) << StringPrintf("%s: error during write", fn);
// set file permission to
@@ -286,8 +279,8 @@ bool RouteDataSet::loadFromFile(std::string& routesXml) {
filename.append(sConfigFile);
fh = fopen(filename.c_str(), "r");
if (fh == NULL) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: fail to open file", "RouteDataSet::loadFromFile");
+ LOG(DEBUG) << StringPrintf("%s: fail to open file",
+ "RouteDataSet::loadFromFile");
return false;
}
@@ -297,8 +290,8 @@ bool RouteDataSet::loadFromFile(std::string& routesXml) {
routesXml.append(buffer, actual);
}
fclose(fh);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: read %zu bytes", "RouteDataSet::loadFromFile", routesXml.length());
+ LOG(DEBUG) << StringPrintf("%s: read %zu bytes", "RouteDataSet::loadFromFile",
+ routesXml.length());
return true;
}
@@ -324,7 +317,7 @@ void RouteDataSet::importProtocolRoute(xmlNodePtr& element,
RouteDataForProtocol* data = new RouteDataForProtocol;
xmlChar* value = NULL;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: element=%s", "RouteDataSet::importProtocolRoute", element->name);
value = xmlGetProp(element, id);
if (value) {
@@ -337,9 +330,9 @@ void RouteDataSet::importProtocolRoute(xmlNodePtr& element,
else if (xmlStrcmp(value, (const xmlChar*)"IsoDep") == 0)
data->mProtocol = NFA_PROTOCOL_MASK_ISO_DEP;
xmlFree(value);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: %s=0x%X", "RouteDataSet::importProtocolRoute", id,
- data->mProtocol);
+ LOG(DEBUG) << StringPrintf("%s: %s=0x%X",
+ "RouteDataSet::importProtocolRoute", id,
+ data->mProtocol);
}
value = xmlGetProp(element, secElem);
@@ -347,9 +340,9 @@ void RouteDataSet::importProtocolRoute(xmlNodePtr& element,
data->mNfaEeHandle = strtol((char*)value, NULL, 16);
xmlFree(value);
data->mNfaEeHandle = data->mNfaEeHandle | NFA_HANDLE_GROUP_EE;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: %s=0x%X", "RouteDataSet::importProtocolRoute",
- secElem, data->mNfaEeHandle);
+ LOG(DEBUG) << StringPrintf("%s: %s=0x%X",
+ "RouteDataSet::importProtocolRoute", secElem,
+ data->mNfaEeHandle);
}
value = xmlGetProp(element, switchOn);
@@ -394,7 +387,7 @@ void RouteDataSet::importTechnologyRoute(xmlNodePtr& element,
RouteDataForTechnology* data = new RouteDataForTechnology;
xmlChar* value = NULL;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: element=%s", "RouteDataSet::importTechnologyRoute", element->name);
value = xmlGetProp(element, id);
if (value) {
@@ -405,9 +398,9 @@ void RouteDataSet::importTechnologyRoute(xmlNodePtr& element,
else if (xmlStrcmp(value, (const xmlChar*)"NfcF") == 0)
data->mTechnology = NFA_TECHNOLOGY_MASK_F;
xmlFree(value);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: %s=0x%X", "RouteDataSet::importTechnologyRoute",
- id, data->mTechnology);
+ LOG(DEBUG) << StringPrintf("%s: %s=0x%X",
+ "RouteDataSet::importTechnologyRoute", id,
+ data->mTechnology);
}
value = xmlGetProp(element, secElem);
@@ -415,9 +408,9 @@ void RouteDataSet::importTechnologyRoute(xmlNodePtr& element,
data->mNfaEeHandle = strtol((char*)value, NULL, 16);
xmlFree(value);
data->mNfaEeHandle = data->mNfaEeHandle | NFA_HANDLE_GROUP_EE;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: %s=0x%X", "RouteDataSet::importTechnologyRoute",
- secElem, data->mNfaEeHandle);
+ LOG(DEBUG) << StringPrintf("%s: %s=0x%X",
+ "RouteDataSet::importTechnologyRoute", secElem,
+ data->mNfaEeHandle);
}
value = xmlGetProp(element, switchOn);
@@ -454,8 +447,7 @@ bool RouteDataSet::deleteFile() {
std::string filename(nfc_storage_path);
filename.append(sConfigFile);
int stat = remove(filename.c_str());
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: exit %u", fn, stat == 0);
+ LOG(DEBUG) << StringPrintf("%s: exit %u", fn, stat == 0);
return stat == 0;
}
@@ -492,43 +484,37 @@ void RouteDataSet::printDiagnostic() {
static const char fn[] = "RouteDataSet::printDiagnostic";
Database* db = getDatabase(DefaultRouteDatabase);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: default route database", fn);
+ LOG(DEBUG) << StringPrintf("%s: default route database", fn);
for (Database::iterator iter = db->begin(); iter != db->end(); iter++) {
RouteData* routeData = *iter;
switch (routeData->mRouteType) {
case RouteData::ProtocolRoute: {
RouteDataForProtocol* proto = (RouteDataForProtocol*)routeData;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: ee h=0x%X; protocol=0x%X", fn,
- proto->mNfaEeHandle, proto->mProtocol);
+ LOG(DEBUG) << StringPrintf("%s: ee h=0x%X; protocol=0x%X", fn,
+ proto->mNfaEeHandle, proto->mProtocol);
} break;
case RouteData::TechnologyRoute: {
RouteDataForTechnology* tech = (RouteDataForTechnology*)routeData;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: ee h=0x%X; technology=0x%X", fn,
- tech->mNfaEeHandle, tech->mTechnology);
+ LOG(DEBUG) << StringPrintf("%s: ee h=0x%X; technology=0x%X", fn,
+ tech->mNfaEeHandle, tech->mTechnology);
} break;
}
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: sec elem route database", fn);
+ LOG(DEBUG) << StringPrintf("%s: sec elem route database", fn);
db = getDatabase(SecElemRouteDatabase);
for (Database::iterator iter2 = db->begin(); iter2 != db->end(); iter2++) {
RouteData* routeData = *iter2;
switch (routeData->mRouteType) {
case RouteData::ProtocolRoute: {
RouteDataForProtocol* proto = (RouteDataForProtocol*)routeData;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: ee h=0x%X; protocol=0x%X", fn,
- proto->mNfaEeHandle, proto->mProtocol);
+ LOG(DEBUG) << StringPrintf("%s: ee h=0x%X; protocol=0x%X", fn,
+ proto->mNfaEeHandle, proto->mProtocol);
} break;
case RouteData::TechnologyRoute: {
RouteDataForTechnology* tech = (RouteDataForTechnology*)routeData;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: ee h=0x%X; technology=0x%X", fn,
- tech->mNfaEeHandle, tech->mTechnology);
+ LOG(DEBUG) << StringPrintf("%s: ee h=0x%X; technology=0x%X", fn,
+ tech->mNfaEeHandle, tech->mTechnology);
} break;
}
}
diff --git a/nci/jni/RoutingManager.cpp b/nci/jni/RoutingManager.cpp
index efeaf23f..39e9af78 100755
--- a/nci/jni/RoutingManager.cpp
+++ b/nci/jni/RoutingManager.cpp
@@ -18,13 +18,16 @@
* Manage the listen-mode routing table.
*/
+#include "RoutingManager.h"
+// Redefined by android-base headers.
+#undef ATTRIBUTE_UNUSED
+
+#include <android-base/logging.h>
#include <android-base/stringprintf.h>
-#include <base/logging.h>
#include <nativehelper/JNIHelp.h>
#include <nativehelper/ScopedLocalRef.h>
#include "JavaClassConstants.h"
-#include "RoutingManager.h"
#include "nfa_ce_api.h"
#include "nfa_ee_api.h"
#include "nfc_config.h"
@@ -33,7 +36,6 @@ using android::base::StringPrintf;
extern bool gActivated;
extern SyncEvent gDeactivatedEvent;
-extern bool nfc_debug_enabled;
const JNINativeMethod RoutingManager::sMethods[] = {
{"doGetDefaultRouteDestination", "()I",
@@ -79,12 +81,11 @@ RoutingManager::RoutingManager()
}
mDefaultFelicaRoute = NfcConfig::getUnsigned(NAME_DEFAULT_NFCF_ROUTE, 0x00);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: Active SE for Nfc-F is 0x%02X", fn, mDefaultFelicaRoute);
+ LOG(DEBUG) << StringPrintf("%s: Active SE for Nfc-F is 0x%02X", fn,
+ mDefaultFelicaRoute);
mDefaultEe = NfcConfig::getUnsigned(NAME_DEFAULT_ROUTE, 0x00);
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: default route is 0x%02X", fn, mDefaultEe);
+ LOG(DEBUG) << StringPrintf("%s: default route is 0x%02X", fn, mDefaultEe);
mAidMatchingMode =
NfcConfig::getUnsigned(NAME_AID_MATCHING_MODE, AID_MATCHING_EXACT_ONLY);
@@ -100,8 +101,8 @@ RoutingManager::RoutingManager()
std::vector<uint8_t> pSysCode = NfcConfig::getBytes(NAME_DEFAULT_SYS_CODE);
if (pSysCode.size() == 0x02) {
mDefaultSysCode = ((pSysCode[0] << 8) | ((int)pSysCode[1] << 0));
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: DEFAULT_SYS_CODE: 0x%02X", __func__, mDefaultSysCode);
+ LOG(DEBUG) << StringPrintf("%s: DEFAULT_SYS_CODE: 0x%02X", __func__,
+ mDefaultSysCode);
}
}
@@ -138,7 +139,7 @@ bool RoutingManager::initialize(nfc_jni_native_data* native) {
{
SyncEventGuard guard(mEeRegisterEvent);
- DLOG_IF(INFO, nfc_debug_enabled) << fn << ": try ee register";
+ LOG(DEBUG) << fn << ": try ee register";
tNFA_STATUS nfaStat = NFA_EeRegister(nfaEeCallback);
if (nfaStat != NFA_STATUS_OK) {
LOG(ERROR) << StringPrintf("%s: fail ee register; error=0x%X", fn,
@@ -319,7 +320,7 @@ bool RoutingManager::isTypeATypeBTechSupportedInEe(tNFA_HANDLE eeHandle) {
tNFA_EE_INFO eeInfo[mActualNumEe];
memset(&eeInfo, 0, mActualNumEe * sizeof(tNFA_EE_INFO));
tNFA_STATUS nfaStat = NFA_EeGetInfo(&mActualNumEe, eeInfo);
- DLOG_IF(INFO, nfc_debug_enabled) << fn;
+ LOG(DEBUG) << fn;
if (nfaStat != NFA_STATUS_OK) {
return status;
}
@@ -337,7 +338,7 @@ bool RoutingManager::isTypeATypeBTechSupportedInEe(tNFA_HANDLE eeHandle) {
bool RoutingManager::addAidRouting(const uint8_t* aid, uint8_t aidLen,
int route, int aidInfo, int power) {
static const char fn[] = "RoutingManager::addAidRouting";
- DLOG_IF(INFO, nfc_debug_enabled) << fn << ": enter";
+ LOG(DEBUG) << fn << ": enter";
uint8_t powerState = 0x01;
if (!mSecureNfcEnabled) {
if (power == 0x00) {
@@ -355,7 +356,7 @@ bool RoutingManager::addAidRouting(const uint8_t* aid, uint8_t aidLen,
mAidAddRemoveEvent.wait();
}
if (mAidRoutingConfigured) {
- DLOG_IF(INFO, nfc_debug_enabled) << fn << ": routed AID";
+ LOG(DEBUG) << fn << ": routed AID";
return true;
} else {
LOG(ERROR) << fn << ": failed to route AID";
@@ -365,14 +366,14 @@ bool RoutingManager::addAidRouting(const uint8_t* aid, uint8_t aidLen,
bool RoutingManager::removeAidRouting(const uint8_t* aid, uint8_t aidLen) {
static const char fn[] = "RoutingManager::removeAidRouting";
- DLOG_IF(INFO, nfc_debug_enabled) << fn << ": enter";
+ LOG(DEBUG) << fn << ": enter";
if (aidLen != 0) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s : len=%d, 0x%x 0x%x 0x%x 0x%x 0x%x", fn, aidLen,
- *(aid), *(aid + 1), *(aid + 2), *(aid + 3), *(aid + 4));
+ LOG(DEBUG) << StringPrintf("%s : len=%d, 0x%x 0x%x 0x%x 0x%x 0x%x", fn,
+ aidLen, *(aid), *(aid + 1), *(aid + 2),
+ *(aid + 3), *(aid + 4));
} else {
- DLOG_IF(INFO, nfc_debug_enabled) << fn << "Remove Empty aid";
+ LOG(DEBUG) << fn << "Remove Empty aid";
}
SyncEventGuard guard(mAidAddRemoveEvent);
@@ -382,7 +383,7 @@ bool RoutingManager::removeAidRouting(const uint8_t* aid, uint8_t aidLen) {
mAidAddRemoveEvent.wait();
}
if (mAidRoutingConfigured) {
- DLOG_IF(INFO, nfc_debug_enabled) << fn << ": removed AID";
+ LOG(DEBUG) << fn << ": removed AID";
return true;
} else {
LOG(WARNING) << fn << ": failed to remove AID";
@@ -393,7 +394,7 @@ bool RoutingManager::removeAidRouting(const uint8_t* aid, uint8_t aidLen) {
bool RoutingManager::commitRouting() {
static const char fn[] = "RoutingManager::commitRouting";
tNFA_STATUS nfaStat = 0;
- DLOG_IF(INFO, nfc_debug_enabled) << fn;
+ LOG(DEBUG) << fn;
if(mEeInfoChanged) {
mSeTechMask = updateEeTechRouteSetting();
mEeInfoChanged = false;
@@ -431,7 +432,7 @@ void RoutingManager::onNfccShutdown() {
NCI_NFCEE_INTERFACE_HCI_ACCESS) &&
(eeInfo[xx].ee_status == NFA_EE_STATUS_ACTIVE);
if (bIsOffHostEEPresent) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: Handle: 0x%04x Change Status Active to Inactive", fn,
eeInfo[xx].ee_handle);
SyncEventGuard guard(mEeSetModeEvent);
@@ -444,7 +445,7 @@ void RoutingManager::onNfccShutdown() {
}
}
} else {
- DLOG_IF(INFO, nfc_debug_enabled) << fn << ": No active EEs found";
+ LOG(DEBUG) << fn << ": No active EEs found";
}
}
@@ -556,21 +557,21 @@ void RoutingManager::notifyEeUpdated() {
void RoutingManager::stackCallback(uint8_t event,
tNFA_CONN_EVT_DATA* eventData) {
static const char fn[] = "RoutingManager::stackCallback";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: event=0x%X", fn, event);
+ LOG(DEBUG) << StringPrintf("%s: event=0x%X", fn, event);
RoutingManager& routingManager = RoutingManager::getInstance();
switch (event) {
case NFA_CE_REGISTERED_EVT: {
tNFA_CE_REGISTERED& ce_registered = eventData->ce_registered;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_CE_REGISTERED_EVT; status=0x%X; h=0x%X", fn,
- ce_registered.status, ce_registered.handle);
+ LOG(DEBUG) << StringPrintf(
+ "%s: NFA_CE_REGISTERED_EVT; status=0x%X; h=0x%X", fn,
+ ce_registered.status, ce_registered.handle);
} break;
case NFA_CE_DEREGISTERED_EVT: {
tNFA_CE_DEREGISTERED& ce_deregistered = eventData->ce_deregistered;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_CE_DEREGISTERED_EVT; h=0x%X", fn, ce_deregistered.handle);
+ LOG(DEBUG) << StringPrintf("%s: NFA_CE_DEREGISTERED_EVT; h=0x%X", fn,
+ ce_deregistered.handle);
} break;
case NFA_CE_ACTIVATED_EVT: {
@@ -579,7 +580,7 @@ void RoutingManager::stackCallback(uint8_t event,
case NFA_DEACTIVATED_EVT:
case NFA_CE_DEACTIVATED_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_DEACTIVATED_EVT, NFA_CE_DEACTIVATED_EVT", fn);
routingManager.notifyDeactivated(NFA_TECHNOLOGY_MASK_A);
SyncEventGuard g(gDeactivatedEvent);
@@ -589,9 +590,9 @@ void RoutingManager::stackCallback(uint8_t event,
case NFA_CE_DATA_EVT: {
tNFA_CE_DATA& ce_data = eventData->ce_data;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_CE_DATA_EVT; stat=0x%X; h=0x%X; data len=%u",
- fn, ce_data.status, ce_data.handle, ce_data.len);
+ LOG(DEBUG) << StringPrintf(
+ "%s: NFA_CE_DATA_EVT; stat=0x%X; h=0x%X; data len=%u", fn,
+ ce_data.status, ce_data.handle, ce_data.len);
getInstance().handleData(NFA_TECHNOLOGY_MASK_A, ce_data.p_data,
ce_data.len, ce_data.status);
} break;
@@ -640,8 +641,7 @@ void RoutingManager::updateDefaultProtocolRoute() {
NFC_DH_ID, protoMask, 0, 0, mSecureNfcEnabled ? 0 : protoMask, 0, 0);
}
if (nfaStat == NFA_STATUS_OK)
- DLOG_IF(INFO, nfc_debug_enabled)
- << fn << ": Succeed to register default ISO-DEP route";
+ LOG(DEBUG) << fn << ": Succeed to register default ISO-DEP route";
else
LOG(ERROR) << fn << ": failed to register default ISO-DEP route";
@@ -680,8 +680,7 @@ void RoutingManager::updateDefaultRoute() {
} else if (nfaStat == NFA_STATUS_OK) {
mIsScbrSupported = true;
mRoutingEvent.wait();
- DLOG_IF(INFO, nfc_debug_enabled)
- << fn << ": Succeed to register system code";
+ LOG(DEBUG) << fn << ": Succeed to register system code";
} else {
LOG(ERROR) << fn << ": Fail to register system code";
// still support SCBR routing for other NFCEEs
@@ -692,7 +691,7 @@ void RoutingManager::updateDefaultRoute() {
if (mDefaultEe != mDefaultIsoDepRoute) {
if ((mDefaultEe != NFC_DH_ID) &&
(!isTypeATypeBTechSupportedInEe(mDefaultEe | NFA_HANDLE_GROUP_EE))) {
- DLOG_IF(INFO, nfc_debug_enabled)
+ LOG(DEBUG)
<< fn << ": mDefaultEE Doesn't support either Tech A/B. Returning...";
return;
}
@@ -702,8 +701,7 @@ void RoutingManager::updateDefaultRoute() {
nfaStat = NFA_EeAddAidRouting(mDefaultEe, 0, NULL, powerState,
AID_ROUTE_QUAL_PREFIX);
if (nfaStat == NFA_STATUS_OK)
- DLOG_IF(INFO, nfc_debug_enabled)
- << fn << ": Succeed to register zero length AID";
+ LOG(DEBUG) << fn << ": Succeed to register zero length AID";
else
LOG(ERROR) << fn << ": failed to register zero length AID";
}
@@ -734,15 +732,14 @@ tNFA_TECHNOLOGY_MASK RoutingManager::updateEeTechRouteSetting() {
if (mDefaultOffHostRoute == 0 && mDefaultFelicaRoute == 0)
return allSeTechMask;
- DLOG_IF(INFO, nfc_debug_enabled)
- << fn << ": Number of EE is " << (int)mEeInfo.num_ee;
+ LOG(DEBUG) << fn << ": Number of EE is " << (int)mEeInfo.num_ee;
tNFA_STATUS nfaStat;
for (uint8_t i = 0; i < mEeInfo.num_ee; i++) {
tNFA_HANDLE eeHandle = mEeInfo.ee_disc_info[i].ee_handle;
tNFA_TECHNOLOGY_MASK seTechMask = 0;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s EE[%u] Handle: 0x%04x techA: 0x%02x techB: "
"0x%02x techF: 0x%02x techBprime: 0x%02x",
fn, i, eeHandle, mEeInfo.ee_disc_info[i].la_protocol,
@@ -767,11 +764,10 @@ tNFA_TECHNOLOGY_MASK RoutingManager::updateEeTechRouteSetting() {
// filter out the unspecified technologies
seTechMask &= mOffHostListenTechMask;
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: seTechMask[%u]=0x%02x", fn, i, seTechMask);
+ LOG(DEBUG) << StringPrintf("%s: seTechMask[%u]=0x%02x", fn, i, seTechMask);
if (seTechMask != 0x00) {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "Configuring tech mask 0x%02x on EE 0x%04x", seTechMask, eeHandle);
+ LOG(DEBUG) << StringPrintf("Configuring tech mask 0x%02x on EE 0x%04x",
+ seTechMask, eeHandle);
nfaStat = NFA_CeConfigureUiccListenTech(eeHandle, seTechMask);
if (nfaStat != NFA_STATUS_OK)
@@ -844,50 +840,50 @@ void RoutingManager::nfaEeCallback(tNFA_EE_EVT event,
switch (event) {
case NFA_EE_REGISTER_EVT: {
SyncEventGuard guard(routingManager.mEeRegisterEvent);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_REGISTER_EVT; status=%u", fn, eventData->ee_register);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_REGISTER_EVT; status=%u", fn,
+ eventData->ee_register);
routingManager.mEeRegisterEvent.notifyOne();
} break;
case NFA_EE_DEREGISTER_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_DEREGISTER_EVT; status=0x%X", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_DEREGISTER_EVT; status=0x%X", fn,
+ eventData->status);
routingManager.mReceivedEeInfo = false;
routingManager.mDeinitializing = false;
} break;
case NFA_EE_MODE_SET_EVT: {
SyncEventGuard guard(routingManager.mEeSetModeEvent);
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_EE_MODE_SET_EVT; status: 0x%04X handle: 0x%04X ", fn,
eventData->mode_set.status, eventData->mode_set.ee_handle);
routingManager.mEeSetModeEvent.notifyOne();
} break;
case NFA_EE_SET_TECH_CFG_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_SET_TECH_CFG_EVT; status=0x%X", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_SET_TECH_CFG_EVT; status=0x%X", fn,
+ eventData->status);
SyncEventGuard guard(routingManager.mRoutingEvent);
routingManager.mRoutingEvent.notifyOne();
} break;
case NFA_EE_CLEAR_TECH_CFG_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_CLEAR_TECH_CFG_EVT; status=0x%X", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_CLEAR_TECH_CFG_EVT; status=0x%X",
+ fn, eventData->status);
SyncEventGuard guard(routingManager.mRoutingEvent);
routingManager.mRoutingEvent.notifyOne();
} break;
case NFA_EE_SET_PROTO_CFG_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_SET_PROTO_CFG_EVT; status=0x%X", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_SET_PROTO_CFG_EVT; status=0x%X",
+ fn, eventData->status);
SyncEventGuard guard(routingManager.mRoutingEvent);
routingManager.mRoutingEvent.notifyOne();
} break;
case NFA_EE_CLEAR_PROTO_CFG_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_CLEAR_PROTO_CFG_EVT; status=0x%X", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_CLEAR_PROTO_CFG_EVT; status=0x%X",
+ fn, eventData->status);
SyncEventGuard guard(routingManager.mRoutingEvent);
routingManager.mRoutingEvent.notifyOne();
} break;
@@ -895,32 +891,32 @@ void RoutingManager::nfaEeCallback(tNFA_EE_EVT event,
case NFA_EE_ACTION_EVT: {
tNFA_EE_ACTION& action = eventData->action;
if (action.trigger == NFC_EE_TRIG_SELECT)
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_EE_ACTION_EVT; h=0x%X; trigger=select (0x%X)", fn,
action.ee_handle, action.trigger);
else if (action.trigger == NFC_EE_TRIG_APP_INIT) {
tNFC_APP_INIT& app_init = action.param.app_init;
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_EE_ACTION_EVT; h=0x%X; trigger=app-init "
"(0x%X); aid len=%u; data len=%u",
fn, action.ee_handle, action.trigger, app_init.len_aid,
app_init.len_data);
} else if (action.trigger == NFC_EE_TRIG_RF_PROTOCOL)
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_EE_ACTION_EVT; h=0x%X; trigger=rf protocol (0x%X)", fn,
action.ee_handle, action.trigger);
else if (action.trigger == NFC_EE_TRIG_RF_TECHNOLOGY)
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_EE_ACTION_EVT; h=0x%X; trigger=rf tech (0x%X)", fn,
action.ee_handle, action.trigger);
else
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_EE_ACTION_EVT; h=0x%X; unknown trigger (0x%X)", fn,
action.ee_handle, action.trigger);
} break;
case NFA_EE_DISCOVER_REQ_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: NFA_EE_DISCOVER_REQ_EVT; status=0x%X; num ee=%u", __func__,
eventData->discover_req.status, eventData->discover_req.num_ee);
SyncEventGuard guard(routingManager.mEeInfoEvent);
@@ -935,13 +931,13 @@ void RoutingManager::nfaEeCallback(tNFA_EE_EVT event,
} break;
case NFA_EE_NO_CB_ERR_EVT:
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_NO_CB_ERR_EVT status=%u", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_NO_CB_ERR_EVT status=%u", fn,
+ eventData->status);
break;
case NFA_EE_ADD_AID_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_ADD_AID_EVT status=%u", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_ADD_AID_EVT status=%u", fn,
+ eventData->status);
SyncEventGuard guard(routingManager.mAidAddRemoveEvent);
routingManager.mAidRoutingConfigured =
(eventData->status == NFA_STATUS_OK);
@@ -951,20 +947,20 @@ void RoutingManager::nfaEeCallback(tNFA_EE_EVT event,
case NFA_EE_ADD_SYSCODE_EVT: {
SyncEventGuard guard(routingManager.mRoutingEvent);
routingManager.mRoutingEvent.notifyOne();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_ADD_SYSCODE_EVT status=%u", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_ADD_SYSCODE_EVT status=%u", fn,
+ eventData->status);
} break;
case NFA_EE_REMOVE_SYSCODE_EVT: {
SyncEventGuard guard(routingManager.mRoutingEvent);
routingManager.mRoutingEvent.notifyOne();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_REMOVE_SYSCODE_EVT status=%u", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_REMOVE_SYSCODE_EVT status=%u", fn,
+ eventData->status);
} break;
case NFA_EE_REMOVE_AID_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_REMOVE_AID_EVT status=%u", fn, eventData->status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_REMOVE_AID_EVT status=%u", fn,
+ eventData->status);
SyncEventGuard guard(routingManager.mAidAddRemoveEvent);
routingManager.mAidRoutingConfigured =
(eventData->status == NFA_STATUS_OK);
@@ -972,28 +968,25 @@ void RoutingManager::nfaEeCallback(tNFA_EE_EVT event,
} break;
case NFA_EE_NEW_EE_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
- "%s: NFA_EE_NEW_EE_EVT h=0x%X; status=%u", fn,
- eventData->new_ee.ee_handle, eventData->new_ee.ee_status);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_NEW_EE_EVT h=0x%X; status=%u", fn,
+ eventData->new_ee.ee_handle,
+ eventData->new_ee.ee_status);
} break;
case NFA_EE_UPDATED_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_EE_UPDATED_EVT", fn);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_UPDATED_EVT", fn);
SyncEventGuard guard(routingManager.mEeUpdateEvent);
routingManager.mEeUpdateEvent.notifyOne();
} break;
case NFA_EE_PWR_AND_LINK_CTRL_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: NFA_EE_PWR_AND_LINK_CTRL_EVT", fn);
+ LOG(DEBUG) << StringPrintf("%s: NFA_EE_PWR_AND_LINK_CTRL_EVT", fn);
SyncEventGuard guard(routingManager.mEePwrAndLinkCtrlEvent);
routingManager.mEePwrAndLinkCtrlEvent.notifyOne();
} break;
default:
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: unknown event=%u ????", fn, event);
+ LOG(DEBUG) << StringPrintf("%s: unknown event=%u ????", fn, event);
break;
}
}
@@ -1001,8 +994,7 @@ void RoutingManager::nfaEeCallback(tNFA_EE_EVT event,
int RoutingManager::registerT3tIdentifier(uint8_t* t3tId, uint8_t t3tIdLen) {
static const char fn[] = "RoutingManager::registerT3tIdentifier";
- DLOG_IF(INFO, nfc_debug_enabled)
- << fn << ": Start to register NFC-F system on DH";
+ LOG(DEBUG) << fn << ": Start to register NFC-F system on DH";
if (t3tIdLen != (2 + NCI_RF_F_UID_LEN + NCI_T3T_PMM_LEN)) {
LOG(ERROR) << fn << ": Invalid length of T3T Identifier";
@@ -1029,8 +1021,7 @@ int RoutingManager::registerT3tIdentifier(uint8_t* t3tId, uint8_t t3tIdLen) {
return NFA_HANDLE_INVALID;
}
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << fn << ": Succeed to register NFC-F system on DH";
+ LOG(DEBUG) << fn << ": Succeed to register NFC-F system on DH";
// Register System Code for routing
if (mIsScbrSupported) {
@@ -1044,8 +1035,7 @@ int RoutingManager::registerT3tIdentifier(uint8_t* t3tId, uint8_t t3tIdLen) {
LOG(ERROR) << StringPrintf("%s: Fail to register system code on DH", fn);
return NFA_HANDLE_INVALID;
}
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Succeed to register system code on DH", fn);
+ LOG(DEBUG) << StringPrintf("%s: Succeed to register system code on DH", fn);
// add handle and system code pair to the map
mMapScbrHandle.emplace(mNfcFOnDhHandle, systemCode);
} else {
@@ -1058,14 +1048,13 @@ int RoutingManager::registerT3tIdentifier(uint8_t* t3tId, uint8_t t3tIdLen) {
void RoutingManager::deregisterT3tIdentifier(int handle) {
static const char fn[] = "RoutingManager::deregisterT3tIdentifier";
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Start to deregister NFC-F system on DH", fn);
+ LOG(DEBUG) << StringPrintf("%s: Start to deregister NFC-F system on DH", fn);
{
SyncEventGuard guard(mRoutingEvent);
tNFA_STATUS nfaStat = NFA_CeDeregisterFelicaSystemCodeOnDH(handle);
if (nfaStat == NFA_STATUS_OK) {
mRoutingEvent.wait();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: Succeeded in deregistering NFC-F system on DH", fn);
} else {
LOG(ERROR) << StringPrintf("%s: Fail to deregister NFC-F system on DH",
@@ -1083,7 +1072,7 @@ void RoutingManager::deregisterT3tIdentifier(int handle) {
tNFA_STATUS nfaStat = NFA_EeRemoveSystemCodeRouting(systemCode);
if (nfaStat == NFA_STATUS_OK) {
mRoutingEvent.wait();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ LOG(DEBUG) << StringPrintf(
"%s: Succeeded in deregistering system Code on DH", fn);
} else {
LOG(ERROR) << StringPrintf("%s: Fail to deregister system Code on DH",
@@ -1099,49 +1088,43 @@ void RoutingManager::nfcFCeCallback(uint8_t event,
static const char fn[] = "RoutingManager::nfcFCeCallback";
RoutingManager& routingManager = RoutingManager::getInstance();
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: 0x%x", __func__, event);
+ LOG(DEBUG) << StringPrintf("%s: 0x%x", __func__, event);
switch (event) {
case NFA_CE_REGISTERED_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: registered event notified", fn);
+ LOG(DEBUG) << StringPrintf("%s: registered event notified", fn);
routingManager.mNfcFOnDhHandle = eventData->ce_registered.handle;
SyncEventGuard guard(routingManager.mRoutingEvent);
routingManager.mRoutingEvent.notifyOne();
} break;
case NFA_CE_DEREGISTERED_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: deregistered event notified", fn);
+ LOG(DEBUG) << StringPrintf("%s: deregistered event notified", fn);
SyncEventGuard guard(routingManager.mRoutingEvent);
routingManager.mRoutingEvent.notifyOne();
} break;
case NFA_CE_ACTIVATED_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: activated event notified", fn);
+ LOG(DEBUG) << StringPrintf("%s: activated event notified", fn);
routingManager.notifyActivated(NFA_TECHNOLOGY_MASK_F);
} break;
case NFA_CE_DEACTIVATED_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: deactivated event notified", fn);
+ LOG(DEBUG) << StringPrintf("%s: deactivated event notified", fn);
routingManager.notifyDeactivated(NFA_TECHNOLOGY_MASK_F);
} break;
case NFA_CE_DATA_EVT: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: data event notified", fn);
+ LOG(DEBUG) << StringPrintf("%s: data event notified", fn);
tNFA_CE_DATA& ce_data = eventData->ce_data;
routingManager.handleData(NFA_TECHNOLOGY_MASK_F, ce_data.p_data,
ce_data.len, ce_data.status);
} break;
default: {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: unknown event=%u ????", fn, event);
+ LOG(DEBUG) << StringPrintf("%s: unknown event=%u ????", fn, event);
} break;
}
}
bool RoutingManager::setNfcSecure(bool enable) {
mSecureNfcEnabled = enable;
- DLOG_IF(INFO, true) << "setNfcSecure NfcService " << enable;
+ LOG(INFO) << "setNfcSecure NfcService " << enable;
return true;
}
@@ -1159,9 +1142,8 @@ void RoutingManager::eeSetPwrAndLinkCtrl(uint8_t config) {
tNFA_STATUS status = NFA_STATUS_OK;
if (mOffHostRouteEse.size() > 0) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s - nfceeId: 0x%02X, config: 0x%02X", fn,
- mOffHostRouteEse[0], config);
+ LOG(DEBUG) << StringPrintf("%s - nfceeId: 0x%02X, config: 0x%02X", fn,
+ mOffHostRouteEse[0], config);
SyncEventGuard guard(mEePwrAndLinkCtrlEvent);
status =
@@ -1182,13 +1164,11 @@ void RoutingManager::eeSetPwrAndLinkCtrl(uint8_t config) {
void RoutingManager::clearRoutingEntry(int clearFlags) {
static const char fn[] = "RoutingManager::clearRoutingEntry";
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("%s: Enter . Clear flags = %d", fn, clearFlags);
+ LOG(DEBUG) << StringPrintf("%s: Enter . Clear flags = %d", fn, clearFlags);
tNFA_STATUS nfaStat = NFA_STATUS_FAILED;
if (clearFlags & CLEAR_AID_ENTRIES) {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("clear all of aid based routing");
+ LOG(DEBUG) << StringPrintf("clear all of aid based routing");
uint8_t clearAID[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
uint8_t aidLen = 0x08;
RoutingManager::getInstance().removeAidRouting(clearAID, aidLen);
@@ -1250,7 +1230,7 @@ void RoutingManager::deinitialize() {
int RoutingManager::registerJniFunctions(JNIEnv* e) {
static const char fn[] = "RoutingManager::registerJniFunctions";
- DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", fn);
+ LOG(DEBUG) << StringPrintf("%s", fn);
return jniRegisterNativeMethods(
e, "com/android/nfc/cardemulation/RoutingOptionManager", sMethods,
NELEM(sMethods));