bugfix: reset runtime settings only when it's valid country code

If same country code is applied, runtime setting will be cleared.

Bug: 377995117
Test: repeat { set-country-code + start-ccc-ranging-session }
Change-Id: I1d0c2199a5ea46750846db17280f4e0a3d7820f3
Merged-In: I1d0c2199a5ea46750846db17280f4e0a3d7820f3
diff --git a/halimpl/hal/phNxpUciHal_ext.cc b/halimpl/hal/phNxpUciHal_ext.cc
index 8d4477a..4d534e2 100644
--- a/halimpl/hal/phNxpUciHal_ext.cc
+++ b/halimpl/hal/phNxpUciHal_ext.cc
@@ -755,13 +755,16 @@
   NXPLOG_UCIHAL_D("Apply country code %c%c", country_code[0], country_code[1]);
 
   phNxpUciHal_Runtime_Settings_t *rt_set = &nxpucihal_ctrl.rt_settings;
-  phNxpUciHal_resetRuntimeSettings();
 
   if (!is_valid_country_code(country_code)) {
     NXPLOG_UCIHAL_D("Country code %c%c is invalid, UWB should be disabled", country_code[0], country_code[1]);
+    phNxpUciHal_resetRuntimeSettings();
+    rt_set->uwb_enable = false;
   }
 
   if (NxpConfig_SetCountryCode(country_code)) {
+    phNxpUciHal_resetRuntimeSettings();
+
     // Load ExtraCal restrictions
     uint16_t mask= 0;
     if (NxpConfig_GetNum("cal.restricted_channels", &mask, sizeof(mask))) {