remove notification, libstorage dependancy from msg-server daemon 76/64976/2
authorKyeonghun Lee <kh9090.lee@samsung.com>
Wed, 6 Apr 2016 11:11:33 +0000 (20:11 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Thu, 7 Apr 2016 02:30:58 +0000 (11:30 +0900)
Change-Id: Id641bfec024bfcc1283aa3624a2fa7f9d245c490
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
23 files changed:
CMakeLists.txt
externals/CMakeLists.txt
externals/MsgDevicedWrapper.cpp
externals/MsgNotificationWrapper.cpp
externals/MsgSensorWrapper.cpp
framework/storage-handler/MsgStorageMessage.cpp
framework/transaction-manager/MsgCmdHandlerTransport.cpp
include/externals/MsgNotificationWrapper.h
manager/CMakeLists.txt
manager/inc/msg-manager-alarm.h [deleted file]
manager/inc/msg-manager-notification.h
manager/inc/msg-manager-util.h [new file with mode: 0644]
manager/src/msg-manager-alarm.cpp [deleted file]
manager/src/msg-manager-notification.cpp
manager/src/msg-manager-sound.cpp
manager/src/msg-manager-util.cpp [new file with mode: 0644]
manager/src/msg-manager.cpp
manager/tizen-manifest.xml
packaging/msg-service.spec
plugin/mms_plugin/CMakeLists.txt
plugin/sms_plugin/SmsPluginSetting.cpp
utils/CMakeLists.txt
utils/MsgUtilStorage.cpp

index 168824debe8f8dcf6080d7b9a838b1b34cb61a77..547a94066cc4d6a8222825fcfb71394f57dc509c 100755 (executable)
@@ -31,6 +31,7 @@ ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")
 ADD_DEFINITIONS(-DTZ_SYS_RO_APP_PATH="${TZ_SYS_RO_APP}")
 ADD_DEFINITIONS(-DTZ_SYS_DATA_PATH="${TZ_SYS_DATA}")
 ADD_DEFINITIONS(-DTZ_SYS_DB_PATH="${TZ_SYS_DB}")
+ADD_DEFINITIONS(-DTZ_SYS_HOME_PATH="${TZ_SYS_HOME}")
 
 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
index d2facf8e979364100849333d3c52ed81f119632e..f11b6002064d14b97faa675d49f5dfad1508b501 100755 (executable)
@@ -31,7 +31,7 @@ INCLUDE_DIRECTORIES(
 )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(externals_pkgs REQUIRED glib-2.0 alarm-service notification iniparser lbs-dbus feedback capi-system-device motion)
+pkg_check_modules(externals_pkgs REQUIRED glib-2.0 alarm-service lbs-dbus capi-system-device motion)
 
 FOREACH(flag ${externals_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index d603b6ed1efd5584f3974e69fd904b2c5b792964..20b9d6e7aca2ce8e59b339765685df913afbd32d 100644 (file)
 */
 
 
+#ifndef MSG_WEARABLE_PROFILE
+#include <bundle.h>
+#endif /* MSG_WEARABLE_PROFILE */
 #include <device/power.h>
-#include <device/display.h>
 
 #include "MsgCallStatusManager.h"
 #include "MsgDebug.h"
 #include "MsgMutex.h"
 #include "MsgGconfWrapper.h"
 #include "MsgDevicedWrapper.h"
+#include "MsgUtilFunction.h"
 
 int g_lock_cnt = 0;
 MsgMutex mx;
@@ -80,17 +83,14 @@ void MsgDisplayUnlock()
 void MsgChangePmState()
 {
        MSG_BEGIN();
-       int callStatus = 0;
+#ifndef MSG_WEARABLE_PROFILE
+       bundle *bundle_data = bundle_create();
 
-       callStatus = MsgGetCallStatus();
-       MSG_DEBUG("Call Status = %d", callStatus);
+       bundle_add_str(bundle_data, "cmd", "change_pm_state");
 
-       if (callStatus > 0 && callStatus < 3) {
-               MSG_DEBUG("Call is activated. Do not turn on the lcd.");
-       } else {
-               MSG_DEBUG("Call is not activated. Turn on the lcd.");
-               device_display_change_state(DISPLAY_STATE_NORMAL);
-       }
+       msg_launch_app(MSG_MGR_APP_ID, bundle_data);
 
+       bundle_free(bundle_data);
+#endif /* MSG_WEARABLE_PROFILE */
        MSG_END();
 }
index fd6921a7c5818a20638cbaadb19966b7b0917b6e..1bf54dd383be54b690333d514e9086dfc3757b38 100755 (executable)
 
 extern "C"
 {
-#include <bundle.h>
 #ifndef MSG_WEARABLE_PROFILE
-#include <notification_internal.h>
-#include <notification_status.h>
-#include <notification_setting.h>
-#include <notification_setting_internal.h>
+#include <bundle.h>
 #endif /* MSG_WEARABLE_PROFILE */
 }
 
-#ifndef MSG_WEARABLE_PROFILE
-
-/*======================================================================================*/
-/*                                                             VARIABLES AND STRUCTURES                                                                */
-/*======================================================================================*/
-
-typedef struct _del_noti_info_s
-{
-       msg_notification_type_t                 type;
-       int             sim_idx;
-}DEL_NOTI_INFO_S;
-
-
-/*======================================================================================*/
-/*                                                                     FUNCTION DEFINE                                                                         */
-/*======================================================================================*/
-
-int getPrivId(msg_notification_type_t noti_type, int sim_idx);
-void updatePrivId(msg_notification_type_t noti_type, int noti_id, int sim_idx);
-
-void MsgDeleteNotiCb(void *data);
-
-#endif /* MSG_WEARABLE_PROFILE */
-
 /*======================================================================================*/
 /*                                                             FUNCTION IMPLEMENTATION                                                                 */
 /*======================================================================================*/
@@ -371,129 +343,41 @@ void MsgRefreshAllNotification(bool bWithSimNoti, bool bFeedback, msg_active_not
 }
 
 
-void MsgDeleteNotification(msg_notification_type_t noti_type, int simIndex)
-{
-#ifndef MSG_WEARABLE_PROFILE
-       int noti_err = NOTIFICATION_ERROR_NONE;
-
-       if (noti_type == MSG_NOTI_TYPE_ALL) {
-               noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
-       } else if (noti_type == MSG_NOTI_TYPE_VOICE_1 || noti_type == MSG_NOTI_TYPE_VOICE_2 || noti_type == MSG_NOTI_TYPE_SIM) {
-               int notiId = 0;
-
-               notiId = getPrivId(noti_type, simIndex);
-               MSG_DEBUG("deleted notification ID = [%d] Type = [%d]", notiId, noti_type);
-
-               if (notiId > 0)
-                       noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, notiId);
-
-       } else {
-               MSG_DEBUG("No matching type [%d]", noti_type);
-       }
-
-       if (noti_err != NOTIFICATION_ERROR_NONE) {
-               MSG_DEBUG("Fail to notification_delete_all noti_err [%d]", noti_err);
-       }
-
-       updatePrivId(noti_type, 0, simIndex);
-#endif /* MSG_WEARABLE_PROFILE */
-}
-
-bool MsgCheckNotificationSettingEnable(void)
-{
-       bool msg_noti_enabled = false;
-#ifndef MSG_WEARABLE_PROFILE
-       notification_system_setting_h system_setting = NULL;
-       notification_setting_h setting = NULL;
-
-       int err = NOTIFICATION_ERROR_NONE;
-
-       err = notification_setting_get_setting_by_package_name(MSG_DEFAULT_APP_ID, &setting);
-
-       if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
-               MSG_ERR("getting setting handle for [%s] is failed. err = %d", MSG_DEFAULT_APP_ID, err);
-       } else {
-               msg_noti_enabled = true;
-
-               bool allow_to_notify = false;
-               err = notification_setting_get_allow_to_notify(setting, &allow_to_notify);
-
-               if (err != NOTIFICATION_ERROR_NONE) {
-                       MSG_ERR("getting do not disturb setting is failed. err = %d", err);
-                       goto EXIT;
-               }
-
-               if (allow_to_notify) {
-                       MSG_DEBUG("message notification is allowed");
-
-                       /* check do not disturb mode */
-                       err = notification_system_setting_load_system_setting(&system_setting);
-
-                       if (err != NOTIFICATION_ERROR_NONE || system_setting == NULL) {
-                               MSG_ERR("getting system setting is failed. err = %d", err);
-                               goto EXIT;
-                       }
-
-                       bool do_not_disturb_mode = false;
-                       err = notification_system_setting_get_do_not_disturb(system_setting, &do_not_disturb_mode);
-
-                       if (err != NOTIFICATION_ERROR_NONE) {
-                               MSG_ERR("getting do not disturb setting is failed. err = %d", err);
-                               goto EXIT;
-                       }
-
-                       if (do_not_disturb_mode) {
-                               bool is_msg_excepted = false;
-                               err = notification_setting_get_do_not_disturb_except(setting, &is_msg_excepted);
-                               if (err != NOTIFICATION_ERROR_NONE) {
-                                       MSG_ERR("getting do not disturb except status for [%s] is failed. err = %d", MSG_DEFAULT_APP_ID, err);
-                                       msg_noti_enabled = false;
-                               } else {
-                                       MSG_INFO("do not disturb mode status for [%s] : %d", MSG_DEFAULT_APP_ID, is_msg_excepted);
-                                       msg_noti_enabled = (is_msg_excepted) ? true : false;
-                               }
-                       } else {
-                               MSG_DEBUG("do not disturb mode is off");
-                       }
-               } else {
-                       MSG_INFO("message notification is not allowed");
-                       msg_noti_enabled = false;
-               }
-       }
-
-EXIT:
-       if (system_setting)
-               notification_system_setting_free_system_setting(system_setting);
-
-       if (setting)
-               notification_setting_free_notification(setting);
-
-#endif /* MSG_WEARABLE_PROFILE */
-       return msg_noti_enabled;
-}
-
-
 msg_error_t MsgDeleteNoti(msg_notification_type_t noti_type, int simIndex)
 {
 #ifndef MSG_WEARABLE_PROFILE
-       bool bNotiSvcReady = false;
+       bundle *bundle_data = bundle_create();
 
-       DEL_NOTI_INFO_S *delNotiInfo = (DEL_NOTI_INFO_S *)calloc(1, sizeof(DEL_NOTI_INFO_S));
+       bundle_add_str(bundle_data, "cmd", "del_noti");
+       switch (noti_type) {
+       case MSG_NOTI_TYPE_ALL:
+               bundle_add_str(bundle_data, "type", "all");
+               break;
+       case MSG_NOTI_TYPE_NORMAL:
+               bundle_add_str(bundle_data, "type", "normal");
+               break;
+       case MSG_NOTI_TYPE_SIM:
+               bundle_add_str(bundle_data, "type", "sim");
+               break;
+       case MSG_NOTI_TYPE_VOICE_1:
+               bundle_add_str(bundle_data, "type", "voice1");
+               break;
+       case MSG_NOTI_TYPE_VOICE_2:
+               bundle_add_str(bundle_data, "type", "voice2");
+               break;
+       default:
+               break;
+       }
 
-       if (delNotiInfo) {
-               delNotiInfo->type = noti_type;
-               delNotiInfo->sim_idx = simIndex;
+       char *sim_index = g_strdup_printf("%d", simIndex);
+       if (sim_index) {
+               bundle_add_str(bundle_data, "sim_index", sim_index);
+               g_free(sim_index);
        }
 
-       bNotiSvcReady = notification_is_service_ready();
+       msg_launch_app(MSG_MGR_APP_ID, bundle_data);
 
-       if (bNotiSvcReady == true) {
-               MSG_DEBUG("Notification server is available");
-               MsgDeleteNotiCb((void *)delNotiInfo);
-       } else {
-               MSG_DEBUG("Notification server is not available. Delete is defered");
-               notification_add_deferred_task(MsgDeleteNotiCb, (void *)delNotiInfo);
-       }
+       bundle_free(bundle_data);
 #endif /* MSG_WEARABLE_PROFILE */
        return MSG_SUCCESS;
 }
@@ -536,195 +420,31 @@ void MsgSoundPlayStart(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_SOUND_TYPE_T sou
 
 msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg, bool bPlayFeedback, int msgId)
 {
+       msg_error_t err = MSG_SUCCESS;
 #ifndef MSG_WEARABLE_PROFILE
        MSG_DEBUG("pTickerMsg=[%s], pLocaleTickerMsg=[%s]", pTickerMsg, pLocaleTickerMsg);
        MSG_DEBUG("play feedback=[%d], msgId=[%d]", bPlayFeedback, msgId);
 
-       if (MsgCheckNotificationSettingEnable())
-               MsgChangePmState();
-
-       char *notiMsg = NULL;
-       msg_active_notification_type_t active_type = MSG_ACTIVE_NOTI_TYPE_NONE;
+       bundle *bundle_data = bundle_create();
 
-       notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, pLocaleTickerMsg);
-       MSG_DEBUG("notiMsg %s", notiMsg);
+       bundle_add_str(bundle_data, "cmd", "insert_ticker");
+       bundle_add_str(bundle_data, "ticker_msg", pTickerMsg);
+       bundle_add_str(bundle_data, "locale_ticker_msg", pLocaleTickerMsg);
 
-       if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) != 0 &&
-               g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) != 0 &&
-               g_strcmp0(pLocaleTickerMsg, MESSAGE_RETRIEVED) != 0) {
-               if (g_strcmp0(pLocaleTickerMsg, notiMsg) == 0) {
-                       notification_status_message_post(pTickerMsg);
-               } else {
-                       notification_status_message_post(notiMsg);
-               }
-       } else {
-               /* Show ticker popup for sending failed msg. */
-               active_type = MSG_ACTIVE_NOTI_TYPE_INSTANT;
-       }
+       if (bPlayFeedback)
+               bundle_add_str(bundle_data, "feedback", "true");
+       else
+               bundle_add_str(bundle_data, "feedback", "false");
 
-       if (notiMsg) {
-               free(notiMsg);
-               notiMsg = NULL;
+       char *msg_id = g_strdup_printf("%d", msgId);
+       if (msg_id) {
+               bundle_add_str(bundle_data, "msg_id", msg_id);
+               g_free(msg_id);
        }
 
-       if (bPlayFeedback) {
-               if (msgId > 0 &&
-                       (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) == 0 || g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) == 0)) {
-                       msg_error_t err = MSG_SUCCESS;
-                       err = MsgRefreshNotification(MSG_NOTI_TYPE_FAILED, true, active_type);
-                       if (err != MSG_SUCCESS) {
-                               MSG_DEBUG("MsgRefreshFailedNoti err=[%d]", err);
-                       }
-               } else if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SIM_MESSAGE_FULL) == 0) {
-                       msg_error_t err = MSG_SUCCESS;
-                       err = MsgRefreshNotification(MSG_NOTI_TYPE_SIM_FULL, true, MSG_ACTIVE_NOTI_TYPE_NONE);
-                       if (err != MSG_SUCCESS) {
-                               MSG_DEBUG("MsgRefreshSimFullNoti err=[%d]", err);
-                       }
-               } else {
-                       MsgSoundPlayStart(NULL, MSG_SOUND_PLAY_DEFAULT);
-               }
-       }
+       err = msg_launch_app(MSG_MGR_APP_ID, bundle_data);
 
+       bundle_free(bundle_data);
 #endif /* MSG_WEARABLE_PROFILE */
-       return MSG_SUCCESS;
-}
-
-
-#ifndef MSG_WEARABLE_PROFILE
-void MsgDeleteNotiCb(void *data)
-{
-       if (data) {
-               DEL_NOTI_INFO_S *delNotiInfo = (DEL_NOTI_INFO_S *)data;
-
-               MsgDeleteNotification(delNotiInfo->type, delNotiInfo->sim_idx);
-
-               free(data);
-               data = NULL;
-       }
-
-       return;
-}
-
-
-int getPrivId(msg_notification_type_t noti_type, int sim_idx)
-{
-       MSG_BEGIN();
-
-       int noti_id = 0;
-
-       switch (noti_type) {
-#ifdef MSG_NOTI_INTEGRATION
-       case MSG_NOTI_TYPE_NORMAL:
-       case MSG_NOTI_TYPE_SIM:
-       case MSG_NOTI_TYPE_CB:
-               if (MsgSettingGetInt(NOTIFICATION_PRIV_ID, &noti_id) != MSG_SUCCESS) {
-                       MSG_INFO("MsgSettingGetInt() is failed");
-               }
-               break;
-#else
-       case MSG_NOTI_TYPE_NORMAL:
-               noti_id = MsgSettingGetInt(NOTIFICATION_PRIV_ID);
-               break;
-       case MSG_NOTI_TYPE_SIM:
-               noti_id = MsgSettingGetInt(SIM_MSG_NOTI_PRIV_ID);
-               break;
-       case MSG_NOTI_TYPE_CB:
-               noti_id = MsgSettingGetInt(CB_NOTI_PRIV_ID);
-               break;
-#endif
-       case MSG_NOTI_TYPE_FAILED:
-               if (MsgSettingGetInt(MSG_SENTFAIL_NOTI_ID, &noti_id) != MSG_SUCCESS) {
-                       MSG_INFO("MsgSettingGetInt() is failed");
-               }
-               break;
-       case MSG_NOTI_TYPE_VOICE_1: {
-               char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
-               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx);
-               if (MsgSettingGetInt(keyName, &noti_id) != MSG_SUCCESS) {
-                       MSG_INFO("MsgSettingGetInt() is failed");
-               }
-               break;
-       }
-       case MSG_NOTI_TYPE_VOICE_2: {
-               char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
-               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx);
-               if (MsgSettingGetInt(keyName, &noti_id) != MSG_SUCCESS) {
-                       MSG_INFO("MsgSettingGetInt() is failed");
-               }
-               break;
-       }
-       case MSG_NOTI_TYPE_SIM_FULL:
-               if (MsgSettingGetInt(SIM_FULL_NOTI_PRIV_ID, &noti_id) != MSG_SUCCESS) {
-                       MSG_INFO("MsgSettingGetInt() is failed");
-               }
-               break;
-       default:
-               MSG_DEBUG("No matching noti type [%d]", noti_type);
-               break;
-       }
-
-       MSG_DEBUG("Get noti type = %d, id = %d, sim_idx:%d", noti_type, noti_id, sim_idx);
-
-       MSG_END();
-
-       return noti_id;
-}
-
-
-void updatePrivId(msg_notification_type_t noti_type, int noti_id, int sim_idx)
-{
-       MSG_BEGIN();
-
-       msg_error_t err = MSG_SUCCESS;
-
-       MSG_DEBUG("Update noti type = %d, id = %d, sim_idx = %d", noti_type, noti_id, sim_idx);
-
-       switch (noti_type) {
-#ifdef MSG_NOTI_INTEGRATION
-       case MSG_NOTI_TYPE_NORMAL:
-       case MSG_NOTI_TYPE_SIM:
-       case MSG_NOTI_TYPE_CB:
-               err = MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_id);
-               break;
-#else
-       case MSG_NOTI_TYPE_NORMAL:
-               err = MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_id);
-               break;
-       case MSG_NOTI_TYPE_SIM:
-               err = MsgSettingSetInt(SIM_MSG_NOTI_PRIV_ID, noti_id);
-               break;
-       case MSG_NOTI_TYPE_CB:
-               err = MsgSettingSetInt(CB_NOTI_PRIV_ID, noti_id);
-               break;
-#endif
-       case MSG_NOTI_TYPE_FAILED:
-               err = MsgSettingSetInt(MSG_SENTFAIL_NOTI_ID, noti_id);
-               break;
-       case MSG_NOTI_TYPE_VOICE_1: {
-               char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
-               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx);
-               err = MsgSettingSetInt(keyName, noti_id);
-               break;
-       }
-       case MSG_NOTI_TYPE_VOICE_2: {
-               char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
-               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx);
-               err = MsgSettingSetInt(keyName, noti_id);
-               break;
-       }
-       case MSG_NOTI_TYPE_SIM_FULL:
-               err = MsgSettingSetInt(SIM_FULL_NOTI_PRIV_ID, noti_id);
-               break;
-       default:
-               MSG_DEBUG("No matching type [%d]", noti_type);
-               break;
-       }
-
-       if (err != MSG_SUCCESS)
-               MSG_INFO("MsgSettingSetInt fail : noti type = %d, id = %d, sim_idx = %d", noti_type, noti_id, sim_idx);
-
-       MSG_END();
+       return err;
 }
-
-#endif /* MSG_WEARABLE_PROFILE */
index a19e17698c09ca3cd1e38831093da1c03521e8b8..bb8eb169bfa6e47b2d877c4f1959f55f4374a5a9 100755 (executable)
@@ -74,7 +74,7 @@ void MsgSensorCBStop()
        MSG_BEGIN();
 
 
-       MsgDeleteNotification(MSG_NOTI_TYPE_ALL, -1);
+       MsgDeleteNoti(MSG_NOTI_TYPE_ALL, -1);
        MsgRefreshNotification(MSG_NOTI_TYPE_ALL, false, MSG_ACTIVE_NOTI_TYPE_NONE);
 #ifndef MSG_NOTI_INTEGRATION
        MsgRefreshNotification(MSG_NOTI_TYPE_SIM, false, MSG_ACTIVE_NOTI_TYPE_NONE);
index d7172e0dae0881c6cb9ae6b78b6b6b7fd3875295..60238e70ac831fef784bf38d49d39aec9505ce91 100755 (executable)
@@ -2230,8 +2230,7 @@ msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int extId, int
        pMsgInfo->msgId = (msg_message_id_t)rowId;
 
        MsgInsertNotification(pMsgInfo);
-       if (MsgCheckNotificationSettingEnable())
-               MsgChangePmState();
+       MsgChangePmState();
 
        MSG_END();
 
index 272bc53bc1a37cd7c3d687d2f6f9b3c2084597a8..ca0549ff2a7c30c1dabd597677f051df9d2104c9 100755 (executable)
@@ -846,8 +846,7 @@ int MsgIncomingCBMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
                MsgInsertNotification(&msgInfo);
        }
 
-       if (MsgCheckNotificationSettingEnable())
-               MsgChangePmState();
+       MsgChangePmState();
 
        msg_id_list_s msgIdList;
        msg_message_id_t msgIds[1];
index ae84c54b7917c4727d13c2341d6fb55b2d9b2d3c..2306f0faf93ad70ebddae11018b34c10caceb6c6 100755 (executable)
@@ -121,7 +121,5 @@ msg_error_t MsgDeleteNoti(msg_notification_type_t noti_type, int simIndex);
 void MsgSoundPlayStart(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_SOUND_TYPE_T soundType);
 
 void MsgRefreshAllNotification(bool bWithSimNoti, bool bFeedback, msg_active_notification_type_t active_type);
-void MsgDeleteNotification(msg_notification_type_t noti_type, int simIndex);
-bool MsgCheckNotificationSettingEnable(void);
 
 #endif
index 0ad7195f568536167ec0e305f7fbe3cbec853226..c453cd83ab50aaa61eca3c10b3884e90323b9eb6 100755 (executable)
@@ -19,10 +19,10 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
 
 SET(MSG-MANAGER-SRCS
         ${CMAKE_CURRENT_SOURCE_DIR}/src/msg-manager.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/src/msg-manager-alarm.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/src/msg-manager-contact.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/src/msg-manager-notification.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/src/msg-manager-sound.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/src/msg-manager-util.cpp
 )
 
 INCLUDE_DIRECTORIES(
@@ -31,7 +31,7 @@ INCLUDE_DIRECTORIES(
 )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(mgr_pkgs REQUIRED glib-2.0 dlog alarm-service appcore-agent badge callmgr_client contacts-service2 capi-appfw-application capi-appfw-package-manager notification vconf feedback capi-media-player capi-media-sound-manager)
+pkg_check_modules(mgr_pkgs REQUIRED glib-2.0 dlog alarm-service appcore-agent badge callmgr_client contacts-service2 capi-appfw-application capi-appfw-package-manager notification vconf feedback capi-media-player capi-media-sound-manager capi-system-device)
 INCLUDE_DIRECTORIES(${mgr_pkgs_INCLUDE_DIRS})
 LINK_DIRECTORIES(${mgr_pkgs_LIBRARY_DIRS})
 
diff --git a/manager/inc/msg-manager-alarm.h b/manager/inc/msg-manager-alarm.h
deleted file mode 100644 (file)
index e86d230..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-#ifndef __MSG_MGR_ALARM_H__
-#define __MSG_MGR_ALARM_H__
-
-/*==================================================================================================
-                                         INCLUDE FILES
-==================================================================================================*/
-#include <time.h>
-
-#include <msg.h>
-#include <alarm.h>
-
-/*==================================================================================================
-                                       DEFINES
-==================================================================================================*/
-
-typedef void (*msg_mgr_alarm_cb)(int alarmId);
-
-/*==================================================================================================
-                                       FUNCTION PROTOTYPES
-==================================================================================================*/
-int MsgMgrAlarmRegistration(struct tm *timeInfo, msg_mgr_alarm_cb userCB, int *alarmId);
-int MsgMgrAlarmRemove(int alarmId);
-
-
-#endif /*__MSG_MGR_ALARM_H__ */
-
index f27a1395a24ae5b80785d56ab636960125aa1694..1584690066e5bac0ba9da50b98179f6f09088a36 100644 (file)
 
 
 /* message app string for ticker noti */
+#define SENDING_MULTIMEDIA_MESSAGE_FAILED      "IDS_MSGF_POP_SENDING_MULTIMEDIA_MESSAGE_FAILED"
+#define MESSAGE_RETRIEVED                                                              "IDS_MSGF_BODY_MESSAGE_RETRIEVED"
+#define SMS_MESSAGE_SENDING_FAIL                                       "IDS_MSGF_POP_SENDING_MESSAGE_FAILED"
+#define SMS_MESSAGE_SIM_MESSAGE_FULL                           "IDS_MSGF_BODY_SIM_MEMORY_FULL_DELETE_SOME_ITEMS"
 #define SMS_MESSAGE_MEMORY_FULL                        "IDS_MSGF_POP_NOT_ENOUGH_MEMORY_DELETE_SOME_ITEMS"
 #define SMS_SIM_CARD_FULL                              "IDS_MSG_HEADER_SIM_CARD_FULL"
 
@@ -287,9 +291,12 @@ int MsgMgrRefreshNotification(msg_mgr_notification_type_t noti_type, bool bFeedb
 int MsgMgrAddReportNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_MESSAGE_INFO_S *msg_info);
 int MsgMgrDeleteReportNotification(const char *addr);
 int MsgMgrAddNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_MESSAGE_INFO_S *msg_info);
+int MsgMgrDeleteNoti(msg_mgr_notification_type_t noti_type, int simIndex);
 
 void MsgMgrRefreshAllNotification(bool bWithSimNoti, bool bFeedback, msg_mgr_active_notification_type_t active_type);
 int MsgMgrInsertInstantMessage(msg_mgr_notification_type_t noti_type);
+bool MsgMgrCheckNotificationSettingEnable();
+int MsgMgrInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg, bool bPlayFeedback, int msgId);
 int MsgMgrInsertBadge(unsigned int unreadMsgCnt);
 
 
diff --git a/manager/inc/msg-manager-util.h b/manager/inc/msg-manager-util.h
new file mode 100644 (file)
index 0000000..6479b47
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __MSG_MGR_UTIL_H__
+#define __MSG_MGR_UTIL_H__
+
+/*==================================================================================================
+                                         INCLUDE FILES
+==================================================================================================*/
+#include <time.h>
+
+#include <msg.h>
+#include <call-manager.h>
+
+/*==================================================================================================
+                                       DEFINES
+==================================================================================================*/
+
+typedef void (*msg_mgr_alarm_cb)(int alarmId);
+
+/*==================================================================================================
+                                       FUNCTION PROTOTYPES
+==================================================================================================*/
+int MsgMgrAlarmRegistration(struct tm *timeInfo, msg_mgr_alarm_cb userCB, int *alarmId);
+int MsgMgrAlarmRemove(int alarmId);
+
+cm_call_status_e MsgMgrGetCallStatus();
+void MsgMgrChangePmState();
+
+
+#endif /*__MSG_MGR_UTIL_H__ */
+
diff --git a/manager/src/msg-manager-alarm.cpp b/manager/src/msg-manager-alarm.cpp
deleted file mode 100644 (file)
index ab80df5..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-/*==================================================================================================
-                                         INCLUDE FILES
-==================================================================================================*/
-
-#include <map>
-#include <stdlib.h>
-#include <stdio.h>
-#include <glib.h>
-
-#include <msg_storage.h>
-
-#include <msg-manager-alarm.h>
-#include <msg-manager-debug.h>
-
-/*==================================================================================================
-                                     DEFINES
-==================================================================================================*/
-typedef std::map<int, msg_mgr_alarm_cb> callBackMap;
-
-/*==================================================================================================
-                                     VARIABLES
-==================================================================================================*/
-bool alarmInit = false;
-callBackMap alarmCBMap;
-
-/*==================================================================================================
-                            INTERNAL FUNCTION IMPLEMENTATION
-==================================================================================================*/
-int MsgMgrAlarmCB(int alarmId, void *pUserParam)
-{
-       MSG_MGR_DEBUG("MsgMgrAlarmCB is called. alarmId [%d]", alarmId);
-
-       callBackMap::iterator it = alarmCBMap.find(alarmId);
-
-       if (it == alarmCBMap.end()) {
-               MSG_MGR_DEBUG("alarmId is not found.");
-       } else {
-               msg_mgr_alarm_cb alarmCBfunction = it->second;
-               if (alarmCBfunction)
-                       alarmCBfunction(alarmId);
-
-               alarmCBMap.erase(it);
-       }
-
-       return 0;
-}
-
-
-int MsgMgrAlarmInit()
-{
-       MSG_MGR_BEGIN();
-
-       alarmCBMap.clear();
-
-       int retval = alarmmgr_init("msg-service-tools");
-       if (retval != ALARMMGR_RESULT_SUCCESS) {
-               MSG_MGR_DEBUG("alarmmgr_init error [%d]", retval);
-               return -1;
-       }
-
-       retval = alarmmgr_set_cb(MsgMgrAlarmCB, NULL);
-       if (retval != ALARMMGR_RESULT_SUCCESS)
-               MSG_MGR_DEBUG("alarmmgr_set_cb() [%d]", retval);
-
-       alarmInit = true;
-
-       MSG_MGR_END();
-       return 0;
-}
-
-/*==================================================================================================
-                            FUNCTION IMPLEMENTATION
-==================================================================================================*/
-int MsgMgrAlarmRegistration(struct tm *timeInfo, msg_mgr_alarm_cb userCB, int *alarmId)
-{
-       MSG_MGR_BEGIN();
-
-       if (!alarmInit) {
-               MSG_MGR_DEBUG("alarm manager is not initialized. Retry once.");
-               MsgMgrAlarmInit();
-               if (!alarmInit) {
-                       MSG_MGR_DEBUG("alarm manager is still not initialized. So return error.");
-                       return -1;
-               }
-       }
-
-       if (timeInfo == NULL || alarmId == NULL) {
-               MSG_MGR_DEBUG("(timeInfo == NULL || alarmId == NULL)");
-               return -1;
-       }
-
-       *alarmId = 0;
-       alarm_info_t *alarm_info = NULL;
-       alarm_id_t alarm_id = -1;
-       alarm_date_t target_time;
-
-       int retval = ALARMMGR_RESULT_SUCCESS;
-
-       alarm_info = alarmmgr_create_alarm();
-       if (alarm_info == NULL) {
-               MSG_MGR_DEBUG("alarmmgr_create_alarm error.");
-               return -1;
-       }
-
-       target_time.year = timeInfo->tm_year + 1900;
-       target_time.month = timeInfo->tm_mon + 1;
-       target_time.day = timeInfo->tm_mday;
-       target_time.hour = timeInfo->tm_hour;
-       target_time.min = timeInfo->tm_min;
-       target_time.sec = timeInfo->tm_sec;
-
-       MSG_MGR_DEBUG("Alarm Time : [%d-%d-%d %d:%d:%d] ",
-                       target_time.year, target_time.month, target_time.day,
-                       target_time.hour, target_time.min, target_time.sec);
-
-       retval = alarmmgr_set_time(alarm_info, target_time);
-       if (retval != ALARMMGR_RESULT_SUCCESS)
-               MSG_MGR_DEBUG("alarmmgr_set_time ret[%d]", retval);
-
-       retval = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_ONCE, 0);
-       if (retval != ALARMMGR_RESULT_SUCCESS)
-               MSG_MGR_DEBUG("alarmmgr_set_repeat_mode ret[%d]", retval);
-
-       retval = alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT);
-       if (retval != ALARMMGR_RESULT_SUCCESS)
-               MSG_MGR_DEBUG("alarmmgr_set_type ret[%d]", retval);
-
-       retval = alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &alarm_id);
-       MSG_MGR_DEBUG("alarmmgr_add_alarm_with_localtime ret[%d], alarm_id[%d]", retval, alarm_id);
-
-       retval = alarmmgr_free_alarm(alarm_info);
-       if (retval != ALARMMGR_RESULT_SUCCESS)
-               MSG_MGR_DEBUG("alarmmgr_free_alarm ret[%d]", retval);
-
-       *alarmId = (int)alarm_id;
-
-       alarmCBMap[*alarmId] = userCB;
-
-       MSG_MGR_END();
-       return 0;
-}
-
-
-int MsgMgrAlarmRemove(int alarmId)
-{
-       MSG_MGR_BEGIN();
-
-       if (!alarmInit) {
-               MSG_MGR_DEBUG("alarm manager is not initialized. Retry once.");
-               MsgMgrAlarmInit();
-               if (!alarmInit) {
-                       MSG_MGR_DEBUG("alarm manager is still not initialized. So return error.");
-                       return -1;
-               }
-       }
-
-       if (alarmmgr_remove_alarm(alarmId) != ALARMMGR_RESULT_SUCCESS) {
-               MSG_MGR_DEBUG("alarmmgr_remove_alarm faild.");
-               return -1;
-       }
-
-       MSG_MGR_END();
-       return 0;
-}
index b92f1ed24cb1d373d2621a35a7c9c225bfb2ce1f..53cf2ad0a7da70ca62f5827ed441c1952ab922cf 100644 (file)
 #include <notification_text_domain.h>
 #include <notification_internal.h>
 #include <notification_status.h>
+#include <notification_setting.h>
+#include <notification_setting_internal.h>
 #include <package_manager.h>
 #include <vconf.h>
 
 #include <msg.h>
 #include <msg_storage.h>
 
-#include <msg-manager-alarm.h>
+#include <msg-manager-util.h>
 #include <msg-manager-contact.h>
 #include <msg-manager-debug.h>
 #include <msg-manager-notification.h>
@@ -95,12 +97,22 @@ typedef struct _msg_mgr_noti_info_s
 } MSG_MGR_NOTI_INFO_S;
 
 
+typedef struct _del_noti_info_s
+{
+       msg_mgr_notification_type_t                     type;
+       int             sim_idx;
+} DEL_NOTI_INFO_S;
+
+
 /*==================================================================================================
                                                                                FUNCTION DEFINE
 ===================================================================================================*/
 
 void MsgMgrInitReportNotiList();
 void MsgRefreshNotiCb(void *data);
+void MsgMgrDeleteNotiCb(void *data);
+
+void MsgMgrDeleteNotification(msg_mgr_notification_type_t noti_type, int simIndex);
 
 notification_h getHandle(int *noti_id);
 
@@ -330,6 +342,21 @@ void MsgRefreshNotiCb(void *data)
 }
 
 
+void MsgMgrDeleteNotiCb(void *data)
+{
+       if (data) {
+               DEL_NOTI_INFO_S *delNotiInfo = (DEL_NOTI_INFO_S *)data;
+
+               MsgMgrDeleteNotification(delNotiInfo->type, delNotiInfo->sim_idx);
+
+               free(data);
+               data = NULL;
+       }
+
+       return;
+}
+
+
 int MsgMgrInsertOnlyActiveNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_MESSAGE_INFO_S *msg_info)
 {
        MSG_MGR_BEGIN();
@@ -557,6 +584,57 @@ __END_OF_ADD_NOTI :
 }
 
 
+void MsgMgrDeleteNotification(msg_mgr_notification_type_t noti_type, int simIndex)
+{
+       int noti_err = NOTIFICATION_ERROR_NONE;
+
+       if (noti_type == MSG_MGR_NOTI_TYPE_ALL) {
+               noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
+       } else if (noti_type == MSG_MGR_NOTI_TYPE_VOICE_1 || noti_type == MSG_MGR_NOTI_TYPE_VOICE_2 || noti_type == MSG_MGR_NOTI_TYPE_SIM) {
+               int notiId = 0;
+
+               notiId = getPrivId(noti_type, simIndex);
+               MSG_MGR_DEBUG("deleted notification ID = [%d] Type = [%d]", notiId, noti_type);
+
+               if (notiId > 0)
+                       noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, notiId);
+
+       } else {
+               MSG_MGR_DEBUG("No matching type [%d]", noti_type);
+       }
+
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               MSG_MGR_DEBUG("Fail to notification_delete_all noti_err [%d]", noti_err);
+       }
+
+       updatePrivId(noti_type, 0, simIndex);
+}
+
+
+int MsgMgrDeleteNoti(msg_mgr_notification_type_t noti_type, int simIndex)
+{
+       bool bNotiSvcReady = false;
+
+       DEL_NOTI_INFO_S *delNotiInfo = (DEL_NOTI_INFO_S *)calloc(1, sizeof(DEL_NOTI_INFO_S));
+
+       if (delNotiInfo) {
+               delNotiInfo->type = noti_type;
+               delNotiInfo->sim_idx = simIndex;
+       }
+
+       bNotiSvcReady = notification_is_service_ready();
+
+       if (bNotiSvcReady == true) {
+               MSG_MGR_DEBUG("Notification server is available");
+               MsgMgrDeleteNotiCb((void *)delNotiInfo);
+       } else {
+               MSG_MGR_DEBUG("Notification server is not available. Delete is defered");
+               notification_add_deferred_task(MsgMgrDeleteNotiCb, (void *)delNotiInfo);
+       }
+       return 0;
+}
+
+
 void MsgMgrRefreshAllNotification(bool bWithSimNoti, bool bFeedback, msg_mgr_active_notification_type_t active_type)
 {
        MSG_MGR_BEGIN();
@@ -2769,6 +2847,131 @@ _END_OF_INSTANT_NOTI:
 }
 
 
+bool MsgMgrCheckNotificationSettingEnable()
+{
+       bool msg_noti_enabled = false;
+       notification_system_setting_h system_setting = NULL;
+       notification_setting_h setting = NULL;
+
+       int err = NOTIFICATION_ERROR_NONE;
+
+       err = notification_setting_get_setting_by_package_name(MSG_DEFAULT_APP_ID, &setting);
+
+       if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
+               MSG_MGR_ERR("getting setting handle for [%s] is failed. err = %d", MSG_DEFAULT_APP_ID, err);
+       } else {
+               msg_noti_enabled = true;
+
+               bool allow_to_notify = false;
+               err = notification_setting_get_allow_to_notify(setting, &allow_to_notify);
+
+               if (err != NOTIFICATION_ERROR_NONE) {
+                       MSG_MGR_ERR("getting do not disturb setting is failed. err = %d", err);
+                       goto EXIT;
+               }
+
+               if (allow_to_notify) {
+                       MSG_MGR_DEBUG("message notification is allowed");
+
+                       /* check do not disturb mode */
+                       err = notification_system_setting_load_system_setting(&system_setting);
+
+                       if (err != NOTIFICATION_ERROR_NONE || system_setting == NULL) {
+                               MSG_MGR_ERR("getting system setting is failed. err = %d", err);
+                               goto EXIT;
+                       }
+
+                       bool do_not_disturb_mode = false;
+                       err = notification_system_setting_get_do_not_disturb(system_setting, &do_not_disturb_mode);
+
+                       if (err != NOTIFICATION_ERROR_NONE) {
+                               MSG_MGR_ERR("getting do not disturb setting is failed. err = %d", err);
+                               goto EXIT;
+                       }
+
+                       if (do_not_disturb_mode) {
+                               bool is_msg_excepted = false;
+                               err = notification_setting_get_do_not_disturb_except(setting, &is_msg_excepted);
+                               if (err != NOTIFICATION_ERROR_NONE) {
+                                       MSG_MGR_ERR("getting do not disturb except status for [%s] is failed. err = %d", MSG_DEFAULT_APP_ID, err);
+                                       msg_noti_enabled = false;
+                               } else {
+                                       MSG_MGR_INFO("do not disturb mode status for [%s] : %d", MSG_DEFAULT_APP_ID, is_msg_excepted);
+                                       msg_noti_enabled = (is_msg_excepted) ? true : false;
+                               }
+                       } else {
+                               MSG_MGR_DEBUG("do not disturb mode is off");
+                       }
+               } else {
+                       MSG_MGR_INFO("message notification is not allowed");
+                       msg_noti_enabled = false;
+               }
+       }
+
+EXIT:
+       if (system_setting)
+               notification_system_setting_free_system_setting(system_setting);
+
+       if (setting)
+               notification_setting_free_notification(setting);
+
+       return msg_noti_enabled;
+}
+
+
+int MsgMgrInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg, bool bPlayFeedback, int msgId)
+{
+       MSG_MGR_DEBUG("pTickerMsg=[%s], pLocaleTickerMsg=[%s]", pTickerMsg, pLocaleTickerMsg);
+       MSG_MGR_DEBUG("play feedback=[%d], msgId=[%d]", bPlayFeedback, msgId);
+
+       MsgMgrChangePmState();
+
+       char *notiMsg = NULL;
+       msg_mgr_active_notification_type_t active_type = MSG_MGR_ACTIVE_NOTI_TYPE_NONE;
+       int err = 0;
+
+       notiMsg = get_translate_text(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, pLocaleTickerMsg);
+       MSG_MGR_DEBUG("notiMsg %s", notiMsg);
+
+       if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) != 0 &&
+               g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) != 0 &&
+               g_strcmp0(pLocaleTickerMsg, MESSAGE_RETRIEVED) != 0) {
+               if (g_strcmp0(pLocaleTickerMsg, notiMsg) == 0) {
+                       notification_status_message_post(pTickerMsg);
+               } else {
+                       notification_status_message_post(notiMsg);
+               }
+       } else {
+               /* Show ticker popup for sending failed msg. */
+               active_type = MSG_MGR_ACTIVE_NOTI_TYPE_INSTANT;
+       }
+
+       if (notiMsg) {
+               free(notiMsg);
+               notiMsg = NULL;
+       }
+
+       if (bPlayFeedback) {
+               if (msgId > 0 &&
+                       (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) == 0 || g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) == 0)) {
+                       err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_FAILED, true, active_type);
+                       if (err != 0) {
+                               MSG_MGR_DEBUG("MsgRefreshFailedNoti err=[%d]", err);
+                       }
+               } else if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SIM_MESSAGE_FULL) == 0) {
+                       err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_SIM_FULL, true, MSG_MGR_ACTIVE_NOTI_TYPE_NONE);
+                       if (err != 0) {
+                               MSG_MGR_DEBUG("MsgRefreshSimFullNoti err=[%d]", err);
+                       }
+               } else {
+                       MsgMgrSoundPlayStart(NULL, MSG_MGR_SOUND_PLAY_DEFAULT);
+               }
+       }
+
+       return err;
+}
+
+
 int MsgMgrInsertBadge(unsigned int unreadMsgCnt)
 {
        MSG_MGR_DEBUG("Start to set badge to [%d].", unreadMsgCnt);
index a10b6904ce3b8422429fd5260ccf448758ed74a5..0879db86077f0d89789d9a3cf2cbbf7415af328e 100644 (file)
@@ -24,7 +24,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include <call-manager.h>
 #include <player.h>
 #include <sound_manager.h>
 #include <feedback.h>
@@ -35,6 +34,7 @@
 #include <msg-manager-debug.h>
 #include <msg-manager-notification.h>
 #include <msg-manager-sound.h>
+#include <msg-manager-util.h>
 
 /*==================================================================================================
                                     DEFINES
@@ -57,13 +57,10 @@ bool bPlaying = false;
 pthread_mutex_t muMmPlay = PTHREAD_MUTEX_INITIALIZER;
 pthread_mutex_t muStream = PTHREAD_MUTEX_INITIALIZER;
 
-extern cm_client_h cm_handle;
-
 /*==================================================================================================
                                                                                FUNCTION DEFINE
 ===================================================================================================*/
 int MsgMgrGetFileSize(const char *pFileName);
-cm_call_status_e MsgMgrGetCallStatus();
 
 int MsgMgrStreamStart(MSG_MGR_SOUND_TYPE_T soundType);
 void MsgMgrStreamStop();
@@ -88,15 +85,6 @@ int MsgMgrGetFileSize(const char *pFileName)
 }
 
 
-cm_call_status_e MsgMgrGetCallStatus()
-{
-       cm_call_status_e call_status = CM_CALL_STATUS_IDLE;
-       cm_get_call_status(cm_handle, &call_status);
-
-       return call_status;
-}
-
-
 static void MsgMgrSoundPlayeErrorCallback(int error_code, void *user_data)
 {
        MSG_MGR_DEBUG("MsgMgrSoundPlayeErrorCallback called [%d]", error_code);
diff --git a/manager/src/msg-manager-util.cpp b/manager/src/msg-manager-util.cpp
new file mode 100644 (file)
index 0000000..26b7ef6
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/*==================================================================================================
+                                         INCLUDE FILES
+==================================================================================================*/
+
+#include <map>
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+
+#include <alarm.h>
+#include <device/display.h>
+
+#include <msg_storage.h>
+
+#include <msg-manager-util.h>
+#include <msg-manager-debug.h>
+#include <msg-manager-notification.h>
+
+/*==================================================================================================
+                                     DEFINES
+==================================================================================================*/
+typedef std::map<int, msg_mgr_alarm_cb> callBackMap;
+
+/*==================================================================================================
+                                     VARIABLES
+==================================================================================================*/
+bool alarmInit = false;
+callBackMap alarmCBMap;
+
+extern cm_client_h cm_handle;
+
+/*==================================================================================================
+                            INTERNAL FUNCTION IMPLEMENTATION
+==================================================================================================*/
+int MsgMgrAlarmCB(int alarmId, void *pUserParam)
+{
+       MSG_MGR_DEBUG("MsgMgrAlarmCB is called. alarmId [%d]", alarmId);
+
+       callBackMap::iterator it = alarmCBMap.find(alarmId);
+
+       if (it == alarmCBMap.end()) {
+               MSG_MGR_DEBUG("alarmId is not found.");
+       } else {
+               msg_mgr_alarm_cb alarmCBfunction = it->second;
+               if (alarmCBfunction)
+                       alarmCBfunction(alarmId);
+
+               alarmCBMap.erase(it);
+       }
+
+       return 0;
+}
+
+
+int MsgMgrAlarmInit()
+{
+       MSG_MGR_BEGIN();
+
+       alarmCBMap.clear();
+
+       int retval = alarmmgr_init("msg-service-tools");
+       if (retval != ALARMMGR_RESULT_SUCCESS) {
+               MSG_MGR_DEBUG("alarmmgr_init error [%d]", retval);
+               return -1;
+       }
+
+       retval = alarmmgr_set_cb(MsgMgrAlarmCB, NULL);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_MGR_DEBUG("alarmmgr_set_cb() [%d]", retval);
+
+       alarmInit = true;
+
+       MSG_MGR_END();
+       return 0;
+}
+
+/*==================================================================================================
+                            FUNCTION IMPLEMENTATION
+==================================================================================================*/
+int MsgMgrAlarmRegistration(struct tm *timeInfo, msg_mgr_alarm_cb userCB, int *alarmId)
+{
+       MSG_MGR_BEGIN();
+
+       if (!alarmInit) {
+               MSG_MGR_DEBUG("alarm manager is not initialized. Retry once.");
+               MsgMgrAlarmInit();
+               if (!alarmInit) {
+                       MSG_MGR_DEBUG("alarm manager is still not initialized. So return error.");
+                       return -1;
+               }
+       }
+
+       if (timeInfo == NULL || alarmId == NULL) {
+               MSG_MGR_DEBUG("(timeInfo == NULL || alarmId == NULL)");
+               return -1;
+       }
+
+       *alarmId = 0;
+       alarm_info_t *alarm_info = NULL;
+       alarm_id_t alarm_id = -1;
+       alarm_date_t target_time;
+
+       int retval = ALARMMGR_RESULT_SUCCESS;
+
+       alarm_info = alarmmgr_create_alarm();
+       if (alarm_info == NULL) {
+               MSG_MGR_DEBUG("alarmmgr_create_alarm error.");
+               return -1;
+       }
+
+       target_time.year = timeInfo->tm_year + 1900;
+       target_time.month = timeInfo->tm_mon + 1;
+       target_time.day = timeInfo->tm_mday;
+       target_time.hour = timeInfo->tm_hour;
+       target_time.min = timeInfo->tm_min;
+       target_time.sec = timeInfo->tm_sec;
+
+       MSG_MGR_DEBUG("Alarm Time : [%d-%d-%d %d:%d:%d] ",
+                       target_time.year, target_time.month, target_time.day,
+                       target_time.hour, target_time.min, target_time.sec);
+
+       retval = alarmmgr_set_time(alarm_info, target_time);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_MGR_DEBUG("alarmmgr_set_time ret[%d]", retval);
+
+       retval = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_ONCE, 0);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_MGR_DEBUG("alarmmgr_set_repeat_mode ret[%d]", retval);
+
+       retval = alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_MGR_DEBUG("alarmmgr_set_type ret[%d]", retval);
+
+       retval = alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &alarm_id);
+       MSG_MGR_DEBUG("alarmmgr_add_alarm_with_localtime ret[%d], alarm_id[%d]", retval, alarm_id);
+
+       retval = alarmmgr_free_alarm(alarm_info);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_MGR_DEBUG("alarmmgr_free_alarm ret[%d]", retval);
+
+       *alarmId = (int)alarm_id;
+
+       alarmCBMap[*alarmId] = userCB;
+
+       MSG_MGR_END();
+       return 0;
+}
+
+
+int MsgMgrAlarmRemove(int alarmId)
+{
+       MSG_MGR_BEGIN();
+
+       if (!alarmInit) {
+               MSG_MGR_DEBUG("alarm manager is not initialized. Retry once.");
+               MsgMgrAlarmInit();
+               if (!alarmInit) {
+                       MSG_MGR_DEBUG("alarm manager is still not initialized. So return error.");
+                       return -1;
+               }
+       }
+
+       if (alarmmgr_remove_alarm(alarmId) != ALARMMGR_RESULT_SUCCESS) {
+               MSG_MGR_DEBUG("alarmmgr_remove_alarm faild.");
+               return -1;
+       }
+
+       MSG_MGR_END();
+       return 0;
+}
+
+
+cm_call_status_e MsgMgrGetCallStatus()
+{
+       cm_call_status_e call_status = CM_CALL_STATUS_IDLE;
+       cm_get_call_status(cm_handle, &call_status);
+
+       return call_status;
+}
+
+
+void MsgMgrChangePmState()
+{
+       MSG_MGR_BEGIN();
+       if (MsgMgrCheckNotificationSettingEnable() == false)
+               return;
+
+       int callStatus = 0;
+
+       callStatus = MsgMgrGetCallStatus();
+       MSG_MGR_DEBUG("Call Status = %d", callStatus);
+
+       if (callStatus > 0 && callStatus < 3) {
+               MSG_MGR_DEBUG("Call is activated. Do not turn on the lcd.");
+       } else {
+               MSG_MGR_DEBUG("Call is not activated. Turn on the lcd.");
+               device_display_change_state(DISPLAY_STATE_NORMAL);
+       }
+
+       MSG_MGR_END();
+}
index 19c7629111a87d1d70b8e002a110428f754ecfe3..2b3044f0429095e934c8078a15a70dfd32cdb30b 100644 (file)
@@ -21,6 +21,7 @@ extern "C"
 #include "msg-manager-debug.h"
 #include "msg-manager-notification.h"
 #include "msg-manager-sound.h"
+#include "msg-manager-util.h"
 
 /* below defines will be removed */
 #define EVENT_KEY_OUT_MSG_TYPE "msg_type"
@@ -306,6 +307,45 @@ void _add_noti_func(app_control_h app_control)
        MsgMgrAddNotification(noti_type, &msg_info);
 }
 
+void _del_noti_func(app_control_h app_control)
+{
+       char *type;
+       msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
+
+       int ret = app_control_get_extra_data(app_control, "type", &type);
+       if (ret == APP_CONTROL_ERROR_NONE && type) {
+               if (g_strcmp0(type, "all") == 0) {
+                       noti_type = MSG_MGR_NOTI_TYPE_ALL;
+               } else if (g_strcmp0(type, "normal") == 0) {
+                       noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
+               } else if (g_strcmp0(type, "sim") == 0) {
+                       noti_type = MSG_MGR_NOTI_TYPE_SIM;
+               } else if (g_strcmp0(type, "voice1") == 0) {
+                       noti_type = MSG_MGR_NOTI_TYPE_VOICE_1;
+               } else if (g_strcmp0(type, "voice2") == 0) {
+                       noti_type = MSG_MGR_NOTI_TYPE_VOICE_2;
+               }
+
+               g_free(type);
+       } else {
+               MSG_MGR_ERR("app_control_get_extra_data failed");
+               return;
+       }
+
+       char *simIndex = NULL;
+       ret = app_control_get_extra_data(app_control, "sim_index", &simIndex);
+       if (ret != APP_CONTROL_ERROR_NONE || simIndex == NULL) {
+               MSG_MGR_ERR("app_control_get_extra_data failed");
+               return;
+       }
+
+       int sim_index = atoi(simIndex);
+
+       MsgMgrDeleteNoti(noti_type, sim_index);
+
+       g_free(simIndex);
+}
+
 void _add_report_noti_func(app_control_h app_control)
 {
        char *type;
@@ -446,6 +486,64 @@ void _insert_only_active_noti_func(app_control_h app_control)
        MsgMgrInsertOnlyActiveNotification(noti_type, &msg_info);
 }
 
+void _insert_ticker_func(app_control_h app_control)
+{
+       char *ticker_msg = NULL;
+       char *locale_ticker_msg = NULL;
+       char *feedback_str = NULL;
+       bool feedback = false;
+       char *msg_id_str = NULL;
+       int msg_id = 0;
+
+       int ret = app_control_get_extra_data(app_control, "ticker_msg", &ticker_msg);
+       if (ret != APP_CONTROL_ERROR_NONE || ticker_msg == NULL) {
+               MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
+               goto _END_OF_INSERT_TICKER;
+       }
+
+       ret = app_control_get_extra_data(app_control, "locale_ticker_msg", &locale_ticker_msg);
+       if (ret != APP_CONTROL_ERROR_NONE || locale_ticker_msg == NULL) {
+               MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
+               goto _END_OF_INSERT_TICKER;
+       }
+
+       ret = app_control_get_extra_data(app_control, "feedback", &feedback_str);
+       if (ret != APP_CONTROL_ERROR_NONE || feedback_str == NULL) {
+               MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
+               goto _END_OF_INSERT_TICKER;
+       } else {
+               if (g_strcmp0(feedback_str, "true") == 0)
+                       feedback = true;
+               else
+                       feedback = false;
+       }
+
+       ret = app_control_get_extra_data(app_control, "msg_id", &msg_id_str);
+       if (ret != APP_CONTROL_ERROR_NONE || msg_id_str == NULL) {
+               MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
+               goto _END_OF_INSERT_TICKER;
+       } else {
+               msg_id = atoi(msg_id_str);
+       }
+
+       ret = MsgMgrInsertTicker(ticker_msg, locale_ticker_msg, feedback, msg_id);
+       if (ret != 0)
+               MSG_MGR_ERR("MsgMgrInsertTicker failed [%d]", ret);
+
+_END_OF_INSERT_TICKER:
+       if (ticker_msg)
+               g_free(ticker_msg);
+
+       if (locale_ticker_msg)
+               g_free(locale_ticker_msg);
+
+       if (feedback_str)
+               g_free(feedback_str);
+
+       if (msg_id_str)
+               g_free(msg_id_str);
+}
+
 void _sound_play_start_func(app_control_h app_control)
 {
        char *type;
@@ -484,6 +582,11 @@ void _sound_play_start_func(app_control_h app_control)
        }
 }
 
+void _change_pm_state_func(app_control_h app_control)
+{
+       MsgMgrChangePmState();
+}
+
 void service_app_control(app_control_h app_control, void *data)
 {
        MSG_MGR_INFO("service_app_control called");
@@ -507,14 +610,20 @@ void service_app_control(app_control_h app_control, void *data)
                                        _refresh_noti_func(app_control);
                                } else if (g_strcmp0(cmd, "add_noti") == 0) {
                                        _add_noti_func(app_control);
+                               } else if (g_strcmp0(cmd, "del_noti") == 0) {
+                                       _del_noti_func(app_control);
                                } else if (g_strcmp0(cmd, "add_report_noti") == 0) {
                                        _add_report_noti_func(app_control);
                                } else if (g_strcmp0(cmd, "del_report_noti") == 0) {
                                        _del_report_noti_func(app_control);
                                } else if (g_strcmp0(cmd, "insert_only_active_noti") == 0) {
                                        _insert_only_active_noti_func(app_control);
+                               } else if (g_strcmp0(cmd, "insert_ticker") == 0) {
+                                       _insert_ticker_func(app_control);
                                } else if (g_strcmp0(cmd, "sound_play_start") == 0) {
                                        _sound_play_start_func(app_control);
+                               } else if (g_strcmp0(cmd, "change_pm_state") == 0) {
+                                       _change_pm_state_func(app_control);
                                }
 
                                g_free(cmd);
index 2d1e37d5c5b9ccc2e036e542819a43e19ec8df00..957333b8ebeff6f3c7d9e1bd785417e0b9b8c761 100644 (file)
@@ -10,6 +10,7 @@
         <privilege>http://tizen.org/privilege/message.read</privilege>
         <privilege>http://tizen.org/privilege/callhistory.read</privilege>
         <privilege>http://tizen.org/privilege/callhistory.write</privilege>
+        <privilege>http://tizen.org/privilege/display</privilege>
         <privilege>http://tizen.org/privilege/notification</privilege>
         <privilege>http://tizen.org/privilege/haptic</privilege>
         <privilege>http://tizen.org/privilege/mediastorage</privilege>
index e59e43710635257310384d9517120067ddf7ea05..cf02ffdd5ddfe8f5cf51308df439ddd63ce91fd4 100755 (executable)
@@ -20,16 +20,11 @@ Requires(postun): systemd
 BuildRequires: cmake
 BuildRequires: libacl-devel
 BuildRequires: pkgconfig(alarm-service)
-BuildRequires: pkgconfig(appcore-agent)
 BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(badge)
+BuildRequires: pkgconfig(boost)
 BuildRequires: pkgconfig(bundle)
-BuildRequires: pkgconfig(capi-appfw-application)
-BuildRequires: pkgconfig(capi-appfw-package-manager)
 BuildRequires: pkgconfig(capi-media-image-util)
 BuildRequires: pkgconfig(capi-media-metadata-extractor)
-BuildRequires: pkgconfig(capi-media-player)
-BuildRequires: pkgconfig(capi-media-sound-manager)
 BuildRequires: pkgconfig(capi-media-thumbnail-util)
 BuildRequires: pkgconfig(capi-network-connection)
 BuildRequires: pkgconfig(capi-system-device)
@@ -43,28 +38,31 @@ BuildRequires: pkgconfig(cynara-session)
 BuildRequires: pkgconfig(deviced)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(eventsystem)
-BuildRequires: pkgconfig(feedback)
 BuildRequires: pkgconfig(gio-2.0)
-BuildRequires: pkgconfig(gobject-2.0)
 BuildRequires: pkgconfig(icu-uc)
-BuildRequires: pkgconfig(iniparser)
 BuildRequires: pkgconfig(json-glib-1.0)
 BuildRequires: pkgconfig(lbs-dbus)
 BuildRequires: pkgconfig(libcurl)
+BuildRequires: pkgconfig(libsmack)
 BuildRequires: pkgconfig(libsystemd-login)
 BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(libxml-2.0)
 BuildRequires: pkgconfig(libwbxml2)
 BuildRequires: pkgconfig(motion)
-BuildRequires: pkgconfig(notification)
-BuildRequires: pkgconfig(security-server)
 BuildRequires: pkgconfig(sqlite3)
-BuildRequires: pkgconfig(storage)
 BuildRequires: pkgconfig(tapi)
 BuildRequires: pkgconfig(vconf)
 %if "%{?profile}" != "wearable"
+BuildRequires: pkgconfig(appcore-agent)
+BuildRequires: pkgconfig(badge)
 BuildRequires: pkgconfig(callmgr_client)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-appfw-package-manager)
+BuildRequires: pkgconfig(capi-media-player)
+BuildRequires: pkgconfig(capi-media-sound-manager)
 BuildRequires: pkgconfig(contacts-service2)
+BuildRequires: pkgconfig(feedback)
+BuildRequires: pkgconfig(notification)
 %endif
 
 %description
@@ -145,6 +143,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
                -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \
                -DTZ_SYS_DATA=%TZ_SYS_DATA \
                -DTZ_SYS_DB=%TZ_SYS_DB \
+               -DTZ_SYS_HOME=%TZ_SYS_HOME \
 %ifarch i586
 -D_TIZEN_I586_ENABLED:BOOL=ON \
 %else
index d11059cc9a284618e768031cf64fc0723bb19e0e..2c48923a19ab13d5848e97cac6e7256437154a31 100755 (executable)
@@ -42,7 +42,7 @@ INCLUDE_DIRECTORIES(
 )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(mms_plugin_pkgs REQUIRED glib-2.0 libcurl vconf dlog capi-network-connection capi-telephony)
+pkg_check_modules(mms_plugin_pkgs REQUIRED glib-2.0 libcurl libsmack vconf dlog capi-network-connection capi-telephony)
 
 FOREACH(flag ${mms_plugin_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 4a6da6abb6256dfe42035a14985336b3f79fe774..dfc38c28b363372c6d64f254d193d7da84f41ad7 100755 (executable)
@@ -1898,8 +1898,7 @@ void SmsPluginSetting::deliverVoiceMsgNoti(int simIndex, int mwiCnt)
                MSG_DEBUG("callbackIncoming is failed.");
 #else
        MsgInsertNotification(&msgInfo);
-       if (MsgCheckNotificationSettingEnable())
-               MsgChangePmState();
+       MsgChangePmState();
 #endif
 
        MSG_END();
index 6379beb1af950138a5c576ac65d9c59358360402..cb248ee2dcfdf0765308022ea0278ab1dd7659ec 100755 (executable)
@@ -46,7 +46,7 @@ INCLUDE_DIRECTORIES(
 
 INCLUDE(FindPkgConfig)
 
-SET(PKG_MODULES glib-2.0 vconf dlog libxml-2.0 storage json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login csr-framework)
+SET(PKG_MODULES glib-2.0 vconf dlog libxml-2.0 boost json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login csr-framework libsmack)
 pkg_check_modules(utils_pkgs REQUIRED ${PKG_MODULES})
 
 FOREACH(flag ${utils_pkgs_CFLAGS})
index a7c793366dc8d27379d2336a59d60ce46d86773c..750d946593afc416a41b30b0554092857c61b108 100755 (executable)
@@ -21,6 +21,9 @@
 #include <queue>
 #include <glib.h>
 
+#include <boost/filesystem.hpp>
+#include <boost/chrono/detail/system.hpp>
+
 #include "MsgDebug.h"
 #include "MsgUtilFile.h"
 #include "MsgContact.h"
@@ -30,7 +33,6 @@
 #include "MsgUtilStorage.h"
 #include "MsgException.h"
 
-#include <storage.h>
 
 static int msgCntLimit[MSG_COUNT_LIMIT_MAILBOX_TYPE_MAX][MSG_COUNT_LIMIT_MSG_TYPE_MAX] = {{10, 10, 0, 10, 10}, {5, 10, 0, 0, 0}, {10, 10, 0, 0, 0}, {10, 10, 0, 0, 0}, {0, 0, 10, 0, 0}};
 
@@ -193,19 +195,18 @@ msg_error_t MsgStoCheckMsgCntFull(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYP
 
        msg_error_t err = MSG_SUCCESS;
 
-       struct statvfs s;
-       double freeSpace;
-       int r;
-       r = storage_get_internal_memory_size(&s);
-       if (r < 0)
+       boost::system::error_code ec;
+       boost::filesystem::space_info si = boost::filesystem::space(TZ_SYS_HOME_PATH, ec);
+
+       if (ec) {
+               MSG_ERR("Faile to get space info [%s]", ec.message().c_str());
                return MSG_ERR_STORAGE_ERROR;
-       else {
-               freeSpace = (double)s.f_bsize*s.f_bavail;
-               MSG_DEBUG("Free space of storage is [%lu] MB.", freeSpace);
+       } else {
+               MSG_DEBUG("Free space of storage is [%llu] MB.", si.free);
 
-               if (freeSpace < SMS_MINIMUM_SPACE && pMsgType->mainType == MSG_SMS_TYPE)
+               if (si.free < SMS_MINIMUM_SPACE && pMsgType->mainType == MSG_SMS_TYPE)
                        err = MSG_ERR_MESSAGE_COUNT_FULL;
-               else if (freeSpace < MMS_MINIMUM_SPACE && pMsgType->mainType == MSG_MMS_TYPE)
+               else if (si.free < MMS_MINIMUM_SPACE && pMsgType->mainType == MSG_MMS_TYPE)
                        err = MSG_ERR_MESSAGE_COUNT_FULL;
        }
 
@@ -345,19 +346,19 @@ int MsgStoCheckMsgCntLimit(const MSG_MESSAGE_TYPE_S* pMsgType, msg_folder_id_t f
 msg_error_t MsgStocheckMemoryStatus()
 {
        msg_error_t err = MSG_SUCCESS;
-       struct statvfs s;
-       double freeSpace;
-       int r;
-       r = storage_get_internal_memory_size(&s);
-       if (r < 0)
+       boost::system::error_code ec;
+       boost::filesystem::space_info si = boost::filesystem::space(TZ_SYS_HOME_PATH, ec);
+
+       if (ec) {
+               MSG_ERR("Faile to get space info [%s]", ec.message().c_str());
                return MSG_ERR_STORAGE_ERROR;
-       else {
-               freeSpace = (double)s.f_bsize*s.f_bavail;
-           MSG_DEBUG("Free space of storage is [%ul] MB.", freeSpace);
-               if (freeSpace < SMS_MINIMUM_SPACE)
-                       err = MSG_ERR_MESSAGE_COUNT_FULL;
        }
 
+       MSG_DEBUG("Free space of storage is [%llu] MB.", si.free);
+
+       if (si.free < SMS_MINIMUM_SPACE)
+               err = MSG_ERR_MESSAGE_COUNT_FULL;
+
        MSG_DEBUG("Memory status =[%d]", err);
 
        return err;