diff options
author | Ruchi Kandoi <kandoiruchi@google.com> | 2017-05-17 11:50:47 -0700 |
---|---|---|
committer | Ruchi Kandoi <kandoiruchi@google.com> | 2017-07-13 09:42:25 -0700 |
commit | f67b334fd64365e1f006f851ba6ad41c221319ff (patch) | |
tree | 1a89076489b434fde09f1b9d37fa95750c95c0be | |
parent | 60b500f2a574d7b4fb52d0f721827e5a2cfc996a (diff) | |
download | android_hardware_broadcom_nfc-f67b334fd64365e1f006f851ba6ad41c221319ff.tar.gz android_hardware_broadcom_nfc-f67b334fd64365e1f006f851ba6ad41c221319ff.tar.bz2 android_hardware_broadcom_nfc-f67b334fd64365e1f006f851ba6ad41c221319ff.zip |
Add metrics for RF and EE Errors.
Adds metrics for RF as well as EE Protocol, Transmission, Timeout and
Activation errors.
Bug: 62586734
Test: inject errors and check logcat
Change-Id: I89046515b482360cd84d4e0d1113c4c45ceee5a7
-rw-r--r-- | src/Android.bp | 2 | ||||
-rw-r--r-- | src/nfc/include/nfc_api.h | 4 | ||||
-rw-r--r-- | src/nfc/nfc/nfc_ncif.cc (renamed from src/nfc/nfc/nfc_ncif.c) | 20 |
3 files changed, 25 insertions, 1 deletions
diff --git a/src/Android.bp b/src/Android.bp index d1f1860..669d63c 100644 --- a/src/Android.bp +++ b/src/Android.bp @@ -10,6 +10,7 @@ cc_library_shared { "liblog", "libdl", "libhardware", + "libmetricslogger", "libpower", // Treble configuration @@ -50,6 +51,7 @@ cc_library_shared { "nfc/nci/*.c", "nfc/ndef/*.c", "nfc/nfc/*.c", + "nfc/nfc/*.cc", "nfc/tags/*.c", "adaptation/*.c", "adaptation/*.cpp", diff --git a/src/nfc/include/nfc_api.h b/src/nfc/include/nfc_api.h index 4f47ab8..83c582f 100644 --- a/src/nfc/include/nfc_api.h +++ b/src/nfc/include/nfc_api.h @@ -370,7 +370,11 @@ typedef uint8_t tNFC_RF_STS; #define NFC_RF_TECHNOLOGY_V NCI_RF_TECHNOLOGY_V typedef uint8_t tNFC_RF_TECH; +#ifdef __cplusplus +extern "C" uint8_t NFC_GetNCIVersion(); +#else extern uint8_t NFC_GetNCIVersion(); +#endif /* Supported Protocols */ #define NFC_PROTOCOL_UNKNOWN NCI_PROTOCOL_UNKNOWN /* Unknown */ diff --git a/src/nfc/nfc/nfc_ncif.c b/src/nfc/nfc/nfc_ncif.cc index 164773b..1fa59b0 100644 --- a/src/nfc/nfc/nfc_ncif.c +++ b/src/nfc/nfc/nfc_ncif.cc @@ -23,6 +23,7 @@ * (callback). On the transmit side, it manages the command transmission. * ******************************************************************************/ +#include <metricslogger/metrics_logger.h> #include <stdlib.h> #include <string.h> #include "nfc_target.h" @@ -34,7 +35,6 @@ #include "nfc_int.h" #include "rw_api.h" #include "rw_int.h" - #if (NFC_RW_ONLY == FALSE) static const uint8_t nfc_mpl_code_to_size[] = {64, 128, 192, 254}; @@ -465,6 +465,8 @@ void nfc_ncif_set_config_status(uint8_t* p, uint8_t len) { *******************************************************************************/ void nfc_ncif_event_status(tNFC_RESPONSE_EVT event, uint8_t status) { tNFC_RESPONSE evt_data; + if (event == NFC_NFCC_TIMEOUT_REVT && status == NFC_STATUS_HW_TIMEOUT) + android::metricslogger::LogCounter("nfc_hw_timeout_error", 1); if (nfc_cb.p_resp_cback) { evt_data.status = (tNFC_STATUS)status; (*nfc_cb.p_resp_cback)(event, &evt_data); @@ -487,6 +489,22 @@ void nfc_ncif_error_status(uint8_t conn_id, uint8_t status) { if (p_cb && p_cb->p_cback) { (*p_cb->p_cback)(conn_id, NFC_ERROR_CEVT, (tNFC_CONN*)&status); } + if (status == NFC_STATUS_TIMEOUT) + android::metricslogger::LogCounter("nfc_rf_timeout_error", 1); + else if (status == NFC_STATUS_EE_TIMEOUT) + android::metricslogger::LogCounter("nfc_ee_timeout_error", 1); + else if (status == NFC_STATUS_ACTIVATION_FAILED) + android::metricslogger::LogCounter("nfc_rf_activation_failed", 1); + else if (status == NFC_STATUS_EE_INTF_ACTIVE_FAIL) + android::metricslogger::LogCounter("nfc_ee_activation_failed", 1); + else if (status == NFC_STATUS_RF_TRANSMISSION_ERR) + android::metricslogger::LogCounter("nfc_rf_transmission_error", 1); + else if (status == NFC_STATUS_EE_TRANSMISSION_ERR) + android::metricslogger::LogCounter("nfc_ee_transmission_error", 1); + else if (status == NFC_STATUS_RF_PROTOCOL_ERR) + android::metricslogger::LogCounter("nfc_rf_protocol_error", 1); + else if (status == NFC_STATUS_EE_PROTOCOL_ERR) + android::metricslogger::LogCounter("nfc_ee_protocol_error", 1); } /******************************************************************************* |