[Feature][T8TSK-338]The apn password is encrypted or masked in log --ril-service

Only Configure:No
Affected branch:ALL
Affected module:RIL
Is it affected on both ZXIC and MTK: MTK
Self-test: Yes
Doc Update:No

Change-Id: I595fbb97e625db8a46e9848e979bdf0a6766e55e
diff --git a/common_src/framework/lynq-ril-service/src/data/data.cpp b/common_src/framework/lynq-ril-service/src/data/data.cpp
index b66072b..678568d 100755
--- a/common_src/framework/lynq-ril-service/src/data/data.cpp
+++ b/common_src/framework/lynq-ril-service/src/data/data.cpp
@@ -45,7 +45,9 @@
 #include <apn_interface.h>
 #include <vector>
 #include <string>
-
+//xy.he@20240524 modify for T8TSK-338 start
+#include "sms/gsm/sms_pdu.h"
+//xy.he@20240524 modify for T8TSK-338 end
 #include "data/data.h"
 #include "common.h"
 
@@ -162,6 +164,12 @@
 
 static int data_call_num = 0;
 
+//xy.he@20240524 modify for T8TSK-338 start
+void encode_log(char str[], int n);
+void decode_log(char str[], int n);
+//xy.he@20240524 modify for T8TSK-338 end
+
+
 RIL_Data_Call_Response_v6 *data_call_response = NULL;
 const int INVALID_VALUE = -1;
 const int INVALID = -2;
@@ -1674,7 +1682,10 @@
         RLOGD("%s parameters  number isn't enough", __FUNCTION__);
         return -1;
     }
-    RLOGD("%s,cmd:%s,record:%s", __FUNCTION__,argv[1],argv[2]);
+    //xy.he@20240524 modify for T8TSK-338 start
+    RLOGD("%s,cmd:%s,record:(has got)", __FUNCTION__,argv[1]);
+    encode_log(argv[2],6);
+    //xy.he@20240524 modify for T8TSK-338 end
     int cmd = std::stoi(argv[1]);
     char* record = argv[2];
     modifyApnDB(cmd, record);
diff --git a/common_src/framework/lynq-ril-service/src/data/data_gdbus.cpp b/common_src/framework/lynq-ril-service/src/data/data_gdbus.cpp
index 0136939..5b93999 100755
--- a/common_src/framework/lynq-ril-service/src/data/data_gdbus.cpp
+++ b/common_src/framework/lynq-ril-service/src/data/data_gdbus.cpp
@@ -50,6 +50,9 @@
 #include <binder/Parcel.h>
 #include "ATCI.h"
 #include "atci_lynq_data_cmd.h"
+//xy.he@20240524 modify for T8TSK-338 start
+#include "sms/gsm/sms_pdu.h"
+//xy.he@20240524 modify for T8TSK-338 end
 #ifdef LED_SUPPORT
 #include "led.h"
 #endif
@@ -520,7 +523,17 @@
     }
     //reason = const_cast<gchar*>(g_variant_dup_string(result, NULL));
     g_variant_get (result, "(&s)", &reason);
-    RLOGD("modifyApnDB_method_cb reason %s", ((reason == NULL)? "":reason));
+    //xy.he@20240524 modify for T8TSK-338 start
+    if(strstr(reason,"password") != NULL)
+    {
+        RLOGD("modifyApnDB_method_cb reason (has got)");
+    }
+    else
+    {
+        RLOGD("modifyApnDB_method_cb reason %s", ((reason == NULL)? "":reason));  
+    }
+    //xy.he@20240524 modify for T8TSK-338 end
+
     printf("modify apn db success, return message: %s\n", ((reason == NULL)? "":reason));
     //printf("modifyApnDB_method_cb reason %s\n", ((reason == NULL)? "":reason));
     /*lei add for AT+LEAPNMOD*/
@@ -536,7 +549,17 @@
 }
 
 int modifyApnDB(int cmd, gchar *record) {
-    RLOGD("%s: cmd: %d, record:%s", __FUNCTION__, cmd, record);
+    //xy.he@20240524 modify for T8TSK-338 start
+    if(strstr(record,"password") != NULL)
+    {
+        RLOGD("%s: cmd: %d, record:(has got)", __FUNCTION__, cmd);
+        encode_log(record,6);
+    }
+    else
+    {
+        RLOGD("%s: cmd: %d, record:%s", __FUNCTION__, cmd, record);
+    }
+    //xy.he@20240524 modify for T8TSK-338 start
     g_dbus_proxy_call(proxy,
             "modifyApnDB",
             g_variant_new("(is)", cmd, record),
diff --git a/common_src/framework/lynq-ril-service/src/ril.cpp b/common_src/framework/lynq-ril-service/src/ril.cpp
index 1c0a080..9ae636a 100755
--- a/common_src/framework/lynq-ril-service/src/ril.cpp
+++ b/common_src/framework/lynq-ril-service/src/ril.cpp
@@ -5911,7 +5911,17 @@
 {
     char *pos, *pos2;
     int argc = 0;
-    printf("LYNQ_REQUEST cmd=%s\n",cmd);
+    //xy.he@20240524 modify for T8TSK-338 start
+    //printf("LYNQ_REQUEST cmd=%s\n",cmd);
+    if(strstr(cmd,"password") != NULL)
+    {
+        RLOGD("LYNQ_REQUEST cmd=(has got)\n");
+    }
+    else
+    {
+        RLOGD("LYNQ_REQUEST cmd=%s\n",cmd);
+    }
+    //xy.he@20240524 modify for T8TSK-338 end
     pos = cmd;
     while (1) {
         // Trim the space characters.
@@ -6188,10 +6198,17 @@
                 while(recvfrom(server_socket_fd, buffer, LYNQ_SOCKET_BUFFER,0,(struct sockaddr*)&lynqClient_addr, &client_addr_length) != -1)//add while by hq for bug 760 2023/02/09
                 {
                     client_tmp = (lynq_client_t*)buffer;
-                    RLOGD("[LYNQ socketId] utoken=%d,request=%d,len=%d,param=%s",client_tmp->uToken,client_tmp->request,client_tmp->paramLen,client_tmp->param);
-                    //char test[36] = {};
-                    //sprintf(test,"test okay len = %d",client_tmp->paramLen);
-                    //sendto(server_socket_fd,test,strlen(test),0,(struct sockaddr*)&client_addr,client_addr_length);
+                    //xy.he@20240524 modify for T8TSK-338 start
+                    if(client_tmp->request != RIL_REQUEST_MODIFY_APN)
+                    {
+                        RLOGD("[LYNQ socketId] utoken=%d,request=%d,len=%d,param=%s",client_tmp->uToken,client_tmp->request,client_tmp->paramLen,client_tmp->param);
+                    }
+                    else
+                    {
+                        RLOGD("[LYNQ socketId] utoken=%d,request=%d,len=%d,param=(has got)",client_tmp->uToken,client_tmp->request,client_tmp->paramLen);
+                        encode_log(client_tmp->param,6);
+                    }
+                    //xy.he@20240524 modify for T8TSK-338 end
                     argv[0] = (char *)lynq_requset_to_string(client_tmp->request);
                     argc = 0;
                     if(client_tmp->paramLen > 0)
@@ -6205,10 +6222,19 @@
                         }
                     }
                     argc = argc+1;
+                    //xy.he@20240524 modify for T8TSK-338 start
                     for(int t = 0;t<argc;t++)
                     {
-                        RLOGD("LYNQ_REQUEST argv[%d]=%s\n",t,argv[t]);
+                        if(strstr(argv[t],"password") != NULL)
+                        {
+                            RLOGD("LYNQ_REQUEST argv[%d]=(has got)\n",t);
+                        }
+                        else
+                        {
+                            RLOGD("LYNQ_REQUEST argv[%d]=%s\n",t,argv[t]);
+                        }
                     }
+                    //xy.he@20240524 modify for T8TSK-338 end
                     COMMAND *command = find_command(argv[0]);
                     if(!command)
                     {