[Bugfix][T106][task-view-794]add initial apn set/get interface

Only Configure: Yes
Affected branch: master
Affected module: data,network
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: Ib6df2f6cb0206deec6f634129b8f8ce532769fc5
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/commands.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/commands.h
index a4a872a..c5c5542 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/commands.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/commands.h
@@ -56,6 +56,11 @@
     {"RIL_REQUEST_DEACTIVATE_DATA_CALL",deactivateDataCall, "deactive data call", RIL_REQUEST_DEACTIVATE_DATA_CALL},
     {"RIL_REQUEST_SET_INITIAL_ATTACH_APN",setInitialAttachApnargc, "intial attach apn", RIL_REQUEST_SET_INITIAL_ATTACH_APN},
     {"RIL_REQUEST_DATA_CALL_LIST",getDataCallList,"get data call list",RIL_REQUEST_DATA_CALL_LIST},
+    //LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_START
+    #ifdef MOBILETEK_TARGET_PLATFORM_T106
+    {"RIL_REQUEST_APN_LIST",getApnList,"get apn list",RIL_REQUEST_APN_LIST},
+    #endif
+    //LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_END
     {"RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE",getLastDataCallFailCause, "last data fail cause" ,RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE},
     {"RIL_REQUEST_SET_DATA_PROFILE",setDataProfile, "set data profile", RIL_REQUEST_SET_DATA_PROFILE},
     {"RIL_REQUEST_SYNC_DATA_SETTINGS_TO_MD",syncDataSettingsToMd, "sync data settings to modem", RIL_REQUEST_SYNC_DATA_SETTINGS_TO_MD},
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 4e79af6..c6f39fd 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
@@ -1493,13 +1493,13 @@
     }
     char* username = checkParameters(argv[4]);
     char* password = checkParameters(argv[5]);
+    RLOGD("setInitialAttachApnargc: apn=%s, protocol=%s, authtype=%d, username=%s, password=%s", apn, protocol, authType, username, password);
     writeStringToParcel(p,apn); //apn
     writeStringToParcel(p,protocol); //protocol
     p.writeInt32(authType);  //authType
     writeStringToParcel(p,username);//username
     writeStringToParcel(p,password);//password
     p.setDataPosition(pos);
-
     pRI->pCI->dispatchFunction(p, pRI);
     return 0;
 }
@@ -1517,7 +1517,23 @@
     pRI->pCI->dispatchFunction(p, pRI);
     return 0;
 }
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_START
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int getApnList(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
+{
+    if(argc != 1)
+    {
+        free(pRI);
+        RLOGE("the peremeters numbers isn't right , so return");
+        return -1;
+    }
 
+    android::Parcel p;
+    pRI->pCI->dispatchFunction(p, pRI);
+    return 0;
+}
+#endif
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_END
 int getLastDataCallFailCause(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
 {
     if(argc != 1)
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.h
index 25c8e89..49793fd 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.h
@@ -52,6 +52,11 @@
 void updateRILDataCallResponsev11(int num ,RIL_Data_Call_Response_v11* p_cur);
 //xf.il@20230610 modify for T106 data end
 int getDataCallList(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_START
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int getApnList(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
+#endif
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_END
 int getLastDataCallFailCause(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
 #ifdef MOBILETEK_TARGET_PLATFORM_T106
 void handleUnsolDataCalllistChange(int num ,RIL_Data_Call_Response_v11* p_cur);
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/mtk_ril_commands.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/mtk_ril_commands.h
index 2d17ee3..715a6ad 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/mtk_ril_commands.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/mtk_ril_commands.h
@@ -82,6 +82,12 @@
 { RIL_REQUEST_QUERY_ICCID, dispatchVoid, responseString},
 { RIL_REQUEST_GET_MSISDN, dispatchVoid, responseString},
 { RIL_REQUEST_RESET_SIMCARD, dispatchVoid, responseVoid},
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_START
+//Data
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+{RIL_REQUEST_APN_LIST, dispatchVoid, responseApnList},
+#endif
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_END
 //Keepalive
 #ifdef KEEP_ALIVE
 { RIL_REQUEST_START_KEEPALIVE_PRO,dispatchStartKeepalivePro,responseInts},
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 90d3409..35d4268 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
@@ -321,6 +321,11 @@
 static int responseSIM_IO(Parcel &p, void *response, size_t responselen);
 static int responseCallForwards(Parcel &p, void *response, size_t responselen);
 static int responseDataCallList(Parcel &p, void *response, size_t responselen);
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_START
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+static int responseApnList(Parcel &p, void *response, size_t responselen);
+#endif
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_END
 static int responseSetupDataCall(Parcel &p, void *response, size_t responselen);
 static int responseRaw(Parcel &p, void *response, size_t responselen);
 static int responseSsn(Parcel &p, void *response, size_t responselen);
@@ -2470,8 +2475,64 @@
 
     return 0;
 }
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_START
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+static int responseApnList(Parcel &p, void *response, size_t responselen)
+{
+    RLOGD("responseApnList: responselen = %d, sizeof(RIL_Apn_List_Response) = %d\n", responselen, sizeof(RIL_Apn_List_Response));
+    if (response == NULL && responselen != 0) {
+        RLOGE("invalid response: NULL");
+        return RIL_ERRNO_INVALID_RESPONSE;
+    }
 
+    if (responselen % sizeof(RIL_Apn_List_Response) != 0) {
+        RLOGE("invalid response length %d expected multiple of %d",
+                (int)responselen, (int)sizeof(RIL_Apn_List_Response));
+        return RIL_ERRNO_INVALID_RESPONSE;
+    }
 
+    int num = responselen / sizeof(RIL_Apn_List_Response);
+    p.writeInt32(num);
+    RIL_Apn_List_Response *p_cur = (RIL_Apn_List_Response *) response;
+
+    startResponse;
+    int i;
+    for(i = 0; i < num; i++)
+    {
+        if(p_cur[i].pdp_type == NULL || p_cur[i].apn == NULL || p_cur[i].pdp_addr == NULL)
+        {
+            RLOGE("invalid response: NULL");
+            return RIL_ERRNO_INVALID_RESPONSE;
+        }
+        RLOGI("LYNQ:[cid=%d,%s,%s,%s,%d,%d,%d,%d,%d,%d]",
+        p_cur[i].cid,
+        (char*)p_cur[i].pdp_type,
+        (char*)p_cur[i].apn,
+        (char*)p_cur[i].pdp_addr,
+        p_cur[i].d_comp,
+        p_cur[i].h_comp,
+        p_cur[i].IPv4AddrAlloc,
+        p_cur[i].Emergency_Indication,
+        p_cur[i].P_CSCF_discovery,
+        p_cur[i].IM_CN_Signalling_Flag_Ind);
+
+        p.writeInt32(p_cur[i].cid);
+        writeStringToParcel(p, p_cur[i].pdp_type);
+        writeStringToParcel(p, p_cur[i].apn);
+        writeStringToParcel(p, p_cur[i].pdp_addr);
+        p.writeInt32(p_cur[i].d_comp);
+        p.writeInt32(p_cur[i].h_comp);
+        p.writeInt32(p_cur[i].IPv4AddrAlloc);
+        p.writeInt32(p_cur[i].Emergency_Indication);
+        p.writeInt32(p_cur[i].P_CSCF_discovery);
+        p.writeInt32(p_cur[i].IM_CN_Signalling_Flag_Ind);
+    }
+    removeLastChar;
+    closeResponse;
+    return 0;
+}
+#endif
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_END
 static int responseDataCallList(Parcel &p, void *response, size_t responselen)
 {
 //xf.il@20230610 modify for T106 data start
@@ -5145,6 +5206,9 @@
         case RIL_REQUEST_QUERY_CLIP: return "RIL_REQUEST_QUERY_CLIP";
         case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: return "RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE";
         case RIL_REQUEST_DATA_CALL_LIST: return "RIL_REQUEST_DATA_CALL_LIST";
+        #ifdef MOBILETEK_TARGET_PLATFORM_T106
+        case RIL_REQUEST_APN_LIST: return "RIL_REQUEST_APN_LIST";//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221
+        #endif
         case RIL_REQUEST_RESET_RADIO: return "RIL_REQUEST_RESET_RADIO";
         case RIL_REQUEST_OEM_HOOK_RAW: return "RIL_REQUEST_OEM_HOOK_RAW";
         case RIL_REQUEST_OEM_HOOK_STRINGS: return "RIL_REQUEST_OEM_HOOK_STRINGS";
@@ -5620,6 +5684,7 @@
         case RIL_REQUEST_RESET_SIMCARD: return "RESET SIMCARD";
 #ifdef MOBILETEK_TARGET_PLATFORM_T106 
         case RIL_UNSOL_AUDIO_DEV_SAMPLERATE: return "UNSOL_AUDIO_DEV_SAMPLERATE";
+        case RIL_REQUEST_APN_LIST: return "APN_LIST";//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221
 #endif
         /*warren add for t800 ril service 2022/1/22 end*/
         default: return "<unknown request>";
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/include/libdata/lynq_data.h b/cap/zx297520v3/src/lynq/lib/liblynq-data/include/libdata/lynq_data.h
index 42fa806..7f8b0f1 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-data/include/libdata/lynq_data.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/include/libdata/lynq_data.h
@@ -55,6 +55,23 @@
                                    sent an invalid value */
 } lynq_data_call_response_v11_t;
 
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_START
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+typedef struct {
+    int cid;
+    char pdp_type[LYNQ_PDP_TYPE_MAX_LEN];
+    char apn[LYNQ_APN_MAX_LEN];
+    char pdp_addr[LYNQ_PDP_ADDR_MAX_LEN];
+    int d_comp;
+    int h_comp;
+    int IPv4AddrAlloc;
+    int Emergency_Indication;
+    int P_CSCF_discovery;
+    int IM_CN_Signalling_Flag_Ind;
+} lynq_apn_list_response;
+#endif
+//LYNQ_MODIFY_ZXW_TASK794_CR2024120449D612E5_XF.Li_20241221_END
+
 typedef struct
 {
     int index;
@@ -76,6 +93,10 @@
 int lynq_reset_apn(char *result);
 int lynq_get_apn_table(int *size,lynq_apn_info **list);
 void lynq_release_wait_data_call();
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int lynq_init_attach_apn(char *apn,char *pdpType,char *user,char *password,char *authType);
+int lynq_get_apn_list(int cid,lynq_apn_list_response *apnList);
+#endif
 
 #ifdef __cplusplus
 }
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 ba6b9b7..3d531a4 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
@@ -1589,7 +1589,218 @@
 
     return 0;
 }
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int getApnLists(lynq_apn_list_response apnList[LYNQ_APN_CHANNEL_MAX],int *realNum)
+{
+    Parcel *p = NULL;
+    lynq_client_t client;
+    int resp_type = -1;
+    int token;
+    int request = -1;    
+    int slot_id = -1;
+    int error = -1;
+    int version =0;
+    int num = 0;
+    char *temp_char = NULL;
 
+    if(apnList==NULL)
+    {
+        LYERRLOG("apnList is null!!!");
+        return -1;
+    }
+
+    client.uToken = get_utoken();
+    client.request = 4002;//RIL_REQUEST_APN_LIST
+    client.paramLen = 0;
+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+    LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+    pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+    if(send_request(lynq_client_sockfd,&client)==-1)
+    {
+        LYERRLOG("send request fail");
+        perror("[LYNQ_DATA] send request fail:");
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return -1;
+    }
+    //get_response(lynq_client_sockfd,p);
+    error = wait_response(lynq_client_sockfd,p,client.uToken,g_wait_time);
+    if(error!=0)
+    {
+        LYERRLOG("wait_response fail,ret:%d",error);
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return error;
+    }
+    pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+    if(JumpHeader(p,&resp_type,&client.uToken,&request,&slot_id,&error)!=0)
+    {
+        LYERRLOG("JumpHeader fail");
+        free_parcel(p);
+        return -1;
+    }
+    LYINFLOG("resp_type=%d,uToken=%d,request=%d,slot_id=%d,error_code=%d",resp_type,client.uToken,request,slot_id,error);
+    p->readInt32(&num);
+    *realNum = num;
+    for (int i = 0; i < num; i++)
+    {
+        p->readInt32(&apnList[i].cid);
+        temp_char = strdupReadString_p(p);
+        LYINFLOG("[%s][%d]%s",__FUNCTION__,__LINE__,temp_char);
+        if(temp_char)
+        {
+            memcpy(apnList[i].pdp_type,temp_char,strlen(temp_char)+1);
+            free(temp_char);
+        }
+        temp_char = strdupReadString_p(p);
+        LYINFLOG("[%s][%d]%s",__FUNCTION__,__LINE__,temp_char);
+        if(temp_char)
+        {
+            memcpy(apnList[i].apn,temp_char,strlen(temp_char)+1);
+            free(temp_char);
+        }
+        temp_char = strdupReadString_p(p);
+        LYINFLOG("[%s][%d]%s",__FUNCTION__,__LINE__,temp_char);
+        if(temp_char)
+        {
+            memcpy(apnList[i].pdp_addr,temp_char,strlen(temp_char)+1);
+            free(temp_char);
+        }
+        p->readInt32(&apnList[i].d_comp);
+        p->readInt32(&apnList[i].h_comp);
+        p->readInt32(&apnList[i].IPv4AddrAlloc);
+        p->readInt32(&apnList[i].Emergency_Indication);
+        p->readInt32(&apnList[i].P_CSCF_discovery);
+        p->readInt32(&apnList[i].IM_CN_Signalling_Flag_Ind);
+    }
+        
+    free_parcel(p);
+    return error;
+}
+int lynq_get_apn_list(int cid, lynq_apn_list_response *apnList)
+{
+    lynq_apn_list_response interApnList[LYNQ_APN_CHANNEL_MAX]={};
+    int number = 0;
+    int error = -1;
+
+    if (g_lynq_data_init_flag == 0)
+    {
+        LYERRLOG("[%s][%d]Invalid operation, need init",__FUNCTION__,__LINE__);
+        return -1;
+    }
+    if((cid < 0 || cid > LYNQ_APN_CHANNEL_MAX) || (apnList==NULL))
+    {
+        LYERRLOG("cid out of range or apnList is null!!!");
+        return -1;
+    }
+    memset(&interApnList,0,sizeof(interApnList));
+    error = getApnLists(interApnList, &number);
+    if(error == 0)
+    {
+        for(int i = 0;i < number;i++)
+        {
+            if(interApnList[i].cid == cid)
+            {
+                apnList->cid = interApnList[i].cid;
+                memcpy(apnList->pdp_type,interApnList[i].pdp_type,sizeof(interApnList[i].pdp_type));
+                memcpy(apnList->apn,interApnList[i].apn,sizeof(interApnList[i].apn));
+                memcpy(apnList->pdp_addr,interApnList[i].pdp_addr,sizeof(interApnList[i].pdp_addr));
+                apnList->d_comp = interApnList[i].d_comp;
+                apnList->h_comp = interApnList[i].h_comp;
+                apnList->IPv4AddrAlloc = interApnList[i].IPv4AddrAlloc;
+                apnList->Emergency_Indication = interApnList[i].Emergency_Indication;
+                apnList->P_CSCF_discovery = interApnList[i].P_CSCF_discovery;
+                apnList->IM_CN_Signalling_Flag_Ind = interApnList[i].IM_CN_Signalling_Flag_Ind;
+                LYINFLOG("[lynq_get_apn_list]:cid=%d, pdp_type=%s, apn=%s, pdp_addr=%s, d_comp=%d, h_comp=%d, IPv4AddrAlloc=%d, Emergency_Indication=%d, P_CSCF_discovery=%d, IM_CN_Signalling_Flag_Ind=%d\n",
+                    apnList->cid, apnList->pdp_type, apnList->apn, apnList->pdp_addr, apnList->d_comp, apnList->h_comp, apnList->IPv4AddrAlloc, apnList->Emergency_Indication,
+                    apnList->P_CSCF_discovery, apnList->IM_CN_Signalling_Flag_Ind);
+                
+            }
+        }
+    }
+    return error;
+}
+//xf.li@20241221 add start
+int lynq_init_attach_apn(char *apn,char *pdpType,char *authType,char *user,char *password)
+{
+    Parcel *p = NULL;
+    lynq_client_t client;
+    int resp_type = -1;
+    int request = -1;
+    int error = -1;
+    int slot_id = -1;
+    char *argv[10] = {};
+    int utoken = -1;
+
+    char *tmp_msg = NULL;
+    int len = 0;
+
+    LYINFLOG("[%s][%d]",__FUNCTION__,__LINE__);
+    if(user == NULL || strcmp(user, "NULL") == 0 || strlen(user) == 0)
+    {
+        argv[1] = NULL;
+    }
+    else
+    {
+        argv[1] = user;
+    }
+
+    if(password == NULL || strcmp(password, "NULL") == 0 || strlen(password) == 0)
+    {
+        argv[2] = NULL;
+    }
+    else
+    {
+        argv[2] = password;
+    }
+
+    if(authType == NULL || strcmp(authType, "NULL") == 0 || strlen(authType) == 0)
+    {
+        argv[3] = NULL;
+    }
+    else
+    {
+        argv[3] = authType;
+    }
+    if(pdpType==NULL || strlen(pdpType) == 0)
+    {
+        argv[4] = "IP";
+    }
+    else
+    {
+        argv[4] = pdpType;
+    }
+
+    client.uToken = get_utoken();
+    client.request = 111;//RIL_REQUEST_SET_INITIAL_ATTACH_APN
+    client.paramLen = 5;
+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+    sprintf(client.param,"%s %s %s %s %s",apn,argv[4],argv[3],argv[1],argv[2]);
+    LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+
+    pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+ 
+    if(send_request(lynq_client_sockfd,&client)==-1)
+    {
+        LYERRLOG("send request fail");
+        perror("[LYNQ_DATA] send request fail:");
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return -1;
+    }
+
+    //get_response(lynq_client_sockfd,p);
+    error = wait_response(lynq_client_sockfd,p,client.uToken,50);
+    if(error!=0)
+    {
+        LYERRLOG("wait_response fail,ret:%d",error);
+        pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+        return error;
+    }
+    pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+    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);
+}
+#endif
+//xf.li@20241221 add end
 int lynq_setup_data_call_sp_t106(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol)
 {
     Parcel *p = NULL;
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/include/lynq-qser-data.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/include/lynq-qser-data.h
index 33b3504..e7850ce 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/include/lynq-qser-data.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/include/lynq-qser-data.h
@@ -276,6 +276,28 @@
  * 
  */
 extern int qser_apn_get_list(qser_apn_info_list_s *apn_list);
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+/**
+ * set initial apnname
+ *
+ * @param [in] apnname         set the apnname.
+ *
+ * @return 
+ *   On success, 0 is returned.  On error, -1 is returned.
+ * 
+ */
+extern int qser_set_initial_apnname(char *apnname);
+/**
+ * get initial apnname
+ *
+ * @param [out] apnname         get the apnname.
+ *
+ * @return 
+ *   On success, 0 is returned.  On error, -1 is returned.
+ * 
+ */
+extern int qser_get_initial_apnname(char apnname[QSER_APN_NAME_SIZE]);
+#endif
 #ifdef __cplusplus
 }
 #endif
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 179e549..094547f 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
@@ -65,6 +65,10 @@
 static int apn_db_query(unsigned char profile_idx,qser_apn_info_s *apn);
 static int apn_db_query_list_cb(void *data, int argc, char **argv, char **azColName);
 static int apn_db_query_list(qser_apn_info_list_s *apn_list);
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int qser_set_initial_apnname(char *apnname);
+int qser_get_initial_apnname(char apnname[QSER_APN_NAME_SIZE]);
+#endif
 
 void lynq_ipv4_aton_urc(lynq_data_call_response_v11_t *libdata,qser_data_call_state_s *data_res)
 {
@@ -1679,6 +1683,42 @@
     }
     return ret;
 }
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int qser_set_initial_apnname(char *apnname)
+{
+    int ret = -1;
+    
+    if(g_lynq_qser_data_init_flag == 0)
+    {
+        return LYNQ_E_NO_INIT;
+    }
+
+    ret = lynq_init_attach_apn(apnname, "IP", "0", "null", "null");
+    return ret;
+}
+int qser_get_initial_apnname(char apnname[QSER_APN_NAME_SIZE])
+{
+    int ret = -1;
+    lynq_apn_list_response apnList = {-1, "", "", "", -1, -1, -1, -1, -1, -1};
+
+    if(g_lynq_qser_data_init_flag == 0)
+    {
+        return LYNQ_E_NO_INIT;
+    }
+
+    if(apnname == NULL)
+    {
+        LYERRLOG("[%s][%d] apnname is NULL",__FUNCTION__,__LINE__);
+    }
+    ret = lynq_get_apn_list(1, &apnList);
+    if(ret == 0)
+    {
+        memcpy(apnname, apnList.apn, sizeof(apnList.apn));
+        LYINFLOG("qser_get_initial_apnname: %s", apnname);
+    }
+    return ret;
+}
+#endif
 int check_pdp_type(qser_apn_pdp_type_e pdp_type)
 {
     switch (pdp_type)
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.cpp
index f69cc13..76e7031 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.cpp
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.cpp
@@ -456,3 +456,23 @@
     }

     return ret;

 }

+int lynq_qser_set_initial_apnname(int argc, char *argv[], int sp_test)

+{

+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);

+    int ret = -1;

+

+    ret = qser_set_initial_apnname(argv[1]);

+    printf("%s%d\n",TEST_RESULT,ret);

+    return ret;

+}

+int lynq_qser_get_initial_apnname(int argc, char *argv[], int sp_test)

+{

+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);

+    int ret = -1;

+    char apnname[QSER_APN_NAME_SIZE] = "\0";

+

+    ret = qser_get_initial_apnname(apnname);

+    printf("LYNQ_QSER_GET_INITIAL_APNNAME:apnname is %s\n", apnname);

+    printf("%s%d\n",TEST_RESULT,ret);

+    return ret;

+}
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.h
index 33364fb..4bdd23d 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.h
@@ -16,4 +16,6 @@
 int lynq_qser_apn_get(int argc, char *argv[], int sp_test);

 int lynq_qser_apn_add(int argc, char *argv[], int sp_test);

 int lynq_qser_apn_del(int argc, char *argv[], int sp_test);

-int lynq_qser_apn_get_list(int argc, char *argv[], int sp_test);
\ No newline at end of file
+int lynq_qser_apn_get_list(int argc, char *argv[], int sp_test);

+int lynq_qser_get_initial_apnname(int argc, char *argv[], int sp_test);

+int lynq_qser_set_initial_apnname(int argc, char *argv[], int sp_test);
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
index 19ec1f0..9256e38 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
@@ -60,6 +60,8 @@
 #define LYNQ_QSER_APN_DEL LYNQ_QSER_DATA + 9
 #define LYNQ_QSER_APN_GET_LIST LYNQ_QSER_DATA + 10
 #define LYNQ_QSER_SETUP_DATA_CALL_ASYNC LYNQ_QSER_DATA + 11
+#define LYNQ_QSER_GET_INITIAL_APNNAME LYNQ_QSER_DATA + 12
+#define LYNQ_QSER_SET_INITIAL_APNNAME LYNQ_QSER_DATA + 13
 
 
 #define LYNQ_QSER_NETWORK LYNQ_BASE + 100
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
index 108fc82..33fa8c8 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
@@ -52,6 +52,8 @@
     {"LYNQ_QSER_APN_ADD",lynq_qser_apn_add, "set apn", LYNQ_QSER_APN_ADD},
     {"LYNQ_QSER_APN_DEL",lynq_qser_apn_del, "del apn", LYNQ_QSER_APN_DEL},
     {"LYNQ_QSER_APN_GET_LIST",lynq_qser_apn_get_list, "get apn list", LYNQ_QSER_APN_GET_LIST},
+    {"LYNQ_QSER_GET_INITIAL_APNNAME",lynq_qser_get_initial_apnname, "get initial apn", LYNQ_QSER_GET_INITIAL_APNNAME},
+    {"LYNQ_QSER_SET_INITIAL_APNNAME",lynq_qser_set_initial_apnname, "set initial apn", LYNQ_QSER_SET_INITIAL_APNNAME},
 //QSER VOICE
     {"LYNQ_QSER_CALL_INIT",qser_voice_call_client_init_test,"qser_voice_call_client_init_test",LYNQ_QSER_CALL_INIT},
     {"LYNQ_QSER_CALL_DEINIT",qser_voice_call_client_deinit_test,"qser_voice_call_client_deinit_test",LYNQ_QSER_CALL_DEINIT},