[Bugfix][API-1365][API-1390] fake scan result during autoconnect;not report scan result during manual connect

Only Configure: No
Affected branch: GSW3.0-No-Connman
Affected module: wifi6
Is it affected on both ZXIC and MTK: only MTK
Self-test: Yes
Doc Update:No

Change-Id: I92d0b3771e768e0c230b2454b159c0709f30a561
diff --git a/lib/liblynq-wifi6/libwifi6.c b/lib/liblynq-wifi6/libwifi6.c
index 70d66cb..221170c 100755
--- a/lib/liblynq-wifi6/libwifi6.c
+++ b/lib/liblynq-wifi6/libwifi6.c
@@ -54,6 +54,7 @@
 volatile int g_sta_scan_finish_flag = 1;
 volatile int g_sta_watcher_started_flag = 0;
 volatile int g_sta_conncet_status_flag = 0;
+volatile int g_sta_fake_scan_finish_flag = 0;
 
 pthread_t g_sta_auto_watcher_pid = 0;
 volatile int g_sta_auto_watcher_stop_flag = 0;
@@ -1308,6 +1309,11 @@
             {
                 notify_connect_status(LYNQ_WIFI_STA_STATUS_DISCONNECT, error);
             }
+            else if (state == LYNQ_WIFI_STA_STATUS_SCAN_RESULT &&
+                     s_sta_status != INNER_STA_STATUS_INIT && g_sta_conncet_status_flag != 0)
+            {
+                RLOGD("donot report scan result during in call connect manual");
+            }
             else
             {
                 notify_connect_status(state, error);
@@ -1330,6 +1336,11 @@
                 }
 
                 last_state = state;
+                if (g_sta_fake_scan_finish_flag == 1)
+                {
+                    g_sta_fake_scan_finish_flag = 0;
+                    notify_connect_status(LYNQ_WIFI_STA_STATUS_SCAN_RESULT, 0);
+                }
             }
         }
     }
@@ -3706,6 +3717,7 @@
 
     pthread_mutex_lock(&s_global_check_mutex);
     s_sta_status = INNER_STA_STATUS_CONNECTING;
+    g_sta_conncet_status_flag = 1;
     strcpy(s_sta_current_connecting_ssid, ssid);
     struct timeval now;
     gettimeofday(&now,NULL);
@@ -4205,11 +4217,18 @@
 
 int lynq_wifi_sta_start_scan(lynq_wifi_index_e idx)
 {
-    if ( g_sta_conncet_status_flag != 0 )
+    if ( s_sta_status == INNER_STA_STATUS_INIT && g_sta_conncet_status_flag != 0 )
     {
-        RLOGD("current sta is connecting dest ap");
+        RLOGD("current sta is autoconnecting dest ap,fake scan result");
+        g_sta_fake_scan_finish_flag = 1;
+        return 0;
+    }
+    else if (g_sta_conncet_status_flag != 0)
+    {
+        RLOGD("current sta is connecting dest ap, don't scan");
         return 1;
     }
+
     const char *clean_last_re ="wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 bss_flush";
     const char *lynq_scan_cmd = "SCAN";