[Bugfix][API-1534]After turning on the USB port, delay for 3 seconds to make a  call

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

Change-Id: Iab675a2e4ac6ac502d0f28499bb47e8ac95565c7
diff --git a/common_src/lib/liblynq-call/lynq_call.cpp b/common_src/lib/liblynq-call/lynq_call.cpp
index 8e6943d..0b7e385 100755
--- a/common_src/lib/liblynq-call/lynq_call.cpp
+++ b/common_src/lib/liblynq-call/lynq_call.cpp
@@ -30,7 +30,8 @@
 #define AUDIO_CTRL_SER "/tmp/audio_ctrl_service"

 #define LIBMODEM_AFE "/tmp/libmodem-afe-ctrl"

 #define TELE_DEMO_LOCK "/tmp/tel_demo_single_proc.lock"

-

+#define CALL_REBOOT_FLAG "/tmp/.call_reboot_flag"

+#define SYSTEM_UPTIME 40

 #define MAX_RING_INCOMING_INTERVAL 10

 

 using ::android::Parcel;

@@ -989,6 +990,49 @@
     return 0;

 }

 

+int call_boot_check()

+{

+    FILE *file = NULL;

+    int uptime = 0;

+

+    file = fopen("/proc/uptime", "r");

+    if(file == NULL) 

+    {

+        LYERRLOG("Error opening /proc/uptime");

+        return -1;

+    }

+    

+    if(fscanf(file, "%d ", &uptime) != 1) 

+    {

+        LYERRLOG("Error reading uptime value");

+    }

+    

+    fclose(file);

+

+    if(uptime > SYSTEM_UPTIME) 

+    {

+        LYINFLOG("System uptime is greater than 40 seconds.");

+    } 

+    else 

+    {

+        LYINFLOG("System uptime is less than 40 seconds.");

+        FILE *fp = NULL;

+        if(check_file_access(CALL_REBOOT_FLAG) != 0)

+        {

+            usleep(3000000);

+            fp = fopen(CALL_REBOOT_FLAG,"w");

+            if(fp == NULL)

+            {

+                LYERRLOG("Creat call reboot flag file failed !!!!");

+                return -1;

+            }

+            LYINFLOG("Creat flag file success");

+            fclose(fp);

+        }

+    }

+    return 0;

+

+}

 int lynq_call(int* handle,char addr[])

 {

     if(g_module_init_flag != MODULE_RUNNING)

@@ -997,6 +1041,11 @@
         return LYNQ_E_CONFLICT;

     }

     try_reset_audio_service();

+

+#ifdef GSW_RIL_CFG

+    call_boot_check();

+#endif

+

     int lynq_call_id = -1;

 

     LYINFLOG("lynq_call begin addr %s",addr);