Merge Android 12

Bug: 202323961
Merged-In: I3a661bed1ae2ee68896f860d7f694ac67bbb9475
Change-Id: Id2907044b79db51f8f76a33b3f2ffaa293cd37fa
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 6e07540..a75cb21 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__);