Add a timer to prevent NFCC got stuck in ActiveRW am: a65f41ad9c am: 6c679f4e35

Original change: https://android-review.googlesource.com/c/platform/hardware/st/nfc/+/1782510

Change-Id: Ie8bd1cf6c1f9d31711ca765e2c7c1347ad879c88
diff --git a/1.1/Nfc.cpp b/1.1/Nfc.cpp
index f3e6741..97820d9 100644
--- a/1.1/Nfc.cpp
+++ b/1.1/Nfc.cpp
@@ -73,8 +73,12 @@
 
 Return<V1_0::NfcStatus> Nfc::coreInitialized(const hidl_vec<uint8_t>& data) {
   hidl_vec<uint8_t> copy = data;
+  int ret;
 
-  int ret = StNfc_hal_core_initialized(&copy[0]);
+  if (copy.size() == 0)
+    ret = 1;
+  else
+    ret = StNfc_hal_core_initialized(&copy[0]);
   return ret == 0 ? V1_0::NfcStatus::OK : V1_0::NfcStatus::FAILED;
 }
 
diff --git a/1.2/Nfc.cpp b/1.2/Nfc.cpp
index c197255..3273294 100644
--- a/1.2/Nfc.cpp
+++ b/1.2/Nfc.cpp
@@ -75,8 +75,12 @@
 
 Return<V1_0::NfcStatus> Nfc::coreInitialized(const hidl_vec<uint8_t>& data) {
   hidl_vec<uint8_t> copy = data;
+  int ret;
 
-  int ret = StNfc_hal_core_initialized(&copy[0]);
+  if (copy.size() == 0)
+    ret = 1;
+  else
+    ret = StNfc_hal_core_initialized(&copy[0]);
   return ret == 0 ? V1_0::NfcStatus::OK : V1_0::NfcStatus::FAILED;
 }
 
diff --git a/st21nfc/hal_wrapper.cc b/st21nfc/hal_wrapper.cc
index faf1800..54e8159 100644
--- a/st21nfc/hal_wrapper.cc
+++ b/st21nfc/hal_wrapper.cc
@@ -389,8 +389,9 @@
                 property_get_int32("persist.vendor.nfc.firmware_debug_enabled", 0);
 
             // Check if FW DBG shall be set
-            if (GetNumValue(NAME_STNFC_FW_DEBUG_ENABLED, &num, sizeof(num))) {
-              if (firmware_debug_enabled && isDebuggable) num = 1;
+            if (GetNumValue(NAME_STNFC_FW_DEBUG_ENABLED, &num, sizeof(num)) ||
+                isDebuggable) {
+              if (firmware_debug_enabled) num = 1;
               // If conf file indicate set needed and not yet enabled
               if ((num == 1) && (p_data[7] == 0x00)) {
                 STLOG_HAL_D("%s - FW DBG traces enabling needed", __func__);