Merge "[Feature][ZXW-204][ZXW-205] add query fota upgrade process api and backup Status"
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyLteaAmtUser_nvrwo_0x0003C800.bin b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyLteaAmtUser_nvrwo_0x0003C800.bin
index ae19b25..197aad6 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyLteaAmtUser_nvrwo_0x0003C800.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyLteaAmtUser_nvrwo_0x0003C800.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyWcdmaAmtUser_nvrwo_0x0003A000.bin b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyWcdmaAmtUser_nvrwo_0x0003A000.bin
index 854310c..8ef3392 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyWcdmaAmtUser_nvrwo_0x0003A000.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/phyWcdmaAmtUser_nvrwo_0x0003A000.bin
Binary files differ
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig
index a8470b2..8206074 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig
@@ -1395,6 +1395,9 @@
 # CONFIG_NET_VENDOR_XILINX is not set
 CONFIG_NET_VENDOR_ZTE=y
 CONFIG_ZX29_GMAC=y
+# zw.wang modify for T106BUG-423 20240118 start
+CONFIG_BOOT_WITHOUT_LOCK=y
+# zw.wang modify for T106BUG-423 20240118  end
 CONFIG_PHYLIB=y
 CONFIG_SWPHY=y
 CONFIG_FIXED_PHY=y
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
index b497527..105d347 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
@@ -1594,7 +1594,7 @@
         return -1;
     }
 
-    if(user == NULL || strcmp(user, "NULL") == 0)
+    if(user == NULL || strcmp(user, "NULL") == 0 || strlen(user) == 0)
     {
         argv[1] = NULL;
     }
@@ -1603,7 +1603,7 @@
         argv[1] = user;
     }
 
-    if(password == NULL || strcmp(password, "NULL") == 0)
+    if(password == NULL || strcmp(password, "NULL") == 0 || strlen(password) == 0)
     {
         argv[2] = NULL;
     }
@@ -1612,7 +1612,7 @@
         argv[2] = password;
     }
 
-    if(authType == NULL || strcmp(authType, "NULL") == 0)
+    if(authType == NULL || strcmp(authType, "NULL") == 0 || strlen(authType) == 0)
     {
         argv[3] = NULL;
     }
@@ -1620,7 +1620,7 @@
     {
         argv[3] = authType;
     }
-    if(normalProtocol==NULL)
+    if(normalProtocol==NULL|| strlen(normalProtocol) == 0)
     {
         argv[4] = "IPV4V6";
     }
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
index 6a1b35b..e1fdb18 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -1605,26 +1605,19 @@
         return LYNQ_E_CONFLICT;

     }

     LYDBGLOG("start get urc info");

-    if(handle != RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED &&handle != RIL_UNSOL_SIGNAL_STRENGTH)

+    if(is_support_urc(handle)==false)

     {

         LYINFLOG("invalid handle!!!");

         return LYNQ_E_PARAMETER_ANONALY;

     }

     if((handle ==RIL_UNSOL_SIGNAL_STRENGTH && NULL == solSigStren) || 

-        (handle ==RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED && NULL == slot_id))

+        (handle !=RIL_UNSOL_SIGNAL_STRENGTH && NULL == slot_id))

     {

         LYINFLOG("incoming solSigStren or slot_id is NULL!!!");

         return LYNQ_E_PARAMETER_ANONALY;

     }

     switch(handle)

-    {

-        case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: //1002

-        {

-            LYDBGLOG("get state update to VOICE");

-            *slot_id = s_module_urc_slot_id;

-            LYINFLOG("slot_id = %d",s_module_urc_slot_id);

-            break;

-        }

+    {        

         case RIL_UNSOL_SIGNAL_STRENGTH: //1009

         {

             LYDBGLOG("get state update to signal info");

@@ -1648,6 +1641,11 @@
             solSigStren->csiSinr = s_network_urc_solSigStren.csiSinr;

             break;

         }

+        default:

+        {

+            *slot_id = s_module_urc_slot_id;

+            LYINFLOG("slot_id = %d",s_module_urc_slot_id);

+        }        

     }

     return RESULT_OK;   

 }

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index fb7494a..a4e452e 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -850,6 +850,8 @@
     }
     //check apn_type
     check_node = modify_node;
+    bzero(temp_buff,12);
+    snprintf(temp_buff,sizeof(temp_buff),"%d",(unsigned int)apn->profile_idx);
     while (check_node != NULL)
     {
         if (xmlGetProp(check_node, "profile_idx") == NULL)  //Null Node
@@ -859,6 +861,11 @@
         }
         else if(strcmp((char *)xmlGetProp(check_node, "apn_type"), apn->apn_type) == 0)
         {
+            if(strcmp((char *)xmlGetProp(check_node, "profile_idx"), temp_buff) == 0)
+            {
+                check_node = check_node->next;
+                continue;
+            }
             LYERRLOG("apntype already exists\n");
             goto FAILED;
         }
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
index d508438..90a5521 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
@@ -474,6 +474,7 @@
 {
     int ret = 0;
     int i = 0;
+    int location = 17;
     static struct mopen_location_info_t mopen_location_info;
     static int64_t tmp_time = 0;
     mopen_gnss_nmea_info_t nmea_info;
@@ -513,7 +514,9 @@
     //set system time.
     if (g_gnss_sync_enable_flag == 1 && g_gnss_sync_done == 0)
     {
-        if( strncmp(data+3,NMEA_RMC,strlen(NMEA_RMC)) == 0 && data[17] == 'A')
+        
+        location = (gpio21_value == 0?17:18);
+        if(strncmp(data+3,NMEA_RMC,strlen(NMEA_RMC)) == 0 && data[location] == 'A')
         {
             if (update_system_time(nmea_info.timestamp) == 0)
             {
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/ril.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/ril.h
index 8aaf524..75ad0a0 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/ril.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/ril.h
@@ -145,6 +145,17 @@
     RIL_E_POWER_ON_UIM_NOT_READY = 7000,
     // Power on end
     //MTK end
+    RIL_E_SIM_PIN = 9200,
+
+    RIL_E_SIM_PUK,
+
+    RIL_E_SIM_LOCKED,
+
+    RIL_E_SIM_INIT_FAILED,
+
+    RIL_E_SIM_GLOBAL_PIN,
+
+    RIL_E_SIM_GLOBAL_PUK,
 } RIL_Errno;
 
 typedef enum {
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril.h
index 8aaf524..75ad0a0 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril.h
@@ -145,6 +145,17 @@
     RIL_E_POWER_ON_UIM_NOT_READY = 7000,
     // Power on end
     //MTK end
+    RIL_E_SIM_PIN = 9200,
+
+    RIL_E_SIM_PUK,
+
+    RIL_E_SIM_LOCKED,
+
+    RIL_E_SIM_INIT_FAILED,
+
+    RIL_E_SIM_GLOBAL_PIN,
+
+    RIL_E_SIM_GLOBAL_PUK,
 } RIL_Errno;
 
 typedef enum {
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
index 8400938..04ce391 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
@@ -62,9 +62,6 @@
 static int sCSQ[2] = { 99, 99 };

 static int sys_mode = 0;/*LTE*/

 

-static int airPlaneMode = 0;

-

-

 static uint64_t ref_ril_nano_time(void)

 {

 	struct timespec now;

@@ -257,6 +254,10 @@
 	setRadioState(RADIO_STATE_OFF);

 }

 

+void resetRadioStateOff(void)

+{

+    setRadioStateOff();

+}

 

 static void reportRadioTech(RIL_Token t)

 {

@@ -1016,7 +1017,6 @@
 	if ((err < 0 || response->success == 0) && (isRadioOn() != 1)) {

 		goto error;

 	}

-	airPlaneMode = 0;

 	updateRadioState();

 	ril_request_open_zsqr_notify();

 

@@ -1856,33 +1856,27 @@
 	RIL_RadioState  currentState = getRadioState();

 

 	RLOGD("ril_request_radio_power(): onOff=%d, currentState=%d", onOff, currentState);

-	if ((onOff == 4) && (currentState != RADIO_STATE_OFF)) {

+	if ( onOff == 4 ) {

 		RLOGD("onOff=%d, currentState=%d   --> AT+CFUN=4", onOff, currentState);

 		err = at_send_command_timeout("AT+CFUN=4", &response, TIMEOUT_CFUN);

 		DO_MM_RESPONSE_ERROR_JDUGE;

 		setRadioStateOff();

-		airPlaneMode = 1;

-	} else if ((onOff == 0) && (currentState != RADIO_STATE_OFF)) {

+	} else if ( onOff == 0 ) {

 		RLOGD("onOff=%d, currentState=%d   --> AT+CFUN=4", onOff, currentState);

 		err = at_send_command_timeout("AT+CFUN=4", &response, TIMEOUT_CFUN);

 		DO_MM_RESPONSE_ERROR_JDUGE;

 		//err = at_send_command("AT^ZPOWEROFF", NULL); //poweroff

-		airPlaneMode = 1;

 		setRadioStateOff();

-	} else if (((onOff == 1) && (currentState == RADIO_STATE_OFF)) || (currentState == RADIO_STATE_UNAVAILABLE) || (currentState == RADIO_STATE_SIM_READY)) {

+	} else if (onOff == 1) {

 		RLOGD("onOff=%d, currentState=%d   --> AT+CFUN=1", onOff, currentState);

 		err = at_send_command_timeout("AT+CFUN=1", &response, TIMEOUT_CFUN);

 		if ((err < 0 || response->success == 0) && (isRadioOn() != 1)) {

 			goto error;

 		}

-		airPlaneMode = 0;

 		updateRadioState();

 		ril_request_open_zsqr_notify();

-	} else if ((onOff == 4) && (airPlaneMode == 1)) {

-		RLOGD("onOff=%d, airPlaneMode=%d   --> AT^ZPOWEROFF", onOff, airPlaneMode);

-		at_send_command("AT^ZPOWEROFF", NULL);

-		setRadioStateOff();

-	}

+	} 

+

 	RIL_onRequestComplete(token, RIL_E_SUCCESS, NULL, 0);

 	goto exit;

 error:

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c
index 64eecd2..43b4347 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.c
@@ -248,7 +248,17 @@
 
 RIL_RadioState getRadioState(void)
 {
-	return sState;
+    int radioState = -1;
+    
+    radioState = isRadioOn();
+    
+    if(1 == radioState) {    
+        updateRadioState();    
+    } 
+    else if((0 == radioState) || (4 == radioState)) {
+        resetRadioStateOff();    
+    }
+    return sState;
 }
 
 /** returns 1 if on, 0 if off, and -1 on error */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
index 0b985a2..8b12387 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
@@ -177,6 +177,7 @@
 void requestSendUSSD(void *data, size_t datalen, RIL_Token t);

 void requestCancelUSSD(void *data, size_t datalen, RIL_Token t);

 void requestDeviceIdentity(void *data, size_t datalen, RIL_Token t);

+void resetRadioStateOff(void);

 

 /*ril_sim.c*/

 void ril_handle_sim_pin_puk(int request, void *data, size_t datalen, RIL_Token token);

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_sim.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_sim.c
index 3c67eff..bcc55ea 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_sim.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_sim.c
@@ -1140,9 +1140,16 @@
 			goto exit;
 
 		case 11: //need pin
+			RIL_onRequestComplete(token, RIL_E_SIM_PIN, NULL, 0);
+			goto error;
 		case 12: //need puk
+			RIL_onRequestComplete(token, RIL_E_SIM_PIN, NULL, 0);
+			goto error;
 		case 13: //sim locked
+			RIL_onRequestComplete(token, RIL_E_SIM_LOCKED, NULL, 0);
+			goto error;
 		case 15: //init fail
+			RIL_onRequestComplete(token, RIL_E_SIM_INIT_FAILED, NULL, 0);
 			goto error;
 
 		case 30: //init sucess
@@ -1151,7 +1158,11 @@
 			goto exit;
 
 		case 260: //need global pin
+			RIL_onRequestComplete(token, RIL_E_SIM_GLOBAL_PIN, NULL, 0);
+			goto error;
 		case 261: //need global puk
+			RIL_onRequestComplete(token, RIL_E_SIM_GLOBAL_PUK, NULL, 0);
+			goto error;
 		default:
 			goto error;
 		}
@@ -1159,8 +1170,8 @@
 	}
 
 error:
-	RLOGD("ril_request_radio_reset: failed!");
-	RIL_onRequestComplete(token, RIL_E_GENERIC_FAILURE, NULL, 0);
+	RLOGD("ril_request_simcard_reset: failed!");
+	//RIL_onRequestComplete(token, RIL_E_GENERIC_FAILURE, NULL, 0);
 	updateRadioState();//if at error, we must update radio state
 exit:
 	at_response_free(response);
diff --git a/mk_T106.sh b/mk_T106.sh
index 6a218cc..2a53128 100644
--- a/mk_T106.sh
+++ b/mk_T106.sh
@@ -1,7 +1,11 @@
 #!/bin/bash
 TOP=$(pwd)
 source update_version.sh
-
+mkdir esdk_patch/Uboot
+cp -R boot/ build/ cp/ pub/ rpm/ tools/ esdk_patch/Uboot/
+cd esdk_patch
+tar -czvf Uboot.tar.gz Uboot
+cd ${TOP}
 cd ap/project/zx297520v3/prj_vehicle_dc_ref/build/
 make allclean all
 cd ../../../../..
@@ -29,6 +33,7 @@
 tar -czvf upstream.tar.gz upstream
 mkdir do_package_tool
 cd ${TOP}
+cp esdk_patch/Uboot.tar.gz allbins cap/zx297520v3/build-vehicle_dc_ref/tmp/deploy/sdk/
 cp -R allbins cap/zx297520v3/build-vehicle_dc_ref/tmp/deploy/sdk/do_package_tool/
 cd cap/zx297520v3/build-vehicle_dc_ref/tmp/deploy/sdk/
 tar -czvf do_package_tool.tar.gz do_package_tool
diff --git a/update_version.sh b/update_version.sh
index c823225..deefb24 100755
--- a/update_version.sh
+++ b/update_version.sh
@@ -1,8 +1,8 @@
 #!/bin/bash
 #export LYNQ_VERSION="T106_lynq_version_ap_build_sh"
-LYNQ_AP_VERSION="T106CN-ZS03.V2.01.01.02P54U02.AP.10.02"
-LYNQ_CAP_INSIDE_VERSION="CAP.10.02"
-LYNQ_CAP_VERSION="CAP.10.02"
+LYNQ_AP_VERSION="T106CN-ZS03.V2.01.01.02P54U02.AP.10.03"
+LYNQ_CAP_INSIDE_VERSION="CAP.10.03"
+LYNQ_CAP_VERSION="CAP.10.03"
 COMMIT_ID="$(git rev-parse HEAD)"
 
 LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""