Fix not to use app-status plugin from monitor plugin 35/233635/1 accepted/tizen/5.5/unified/20200519.155035 submit/tizen_5.5/20200519.005026
authorhyunuk.tak <hyunuk.tak@samsung.com>
Mon, 18 May 2020 04:08:54 +0000 (13:08 +0900)
committerhyunuk.tak <hyunuk.tak@samsung.com>
Mon, 18 May 2020 04:08:57 +0000 (13:08 +0900)
Change-Id: Ia29a74d576d346955be220290a890a0aae1e8a10
Signed-off-by: hyunuk.tak <hyunuk.tak@samsung.com>
packaging/stc-manager.spec
plugin/monitor/CMakeLists.txt
plugin/monitor/stc-plugin-monitor-rstn.c

index 69cbe48..c183fde 100644 (file)
@@ -78,6 +78,8 @@ A smart traffic control manager extension for tethering client data usage plugin
 
 %package plugin-monitor
 Summary: Monitor plugin for data usage of clients
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(syspopup-caller)
 
 %description plugin-monitor
 A smart traffic control manager extension for monitoring client data usage plugin
index 63b1b9d..e1e0048 100644 (file)
@@ -10,6 +10,8 @@ PKG_CHECK_MODULES(monitor_plugin REQUIRED
        glib-2.0
        vconf
        openssl1.1
+       bundle
+       syspopup-caller
        )
 
 FOREACH(flag ${monitor_plugin_CFLAGS})
index 365207c..ab88ae3 100755 (executable)
@@ -16,6 +16,9 @@
 
 #include <vconf.h>
 #include <vconf-keys.h>
+#include <bundle.h>
+#include <bundle_internal.h>
+#include <syspopup_caller.h>
 
 #include "counter.h"
 #include "stc-plugin-monitor.h"
@@ -26,7 +29,6 @@
 #include "table-restrictions.h"
 #include "table-statistics.h"
 #include "helper-net-cls.h"
-#include "stc-manager-plugin-appstatus.h"
 #include "stc-manager-plugin-tether.h"
 
 static void __print_rstn(stc_rstn_data_s *rstn_data)
@@ -1200,6 +1202,7 @@ void stc_monitor_rstn_update_counter(gpointer data,
                                        gpointer user_data)
 {
        int i;
+       int is_roaming = 0;
        stc_rstn_data_s *rstn_data = (stc_rstn_data_s *)data;
        classid_bytes_context_s *context = (classid_bytes_context_s *)user_data;
        GSList *conn_list = stc_get_connection_list();
@@ -1220,7 +1223,8 @@ void stc_monitor_rstn_update_counter(gpointer data,
                        g_strcmp0(rstn_data->subscriber_id, conn->subscriber_id) != 0)
                        return;
 
-               if (rstn_data->roaming != conn->roaming)
+               is_roaming = (rstn_data->roaming == STC_ROAMING_ENABLE) ? 1 : 0;
+               if (is_roaming != conn->roaming)
                        return;
 
                if (rstn_data->limit_exceeded != 0) {
@@ -1297,6 +1301,35 @@ void stc_monitor_rstn_update_iface_counter(classid_bytes_context_s *context)
        }
 }
 
+static int stc_plugin_monitor_launch_rstn_popup(const char *content,
+               const char *type, const char *app_id,
+               const char *iftype, const char *limit)
+{
+       int ret = 0;
+       bundle *b = bundle_create();
+
+       bundle_add(b, "_SYSPOPUP_CONTENT_", content);
+       bundle_add(b, "_SYSPOPUP_TYPE_", type);
+       bundle_add(b, "_APP_ID_", app_id);
+       bundle_add(b, "_IF_TYPE_", iftype);
+
+       if (g_strcmp0(type, "warning_noti") == 0) {
+               bundle_add(b, "_WARN_LIMIT_", limit);
+               STC_LOGD("Warn message : content[%s] type[%s] app_id[%s] limit[%s]",
+                       content, type, app_id, limit);
+       } else {
+               bundle_add(b, "_RESTRICTION_LIMIT_", limit);
+               STC_LOGD("Restriction message : content[%s] type[%s] app_id[%s] limit[%s]",
+                       content, type, app_id, limit);
+       }
+
+       ret = syspopup_launch("net-popup", b);
+
+       bundle_free(b);
+
+       return ret;
+}
+
 void stc_monitor_rstn_action_when_limit_exceeded(stc_rstn_limit_type_e limit_type,
                                                stc_rstn_data_s *rstn_data,
                                                classid_bytes_context_s *context)
@@ -1383,7 +1416,7 @@ void stc_monitor_rstn_action_when_limit_exceeded(stc_rstn_limit_type_e limit_typ
 
        snprintf(iftype, MAX_INT_LENGTH, "%d", rstn_data->iftype);
        snprintf(byte, MAX_INT_LENGTH, "%lld", rstn_data->limit[limit_type]);
-       stc_plugin_appstatus_send_message(net_popup_content,
+       stc_plugin_monitor_launch_rstn_popup(net_popup_content,
                        net_popup_type, rstn_data->app_id, iftype, byte);
 
        if (STC_DEBUG_LOG && STC_RSTN_LOG)