From: jk.pu Date: Wed, 21 Oct 2015 02:07:57 +0000 (+0900) Subject: Merge branch 'tizen_2.4' into tizen_3.0 X-Git-Tag: submit/tizen/20151026.073646^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0999929129e61f8bc868e0991f29a8cd253f922;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git Merge branch 'tizen_2.4' into tizen_3.0 below modificaiton at 2.4 is not included this merge. binary exchange and file batch is not supported tizen 3.0. CurrentBrightness, CustomBrightness is not declare at org.tizen.system.deviced.display. http://165.213.149.170/gerrit/#/c/69501/ Binary Exchanging Support http://165.213.149.170/gerrit/#/c/73673/ Filesystem API implementation using binary interface http://165.213.149.170/gerrit/#/c/79143/ [Filesystem] Fixed readBytes() http://165.213.149.170/gerrit/#/c/79379/ [Filesystem] Fix for memory leak. http://165.213.149.170/gerrit/#/c/79398/ [Filesystem] Fix for FileWriteSync() http://165.213.149.170/gerrit/#/c/90736/ [Filesystem] Fixed behaviour of Filestream http://165.213.149.170/gerrit/#/c/70340/ [Power] - Changing method of getting the custom status Signed-off-by: jk.pu Change-Id: I1dee525806c7e5fd09d246ee81ab81be63a7f789 --- c0999929129e61f8bc868e0991f29a8cd253f922 diff --cc packaging/webapi-plugins.spec index 839c81f7,e98fb0e0..bb005f52 mode 100755,100755..100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@@ -7,10 -3,8 +7,10 @@@ %define crosswalk_extensions tizen-extensions-crosswalk +%define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} + Name: webapi-plugins - Version: 0.24 -Version: 0.62 ++Version: 0.25 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries @@@ -291,19 -319,9 +291,19 @@@ BuildRequires: pkgconfig(capi-appfw-app BuildRequires: pkgconfig(capi-appfw-package-manager) BuildRequires: pkgconfig(capi-content-media-content) BuildRequires: pkgconfig(capi-media-metadata-extractor) +BuildRequires: pkgconfig(libtzplatform-config) + +%if %{with wayland} +%define display_type wayland +BuildRequires: pkgconfig(wayland-client) +%else +%define display_type x11 +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(xrandr) +%endif %if "%{?tizen_privilege_engine}" == "ACE" - BuildRequires: pkgconfig(capi-security-privilege-manager) + BuildRequires: pkgconfig(security-privilege-checker) %endif %if "%{?tizen_privilege_engine}" == "CYNARA" diff --cc src/account/account_instance.cc index 0c0f87b0,8e27e784..8e27e784 mode 100755,100755..100644 --- a/src/account/account_instance.cc +++ b/src/account/account_instance.cc diff --cc src/account/account_manager.cc index 7348b840,409ac752..409ac752 mode 100755,100755..100644 --- a/src/account/account_manager.cc +++ b/src/account/account_manager.cc diff --cc src/application/application_manager.cc index 451725b9,d505eea5..1bd507cc --- a/src/application/application_manager.cc +++ b/src/application/application_manager.cc @@@ -23,12 -23,11 +23,12 @@@ #include #include #include +#include #include #include + #include + #include - #include "application/application_instance.h" - #include "application/application_utils.h" #include "common/current_application.h" #include "common/logger.h" #include "common/platform_result.h" @@@ -46,15 -49,14 +50,16 @@@ const std::string kTizenApisFileScheme const std::string kTizenApisAppSlash = "/"; const std::string kTizenApisAppShared = "shared"; -const char* kStartKey = "start"; -const char* kEndKey = "end"; +const char* kStartKey = PKGMGR_INSTALLER_START_KEY_STR; +const char* kEndKey = PKGMGR_INSTALLER_END_KEY_STR; +const char* kOkValue = PKGMGR_INSTALLER_OK_EVENT_STR; +const char* kInstallEvent = PKGMGR_INSTALLER_INSTALL_EVENT_STR; +const char* kUpdateEvent = PKGMGR_INSTALLER_UPGRADE_EVENT_STR; +const char* kUninstallEvent = PKGMGR_INSTALLER_UNINSTALL_EVENT_STR; + const char* kAppidKey = "appid"; -const char* kOkValue = "ok"; -const char* kInstallEvent = "install"; -const char* kUpdateEvent = "update"; -const char* kUninstallEvent = "uninstall"; + + const std::string kAction = "action"; const std::string kCallbackId = "callbackId"; const std::string kOnInstalled = "oninstalled"; @@@ -81,9 -108,9 +111,9 @@@ void ApplicationManager::GetCurrentAppl // obtain handle to application info pkgmgrinfo_appinfo_h handle; - int ret = pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle); + int ret = pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle); if (PMINFO_R_OK != ret) { - LoggerE("Failed to get app info."); + LoggerE("Failed to get app info: %d (%s)", ret, get_error_message(ret)); ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get app info."), out); return; } @@@ -663,9 -698,9 +701,9 @@@ void ApplicationManager::FindAppControl } pkgmgrinfo_appinfo_h handle; - int ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle); + int ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &handle); if (PMINFO_R_OK != ret) { - LoggerE("Failed to get appInfo"); + LoggerE("Failed to get appInfo: %d (%s)", ret, get_error_message(ret)); } else { picojson::array* array = static_cast(user_data); array->push_back(picojson::value(picojson::object())); diff --cc src/application/application_utils.cc index b47f203e,c6a871e3..7f33749d mode 100755,100755..100644 --- a/src/application/application_utils.cc +++ b/src/application/application_utils.cc @@@ -102,9 -102,9 +102,9 @@@ void ApplicationUtils::CreateApplicatio } pkgmgrinfo_pkginfo_h pkginfo; - ret = pkgmgrinfo_pkginfo_get_pkginfo(tmp_str, &pkginfo); + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(tmp_str, getuid(), &pkginfo); if (PMINFO_R_OK != ret) { - LoggerE("Failed to get package info"); + LoggerE("Failed to get package info: %d (%s)", ret, get_error_message(ret)); } else { // version tmp_str = nullptr; diff --cc src/archive/archive_callback_data.h index 238838fe,4815e9ea..4815e9ea mode 100755,100755..100644 --- a/src/archive/archive_callback_data.h +++ b/src/archive/archive_callback_data.h diff --cc src/archive/archive_file.h index 507db585,c81b86d7..c81b86d7 mode 100755,100755..100644 --- a/src/archive/archive_file.h +++ b/src/archive/archive_file.h diff --cc src/archive/archive_file_entry.h index ba88c786,bbd72f84..bbd72f84 mode 100755,100755..100644 --- a/src/archive/archive_file_entry.h +++ b/src/archive/archive_file_entry.h diff --cc src/archive/archive_manager.h index 4f93f9aa,fb9f19aa..fb9f19aa mode 100755,100755..100644 --- a/src/archive/archive_manager.h +++ b/src/archive/archive_manager.h diff --cc src/archive/filesystem_file.cc index cbd8de7e,d5e9df51..d5e9df51 mode 100644,100755..100644 --- a/src/archive/filesystem_file.cc +++ b/src/archive/filesystem_file.cc diff --cc src/archive/filesystem_file.h index 9879567a,b764bbdd..b764bbdd mode 100644,100755..100644 --- a/src/archive/filesystem_file.h +++ b/src/archive/filesystem_file.h diff --cc src/archive/filesystem_node.cc index 4e2744b5,918b0c17..918b0c17 mode 100644,100755..100644 --- a/src/archive/filesystem_node.cc +++ b/src/archive/filesystem_node.cc diff --cc src/archive/filesystem_node.h index 322f4b0d,a8b52995..a8b52995 mode 100755,100755..100644 --- a/src/archive/filesystem_node.h +++ b/src/archive/filesystem_node.h diff --cc src/archive/filesystem_path.h index 8809d13f,c06b9cb0..c06b9cb0 mode 100755,100755..100644 --- a/src/archive/filesystem_path.h +++ b/src/archive/filesystem_path.h diff --cc src/archive/un_zip.cc index 8b8b2ce6,579958ed..579958ed mode 100644,100755..100644 --- a/src/archive/un_zip.cc +++ b/src/archive/un_zip.cc diff --cc src/archive/un_zip.h index 187d9c5b,68a30272..68a30272 mode 100644,100755..100644 --- a/src/archive/un_zip.h +++ b/src/archive/un_zip.h diff --cc src/archive/un_zip_extract_request.cc index 6aef5208,197d6b5d..197d6b5d mode 100644,100755..100644 --- a/src/archive/un_zip_extract_request.cc +++ b/src/archive/un_zip_extract_request.cc diff --cc src/bluetooth/bluetooth_util.h index 2a48add8,2673711f..2673711f mode 100755,100755..100644 --- a/src/bluetooth/bluetooth_util.h +++ b/src/bluetooth/bluetooth_util.h diff --cc src/calendar/calendar.h index a29e4f5c,2d5db2e1..2d5db2e1 mode 100755,100755..100644 --- a/src/calendar/calendar.h +++ b/src/calendar/calendar.h diff --cc src/calendar/calendar_item.h index f0171e7d,9666c110..9666c110 mode 100755,100755..100644 --- a/src/calendar/calendar_item.h +++ b/src/calendar/calendar_item.h diff --cc src/calendar/calendar_manager.h index 29d0df9b,5e8e2507..5e8e2507 mode 100755,100755..100644 --- a/src/calendar/calendar_manager.h +++ b/src/calendar/calendar_manager.h diff --cc src/calendar/calendar_record.h index 09f2d2b3,8228b674..8228b674 mode 100755,100755..100644 --- a/src/calendar/calendar_record.h +++ b/src/calendar/calendar_record.h diff --cc src/calendar/js/calendar_item.js index c4d54029,35717e29..35717e29 mode 100755,100755..100644 --- a/src/calendar/js/calendar_item.js +++ b/src/calendar/js/calendar_item.js diff --cc src/common/converter.h index 35bd577c,1b9a30d5..1b9a30d5 mode 100755,100755..100644 --- a/src/common/converter.h +++ b/src/common/converter.h diff --cc src/common/extension.cc index 193ede02,042f0ada..1f03f025 mode 100755,100755..100644 --- a/src/common/extension.cc +++ b/src/common/extension.cc @@@ -80,10 -80,17 +79,10 @@@ bool InitializeInterfaces(XW_GetInterfa g_permission = reinterpret_cast( get_interface(XW_INTERNAL_PERMISSIONS_INTERFACE)); if (!g_permission) { - std::cerr << "NOTE: permission interface not available in this version " - << "of Crosswalk, ignoring permission for extensions.\n"; + LoggerE("NOTE: permission interface not available in this version " + "of runtime, ignoring permission for extensions."); } - g_data = reinterpret_cast( - get_interface(XW_INTERNAL_DATA_INTERFACE)); - if (!g_data) { - LoggerE("NOTE: data interface not available in this version of " - "runtime, ignoring data for extensions."); - } - initialized = true; } diff --cc src/common/extension.h index adae62d8,4abf525f..27906a94 mode 100755,100755..100644 --- a/src/common/extension.h +++ b/src/common/extension.h @@@ -110,8 -114,13 +106,8 @@@ class Instance XW_Instance xw_instance() const { return xw_instance_; } private: - void PostMessage(const char* msg); - friend class Extension; - static std::mutex instance_mutex_; + static std::unordered_set all_instances_; XW_Instance xw_instance_; diff --cc src/common/tools.cc index 309c5818,252bcd56..a02b6a7a --- a/src/common/tools.cc +++ b/src/common/tools.cc @@@ -144,17 -144,14 +144,8 @@@ class AccessControlImpl bool CheckAccess(const std::vector& privileges) { LoggerD("Enter"); - int ret = 0; - //privilege checker is removed tizen 3.0. - /* for (size_t i = 0; i < privileges.size(); ++i) { - ret = privilege_checker_check_privilege(privileges[i].c_str()); - for (size_t i = 0; i < privileges.size(); ++i) { - int ret = privilege_checker_check_privilege(privileges[i].c_str()); -- if (PRIVILEGE_CHECKER_ERR_NONE != ret) { -- return false; -- } -- } - return true; - } */ ++ return true; - } }; #elif PRIVILEGE_USE_CYNARA diff --cc src/contact/addressbook.h index ca8061cc,96bc52e1..96bc52e1 mode 100755,100755..100644 --- a/src/contact/addressbook.h +++ b/src/contact/addressbook.h diff --cc src/contact/contact_util.h index fdcb3a85,ed806575..ed806575 mode 100755,100755..100644 --- a/src/contact/contact_util.h +++ b/src/contact/contact_util.h diff --cc src/contact/person.h index 8a0c5999,d71b2edb..d71b2edb mode 100755,100755..100644 --- a/src/contact/person.h +++ b/src/contact/person.h diff --cc src/content/content_filter.h index 0109726b,27ea7d3c..27ea7d3c mode 100755,100755..100644 --- a/src/content/content_filter.h +++ b/src/content/content_filter.h diff --cc src/content/content_manager.cc index 7856a3e6,cf0c4680..cf0c4680 mode 100755,100755..100644 --- a/src/content/content_manager.cc +++ b/src/content/content_manager.cc diff --cc src/content/content_manager.h index 6ebf8b9a,36b52d58..36b52d58 mode 100755,100755..100644 --- a/src/content/content_manager.h +++ b/src/content/content_manager.h diff --cc src/exif/exif_api.js index 40face01,d209d8ac..d209d8ac mode 100755,100755..100644 --- a/src/exif/exif_api.js +++ b/src/exif/exif_api.js diff --cc src/filesystem/filesystem_file.cc index fc3d89c6,069aefca..fc3d89c6 mode 100755,100755..100644 --- a/src/filesystem/filesystem_file.cc +++ b/src/filesystem/filesystem_file.cc diff --cc src/filesystem/filesystem_file.h index 5779eafb,e903e5c6..5779eafb mode 100755,100755..100644 --- a/src/filesystem/filesystem_file.h +++ b/src/filesystem/filesystem_file.h diff --cc src/filesystem/filesystem_instance.cc index 5e4d10b9,b4879472..4065eed5 mode 100755,100755..100644 --- a/src/filesystem/filesystem_instance.cc +++ b/src/filesystem/filesystem_instance.cc diff --cc src/filesystem/filesystem_instance.h index 6c30d3ab,71bf385d..6c30d3ab mode 100755,100755..100644 --- a/src/filesystem/filesystem_instance.h +++ b/src/filesystem/filesystem_instance.h diff --cc src/filesystem/filesystem_manager.cc index 4e6a6e37,c71fb7a7..4e6a6e37 mode 100755,100755..100644 --- a/src/filesystem/filesystem_manager.cc +++ b/src/filesystem/filesystem_manager.cc diff --cc src/filesystem/filesystem_manager.h index 0492d345,44522c28..0492d345 mode 100755,100755..100644 --- a/src/filesystem/filesystem_manager.h +++ b/src/filesystem/filesystem_manager.h diff --cc src/filesystem/filesystem_utils.h index 7c8762e7,3522c59c..3522c59c mode 100755,100755..100644 --- a/src/filesystem/filesystem_utils.h +++ b/src/filesystem/filesystem_utils.h diff --cc src/filesystem/js/common.js index ed45ada6,a0010cb6..1bc8ed30 mode 100755,100755..100644 --- a/src/filesystem/js/common.js +++ b/src/filesystem/js/common.js diff --cc src/filesystem/js/file.js index c7d80b18,7751273b..278fdf60 mode 100755,100755..100644 --- a/src/filesystem/js/file.js +++ b/src/filesystem/js/file.js @@@ -404,8 -394,40 +395,40 @@@ File.prototype.copyTo = function(origin } var _oldNode = native_.getResultObject(resultOldPath); - if (_oldNode.isFile && addFilenameToPath) { - _realDestinationPath = _realDestinationPath + _realOriginalPath.split('/').pop(); + var addFileName = false; + var lastChar = _realDestinationPath.substr(_realDestinationPath.length -1); + + var resultNewPath = native_.callSync('File_statSync', {location: _realDestinationPath}); + if (native_.isSuccess(resultNewPath)) { + var _newNode = native_.getResultObject(resultNewPath); + if (_newNode.isDirectory) { + if (lastChar !== '/') { + _realDestinationPath += '/'; + } + addFileName = true; + } + } else { + var destinationFileName, destinationDirectoryPath; + if (lastChar !== '/') { + destinationFileName = _realDestinationPath.split('/').pop(); + } + destinationDirectoryPath = _realDestinationPath.substr(0, _realDestinationPath.lastIndexOf('/') + 1); + + var resultDestinationDirectory = native_.callSync('File_statSync', {location: destinationDirectoryPath}); + if (native_.isFailure(resultDestinationDirectory)) { + setTimeout(function() { + native_.callIfPossible(args.onerror, native_.getErrorObject(resultDestinationDirectory)); + }, 0); + return; + } + + if (destinationFileName.length == 0) { + addFileName = true; + } + } + + if (_oldNode.isFile && addFileName) { - _realDestinationPath += '/' + _realOriginalPath.split('/').pop(); ++ _realDestinationPath += _realOriginalPath.split('/').pop(); } if (!args.overwrite) { diff --cc src/filesystem/js/file_stream.js index b0ede171,1d9f5a60..b0ede171 mode 100755,100755..100644 --- a/src/filesystem/js/file_stream.js +++ b/src/filesystem/js/file_stream.js diff --cc src/keymanager/keymanager_instance.cc index bd4102a0,1493d405..1493d405 mode 100755,100755..100644 --- a/src/keymanager/keymanager_instance.cc +++ b/src/keymanager/keymanager_instance.cc diff --cc src/mediacontroller/mediacontroller_types.cc index 3f40b31b,a6e941eb..a6e941eb mode 100644,100755..100644 --- a/src/mediacontroller/mediacontroller_types.cc +++ b/src/mediacontroller/mediacontroller_types.cc diff --cc src/messaging/MsgCommon/AbstractFilter.h index 8fad98ed,0ac41e4d..0ac41e4d mode 100755,100755..100644 --- a/src/messaging/MsgCommon/AbstractFilter.h +++ b/src/messaging/MsgCommon/AbstractFilter.h diff --cc src/messaging/MsgCommon/Any.h index dd7e1a5c,009ae783..009ae783 mode 100755,100755..100644 --- a/src/messaging/MsgCommon/Any.h +++ b/src/messaging/MsgCommon/Any.h diff --cc src/messaging/MsgCommon/AttributeFilter.h index 71d0b6cc,b14ccbe4..b14ccbe4 mode 100755,100755..100644 --- a/src/messaging/MsgCommon/AttributeFilter.h +++ b/src/messaging/MsgCommon/AttributeFilter.h diff --cc src/messaging/MsgCommon/AttributeRangeFilter.h index aaf9e544,4c0d8e1e..4c0d8e1e mode 100755,100755..100644 --- a/src/messaging/MsgCommon/AttributeRangeFilter.h +++ b/src/messaging/MsgCommon/AttributeRangeFilter.h diff --cc src/messaging/MsgCommon/CompositeFilter.h index 4bc06070,e6d2c328..e6d2c328 mode 100755,100755..100644 --- a/src/messaging/MsgCommon/CompositeFilter.h +++ b/src/messaging/MsgCommon/CompositeFilter.h diff --cc src/messaging/MsgCommon/FilterIterator.h index 1ce91198,a3d92d0d..a3d92d0d mode 100755,100755..100644 --- a/src/messaging/MsgCommon/FilterIterator.h +++ b/src/messaging/MsgCommon/FilterIterator.h diff --cc src/messaging/MsgCommon/SortMode.h index f9dc6072,d9491b18..d9491b18 mode 100755,100755..100644 --- a/src/messaging/MsgCommon/SortMode.h +++ b/src/messaging/MsgCommon/SortMode.h diff --cc src/messaging/conversation_callback_data.h index 43cb5631,9d82d82a..9d82d82a mode 100755,100755..100644 --- a/src/messaging/conversation_callback_data.h +++ b/src/messaging/conversation_callback_data.h diff --cc src/messaging/conversations_change_callback.h index 36e0fd11,ca71198e..ca71198e mode 100755,100755..100644 --- a/src/messaging/conversations_change_callback.h +++ b/src/messaging/conversations_change_callback.h diff --cc src/messaging/email_manager.h index cc3a800e,8828d296..8828d296 mode 100755,100755..100644 --- a/src/messaging/email_manager.h +++ b/src/messaging/email_manager.h diff --cc src/messaging/find_msg_callback_user_data.h index a2a0f0bf,d7782282..d7782282 mode 100755,100755..100644 --- a/src/messaging/find_msg_callback_user_data.h +++ b/src/messaging/find_msg_callback_user_data.h diff --cc src/messaging/folders_callback_data.h index 7e8b2223,34a50769..34a50769 mode 100755,100755..100644 --- a/src/messaging/folders_callback_data.h +++ b/src/messaging/folders_callback_data.h diff --cc src/messaging/folders_change_callback.h index 088db8cf,68c4fc1c..68c4fc1c mode 100755,100755..100644 --- a/src/messaging/folders_change_callback.h +++ b/src/messaging/folders_change_callback.h diff --cc src/messaging/message.h index 95025e96,7bccf995..7bccf995 mode 100755,100755..100644 --- a/src/messaging/message.h +++ b/src/messaging/message.h diff --cc src/messaging/message_attachment.h index df914457,77e44b10..77e44b10 mode 100755,100755..100644 --- a/src/messaging/message_attachment.h +++ b/src/messaging/message_attachment.h diff --cc src/messaging/message_body.h index b0c3f9e1,1e8164a5..1e8164a5 mode 100755,100755..100644 --- a/src/messaging/message_body.h +++ b/src/messaging/message_body.h diff --cc src/messaging/message_callback_user_data.h index dde99f91,098c8cd9..098c8cd9 mode 100755,100755..100644 --- a/src/messaging/message_callback_user_data.h +++ b/src/messaging/message_callback_user_data.h diff --cc src/messaging/message_conversation.h index 142b0f1d,5a2dc423..5a2dc423 mode 100755,100755..100644 --- a/src/messaging/message_conversation.h +++ b/src/messaging/message_conversation.h diff --cc src/messaging/message_email.h index 8772d509,092834f6..092834f6 mode 100755,100755..100644 --- a/src/messaging/message_email.h +++ b/src/messaging/message_email.h diff --cc src/messaging/message_mms.h index 2e78bbb0,cb25250d..cb25250d mode 100755,100755..100644 --- a/src/messaging/message_mms.h +++ b/src/messaging/message_mms.h diff --cc src/messaging/message_service.h index 4584e8fa,5aab33ed..5aab33ed mode 100755,100755..100644 --- a/src/messaging/message_service.h +++ b/src/messaging/message_service.h diff --cc src/messaging/message_sms.h index b946440a,5b252ffd..5b252ffd mode 100755,100755..100644 --- a/src/messaging/message_sms.h +++ b/src/messaging/message_sms.h diff --cc src/messaging/message_storage.h index a974ebe9,6db19f1d..6db19f1d mode 100755,100755..100644 --- a/src/messaging/message_storage.h +++ b/src/messaging/message_storage.h diff --cc src/messaging/message_storage_email.h index ea09c071,fe943e75..fe943e75 mode 100755,100755..100644 --- a/src/messaging/message_storage_email.h +++ b/src/messaging/message_storage_email.h diff --cc src/messaging/messaging_database_manager.cc index e4ef4054,9307b1c9..74cdacc3 --- a/src/messaging/messaging_database_manager.cc +++ b/src/messaging/messaging_database_manager.cc @@@ -206,10 -204,9 +205,10 @@@ msg_error_t MessagingDatabaseManager::c char strDBName[64]; memset(strDBName, 0x00, sizeof(strDBName)); - snprintf(strDBName, sizeof(strDBName), "%s", MSG_DB_NAME); + snprintf(strDBName, sizeof(strDBName), "%s/%s", + tzplatform_getenv(TZ_USER_DB), MSG_DB_NAME); - err = db_util_open(strDBName, &sqlHandle, DB_UTIL_REGISTER_HOOK_METHOD); + int err = db_util_open(strDBName, &sqlHandle, DB_UTIL_REGISTER_HOOK_METHOD); if (SQLITE_OK != err) { LoggerE("DB connecting fail [%d]", err); diff --cc src/messaging/messaging_instance.cc index 99f3d03c,f07657be..2d104e33 --- a/src/messaging/messaging_instance.cc +++ b/src/messaging/messaging_instance.cc @@@ -222,21 -225,14 +226,21 @@@ void MessagingInstance::MessageServiceS simIndex = static_cast (MessagingUtil::getValueFromJSONObject(data,SEND_MESSAGE_ARGS_SIMINDEX)); - if (!callback->setSimIndex(simIndex)) { - delete callback; - callback = nullptr; - POST_AND_RETURN(PlatformResult(ErrorCode::UNKNOWN_ERR, "set sim index failed"), - json, obj, JSON_CALLBACK_ERROR) + bool cell_support = false; + system_info_get_platform_bool("http://tizen.org/feature/network.telephony", &cell_support); + if (cell_support) { + LoggerD("cell_support is true"); + if (!callback->setSimIndex(simIndex)) { + delete callback; + callback = nullptr; + POST_AND_RETURN(PlatformResult(ErrorCode::UNKNOWN_ERR, "set sim index failed"), + json, obj, JSON_CALLBACK_ERROR) + } + } else { + LoggerD("cell_support is false"); } - queue_.add(static_cast(callbackId), PostPriority::HIGH); + callback->AddToQueue(); auto service = manager_.getMessageService(serviceId); ret = service->sendMessage(callback); diff --cc src/messaging/messaging_util.h index b7d570b9,cbd8bcd8..cbd8bcd8 mode 100755,100755..100644 --- a/src/messaging/messaging_util.h +++ b/src/messaging/messaging_util.h diff --cc src/package/package_info_provider.cc index 78d3b720,2cb344ef..55f40fa5 mode 100755,100644..100644 --- a/src/package/package_info_provider.cc +++ b/src/package/package_info_provider.cc @@@ -71,9 -72,9 +72,10 @@@ void PackageInfoProvider::GetPackagesIn start_time = clock(); picojson::array array_data; - int ret = pkgmgrinfo_pkginfo_get_list(PackageInfoGetListCb, &array_data); - if (ret != PMINFO_R_OK ) { - LoggerE("Failed to get package information: %d (%s)", ret, get_error_message(ret)); ++ + if ( pkgmgrinfo_pkginfo_get_usr_list(PackageInfoGetListCb, &array_data, getuid()) + != PMINFO_R_OK ) { + LoggerE("Failed to get package information"); REPORT_ERROR(out, UnknownException("Any other platform error occurs")); return; } diff --cc src/power/power_manager.cc index bb935f22,9788d89d..8278982c mode 100755,100755..100644 --- a/src/power/power_manager.cc +++ b/src/power/power_manager.cc @@@ -393,10 -419,17 +419,11 @@@ PlatformResult PowerManager::GetPlatfor int brightness = 0; int is_custom_mode = 0; - auto error_code = PowerPlatformProxy::GetInstance().IsCustomBrightness(&is_custom_mode); - - if (!error_code) { - LoggerE("Failed to check if custom brightness is set."); - return error_code; - } - + vconf_get_int(VCONFKEY_PM_CUSTOM_BRIGHTNESS_STATUS, &is_custom_mode); if ((is_custom_mode && current_brightness_ != -1) || should_be_read_from_cache_) { LoggerD("return custom brightness %d", current_brightness_); - return current_brightness_; + *result = current_brightness_; + return PlatformResult(ErrorCode::NO_ERROR); } int is_auto_brightness = 0; @@@ -409,11 -442,19 +436,19 @@@ } } else { LoggerD("Brightness via DBUS"); - brightness = PowerPlatformProxy::GetInstance().GetBrightness(); - error_code = PowerPlatformProxy::GetInstance().GetBrightness(&brightness); ++ auto error_code = PowerPlatformProxy::GetInstance().GetBrightness(&brightness); + + if (!error_code) { + LoggerE("Failed to obtain brightness via DBUS."); + return error_code; + } } + LoggerD("BRIGHTNESS(%s) %d", is_auto_brightness == 1 ? "auto" : "fix" , brightness); - return brightness; + *result = brightness; + + return PlatformResult(ErrorCode::NO_ERROR); } diff --cc src/power/power_platform_proxy.cc index 6d45f17c,5a9c4703..5ccd90ff mode 100755,100755..100644 --- a/src/power/power_platform_proxy.cc +++ b/src/power/power_platform_proxy.cc @@@ -79,12 -79,17 +79,17 @@@ common::PlatformResult PowerPlatformPro DBusOperationArguments args; args.AddArgumentInt32(val); - return dbus_op_.InvokeSyncGetInt("HoldBrightness", &args); + return dbus_op_.InvokeSyncGetInt("HoldBrightness", &args, result); } - int PowerPlatformProxy::GetBrightness() { + common::PlatformResult PowerPlatformProxy::GetBrightness(int* result) { LoggerD("Entered"); - return dbus_op_.InvokeSyncGetInt("GetBrightness", NULL); - return dbus_op_.InvokeSyncGetInt("CurrentBrightness", nullptr, result); ++ return dbus_op_.InvokeSyncGetInt("GetBrightness", nullptr, result); + } + + common::PlatformResult PowerPlatformProxy::IsCustomBrightness(int* result) { + LoggerD("Entered"); + return dbus_op_.InvokeSyncGetInt("CustomBrightness", nullptr, result); } } // namespace power diff --cc src/systeminfo/systeminfo_properties_manager.cc index a88fb8a2,b9bce2db..8ffa60d5 --- a/src/systeminfo/systeminfo_properties_manager.cc +++ b/src/systeminfo/systeminfo_properties_manager.cc @@@ -1138,7 -1151,7 +1152,8 @@@ PlatformResult SysteminfoPropertiesMana array.push_back(picojson::value(picojson::object())); picojson::object& internal_obj = array.back().get(); - if (statfs(kStorageInternalPath, &fs) < 0) { ++ + if (statfs(kStorageInternalPath.c_str(), &fs) < 0) { LoggerE("There are no storage units detected"); return PlatformResult(ErrorCode::UNKNOWN_ERR, "There are no storage units detected"); } diff --cc src/systemsetting/systemsetting_instance.cc index 05ae6315,3f318d75..3f318d75 mode 100644,100755..100644 --- a/src/systemsetting/systemsetting_instance.cc +++ b/src/systemsetting/systemsetting_instance.cc diff --cc src/time/time_manager.cc index 00000000,898954a5..4bc6adb8 mode 000000,100644..100644 --- a/src/time/time_manager.cc +++ b/src/time/time_manager.cc @@@ -1,0 -1,204 +1,204 @@@ + /* + * 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 "time/time_manager.h" + + #include + #include + #include + + #include "common/logger.h" + #include "time/time_instance.h" + + using common::PlatformResult; + using common::ErrorCode; + using common::Instance; + + namespace extension { + namespace time { + + TimeManager::TimeManager(TimeInstance* instance) + : instance_(instance), + current_timezone_(GetDefaultTimezone()), + is_time_listener_registered_(false), + is_timezone_listener_registered_(false) { + LoggerD("Entered"); + } + + TimeManager::~TimeManager() { + LoggerD("Entered"); + if (is_time_listener_registered_) { + UnregisterVconfCallback(kTimeChange); + } + if (is_timezone_listener_registered_) { + UnregisterVconfCallback(kTimezoneChange); + } + } + + PlatformResult TimeManager::GetTimezoneOffset(const std::string& timezone_id, + const std::string& timestamp_str, + std::string* offset, + std::string* modifier) { + LoggerD("Entered"); + std::unique_ptr unicode_id (new UnicodeString(timezone_id.c_str())); + std::unique_ptr tz (TimeZone::createTimeZone(*unicode_id)); + + if (TimeZone::getUnknown() == *tz) { + return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."); + } + + const int32_t oneHour = 3600000; + UDate date = std::stod(timestamp_str); + int32_t stdOffset = 0; + int32_t dstOffset = 0; + UErrorCode ec = U_ZERO_ERROR; + //offset is get for target LOCAL date timestamp, but it should be UTC timestamp, + //so it has to be checked below against DST edge condition + tz->getOffset(date, false, stdOffset, dstOffset, ec); + LOGD("stdOffset: %d, dstOffset: %d", stdOffset, dstOffset); + + //this section checks if date is not in DST transition point + //check if date shifted to UTC timestamp is still with the same offset + int32_t dstOffsetBefore = 0; + tz->getOffset(date - stdOffset - dstOffset, false, stdOffset, dstOffsetBefore, ec); + LOGD("stdOffset: %d, dstOffsetBefore: %d", stdOffset, dstOffsetBefore); + + //it has to be checked if it is 'missing' hour case + int32_t dstOffsetAfterBefore = 0; + tz->getOffset(date - stdOffset - dstOffset + oneHour, + false, stdOffset, dstOffsetAfterBefore, ec); + LOGD("stdOffset: %d, dstOffsetAfterBefore: %d", stdOffset, dstOffsetAfterBefore); + + //offset would be minimum of local and utc timestamp offsets + //(to work correctly even if DST transtion is 'now') + dstOffset = std::min(dstOffset, dstOffsetBefore); + + *offset = std::to_string(stdOffset + dstOffset); + *modifier = std::to_string(dstOffsetAfterBefore - dstOffsetBefore); + return PlatformResult(ErrorCode::NO_ERROR); + } + + PlatformResult TimeManager::RegisterVconfCallback(ListenerType type) { + LoggerD("Entered"); + if (!is_time_listener_registered_ && !is_timezone_listener_registered_){ + LOGD("registering listener on platform"); + if (0 != vconf_notify_key_changed( + VCONFKEY_SYSTEM_TIME_CHANGED, OnTimeChangedCallback, this)) { + LOGE("Failed to register vconf callback"); + return PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to register vconf callback"); + } + } else { + LOGD("not registering listener on platform - already registered"); + } + switch (type) { + case kTimeChange : + is_time_listener_registered_ = true; + LOGD("time change listener registered"); + break; + case kTimezoneChange : + is_timezone_listener_registered_ = true; + LOGD("time zone change listener registered"); + break; + default : + LOGE("Unknown type of listener"); + return PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown type of listener"); + } + return PlatformResult(ErrorCode::NO_ERROR); + } + + PlatformResult TimeManager::UnregisterVconfCallback(ListenerType type) { + LoggerD("Entered"); + switch (type) { + case kTimeChange : + is_time_listener_registered_ = false; + LOGD("time change listener unregistered"); + break; + case kTimezoneChange : + is_timezone_listener_registered_ = false; + LOGD("time zone change listener unregistered"); + break; + default : + return PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown type of listener"); + } + if (!is_time_listener_registered_ && !is_timezone_listener_registered_) { + LOGD("unregistering listener on platform"); + if (0 != vconf_ignore_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, OnTimeChangedCallback)) { + LOGE("Failed to unregister vconf callback"); + // silent fail + //return PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to unregister vconf callback"); + } + } + return PlatformResult(ErrorCode::NO_ERROR); + } + + void TimeManager::OnTimeChangedCallback(keynode_t* /*node*/, void* event_ptr) { + LoggerD("Entered"); + TimeManager* manager = static_cast(event_ptr); + TimeInstance* instance = manager->GetTimeInstance(); + std::string defaultTimezone = GetDefaultTimezone(); + + if (manager->GetCurrentTimezone() != defaultTimezone) { + manager->SetCurrentTimezone(defaultTimezone); + //call timezone callback + + const std::shared_ptr& response = + std::shared_ptr(new picojson::value(picojson::object())); + response->get()["listenerId"] = picojson::value("TimezoneChangeListener"); + // ReportSuccess(result,response->get()); + Instance::PostMessage(instance, response->serialize().c_str()); + } + //call date time callback + const std::shared_ptr& response = + std::shared_ptr(new picojson::value(picojson::object())); + response->get()["listenerId"] = picojson::value("DateTimeChangeListener"); + // ReportSuccess(result,response->get()); + Instance::PostMessage(instance, response->serialize().c_str()); + } + + std::string TimeManager::GetDefaultTimezone() { + LoggerD("Entered"); + char buf[1024]; + std::string result; - ssize_t len = readlink("/opt/etc/localtime", buf, sizeof(buf)-1); ++ ssize_t len = readlink("/etc/localtime", buf, sizeof(buf)-1); + if (len != -1) { + buf[len] = '\0'; + } else { + /* handle error condition */ + return result; + } + result = std::string(buf+strlen("/usr/share/zoneinfo/")); + + LoggerD("tzpath = %s", result.c_str()); + return result; + } + + std::string TimeManager::GetCurrentTimezone(){ + LoggerD("Entered"); + return current_timezone_; + } + + void TimeManager::SetCurrentTimezone(const std::string& new_timezone){ + LoggerD("Entered"); + current_timezone_ = new_timezone; + } + + TimeInstance* TimeManager::GetTimeInstance() { + LoggerD("Entered"); + return instance_; + } + + } // time + } // extension diff --cc src/tool/desc_gentool.cc index 60d4646a,e0570ef9..3cc9d816 --- a/src/tool/desc_gentool.cc +++ b/src/tool/desc_gentool.cc @@@ -173,12 -169,12 +173,13 @@@ int main(int argc, char* argv[]) !fname.compare(0, prefix_.size(), prefix_) && !fname.compare(fname.size() - postfix_.size(), postfix_.size(), postfix_)) { - std::string so_path = tce_path + "/" + fname; + std::string so_path = tec_path + "/" + fname; + char* error; void *handle = dlopen(so_path.c_str(), RTLD_LAZY); - if ((error = dlerror()) != NULL) { + if (handle == NULL) { std::cerr << "cannot open " << so_path << std::endl; - std::cerr << "Error >>" << error << std::endl; + char* error = dlerror(); + std::cerr << "Error >>" << ((error == NULL) ? "NULL" : error) << std::endl; return -1; } diff --cc src/utils/utils_api.js index 981f2c4a,bc85eb7c..d4941e8f mode 100644,100755..100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js