Fixed wrong password retry crash issue 25/137925/2
authorAbhishek Sansanwal <abhishek.s94@samsung.com>
Mon, 10 Jul 2017 09:08:47 +0000 (14:38 +0530)
committerAbhishek Sansanwal <abhishek.s94@samsung.com>
Mon, 10 Jul 2017 10:25:25 +0000 (15:55 +0530)
Signed-off-by: Abhishek Sansanwal <abhishek.s94@samsung.com>
Change-Id: I1cf3faf4081c2deff528ee420298eb9e851d426f

include/layout/layout_network.h
src/layout/layout_network.c

index c612bcd..cba810e 100644 (file)
@@ -50,6 +50,8 @@ struct _priv {
 
        struct _connection_data *wired;
        struct menumgr *menu;
+
+       char *connecting_essid;
 };
 
 
index 170a06b..caa35e4 100644 (file)
@@ -82,6 +82,7 @@ static void _focused_menu(void *data, int id);
 static void _selected(void *data, int id);
 static char *_get_connected_ap(void *data, int id);
 static void _selected_menu(void *data, int id);
+static void _grid_find_retry_ap(Elm_Object_Item *it, void *data);
 void network_wireless_set_update_callbacks(void *data);
 void network_wired_set_update_callbacks(void *data);
 
@@ -451,7 +452,7 @@ static void _wired_retry_cb(void *data, Evas_Object *obj, void *ei)
 }
 static void _wireless_retry_cb(void *data, Evas_Object *obj, void *ei)
 {
-       struct _priv *priv;;
+       struct _priv *priv;
        priv = data;
 struct wifi_manager_ap_info *ap_info;
        char *essid;
@@ -460,6 +461,9 @@ struct wifi_manager_ap_info *ap_info;
         if (!priv)
                 return;
 
+       viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_FOREACH,
+                               _grid_find_retry_ap);
+       free(priv->connecting_essid);
        ap_info = elm_object_item_data_get(priv->connecting_wireless_item);
        essid = ap_info->essid;
        _destroy_wireless_status_popup();
@@ -945,6 +949,35 @@ static void _grid_set_unfocus(Elm_Object_Item *it, void *data)
        if (it != priv->focused_wireless_item)
                elm_object_item_signal_emit(it, SIG_LIST_ITEM_UNFOCUS, SRC_ELM);
 }
+static bool _compare_ap_name(const char *ap_name, const char *ap_name_part)
+{
+       int ap_name_len = strlen(ap_name);
+       int ap_name_part_len = strlen(ap_name_part);
+
+       if (strncmp(ap_name, ap_name_part,
+                               ap_name_len > ap_name_part_len ? ap_name_len : ap_name_part_len) == 0)
+               return true;
+       else
+               return false;
+}
+
+
+static void _grid_find_retry_ap(Elm_Object_Item *it, void *data)
+{
+       struct wifi_manager_ap_info *ap_info = NULL;
+       struct _priv *priv = data;
+       if (NULL == priv) {
+               _ERR("User data not found");
+               return;
+       }
+
+       ap_info = elm_object_item_data_get(it);
+
+       if (_compare_ap_name(priv->connecting_essid, ap_info->essid)) {
+               priv->connecting_wireless_item = it;
+               priv->selected_wireless_item = it;
+       }
+}
 
 static void _grid_remove_connecting_state(Elm_Object_Item *it, void *data)
 {
@@ -998,6 +1031,7 @@ void _wireless_selected_cb(Elm_Object_Item *it, void *data)
                return;
        }
 
+       priv->connecting_essid = strdup(ap_info->essid);
        if (ap_info->connection_state == WIFI_MANAGER_CONNECTION_STATE_CONNECTED) {
                _ERR("Already connected AP.");
                return;