From 78e47223716e5b912cd50364b0ad0754b47322a4 Mon Sep 17 00:00:00 2001 From: Seungyoun Ju Date: Thu, 29 Nov 2012 18:29:42 +0900 Subject: [PATCH] Improper notification type is used - Issues Improper notification type is used. Tethering enabled state is checked wrongly. - Fix description Notification type is corrected. A function which checks tethering enabled state by tethering type is implemented and used. Change-Id: Ib20cfc7fa7a441fa0e8d9a2f0fb13e7c50f47bc0 --- include/mobileap_agent.h | 3 ++- src/mobileap_main.c | 32 +++++++++++++++++++++++++++++--- src/mobileap_notification.c | 4 ++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/include/mobileap_agent.h b/include/mobileap_agent.h index 841ef85..b67ecd4 100644 --- a/include/mobileap_agent.h +++ b/include/mobileap_agent.h @@ -208,7 +208,8 @@ gboolean _mobileap_clear_state(int state); gboolean _mobileap_is_disabled(void); -gboolean _mobileap_is_enabled(mobile_ap_type_e type); +gboolean _mobileap_is_enabled(int state); +gboolean _mobileap_is_enabled_by_type(mobile_ap_type_e type); gboolean _mobileap_set_state(int state); #endif diff --git a/src/mobileap_main.c b/src/mobileap_main.c index 36c8e3c..ace1cce 100644 --- a/src/mobileap_main.c +++ b/src/mobileap_main.c @@ -156,9 +156,35 @@ gboolean _mobileap_is_disabled(void) return mobileap_state ? FALSE : TRUE; } -gboolean _mobileap_is_enabled(mobile_ap_type_e type) +gboolean _mobileap_is_enabled(int state) { - return (mobileap_state & type) ? TRUE : FALSE; + return (mobileap_state & state) ? TRUE : FALSE; +} + +gboolean _mobileap_is_enabled_by_type(mobile_ap_type_e type) +{ + switch (type) { + case MOBILE_AP_TYPE_WIFI: + if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI)) + return TRUE; + break; + + case MOBILE_AP_TYPE_BT: + if (_mobileap_is_enabled(MOBILE_AP_STATE_BT)) + return TRUE; + break; + + case MOBILE_AP_TYPE_USB: + if (_mobileap_is_enabled(MOBILE_AP_STATE_USB)) + return TRUE; + break; + + default: + ERR("Unknow type : %d\n", type); + break; + } + + return FALSE; } gboolean _mobileap_clear_state(int state) @@ -452,7 +478,7 @@ static DBusHandlerResult __dnsmasq_signal_filter(DBusConnection *conn, if (_get_tethering_type_from_ip(ip_addr, &type) != MOBILE_AP_ERROR_NONE) return DBUS_HANDLER_RESULT_HANDLED; - if (_mobileap_is_enabled(type) != FALSE) { + if (_mobileap_is_enabled_by_type(type) == FALSE) { DBG("Tethering[%d] is disabled. Ignore ACK\n", type); return DBUS_HANDLER_RESULT_HANDLED; } diff --git a/src/mobileap_notification.c b/src/mobileap_notification.c index ae5eda7..e85eb7d 100644 --- a/src/mobileap_notification.c +++ b/src/mobileap_notification.c @@ -39,7 +39,7 @@ int _create_notification(const char *content, const char *title, const char *ico notification_h noti = NULL; notification_error_e ret = NOTIFICATION_ERROR_NONE; - noti = notification_new(NOTIFICATION_TYPE_NOTI, + noti = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); if (!noti) { ERR("Fail to notification_new [%d]\n", ret); @@ -162,7 +162,7 @@ int _delete_notification(void) DBG("+\n"); notification_error_e ret; - ret = notification_delete_all_by_type(APPNAME, NOTIFICATION_TYPE_NOTI); + ret = notification_delete_all_by_type(APPNAME, NOTIFICATION_TYPE_ONGOING); if (ret != NOTIFICATION_ERROR_NONE) { ERR("Fail to notification_delete_all_by_type [%d]\n", ret); return MOBILE_AP_ERROR_INTERNAL; -- 2.7.4