SET(MAIN-SRCS
${CMAKE_SOURCE_DIR}/framework/main.cpp
+ ${CMAKE_SOURCE_DIR}/framework/MsgDPMUtils.cpp
)
INCLUDE_DIRECTORIES(
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(main_pkgs REQUIRED glib-2.0 dlog vconf)
+pkg_check_modules(main_pkgs REQUIRED glib-2.0 dlog vconf dpm)
FOREACH(flag ${main_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
--- /dev/null
+/*
+ * Copyright (c) 2014 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 "MsgDebug.h"
+#include "MsgStorageHandler.h"
+#include "MsgUtilFunction.h"
+#include "MsgDPMUtils.h"
+
+#include <dpm/restriction.h>
+
+device_policy_manager_h dpm_handle = NULL;
+int dpm_sms_callback_id = 0;
+int dpm_mms_callback_id = 0;
+
+/*==================================================================================================
+ FUNCTION IMPLEMENTATION
+==================================================================================================*/
+
+static void dpm_sms_policy_changed_callback(const char* name, const char* object, void *user_data)
+{
+ MSG_INFO("dpm_sms_policy_changed_callback called. name [%s] object [%s]", name, object);
+
+ int ret = 0;
+ int state = 0;
+
+ ret = dpm_restriction_get_messaging_state(dpm_handle, &state);
+ if (ret != DPM_ERROR_NONE) {
+ MSG_ERR("dpm_restriction_get_messaging_state failed [%d]", ret);
+ return;
+ }
+
+ msg_set_dpm_policy(MSG_SMS_TYPE, state);
+
+ if (state == 1) {
+ MsgStoUpdateDPMRestrictedStatus(MSG_SMS_TYPE);
+ /* temporal */
+ MsgStoUpdateDPMRestrictedStatus(MSG_MMS_TYPE);
+ }
+}
+
+#if 0
+static void dpm_mms_policy_changed_callback(const char* name, const char* object, void *user_data)
+{
+ MSG_INFO("dpm_mms_policy_changed_callback called. name [%s] object [%s]", name, object);
+
+ int ret = 0;
+ int state = 0;
+
+ ret = dpm_restriction_get_messaging_state(dpm_handle, &dpm_policy_enable[MSG_MMS_TYPE]);
+ if (ret != DPM_ERROR_NONE) {
+ MSG_ERR("dpm_restriction_get_messaging_state failed [%d]", ret);
+ return;
+ }
+
+ msg_set_dpm_policy(MSG_MMS_TYPE, state);
+
+ if (state == 1)
+ MsgStoUpdateDPMRestrictedStatus(MSG_MMS_TYPE);
+}
+#endif
+
+void __get_dpm_policy()
+{
+ int ret = 0;
+ int state = 0;
+
+ ret = dpm_restriction_get_messaging_state(dpm_handle, &state);
+ if (ret != DPM_ERROR_NONE) {
+ MSG_ERR("dpm_restriction_get_messaging_state failed [%d]", ret);
+ return;
+ }
+
+ MSG_DEBUG("sms policy [%d]", state);
+ msg_set_dpm_policy(MSG_SMS_TYPE, state);
+// MSG_DEBUG("mms policy [%d]", dpm_policy_enable[MSG_MMS_TYPE]);
+
+ ret = dpm_add_policy_changed_cb(dpm_handle, "messaging", dpm_sms_policy_changed_callback, NULL, &dpm_sms_callback_id);
+ if (ret != DPM_ERROR_NONE) {
+ MSG_ERR("dpm_add_policy_changed_cb failed [%d]", ret);
+ return;
+ }
+}
+
+void msg_init_dpm_policy()
+{
+ MSG_BEGIN();
+
+ int cnt = 5;
+ while (cnt--) {
+ dpm_handle = dpm_manager_create();
+ if (dpm_handle == NULL) {
+ MSG_ERR("dpm_manager_create() failed");
+ } else {
+ MSG_DEBUG("dpm_manager_create() success");
+ __get_dpm_policy();
+ break;
+ }
+
+ sleep(1);
+ }
+
+ MSG_END();
+}
+
+
+void msg_deinit_dpm_policy()
+{
+ if (dpm_handle)
+ dpm_manager_destroy(dpm_handle);
+
+ if (dpm_sms_callback_id)
+ dpm_remove_policy_changed_cb(dpm_handle, dpm_sms_callback_id);
+
+ if (dpm_mms_callback_id)
+ dpm_remove_policy_changed_cb(dpm_handle, dpm_mms_callback_id);
+}
+
INCLUDE FILES
==================================================================================================*/
#include "MsgCallStatusManager.h"
+#include "MsgDPMUtils.h"
#include "MsgDebug.h"
#include "MsgException.h"
#include "MsgContact.h"
#include "MsgStorageTypes.h"
#include "MsgCmdHandler.h"
#include "MsgUtilFile.h"
-#include "MsgUtilFunction.h"
#include "MsgUtilStorage.h"
#include "MsgNotificationWrapper.h"
err = dbHandle->execQuery(sqlQuery);
if (err == MSG_SUCCESS) {
+ MsgStoUpdateAllAddress();
MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
}
--- /dev/null
+/*
+ * Copyright (c) 2014 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_DPM_UTILS_H
+#define MSG_DPM_UTILS_H
+
+/*==================================================================================================
+ INCLUDE FILES
+==================================================================================================*/
+#include "MsgInternalTypes.h"
+
+
+/*==================================================================================================
+ FUNCTION PROTOTYPES
+==================================================================================================*/
+
+void msg_init_dpm_policy();
+void msg_deinit_dpm_policy();
+
+#endif /* MSG_DPM_UTILS_H */
msg_error_t msg_aul_svc_set_uri(bundle *bundle_data, char *uri);
-void msg_init_dpm_policy();
-
-void msg_deinit_dpm_policy();
+void msg_set_dpm_policy(int type, int state);
bool msg_check_dpm_policy(int type);
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include/common
- ${CMAKE_SOURCE_DIR}/include/framework
${CMAKE_SOURCE_DIR}/include/utils
${CMAKE_SOURCE_DIR}/include/externals
${CMAKE_SOURCE_DIR}/include/mapi
#include "MsgSettingTypes.h"
#include "MsgMmsMessage.h"
#include "MsgGconfWrapper.h"
-#include "MsgStorageHandler.h"
#include "MsgSerialize.h"
#include "MsgSpamFilter.h"
#include "MsgUtilMime.h"
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include/mapi
${CMAKE_SOURCE_DIR}/include/common
- ${CMAKE_SOURCE_DIR}/include/framework
${CMAKE_SOURCE_DIR}/include/utils
${CMAKE_SOURCE_DIR}/vobject-engine/include
)
INCLUDE(FindPkgConfig)
-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 libsmack csr dpm)
+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 libsmack csr)
pkg_check_modules(utils_pkgs REQUIRED ${PKG_MODULES})
FOREACH(flag ${utils_pkgs_CFLAGS})
#include <ctype.h>
#include <aul.h>
#include <aul_svc.h>
-#include <dpm/restriction.h>
typedef struct _msg_launch_app_data {
char *app_id;
[MSG_MMS_TYPE] = 1,
};
-device_policy_manager_h dpm_handle = NULL;
-bool is_dpm_init = false;
-int dpm_sms_callback_id = 0;
-int dpm_mms_callback_id = 0;
-
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
static int phonenumberMinMatchDigit = -1;
#endif
}
-void dpm_sms_policy_changed_callback(const char* name, const char* object, void *user_data)
+void msg_set_dpm_policy(int type, int state)
{
- MSG_INFO("dpm_sms_policy_changed_callback called. name [%s] object [%s]", name, object);
-
- int ret = 0;
-
- ret = dpm_restriction_get_messaging_state(dpm_handle, &dpm_policy_enable[MSG_SMS_TYPE - 1]);
- if (ret != DPM_ERROR_NONE) {
- MSG_ERR("dpm_restriction_get_messaging_state failed [%d]", ret);
- return;
- }
+ dpm_policy_enable[type] = state;
}
-void dpm_mms_policy_changed_callback(const char* name, const char* object, void *user_data)
-{
- MSG_INFO("dpm_mms_policy_changed_callback called. name [%s] object [%s]", name, object);
-
- int ret = 0;
-
- ret = dpm_restriction_get_messaging_state(dpm_handle, &dpm_policy_enable[MSG_MMS_TYPE - 1]);
- if (ret != DPM_ERROR_NONE) {
- MSG_ERR("dpm_restriction_get_messaging_state failed [%d]", ret);
- return;
- }
-}
-
-
-static bool __get_dpm_policy()
-{
- int ret = 0;
-
- ret = dpm_restriction_get_messaging_state(dpm_handle, &dpm_policy_enable[MSG_SMS_TYPE]);
- if (ret != DPM_ERROR_NONE) {
- MSG_ERR("dpm_restriction_get_messaging_state failed [%d]", ret);
- return false;
- }
-
- MSG_DEBUG("sms policy [%d]", dpm_policy_enable[MSG_SMS_TYPE]);
- MSG_DEBUG("mms policy [%d]", dpm_policy_enable[MSG_MMS_TYPE]);
-
- ret = dpm_add_policy_changed_cb(dpm_handle, "messaging", dpm_sms_policy_changed_callback, NULL, &dpm_sms_callback_id);
- if (ret != DPM_ERROR_NONE) {
- MSG_ERR("dpm_add_policy_changed_cb failed [%d]", ret);
- return false;
- }
-
- return true;
-}
-
-void msg_init_dpm_policy()
-{
- MSG_BEGIN();
-
- dpm_handle = dpm_manager_create();
- if (dpm_handle == NULL) {
- MSG_ERR("dpm_manager_create() failed");
- return;
- }
-
- is_dpm_init = __get_dpm_policy();
-
- MSG_END();
-}
-
-
-void msg_deinit_dpm_policy()
-{
- if (dpm_handle)
- dpm_manager_destroy(dpm_handle);
-
- if (dpm_sms_callback_id)
- dpm_remove_policy_changed_cb(dpm_handle, dpm_sms_callback_id);
-
- if (dpm_mms_callback_id)
- dpm_remove_policy_changed_cb(dpm_handle, dpm_mms_callback_id);
-
- is_dpm_init = false;
-}
-
bool msg_check_dpm_policy(int type)
{
- if (is_dpm_init == false)
- msg_init_dpm_policy();
-
return dpm_policy_enable[MSG_SMS_TYPE];
// return dpm_policy_enable[type];
}