[Feature][T8TSK-126][AT]at+elapnmod can not input mccmnc

Change-Id: I8e9f1656fea8ed68a771d02169285de515eb99d8
diff --git a/framework/lynq-ril-service/src/lynq_common.cpp b/framework/lynq-ril-service/src/lynq_common.cpp
index 5b4ffb6..b073796 100755
--- a/framework/lynq-ril-service/src/lynq_common.cpp
+++ b/framework/lynq-ril-service/src/lynq_common.cpp
@@ -33,6 +33,7 @@
 extern apn_table_t apn_table[LYNQ_APN_CHANNEL_MAX] = {};
 extern int apn_count = 0;
 extern char lynq_at[LYNQ_AT_LEN_MAX]= {};
+char mccmnc[8] = {0};
 pthread_cond_t lynq_at_cond = PTHREAD_COND_INITIALIZER;
 pthread_mutex_t lynq_at_mutex= PTHREAD_MUTEX_INITIALIZER;
 
@@ -530,7 +531,16 @@
     }
     if (!strcmp(mcc,"null"))
     {
-        sprintf(strtmp[1], "mcc=;");
+        char mcc[8] = {0};
+        if(strlen(mccmnc))
+        {
+            strncpy(mcc, mccmnc, 3);
+            sprintf(strtmp[1], "mcc=%s;", mcc);
+        }
+        else
+        {
+            sprintf(strtmp[2], "mcc=;");
+        }
     }
     else
     {
@@ -538,7 +548,14 @@
     }
     if (!strcmp(mnc,"null"))
     {
-        sprintf(strtmp[2], "mnc=;");
+        if(strlen(mccmnc))
+        {
+            sprintf(strtmp[2], "mnc=%s;", mccmnc+3);
+        }
+        else
+        {
+            sprintf(strtmp[2], "mnc=;");
+        }
     }
     else
     {
@@ -604,6 +621,13 @@
     return 0;
 }
 
+static void lynq_req_mccmnc(int uToken)
+{
+    char *new_argv[10] = {};
+    new_argv[0] = "RIL_REQUEST_OPERATOR";
+    android::lynqSendToRil(1,new_argv,uToken);//for get mccmnc
+}
+
 int lynq_modify_apn_info(int argc,char*argv[],char *rilReq, int uToken)
 {
     /*
@@ -630,13 +654,14 @@
     {
         for(int i = 4; i < 14; i++)
         {
-            printf("argv[%d] %s\n", i,argv[i]);
             if(argv[i] == NULL)
             {
                 syncRespToUsb(100);
                 return -1;
             }
         }
+        lynq_req_mccmnc(uToken);
+        usleep(500*1000);
         insert_apn_char(apn_info, argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11], argv[12], argv[13]);
         new_argv[1] = "0";
         new_argv[2] = apn_info;
diff --git a/framework/lynq-ril-service/src/lynq_common.h b/framework/lynq-ril-service/src/lynq_common.h
index 483986a..061bff7 100755
--- a/framework/lynq-ril-service/src/lynq_common.h
+++ b/framework/lynq-ril-service/src/lynq_common.h
@@ -98,6 +98,7 @@
 extern apn_table_t apn_table[LYNQ_APN_CHANNEL_MAX];
 extern int apn_count;
 extern char lynq_at[LYNQ_AT_LEN_MAX];
+extern char mccmnc[8];
 usb_at_transfer_t *lynqFindId(char *cmd);
 usb_cmd_t * lynqFindUsbEvent(char *cmd);
 int transferAtToRequest(char *cmd);
diff --git a/framework/lynq-ril-service/src/ril.cpp b/framework/lynq-ril-service/src/ril.cpp
index 386fd13..e44cd49 100755
--- a/framework/lynq-ril-service/src/ril.cpp
+++ b/framework/lynq-ril-service/src/ril.cpp
@@ -3937,6 +3937,58 @@
     return strndup16to8(s16, stringlen);
 }
 
+static void lynq_get_mccmnc(Parcel &p, char *mccmnc)
+{
+    p.setDataPosition(0);
+    if(p.dataAvail() > 0)
+    {
+        int resp_type;
+        int token;
+        int request;
+        int slot_id;
+        int error1;
+        int num;
+        char *resp[128];
+        p.readInt32(&resp_type);
+        p.readInt32(&token);
+        p.readInt32(&request);
+        p.readInt32(&slot_id);
+        p.readInt32(&error1);
+        if(!error1)
+        {
+            p.readInt32(&num);
+            if(num == 0 || num > 128)
+            {
+                LYERRLOG("no paramters or num %d too great",num);
+            }
+            else
+            {
+                int i;
+                for(i = 0; i<num;i++)
+                {
+                    resp[i] = lynqStrdupReadString(p);
+                }
+                if(NULL != resp[2])
+                {
+                    strcpy(mccmnc,resp[2]);
+                    printf("mcc mnc %s\n", mccmnc);
+                }
+                for(i = 0; i<num;i++)
+                {
+                    if(resp[i]!=NULL)
+                    {
+                        free(resp[i]);
+                    }  
+                }
+            }
+        }
+        else
+        {
+            LYERRLOG("lynq_get_mccmnc error");
+        }
+    }
+}
+
 extern "C" void
 RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responselen) {
     RequestInfo *pRI;
@@ -4254,6 +4306,7 @@
                                     }
                                 }
                                 imei_cnt++;
+                                free(test);
                             }
                         }
                     }
@@ -4286,6 +4339,10 @@
                     break;
                 }
                 /*lei add for AT+CGSN 2022/8/4*/
+                case RIL_REQUEST_OPERATOR:
+                {
+                    lynq_get_mccmnc(p, mccmnc);
+                }
                default:
                    break;
                }