Merge "[Feature][T106] Optimize partition damage recovery logic"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 8400655..0bea4fc 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -455,6 +455,9 @@
 #cz.li@20240221 add for MOBILETEK_GNSS_UPDATE_ENABLE value: "yes","no"
 MOBILETEK_GNSS_UPDATE_ENABLE = "no"
 
+#xf.li@20240716 add for MOBILETEK_LOG_ENCRYPT value: "enable","disable"
+MOBILETEK_LOG_ENCRYPT = "disable"
+
 LYNQ_CONFIG_COMMITID = "e2a3410390ff0ad762462ccb6af8faa5e16dcd61"
 LYNQ_CONFIG_VERSION = "T106_ap_version_cap_0425"
 LYNQ_CONFIG_SW_VERSION = "T106_ap_version_MR3.02b06.00"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/zxic-image.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/zxic-image.bb
index b9d6b78..f15ad14 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/zxic-image.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/zxic-image.bb
@@ -256,7 +256,17 @@
     ${@bb.utils.contains("DISTRO_FEATURES", "oemfs", "do_oemfs_oemdata;", "", d)} \
     ${@bb.utils.contains("IMAGE_FSTYPES", "squashfs", "do_rootfs_squashfs;", "", d)} \
     "
-
+#xf.li@20240716 add start
+do_oem_config() {
+	if [ "${MOBILETEK_LOG_ENCRYPT}" = "enable" ]; then
+		touch ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag
+	else
+		rm -rf ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag
+		touch ${IMAGE_ROOTFS}/etc/no_log_encrypt
+	fi
+}
+addtask  do_oem_config after do_rootfs before do_image
+#xf.li@20240716 add end
 addtask  cprootfs after do_dm_verity before do_build
 addtask  do_dm_verity after do_image_complete  before do_build
 addtask  cleanrootfs after do_clean  before do_cleansstate
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-core/busybox/busybox/busybox-1.33.1/0103-syslogd-data-encryption.patch b/cap/zx297520v3/sources/meta-zxic/recipes-core/busybox/busybox/busybox-1.33.1/0103-syslogd-data-encryption.patch
new file mode 100755
index 0000000..32a47fa
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-core/busybox/busybox/busybox-1.33.1/0103-syslogd-data-encryption.patch
@@ -0,0 +1,32 @@
+From 8e37145dcc28a46f9c1ebc85c8c2df269635677c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=E5=AE=8B=E4=BA=91=E9=9C=9E0318000489?=
+ <song.yunxia@sanechips.com.cn>
+Date: Thu, 18 Apr 2024 21:40:23 +0800
+Subject: [PATCH] syslogd data encryption
+
+---
+ sysklogd/syslogd.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+ mode change 100644 => 100755 sysklogd/syslogd.c
+
+diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
+old mode 100644
+new mode 100755
+index 76c0991..ca7cef8
+--- a/sysklogd/syslogd.c
++++ b/sysklogd/syslogd.c
+@@ -695,7 +695,12 @@ static void log_locally(time_t now, char *msg, logFile_t *log_file)
+ 	struct flock fl;
+ #endif
+ 	int len = strlen(msg);
++	int index;
+
++	if(access("/etc/syslog_encrypt_flag", F_OK) == 0){
++		for(index = 0; index < len; index++)
++			msg[index] ^= 1;
++	}					
+ 	/* fd can't be 0 (we connect fd 0 to /dev/log socket) */
+ 	/* fd is 1 if "-O -" is in use */
+ 	if (log_file->fd > 1) {
+-- 
+2.17.1
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb b/cap/zx297520v3/sources/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb
index 82866eb..a0e8bef 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb
@@ -59,6 +59,7 @@
 SRC_URI += "file://busybox-1.33.1/0101-zxic-bb_get_chunk_from_file-limit-10MB.patch"
 #SRC_URI += "file://busybox-1.33.1/0102-zxic-ash-read-etc-profile.patch"
 SRC_URI += "file://busybox-1.33.1/0103-top-short-lived-processes-optimize.patch"
+SRC_URI += "file://busybox-1.33.1/0103-syslogd-data-encryption.patch"
 
 SRC_URI_append_libc-musl = " file://busybox-1.33.1/musl.cfg "
 
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
index 404acb7..05550f1 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -91,6 +91,7 @@
 

 static int s_module_call_state =CALL_OFF;

 static int s_call_auto_answer = 0;

+static char g_hungup_addr[LYNQ_PHONE_NUMBER_MAX] = {0};

 

 typedef enum{

     LYNQ_E_VOLUMN_SET_DTMF,

@@ -308,6 +309,7 @@
     s_call_lists[lynq_call_id].toa = 0;

     s_call_lists[lynq_call_id].direction = 0;

     s_call_lists[lynq_call_id].used = 0;

+    memcpy(g_hungup_addr,s_call_lists[lynq_call_id].addr,strlen(s_call_lists[lynq_call_id].addr)+1);

     memset(s_call_lists[lynq_call_id].addr,0,sizeof(s_call_lists[lynq_call_id].addr));

 }

 

@@ -468,6 +470,9 @@
                 if(call_end == 0)

                 {

                     LYINFLOG("MT/MO hungup,then clean call info local idx is %d id is %d",i, s_call_lists[i].call_id);

+

+                    s_CallId = s_call_lists[i].call_id;

+                    

                     //update_end_state(i);//lei modify for:update end state for this call

                     cleanCallList(i);

                     send_call_state_change();//means mt/mo call is end

@@ -538,6 +543,7 @@
                     LYINFLOG("state changed from %d to %d",s_call_lists[n].call_state,call_list[i].call_state);

                     

                     updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);//update mt call

+                    s_CallId = call_list[i].call_id;

                     send_call_state_change();

                 }                            

             }

@@ -1032,8 +1038,11 @@
     if(lynq_call_id!=INVALID_ID)

     {

         cleanCallList(lynq_call_id);

-    }        

-

+    } 

+    

+    

+    s_CallId = call_id;

+    

     //fix bug T106BUG-56

     send_call_state_change();

     return RESULT_OK;     

@@ -1114,6 +1123,7 @@
         if((*handle) >= 0)

         {

             *call_state = (int)LYNQ_CALL_END;

+            memcpy(addr,g_hungup_addr,strlen(g_hungup_addr)+1);

             return RESULT_OK; 

         }

         else