[Bugfix][API-1626][network]  P10 modem 4G only access cell fail

           Affected branch: unknown
           Affected module: unknown
           Is it affected on both ZXIC and MTK: mtk
           Self-test: Yes
           Doc Update: No

Change-Id: I669d59f541cc5e2d72678f6a760695d51270cf1f
diff --git a/IC_src/mtk/telephonyware/3.0/hardware/ril/platformlib/libmipc/lib/src/api/mipc_apn_api.c b/IC_src/mtk/telephonyware/3.0/hardware/ril/platformlib/libmipc/lib/src/api/mipc_apn_api.c
index 1707c4d..f596c20 100644
--- a/IC_src/mtk/telephonyware/3.0/hardware/ril/platformlib/libmipc/lib/src/api/mipc_apn_api.c
+++ b/IC_src/mtk/telephonyware/3.0/hardware/ril/platformlib/libmipc/lib/src/api/mipc_apn_api.c
@@ -40,7 +40,9 @@
         result_ptr->result_code = (mipc_result_enum)(*((uint32_t*)val_ptr));
         //acording to MBIM spec, non-succ result should have no information buffer(9.4.5)
         if (MIPC_RESULT_SUCCESS != result_ptr->result_code) {
-            result = MIPC_API_RESULT_SUCCESS;
+            /*modify by hq at 20240627 for API-1626 P10 modem 4G only access cell fail begin*/
+            result = MIPC_API_RESULT_FAIL;
+            /*modify by hq at 20240627 for API-1626 P10 modem 4G only access cell fail end*/
             break;
         }
         val_ptr = mipc_msg_get_val_ptr(msg_cnf_ptr, MIPC_APN_SET_IA_CNF_T_IA_COUNT, NULL);
diff --git a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.cpp b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.cpp
index 53385cb..154b9ef 100755
--- a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.cpp
+++ b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.cpp
@@ -92,7 +92,10 @@
     mApnInit(false),
     mcc(String8("")),
     mnc(String8("")),
-    emptyStr(String8("")) {
+    emptyStr(String8("")),
+    /*add by hq at 20240627 for API-1626 P10 modem 4G only access cell fail begin*/
+    mIaRetryCount(0) {
+    /*add by hq at 20240627 for API-1626 P10 modem 4G only access cell fail end*/
 }
 
 RpApnController::~RpApnController() {
@@ -701,9 +704,19 @@
 
 	if (response->getError() != RIL_E_SUCCESS) {
         logD(RFX_LOG_TAG, "setdataprofile response fail!");
+        /*add by hq at 20240627 for API-1626 P10 modem 4G only access cell fail begin*/		
+        mIaRetryCount++;
+        if (mIaRetryCount < 20) {
+             usleep(50 * 1000);
+             setInitialAttachApn();
+        }
+        /*add by hq at 20240627 for API-1626 P10 modem 4G only access cell fail end*/		
         return;
     }else{
         logD(RFX_LOG_TAG, "setdataprofile response success!");
+        /*add by hq at 20240627 for API-1626 P10 modem 4G only access cell fail begin*/		
+        mIaRetryCount = 0;
+        /*add by hq at 20240627 for API-1626 P10 modem 4G only access cell fail end*/
     }
 }
 
diff --git a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.h b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.h
index baab352..a295c36 100755
--- a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.h
+++ b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.h
@@ -176,6 +176,9 @@
     bool mApnInit;
     String8 emptyStr;
     int mDataprofileid;
+    /*add by hq at 20240627 for API-1626 P10 modem 4G only access cell fail begin*/
+    int mIaRetryCount;
+    /*add by hq at 20240627 for API-1626 P10 modem 4G only access cell fail end*/
 };
 
 #endif /* __RP_APN_CONTROLLER_H__ */