Merge "[Bugfix][T106BUG-135]after gnss init,execute deinit immediately will caton. Only Configure:No; Affected branch:master; Affected module:Gnss; Is it affected on both ZXIC and MTK: only ZXIC; Self-test: Yes; Doc Update:No"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
index 333a235..d5acfcc 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
@@ -222,6 +222,7 @@
         mobiletek-tester-rdit \
         lynq-qser-voice-demo \
         lynq-qser-fota-demo \
+        lynq-qser-gnss-demo \
 	"
 
 zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/LICENSE b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/LICENSE
new file mode 100755
index 0000000..1b15bd2
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/LICENSE
@@ -0,0 +1,31 @@
+opyright Statement:
+
+This software/firmware and related documentation ("MobileTek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to MobileTek Inc. and/or its licensors. Without
+the prior written permission of MobileTek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of MobileTek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+MobileTek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MobileTek SOFTWARE")
+RECEIVED FROM MobileTek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. MobileTek 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 MobileTek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE MobileTek 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 MobileTek
+SOFTWARE. MobileTek SHALL ALSO NOT BE RESPONSIBLE FOR ANY MobileTek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MobileTek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MobileTek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT MobileTek'S OPTION, TO REVISE OR REPLACE THE
+MobileTek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO MobileTek FOR SUCH MobileTek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend.c b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend.c
new file mode 100755
index 0000000..ff653f6
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AUTOSUSPEND"
+
+#include <stdbool.h>
+
+#include <log/log.h>
+#include <liblog/lynq_deflog.h>
+
+#include "autosuspend.h"
+
+#include "autosuspend_ops.h"
+
+static struct autosuspend_ops *autosuspend_ops;
+static bool autosuspend_enabled;
+static bool autosuspend_inited;
+
+static int autosuspend_init(void)
+{
+    if (autosuspend_inited) {
+        return 0;
+    }
+
+    autosuspend_ops = autosuspend_wakeup_count_init();
+    if (autosuspend_ops) {
+        goto out;
+    }
+
+    if (!autosuspend_ops) {
+        ALOGI("failed to initialize autosuspend\n");
+        return -1;
+    }
+
+out:
+    autosuspend_inited = true;
+
+    ALOGI("autosuspend initialized\n");
+    return 0;
+}
+
+int autosuspend_enable(void)
+{
+    int ret;
+
+    ret = autosuspend_init();
+    if (ret) {
+        return ret;
+    }
+
+    ALOGI("autosuspend_enable\n");
+
+    if (autosuspend_enabled) {
+        return 0;
+    }
+
+    ret = autosuspend_ops->enable();
+    if (ret) {
+        return ret;
+    }
+
+    autosuspend_enabled = true;
+    return 0;
+}
+
+int autosuspend_disable(void)
+{
+    int ret;
+
+    ret = autosuspend_init();
+    if (ret) {
+        return ret;
+    }
+
+    ALOGI("autosuspend_disable\n");
+
+    if (!autosuspend_enabled) {
+        return 0;
+    }
+
+    ret = autosuspend_ops->disable();
+    if (ret) {
+        return ret;
+    }
+
+    autosuspend_enabled = false;
+    return 0;
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend.h b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend.h
new file mode 100755
index 0000000..59188a8
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _LIBSUSPEND_AUTOSUSPEND_H_
+#define _LIBSUSPEND_AUTOSUSPEND_H_
+
+#include <sys/cdefs.h>
+#include <stdbool.h>
+
+__BEGIN_DECLS
+
+/*
+ * autosuspend_enable
+ *
+ * Turn on autosuspend in the kernel, allowing it to enter suspend if no
+ * wakelocks/wakeup_sources are held.
+ *
+ *
+ *
+ * Returns 0 on success, -1 if autosuspend was not enabled.
+ */
+int autosuspend_enable(void);
+
+/*
+ * autosuspend_disable
+ *
+ * Turn off autosuspend in the kernel, preventing suspend and synchronizing
+ * with any in-progress resume.
+ *
+ * Returns 0 on success, -1 if autosuspend was not disabled.
+ */
+int autosuspend_disable(void);
+
+/*
+ * set_wakeup_callback
+ *
+ * Set a function to be called each time the device returns from suspend.
+ * success is true if the suspend was sucessful and false if the suspend
+ * aborted due to some reason.
+ */
+void set_wakeup_callback(void (*func)(bool success));
+
+__END_DECLS
+
+#endif
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend.service b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend.service
new file mode 100755
index 0000000..3cbb46c
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=lynq-autosuspend-service
+
+[Service]
+ExecStart=/usr/bin/autosuspend
+Type=simple
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_ops.h b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_ops.h
new file mode 100755
index 0000000..698e25b
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_ops.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _LIBSUSPEND_AUTOSUSPEND_OPS_H_
+#define _LIBSUSPEND_AUTOSUSPEND_OPS_H_
+
+struct autosuspend_ops {
+    int (*enable)(void);
+    int (*disable)(void);
+};
+
+struct autosuspend_ops *autosuspend_autosleep_init(void);
+struct autosuspend_ops *autosuspend_earlysuspend_init(void);
+struct autosuspend_ops *autosuspend_wakeup_count_init(void);
+
+#endif
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_wakeup_count.c b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_wakeup_count.c
new file mode 100755
index 0000000..85fbc84
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_wakeup_count.c
@@ -0,0 +1,560 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AUTOSUSPEND"
+//#define LOG_NDEBUG 0
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include <string.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#include <unistd.h>
+#include <dlfcn.h>
+//#include <cutils/properties.h>
+#define USER_LOG_TAG "PMS"
+#include <liblog/lynq_deflog.h>
+#include <log/log.h>
+#include <stdlib.h>
+#include "autosuspend_ops.h"
+
+#ifdef MOBILETEK_SUSPEND_CFG
+#define SYS_POWER_STATE "/sys/power/state"
+#endif
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+#define SYS_POWER_STATE "/sys/power/autosleep"
+#endif
+#define SYS_POWER_WAKEUP_COUNT "/sys/power/wakeup_count"
+#define SYS_POWER_SPM_SUSPEND_CRTL "/sys/power/spm/suspend_ctrl"
+
+#define BASE_SLEEP_TIME 100000
+#define POSSIBLE_MAX_SLEEP_TIME 60000000
+
+static int state_fd;
+static int wakeup_count_fd;
+static int suspend_ctrl_fd;
+static pthread_t suspend_thread;
+static sem_t suspend_lockout;
+extern pthread_cond_t feedback_cond;
+extern pthread_mutex_t feedback_mutex;
+extern pthread_mutex_t time_info_mutex;
+static const char *sleep_state = "mem";
+#ifdef MOBILETEK_SUSPEND_CFG
+static const char *reg_netsys[5] = {"reg_netsys_srcclkena_mask_b 0",
+                                    "reg_netsys_infra_req_mask_b 0",
+                                    "reg_netsys_apsrc_req_mask_b 0",
+                                    "reg_netsys_vrf18_req_mask_b 0",
+                                    "reg_netsys_ddr_en_mask_b 0"};
+#endif
+static void (*wakeup_func)(bool success) = NULL;
+static int sleep_time = BASE_SLEEP_TIME;
+static int possible_max_sleep_time = POSSIBLE_MAX_SLEEP_TIME;
+
+extern int adb_debug_mode;
+
+static long start_time;  // 出错点:time_info_t 结构体两个成员都是long,因此这两个变量必须是long型,不能定义成int
+static long end_time; 
+
+
+
+# define TEMP_FAILURE_RETRY(expression) \
+  (__extension__							      \
+    ({ long int __result;						      \
+       do __result = (long int) (expression);				      \
+       while (__result == -1L && errno == EINTR);			      \
+       __result; }))
+
+
+pid_t pid = 0;
+
+enum {
+    PARTIAL_WAKE_LOCK = 1,  // the cpu stays on, but the screen is off
+    FULL_WAKE_LOCK = 2      // the screen is also on
+};
+
+// while you have a lock held, the device will stay on at least at the
+// level you request.
+
+struct time_info_t
+{
+    long sleep_start_time;
+    long wakeup_time;
+};
+
+extern struct time_info_t time_info;
+
+struct timeval tv;
+
+#ifdef MOBILETEK_SUSPEND_CFG
+void *dlHandle_wakelock;
+void *dlHandle_log;
+void *dlHandle_network;
+static void* dlHandle_sim;
+
+int (*lynq_screen)(int num);
+int (*lynq_sim_init)(int utoken);
+int (*acquire_wake_lock)(int lock, const char* id);
+int (*release_wake_lock)(const char* id);
+int (*lynq_query_registration_state)(const char *type,int* regState,int* imsRegState,char * LAC,char * CID,int *
+netType,int *radioTechFam,int *errorCode);
+int (*lynq_network_init)(int utoken);
+
+void init_wakelock_func(void)
+{
+    const char *lynqLibPath_WakeLock = "/usr/lib64/libpower.so";
+    const char *lynqLibPath_Log = "/lib64/liblynq-log.so";
+
+    dlHandle_wakelock = dlopen(lynqLibPath_WakeLock, RTLD_NOW);
+    if (dlHandle_wakelock == NULL) 
+    {
+        ALOGI("dlopen lynqLibPath_WakeLock failed: %s", dlerror());
+        exit(EXIT_FAILURE);
+    }
+    dlHandle_log = dlopen(lynqLibPath_Log, RTLD_NOW);
+    if (dlHandle_log == NULL) 
+    {
+        ALOGI("dlopen dlHandle_log failed: %s", dlerror());
+        exit(EXIT_FAILURE);
+    }
+    acquire_wake_lock = (int(*)(int,const char*))dlsym(dlHandle_wakelock, "acquire_wake_lock");
+    if (acquire_wake_lock == NULL) {
+        ALOGI("acquire_wake_lock not defined or exported in %s", lynqLibPath_WakeLock);
+        exit(EXIT_FAILURE);
+    }
+    release_wake_lock = (int(*)( const char*))dlsym(dlHandle_wakelock, "release_wake_lock");
+    if (release_wake_lock == NULL) {
+        ALOGI("release_wake_lock not defined or exported in %s", lynqLibPath_WakeLock);
+        exit(EXIT_FAILURE);
+    }
+    dlerror(); // Clear any previous dlerror
+
+  return;
+}
+
+
+ void init_sim_func()
+{
+    int res;
+    const char *lynqLibPath_Sim = "/lib64/liblynq-sim.so";
+
+    pid = getpid();
+    dlHandle_sim = dlopen(lynqLibPath_Sim, RTLD_NOW);
+    if (dlHandle_sim == NULL) 
+    {
+        ALOGI("dlopen lynqLibPath_Sim failed: %s", dlerror());
+        exit(EXIT_FAILURE);
+    }
+
+    lynq_screen = (int(*)(int))dlsym(dlHandle_sim, "lynq_screen");
+    if (lynq_screen == NULL) {
+        ALOGI("lynq_screen not defined or exported in %s", lynqLibPath_Sim);
+        exit(EXIT_FAILURE);
+    }
+
+    lynq_sim_init = (int(*)(int utoken))dlsym(dlHandle_sim,"lynq_sim_init");
+    if (lynq_sim_init == NULL) {
+        ALOGI("lynq_sim_init not defined or exported in %s", lynqLibPath_Sim);
+        exit(EXIT_FAILURE);
+    }
+    dlerror(); // Clear any previous dlerror
+
+    res = lynq_sim_init((int)pid);
+    if(res == 0)
+    {
+        ALOGI("Run lynq_sim_init\n");
+    }else{
+        ALOGI("lynq sim init error\n");
+    }
+    sleep(1);    
+
+    return;
+}
+
+
+void init_network_func()
+{
+    int res;
+    const char *lynqLibPath_Network = "/lib64/liblynq-network.so";
+    dlHandle_network = dlopen(lynqLibPath_Network, RTLD_NOW);
+    if (dlHandle_network == NULL) 
+    {
+        ALOGI("dlopen lynqLibPath_Network failed: %s", dlerror());
+        exit(EXIT_FAILURE);
+    }
+
+    lynq_query_registration_state = (int(*)(const char*,int*,int*,char *,char *,int *,int *,int*))dlsym(
+dlHandle_network, "lynq_query_registration_state");
+    if (lynq_query_registration_state == NULL) {
+        ALOGI("lynq_query_registration_state not defined or exported in %s", lynqLibPath_Network);
+        exit(EXIT_FAILURE);
+    }
+
+    lynq_network_init = (int(*)(int))dlsym(dlHandle_network, "lynq_network_init");
+    if (lynq_network_init == NULL) {
+        ALOGI("lynq_network_init not defined or exported in %s", lynqLibPath_Network);
+        exit(EXIT_FAILURE);
+    }
+
+    ALOGI("start lynq_network_init\n");
+    printf("start lynq_network_init\n");
+    res = lynq_network_init(2);
+    sleep(10);
+
+    if(res == 0)
+    {
+        ALOGI("Run lynq_network_init\n");
+        printf("Run lynq_network_init\n");
+    }else{
+        ALOGI("lynq_network_init error\n");
+        printf("lynq_network_init error\n");
+    }       
+
+    dlerror(); // Clear any previous dlerror
+    return;            
+}
+#endif
+
+static int suspend_ctrl(char *wakeup_count,int wakeup_count_len)
+{
+
+
+    char buf[80];
+    int ret = 0;
+#ifdef MOBILETEK_SUSPEND_CFG
+    system("echo \"Sys standby mode\" >/dev/console");
+    // sleep(1);
+    system("echo 7 | emdlogger_ctrl");
+    // sleep(1);
+
+    if (lynq_screen(0) != 0)  //notify ril for screen off
+    {
+        ALOGI("lynq_screen off fail\n");
+        return -1;
+    }
+    system("echo mode 4 0 >/sys/devices/platform/10005000.pinctrl/mt_gpio");
+    system("echo out 4 1 >/sys/devices/platform/10005000.pinctrl/mt_gpio");
+    RLOGD("ring GPIO PASS\n");
+    system("hwclock -w");
+    RLOGD("TIME: sys to rtc\n");
+    lseek(wakeup_count_fd, 0, SEEK_SET);
+    system("echo \"autosuspend:Sys seek\" >/dev/console");
+    wakeup_count_len = TEMP_FAILURE_RETRY(read(wakeup_count_fd, wakeup_count,
+               200));
+    ALOGE("%s: %d, write %s to wakeup_count\n", __func__, wakeup_count_len, wakeup_count);
+    if (wakeup_count_len < 0) {
+            strerror_r(errno, buf, sizeof(buf));
+            ALOGE("Error reading from %s: %s\n", SYS_POWER_WAKEUP_COUNT, buf);
+            wakeup_count_len = 0;
+            return -1;
+     }
+
+    for(int i = 0;i < 5;i++)  //notify spm (other core) to handle pre-sleep configuration
+    {
+        if(TEMP_FAILURE_RETRY(write(suspend_ctrl_fd,reg_netsys[i],strlen(reg_netsys[i]))) < 0)
+        {
+            strerror_r(errno, buf, sizeof(buf));
+            ALOGI("Error writing to %s: %s\n", SYS_POWER_SPM_SUSPEND_CRTL, buf);
+            return -1;
+        }    
+    }
+#endif
+
+    system("echo \"autosuspend:Sys suspend\" >/dev/console");
+    if(TEMP_FAILURE_RETRY(write(state_fd, sleep_state, strlen(sleep_state))) < 0) //enter suspend procedures in kernel
+    {
+        strerror_r(errno, buf, sizeof(buf));
+        ALOGI("Error writing to %s: %s\n", SYS_POWER_STATE, buf);
+        return -1;
+    }
+
+    return 0;
+}
+
+
+void wakeup_feedback(bool success)
+{
+
+    char buf[80];
+    long sleeptime = 0;
+#ifdef MOBILETEK_SUSPEND_CFG
+    system("hwclock -s");
+    RLOGD("TIME: rtc to sys\n");
+    if (!success)
+    {
+
+       system("mdlogctl start");
+
+       system("echo 8 | emdlogger_ctrl");
+    
+       usleep(200000); 
+       ALOGI("Log on with failure\n");
+       return ;
+    }
+
+    
+    if (lynq_screen(1) != 0)  // notify ril for screen on
+    {
+    ALOGI("lynq_screen on fail\n");
+
+    }
+
+    system("mdlogctl start");
+
+//  sleep(1);
+
+    system("echo 8 | emdlogger_ctrl");
+
+    usleep(300000); //delay 2s for ril handling screen on,at least 70ms
+#endif
+
+    pthread_mutex_lock(&time_info_mutex);
+    memset(&tv,0,sizeof(struct timeval));
+    gettimeofday(&tv,NULL);
+    // time_info.wakeup_time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+    end_time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+    ALOGI("%s: wake up time: %ld ms\n", __func__,end_time);
+
+    memset(&time_info,0,sizeof(struct time_info_t));
+
+    time_info.sleep_start_time = start_time;
+    time_info.wakeup_time = end_time;
+    sleeptime = end_time -start_time;
+    RLOGD("sleep time is %ld ms\n", sleeptime);
+    pthread_mutex_unlock(&time_info_mutex);
+
+    if (pthread_cond_broadcast(&feedback_cond) != 0) {
+        strerror_r(errno, buf, sizeof(buf));
+        ALOGI("Error broadcast cond: %s\n", buf);
+    }
+
+    return ;
+
+}
+
+static void update_sleep_time(bool success) {
+    if (success) {
+        sleep_time = BASE_SLEEP_TIME;
+        return;
+    }
+    // double sleep time after each failure up to one minute
+    sleep_time = MIN(sleep_time * 2, possible_max_sleep_time);
+}
+
+static void *suspend_thread_func(void *arg __attribute__((unused)))
+{
+    char buf[80];
+    char wakeup_count[20];
+    int wakeup_count_len;
+    int ret;
+    bool success = true;
+
+    while (1) {
+        update_sleep_time(success);
+        usleep(sleep_time);
+        success = false;
+
+        ALOGI("%s: wait\n", __func__);
+        ret = sem_wait(&suspend_lockout);
+        if (ret < 0) {
+            strerror_r(errno, buf, sizeof(buf));
+            ALOGI("Error waiting on semaphore: %s\n", buf);
+            continue;
+        }
+
+        ALOGV("%s: read wakeup_count\n", __func__);
+        lseek(wakeup_count_fd, 0, SEEK_SET);
+        wakeup_count_len = TEMP_FAILURE_RETRY(read(wakeup_count_fd, wakeup_count,
+                sizeof(wakeup_count)));
+        if (wakeup_count_len < 0) {
+            strerror_r(errno, buf, sizeof(buf));
+            ALOGE("Error reading from %s: %s\n", SYS_POWER_WAKEUP_COUNT, buf);
+            wakeup_count_len = 0;
+            continue;
+        }
+        if (!wakeup_count_len) {
+            ALOGE("Empty wakeup count\n");
+            continue;
+        }
+
+        ALOGI("%s: start suspend_ctrl\n", __func__);
+        memset(&tv,0,sizeof(struct timeval));
+        // memset(&time_info,0 ,sizeof(struct time_info_t));
+        gettimeofday(&tv,NULL);
+
+        start_time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+        ALOGI("%s: suspend start time: %ld ms\n", __func__,start_time);
+        // time_info.sleep_start_time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+
+        ret = suspend_ctrl(wakeup_count,wakeup_count_len);
+
+        if (ret >= 0) {
+                ALOGI("suspend_ctrl success.\n");
+                success = true;
+         }
+         else
+         {
+                ALOGI("suspend_ctrl false.\n");
+                success = false;
+         }
+
+         void (*func)(bool success) = wakeup_func;
+         if (func != NULL) {
+                (*func)(success); //handling resume event for other libs /apps
+            }
+
+         ALOGI("%s: release sem\n", __func__);
+         ret = sem_post(&suspend_lockout);
+         if (ret < 0) {
+            strerror_r(errno, buf, sizeof(buf));
+            ALOGI("Error releasing semaphore: %s\n", buf);
+         } 
+
+         if(adb_debug_mode == 1) // it's neccessary to wait for autosuspend_disable function calling in debug mode when finish resume procedure.
+         {
+           sleep(40);
+         }
+         else
+         {
+            ALOGI("%s: adb_debug unsupported\n", __func__);
+         }
+
+         ALOGI("%s: END SLEEP\n", __func__);
+    }
+    return NULL;
+}
+
+static int autosuspend_wakeup_count_enable(void)
+{
+    char buf[80];
+    int ret;
+
+    ALOGI("autosuspend_wakeup_count_enable\n");
+
+    ret = sem_post(&suspend_lockout);
+
+    if (ret < 0) {
+        strerror_r(errno, buf, sizeof(buf));
+        ALOGI("Error changing semaphore: %s\n", buf);
+    }
+
+    ALOGI("autosuspend_wakeup_count_enable done\n");
+
+    return ret;
+}
+
+static int autosuspend_wakeup_count_disable(void)
+{
+    char buf[80];
+    int ret;
+
+    ALOGI("autosuspend_wakeup_count_disable\n");
+
+    ret = sem_wait(&suspend_lockout);
+
+    if (ret < 0) {
+        strerror_r(errno, buf, sizeof(buf));
+        ALOGI("Error changing semaphore: %s\n", buf);
+    }
+
+    ALOGI("autosuspend_wakeup_count_disable done\n");
+
+    return ret;
+}
+
+void set_wakeup_callback(void (*func)(bool success))
+{
+    if (wakeup_func != NULL) {
+        ALOGI("Duplicate wakeup callback applied, keeping original");
+        return;
+    }
+    wakeup_func = func;
+}
+
+struct autosuspend_ops autosuspend_wakeup_count_ops = {
+        .enable = autosuspend_wakeup_count_enable,
+        .disable = autosuspend_wakeup_count_disable,
+};
+
+struct autosuspend_ops *autosuspend_wakeup_count_init(void)
+{
+    int ret;
+    char buf[80];
+    char timeout_str[100]="100000";
+
+    //if (property_get("sys.autosuspend.timeout", timeout_str, NULL))
+    {
+        possible_max_sleep_time = atoi(timeout_str);
+        ALOGI("autosuspend timeout is %d\n", possible_max_sleep_time);
+    }
+
+    state_fd = TEMP_FAILURE_RETRY(open(SYS_POWER_STATE, O_RDWR));
+    if (state_fd < 0) {
+        strerror_r(errno, buf, sizeof(buf));
+        ALOGI("Error opening %s: %s\n", SYS_POWER_STATE, buf);
+        goto err_open_state;
+    }
+
+    wakeup_count_fd = TEMP_FAILURE_RETRY(open(SYS_POWER_WAKEUP_COUNT, O_RDWR));
+    if (wakeup_count_fd < 0) {
+        strerror_r(errno, buf, sizeof(buf));
+        ALOGI("Error opening %s: %s\n", SYS_POWER_WAKEUP_COUNT, buf);
+        goto err_open_wakeup_count;
+    }
+#ifdef MOBILETEK_SUSPEND_CFG
+    suspend_ctrl_fd = TEMP_FAILURE_RETRY(open(SYS_POWER_SPM_SUSPEND_CRTL, O_RDWR));
+    if (suspend_ctrl_fd < 0) {
+        strerror_r(errno, buf, sizeof(buf));
+        ALOGI("Error opening %s: %s\n", SYS_POWER_SPM_SUSPEND_CRTL, buf);
+        goto err_open_suspend_ctrl;
+    }
+#endif
+    ret = sem_init(&suspend_lockout, 0, 0);
+    if (ret < 0) {
+        strerror_r(errno, buf, sizeof(buf));
+        ALOGI("Error creating semaphore: %s\n", buf);
+        goto err_sem_init;
+    }
+    ret = pthread_create(&suspend_thread, NULL, suspend_thread_func, NULL);
+    if (ret) {
+        strerror_r(ret, buf, sizeof(buf));
+        ALOGI("Error creating thread: %s\n", buf);
+        goto err_pthread_create;
+    }
+
+    ALOGI("Selected wakeup count\n");
+    return &autosuspend_wakeup_count_ops;
+
+err_pthread_create:
+    sem_destroy(&suspend_lockout);
+err_sem_init:
+    close(wakeup_count_fd);
+err_open_wakeup_count:
+    close(state_fd);
+#ifdef MOBILETEK_SUSPEND_CFG
+err_open_suspend_ctrl:
+    close(suspend_ctrl_fd);
+#endif
+err_open_state:
+    return NULL;
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/lynq-autosuspend.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/lynq-autosuspend.sh
new file mode 100644
index 0000000..8e96831
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/lynq-autosuspend.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# Run the daemon
+#
+
+DAEMON="lynq-autosuspend-service"
+PIDFILE="/var/run/$DAEMON.pid"
+EXEC="/usr/bin/autosuspend"
+EXEC_ARGS=""
+
+
+start() {
+        echo -n "Starting $DAEMON... "
+        start-stop-daemon --no-close -S -b -m -p $PIDFILE -x $EXEC -- $EXEC_ARGS
+        [ $? -eq 0 ] && echo "OK" || echo "ERROR"
+}
+
+stop() {
+        echo -n "Stopping $DAEMON... "
+        start-stop-daemon -K -p $PIDFILE
+        [ $? -eq 0 ] && echo "OK" || echo "ERROR"
+}
+
+restart() {
+        stop
+        start
+}
+
+case "$1" in
+  start|stop|restart)
+        "$1"
+        ;;
+  *)
+        echo "Usage: $0 {start|stop|restart}"
+        exit 1
+esac
+
+exit $?
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/main.c b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/main.c
new file mode 100755
index 0000000..d4e6960
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/main.c
@@ -0,0 +1,491 @@
+/* //device/system/rild/rild.c
+**
+** Copyright 2006 The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <dlfcn.h>
+#include <string.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <log/log.h>
+#include <liblog/lynq_deflog.h>
+#include <include/lynq_uci.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <signal.h>
+
+
+#define LOG_UCI_MODULE "lynq_autosuspend"
+#define LOG_UCI_FILE "lynq_uci"
+
+#define LOG_TAG "AUTOSUSPEND"
+
+#define USER_LOG_TAG "PMS"
+
+#define SOCK_PATH  "/tmp/autosuspend.cmd.server"  //不能在当前这个目录创建socket文件,否则报错找不到文件(可能是因为这是在共享文件夹下,不支持创建socket文件)
+
+#define SOCK_DATA_PATH  "/tmp/autosuspend.data.server"
+
+// #define LYINFLOG(X...)  lynq_log_global_output(LOG_INFO,X)
+
+#define TIME_OUT_TIME 30
+
+
+#define MAX_LIB_ARGS        16
+
+int adb_debug_mode = 0;
+
+
+pthread_cond_t feedback_cond = PTHREAD_COND_INITIALIZER;
+pthread_mutex_t feedback_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t time_info_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+extern int autosuspend_enable(void);
+extern int autosuspend_disable(void);
+extern void init_wakelock_func(void);
+extern void init_sim_func();
+extern void init_network_func();
+extern void set_wakeup_callback(void (*func)(bool success));
+extern void wakeup_feedback(bool success);
+extern int (*lynq_screen)(int num);
+
+struct time_info_t
+{
+    long sleep_start_time;
+    long wakeup_time;
+};
+
+struct time_info_t time_info; 
+
+static void usage(const char *argv0) {
+    fprintf(stderr, "Usage: %s -l <possible_max_sleep_time> [-- <args for Autosuspend Service>]\n", argv0);
+    exit(EXIT_FAILURE);
+}
+
+
+
+static int make_argv(char * args, char ** argv) {
+    // Note: reserve argv[0]
+    int count = 1;
+    char * tok;
+    char * s = args;
+
+    while ((tok = strtok(s, " \0"))) {
+        argv[count] = tok;
+        s = NULL;
+        count++;
+    }
+    return count;
+}
+
+static int Accept(int fd, struct sockaddr *sa, socklen_t *salenptr)
+{
+    int n;
+
+    while((n = accept(fd, sa, salenptr)) < 0)
+    {
+        if((errno == ECONNABORTED) || (errno == EINTR))
+            continue;
+        else
+        {
+            ALOGI("accept error\n");
+            return -1;
+        }
+    }
+    return n;
+}
+
+static int Bind(int fd, const struct sockaddr *sa, socklen_t salen)
+{
+    if(bind(fd, sa, salen) < 0)
+    {
+        // ALOGI("bind error\n");
+        perror("bind error");
+        return -1;
+    }
+	return 0;
+}
+
+
+static int Socket(int family, int type, int protocol)
+{
+    int n;
+
+    if ( (n = socket(family, type, protocol)) < 0)
+    {
+        ALOGI("socket error\n");
+        return -1;
+    }
+    return n;
+}
+
+static int Listen(int fd, int backlog)
+{
+    if(listen(fd, backlog) < 0)
+    {
+        ALOGI("listen error\n");
+        return -1;
+    }
+	return 0;
+}
+
+
+static int listen_port(struct sockaddr_un *addr, char *sockpath)
+{
+    int listenfd;
+    listenfd = Socket(AF_UNIX,SOCK_STREAM,0);
+    if(listenfd == -1)
+        return -1;
+    memset(addr, 0, sizeof(struct sockaddr_un));
+    addr->sun_family = AF_UNIX;
+    strcpy(addr->sun_path,sockpath);
+    // int opt = 1;
+	// if(setsockopt(listenfd, SOL_SOCKET,SO_REUSEADDR, (const void *)&opt, sizeof(opt)) == -1)
+    // {
+    //     perror("setsockopt error");
+    //     return -1;
+    // }
+
+// 以上方法对非网络的本地socket无效,应该用unlink函数避免Address already in use的错误
+
+
+    unlink(sockpath);
+    if(Bind(listenfd,(struct sockaddr *)addr,sizeof(*addr)) == -1)
+        return -1;
+
+    if(Listen(listenfd,20) == -1)
+        return -1;
+
+    return listenfd; 
+}
+
+static ssize_t Read(int fd, void *ptr, size_t nbytes)
+{
+    ssize_t n;
+    
+    while((n = read(fd, ptr, nbytes)) == -1)
+    {
+       //printf("READ,%d\n",fd);
+        if (errno == EINTR)
+		{	
+			ALOGI("read error eintr\n");
+            continue;
+		}
+        else if(errno == EAGAIN || errno == EWOULDBLOCK)
+        {
+            ALOGI("read time out\n");
+            return -1;
+        }
+        else
+        {
+            ALOGI("read error\n");
+            return -1;
+        }
+    }
+    //sleep(2);
+    //printf("READ1,%d\n", fd);
+    return n;
+}
+
+static ssize_t Write(int fd, const void *ptr, size_t nbytes)
+{
+    ssize_t n;
+
+    while((n = write(fd, ptr, nbytes)) == -1)
+    {
+        if (errno == EINTR)
+            continue;
+        else if(errno == EPIPE)
+		{
+			ALOGI("write error epipe\n");
+			return -1;
+		}  
+		else
+			return -1;
+    }
+    return n;
+}
+
+static int Close(int fd)
+{
+    if (close(fd) == -1)
+    {
+        ALOGI("close error\n");
+        return -1;
+    }
+	return 0;
+}
+
+
+void *deal_autosuspend(void *sockfd)
+{
+    int commfd = *((int *)sockfd);
+    char buf[20];
+    char res[15];
+
+    while(1)
+    {
+        memset(buf,0,sizeof(buf));
+        ALOGI("deal_autosuspend start to read.\n");
+        // 错误点:read函数在对端关闭后,也会直接返回0,不会阻塞,因此要判断是否返回0,返回0表示对端已经关闭,此时要跳出while循环不再监听
+        // 为什么对端会关闭?因为在客户端没有用nohup方式打开的情况下,系统睡眠后客户端进行会直接被杀死,对端会关闭,所以会导致read不阻塞,且总是返回0的现象
+        if(Read(commfd,buf,sizeof(buf)) <= 0) 
+        {
+            ALOGI("service receive suspend_cmd fail or client is closed.\n");
+            Close(commfd);
+            break;
+        }
+        if(strcmp(buf,"enable") == 0)
+        {
+            if(autosuspend_enable() < 0)
+            {
+                ALOGI("autosuspend_enable fail.\n");
+            }
+            else
+            {
+                ALOGI("autosuspend_enable success.\n");
+            }        
+        }
+        else if(strcmp(buf,"disable") == 0)
+        {
+            if(autosuspend_disable() < 0)
+            {
+                ALOGI("autosuspend_disable fail.\n");
+            }
+            else
+            {
+                ALOGI("autosuspend_disable success.\n");
+
+            }        
+        }
+
+        else
+        {
+            ALOGI("Unknown cmd : %s\n",buf);
+        }
+
+    }
+
+
+
+}
+
+#ifdef GSW_SUSPEND_CFG
+/*jb.qi add for service send when DTR is low on 20221111 start */
+void *dtr_wakeup()
+{
+    FILE *fp;
+    int ret;
+    bool success = true;
+    char buf[30];
+    char dtr_buffer[25];
+    RLOGD("dtr_wakeup start\n");
+    while(1)
+    {
+        fp = popen("cat /sys/devices/platform/10005000.pinctrl/mt_gpio |grep 006:","r");
+        fgets(dtr_buffer, sizeof(dtr_buffer), fp);
+        if(dtr_buffer[7] == '0')
+        {
+            time_info.sleep_start_time = 123;
+            time_info.wakeup_time = 123;
+            if (pthread_cond_broadcast(&feedback_cond) != 0) 
+            {
+                strerror_r(errno, buf, sizeof(buf));
+                ALOGI("Error broadcast cond: %s\n", buf);
+            }   
+            RLOGD("dtr_wakeup success!\n");
+            sleep(3);
+        }
+        usleep(500);
+        pclose(fp);
+    }
+}
+/*jb.qi add for service send when DTR is low on 20221111 end */
+#endif
+
+void *send_feedback(void *sockfd)
+{
+    int commfd = *((int *)sockfd);
+    char buf[80];
+
+    while (1)
+    {
+        memset(buf,0,sizeof(buf));
+        ALOGI("send_feedback thread wait to send.\n");
+        pthread_mutex_lock(&feedback_mutex);
+        pthread_cond_wait(&feedback_cond,&feedback_mutex);
+
+        ALOGI("send_feedback thread is now sending the feedback to client.\n");
+        pthread_mutex_lock(&time_info_mutex);
+        if(Write(commfd,&time_info,sizeof(struct time_info_t)) <= 0) 
+        {
+            ALOGI("service send wakeup_feedback struct fail.\n");
+            Close(commfd);
+            pthread_mutex_unlock(&time_info_mutex);
+            pthread_mutex_unlock(&feedback_mutex);
+#ifdef GSW_SUSPEND_CFG
+            continue ;//jb.qi add for service send when DTR is low on 20221111 
+#endif
+
+#ifdef MOBILETEK_SUSPEND_CFG
+            break ;
+#endif
+        }        
+        pthread_mutex_unlock(&time_info_mutex);
+
+        pthread_mutex_unlock(&feedback_mutex);
+
+
+
+    }
+
+}
+
+
+int main(int argc, char **argv) {
+
+
+    // int i = 0;
+    // RLOGD("**Autosuspend Service Daemon Started**");
+    // RLOGD("**Autosuspend Service param count=%d**", argc);
+    char tmp[20];
+
+    int commfd, commfd_data, server_sock, server_data_sock,len, len_data;
+
+    struct sockaddr_un server_sockaddr;
+    struct sockaddr_un server_data_sockaddr;
+    struct sockaddr_un client_sockaddr;
+
+    len = sizeof(server_sockaddr);
+
+
+    pthread_t tid;
+#ifdef GSW_SUSPEND_CFG
+	pthread_t tid_1;//jb.qi add for service send when DTR is low on 20221111 
+#endif
+    
+    LYLOGEINIT(USER_LOG_TAG);
+    LYLOGSET(LOG_DEBUG);    
+    // LYLOGSET(LOG_ERROR);
+
+    int auto_enable = 0;
+
+    lynq_get_value(LOG_UCI_FILE, LOG_UCI_MODULE, "debug", tmp); // 即获取系统层面的环境变量
+    ALOGI("Autosuspend Service Daemon. debug %s\n",tmp);
+    adb_debug_mode=atoi(tmp);
+    lynq_get_value(LOG_UCI_FILE, LOG_UCI_MODULE, "auto_enable", tmp);
+    auto_enable=atoi(tmp);
+    ALOGI("Autosuspend Service Daemon. auto_enable %s\n",tmp);
+#ifdef MOBILETEK_SUSPEND_CFG
+    init_wakelock_func();
+    init_sim_func();
+#endif
+    signal(SIGPIPE,SIG_IGN); // 忽略SIGPIPE信号,防止由于客户端关闭,继续往客户端write,会导致服务端收到SIGPIPE信号而Broken pipe
+
+    
+    // init_network_func();
+
+    // if(pthread_cond_init(&feedback_cond,NULL) != 0)
+    // {
+    //     strerror_r(errno, buf, sizeof(buf));
+    //     ALOGI("Error creating cond: %s\n", buf);
+    //     return -1;
+    // }
+
+    set_wakeup_callback(wakeup_feedback);
+    // 注册回调函数
+
+   if(auto_enable==0)
+   {
+      if(autosuspend_disable() < 0)
+     {
+       ALOGI("autosuspend_disable fail.\n");
+     }
+     else
+     {
+       ALOGI("autosuspend_disable success.\n");
+     }
+   }
+   if(auto_enable==1)
+   {
+      if(autosuspend_enable() < 0)
+     {
+       ALOGI("autosuspend_enable fail.\n");
+     }
+     else
+     {
+       ALOGI("autosuspend_enable success.\n");
+     }
+   }
+
+
+    server_sock = listen_port(&server_sockaddr,SOCK_PATH);
+    if(server_sock == -1)
+        return -1;
+
+    server_data_sock = listen_port(&server_data_sockaddr,SOCK_DATA_PATH);
+    if(server_data_sock == -1)
+        return -1;
+#ifdef GSW_SUSPEND_CFG
+    /*jb.qi add for service send when DTR is low on 20221111 start*/
+    pthread_create(&tid_1,NULL,dtr_wakeup,NULL);
+    pthread_detach(tid_1);
+    /*jb.qi add for service send when DTR is low on 20221111 end*/
+#endif
+
+    while (1)
+    {
+        ALOGI("service socket listening...\n");
+        commfd = Accept(server_sock,(struct sockaddr *)&client_sockaddr,&len);
+        if(commfd == -1)
+        {
+            return -1;
+        }
+        if(getpeername(commfd, (struct sockaddr *)&client_sockaddr, &len) == -1)
+        {
+            ALOGI("GETPEERNAME ERROR.\n");
+            // Close(server_sock);
+            Close(commfd);
+            continue;
+        }
+        else
+        {
+            ALOGI("Client socket filepath: %s\n", client_sockaddr.sun_path);
+        }
+
+        commfd_data = Accept(server_data_sock,NULL,NULL);
+        if(commfd_data == -1)
+        {
+            return -1;
+        }
+        ALOGI("data channel connected.\n");
+        
+        pthread_create(&tid,NULL,deal_autosuspend,(void*)&commfd);//这里很容易错,最后一个参数要取地址,这是一个指针
+        pthread_detach(tid);   
+
+        pthread_create(&tid,NULL,send_feedback,(void*)&commfd_data);
+        pthread_detach(tid); 
+
+
+    }
+    
+ 
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/makefile b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/makefile
new file mode 100755
index 0000000..0441d43
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/makefile
@@ -0,0 +1,67 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+                -g -Os \
+                -flto \
+                -DRIL_SHLIB \
+                -DATCI_PARSE \
+                -DKEEP_ALIVE \
+                -D__LINUX_OS__ \
+                -DECALL_SUPPORT
+
+
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DHAVE_SYS_UIO_H -DRIL_TIME_CB
+endif
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+    LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
+endif
+
+ifeq ($(strip $(MOBILETEK_SUSPEND_CFG)), GSW)
+    LOCAL_CFLAGS += -DGSW_SUSPEND_CFG
+
+endif
+
+ifeq ($(strip $(MOBILETEK_SUSPEND_CFG)), PLATFORM)
+    LOCAL_CFLAGS += -DMOBILETEK_SUSPEND_CFG
+
+endif
+
+
+LOCAL_PATH   = .
+
+LOCAL_C_INCLUDES = \
+  -I.   -I$(ROOT)$(includedir)/liblog -I$(ROOT)$(includedir) \
+
+
+
+
+LOCAL_LIBS := \
+    -L. \
+    -ldl \
+    -lpthread \
+    -llynq-log \
+    -llynq-uci \
+    -llog \
+    -lbsp \
+
+
+SOURCES = $(wildcard *.c )
+
+EXECUTABLE = autosuspend
+
+OBJECTS=$(SOURCES:.c=.o)
+all: $(EXECUTABLE)
+
+$(EXECUTABLE): $(OBJECTS)
+	$(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.c
+	$(CC) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+	$(RM) $(OBJECTS) $(EXECUTABLE)
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/lynq-autosuspend.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/lynq-autosuspend.bb
new file mode 100755
index 0000000..c646163
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/lynq-autosuspend.bb
@@ -0,0 +1,79 @@
+inherit externalsrc package systemd
+
+DESCRIPTION = "autosuspend.service"
+
+LICENSE = "MobileTekProprietary"
+LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=44d8d2b6296ca24bcd4894bb7155bf27"
+
+SRC_URI = "file://autosuspend.c file://LICENSE \
+           file://autosuspend.h \
+           file://autosuspend_ops.h \
+           file://autosuspend_wakeup_count.c \
+           file://main.c \
+           file://autosuspend.service \
+           file://lynq-autosuspend.sh \
+           file://makefile \
+"
+
+EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\
+                'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\
+                'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+LOCAL_C_INCLUDES = "-I. "
+
+DEPENDS = "liblynq-log liblynq-uci"
+DEPENDS += "${@bb.utils.contains('TARGET_PLATFORM', 'mt2735', 'audio-mixer-ctrl streamer1.0', '', d)} liblynq-log liblynq-uci libbsp"
+LOCAL_LIBS = "-L. -ldl -lstdc++ -lpthread -llog"
+SOURCES = "$(wildcard *.c )"
+
+OBJECTS = "$(SOURCES:.c=.o)"
+
+EXTRA_OEMAKE += "'MOBILETEK_SUSPEND_CFG = ${MOBILETEK_SUSPEND_CFG}'\
+                 'TARGET_PLATFORM = ${TARGET_PLATFORM}'\
+                 'MTK_LED_SUPPORT = ${MTK_LED_SUPPORT}'\
+                 'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+
+EXECUTABLE = "autosuspend"
+S = "${WORKDIR}"
+TARGET_CC_ARCH += "${LDFLAGS}"
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "autosuspend.service"
+FILES_${PN} += "${systemd_unitdir}/system/autosuspend.service"
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+
+	#${CXX} -Wall ${LOCAL_C_INCLUDES} autosuspend.c autosuspend_wakeup_count.c main.c ${LOCAL_LIBS} -o ${EXECUTABLE}
+	if test "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" || test "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4"; then
+		oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -mhard-float"
+	else
+		oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}"
+	fi
+}
+
+do_install() {
+	install -d ${D}${bindir}/
+	echo "Installing image PN ${PN}"
+	echo "Installing image systemd_unitdir ${systemd_unitdir}"
+	echo "Installing image D ${D}"
+	echo "Installing image B ${B}"
+	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+		install -d ${D}${systemd_unitdir}/system/
+		install -m 0644 ${B}/autosuspend.service ${D}${systemd_unitdir}/system
+    else
+		install -d ${D}${sysconfdir}/init.d
+        install -m 0755  ${S}/lynq-autosuspend.sh ${D}${sysconfdir}/init.d/
+        install -d ${D}${sysconfdir}/rcS.d
+        ln -s ../init.d/lynq-autosuspend.sh ${D}${sysconfdir}/rcS.d/S82lynq-autosuspend-service
+	fi
+
+	install -m 0755 ${S}/autosuspend ${D}${bindir}/
+	install -d ${D}${includedir}
+}
+
+
+
+
+
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-gnss-demo/lynq-qser-gnss-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-gnss-demo/lynq-qser-gnss-demo.bb
new file mode 100755
index 0000000..a14707b
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-gnss-demo/lynq-qser-gnss-demo.bb
@@ -0,0 +1,35 @@
+#inherit externalsrc package
+#inherit externalsrc package systemd
+DESCRIPTION = "lynq-qser-gnss-demo"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+DEPENDS += "liblynq-qser-gnss"
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/packages/apps/lynq-qser-gnss-demo"
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/packages/apps:"
+SRC_URI = " \
+          file://lynq-qser-gnss-demo \
+          "
+
+SRC-DIR = "${S}/../lynq-qser-gnss-demo"
+TARGET_CC_ARCH += "${LDFLAGS}"
+SYSTEMD_PACKAGES = "${PN}"
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'\"
+EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"
+
+EXTRA_OEMAKE += "'MOBILETEK_FOTA_CFG = ${MOBILETEK_FOTA_CFG}'"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+	if test "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" || test "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4"; then
+		oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -mhard-float"
+	else
+		oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}"
+	fi
+}
+
+do_install() {
+	install -d ${D}${bindir}/
+	install -m 0755 ${SRC-DIR}/lynq-qser-gnss-demo ${D}${bindir}/
+}
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 0d1d63d..8cb0da3 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
@@ -394,6 +394,7 @@
         strcpy(apn_list->apn[node_num].apn_name,(char *)xmlGetProp(modify_node, "apn_name"));
         strcpy(apn_list->apn[node_num].username,(char *)xmlGetProp(modify_node, "username"));
         strcpy(apn_list->apn[node_num].password,(char *)xmlGetProp(modify_node, "password"));
+        strcpy(apn_list->apn[node_num].apn_type,(char *)xmlGetProp(modify_node, "apn_type"));
         node_num ++;
         modify_node = modify_node->next;
     }
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq_qser_data_apn.xml b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq_qser_data_apn.xml
index 590d493..ddc89a9 100644
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq_qser_data_apn.xml
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq_qser_data_apn.xml
@@ -1,3 +1,3 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <lynq_qser_data_apn>
-  <apn profile_idx="0" pdp_type="3" auth_proto="0" apn_name="default" username="NULL" password="NULL" apn_type="default"/></lynq_qser_data_apn>
\ No newline at end of file
+  <apn profile_idx="0" pdp_type="3" auth_proto="0" apn_name="default" username="NULL" password="NULL" apn_type="iot_default"/></lynq_qser_data_apn>
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 b11ebb9..121425e 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
@@ -90,7 +90,7 @@
     {"LYNQ_QSER_ENABLE_PIN",qser_enable_pin_test, "enable pin", LYNQ_QSER_ENABLE_PIN},
     {"LYNQ_QSER_DISABLE_PIN",qser_disable_pin_test, "disable pin", LYNQ_QSER_DISABLE_PIN},
     {"LYNQ_QSER_GET_SIM_STATUS",qser_get_sim_status_test, "get sim status", LYNQ_QSER_GET_SIM_STATUS},
-    {"LYNQ_SIM_DEINIT",qser_deinit_sim, "deinit sim lib", LYNQ_QSER_SIM_DEINIT},
+    {"LYNQ_QSER_SIM_DEINIT",qser_deinit_sim, "deinit sim lib", LYNQ_QSER_SIM_DEINIT},
 //QSER SMS
     {"LYNQ_QSER_SMS_INIT",qser_init_sms, "init the sms lib", LYNQ_QSER_SMS_INIT},
     {"LYNQ_QSER_SMS_DEINIT",qser_deinit_sms, "deinit the sms lib", LYNQ_QSER_SMS_DEINIT},
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-gnss-demo/include/lynq-qser-gnss-demo.h b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-gnss-demo/include/lynq-qser-gnss-demo.h
new file mode 100755
index 0000000..c472cf5
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-gnss-demo/include/lynq-qser-gnss-demo.h
@@ -0,0 +1,128 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum
+{
+                                                /**<  0  reserve  */
+    E_MT_LOC_MSG_ID_LOCATION_INFO = 1,          /**<  pv_data = &QL_LOC_LOCATION_INFO_T  */
+                                                /**<  2  reserve  */
+    E_MT_LOC_MSG_ID_NMEA_INFO = 3,              /**<  pv_data = &QL_LOC_NMEA_INFO_T  */
+}e_msg_id_t;
+
+#define MOPEN_GNSS_NMEA_MAX_LENGTH  255                 /**  NMEA string maximum length. */
+typedef struct
+{
+    int64_t     timestamp;                              /**<   System Timestamp, marked for when got the nmea data */
+    int         length;                                 /**<   NMEA string length. */
+    char        nmea[MOPEN_GNSS_NMEA_MAX_LENGTH + 1];   /**<   NMEA string.*/
+}mopen_gnss_nmea_info_t;  /* Message */
+
+struct mopen_location_info_t
+{
+    uint32_t    size;                   /**<   Set to the size of mcm_gps_location_t. */
+    int flags;                          /**<   Contains GPS location flags bits. */
+    int position_source;                /**<   Provider indicator for HYBRID or GPS. */
+    double      latitude;               /**<   Latitude in degrees. */
+    double      longitude;              /**<   Longitude in degrees. */
+    double      altitude;               /**<   Altitude in meters above the WGS 84 reference ellipsoid. */
+    float       speed;                  /**<   Speed in meters per second. */
+    float       bearing;                /**<   Heading in degrees. */
+    float       accuracy;               /**<   Expected accuracy in meters. */
+    int64_t     timestamp;              /**<   Timestamp for the location fix in UTC million-second base.  */
+    int32_t     is_indoor;              /**<   Location is indoors. */
+    float       floor_number;           /**<   Indicates the floor number. */
+};
+
+/*Instantiate callback function*/
+void cb
+(
+        uint32_t    h_loc,
+        e_msg_id_t  e_msg_id,
+        void        *pv_data,
+        void        *context_ptr
+        )
+{
+    printf("e_msg_id=%d\n", e_msg_id);
+    switch(e_msg_id)
+    {
+    case E_MT_LOC_MSG_ID_LOCATION_INFO:
+    {
+        mopen_location_info_t *pt_location = (mopen_location_info_t *)pv_data;
+        printf("**** flag=0x%X, Latitude = %f, Longitude=%f, altitude = %f, speed = %f, timestamp = %lld ****\n",
+               pt_location->flags,
+               pt_location->latitude,
+               pt_location->longitude,
+               pt_location->altitude,
+               pt_location->speed,
+               pt_location->timestamp);
+        break;
+    }
+    case E_MT_LOC_MSG_ID_NMEA_INFO:
+    {
+        mopen_gnss_nmea_info_t  *pt_nmea = (mopen_gnss_nmea_info_t *)pv_data;
+
+        printf("**** NMEA info: timestamp=%lld, length=%d, nmea=%s ****\n",
+               pt_nmea->timestamp, pt_nmea->length, pt_nmea->nmea);
+        break;
+    }
+    }
+}
+
+typedef void (*gnss_handler_func_t)
+(
+        uint32_t    h_loc,
+        e_msg_id_t  e_msg_id,
+        void        *pv_data,
+        void        *context_ptr
+        );
+
+typedef enum {
+    DELETE_NOTHING = 0,        /**< Delete nothing. */
+    DELETE_EPHEMERIS = 1,      /**< Delete ephemeris data. */
+    DELETE_ALMANAC = 2,        /**< Delete almanac data. */
+    DELETE_POSITION_TIME = 3,  /**< Delete position and time data. */
+    DELETE_UTC = 4,            /**< Delete UTC data. */
+    DELETE_ALL = 5,            /**< Delete all location data. */
+}DELETE_AIDING_DATA_TYPE_T;
+
+typedef struct 
+{
+    uint32_t year; // >1980
+    uint32_t month; // 1-12
+    uint32_t day; // 1-31
+    uint32_t hour; // 0-23
+    uint32_t minute; // 0-59
+    uint32_t second; // 0-59
+    uint32_t millisecond; // 0-999
+}LYNQ_INJECT_TIME_INTO_T; /* Message */
+
+
+void user_help(void)
+{
+    printf("\t-1 exit\n"
+           "\t1 gnss init\n"
+           "\t2 gnss deinit \n"
+           "\t3 gnss add handle function\n"
+           "\t4 gnss set single mode\n"
+           "\t5 gnss set get_para_from_nmea mode\n"
+           "\t6 gnss start\n"
+           "\t7 gnss stop\n"
+           "\t8 gnss Delete_Aiding_Data and reset\n"
+           "\t9 gnss injecttime\n"
+           "please input operator: >> ");
+}
+void delete_type(void)
+{
+    printf("\t0 DELETE_NOTHING\n"
+           "\t1 DELETE_EPHEMERIS\n"
+           "\t2 DELETE_ALMANAC\n"
+           "\t3 DELETE_POSITION_TIME \n"
+           "\t4 DELETE_UTC\n"
+           "\t5 DELETE_ALL\n"
+           "please input operator: >> ");
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-gnss-demo/lynq-qser-gnss-demo.cpp b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-gnss-demo/lynq-qser-gnss-demo.cpp
new file mode 100755
index 0000000..01aa10e
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-gnss-demo/lynq-qser-gnss-demo.cpp
@@ -0,0 +1,213 @@
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <termios.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <termios.h>
+#include <time.h>
+#include <sys/ioctl.h>
+#include <dlfcn.h>
+#include <stdint.h>
+#include "lynq-qser-gnss-demo.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+int (*qser_Gnss_Init)(uint32_t *h_gnss);
+int (*qser_Gnss_Deinit)(uint32_t);
+int (*qser_AddRxIndMsgHandler)(gnss_handler_func_t handler_ptr,uint32_t);
+int (*qser_Set_Indications)(uint32_t h_gnss,e_msg_id_t);
+int (*qser_Gnss_Start)(uint32_t h_gnss);
+int (*qser_Gnss_Stop)(uint32_t h_gnss);
+int (*qser_Gnss_Delete_Aiding_Data)(uint32_t,DELETE_AIDING_DATA_TYPE_T);
+int (*qser_Gnss_InjectTime)(uint32_t,LYNQ_INJECT_TIME_INTO_T *time_info);
+void *dlHandle_gnss;
+
+int main(int argc, char *argv[])
+{
+    int ret;
+    int opt = 0;
+    char *lynqLib_gnss = "/lib/liblynq-qser-gnss.so";
+    char dev_file[12] = {0};
+    uint32_t ph_gnss;
+    dlHandle_gnss = dlopen(lynqLib_gnss, RTLD_NOW);
+    while(1)
+    {
+        printf("=========gnss main=========\n");
+        user_help();
+        scanf("%d", &opt);
+        switch (opt)
+        {
+        case -1:
+        {
+            printf("main exit\n");
+            return 0;
+        }
+
+        case 1:
+        {
+            qser_Gnss_Init=(int(*)(uint32_t *h_gnss))dlsym(dlHandle_gnss, "qser_Gnss_Init");
+            ret = qser_Gnss_Init(&ph_gnss);
+            if(ret < 0)
+            {
+                printf("mopen_gnss_client_init FAIL.\n");
+                return -1;
+            }
+            printf("mopen_gnss_client_init success , with address=%d\n",  ph_gnss);
+            break;
+        }
+        case 2:
+        {
+            qser_Gnss_Deinit=(int(*)(uint32_t))dlsym(dlHandle_gnss, "qser_Gnss_Deinit");
+            ret =qser_Gnss_Deinit(ph_gnss);
+            if(ret < 0)
+            {
+                printf("mopen_gnss_client_init FAIL.\n");
+                return -1;
+            }
+            printf("mopen_gnss_client_Deinit success ");
+            return 0;
+        }
+        case 3:
+        {
+            qser_AddRxIndMsgHandler=(int(*)(gnss_handler_func_t,uint32_t))dlsym(dlHandle_gnss, "qser_AddRxIndMsgHandler");
+            ret = qser_AddRxIndMsgHandler((gnss_handler_func_t)&cb,ph_gnss);
+            if(ret < 0)
+            {
+                printf("lynq_AddRxIndMsgHandler\n");
+                qser_Gnss_Deinit(ph_gnss);
+                return -1;
+            }
+            printf("add success\n");
+            break;
+        }
+        case 4:
+        {
+            e_msg_id_t ptr2=E_MT_LOC_MSG_ID_LOCATION_INFO;
+            qser_Set_Indications=(int(*)(uint32_t h_gnss,e_msg_id_t))dlsym(dlHandle_gnss, "qser_Set_Indications");
+            ret = qser_Set_Indications(ph_gnss,ptr2);
+            if(ret < 0)
+            {
+                printf("lynq_Set_LOCATION_INFO fail\n");
+                qser_Gnss_Deinit(ph_gnss);
+                return -1;
+            }
+            printf("set location mode success\n");
+            break;
+        }
+        case 5:
+        {
+            e_msg_id_t ptr4=E_MT_LOC_MSG_ID_NMEA_INFO;
+            qser_Set_Indications=(int(*)(uint32_t h_gnss,e_msg_id_t))dlsym(dlHandle_gnss, "qser_Set_Indications");
+            ret = qser_Set_Indications(ph_gnss,ptr4);
+            if(ret < 0)
+            {
+                printf("lynq_Set_NMEA_INFO fail\n");
+                qser_Gnss_Deinit(ph_gnss);
+                return -1;
+            }
+            printf("set nmea mode success\n");
+            break;
+            
+        }
+        case 6:
+        {
+            qser_Gnss_Start=(int(*)(uint32_t))dlsym(dlHandle_gnss, "qser_Gnss_Start");
+            ret = qser_Gnss_Start(ph_gnss);
+            if(ret < 0)
+            {
+                printf("lynq_Gnss_Start fail\n");
+                return -1;
+            }
+            printf("start success\n");
+            break;
+        }
+        case 7:
+        {
+            qser_Gnss_Stop=(int(*)(uint32_t))dlsym(dlHandle_gnss, "qser_Gnss_Stop");
+            ret = qser_Gnss_Stop(ph_gnss);
+            if(ret < 0)
+            {
+                printf("lynq_Gnss_Stop fail\n");
+                qser_Gnss_Deinit(ph_gnss);
+                return -1;
+            }
+            break;
+            printf("stop success\n");
+        }
+
+        case 8:
+        {
+            int opt_1;
+            DELETE_AIDING_DATA_TYPE_T ptr;
+            qser_Gnss_Delete_Aiding_Data=(int(*)(uint32_t,DELETE_AIDING_DATA_TYPE_T))dlsym(dlHandle_gnss, "qser_Gnss_Delete_Aiding_Data");
+            printf("=========delete aiding data type=========\n");
+            delete_type();
+            scanf("%d", &opt_1);
+            switch(opt_1)
+            {
+            case 0:
+            {
+                ptr = DELETE_NOTHING;//hot
+            }
+            case 1:
+            {
+                ptr = DELETE_EPHEMERIS;//warm
+            }
+            case 2:
+            {
+                ptr = DELETE_ALMANAC;
+            }
+            case 3:
+            {
+                ptr = DELETE_POSITION_TIME;
+            }
+            case 4:
+            {
+                ptr = DELETE_UTC;
+            }
+            case 5:
+            {
+                ptr = DELETE_ALL;//cold
+            }
+            }
+            ret = qser_Gnss_Delete_Aiding_Data(ph_gnss,ptr);
+            if(ret < 0)
+            {
+                printf("lynq_Gnss_Delete_Aiding_Data %d fail\n",opt_1);
+                qser_Gnss_Deinit(ph_gnss);
+                return -1;
+            }
+            printf("lynq_Gnss_Delete_Aiding_Data %d success\n",opt_1);
+            break;
+        }
+        case 9:
+        {
+            LYNQ_INJECT_TIME_INTO_T time_test;
+            qser_Gnss_InjectTime=(int(*)(uint32_t,LYNQ_INJECT_TIME_INTO_T *time_info))dlsym(dlHandle_gnss, "qser_Gnss_InjectTime");
+            ret = qser_Gnss_InjectTime(ph_gnss,&time_test);
+            if(ret < 0)
+            {
+                printf("lynq_Gnss_InjectTime fail\n");
+                qser_Gnss_Deinit(ph_gnss);
+                return -1;
+            }
+            printf("lynq_Gnss_InjectTime success\n");
+            break;
+        }
+        }
+    }
+    return 0;
+}
+#ifdef __cplusplus
+}
+#endif
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-gnss-demo/makefile b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-gnss-demo/makefile
new file mode 100755
index 0000000..637163d
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-gnss-demo/makefile
@@ -0,0 +1,50 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+                -std=gnu++14 \
+                -g -Os \
+                -flto \
+                -fpermissive \
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+LOCAL_CFLAGS += -Wno-error=format-security
+
+LOCAL_PATH   = .
+
+LOCAL_C_INCLUDES = \
+  -I. \
+  -I$(LOCAL_PATH)/include/ \
+  -I$(ROOT)$(includedir)/liblog \
+
+
+LOCAL_LIBS := \
+    -L. \
+    -ldl \
+    -lstdc++ \
+    -lpthread \
+
+
+SOURCES = lynq-qser-gnss-demo.cpp
+
+EXECUTABLE = lynq-qser-gnss-demo
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+OBJECTS_TOOL=$(SOURCES_TOOL:.cpp=.o)
+all: $(EXECUTABLE) 
+
+$(EXECUTABLE): $(OBJECTS)
+	$(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+	$(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+	$(RM) $(OBJECTS) $(EXECUTABLE)
+	$(RM) $(OBJECTS_TOOL) $(EXECUTABLE)
+
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-voice-demo/lynq-qser-voice-demo.cpp b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-voice-demo/lynq-qser-voice-demo.cpp
index 3e69508..5f421c9 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-voice-demo/lynq-qser-voice-demo.cpp
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-voice-demo/lynq-qser-voice-demo.cpp
Binary files differ