Merge "[Bugfix][T106BUG-660]Fixed the problem that no callback when deactive APN in special markets"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
index 90a1d43..d43a308 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -14,9 +14,7 @@
 at_snap_flag=3
 at_wifi_mac=0
 auto_apn_index=0
-#xf.li@20240111 modify for T106BUG-480 start
-cid_reserved=0
-#xf.li@20240111 modify for T106BUG-480 end
+cid_reserved=1
 clear_pb_when_restore=no
 clear_sms_when_restore=no
 default_apn=3gnet
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.cpp
index a9d44b2..4e79af6 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.cpp
@@ -822,7 +822,7 @@
             memcpy(lynq_apn_cid_table[i].apntype, apntype, strlen(apntype) + 1);
             lynq_apn_cid_table[i].dialing = 1;
             lynq_apn_cid_table[i].uToken = pRI->uToken;
-            RLOGD("DATA: apn_table[%d].apn = %s, apntype = %s, dialing = %d, utoken = %d\n", i, lynq_apn_cid_table[i].apn, lynq_apn_cid_table[i].apntype, lynq_apn_cid_table[i].dialing, lynq_apn_cid_table[i].uToken = pRI->uToken);
+            RLOGD("DATA: apn_table[%d].apn = %s, apntype = %s, dialing = %d, utoken = %d\n", i, lynq_apn_cid_table[i].apn, lynq_apn_cid_table[i].apntype, lynq_apn_cid_table[i].dialing, lynq_apn_cid_table[i].uToken);
             break;
         }
     }
@@ -1181,6 +1181,7 @@
 #ifdef MOBILETEK_TARGET_PLATFORM_T106
     char reason[8];
     const char *cid = argv[1];
+    int deactive_cid = -1;
 
     if(argc != 2)
     {
@@ -1188,8 +1189,16 @@
         RLOGD("the paremeters numbers isn't right , so return");
         return -1;
     }
-    RLOGD("cid = %S",cid);
-    RLOGD("deactivateDataCall %d: " , pRI->pCI->requestNumber);
+    deactive_cid = atoi(cid);
+    RLOGD("deactive_cid = %d, utoken = %d", deactive_cid, pRI->uToken);
+    for(int i = 0; i < LYNQ_APN_CHANNEL_MAX; i++)
+    {
+        if(lynq_apn_cid_table[i].cid == deactive_cid)
+        {
+            lynq_apn_cid_table[i].deactive_utoken = pRI->uToken;
+            break;
+        }
+    }
     sprintf(reason,"%d",DEACTIVATE_REASON_NONE);
     android::Parcel p;
     size_t pos = p.dataPosition();
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.cpp
index ad0cfad..04e8d5a 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.cpp
@@ -34,14 +34,14 @@
 //xf.il@20230610 modify for T106 data start
 #ifdef MOBILETEK_TARGET_PLATFORM_T106
 extern lynq_apn_cid_table_t lynq_apn_cid_table[LYNQ_APN_CHANNEL_MAX] = {
-    {-1, "", "", "", -1, -1, -1, -1, ""}, \
-    {-1, "", "", "", -1, -1, -1, -1, ""}, \
-    {-1, "", "", "", -1, -1, -1, -1, ""}, \
-    {-1, "", "", "", -1, -1, -1, -1, ""}, \
-    {-1, "", "", "", -1, -1, -1, -1, ""}, \
-    {-1, "", "", "", -1, -1, -1, -1, ""}, \
-    {-1, "", "", "", -1, -1, -1, -1, ""}, \
-    {-1, "", "", "", -1, -1, -1, -1, ""},
+    {-1, "", "", "", -1, -1, -1, -1, -1, ""}, \
+    {-1, "", "", "", -1, -1, -1, -1, -1, ""}, \
+    {-1, "", "", "", -1, -1, -1, -1, -1, ""}, \
+    {-1, "", "", "", -1, -1, -1, -1, -1, ""}, \
+    {-1, "", "", "", -1, -1, -1, -1, -1, ""}, \
+    {-1, "", "", "", -1, -1, -1, -1, -1, ""}, \
+    {-1, "", "", "", -1, -1, -1, -1, -1, ""}, \
+    {-1, "", "", "", -1, -1, -1, -1, -1, ""},
 };
 #endif
 //xf.il@20230610 modify for T106 data end
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.h
index c8d56cf..ceb46f9 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.h
@@ -110,6 +110,7 @@
     int dialing;
     int status;
     int uToken;
+    int deactive_utoken;
     //int apnstatus;//1:has enable;0:need disable.
     //int pdpstate;//lei add for at+elapnact?  refer to T800 AT COMMANDS:+lapnact
     char address[LYNQ_ADDRESS_LEN_MAX];
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
index 26f34a7..bc7d265 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
@@ -4178,6 +4178,47 @@
 
         p.writeInt32 (e);
         #ifdef MOBILETEK_TARGET_PLATFORM_T106
+        if(pRI->pCI->requestNumber == RIL_REQUEST_DEACTIVATE_DATA_CALL)
+        {
+            if(e == 0)
+            {
+                RLOGD("[DATA]: deactive datacall success\n");
+                for(int j = 0; j < LYNQ_APN_CHANNEL_MAX; j++)
+                {
+                    RLOGD("lynq_apn_cid_table[j].uToken =%d, pRI->uToken = %d", lynq_apn_cid_table[j].deactive_utoken, pRI->uToken);
+                    if(lynq_apn_cid_table[j].used == 1 && lynq_apn_cid_table[j].deactive_utoken == pRI->uToken)
+                    {
+                        RLOGD("[DATA]delete cid is %d", lynq_apn_cid_table[j].cid);
+                        //delete
+                        bzero(lynq_apn_cid_table[j].apn,LYNQ_APN_LEN_MAX);
+                        bzero(lynq_apn_cid_table[j].apntype,LYNQ_APNTPYE_LEN_MAX);
+                        bzero(lynq_apn_cid_table[j].ifaceName,LYNQ_IFNAME_LEN_MAX);
+                        bzero(lynq_apn_cid_table[j].address,LYNQ_ADDRESS_LEN_MAX);
+                        lynq_apn_cid_table[j].cid = -1;
+                        lynq_apn_cid_table[j].used = -1;
+                        lynq_apn_cid_table[j].status = -1;
+                        lynq_apn_cid_table[j].dialing = -1;
+                        lynq_apn_cid_table[j].uToken = -1;
+                        lynq_apn_cid_table[j].deactive_utoken = -1;
+                        break;
+                    }
+                }
+            }
+            else
+            {
+                RLOGD("[DATA]: deactive datacall fail\n");
+                for(int j = 0; j < LYNQ_APN_CHANNEL_MAX; j++)
+                {
+                    RLOGD("lynq_apn_cid_table[j].uToken =%d, pRI->uToken = %d", lynq_apn_cid_table[j].deactive_utoken, pRI->uToken);
+                    if(lynq_apn_cid_table[j].used == 1 && lynq_apn_cid_table[j].deactive_utoken == pRI->uToken)
+                    {
+                        lynq_apn_cid_table[j].deactive_utoken = -1;
+                        break;
+                    }
+                }
+            }
+
+        }
         //xf.li@20231102 add for t106 data start
         if(pRI->pCI->requestNumber == RIL_REQUEST_SETUP_DATA_CALL)
         {
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 1cfea66..f64f900 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
@@ -1444,8 +1444,13 @@
     JumpHeader(p,&resp_type,&client.uToken,&request,&slot_id,&error);
     LYINFLOG("resp_type=%d,uToken=%d,request=%d,slot_id=%d,error_code=%d",resp_type,client.uToken,request,slot_id,error);
     free_parcel(p);
-#ifndef MOBILETEK_TARGET_PLATFORM_T106
     cleanOnceApnTable(lynq_data_call_id);
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+    set_list_buffer_valid(false);
+    pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+    s_data_urc_wait_list.push_back(lynq_data_call_id);
+    pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+    sendSignalPdnChange();
 #endif
     printf_apn_table_debug(__FUNCTION__,__LINE__);
     return error;