Disconnect and forget the AP when removing the AP configuration. 38/192238/4 submit/tizen/20181120.123835
authorJaehyun Kim <jeik01.kim@samsung.com>
Thu, 1 Nov 2018 08:55:56 +0000 (17:55 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 20 Nov 2018 08:41:17 +0000 (08:41 +0000)
Change-Id: I2daf6e343e796012eee2d48e322b73c1d6463c74
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/wifi_internal.c

index b8262e4..f54af56 100755 (executable)
@@ -2934,6 +2934,7 @@ int _wifi_foreach_configuration(wifi_manager_config_list_cb callback, void *user
 int _wifi_remove_configuration(const gchar *config_id)
 {
        int rv;
+       GSList *list;
 
        rv = net_config_remove_configurations(config_id);
        if (rv == NET_ERR_ACCESS_DENIED) {
@@ -2942,6 +2943,34 @@ int _wifi_remove_configuration(const gchar *config_id)
        } else if (rv != NET_ERR_NONE)
                return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
+       rv = __update_profile_iterator();
+       if (rv == NET_ERR_ACCESS_DENIED) {
+               WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+       }
+
+       if ((int)g_slist_length(profile_iterator) == 0) {
+               WIFI_LOG(WIFI_WARN, "There is no AP"); //LCOV_EXCL_LINE
+               return WIFI_MANAGER_ERROR_NONE; //LCOV_EXCL_LINE
+       }
+
+       for (list = profile_iterator; list; list = list->next) {
+               net_profile_info_s *prof_info = (net_profile_info_s *)list->data;
+               if (g_str_has_suffix((gchar*)(prof_info->ProfileName), config_id) == TRUE) {
+
+                       rv = net_delete_profile(prof_info->ProfileName); //LCOV_EXCL_LINE
+                       if (rv == NET_ERR_ACCESS_DENIED) {
+                               WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+                               return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+                       } else if (rv != NET_ERR_NONE) {
+                               return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+                       }
+
+                       prof_info->Favourite = (char)FALSE; //LCOV_EXCL_LINE
+                       break;
+               }
+       }
+
        return WIFI_MANAGER_ERROR_NONE;
 }