Change the package name
[platform/core/connectivity/net-popup.git] / src / net-popup.c
index 4ec76b8..08d9b93 100755 (executable)
@@ -3,7 +3,7 @@
 *
 * Copyright 2012  Samsung Electronics Co., Ltd
 *
-* Licensed under the Flora License, Version 1.0 (the "License");
+* Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 #include <tzplatform_config.h>
 #include <vpn_service.h>
 #include <vpn_service_internal.h>
+#include <stc.h>
+#include <stc_internal.h>
+#include <system_info.h>
 
 #include "net-popup.h"
+#include "net-popup-w.h"
 #include "net-popup-vpn.h"
 #include "net-popup-strings.h"
 
+#define NET_POPUP_APPID                "org.tizen.net-popup"
 #define NET_WIFIQS_APPID       "net.wifi-qs"
+#define DATA_USAGE_APPID       "org.tizen.setting"
+#define WIFI_EFL_UG                    "wifi-efl-ug"
 
 #define LOCALEDIR                      "/usr/share/locale"
-#define NETPOPUP_EDJ    tzplatform_mkpath(TZ_SYS_RO_UG, "/res/edje/net-popup/netpopup-custom.edj")
+#define NETPOPUP_EDJ                   "/usr/apps/" \
+                                       NET_POPUP_APPID \
+                                       "/res/edje/netpopup-custom.edj"
 #define QP_PRELOAD_NOTI_ICON_PATH      tzplatform_mkpath(TZ_SYS_RO_APP, "/org.tizen.quickpanel/shared/res/noti_icons/Wi-Fi")
 
+#define STC_NOTI_DATA_USAGE_ICON_PATH  "/usr/share/icons/"
+#define STC_NOTI_DATA_USAGE_ICON_NAME  "stc_noti_datausage.png"
+
 #define NETCONFIG_NOTIFICATION_WIFI_ICON \
                                        tzplatform_mkpath(TZ_SYS_RO_ICONS, "/noti_wifi_in_range.png")
 #define NETCONFIG_NOTIFICATION_WIFI_ICON_LITE \
 #define NETCONFIG_NOTIFICATION_WIFI_IN_RANGE_ICON_LITE \
                                        tzplatform_mkpath(TZ_SYS_RO_ICONS, "/noti_wifi_in_range.png")
 #define NETCONFIG_NOTIFICATION_WIFI_FOUND_TITLE \
-               dgettext(PACKAGE, "IDS_COM_BODY_WI_FI_NETWORKS_AVAILABLE")
+               dgettext(DOMAIN_NAME, "IDS_COM_BODY_WI_FI_NETWORKS_AVAILABLE")
 #define NETCONFIG_NOTIFICATION_WIFI_FOUND_CONTENT \
-               dgettext(PACKAGE, "IDS_WIFI_SBODY_TAP_HERE_TO_CONNECT")
+               dgettext(DOMAIN_NAME, "IDS_WIFI_SBODY_TAP_HERE_TO_CONNECT")
 #define NETCONFIG_NOTIFICATION_WIFI_PORTAL_TITLE \
-                       dgettext(PACKAGE, "IDS_WIFI_HEADER_SIGN_IN_TO_WI_FI_NETWORK_ABB")
+               dgettext(DOMAIN_NAME, "IDS_WIFI_HEADER_SIGN_IN_TO_WI_FI_NETWORK_ABB")
+#define NETCONFIG_NOTIFICATION_IP_CONFLICT_TITLE \
+               dgettext(DOMAIN_NAME, "IDS_IP_CONFLICT")
 #define NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT "\"%s\""
 
+#define STC_NOTIFICATION_WARNING_TITLE \
+               dgettext(DOMAIN_NAME, "IDS_COM_BODY_DATA_USAGE_WARNING")
+#define STC_NOTIFICATION_WARNING_CONTENT \
+               dgettext(DOMAIN_NAME, "IDS_SM_SBODY_TAP_HERE_TO_VIEW_YOUR_DATA_USAGE_ABB")
+#define STC_NOTIFICATION_RESTRICTION_OK_TITLE \
+               dgettext(DOMAIN_NAME, "IDS_SM_HEADER_MOBILE_DATA_TURNED_OFF_ABB2")
+#define STC_NOTIFICATION_RESTRICTION_OK_CONTENT \
+               dgettext(DOMAIN_NAME, "IDS_SM_SBODY_TAP_HERE_TO_TURN_IT_ON_AGAIN_ABB")
+#define STC_NOTIFICATION_RESTRICTION_ON_TITLE \
+               dgettext(DOMAIN_NAME, "IDS_SM_TMBODY_MOBILE_DATA_LIMIT_EXCEEDED_ABB")
+
+#define STC_TOTAL_DATACALL "TOTAL_DATACALL"
+#define STC_TOTAL_WIFI "TOTAL_WIFI"
+#define STC_TOTAL_BLUETOOTH "TOTAL_BLUETOOTH"
+
 #define USER_RESP_LEN 30
 #define ICON_PATH_LEN 128
 #define RESP_REMAIN_CONNECTED                          "RESP_REMAIN_CONNECTED"
@@ -82,6 +111,8 @@ static Ecore_Event_Handler *ecore_event_evas_quick_panel_handler;
 long sizes[] = {1073741824, 1048576, 1024, 0};
 char *units[] = {"GB", "MB", "KB", "B"};
 
+static tizen_profile_t g_profile = TIZEN_PROFILE_UNKNOWN;
+
 static app_control_h g_req_handle = NULL;
 static char *resp_popup_mode = NULL;
 
@@ -95,9 +126,15 @@ static char *iface_name = NULL;
 static Eina_Bool turn_on_roaming = FALSE;
 static Eina_Bool do_not_show_popup = FALSE;
 
+/* data usage popup */
+static char *data_usage_app_id = NULL;
+static char *data_usage_iftype = NULL;
+
 static int __net_popup_show_notification(app_control_h request, void *data);
 static int __toast_popup_show(app_control_h request, void *data);
 static int __net_popup_show_popup(app_control_h request, void *data);
+static void __net_popup_show_warning_noti(app_control_h request, void *data);
+static void __net_popup_show_restriction_noti(app_control_h request, void *data);
 static void __net_popup_add_found_ap_noti(void);
 static void __net_popup_del_found_ap_noti(void);
 static void __net_popup_add_portal_noti(app_control_h request);
@@ -106,6 +143,42 @@ static void __net_popup_show_popup_with_user_resp(app_control_h request, void *d
 static void __net_popup_show_vpn_popup(app_control_h request, void *data);
 static int _net_popup_send_user_resp(char *resp, Eina_Bool state);
 static int __net_popup_show_network_error_popup(app_control_h request, void *data);
+static void __net_popup_add_ip_conflict_noti(app_control_h request);
+static void __net_popup_del_ip_conflict_noti(void);
+
+static void __net_popup_get_tizen_profile(void)
+{
+       char *profile_name = NULL;
+
+       system_info_get_platform_string("http://tizen.org/feature/profile", &profile_name);
+
+       switch (*profile_name) {
+       case 'm':
+       case 'M':
+               g_profile = TIZEN_PROFILE_MOBILE;
+               log_print(NET_POPUP, "mobile profile\n");
+               break;
+       case 'w':
+       case 'W':
+               g_profile = TIZEN_PROFILE_WEARABLE;
+               log_print(NET_POPUP, "wearable profile\n");
+               break;
+       case 't':
+       case 'T':
+               g_profile = TIZEN_PROFILE_TV;
+               log_print(NET_POPUP, "tv profile\n");
+               break;
+       case 'i':
+       case 'I':
+               g_profile = TIZEN_PROFILE_IVI;
+               log_print(NET_POPUP, "ivi profile\n");
+               break;
+       default:
+               g_profile = TIZEN_PROFILE_COMMON;
+               log_print(NET_POPUP, "common profile\n");
+       }
+       free(profile_name);
+}
 
 GDBusProxy *__net_popup_init_dbus(void)
 {
@@ -120,9 +193,9 @@ GDBusProxy *__net_popup_init_dbus(void)
        }
 
        proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
-                       "net.netpopup",
+                       NET_POPUP_APPID,
                        "/Netpopup",
-                       "net.netpopup",
+                       NET_POPUP_APPID,
                        NULL, &err);
 
        if (proxy == NULL) {
@@ -150,47 +223,68 @@ void __net_popup_deinit_dbus(void)
        return;
 }
 
-int __net_popup_send_dbus_msg(const char *resp)
+void __net_popup_send_data_usage_msg(const char *app_id,
+       const char *iftype)
 {
-       log_print(NET_POPUP, "__net_popup_send_dbus_msg()\n");
+       log_print(NET_POPUP, "__net_popup_send_data_usage_msg()\n");
 
-       if (conn == NULL || resp == NULL)
-               return -1;
+       int ret = STC_ERROR_NONE;
+       stc_h stc = NULL;
+       stc_restriction_rule_h rule = NULL;
 
-       GDBusConnection *gconn = NULL;
-       GVariant *msg = NULL;
-       char *module = "wifi";
-       GError *err = NULL;
+       ret = stc_initialize(&stc);
+       if (ret != STC_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to initialize ret= %d\n", ret);
+               goto DONE;
+       }
 
-       gconn = g_bus_get_sync(DBUS_BUS_SYSTEM, NULL, &err);
-       if (err != NULL) {
-               g_error_free(err);
-               err = NULL;
-               return -1;
+       ret = stc_restriction_rule_create(stc, &rule);
+       if (ret != STC_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to create restriction rule ret= %d\n", ret);
+               goto DONE;
        }
 
-       msg = g_variant_new("(ss)", module, resp);
-       g_dbus_connection_emit_signal(gconn, NULL, "/Org/Tizen/Quickpanel",
-                       "org.tizen.quickpanel", "ACTIVITY", msg, &err);
-       if (err) {
-               g_error_free(err);
-               return -1;
+       ret = stc_restriction_rule_set_app_id(rule, app_id);
+       if (ret != STC_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to set application ID ret= %d\n", ret);
+               goto DONE;
+       }
+
+       ret = stc_restriction_rule_set_iface_type(rule, iftype[0] - '0');
+       if (ret != STC_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to set interface type ret= %d\n", ret);
+               goto DONE;
        }
 
-       g_variant_unref(msg);
+       ret = stc_unset_restriction(stc, rule);
+       if (ret != STC_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to unset restriction ret= %d\n", ret);
+               goto DONE;
+       }
 
-       if (gconn)
-               g_object_unref(gconn);
+       log_print(NET_POPUP, "Success to unset restriction\n");
 
+DONE:
+       if (rule) {
+               ret = stc_restriction_rule_destroy(rule);
+               if (ret != STC_ERROR_NONE)
+                       log_print(NET_POPUP, "Failed to destroy restriction rule ret= %d\n", ret);
+       }
 
-       return 0;
+       if (stc) {
+               ret = stc_deinitialize(stc);
+               if (ret != STC_ERROR_NONE)
+                       log_print(NET_POPUP, "Failed to deinitialize ret= %d\n", ret);
+       }
+
+       return;
 }
 
 static bool __net_popup_create(void *data)
 {
        log_print(NET_POPUP, "__net_popup_create()\n");
 
-       bindtextdomain(PACKAGE, LOCALEDIR);
+       bindtextdomain(DOMAIN_NAME, LOCALEDIR);
 
        return true;
 }
@@ -203,11 +297,27 @@ static void __net_popup_terminate(void *data)
                ecore_event_handler_del(ecore_event_evas_handler);
                ecore_event_evas_handler = NULL;
        }
+
        if (ecore_event_evas_quick_panel_handler) {
                ecore_event_handler_del(ecore_event_evas_quick_panel_handler);
                ecore_event_evas_quick_panel_handler = NULL;
        }
 
+       if (g_req_handle) {
+               app_control_destroy(g_req_handle);
+               g_req_handle = NULL;
+       }
+
+       if (resp_popup_mode) {
+               free(resp_popup_mode);
+               resp_popup_mode = NULL;
+       }
+
+       if (iface_name) {
+               free(iface_name);
+               iface_name = NULL;
+       }
+
        return;
 }
 
@@ -279,9 +389,18 @@ static void __net_popup_service_cb(app_control_h request, void *data)
        if (operation != NULL && g_str_equal(operation, APP_CONTROL_OPERATION_SETTING_VPN)) {
                app_control_clone(&g_req_handle, request);
                __net_popup_show_vpn_popup(request, data);
+               if (operation) {
+                       free(operation);
+                       operation = NULL;
+               }
                return;
        }
 
+       if (operation) {
+               free(operation);
+               operation = NULL;
+       }
+
        ret = app_control_get_extra_data(request, "_SYSPOPUP_TYPE_", &type);
        if (APP_CONTROL_ERROR_NONE != ret) {
                log_print(NET_POPUP, "Failed to get _SYSPOPUP_TYPE_ ret = %d", ret);
@@ -299,6 +418,11 @@ static void __net_popup_service_cb(app_control_h request, void *data)
                __toast_popup_show(request, data);
        } else if (g_str_equal(type, "popup")) {
                __net_popup_show_popup(request, data);
+       } else if (g_str_equal(type, "warning_noti")) {
+               __net_popup_show_warning_noti(request, data);
+               elm_exit();
+       } else if (g_str_equal(type, "restriction_noti")) {
+               __net_popup_show_restriction_noti(request, data);
        } else if (g_str_equal(type, "add_found_ap_noti")) {
                __net_popup_add_found_ap_noti();
                elm_exit();
@@ -311,6 +435,12 @@ static void __net_popup_service_cb(app_control_h request, void *data)
        } else if (g_str_equal(type, "del_portal_noti")) {
                __net_popup_del_portal_noti();
                elm_exit();
+       } else if (g_str_equal(type, "add_ip_conflict_noti")) {
+               __net_popup_add_ip_conflict_noti(request);
+               elm_exit();
+       } else if (g_str_equal(type, "del_ip_conflict_noti")) {
+               __net_popup_del_ip_conflict_noti();
+               elm_exit();
        } else if (g_str_equal(type, "popup_user_resp")) {
                app_control_clone(&g_req_handle, request);
                __net_popup_show_popup_with_user_resp(request, data);
@@ -552,6 +682,21 @@ static int __toast_popup_show(app_control_h request, void *data)
                        g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_WIFI_CONNECTED, "");
                log_print(NET_POPUP, "alert wifi connected\n");
                g_free(ap_name);
+       } else if (strcmp(mode, "warn threshold crossed") == 0) {
+               char *app_id = NULL;
+
+               ret = app_control_get_extra_data(request, "_APP_ID_", &app_id);
+
+               if (APP_CONTROL_ERROR_NONE != ret) {
+                       log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret);
+                       g_free(mode);
+                       return 0;
+               }
+
+               g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_DATA_USAGE_WARNING);
+
+               log_print(NET_POPUP, "alert warn threshold crossed [%s]\n", app_id);
+               g_free(app_id);
        } else if (strcmp(mode, "security restriction") == 0) {
                ret = app_control_get_extra_data(request, "_RESTRICTED_TYPE_", &restricted_type);
                if (APP_CONTROL_ERROR_NONE != ret) {
@@ -648,6 +793,24 @@ static int __net_popup_show_notification(app_control_h request, void *data)
 
                log_print(NET_POPUP, "alert wifi connected\n");
                g_free(ap_name);
+       } else if (strcmp(mode, "warn threshold crossed") == 0) {
+               char buf[ALERT_STR_LEN_MAX] = "";
+               char *app_id = NULL;
+
+               ret = app_control_get_extra_data(request, "_APP_ID_", &app_id);
+
+               if (APP_CONTROL_ERROR_NONE != ret) {
+                       log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret);
+                       g_free(mode);
+                       return 0;
+               }
+
+               g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_DATA_USAGE_WARNING);
+
+               notification_status_message_post(buf);
+
+               log_print(NET_POPUP, "alert warn threshold crossed [%s]\n", app_id);
+               g_free(app_id);
        } else {
                notification_status_message_post(mode);
                log_print(NET_POPUP, "%s\n", mode);
@@ -921,10 +1084,6 @@ void _tethering_wifi_btn_yes_cb(void *data, Evas_Object *obj, void *event_info)
        bool result = FALSE;
        Evas_Object *popup = (Evas_Object *)data;
 
-       __net_popup_init_dbus();
-       __net_popup_send_dbus_msg("progress_off");
-       __net_popup_deinit_dbus();
-
        result = _net_popup_send_user_resp(RESP_WIFI_TETHERING_OFF, FALSE);
        if (true != result)
                log_print(NET_POPUP, "Failed to send user response ");
@@ -942,10 +1101,6 @@ void _tethering_wifi_ap_btn_yes_cb(void *data, Evas_Object *obj, void *event_inf
        bool result = FALSE;
        Evas_Object *popup = (Evas_Object *)data;
 
-       __net_popup_init_dbus();
-       __net_popup_send_dbus_msg("progress_off");
-       __net_popup_deinit_dbus();
-
        result = _net_popup_send_user_resp(RESP_WIFI_AP_TETHERING_OFF, FALSE);
        if (true != result)
                log_print(NET_POPUP, "Failed to send user response ");
@@ -1006,8 +1161,10 @@ void _vpn_btn_connect_cb(void *data, Evas_Object *obj, void *event_info)
        ret = _vpnsvc_up(iface_name);
        _vpn_send_result(ret);
 
-       if (iface_name)
+       if (iface_name) {
                g_free(iface_name);
+               iface_name = NULL;
+       }
        if (popup)
                evas_object_del(popup);
        if (obj)
@@ -1025,8 +1182,10 @@ void _vpn_btn_disconnect_cb(void *data, Evas_Object *obj, void *event_info)
        ret = _vpnsvc_down(iface_name);
        _vpn_send_result(ret);
 
-       if (iface_name)
+       if (iface_name) {
                g_free(iface_name);
+               iface_name = NULL;
+       }
        if (popup)
                evas_object_del(popup);
        if (obj)
@@ -1042,8 +1201,10 @@ void _vpn_btn_no_cb(void *data, Evas_Object *obj, void *event_info)
 
        _vpn_send_result(VPNSVC_ERROR_CANCELED);
 
-       if (iface_name)
+       if (iface_name) {
                g_free(iface_name);
+               iface_name = NULL;
+       }
        if (popup)
                evas_object_del(popup);
        if (obj)
@@ -1069,6 +1230,167 @@ void _btn_no_cb(void *data, Evas_Object *obj, void *event_info)
        elm_exit();
 }
 
+static void __data_usage_notification(notification_type_e type,
+       notification_ly_type_e ly_type, const char *title_text, const char *title_key,
+       const char *content_text, const char *content_key, const char *launch_appid)
+{
+       int ret = 0;
+       int noti_flags = 0;
+       char icon_path[ICON_PATH_LEN];
+       notification_h noti = NULL;
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+       app_control_h service_handle = NULL;
+
+       noti = notification_create(type);
+       if (noti == NULL) {
+               log_print(NET_POPUP, "Failed to create notification");
+               return;
+       }
+
+       noti_err = notification_set_time(noti, time(NULL));
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to notification_set_time : %d", noti_err);
+               goto error;
+       }
+
+       g_snprintf(icon_path, sizeof(icon_path), "%s%s",
+               STC_NOTI_DATA_USAGE_ICON_PATH, STC_NOTI_DATA_USAGE_ICON_NAME);
+       noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, icon_path);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to notification_set_image : %d", noti_err);
+               goto error;
+       }
+
+       noti_err = notification_set_layout(noti, ly_type);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to notification_set_layout : %d", noti_err);
+               goto error;
+       }
+
+       noti_err = notification_set_text_domain(noti, PACKAGE,
+                       LOCALEDIR);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to notification_set_text_domain : %d", noti_err);
+               goto error;
+       }
+
+       noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+                       title_text, title_key,
+                       NOTIFICATION_VARIABLE_TYPE_NONE);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to notification_set_title : %d", noti_err);
+               goto error;
+       }
+
+       if (content_text) {
+               noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+                               content_text, content_key,
+                               NOTIFICATION_VARIABLE_TYPE_NONE);
+               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       log_print(NET_POPUP, "Failed to notification_set_content: %d", noti_err);
+                       goto error;
+               }
+       }
+
+       noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
+               NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR;
+       noti_err = notification_set_display_applist(noti, noti_flags);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to notification_set_display_applist: %d", noti_err);
+               goto error;
+       }
+
+       if (launch_appid) {
+               ret = app_control_create(&service_handle);
+               log_print(NET_POPUP, "Service create ret[%d]", ret);
+               if (ret != APP_CONTROL_ERROR_NONE)
+                       goto error;
+
+               ret = app_control_set_app_id(service_handle, launch_appid);
+               log_print(NET_POPUP, "Service set app id ret = %d", ret);
+               if (ret != APP_CONTROL_ERROR_NONE)
+                       goto error;
+
+               ret = app_control_add_extra_data(service_handle, "caller", "notification");
+               log_print(NET_POPUP, "Service data addition ret = %d", ret);
+               if (ret != APP_CONTROL_ERROR_NONE)
+                       goto error;
+
+               noti_err = notification_set_launch_option(noti,
+                               NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, service_handle);
+               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       log_print(NET_POPUP, "Failed to notification_set_launch_option");
+                       goto error;
+               }
+       }
+
+       noti_err = notification_post(noti);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to insert notification[error# is %d]", noti_err);
+               goto error;
+       }
+
+       log_print(NET_POPUP, "Successfully added notification");
+
+error:
+
+       if (noti != NULL)
+               notification_free(noti);
+
+       if (service_handle)
+               app_control_destroy(service_handle);
+}
+
+static void __data_usage_btn_on_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       log_print(NET_POPUP, "__data_usage_btn_on_cb()");
+       Evas_Object *popup = (Evas_Object *)data;
+
+       __net_popup_init_dbus();
+       __net_popup_send_data_usage_msg(data_usage_app_id, data_usage_iftype);
+       __net_popup_deinit_dbus();
+
+       __data_usage_notification(NOTIFICATION_TYPE_ONGOING,
+               NOTIFICATION_LY_ONGOING_EVENT,
+               STC_NOTIFICATION_RESTRICTION_ON_TITLE,
+               "IDS_SM_TMBODY_MOBILE_DATA_LIMIT_EXCEEDED_ABB",
+               NULL, NULL, NULL);
+
+       if (popup)
+               evas_object_del(popup);
+       if (obj)
+               evas_object_del(obj);
+
+       g_free(data_usage_app_id);
+       g_free(data_usage_iftype);
+
+       elm_exit();
+}
+
+static void __data_usage_btn_ok_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       log_print(NET_POPUP, "__data_usage_btn_ok_cb()");
+       Evas_Object *popup = (Evas_Object *)data;
+
+       __data_usage_notification(NOTIFICATION_TYPE_ONGOING,
+               NOTIFICATION_LY_ONGOING_EVENT,
+               STC_NOTIFICATION_RESTRICTION_OK_TITLE,
+               "IDS_SM_HEADER_MOBILE_DATA_TURNED_OFF_ABB2",
+               STC_NOTIFICATION_RESTRICTION_OK_CONTENT,
+               "IDS_SM_SBODY_TAP_HERE_TO_TURN_IT_ON_AGAIN_ABB",
+               DATA_USAGE_APPID);
+
+       if (popup)
+               evas_object_del(popup);
+       if (obj)
+               evas_object_del(obj);
+
+       g_free(data_usage_app_id);
+       g_free(data_usage_iftype);
+
+       elm_exit();
+}
+
 static void __net_popup_show_popup_with_user_resp(app_control_h request,
                void *data)
 {
@@ -1107,7 +1429,6 @@ static void __net_popup_show_popup_with_user_resp(app_control_h request,
                evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
                                EVAS_HINT_EXPAND);
 
-               __net_popup_send_dbus_msg("progress_on");
                label = elm_label_add(popup);
                elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
                elm_object_text_set(label, ALERT_STR_WIFI_MOBILE_AP_ON);
@@ -1222,6 +1543,120 @@ static void __net_popup_show_vpn_popup(app_control_h request, void *data)
        return;
 }
 
+static void __net_popup_show_warning_noti(app_control_h request, void *data)
+{
+       log_print(NET_POPUP, "__net_popup_show_warning_noti()\n");
+
+       int ret = app_control_get_extra_data(request, "_APP_ID_", &data_usage_app_id);
+       if (APP_CONTROL_ERROR_NONE != ret) {
+               log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret);
+               elm_exit();
+               return;
+       }
+
+       if (strcmp(data_usage_app_id, STC_TOTAL_DATACALL) &&
+               strcmp(data_usage_app_id, STC_TOTAL_WIFI) &&
+               strcmp(data_usage_app_id, STC_TOTAL_BLUETOOTH)) {
+               log_print(NET_POPUP, "It's not total data usage [%s]", data_usage_app_id);
+               g_free(data_usage_app_id);
+               elm_exit();
+               return;
+       }
+
+       __data_usage_notification(NOTIFICATION_TYPE_ONGOING,
+               NOTIFICATION_LY_ONGOING_EVENT,
+               STC_NOTIFICATION_WARNING_TITLE,
+               "IDS_COM_BODY_DATA_USAGE_WARNING",
+               STC_NOTIFICATION_WARNING_CONTENT,
+               "IDS_SM_SBODY_TAP_HERE_TO_VIEW_YOUR_DATA_USAGE_ABB",
+               DATA_USAGE_APPID);
+}
+
+static void __net_popup_show_restriction_noti(app_control_h request, void *data)
+{
+       Evas_Object *win;
+       Evas_Object *popup;
+       Evas_Object *button1;
+       Evas_Object *button2;
+       char *title = NULL;
+       char *content = NULL;
+       char *limit = NULL;
+       char *on_btn = NULL;
+       char *ok_btn = NULL;
+       char buf[ALERT_STR_LEN_MAX] = "";
+
+       log_print(NET_POPUP, "__net_popup_show_data_usage_popup");
+
+       int ret = app_control_get_extra_data(request, "_APP_ID_", &data_usage_app_id);
+       if (APP_CONTROL_ERROR_NONE != ret) {
+               log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret);
+               elm_exit();
+               return;
+       }
+
+       if (strcmp(data_usage_app_id, STC_TOTAL_DATACALL) &&
+               strcmp(data_usage_app_id, STC_TOTAL_WIFI) &&
+               strcmp(data_usage_app_id, STC_TOTAL_BLUETOOTH)) {
+               log_print(NET_POPUP, "It's not total data usage [%s]", data_usage_app_id);
+               g_free(data_usage_app_id);
+               elm_exit();
+               return;
+       }
+
+       ret = app_control_get_extra_data(request, "_IF_TYPE_", &data_usage_iftype);
+       if (APP_CONTROL_ERROR_NONE != ret) {
+               log_print(NET_POPUP, "Failed to get _IF_TYPE_ ret = %d", ret);
+               g_free(data_usage_app_id);
+               elm_exit();
+               return;
+       }
+
+       ret = app_control_get_extra_data(request, "_RESTRICTION_LIMIT_", &limit);
+       if (APP_CONTROL_ERROR_NONE != ret) {
+               log_print(NET_POPUP, "Failed to get _RESTRICTION_LIMIT_ ret = %d", ret);
+               g_free(data_usage_app_id);
+               g_free(data_usage_iftype);
+               elm_exit();
+               return;
+       }
+
+       title = ALERT_STR_DATA_USAGE_TITLE;
+       g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_DATA_USAGE_CONTENT, limit);
+       content = buf;
+       on_btn = ALERT_STR_DATA_USAGE_TURN_ON_BUTTON;
+       ok_btn = ALERT_STR_OK;
+
+       log_print(NET_POPUP, "title(%s) content(%s) app_id(%s) iftype(%s) limit(%s)",
+               title, content, data_usage_app_id, data_usage_iftype, limit);
+
+       win = __net_popup_create_win();
+
+       popup = elm_popup_add(win);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+       elm_object_text_set(popup, content);
+       elm_object_part_text_set(popup, "title,text", title);
+
+       /* ON button */
+       button1 = elm_button_add(popup);
+       elm_object_style_set(button1, "bottom");
+       elm_object_text_set(button1, on_btn);
+       elm_object_part_content_set(popup, "button1", button1);
+       evas_object_smart_callback_add(button1, "clicked", __data_usage_btn_on_cb, popup);
+
+       /* OK button */
+       button2 = elm_button_add(popup);
+       elm_object_style_set(button2, "bottom");
+       elm_object_text_set(button2, ok_btn);
+       elm_object_part_content_set(popup, "button2", button2);
+       evas_object_smart_callback_add(button2, "clicked", __data_usage_btn_ok_cb, popup);
+
+       evas_object_show(popup);
+       evas_object_show(win);
+
+       return;
+}
+
 static int __net_popup_show_popup(app_control_h request, void *data)
 {
        log_print(NET_POPUP, "__net_popup_show_popup()\n");
@@ -1310,7 +1745,7 @@ static void __net_popup_add_found_ap_noti(void)
        notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
        app_control_h service_handle = NULL;
 
-       notification_get_detail_list("net.netpopup", NOTIFICATION_GROUP_ID_NONE,
+       notification_get_detail_list(NET_POPUP_APPID, NOTIFICATION_GROUP_ID_NONE,
                        NOTIFICATION_PRIV_ID_NONE, -1, &noti_list);
        if (noti_list != NULL) {
                notification_free_list(noti_list);
@@ -1408,6 +1843,9 @@ error:
 
        if (noti != NULL)
                notification_free(noti);
+
+       if (service_handle)
+               app_control_destroy(service_handle);
 }
 
 static void __net_popup_del_found_ap_noti(void)
@@ -1425,6 +1863,142 @@ static void __net_popup_del_found_ap_noti(void)
        log_print(NET_POPUP, "Successfully deleted notification");
 }
 
+static void __net_popup_add_ip_conflict_noti(app_control_h request)
+{
+       log_print(NET_POPUP, "__net_popup_add_portal_noti()\n");
+
+       int ret = 0;
+       int noti_flags = 0;
+       char *mac = NULL;
+       char icon_path[ICON_PATH_LEN];
+       notification_h noti = NULL;
+       app_control_h service_handle = NULL;
+       notification_list_h noti_list = NULL;
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+       ret = app_control_get_extra_data(request, "_MAC_ADDRESS_", &mac);
+
+       if (mac == NULL || ret != APP_CONTROL_ERROR_NONE) {
+               log_print(NET_POPUP, "Failed to retrieve mac address!!");
+               g_free(mac);
+               return;
+       }
+
+       log_print(NET_POPUP, "Successfully added notification");
+
+       notification_get_detail_list(NET_POPUP_APPID, NOTIFICATION_GROUP_ID_NONE,
+                       NOTIFICATION_PRIV_ID_NONE, -1, &noti_list);
+       if (noti_list != NULL) {
+               notification_free_list(noti_list);
+               g_free(mac);
+               return;
+       }
+
+       noti = notification_create(NOTIFICATION_TYPE_NOTI);
+       if (noti == NULL) {
+               log_print(NET_POPUP, "fail to create notification");
+               g_free(mac);
+               return;
+       }
+
+       noti_err = notification_set_time(noti, time(NULL));
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_set_time : %d", noti_err);
+               goto error;
+       }
+
+       noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+                       NETCONFIG_NOTIFICATION_WIFI_ICON_LITE);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
+               goto error;
+       }
+
+       g_snprintf(icon_path, sizeof(icon_path), "%s%s", QP_PRELOAD_NOTI_ICON_PATH, "/noti_wifi_in_range_ongoing.png");
+       noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, icon_path);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
+               goto error;
+       }
+
+       noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_MULTIPLE);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_set_layout : %d", noti_err);
+               goto error;
+       }
+
+       noti_err = notification_set_text_domain(noti, PACKAGE,
+                       LOCALEDIR);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_set_text_domain : %d", noti_err);
+               goto error;
+       }
+
+       noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+                       NETCONFIG_NOTIFICATION_IP_CONFLICT_TITLE,
+                       "IDS_IP_CONFLICT",
+                       NOTIFICATION_VARIABLE_TYPE_NONE);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_set_title : %d", noti_err);
+               goto error;
+       }
+
+       noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+                       NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT,
+                       NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT,
+                       NOTIFICATION_VARIABLE_TYPE_STRING, mac,
+                       NOTIFICATION_VARIABLE_TYPE_NONE);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_set_content : %d", noti_err);
+               goto error;
+       }
+
+       noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_INDICATOR;
+       noti_err = notification_set_display_applist(noti, noti_flags);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_set_display_applist : %d", noti_err);
+               goto error;
+       }
+
+       ret = app_control_create(&service_handle);
+       log_print(NET_POPUP, "service create ret[%d]", ret);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               goto error;
+
+       ret = app_control_set_app_id(service_handle, WIFI_EFL_UG);
+       log_print(NET_POPUP, "Service set app id ret = %d", ret);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               goto error;
+
+       ret = app_control_add_extra_data(service_handle, "caller", "notification");
+       log_print(NET_POPUP, "Service data addition ret = %d", ret);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               goto error;
+
+       noti_err = notification_set_launch_option(noti,
+                       NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, service_handle);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_set_launch_option");
+               goto error;
+       }
+
+       noti_err = notification_post(noti);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_post");
+               goto error;
+       }
+
+       log_print(NET_POPUP, "Successfully added notification");
+
+error:
+       g_free(mac);
+       if (noti != NULL)
+               notification_free(noti);
+
+       if (service_handle != NULL)
+               app_control_destroy(service_handle);
+}
+
 static void __net_popup_add_portal_noti(app_control_h request)
 {
        log_print(NET_POPUP, "__net_popup_add_portal_noti()\n");
@@ -1448,7 +2022,7 @@ static void __net_popup_add_portal_noti(app_control_h request)
 
        log_print(NET_POPUP, "Successfully added notification");
 
-       notification_get_detail_list("net.netpopup", NOTIFICATION_GROUP_ID_NONE,
+       notification_get_detail_list(NET_POPUP_APPID, NOTIFICATION_GROUP_ID_NONE,
                        NOTIFICATION_PRIV_ID_NONE, -1, &noti_list);
        if (noti_list != NULL) {
                notification_free_list(noti_list);
@@ -1561,6 +2135,21 @@ error:
                app_control_destroy(service_handle);
 }
 
+static void __net_popup_del_ip_conflict_noti(void)
+{
+       log_print(NET_POPUP, "__net_popup_del_ip_conflict_noti()\n");
+
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+       noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               log_print(NET_POPUP, "fail to notification_delete_all");
+               return;
+       }
+
+       log_print(NET_POPUP, "Successfully deleted notification");
+}
+
 static void __net_popup_del_portal_noti(void)
 {
        log_print(NET_POPUP, "__net_popup_del_portal_noti()\n");
@@ -1580,14 +2169,21 @@ EXPORT_API int main(int argc, char *argv[])
 {
        log_print(NET_POPUP, "main()\n");
 
-       ui_app_lifecycle_callback_s app_callback = {
-               .create = __net_popup_create,
-               .terminate = __net_popup_terminate,
-               .pause = __net_popup_pause,
-               .resume = __net_popup_resume,
-               .app_control = __net_popup_service_cb,
-       };
+       __net_popup_get_tizen_profile();
 
-       return ui_app_main(argc, argv, &app_callback, NULL);
-}
+       if (g_profile == TIZEN_PROFILE_MOBILE) {
+               ui_app_lifecycle_callback_s app_callback = {
+                       .create = __net_popup_create,
+                       .terminate = __net_popup_terminate,
+                       .pause = __net_popup_pause,
+                       .resume = __net_popup_resume,
+                       .app_control = __net_popup_service_cb,
+               };
+
+               return ui_app_main(argc, argv, &app_callback, NULL);
+       } else if (g_profile == TIZEN_PROFILE_WEARABLE) {
+               return net_popup_w_init(argc, argv);
+       }
 
+       return 0;
+}