Improper notification type is used
authorSeungyoun Ju <sy39.ju@samsung.com>
Thu, 29 Nov 2012 09:29:42 +0000 (18:29 +0900)
committerSeungyoun Ju <sy39.ju@samsung.com>
Fri, 7 Dec 2012 04:46:49 +0000 (13:46 +0900)
- 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
src/mobileap_main.c
src/mobileap_notification.c

index 841ef85..b67ecd4 100644 (file)
@@ -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
index 36c8e3c..ace1cce 100644 (file)
@@ -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;
                }
index ae5eda7..e85eb7d 100644 (file)
@@ -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;