[Feature] Merge MR0.5 from MTK

Change-Id: I77f817d2d58dfa7a69b4af32123f2929c724356e
diff --git a/framework/lynq-ril-service/src/Ril_responsedispatch.cpp b/framework/lynq-ril-service/src/Ril_responsedispatch.cpp
index 5266d60..1f54405 100755
--- a/framework/lynq-ril-service/src/Ril_responsedispatch.cpp
+++ b/framework/lynq-ril-service/src/Ril_responsedispatch.cpp
@@ -55,6 +55,7 @@
 //global variable
 static pthread_mutex_t s_listMutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t s_listCond = PTHREAD_COND_INITIALIZER;
+static bool list_init_done = false;
 //marco define
 #define LIST_LOCK()  pthread_mutex_lock(&s_listMutex)
 #define LIST_UNLOCK() pthread_mutex_unlock(&s_listMutex)
@@ -73,11 +74,18 @@
     memset(list, 0 ,sizeof(struct RspDisp_Event));
     list->next = list;
     list->prev = list;
+    list_init_done = true;
+    WAKEUPLIST();
     RLOGD("Demo Ril_event init list!");
 }
 
 void addToList(struct RspDisp_Event* ev, struct RspDisp_Event* list)
 { //add to list tail
+    if(!list_init_done) {
+        RLOGD("Demo Ril_event add an event , wait list init done!");
+        WAITLIST();
+        RLOGD("Demo Ril_event add an event , list init done,continue...");
+    }
     ev->next = list;
     ev->prev = list->prev;
     ev->prev->next = ev;
diff --git a/framework/lynq-ril-service/src/atci/ATCI.cpp b/framework/lynq-ril-service/src/atci/ATCI.cpp
index 97376a7..af29d33 100755
--- a/framework/lynq-ril-service/src/atci/ATCI.cpp
+++ b/framework/lynq-ril-service/src/atci/ATCI.cpp
@@ -70,7 +70,8 @@
 int atci_dispatch_cmd(char *line);
 #endif
 
-int atci_server_socket_fd, atci_client_connect;
+int atci_server_socket_fd = -1;
+int atci_client_connect = -1;
 namespace android {
     extern int s_registerCalled;
 }
@@ -601,6 +602,11 @@
     exit(1);
   }
   RLOGD("Accept a client , fd is %d", conn);
+  if(atci_client_connect >= 0) {
+      RLOGE("atci_client_connect need close!");
+      close(atci_client_connect);
+      atci_client_connect = -1;
+  }
   atci_client_connect = conn;
   socketData recv_data;
   int ret;
diff --git a/framework/lynq-ril-service/src/cc.cpp b/framework/lynq-ril-service/src/cc.cpp
index bf3e881..369bd2f 100755
--- a/framework/lynq-ril-service/src/cc.cpp
+++ b/framework/lynq-ril-service/src/cc.cpp
@@ -169,10 +169,10 @@
         ret = set_mixer_ctrl_value_int(isEcallAudioPath() ? g_mixer_name_ecall: g_mixer_name, value);
         RLOGD("mixer_set(%s) = %d, ret: %d", (isEcallAudioPath() ? g_mixer_name_ecall: g_mixer_name), value, ret);
     } else {
-        setEcallAudioPathOn(false);
+        //setEcallAudioPathOn(false);
         ret = get_mixer_ctrl_value_int(g_mixer_name);
         RLOGD("mixer_set(get_mixer_ctrl_value_int: %s) = %d", g_mixer_name, ret);
-        if(ret  == 0) {
+        if(ret > 0) {
             ret = set_mixer_ctrl_value_int(g_mixer_name, value);
             RLOGD("mixer_set(%s) = %d", g_mixer_name, ret);
         } else {
@@ -220,6 +220,7 @@
         ret = get_mixer_ctrl_value_int(g_mixer_name_bt);
     } else {
         RLOGE("mixer_check wrong mix %d", mix);
+        ret = -1;
     }
     RLOGD("The ctrl \"%s\" is set to %d ", g_mixer_name, ret);
     return ret;
@@ -1445,6 +1446,7 @@
     android::Parcel p;
 
     dtmf_stop(dtmf_handle);
+    dtmf_handle = NULL;
     pRI->pCI->dispatchFunction(p, pRI);
     return 0;
 }
diff --git a/framework/lynq-ril-service/src/data/data.cpp b/framework/lynq-ril-service/src/data/data.cpp
index e9067b9..ff64a15 100755
--- a/framework/lynq-ril-service/src/data/data.cpp
+++ b/framework/lynq-ril-service/src/data/data.cpp
@@ -191,7 +191,7 @@
 
 //when 1, libvendor-ril manage the PDN retry , network configuration than create from ril request.
 bool isEnableLocalconf(){
-    bool isEnable;
+    bool isEnable = false;
     RLOGD("enable configuration: %d", isEnable);
 
     char prop_value[64] = { 0 };
@@ -392,7 +392,7 @@
         return NULL;
     }
 
-    dns[4][40] = {0};
+    memset(dns,0,4*40);
     dnsNum = 0;
 
     RLOGD("fill data");
@@ -414,7 +414,7 @@
         strcpy(dns[dnsNum],dnses);
         dnsNum++;
     }
-    return dnses;
+    return NULL;
 }
 
 char* getAddress(char* apnType, const char token)
@@ -836,8 +836,7 @@
     findCellularName(line);
     sprintf(cmd, "connmanctl connect %s", csname);
     int ret = system(cmd);
-    memset(line, LEN*sizeof(char), 0);
-    memset(line, 27*sizeof(char), 0);
+    memset(line, 0, LEN*sizeof(char));
 
     updataDataConnectState(get_default_sim_data(), true);
     p.writeInt32 (0);
@@ -1128,8 +1127,8 @@
     findCellularName(line);
     sprintf(cmd, "connmanctl disconnect %s", csname);
     int ret = system(cmd);
-    memset(line, LEN*sizeof(char), 0);
-    memset(line, 27*sizeof(char), 0);
+    memset(line, 0, LEN*sizeof(char));
+    memset(csname, 0, 27*sizeof(char));
     updataDataConnectState(get_default_sim_data(), false);
     p.writeInt32 (0);
     p.writeInt32 (pRI->pCI->requestNumber);
diff --git a/framework/lynq-ril-service/src/data/data_gdbus.cpp b/framework/lynq-ril-service/src/data/data_gdbus.cpp
index 6f6e7ec..39fc469 100755
--- a/framework/lynq-ril-service/src/data/data_gdbus.cpp
+++ b/framework/lynq-ril-service/src/data/data_gdbus.cpp
@@ -449,6 +449,8 @@
     {
         if(urc_response.pdnState == RIL_Data_Call_PdnState::PDN_DISCONNECTED) {
             notifyDataSignal();
+        } else if (urc_response.pdnState == RIL_Data_Call_PdnState::PDN_FAILED) {
+            updataDataConnectState(get_default_sim_data(), false);
         }
     }
     return;
@@ -498,5 +500,6 @@
     if(loop != NULL) {
         g_main_loop_unref(loop);
     }
+    return NULL;
 }
 
diff --git a/framework/lynq-ril-service/src/ecall/eCall.cpp b/framework/lynq-ril-service/src/ecall/eCall.cpp
index db0efac..3e9fed8 100755
--- a/framework/lynq-ril-service/src/ecall/eCall.cpp
+++ b/framework/lynq-ril-service/src/ecall/eCall.cpp
@@ -171,14 +171,18 @@
 
 void setEcallAudioPathOn(bool on) {
     RLOGD("%s() , is_ecall_audio_path: %d, on: %d", __FUNCTION__, is_ecall_audio_path, on);
-    if((is_ecall_audio_path != on) && isEcallAutoanswerTimerFinish()) {
+
+    if((is_ecall_audio_path != on) && (isEcallAutoanswerTimerFinish())) {
         is_ecall_audio_path = on;
     }
+    RLOGD("%s() , is_ecall_audio_path: %d", __FUNCTION__, is_ecall_audio_path);
 }
 
 void autoAnswerEcall(bool on) {
-    RLOGD("%s: on: %d", __FUNCTION__, on);
-    setEcallAudioPathOn(on);
+    RLOGD("%s() , is_ecall_audio_path: %d, on: %d", __FUNCTION__, is_ecall_audio_path, on);
+    if(is_ecall_audio_path != on) {
+        is_ecall_audio_path = on;
+    }
     if(on) {
         char* argv[2] = {"", "1"};
         autoAnswerCall(2, argv, RIL_SOCKET_ID(0), NULL); //unused socket id;
@@ -193,6 +197,7 @@
     fast_argc = argc;
     fast_argv.clear();
     for(int i = 0; i < argc; i++) {
+        RLOGD("fast_argv[%d] = %s", i, (argv[i]==NULL)? "NULL":argv[i]);
         fast_argv.push_back(argv[i]);
     }
 }
@@ -537,7 +542,7 @@
   uint8_t uct;
   int digitLimit;
   char *msd_data_src = (char *) argv[2];
-  unsigned char msd_data_dst[MSD_MAX_LENGTH];
+  unsigned char msd_data_dst[MSD_MAX_LENGTH] = {0};
   int len = strlen(msd_data_src);
 
   if (argc < 2 || argv[2] == NULL || len % 2 == 1) {
@@ -1120,6 +1125,7 @@
     //resend
     resendnum++;
     start_ecll_timer(gostResendMsdTimer, gost_resend_msd_value, gost_interval);
+    return 1;
 }
 
 int T7GostEcallSmsMsd(sigval_t sig) {
@@ -1130,6 +1136,9 @@
 
     if((sig.sival_int != sT7_sig_value) && (sig.sival_int != sT5_sig_value))
     {
+        if(argv) {
+            delete []argv;
+        }
         return -1;
     }
 
@@ -1140,11 +1149,18 @@
         utils::mtk_property_get(PROP_ECALL_TEST_CASE, testCase, "test");
         if(strcmp(testCase, "33470") == 0)
         {
+            if(argv) {
+                delete []argv;
+            }
             RLOGD("%s:testCase(%s) not need send sms", __FUNCTION__, testCase);
             return -1;
         }
 
-        if(fast_argv.size() < 6) {
+
+        if(fast_argv.size() < 5) {
+            if(argv) {
+                delete []argv;
+            }
             RLOGD("%s:testCase(%s) fast_argv size(%d) is not right", __FUNCTION__, testCase,fast_argv.size());
             return -1;
         }
@@ -1155,8 +1171,8 @@
             argv[i][fast_argv[i].size()] = '\0';
         }
 
-        printf("num:%s, data:%s\n", argv[4], argv[5]);
-        char *msd_data_src = (char *)argv[5];
+        RLOGD("num:%s, data:%s\n", argv[3], argv[4]);
+        char *msd_data_src = (char *)argv[4];
         int len = strlen(msd_data_src);
         std::shared_ptr<SslpManager> manager = std::make_shared<SslpManager>();
         std::string data = manager->encodeAllRecords(service_support_layer_protocol::EGTS_ECALL_SERVICE,
@@ -1164,11 +1180,11 @@
                 EcallUtils::EGTS_SR_RAW_MSD_DATA,
                 msd_data_src);
         //encode
-        printf("T7:data.c_str():%s\n", data.c_str());
+        RLOGD("T7:data.c_str():%s\n", data.c_str());
         int pt = GOST_EGTS_PT_APPDATA;
         gostTransferLayerEncode(msd, 0, const_cast<char*> (data.c_str()), pt, sizeof(msd));
-        printf("T7:msd:%s\n", msd);
-        gostSendSmsForMsd(fast_ecall_socket_id, argv[4], msd);
+        RLOGD("T7:msd:%s\n", msd);
+        gostSendSmsForMsd(fast_ecall_socket_id, argv[3], msd);
         for(int i=0; i < fast_argv.size(); i++) {
             delete [] argv[i];
         }
@@ -1177,6 +1193,9 @@
         return 0;
     }
 
+    if(argv) {
+        delete []argv;
+    }
     return -1;
 }
 
@@ -1192,8 +1211,9 @@
         return 0;
     }
 
-    int argc = 6;
-    char *argv[6];
+    int argc = 5;
+    char *argv[5];
+    argv[0] = "RIL_REQUEST_ECALL_FAST_MAKE_ECALL";
     if(ecalltype)
     {
         argv[1] = "2";//1:Manual 2:auto
@@ -1203,9 +1223,9 @@
         argv[1] = "1";//1:Manual 2:auto
     }
     argv[2] = "2";    //1:test ecall 2:Emergency eCall 3:Reconfiguration eCall
-    argv[3] = "1";    //1:Pull mode 2:push mode
-    argv[4] = num;
-    argv[5] = msd;
+//    argv[3] = "1";    //1:Pull mode 2:push mode
+    argv[3] = num;
+    argv[4] = msd;
     dialFastEcall(argc, argv, (RIL_SOCKET_ID)(soc_id), pRI);
     return 0;
 }
@@ -1215,7 +1235,7 @@
     char msd[512] = {0};
     char sdata[512] = {0};
     char server_data[512] = {0};
-    int server_len;
+    int server_len = 0;
     int parseStatus;
     gost_transfer_head_t stransferHead;
 
@@ -1243,7 +1263,7 @@
             CmdUtils::EGTS_SR_COMMAND_DATA,
             cmd,
             (parseStatus == GOST_OK));
-    strncpy(sdata, sslp_ack.c_str(), 512);
+    strncpy(sdata, sslp_ack.c_str(), 512 - 1);
     int pt = GOST_EGTS_PT_RESPONSE;
     gostResponseTypeSfrdEncode(sdata, stransferHead, parseStatus);
     gostTransferLayerEncode(msd, 0, sdata, pt, sizeof(msd));
@@ -1262,7 +1282,7 @@
             char ecallNum[64] = {0};
             if(fast_argv.size() > 4)
             {
-                strcpy(ecallNum, fast_argv[4].c_str());
+                strcpy(ecallNum, fast_argv[3].c_str());
             }
             gostInitEcallViaSms(soc_id, ecallNum, ecalltype, msd_data);
         } else if(cmd == EcallUtils::EGTS_ECALL_MSD_REQ) {
diff --git a/framework/lynq-ril-service/src/ecall/gost/utils/GostEcallUtils.cpp b/framework/lynq-ril-service/src/ecall/gost/utils/GostEcallUtils.cpp
index 1b6989e..301e622 100755
--- a/framework/lynq-ril-service/src/ecall/gost/utils/GostEcallUtils.cpp
+++ b/framework/lynq-ril-service/src/ecall/gost/utils/GostEcallUtils.cpp
@@ -188,6 +188,8 @@
     }
     default: {
         MTK_RLOGW("error");
+        delete [] hex;
+        hex = NULL;
         return "";
     }
     }
diff --git a/framework/lynq-ril-service/src/em/em.cpp b/framework/lynq-ril-service/src/em/em.cpp
index 5af9d17..4a8c7ef 100755
--- a/framework/lynq-ril-service/src/em/em.cpp
+++ b/framework/lynq-ril-service/src/em/em.cpp
@@ -74,8 +74,10 @@
 };
 em_arry_t ims_common[] = {
     {"operator_code",2,ims_setting,0,0},
+#ifndef TARGET_PLATFORM_MT2735
     {"sms_support",2,ims_setting,0,0},
     {"voice_support",2,ims_setting,0,0}
+#endif
 };
 em_arry_t ims_call[] = {
     {"UA_call_codec_order1",2,ims_setting,0,0},
diff --git a/framework/lynq-ril-service/src/em/em_hspa.cpp b/framework/lynq-ril-service/src/em/em_hspa.cpp
index 3e9638a..a2df7c5 100755
--- a/framework/lynq-ril-service/src/em/em_hspa.cpp
+++ b/framework/lynq-ril-service/src/em/em_hspa.cpp
@@ -100,11 +100,13 @@
         atLine->atTokStart(&err);
         if (err < 0) {
             RLOGW("this is not a valid response string");
+            delete atLine;
             return;
         }
         int mode = atLine->atTokNextint(&err);
         if (err < 0) {
             RLOGW("parse rat fail");
+            delete atLine;
             return;
         }
         showHspa(mode);
diff --git a/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTest.cpp b/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTest.cpp
index 26759a1..172ba35 100755
--- a/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTest.cpp
+++ b/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTest.cpp
@@ -1004,6 +1004,7 @@
         std::shared_ptr<RfDesenseTxTestLte> tdd = std::make_shared<
                 RfDesenseTxTestLte>(utils::MODEM_LTE_TDD);
         tdd->show_default();
+#ifdef C2K_SUPPORT
     } else if ((standard == sub_tx_test[INDEX_CDMA_EVDO].name)
             && utils::isC2KSupport()) {
         //CDMA(EVDO)
@@ -1016,6 +1017,7 @@
         std::shared_ptr<RfDesenseTxTestCdma> cdma_1x = std::make_shared<
                 RfDesenseTxTestCdma>(utils::MODEM_CDMA_1X);
         cdma_1x->show_default();
+#endif
     } else {
         LOG_D(LOG_TAG, "invaild INPUT");
         return false;
@@ -1051,6 +1053,7 @@
     } else if (standard == sub_tx_test[INDEX_LTE_TDD].name) {
         //LTE(TDD)
         handle_lte_tdd_para(name, last_pos, sub_name);
+#ifdef C2K_SUPPORT
     } else if ((standard == sub_tx_test[INDEX_CDMA_EVDO].name)
             && utils::isC2KSupport()) {
         //CDMA(EVDO)
@@ -1059,6 +1062,7 @@
             && utils::isC2KSupport()) {
         //CDMA(1X)
         handle_cdma_1X_para(name, last_pos, sub_name);
+#endif
     } else {
         LOG_D(LOG_TAG, "invaild INPUT");
         return false;
@@ -1084,6 +1088,7 @@
     } else if (standard == sub_tx_test[INDEX_LTE_TDD].name) {
         //LTE(TDD)
         mRatList[INDEX_LTE_TDD]->setRatCheckState(true);
+#ifdef C2K_SUPPORT
     } else if ((standard == sub_tx_test[INDEX_CDMA_EVDO].name)
             && utils::isC2KSupport()) {
         //CDMA(EVDO)
@@ -1092,6 +1097,7 @@
             && utils::isC2KSupport()) {
         //CDMA(1X)
         mRatList[INDEX_CDMA_1X]->setRatCheckState(true);
+#endif
     } else {
         LOG_D(LOG_TAG, "invaild INPUT");
         return false;
diff --git a/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTestGsm.cpp b/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTestGsm.cpp
index 793e99f..e09fea1 100755
--- a/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTestGsm.cpp
+++ b/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTestGsm.cpp
@@ -285,9 +285,9 @@
 void RfDesenseTxTestGsm::show_default() {
     int band_index = utils::find_index(band_values, band);
     int pattern_index = std::stoi(pattern);
-    std::string temp = "GSM parameter: Band: " + std::string(rfdesense_gsm_band[band_index].name) +
+    std::string temp = "GSM parameter: Band: " + std::string(rfdesense_gsm_band[band_index > 5 ? 0 : band_index].name) +
             ", Channel(ARFCN): " + channel + ", Power Level: " + power + ", AFC: " + afc + ", TSC: " + tsc +
-            ", PATTERN: " + std::string(rfdesense_gsm_pattern[pattern_index].name);
+            ", PATTERN: " + std::string(rfdesense_gsm_pattern[pattern_index > 6 ? 0 : pattern_index].name);
     emResultNotifyWithDone(temp);
 }
 
diff --git a/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTestTd.cpp b/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTestTd.cpp
index f945a71..3693061 100755
--- a/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTestTd.cpp
+++ b/framework/lynq-ril-service/src/em/rfdesense/RfDesenseTxTestTd.cpp
@@ -211,11 +211,23 @@
     std::string temp;
     if(modem_type == utils::MODEM_TDSCDMA){
         int band_index = utils::find_index(tdscdma_band_values, band);
-        temp = "TDSCDMA parameters: Band: " + std::string(rfdesense_tdscdma_band[band_index].name) +
+        int index = 0;
+        if(band_index < 2 && band_index > -1) {
+            index = band_index;
+        } else {
+            index = 0;
+        }
+        temp = "TDSCDMA parameters: Band: " + std::string(rfdesense_tdscdma_band[index].name) +
             ", Channel(ARFCN): " + channel + ", Power Level(dBm): " + power;
     } else if(modem_type == utils::MODEM_WCDMA) {
         int band_index = utils::find_index(wcdma_band_values, band);
-        temp = "WCDMA parameters: Band: " + std::string(rfdesense_wcdma_band[band_index].name) +
+        int index = 0;
+        if(band_index < 18 && band_index > -1) {
+            index = band_index;
+        } else {
+            index = 0;
+        }
+        temp = "WCDMA parameters: Band: " + std::string(rfdesense_wcdma_band[index].name) +
             ", Channel(ARFCN): " + channel + ", Power Level(dBm): " + power;
     }
     if(!temp.empty()) {
diff --git a/framework/lynq-ril-service/src/include/libtel/lib_tele.h b/framework/lynq-ril-service/src/include/libtel/lib_tele.h
deleted file mode 100755
index 455c08c..0000000
--- a/framework/lynq-ril-service/src/include/libtel/lib_tele.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _LIB_TEL_H_
-#define _LIB_TEL_H_
-#include <sys/types.h>
-#include <vendor-ril/telephony/ril.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef struct{
-    int32_t token;
-    int32_t request;
-    RIL_Errno e;
-}lynqBase;
-typedef enum {
- SUCCESS = 0,
- ERROR = 1,
-}RIL_Errcode;
-void lynq_ril_init();
-void lynq_ril_deinit(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/framework/lynq-ril-service/src/include/libtel/lynq_call.h b/framework/lynq-ril-service/src/include/libtel/lynq_call.h
deleted file mode 100755
index 5066d9d..0000000
--- a/framework/lynq-ril-service/src/include/libtel/lynq_call.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright Statement:
- *
- * This software/firmware and related documentation ("MediaTek Software") are
- * protected under relevant copyright laws. The information contained herein
- * is confidential and proprietary to MediaTek Inc. and/or its licensors.
- * Without the prior written permission of MediaTek inc. and/or its licensors,
- * any reproduction, modification, use or disclosure of MediaTek Software,
- * and information contained herein, in whole or in part, shall be strictly prohibited.
- */
-/* MediaTek Inc. (C) 2010. All rights reserved.
- *
- * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
- * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
- * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
- * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
- * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
- * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * The following software/firmware and/or related documentation ("MediaTek Software")
- * have been modified by MediaTek Inc. All revisions are subject to any receiver's
- * applicable license agreements with MediaTek Inc.
- */
-#ifndef LYNQ_CALL_H
-#define LYNQ_CALL_H 1
-#include "lib_tele.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define LYNQ_PHONE_NUMBER_MAX 32
-#define INDEX_IS_NUMBER( alpha_char )   \
-   ( ( (alpha_char >= '0') && (alpha_char <= '9') ) ? 1 : 0 )
- typedef enum {
-     LYNQ_CALL_ACTIVE = 0,
-     LYNQ_CALL_HOLDING = 1,
-     LYNQ_CALL_DIALING = 2,    /* MO call only */
-     LYNQ_CALL_ALERTING = 3,   /* MO call only */
-     LYNQ_CALL_INCOMING = 4,   /* MT call only */
-     LYNQ_CALL_WAITING = 5       ,/* MT call only */
-     LYNQ_CALL_DACTIVE=6
- } lynqCallState;
-
- typedef struct
-{
-    lynqBase base;
-    int call_id;
-    lynqCallState call_state;
-    int toa;
-    char * addr;
-}lynqCallList;
-typedef struct
-{
-    lynqBase base;
-    RIL_LastCallFailCause cause_code;
-    char * vendor_cause;
-}lynqLastCallFailCause;
-typedef int (*lynq_incoming_call_cb)(RIL_SOCKET_ID soc_id,int index, char addr[], int callState, int toa);
-int lynq_init_call(lynq_incoming_call_cb call_cb);
-int lynq_call(const char *addr,lynqCallList *msg);
-int lynq_call_answer(lynqCallList* msg);
-int lynq_call_hang_up(const int callId,lynqBase *base);
-int lynq_reject_call(lynqBase *base);
-int lynq_set_auto_answercall(int mode,int *status);
-int lynq_get_mute_status(int *status);
-int lynq_set_mute_mic(const int enable,int *status);
-int lynq_set_DTMF(const char callnum,lynqBase *base);
-int lynq_set_DTMF_volume(const int volume);
-int lynq_do_multi_conference(lynqCallList *msg);
-int lynq_othercall_hold(const int callindex,lynqBase *base);
-int lynq_hangup_wating_for_call(lynqCallList *msg);
-int lynq_hangup_foreground_resume_background(lynqCallList *msg);
-int lynq_switch_hold_and_active_call(lynqCallList *msg);
-int lynq_get_last_call_fail_cause(lynqLastCallFailCause *msg);
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/framework/lynq-ril-service/src/include/libtel/lynq_call_ext.h b/framework/lynq-ril-service/src/include/libtel/lynq_call_ext.h
deleted file mode 100755
index 8fe201e..0000000
--- a/framework/lynq-ril-service/src/include/libtel/lynq_call_ext.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright Statement:
- *
- * This software/firmware and related documentation ("MediaTek Software") are
- * protected under relevant copyright laws. The information contained herein
- * is confidential and proprietary to MediaTek Inc. and/or its licensors.
- * Without the prior written permission of MediaTek inc. and/or its licensors,
- * any reproduction, modification, use or disclosure of MediaTek Software,
- * and information contained herein, in whole or in part, shall be strictly prohibited.
- */
-/* MediaTek Inc. (C) 2010. All rights reserved.
- *
- * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
- * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
- * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
- * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
- * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
- * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * The following software/firmware and/or related documentation ("MediaTek Software")
- * have been modified by MediaTek Inc. All revisions are subject to any receiver's
- * applicable license agreements with MediaTek Inc.
- */
-#ifndef LYNQ_CALL_EXT_H
-#define LYNQ_CALL_EXT_H 1
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int lynq_voice_dial(const char *num);
-int lynq_voice_answer();
-int lynq_reject_call_ext();
-int lynq_call_hang_up_ext();
-int lynq_get_spk_modem_volume();
-int lynq_set_spk_modem_volume(int volume);
-int lynq_set_call_mute(int mute);
-int lynq_get_call_mute();
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/framework/lynq-ril-service/src/include/libtel/lynq_data.h b/framework/lynq-ril-service/src/include/libtel/lynq_data.h
deleted file mode 100755
index 304f3aa..0000000
--- a/framework/lynq-ril-service/src/include/libtel/lynq_data.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef LYNQ_DATA_H
-#define LYNQ_DATA_H 1
-#include <vendor-ril/telephony/ril.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define LYNQ_PDP_TYPE_MAX_LEN 16
-#define LYNQ_IFACE_NAME_MAX_LEN 50
-#define LYNQ_APN_MAX_LEN 50
-#define LYNQ_APN_TYPE_MAX_LEN 50
-#define LYNQ_PDP_ADDR_MAX_LEN 64
-#define LYNQ_DNS_ADDR_MAX_LEN 64
-#define LYNQ_GETWAYS_ADDR_MAX_LEN 64
-#define LYNQ_POXY_ADDR_MAX_LEN 64
-
-typedef struct {
-    int            status;     /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
-    int            suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
-                                           back-off timer value RIL wants to override the one
-                                           pre-configured in FW.
-                                           The unit is miliseconds.
-                                           The value < 0 means no value is suggested.
-                                           The value 0 means retry should be done ASAP.
-                                           The value of INT_MAX(0x7fffffff) means no retry. */
-    int            cid;        /* Context ID, uniquely identifies this call */
-    int            active;     /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
-    char           type[LYNQ_PDP_TYPE_MAX_LEN];       /* One of the PDP_type values in TS 27.007 section 10.1.1.
-                                   For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
-                                   PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
-                                   such as "IP" or "IPV6" */
-    char           ifname[LYNQ_IFACE_NAME_MAX_LEN];     /* The network interface name */
-    char           addresses[LYNQ_PDP_ADDR_MAX_LEN];  /* A space-delimited list of addresses with optional "/" prefix length,
-                                   e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
-                                   May not be empty, typically 1 IPv4 or 1 IPv6 or
-                                   one of each. If the prefix length is absent the addresses
-                                   are assumed to be point to point with IPv4 having a prefix
-                                   length of 32 and IPv6 128. */
-    char           dnses[LYNQ_DNS_ADDR_MAX_LEN];      /* A space-delimited list of DNS server addresses,
-                                   e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
-                                   May be empty. */
-    char           gateways[LYNQ_GETWAYS_ADDR_MAX_LEN];   /* A space-delimited list of default gateway addresses,
-                                   e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
-                                   May be empty in which case the addresses represent point
-                                   to point connections. */
-    char           pcscf[LYNQ_POXY_ADDR_MAX_LEN];    /* the Proxy Call State Control Function address
-                                 via PCO(Protocol Configuration Option) for IMS client. */
-    int            mtu;        /* MTU received from network
-                                   Value <= 0 means network has either not sent a value or
-                                   sent an invalid value */
-} LYNQ_Data_Call_Response_v11;
-/*Warren add for T800 platform start 2021/11/10*/
-typedef int (*lynq_data_call_state_cb)(char apn[LYNQ_APN_MAX_LEN],char apnType[LYNQ_APN_TYPE_MAX_LEN],int pdnState,char ifaceName[LYNQ_IFACE_NAME_MAX_LEN]);
-int lynq_init_data(lynq_data_call_state_cb data_cb);
-int lynq_setup_data_call(int *handle,char ifaceName[],RIL_Errno *err_code);
-int lynq_deactive_data_call(int *handle,RIL_Errno *err_code);
-int lynq_setup_data_call_sp(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol,char ifaceName[],RIL_Errno *err_code);
-int lynq_deactive_data_call_sp(int *handle,char *apnType,RIL_Errno *err_code);
-/*Warren add for T800 platform end 2021/11/10*/
-int lynq_get_data_call_list(LYNQ_Data_Call_Response_v11 **dataCallList,const int listNum,int *realNum);
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/framework/lynq-ril-service/src/include/libtel/lynq_network.h b/framework/lynq-ril-service/src/include/libtel/lynq_network.h
deleted file mode 100755
index 9408e5b..0000000
--- a/framework/lynq-ril-service/src/include/libtel/lynq_network.h
+++ /dev/null
@@ -1,135 +0,0 @@
-#include "lib_tele.h"
-#ifndef __LYNQ_NETWORK__
-#define __LYNQ_NETWORK__
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef struct{
-    lynqBase base;
-    char *OperatorFN;    //It is long alpha ONS or EONS
-    char *OperatorSH;    //It is short alpha ONS or EONS
-    char *MccMnc;        //It is 5 or 6 digit numeric code (MCC + MNC)
-}operatorInfo;
-typedef struct{
-    lynqBase base;
-    char *OperatorFN;
-    char *OperatorSH;
-    char *MccMnc;
-    char * NetStatus;   //a string value of the status: "unknown","available","current","forbidden"
-}availableNetwork;
-
-typedef struct{
-    lynqBase base;
-    int mode;
-}networkSelecttionMode;
-typedef struct{
-    lynqBase base;
-    int     regState;               //registration state
-    int     imsRegState;
-    char *  LAC;                    //location area code, it is LAC if registered or NULL id not
-    char *  CID;                    //cell identifier, if registered or NULL id not.
-    RIL_RadioTechnology netType;    //network type
-    RIL_RadioTechnologyFamily radioTechFam;//RIL_RadioTechnologyFamily
-}registrationStateInfo;
-
-typedef struct{
-    lynqBase base;
-    RIL_RadioTechnology radioTech;
-}radioTechnology;
-
-typedef struct{
-    lynqBase base;
-    int pnt; //preffered network type.
-}prefferredNetworkType;
-typedef struct{
-    lynqBase base;
-    char *cid;
-    int rssi;
-}neighboringCellIDs;
-typedef struct{
-    lynqBase base;
-    int bandmode[20];
-}availableBandMode;
-typedef struct{
-    lynqBase base;
-    RIL_CellInfo cellinfo;
-}cellInfoList;
-typedef struct{
-    lynqBase base;
-    RIL_SignalStrength_v14 signalStrength;
-}solicitedSignalStrength;
-
-/*T800 platform support gsm,wcdma lte,nr */
-typedef struct{
-    int gw_sig_valid; /*1 valid,1 invalid*/
-    int rssi;         /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
-    int wcdma_sig_valid;/*1 valid,0 invalid*/
-    int rscp;        /* The Received Signal Code Power in dBm multipled by -1.
-                      * Range : 25 to 120
-                      * INT_MAX: 0x7FFFFFFF denotes invalid value.
-                      * Reference: 3GPP TS 25.123, section 9.1.1.1 */
-    int ecno;        /* Valid values are positive integers.  This value is the actual Ec/Io multiplied
-                      * by -10.  Example: If the actual Ec/Io is -12.5 dB, then this response value
-                      * will be 125.*/
-    int lte_sig_valid;/*1 valid,0 invalid*/
-    int rsrp;        /* The current Reference Signal Receive Power in dBm multipled by -1.
-                      * Range: 44 to 140 dBm
-                      * INT_MAX: 0x7FFFFFFF denotes invalid value.
-                      * Reference: 3GPP TS 36.133 9.1.4 */
-    int rsrq;        /* The current Reference Signal Receive Quality in dB multiplied by -1.
-                      * Range: 20 to 3 dB.
-                      * INT_MAX: 0x7FFFFFFF denotes invalid value.
-                      * Reference: 3GPP TS 36.133 9.1.7 */
-    int rssnr;       /* The current reference signal signal-to-noise ratio in 0.1 dB units.
-                      * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
-                      * INT_MAX : 0x7FFFFFFF denotes invalid value.
-                      * Reference: 3GPP TS 36.101 8.1.1 */
-    int nr_sig_valid;/*1 valid,0 invalid*/
-    int ssRsrp;      /* SS(Synchronization Signal) reference signal received power, multipled by -1.
-                      * Reference: 3GPP TS 38.215.
-                      * Range [44, 140], INT_MAX means invalid/unreported.*/
-    int ssRsrq;      /* SS reference signal received quality, multipled by -1.
-                      * Reference: 3GPP TS 38.215.
-                      * Range [3, 20], INT_MAX means invalid/unreported.*/
-    int ssSinr;      /* SS signal-to-noise and interference ratio.
-                      * Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
-                      * Range [-23, 40], INT_MAX means invalid/unreported.*/
-    int csiRsrp;     /* CSI reference signal received power, multipled by -1.
-                      * Reference: 3GPP TS 38.215.
-                      * Range [44, 140], INT_MAX means invalid/unreported.*/
-    int csiRsrq;     /* CSI reference signal received quality, multipled by -1.
-                      * Reference: 3GPP TS 38.215.
-                      * Range [3, 20], INT_MAX means invalid/unreported.*/
-    int csiSinr;     /* CSI signal-to-noise and interference ratio.
-                      * Reference: 3GPP TS 138.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
-                      * Range [-23, 40], INT_MAX means invalid/unreported.*/
-}signalStrength_t;
-typedef void (*lynq_signal_strength_change_ind)(int slot,signalStrength_t signalStrength);
-typedef void (*lynq_voice_network_state_change_ind)(int slot);
-int lynq_signal_strength_change_cb(lynq_signal_strength_change_ind signalStrength_cb);
-int lynq_voice_network_state_change_cb(lynq_voice_network_state_change_ind voiceChange_cb);
-int lynq_query_operater(operatorInfo * currentOperator);
-int lynq_query_network_selection_mode(networkSelecttionMode *netselMode);
-int lynq_set_network_selection_mode(const char *mode,const char* mccmnc,lynqBase * base);
-int lynq_query_available_network(availableNetwork *availNet);
-int lynq_query_registration_state(const char *type,registrationStateInfo *regStateInfo);
-int lynq_query_prefferred_networktype(prefferredNetworkType * preNetType);
-int lynq_set_prefferred_networktype(const int preffertype,lynqBase * base);
-int lynq_query_cell_info(cellInfoList * * cellinfo, int listNum, int * realNum);
-int lynq_set_unsol_cell_info_listrate(const int rate,lynqBase * base);
-int lynq_query_neighboring_cellids(neighboringCellIDs **neiCeIDs,const int listNum,int *realNum);
-int lynq_set_band_mode(const int bandmode,lynqBase *base);
-int lynq_query_available_bandmode(availableBandMode*availBanMode);
-int lynq_radio_on(const int data,lynqBase *base);
-int lynq_query_radio_tech(radioTechnology *radioTech);
-int lynq_solicited_signal_strength(solicitedSignalStrength *solSigStren);
-int lynq_modem_on(const int data,lynqBase *base);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
diff --git a/framework/lynq-ril-service/src/include/libtel/lynq_sim.h b/framework/lynq-ril-service/src/include/libtel/lynq_sim.h
deleted file mode 100755
index 92d6063..0000000
--- a/framework/lynq-ril-service/src/include/libtel/lynq_sim.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*============================================================================= 
-#     FileName: lynq_sim.cpp
-#     Desc: about SIMAPI
-#     Author: mobiletek 
-#     Version: V1.0
-#     LastChange: 2020-07-29 
-#     History: 
-# If you need to use any API under lynq_sim, you must first call the init_sim() function to initialize these functions.
-=============================================================================*/
-#ifndef __LYNQ_SIM__
-#define __LYNQ_SIM__
-#include <sys/types.h>
-#include "lib_tele.h"
-#define MAX_BUF 20
-#define MAX_NUM 80
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef struct
-{
-    lynqBase base;
-    RIL_CardState card_status;
-    RIL_AppType  card_type;
-    RIL_PinState pin_state;
-}simStatus;
-
-typedef struct
-{
-    lynqBase base;
-    char imsi[MAX_BUF];
-    //char *imsi;
-}simImsi;
-
-typedef struct
-{
-    lynqBase base;
-    char iccid[MAX_BUF];
-}simIccid;
-
-typedef struct 
-{
-    lynqBase base;
-    int state[MAX_BUF];
-    char buf[MAX_BUF];
-}simOperate;
-
-typedef struct 
-{
-    lynqBase base;
-    char number[MAX_NUM];
-}simNumber;
-
-typedef struct 
-{
-    lynqBase base;
-    char MCCMNC[MAX_BUF];
-    char buf[MAX_BUF];
-}simOperator;
-
-int init_sim();
-int lynq_get_sim_status(int *card_status);
-int lynq_get_imsi(char buf[]);
-
-/*add by lei*/
-int lynq_sim_init(void);
-int lynq_sim_deinit(void);
-int lynq_enable_pin(char *pin);
-int lynq_disable_pin(char *pin);
-int lynq_query_operator(char buf[]);
-int lynq_get_iccid(char buf[]);
-int lynq_query_pin_lock(char *pin,char buf[]);
-int lynq_verify_pin(char *pin);
-int lynq_change_pin(char *old_pin, char *new_pin);
-int lynq_unlock_pin(char *puk, char *pin);
-int lynq_query_phone_number(char buf[]);
-/*add by lei*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/framework/lynq-ril-service/src/include/libtel/lynq_sms.h b/framework/lynq-ril-service/src/include/libtel/lynq_sms.h
deleted file mode 100755
index cc7d57b..0000000
--- a/framework/lynq-ril-service/src/include/libtel/lynq_sms.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*============================================================================= 
-#     FileName: lynq_sms.h
-#         Desc: about sms api
-#       Author: zhouqunchao 
-#      Version:  
-#   LastChange: 2020-07-29 
-#      History: 
- 
-=============================================================================*/
-
-#ifndef YLNQ_SMS_H
-#define YLNQ_SMS_H 1
-#include <sys/types.h>
-#include "lib_tele.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define MIN_MSM_PARAM_NUM 4
-#define MIN_IMS_MSM_PARAM_NUM 6
-#define MIN_WRITE_MSM_PARAM_NUM 5
-#define MSG_MAX_LEN 1024
-#define TELEPHONE_NUM_LEN 64
-#define STORAGE_SMS_MAX_SIZE 128
-#define SMSC_MAX_LEN 22
-
-enum{
-    SMS_OK = 0,
-    SMS_FAIL,
-    SMS_PARAM_ERR
-};
-
-typedef struct {
-    char *telephonyNumber;
-    char *charset;
-    char *msg;
-    char *smsc;
-} SmsSendData;
-typedef struct{
-    lynqBase base;
-    RIL_SMS_Response smsResp;
-}smsResponse;
-typedef struct {
-    char *telephonyNumber;
-    char *charset;
-    char *msg;
-    char *retryNum;
-    char *messageRef;
-    char *smsc;
-} SmsImsSendData;
-
-typedef struct {
-    int  smsStatus; //UnRead\Read\UnSent\Sent
-    char *recPhonNum;
-    char *charset;
-    char *msg;
-    char *smsc;
-} SmsInfo;
-
-typedef struct{
-    lynqBase base;
-    int msgStoreIndex;
-}messageStoreInfo;
-
-typedef struct{
-    lynqBase base;
-    char *smsc;
-}smscCbInfo;
-typedef struct
-{
-    int index;          /*the index of sms in memory,0-255 */
-    int status;         /* 0:read, 1:unread */
-    int charset;        /* 0:7bit, 1:8bit, 2:16bit(chinese) */
-    char smsc[SMSC_MAX_LEN];    /* smsc address */
-    int smscLen;                /* smsc string  length */
-    int smslen;                 /* the length of sms,the maximum length shall not exceed the length specified in 3GGP protocol(160/70) */
-    char message[MSG_MAX_LEN];  /* sms content */
-    RIL_SOCKET_ID soc_id;
-    char teleNum[TELEPHONE_NUM_LEN];    /* telephony number */
-    int numLen;                         /* telephony number strings length */
-}lynq_sms_msg_info_t;
-
-typedef struct{
-    int index;              /*the index of sms in memory,0-255 */
-    int status;             /* 0:read, 1:unread */
-    uint64_t timestamp;     /* reciced message timestamp */
-    char telephone_num[TELEPHONE_NUM_LEN];    /* sender telephone number */
-}lynq_sms_info_t;
-
-typedef struct{
-    int num_msg;        /* numbers of messsage */
-    lynq_sms_info_t lynq_sms_info[STORAGE_SMS_MAX_SIZE];  /* message information */
-}lynq_sms_list_info_t;
-
-int lynq_Ims_send_sms(const char *telephonyNumber, const int charset,const char *msg, const char*retryNum,const char *messageRef, const char *smsc,smsResponse *smsResp);
-int lynq_write_sms_to_sim(const int smsStatus,const char *recPhonNum,const int charset,const char *msg,const char *smsc,messageStoreInfo *msgstroeInfo);
-int lynq_report_sms_memory_status(const int status,lynqBase *base);
-int lynq_delet_sms_on_sim(const int index,lynqBase *base);
-int lynq_store_sms_to_memory(RIL_SOCKET_ID soc_id,const int status,char * num,const char* sms,lynqBase *base);
-int lynq_get_sms_from_memory(const int index, lynq_sms_msg_info_t* sms,lynqBase *base);
-int lynq_delete_message_from_memory(const int index,lynqBase *base);
-
-typedef void (*lynq_recive_new_sms_cb)(RIL_SOCKET_ID soc_id,char * num, char * smsc, char * msg, int charset);
-int lynq_sms_init(lynq_recive_new_sms_cb cb);
-int lynq_sms_deinit(void);
-int lynq_send_sms(char *telephony_num, int charset, char *msg);
-int lynq_read_sms(int index, lynq_sms_msg_info_t *sms_msg_info);
-int lynq_get_smsc_address(const char *service_num, int size);
-int lynq_set_smsc_address(const char* service_num, int size);
-int lynq_list_sms(lynq_sms_list_info_t *lynq_sms_list);
-int lynq_delete_sms(int index);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/framework/lynq-ril-service/src/makefile b/framework/lynq-ril-service/src/makefile
index 0d72666..d6d78f6 100755
--- a/framework/lynq-ril-service/src/makefile
+++ b/framework/lynq-ril-service/src/makefile
@@ -10,7 +10,7 @@
                 -DKEEP_ALIVE \
                 -DECALL_SUPPORT
 
-$(warning ################# C2K support: $(RAT_CONFIG_C2K_SUPPORT) $(CXX))
+$(warning ################# C2K support: $(RAT_CONFIG_C2K_SUPPORT))
 ifeq ($(strip $(RAT_CONFIG_C2K_SUPPORT)), yes)
     LOCAL_CFLAGS += -DC2K_SUPPORT
 endif
diff --git a/framework/lynq-ril-service/src/network.cpp b/framework/lynq-ril-service/src/network.cpp
index 639f4c6..418e0d2 100755
--- a/framework/lynq-ril-service/src/network.cpp
+++ b/framework/lynq-ril-service/src/network.cpp
@@ -345,6 +345,7 @@
     signal_strength_printf=atoi(argv[1]);
     printf("\nthe signal strength printf log will %s\n", signal_strength_printf == 0 ? "close" : "open");
     free(pRI);
+    return 0;
 }
 //RIL_REQUEST_MODEM_POWEROFF
 int setModemPowerOFF (int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI) {
diff --git a/framework/lynq-ril-service/src/powerManager.cpp b/framework/lynq-ril-service/src/powerManager.cpp
index efa8f6d..b3a33fd 100755
--- a/framework/lynq-ril-service/src/powerManager.cpp
+++ b/framework/lynq-ril-service/src/powerManager.cpp
@@ -104,6 +104,7 @@
     }
     RLOGD("read_wakeup_reason is %s", buf);
     reason = buf;
+    buf[49]='\0';
 fail:
     close(fd);
     return reason;
diff --git a/framework/lynq-ril-service/src/ril.cpp b/framework/lynq-ril-service/src/ril.cpp
index 612d680..4e6b97f 100755
--- a/framework/lynq-ril-service/src/ril.cpp
+++ b/framework/lynq-ril-service/src/ril.cpp
@@ -78,7 +78,7 @@
 /*Warren add for t800 RIL service 2021_12_10 end*/
 
 #define LOG_TAG "DEMO_RIL"
-
+#define WAIT_TIME_FOR_SIM_SWITCH 30
 
 extern void ARspRequest (int request, RIL_SOCKET_ID socket_id);
 extern void responseDispatch();
@@ -559,7 +559,7 @@
 
     startRequest;
     for (int i = 0 ; i < count ; i++) {
-        int32_t t;
+        int32_t t = 0;
 
         status = p.readInt32(&t);
         pInts[i] = (int)t;
@@ -596,7 +596,7 @@
 static void
 dispatchSmsWrite (Parcel &p, RequestInfo *pRI) {
     RIL_SMS_WriteArgs args;
-    int32_t t;
+    int32_t t = -1;
     status_t status;
 
     RLOGD("dispatchSmsWrite");
@@ -648,7 +648,7 @@
     RIL_Dial dial;
     RIL_UUS_Info uusInfo;
     int32_t sizeOfDial;
-    int32_t t;
+    int32_t t = -1;
     int32_t uusPresent;
     status_t status;
 
@@ -754,7 +754,7 @@
         RIL_SIM_IO_v5 v5;
     } simIO;
 
-    int32_t t;
+    int32_t t = -1;
     int size;
     status_t status;
 
@@ -834,7 +834,7 @@
  */
 static void
 dispatchSIM_APDU (Parcel &p, RequestInfo *pRI) {
-    int32_t t;
+    int32_t t = -1;
     status_t status;
     RIL_SIM_APDU apdu;
 
@@ -907,7 +907,7 @@
 static void
 dispatchCallForward(Parcel &p, RequestInfo *pRI) {
     RIL_CallForwardInfo cff;
-    int32_t t;
+    int32_t t = -1;
     status_t status;
 
     RLOGD("dispatchCallForward");
@@ -1003,7 +1003,7 @@
 
 static status_t
 constructCdmaSms(Parcel &p, RequestInfo *pRI, RIL_CDMA_SMS_Message& rcsm) {
-    int32_t  t;
+    int32_t  t = -1;
     uint8_t ut;
     status_t status;
     int32_t digitCount;
@@ -1250,7 +1250,7 @@
 static void
 dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI) {
     RIL_CDMA_SMS_Ack rcsa;
-    int32_t  t;
+    int32_t  t = -1;
     status_t status;
     int32_t digitCount;
 
@@ -1411,9 +1411,9 @@
 
 static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI) {
     RIL_CDMA_SMS_WriteArgs rcsw;
-    int32_t  t;
+    int32_t  t = -1;
     uint32_t ut;
-    uint8_t  uct;
+    uint8_t  uct = 0;
     status_t status;
     int32_t  digitCount;
     int32_t  digitLimit;
@@ -1542,7 +1542,7 @@
 static void dispatchSetInitialAttachApn(Parcel &p, RequestInfo *pRI)
 {
     RIL_InitialAttachApn pf;
-    int32_t  t;
+    int32_t  t = -1;
     status_t status;
 
     memset(&pf, 0, sizeof(pf));
@@ -1591,7 +1591,7 @@
 
 static void dispatchNVReadItem(Parcel &p, RequestInfo *pRI) {
     RIL_NV_ReadItem nvri;
-    int32_t  t;
+    int32_t  t = -1;
     status_t status;
 
     memset(&nvri, 0, sizeof(nvri));
@@ -1624,7 +1624,7 @@
 
 static void dispatchNVWriteItem(Parcel &p, RequestInfo *pRI) {
     RIL_NV_WriteItem nvwi;
-    int32_t  t;
+    int32_t  t = -1;
     status_t status;
 
     memset(&nvwi, 0, sizeof(nvwi));
@@ -1718,7 +1718,7 @@
 static void dispatchSimAuthentication(Parcel &p, RequestInfo *pRI)
 {
     RIL_SimAuthentication pf;
-    int32_t  t;
+    int32_t  t = -1;
     status_t status;
 
     memset(&pf, 0, sizeof(pf));
@@ -1844,7 +1844,7 @@
 
 static void dispatchRadioCapability(Parcel &p, RequestInfo *pRI){
     RIL_RadioCapability rc;
-    int32_t t;
+    int32_t t = -1;
     status_t status;
 
     memset (&rc, 0, sizeof(RIL_RadioCapability));
@@ -4084,8 +4084,9 @@
         case RIL_REQUEST_ALLOW_DATA:
         {
             if(utils::is_support_dsds() && isNeedConnect() && get_default_sim_data() == socket_id) {
-                RLOGD("recreate PDN with sim switch");
+                RLOGD("wait and recreate PDN with sim switch");
                 resetConnect();
+                sleep(WAIT_TIME_FOR_SIM_SWITCH);
                 setupDataCall(0, NULL, (RIL_SOCKET_ID)0, NULL);
             }
             break;
@@ -5232,7 +5233,7 @@
         RLOGD("init socket id: %d, %s", id, radioStateToString(radioState));
     }
     RLOGD("init socket id: %d, %s", id, radioStateToString(radioState));
-
+    updataDataConnectState(id, false);
     sendRequestToMd(RIL_REQUEST_GET_SIM_STATUS, id);
 
 #if 0
@@ -5807,7 +5808,7 @@
 RIL_StartRevSocket()
 {
     RLOGD("RIL_StartRevSocket start\n");
-    char *argv[MAX_ARGS];
+    char *argv[MAX_ARGS] = {0};
     int  argc = 0;
 
     prctl(PR_SET_NAME,(unsigned long)"UDP_Thr");
@@ -6121,6 +6122,10 @@
         break;
     }
     default:
+        if(pRI) {
+            free(pRI);
+            pRI = NULL;
+        }
         break;
     }
     return 0;
@@ -6141,6 +6146,10 @@
 
 void ATCIRequest(int request,char* reqString, void* t,int argc,char**argv)
 {
+    if(t == NULL) {
+        RLOGE("ATCIRequest t is null");
+        return;
+    }
     RequestInfo *pRI = (RequestInfo *)t;
     int waittoken;
     if (request < RIL_REQUEST_VENDOR_BASE) {
@@ -6148,8 +6157,13 @@
     } else {
         pRI->pCI = find_mtk_command(request);
     }
-    if(pRI->pCI == NULL)
+    if(pRI->pCI == NULL){
         RLOGE("pCI command not found!");
+        if(pRI) {
+            free(pRI);
+        }
+        return;
+    }
 
     if(utils::is_suppport_dsss()){
         pRI->socket_id = (RIL_SOCKET_ID)Phone_utils::get_enable_sim_for_dsss();
@@ -6165,6 +6179,10 @@
 
     if(command == NULL) {
         RLOGE("ATCI request command find error!");
+        if(pRI) {
+            free(pRI);
+        }
+        return;
     } else {
         RLOGE("ATCI request name is %s!",command->name);
     }
@@ -6373,7 +6391,7 @@
 
 void processUnsolicited (Parcel &p, int type)
 {
-    int32_t response;
+    int32_t response = -1;
     p.readInt32(&response);
     switch(response){
         case RIL_UNSOL_MAL_AT_INFO:
@@ -6411,6 +6429,7 @@
 }
 void processSolicited(Parcel &p, int type) {
     int32_t serial, error;
+    serial = 0;
     p.readInt32(&serial); //telematic it is the same as ril request num
     p.readInt32(&error);
     RLOGD("processSolicited serial %d\n", serial);
@@ -6545,7 +6564,7 @@
 static void dispatchFastEcall (Parcel &p, RequestInfo *pRI) {
     RIL_ECallReqMsg eCallReqMsg;
 
-    int32_t t;
+    int32_t t = -1;
     int size;
     status_t status;
     int digitCount;
@@ -6612,7 +6631,7 @@
 static void dispatchSetMsd (Parcel &p, RequestInfo *pRI) {
     RIL_ECallSetMSD eCallSetMsd;
 
-    int32_t t;
+    int32_t t = -1;
     int size;
     status_t status;
     int digitCount;
@@ -6670,7 +6689,7 @@
  */
 static void dispatchEcallRecord (Parcel &p, RequestInfo *pRI) {
     RIL_ECallSetNum args;
-    int32_t t;
+    int32_t t = -1;
     status_t status;
 
     RLOGD("dispatchSmsWrite");
@@ -6713,7 +6732,7 @@
 #ifdef KEEP_ALIVE
 static void dispatchStartKeepalivePro(Parcel &p, RequestInfo *pRI){
     RIL_RequestKeepalive_Pro kp;
-    int32_t t;
+    int32_t t = -1;
     status_t status;
     std::vector<uint8_t> sadr;
     std::vector<uint8_t> dadr;
diff --git a/framework/lynq-ril-service/src/sms/cdma/BearerData.cpp b/framework/lynq-ril-service/src/sms/cdma/BearerData.cpp
index fccbfbf..f3d829c 100755
--- a/framework/lynq-ril-service/src/sms/cdma/BearerData.cpp
+++ b/framework/lynq-ril-service/src/sms/cdma/BearerData.cpp
@@ -1384,7 +1384,7 @@
   }
   string strbuf;
   while (inStream->available() >= 6) {
-    strbuf.push_back(UserData::ASCII_MAP[inStream->read(6)]);
+    strbuf.push_back(UserData::ASCII_MAP[(inStream->read(6)) >= 95 ? 0 : (inStream->read(6))]);
   }
   string data = strbuf;
   bData->numberOfMessages = std::stoi(data.substr(0, 2));
@@ -1431,7 +1431,7 @@
   }
   string strbuf;
   for (int i = 0; i < numFields; i++) {
-    strbuf.push_back(UserData::ASCII_MAP[inStream->read(6)]);
+    strbuf.push_back(UserData::ASCII_MAP[(inStream->read(6)) >= 95 ? 0 : (inStream->read(6))]);
   }
   bData->userData->payloadStr = strbuf;
 }
diff --git a/framework/lynq-ril-service/src/sms/cdma/GsmAlphabet.cpp b/framework/lynq-ril-service/src/sms/cdma/GsmAlphabet.cpp
index d2f29b8..85f8d27 100755
--- a/framework/lynq-ril-service/src/sms/cdma/GsmAlphabet.cpp
+++ b/framework/lynq-ril-service/src/sms/cdma/GsmAlphabet.cpp
@@ -642,7 +642,7 @@
              i++, bitOffset += 7) {
         char c = data[i];
         auto v = charToLanguageTable->find(c);
-        int value;
+        int value = 0;
         if (v == charToLanguageTable->end()) {
             v = charToShiftTable->find(c);  // Lookup the extended char.
             if (v == charToShiftTable->end()) {
diff --git a/framework/lynq-ril-service/src/sms/cdma/HexDump.cpp b/framework/lynq-ril-service/src/sms/cdma/HexDump.cpp
index d18c2fa..13efbd6 100755
--- a/framework/lynq-ril-service/src/sms/cdma/HexDump.cpp
+++ b/framework/lynq-ril-service/src/sms/cdma/HexDump.cpp
@@ -120,7 +120,7 @@
 
 std::string HexDump::toHexString(std::vector<uint8_t> v) {
   int length = v.size();
-  uint8_t array[length];
+  uint8_t array[length] = {0};
   std::copy(v.begin(), v.end(), array);
   return toHexString(array, 0, length, true, false);
 }
diff --git a/framework/lynq-ril-service/src/sms/gsm/sms_pdu.cpp b/framework/lynq-ril-service/src/sms/gsm/sms_pdu.cpp
index a7b682b..81d07e3 100755
--- a/framework/lynq-ril-service/src/sms/gsm/sms_pdu.cpp
+++ b/framework/lynq-ril-service/src/sms/gsm/sms_pdu.cpp
@@ -2065,6 +2065,7 @@
         //printf("======%s\n", output);
     }
     //printf("\nutf8Buf:%s\n", utf8Buf);
+    return 0;
 }
 
 #define GOST_EGTS_PC_OK 0
@@ -2171,7 +2172,7 @@
     len = _smsbuf_hex_string(&smsbuf, output, out_len);
     //printf("1----%s,len:%d,%d\n", output, len, record.fdl * 2);
     strncat(output, sdata, record.fdl * 2);
-    kal_int8 sfrcs[2];
+    kal_int8 sfrcs[3]={0};
     sfrcs[0] = record.sfrcs >> 8 & 0x00ff;  //high bit
     sfrcs[1] = record.sfrcs & 0x00ff;   //low bit
     sprintf(sfrcs,"%02x%02x", sfrcs[1], sfrcs[0]);
diff --git a/framework/lynq-ril-service/src/sms/sms.cpp b/framework/lynq-ril-service/src/sms/sms.cpp
index fe11515..50af251 100755
--- a/framework/lynq-ril-service/src/sms/sms.cpp
+++ b/framework/lynq-ril-service/src/sms/sms.cpp
@@ -215,16 +215,15 @@
                 android::Parcel p;
                 size_t pos = p.dataPosition();
                 RequestInfo *pRI_backup = (RequestInfo *)calloc(1, sizeof(RequestInfo));
-                if(pRI_backup == NULL) {
-                    return 0;
+                if(pRI_backup != NULL) {
+                    pRI_backup->token = pRI->token;
+                    pRI_backup->pCI = pRI->pCI;
+                    pRI_backup->socket_id = pRI->socket_id;
+                    pRI_backup->p_next = pRI->p_next;
+                    constructGsmSendSmsRilRequest(p, smscPDU, pdu[index]);
+                    p.setDataPosition(pos);
+                    pRI->pCI->dispatchFunction(p, pRI_backup);
                 }
-                pRI_backup->token = pRI->token;
-                pRI_backup->pCI = pRI->pCI;
-                pRI_backup->socket_id = pRI->socket_id;
-                pRI_backup->p_next = pRI->p_next;
-                constructGsmSendSmsRilRequest(p, smscPDU, pdu[index]);
-                p.setDataPosition(pos);
-                pRI->pCI->dispatchFunction(p, pRI_backup);
             }
 
             for(index = 0; index < msg_num; index++){
@@ -306,19 +305,18 @@
                 android::Parcel p;
                 size_t pos = p.dataPosition();
                 RequestInfo *pRI_backup = (RequestInfo *)calloc(1, sizeof(RequestInfo));
-                if(pRI_backup == NULL) {
-                    return 0;
+                if(pRI_backup != NULL) {
+                    pRI_backup->token = pRI->token;
+                    pRI_backup->pCI = pRI->pCI;
+                    pRI_backup->socket_id = pRI->socket_id;
+                    pRI_backup->p_next = pRI->p_next;
+                    p.writeInt32(RADIO_TECH_3GPP);
+                    p.write(&retry, sizeof(retry));
+                    p.write(&messageRef, sizeof(messageRef));
+                    constructGsmSendSmsRilRequest(p, smscPDU, pdu[index]);
+                    p.setDataPosition(pos);
+                    pRI->pCI->dispatchFunction(p, pRI_backup);
                 }
-                pRI_backup->token = pRI->token;
-                pRI_backup->pCI = pRI->pCI;
-                pRI_backup->socket_id = pRI->socket_id;
-                pRI_backup->p_next = pRI->p_next;
-                p.writeInt32(RADIO_TECH_3GPP);
-                p.write(&retry, sizeof(retry));
-                p.write(&messageRef, sizeof(messageRef));
-                constructGsmSendSmsRilRequest(p, smscPDU, pdu[index]);
-                p.setDataPosition(pos);
-                pRI->pCI->dispatchFunction(p, pRI_backup);
             }
 
             for(index = 0; index < msg_num; index++){
@@ -407,18 +405,17 @@
                 android::Parcel p;
                 size_t pos = p.dataPosition();
                 RequestInfo *pRI_backup = (RequestInfo *)calloc(1, sizeof(RequestInfo));
-                if(pRI_backup == NULL) {
-                    return 0;
+                if(pRI_backup != NULL) {
+                    pRI_backup->token = pRI->token;
+                    pRI_backup->pCI = pRI->pCI;
+                    pRI_backup->socket_id = pRI->socket_id;
+                    pRI_backup->p_next = pRI->p_next;
+                    p.writeInt32(atoi(argv[1]));
+                    writeStringToParcel(p, (const char *)pdu[index]);
+                    writeStringToParcel(p, (const char *)smscPDU);
+                    p.setDataPosition(pos);
+                    pRI->pCI->dispatchFunction(p, pRI_backup);
                 }
-                pRI_backup->token = pRI->token;
-                pRI_backup->pCI = pRI->pCI;
-                pRI_backup->socket_id = pRI->socket_id;
-                pRI_backup->p_next = pRI->p_next;
-                p.writeInt32(atoi(argv[1]));
-                writeStringToParcel(p, (const char *)pdu[index]);
-                writeStringToParcel(p, (const char *)smscPDU);
-                p.setDataPosition(pos);
-                pRI->pCI->dispatchFunction(p, pRI_backup);
             }
 
             for(index = 0; index < msg_num; index++){
@@ -856,6 +853,7 @@
         size_t pos = p.dataPosition();
         RequestInfo *pRI_backup = (RequestInfo *)calloc(1, sizeof(RequestInfo));
         if(pRI_backup == NULL) {
+            free(pRI);
             return 0;
         }
         pRI_backup->token = pRI->token;
diff --git a/framework/lynq-ril-service/src/ss.cpp b/framework/lynq-ril-service/src/ss.cpp
index 78f0113..2a0ca3f 100755
--- a/framework/lynq-ril-service/src/ss.cpp
+++ b/framework/lynq-ril-service/src/ss.cpp
@@ -268,12 +268,14 @@
     {
         printf("iconv_open error\n");
         RLOGE("iconv_open error");
+        iconv_close(cd);
         return -1;
     }
     memset(dst_str, 0, dst_len);
     if(iconv(cd, pin, &src_len, pout, &dst_len) == -1){
         printf("format error or nosupport\n");
         RLOGE("format error or nosupport");
+        iconv_close(cd);
         return -1;
     }