Merge "[Bugfix][API-1094] due to dislocation,get_data_call_list fail" into MR3.0-merge
diff --git a/src/lynq/framework/lynq-ril-service/src/data/data.cpp b/src/lynq/framework/lynq-ril-service/src/data/data.cpp
index d983d4e..b66072b 100755
--- a/src/lynq/framework/lynq-ril-service/src/data/data.cpp
+++ b/src/lynq/framework/lynq-ril-service/src/data/data.cpp
@@ -1060,6 +1060,7 @@
 int deactivateDataCall(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
 {
     bool hasDeactivate = TRUE;
+    int err_code = 0;
     Parcel p;
     /*jb.qi change for swtich card after dial on 20221025 start*/
     if((pRI == NULL) && (argc == 0))
@@ -1106,30 +1107,21 @@
             }
             if(hasDeactivate)
             {
-                 p.writeInt32 (0);
-                 p.writeInt32 (pRI->pCI->requestNumber);
-                 p.writeInt32(socket_id);
-                 p.writeInt32 (2);//RIL_E_GENERIC_FAILURE
-                 android::LYNQ_RIL_respSocket(p, (void *)pRI);
-                 return -1;
+                 err_code = 8087;//not have apn this has been activate int this time.
+                 RLOGD("not have apn this has been activate int this time");
             }
         }
         else
         {
-            p.writeInt32 (0);
-            p.writeInt32 (pRI->pCI->requestNumber);
-            p.writeInt32(socket_id);
-            p.writeInt32 (2);//RIL_E_GENERIC_FAILURE
-            re = deactivateDataCallarc(argc,argv,socket_id,pRI);//warren add for setup data call timeout on 20230602
-            android::LYNQ_RIL_respSocket(p, (void *)pRI);
-            return -1;
+            err_code = 8088;//not have any apns this has been activate int this time.
+            RLOGD("not have any apns this has been activate int this time");
         }
         re = deactivateDataCallarc(argc,argv,socket_id,pRI);
         p.writeInt32 (0);
         p.writeInt32(pRI->uToken);
         p.writeInt32 (pRI->pCI->requestNumber);
         p.writeInt32(socket_id);
-        p.writeInt32 (0);//RIL_E_GENERIC_FAILURE
+        p.writeInt32 (err_code);
         android::LYNQ_RIL_respSocket(p, (void *)pRI);
         if (pRI != NULL)
         {
@@ -1153,22 +1145,14 @@
         }
         if(hasDeactivate)
         {
-             p.writeInt32 (0);
-             p.writeInt32 (pRI->pCI->requestNumber);
-             p.writeInt32(socket_id);
-             p.writeInt32 (2);//RIL_E_GENERIC_FAILURE
-             android::LYNQ_RIL_respSocket(p, (void *)pRI);
-             return -1;
+             err_code = 8087;//not have apn this has been activate int this time.
+             RLOGD("not have apn this has been activate int this time");
         }
     }
     else
     {
-        p.writeInt32 (0);
-        p.writeInt32 (pRI->pCI->requestNumber);
-        p.writeInt32(socket_id);
-        p.writeInt32 (2);//RIL_E_GENERIC_FAILURE
-        android::LYNQ_RIL_respSocket(p, (void *)pRI);
-        return -1;
+        err_code = 8088;//not have any apns this has been activate int this time.
+        RLOGD("not have any apns this has been activate int this time");
     }
     char cmd[256];
     getCellularService();
@@ -1182,7 +1166,7 @@
     p.writeInt32(pRI->uToken);
     p.writeInt32 (pRI->pCI->requestNumber);
     p.writeInt32(socket_id);
-    p.writeInt32 (0);//RIL_E_GENERIC_FAILURE
+    p.writeInt32 (err_code);//RIL_E_GENERIC_FAILURE
     android::LYNQ_RIL_respSocket(p, (void *)pRI);
     /* no response from telecore, free pRI prevent memory leak */
     if (pRI != NULL) {
diff --git a/src/lynq/framework/lynq-ril-service/src/data/data_gdbus.cpp b/src/lynq/framework/lynq-ril-service/src/data/data_gdbus.cpp
index 9d3e4d2..370e2ac 100755
--- a/src/lynq/framework/lynq-ril-service/src/data/data_gdbus.cpp
+++ b/src/lynq/framework/lynq-ril-service/src/data/data_gdbus.cpp
@@ -307,6 +307,31 @@
             {
                 RLOGD("for apn_table[%d].apn:%s,apntype:%s,used:%d,apnstatus:%d\n",i,apn_table[i].apn,
                 apn_table[i].apntype,apn_table[i].used,apn_table[i].apnstatus);
+                if((strcmp(apn_table[i].apntype,urc_response->apnType)==0))
+                {
+                    apn_table[i].pdpstate = urc_response->pdnState;
+                    char ptr[1] = "";
+                    if(NULL == urc_response->ifname)
+                    {
+                        memcpy(apn_table[i].ifaceName, ptr,strlen(ptr)+1);
+                    }
+                    if(NULL == urc_response->addresses)
+                    {
+                        memcpy(apn_table[i].address, ptr, strlen(ptr)+1);
+                    }
+                    memcpy(iface_t,apn_table[i].ifaceName,strlen(apn_table[i].ifaceName)+1);
+                    memcpy(apnType_t,apn_table[i].apntype,strlen(apn_table[i].apntype)+1);
+                    memcpy(apn_t,apn_table[i].apn,strlen(apn_table[i].apn)+1);
+                    p.writeInt32(1);
+                    p.writeInt32(LYNQ_URC_DATA_CALL_STATUS_IND);
+                    p.writeInt32(0);//temporary plan
+                    p.writeInt32(urc_response->pdnState);
+                    writeStringToParcel(p,apn_t);
+                    writeStringToParcel(p,apnType_t);
+                    writeStringToParcel(p,iface_t);
+                    android::LYNQ_RIL_urcBroadcast(p,LYNQ_URC_DATA_CALL_STATUS_IND);
+                    RLOGD("cid is %d apn:%s,apntype:%s",urc_response->cId,apn_table[i].apn,apn_table[i].apntype);
+                }
             }
             return 0;
         }
diff --git a/src/telephonyware/3.0/hardware/ril/fusion/libril/ril.cpp b/src/telephonyware/3.0/hardware/ril/fusion/libril/ril.cpp
old mode 100644
new mode 100755
index 17802d4..afb93ef
--- a/src/telephonyware/3.0/hardware/ril/fusion/libril/ril.cpp
+++ b/src/telephonyware/3.0/hardware/ril/fusion/libril/ril.cpp
@@ -6474,12 +6474,12 @@
 
             RLOGD("RIL_client_register create socket clientSocketName %s", clientSocketName);
 
+            s_fdCommand_client[i] = -1;
             if (createClientSocket(clientSocketName, i) < 0) {
                 RLOGE("create client failed");
                 return;
             }
 
-            s_fdCommand_client[i] = -1;
         }
     }
 }
diff --git a/src/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/sys/RtcCapabilitySwitchChecker.cpp b/src/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/sys/RtcCapabilitySwitchChecker.cpp
index aebf3d3..c777f10 100644
--- a/src/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/sys/RtcCapabilitySwitchChecker.cpp
+++ b/src/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/sys/RtcCapabilitySwitchChecker.cpp
@@ -215,7 +215,9 @@
 #endif

 

 bool RtcCapabilitySwitchChecker::imsiReady(bool log) {

-    for (int i = RFX_SLOT_ID_0; i < getSimCount(); i++) {

+        int card_type = 0;

+

+	for (int i = RFX_SLOT_ID_0; i < getSimCount(); i++) {

 /*TODO

         int sim_state = m_status_managers[i]->getIntValue(RFX_STATUS_KEY_SIM_STATE);

         int sim_onoff_state = getSimOnOffState(i, log);

@@ -228,6 +230,12 @@
             continue;

         }

 */

+        card_type = m_status_managers[i]->getIntValue(RFX_STATUS_KEY_CARD_TYPE, 0);

+        if (card_type <= 0) {

+            RFX_LOG_I(RFX_LOG_TAG, "imsiReady, skip when sim%d_state=%d", i + 1, card_type);

+            continue;

+        }

+

         const String8& imsi = getImsi(i);

         if (imsi.isEmpty()) {

             RFX_LOG_I(RFX_LOG_TAG, "imsiReady, sim%d imsi not ready", i + 1);