From: Kyeonghun Lee Date: Wed, 6 Apr 2016 02:59:05 +0000 (+0900) Subject: remove unnecessary dependancy to reduce memory use X-Git-Tag: submit/tizen/20160406.043211^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a30b939bc03bb25f26b3ffc0fb65c6adcadde222;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git remove unnecessary dependancy to reduce memory use Change-Id: If7d377571e9386ef9d1c6bd3b752c5855dd44b70 Signed-off-by: Kyeonghun Lee --- diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index 2e639c3..1fc04c9 100755 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -70,7 +70,7 @@ INCLUDE_DIRECTORIES( ) INCLUDE(FindPkgConfig) -pkg_check_modules(fw_handler_pkgs REQUIRED glib-2.0 gio-2.0 dlog vconf capi-appfw-application) +pkg_check_modules(fw_handler_pkgs REQUIRED glib-2.0 gio-2.0 dlog vconf) FOREACH(flag ${fw_handler_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -std=c++0x") diff --git a/framework/deliver-handler/MsgDeliverHandler.cpp b/framework/deliver-handler/MsgDeliverHandler.cpp index 3d04847..b57b995 100755 --- a/framework/deliver-handler/MsgDeliverHandler.cpp +++ b/framework/deliver-handler/MsgDeliverHandler.cpp @@ -14,9 +14,6 @@ * limitations under the License. */ -#ifndef MSG_WEARABLE_PROFILE -#include -#endif // MSG_WEARABLE_PROFILE #include #include @@ -45,28 +42,20 @@ void MsgLaunchClass0(msg_message_id_t msgId) { MSG_BEGIN(); #ifndef MSG_WEARABLE_PROFILE - app_control_h svc_h; - - int ret = APP_CONTROL_ERROR_NONE; - - ret = app_control_create(&svc_h); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_create() is failed : %d", ret); - app_control_destroy(svc_h); - return; - } + int ret = 0; + msg_error_t err = MSG_SUCCESS; + bundle *b = NULL; - ret = app_control_set_app_id(svc_h, "org.tizen.msg-ui-class0"); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_set_app_id() is failed : %d", ret); - app_control_destroy(svc_h); + b = bundle_create(); + if (b == NULL) { + MSG_DEBUG("bundle_create() is failed"); return; } - ret = app_control_add_extra_data(svc_h, "type", "msg_id"); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); - app_control_destroy(svc_h); + ret = bundle_add_str(b, "type", "msg_id"); + if (ret != 0) { + MSG_DEBUG("bundle_add_str() is failed : %d", ret); + bundle_free(b); return; } @@ -74,21 +63,19 @@ void MsgLaunchClass0(msg_message_id_t msgId) memset(&tmpStrMsgId, 0x00, sizeof(tmpStrMsgId)); snprintf(tmpStrMsgId, sizeof(tmpStrMsgId), "%d", msgId); MSG_DEBUG("tmpStrMsgId [%s]", tmpStrMsgId); - ret = app_control_add_extra_data(svc_h, "msgId", tmpStrMsgId); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); - app_control_destroy(svc_h); + ret = bundle_add_str(b, "msgId", tmpStrMsgId); + if (ret != 0) { + MSG_DEBUG("bundle_add_str() is failed : %d", ret); + bundle_free(b); return; } - ret = app_control_send_launch_request(svc_h, NULL, NULL); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_send_launch_request() is failed : %d", ret); - app_control_destroy(svc_h); - return; + err = msg_launch_app("org.tizen.msg-ui-class0", b); + if (err != MSG_SUCCESS) { + MSG_DEBUG("msg_launch_app() is failed : %d", err); } - app_control_destroy(svc_h); + bundle_free(b); #endif // MSG_WEARABLE_PROFILE MSG_END(); } @@ -411,91 +398,76 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO MSG_INFO("MsgSettingGetInt() is failed"); } MSG_PUSH_SERVICE_TYPE_T serviceType = (MSG_PUSH_SERVICE_TYPE_T)tmpVal; - app_control_h svc_handle = NULL; - switch (pMsgInfo->msgType.subType) { case MSG_WAP_SL_SMS: { *pSendNoti = true; if (serviceType == MSG_PUSH_SERVICE_ALWAYS) { - if (app_control_create(&svc_handle) < 0) { - MSG_DEBUG("Fail to create service handle"); - break; - } - if (!svc_handle) { - MSG_DEBUG("Service handle is NULL"); + bundle *b = NULL; + b = bundle_create(); + if (b == NULL) { + MSG_DEBUG("bundle_create() is failed"); break; } - if (app_control_set_operation(svc_handle, APP_CONTROL_OPERATION_VIEW) < 0) { - MSG_DEBUG("Fail to create service handle"); - app_control_destroy(svc_handle); - break; - } - if (app_control_set_uri(svc_handle, pMsgInfo->msgText) < 0) { - MSG_DEBUG("Fail to set uri"); - app_control_destroy(svc_handle); - break; - } - if (app_control_set_app_id(svc_handle, MSG_SVC_PKG_NAME_BROWSER) < 0) { - MSG_DEBUG("Fail to set package"); - app_control_destroy(svc_handle); + + err = msg_aul_svc_set_operation(b, "http://tizen.org/appcontrol/operation/view"); + if (err != MSG_SUCCESS) { + MSG_DEBUG("msg_aul_svc_set_operation() is failed : %d", err); + bundle_free(b); break; } - if (app_control_send_launch_request(svc_handle, NULL, NULL) < 0) { - MSG_DEBUG("Fail to launch browser"); - app_control_destroy(svc_handle); + + err = msg_aul_svc_set_uri(b, pMsgInfo->msgText); + if (err != MSG_SUCCESS) { + MSG_DEBUG("msg_aul_svc_set_uri() is failed : %d", err); + bundle_free(b); break; } - app_control_destroy(svc_handle); + err = msg_launch_app(MSG_SVC_PKG_NAME_BROWSER, b); + if (err != MSG_SUCCESS) { + MSG_DEBUG("msg_launch_app() is failed : %d", err); + } + bundle_free(b); } else if (serviceType == MSG_PUSH_SERVICE_PROMPT) { MSG_DEBUG("WAP Message SL(Always Ask) start."); - app_control_h svc_h; - int ret = APP_CONTROL_ERROR_NONE; - - ret = app_control_create(&svc_h); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_create() is failed : %d", ret); - break; - } - - ret = app_control_set_app_id(svc_h, "org.tizen.message-dialog"); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_set_app_id() is failed : %d", ret); - app_control_destroy(svc_h); + int ret = 0; + bundle *b = NULL; + b = bundle_create(); + if (b == NULL) { + MSG_DEBUG("bundle_create() is failed"); break; } - ret = app_control_add_extra_data(svc_h, "mode", "WAP_PUSH_SL"); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); - app_control_destroy(svc_h); + ret = bundle_add_str(b, "mode", "WAP_PUSH_SL"); + if (ret != 0) { + MSG_DEBUG("bundle_add_str() is failed : %d", ret); + bundle_free(b); break; } - ret = app_control_add_extra_data(svc_h, "url", pMsgInfo->msgText); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); - app_control_destroy(svc_h); + ret = bundle_add_str(b, "url", pMsgInfo->msgText); + if (ret != 0) { + MSG_DEBUG("bundle_add_str() is failed : %d", ret); + bundle_free(b); break; } - ret = app_control_add_extra_data(svc_h, "address", pMsgInfo->addressList[0].addressVal); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_add_extra_data() is failed : %d", ret); - app_control_destroy(svc_h); + ret = bundle_add_str(b, "address", pMsgInfo->addressList[0].addressVal); + if (ret != 0) { + MSG_DEBUG("bundle_add_str() is failed : %d", ret); + bundle_free(b); break; } - ret = app_control_send_launch_request(svc_h, NULL, NULL); - if (ret != APP_CONTROL_ERROR_NONE) { - MSG_DEBUG("app_control_send_launch_request() is failed : %d", ret); + err = msg_launch_app("org.tizen.message-dialog", b); + if (err != MSG_SUCCESS) { + MSG_DEBUG("msg_launch_app() is failed : %d", err); } - app_control_destroy(svc_h); - MSG_DEBUG("app_control_destroy() returns : %d", ret); + bundle_free(b); } } break; diff --git a/include/utils/MsgUtilFile.h b/include/utils/MsgUtilFile.h index 88596c5..0407143 100755 --- a/include/utils/MsgUtilFile.h +++ b/include/utils/MsgUtilFile.h @@ -63,7 +63,6 @@ char *MsgGetDirName(char *file_path); char *MsgGetFileName(char *file_path); int MsgCheckFilepathSmack(const char *app_smack_label, char *file_path); -bool MsgScanFile(char *filePath); void MsgGetMimeType(char *filePath, char *mimeType, int size); int MsgTcsScanFile(const char *filepath, int *bLevel); bool MsgAclInit(); diff --git a/include/utils/MsgUtilFunction.h b/include/utils/MsgUtilFunction.h index 8472c2a..1442320 100755 --- a/include/utils/MsgUtilFunction.h +++ b/include/utils/MsgUtilFunction.h @@ -158,6 +158,10 @@ uid_t msg_get_login_user(); msg_error_t msg_launch_app(const char *app_id, bundle *bundle_data); +msg_error_t msg_aul_svc_set_operation(bundle *bundle_data, const char *operation); + +msg_error_t msg_aul_svc_set_uri(bundle *bundle_data, char *uri); + /* Dbus function */ void MsgDbusInit(); void MsgDbusDeinit(); diff --git a/packaging/msg-service.spec b/packaging/msg-service.spec index 63bf915..e59e437 100755 --- a/packaging/msg-service.spec +++ b/packaging/msg-service.spec @@ -26,7 +26,6 @@ BuildRequires: pkgconfig(badge) BuildRequires: pkgconfig(bundle) BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-appfw-package-manager) -BuildRequires: pkgconfig(capi-content-media-content) BuildRequires: pkgconfig(capi-media-image-util) BuildRequires: pkgconfig(capi-media-metadata-extractor) BuildRequires: pkgconfig(capi-media-player) @@ -35,7 +34,6 @@ BuildRequires: pkgconfig(capi-media-thumbnail-util) BuildRequires: pkgconfig(capi-network-connection) BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(capi-system-info) -BuildRequires: pkgconfig(capi-system-system-settings) BuildRequires: pkgconfig(capi-telephony) BuildRequires: pkgconfig(csr-framework) BuildRequires: pkgconfig(cynara-client) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 8af74a5..6379beb 100755 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -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 capi-content-media-content aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login csr-framework) +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) pkg_check_modules(utils_pkgs REQUIRED ${PKG_MODULES}) FOREACH(flag ${utils_pkgs_CFLAGS}) diff --git a/utils/MsgUtilFile.cpp b/utils/MsgUtilFile.cpp index 36894a7..71fc128 100755 --- a/utils/MsgUtilFile.cpp +++ b/utils/MsgUtilFile.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -1228,37 +1227,6 @@ __RETURN: } -bool MsgScanFile(char *filePath) -{ - if (filePath == NULL) { - MSG_DEBUG("Invalid Parameter src = %p", filePath); - return false; - } - - msg_error_t ret = media_content_connect(); - - if (ret == MEDIA_CONTENT_ERROR_NONE) { - if (media_content_scan_file(filePath) != MEDIA_CONTENT_ERROR_NONE) { - MSG_ERR("media_content_scan_file() is failed , %d", ret); - media_content_disconnect(); - return false; - } - - ret = media_content_disconnect(); - - if (ret != MEDIA_CONTENT_ERROR_NONE) { - MSG_ERR("media_content_disconnect is failed , %d", ret); - return false; - } - } else { - MSG_ERR("media_content_connect is failed , %d", ret); - return false; - } - - return true; -} - - void MsgGetMimeType(char *filePath, char *mimeType, int size) { aul_get_mime_from_file(filePath, mimeType, size); diff --git a/utils/MsgUtilFunction.cpp b/utils/MsgUtilFunction.cpp index 050c4a2..a2946b5 100755 --- a/utils/MsgUtilFunction.cpp +++ b/utils/MsgUtilFunction.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #define DEFAULT_MIN_MATCH_DIGIT 8 @@ -1250,6 +1251,30 @@ msg_error_t msg_launch_app(const char *app_id, bundle *bundle_data) } +msg_error_t msg_aul_svc_set_operation(bundle *bundle_data, const char *operation) +{ + int ret = aul_svc_set_operation(bundle_data, operation); + if (ret < 0) { + MSG_DEBUG("aul_svc_set_operation() is failed : %d", ret); + return MSG_ERR_UNKNOWN; + } + + return MSG_SUCCESS; +} + + +msg_error_t msg_aul_svc_set_uri(bundle *bundle_data, char *uri) +{ + int ret = aul_svc_set_uri(bundle_data, uri); + if (ret < 0) { + MSG_DEBUG("aul_svc_set_uri() is failed : %d", ret); + return MSG_ERR_UNKNOWN; + } + + return MSG_SUCCESS; +} + + void MsgDbusInit() { MSG_DEBUG();