[net-config] Suspend/Resume WLAN driver
[platform/core/connectivity/net-config.git] / src / wifi-state.c
index 30c740f..237e2e0 100755 (executable)
@@ -480,6 +480,7 @@ void wifi_state_update_power_state(gboolean powered)
                /* Inform net-popup to remove the wifi found notification */
                netconfig_send_notification_to_net_popup(NETCONFIG_DEL_FOUND_AP_NOTI, NULL);
                netconfig_send_notification_to_net_popup(NETCONFIG_DEL_PORTAL_NOTI, NULL);
+               netconfig_send_notification_to_net_popup(NETCONFIG_DEL_IP_CONFLICT_NOTI, NULL);
 
                _deregister_network_notification();
        }
@@ -540,12 +541,14 @@ void wifi_state_set_service_state(wifi_service_state_e new_state)
        DBG("Wi-Fi service state, old state[%s] ==> new state[%s]",
                _convert_wifi_service_state_to_string(old_state), _convert_wifi_service_state_to_string(new_state));
 
-       /* During DHCP, temporarily disable Wi-Fi power saving */
-       if ((old_state < NETCONFIG_WIFI_ASSOCIATION || old_state == NETCONFIG_WIFI_FAILURE) && new_state == NETCONFIG_WIFI_CONFIGURATION) {
+       /* From association, temporarily disable Wi-Fi power saving */
+       if ((old_state < NETCONFIG_WIFI_ASSOCIATION || old_state == NETCONFIG_WIFI_FAILURE) && new_state == NETCONFIG_WIFI_ASSOCIATION) {
                _set_power_lock(TRUE);
+               wifi_set_early_suspend(FALSE);
                dhcp_stage = TRUE;
-       } else if (dhcp_stage == TRUE) {
+       } else if (dhcp_stage == TRUE && new_state != NETCONFIG_WIFI_CONFIGURATION) {
                _set_power_lock(FALSE);
+               wifi_set_early_suspend(TRUE);
                dhcp_stage = FALSE;
        }
 
@@ -724,7 +727,7 @@ void wifi_state_get_connected_essid(gchar **essid)
  */
 gboolean handle_get_wifi_state(Wifi *wifi, GDBusMethodInvocation *context)
 {
-       g_return_val_if_fail(wifi != NULL, FALSE);
+       g_return_val_if_fail(wifi != NULL, TRUE);
        GVariant *param = NULL;
        wifi_tech_state_e tech_state = NETCONFIG_WIFI_TECH_UNKNOWN;
        wifi_service_state_e service_state = NETCONFIG_WIFI_UNKNOWN;