Fix DPM state synchronization issue 05/190205/1 accepted/tizen/unified/20180928.142140 submit/tizen/20180928.073243
authorJaehyun Kim <jeik01.kim@samsung.com>
Fri, 28 Sep 2018 06:51:07 +0000 (15:51 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Fri, 28 Sep 2018 06:52:23 +0000 (15:52 +0900)
Change-Id: Ie088f7ecfeaa57c355352bce4326b43cd353dbbb
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
include/network_internal.h
include/network_signal.h
src/network_interface.c
src/network_signal.c

index 98a6728..e6cd880 100755 (executable)
@@ -100,8 +100,6 @@ extern "C" {
 #define NETCONFIG_SIGNAL_TDLS_CONNECTED                "TDLSConnect"
 #define NETCONFIG_SIGNAL_TDLS_DISCONNECTED     "TDLSDisconnect"
 #define NETCONFIG_SIGNAL_WIFI_CONNECT_FAIL     "WiFiConnectFail"
-#define NETCONFIG_SIGNAL_DPM_WIFI                      "DPMWifi"
-#define NETCONFIG_SIGNAL_DPM_WIFI_PROFILE      "DPMWifiProfile"
 #define NETCONFIG_SIGNAL_WPS_FAIL_EVENT                "WpsFailEvent"
 #define NETCONFIG_SIGNAL_IP_CONFLICT_EVENT     "IpConflictEvent"
 
index 8a9066d..4d21060 100755 (executable)
@@ -28,12 +28,6 @@ int _net_deregister_signal(void);
 int _net_register_signal(void);
 int _net_init_service_state(void);
 
-/* Device Policy Manager */
-int _net_get_dpm_wifi_state(void);
-void _net_set_dpm_wifi_state(int state);
-int _net_get_dpm_wifi_profile_state(void);
-void _net_set_dpm_wifi_profile_state(int state);
-
 void _net_set_cs_tid(int tid);
 void _net_unset_cs_tid(int tid);
 
index 141fbca..4051681 100755 (executable)
@@ -2773,13 +2773,12 @@ int net_get_device_policy_wifi(void)
 {
        __NETWORK_FUNC_ENTER__;
 
-       int state = _net_get_dpm_wifi_state();
-       if (state == -1) {
-               net_err_e Error = _net_dbus_device_policy_get_wifi(&state);
-               if (Error != NET_ERR_NONE)
-                       WIFI_LOG(WIFI_ERROR, "_net_dbus_device_policy_get_wifi failed\n");
-               else
-                       _net_set_dpm_wifi_state(state);
+       int state = -1;
+       net_err_e Error = _net_dbus_device_policy_get_wifi(&state);
+
+       if (Error != NET_ERR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "_net_dbus_device_policy_get_wifi failed\n");
+               state = TRUE;
        }
 
        WIFI_LOG(WIFI_INFO, "Wifi device policy state [%d]\n", state);
@@ -2792,15 +2791,16 @@ int net_get_device_policy_wifi_profile(void)
 {
        __NETWORK_FUNC_ENTER__;
 
-       int state = _net_get_dpm_wifi_profile_state();
-       if (state == -1) {
-               net_err_e Error = _net_dbus_device_policy_get_wifi_profile(&state);
-               if (Error != NET_ERR_NONE)
-                       WIFI_LOG(WIFI_ERROR, "_net_dbus_device_policy_get_wifi_profile failed\n");
-               else
-                       _net_set_dpm_wifi_profile_state(state);
+       int state = -1;
+       net_err_e Error = _net_dbus_device_policy_get_wifi_profile(&state);
+
+       if (Error != NET_ERR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "_net_dbus_device_policy_get_wifi_profile failed\n");
+               state = TRUE;
        }
 
+       WIFI_LOG(WIFI_INFO, "Wifi profile policy state [%d]\n", state);
+
        __NETWORK_FUNC_EXIT__;
        return state;
 }
@@ -3205,13 +3205,13 @@ int net_modify_profile(const char* profile_name, net_profile_info_s* prof_info)
                return NET_ERR_APP_NOT_REGISTERED; //LCOV_EXCL_LINE
        }
 
-       if (!_net_get_dpm_wifi_state()) {
+       if (!net_get_device_policy_wifi()) {
                WIFI_LOG(WIFI_ERROR, "Wifi device policy restricts"); //LCOV_EXCL_LINE
                __NETWORK_FUNC_EXIT__; //LCOV_EXCL_LINE
                return NET_ERR_SECURITY_RESTRICTED; //LCOV_EXCL_LINE
        }
 
-       if (!_net_get_dpm_wifi_profile_state()) {
+       if (!net_get_device_policy_wifi_profile()) {
                WIFI_LOG(WIFI_ERROR, "Wifi profile device policy restricts"); //LCOV_EXCL_LINE
                __NETWORK_FUNC_EXIT__; //LCOV_EXCL_LINE
                return NET_ERR_SECURITY_RESTRICTED; //LCOV_EXCL_LINE
index c1b961d..f7c67a3 100755 (executable)
@@ -39,8 +39,6 @@ static __thread guint gdbus_conn_subscribe_id_connman_scandone = 0;
 static __thread guint gdbus_conn_subscribe_id_connman_scanstarted = 0;
 static __thread guint gdbus_conn_subscribe_id_netconfig_wifi = 0;
 static __thread guint gdbus_conn_subscribe_id_netconfig = 0;
-static __thread int net_dpm_wifi_state = -1;
-static __thread int net_dpm_wifi_profile_state = -1;
 
 struct cs_tid_info {
        int tid;
@@ -986,62 +984,6 @@ out:
        return NET_ERR_NONE;
 }
 
-static int __net_handle_network_dpm_wifi_event(GVariant *param)
-{
-       __NETWORK_FUNC_ENTER__;
-
-       GVariantIter *iter = NULL;
-       GVariant *value = NULL;
-       const char *key = NULL;
-       const gchar *sig_value = NULL;
-
-       g_variant_get(param, "(a{sv})", &iter);
-
-       while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
-               if (g_strcmp0(key, "key") == 0) {
-                       sig_value = g_variant_get_string(value, NULL);
-                       WIFI_LOG(WIFI_INFO, "Wifi device policy : %s",
-                                               sig_value);
-                       if (g_strcmp0(sig_value, "allowed") == 0)
-                               net_dpm_wifi_state = TRUE;
-                       else
-                               net_dpm_wifi_state = FALSE;
-               }
-       }
-       g_variant_iter_free(iter);
-
-       __NETWORK_FUNC_EXIT__;
-       return NET_ERR_NONE;
-}
-
-static int __net_handle_network_dpm_wifi_profile_event(GVariant *param)
-{
-       __NETWORK_FUNC_ENTER__;
-
-       GVariantIter *iter = NULL;
-       GVariant *value = NULL;
-       const char *key = NULL;
-       const gchar *sig_value = NULL;
-
-       g_variant_get(param, "(a{sv})", &iter);
-
-       while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
-               if (g_strcmp0(key, "key") == 0) {
-                       sig_value = g_variant_get_string(value, NULL);
-                       WIFI_LOG(WIFI_INFO, "Wifi profile device policy : %s",
-                                               sig_value);
-                       if (g_strcmp0(sig_value, "allowed") == 0)
-                               net_dpm_wifi_profile_state = TRUE;
-                       else
-                               net_dpm_wifi_profile_state = FALSE;
-               }
-       }
-       g_variant_iter_free(iter);
-
-       __NETWORK_FUNC_EXIT__;
-       return NET_ERR_NONE;
-}
-
 static void __net_connman_service_signal_filter(GDBusConnection *conn,
                const gchar *name, const gchar *path, const gchar *interface,
                const gchar *sig, GVariant *param, gpointer user_data)
@@ -1386,10 +1328,7 @@ static void __net_netconfig_network_signal_filter(GDBusConnection *conn,
                const gchar *name, const gchar *path, const gchar *interface,
                const gchar *sig, GVariant *param, gpointer user_data)
 {
-       if (g_strcmp0(sig, NETCONFIG_SIGNAL_DPM_WIFI) == 0)
-               __net_handle_network_dpm_wifi_event(param);
-       else if (g_strcmp0(sig, NETCONFIG_SIGNAL_DPM_WIFI_PROFILE) == 0)
-               __net_handle_network_dpm_wifi_profile_event(param);
+       return;
 }
 
 static int __net_get_tech_states(GVariant *message, net_state_type_e *state)
@@ -1491,26 +1430,6 @@ done:
        return Error;
 }
 
-int _net_get_dpm_wifi_state(void)
-{
-       return net_dpm_wifi_state;
-}
-
-void _net_set_dpm_wifi_state(int state)
-{
-       net_dpm_wifi_state = state;
-}
-
-gboolean _net_get_dpm_wifi_profile_state()
-{
-       return net_dpm_wifi_profile_state;
-}
-
-void _net_set_dpm_wifi_profile_state(int state)
-{
-       net_dpm_wifi_profile_state = state;
-}
-
 void _net_set_cs_tid(int tid)
 {
        GSList *list;