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)
)
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}")
*/
+#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;
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();
}
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 */
/*======================================================================================*/
}
-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;
}
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, ¬i_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, ¬i_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, ¬i_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, ¬i_id) != MSG_SUCCESS) {
- MSG_INFO("MsgSettingGetInt() is failed");
- }
- break;
- }
- case MSG_NOTI_TYPE_SIM_FULL:
- if (MsgSettingGetInt(SIM_FULL_NOTI_PRIV_ID, ¬i_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 */
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);
pMsgInfo->msgId = (msg_message_id_t)rowId;
MsgInsertNotification(pMsgInfo);
- if (MsgCheckNotificationSettingEnable())
- MsgChangePmState();
+ MsgChangePmState();
MSG_END();
MsgInsertNotification(&msgInfo);
}
- if (MsgCheckNotificationSettingEnable())
- MsgChangePmState();
+ MsgChangePmState();
msg_id_list_s msgIdList;
msg_message_id_t msgIds[1];
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
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(
)
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})
+++ /dev/null
-/*
- * 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__ */
-
/* 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"
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);
--- /dev/null
+/*
+ * 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__ */
+
+++ /dev/null
-/*
- * 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;
-}
#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>
} 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);
}
+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();
}
+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();
}
+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);
#include <sys/stat.h>
#include <unistd.h>
-#include <call-manager.h>
#include <player.h>
#include <sound_manager.h>
#include <feedback.h>
#include <msg-manager-debug.h>
#include <msg-manager-notification.h>
#include <msg-manager-sound.h>
+#include <msg-manager-util.h>
/*==================================================================================================
DEFINES
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();
}
-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);
--- /dev/null
+/*
+ * 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();
+}
#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"
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;
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;
}
}
+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");
_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);
<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>
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)
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
-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
)
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}")
MSG_DEBUG("callbackIncoming is failed.");
#else
MsgInsertNotification(&msgInfo);
- if (MsgCheckNotificationSettingEnable())
- MsgChangePmState();
+ MsgChangePmState();
#endif
MSG_END();
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})
#include <queue>
#include <glib.h>
+#include <boost/filesystem.hpp>
+#include <boost/chrono/detail/system.hpp>
+
#include "MsgDebug.h"
#include "MsgUtilFile.h"
#include "MsgContact.h"
#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}};
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;
}
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;