Merge branch 'tizen_2.4' into tizen_3.0
authorjk.pu <jk.pu@samsung.com>
Wed, 21 Oct 2015 02:07:57 +0000 (11:07 +0900)
committerjk.pu <jk.pu@samsung.com>
Mon, 26 Oct 2015 02:23:59 +0000 (11:23 +0900)
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 <jk.pu@samsung.com>
Change-Id: I1dee525806c7e5fd09d246ee81ab81be63a7f789

85 files changed:
1  2 
packaging/webapi-plugins.spec
src/account/account_instance.cc
src/account/account_manager.cc
src/application/application_manager.cc
src/application/application_utils.cc
src/archive/archive_callback_data.h
src/archive/archive_file.h
src/archive/archive_file_entry.h
src/archive/archive_manager.h
src/archive/filesystem_file.cc
src/archive/filesystem_file.h
src/archive/filesystem_node.cc
src/archive/filesystem_node.h
src/archive/filesystem_path.h
src/archive/un_zip.cc
src/archive/un_zip.h
src/archive/un_zip_extract_request.cc
src/badge/badge_manager.cc
src/bluetooth/bluetooth_util.h
src/calendar/calendar.h
src/calendar/calendar_item.h
src/calendar/calendar_manager.h
src/calendar/calendar_record.h
src/calendar/js/calendar_item.js
src/common/converter.h
src/common/extension.cc
src/common/extension.h
src/common/tools.cc
src/contact/addressbook.h
src/contact/contact_util.h
src/contact/person.h
src/content/content_filter.h
src/content/content_manager.cc
src/content/content_manager.h
src/datacontrol/datacontrol_instance.cc
src/exif/exif_api.js
src/filesystem/filesystem_file.cc
src/filesystem/filesystem_file.h
src/filesystem/filesystem_instance.cc
src/filesystem/filesystem_instance.h
src/filesystem/filesystem_manager.cc
src/filesystem/filesystem_manager.h
src/filesystem/filesystem_utils.h
src/filesystem/js/common.js
src/filesystem/js/file.js
src/filesystem/js/file_stream.js
src/keymanager/keymanager_instance.cc
src/mediacontroller/mediacontroller_types.cc
src/messaging/MsgCommon/AbstractFilter.h
src/messaging/MsgCommon/Any.h
src/messaging/MsgCommon/AttributeFilter.h
src/messaging/MsgCommon/AttributeRangeFilter.h
src/messaging/MsgCommon/CompositeFilter.h
src/messaging/MsgCommon/FilterIterator.h
src/messaging/MsgCommon/SortMode.h
src/messaging/conversation_callback_data.h
src/messaging/conversations_change_callback.h
src/messaging/email_manager.h
src/messaging/find_msg_callback_user_data.h
src/messaging/folders_callback_data.h
src/messaging/folders_change_callback.h
src/messaging/message.h
src/messaging/message_attachment.h
src/messaging/message_body.h
src/messaging/message_callback_user_data.h
src/messaging/message_conversation.h
src/messaging/message_email.h
src/messaging/message_mms.h
src/messaging/message_service.h
src/messaging/message_sms.h
src/messaging/message_storage.h
src/messaging/message_storage_email.h
src/messaging/messaging.gyp
src/messaging/messaging_database_manager.cc
src/messaging/messaging_instance.cc
src/messaging/messaging_util.h
src/package/package_info_provider.cc
src/power/power_manager.cc
src/power/power_platform_proxy.cc
src/systeminfo/systeminfo_properties_manager.cc
src/systemsetting/systemsetting_instance.cc
src/time/time_manager.cc
src/tool/desc_gentool.cc
src/utils/utils_api.js
src/utils/utils_instance.cc

index 839c81f7fccb9ab8d1152e62fbfa2b0f9dfb7045,e98fb0e051a7b792d9b6fa5002fa896f6ccb70dc..bb005f52242ac0111a25e245c0231dba985c00ef
mode 100755,100755..100644
@@@ -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"
index 0c0f87b04340d33ebe8bb7dbb04212c488585c14,8e27e784e2536238b53caa93cf0285113eb86bf5..8e27e784e2536238b53caa93cf0285113eb86bf5
mode 100755,100755..100644
index 7348b840a8c38c6208fa04e26379139a7e6d50e0,409ac752c39082fe13d35d19efdd3411ec790969..409ac752c39082fe13d35d19efdd3411ec790969
mode 100755,100755..100644
index 451725b91391b803c874f13e562fa29dedcbaaf2,d505eea55052a0223e24eecb4ab9891f4a15b651..1bd507ccd9c5baad9555f44288cb0e90804dba4c
  #include <app_manager.h>
  #include <app_manager_extension.h>
  #include <aul.h>
 +#include <pkgmgr_installer.h>
  #include <package_manager.h>
  #include <pkgmgr-info.h>
+ #include <bundle.h>
+ #include <bundle_internal.h>
  
- #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<picojson::array*>(user_data);
          array->push_back(picojson::value(picojson::object()));
index b47f203e13ec1eb6469c108ff80446f0d684f200,c6a871e36aee1dd622e3dbcb86d5901ca0fa7969..7f33749d5dfb12190b7f8333b07c9fe35efd970f
mode 100755,100755..100644
@@@ -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;
index 238838fe97d80c57d2adf03cc30aaba319a2981f,4815e9ea1ae5c255777a919fd103a6882dc53d14..4815e9ea1ae5c255777a919fd103a6882dc53d14
mode 100755,100755..100644
index 507db5851231099b991d3d77358de32ddb6f0301,c81b86d7b14b5ce5ae2c3d973c4ea8b834b3e205..c81b86d7b14b5ce5ae2c3d973c4ea8b834b3e205
mode 100755,100755..100644
index ba88c786d436133e651e19443caeb903da60faf0,bbd72f8422aac7f9aeacc16815c834823f4a3970..bbd72f8422aac7f9aeacc16815c834823f4a3970
mode 100755,100755..100644
index 4f93f9aad51061aaf886c8acd7c953b9cea004a5,fb9f19aaf4eb7e607a5c9a448c497572b6917398..fb9f19aaf4eb7e607a5c9a448c497572b6917398
mode 100755,100755..100644
index cbd8de7e64feebcf9c99878f765c4d45719e9907,d5e9df514bce69175ba8f296c319d166d5732467..d5e9df514bce69175ba8f296c319d166d5732467
mode 100644,100755..100644
index 9879567afa5dc3dd8580fd63505827189f9c8baf,b764bbdd645a273b5b2d04adec611a05b4b38490..b764bbdd645a273b5b2d04adec611a05b4b38490
mode 100644,100755..100644
index 4e2744b50006e73f9217492e01026742637798cf,918b0c1721e5bacae5c789808d46fff3e3f6de41..918b0c1721e5bacae5c789808d46fff3e3f6de41
mode 100644,100755..100644
index 322f4b0d119ed3bb4fb98ac4eb0c05ce117a899b,a8b529952734b83d246d208ab8cf07a929347f1f..a8b529952734b83d246d208ab8cf07a929347f1f
mode 100755,100755..100644
index 8809d13f12fe77f671af73df751303bf4cb05d3d,c06b9cb0ac0ee24a0376a0201907a947fdf3b287..c06b9cb0ac0ee24a0376a0201907a947fdf3b287
mode 100755,100755..100644
index 8b8b2ce6e5936fc58c641b6e56b69f256b94568e,579958ed940858dc94721c7c3bd81562a0d995a2..579958ed940858dc94721c7c3bd81562a0d995a2
mode 100644,100755..100644
index 187d9c5b1c1b1f5ab6b5d0a89091344ba71e7e0e,68a30272bf81f9a8ad6857c1fc038f093dc2743c..68a30272bf81f9a8ad6857c1fc038f093dc2743c
mode 100644,100755..100644
index 6aef5208078cf3b5f9053482c20fe4464809f034,197d6b5d4269bbf40a44e8baddbf53ecd91236c4..197d6b5d4269bbf40a44e8baddbf53ecd91236c4
mode 100644,100755..100644
Simple merge
index 2a48add8c34e3da56fe86a9f836cb344be587fcd,2673711f2a91a46b785f807ac41e5b7cfdcdb80d..2673711f2a91a46b785f807ac41e5b7cfdcdb80d
mode 100755,100755..100644
index a29e4f5c2f1ef0f52efc5b90185e34a67aaa65af,2d5db2e10f17d9c1d6561b314a0c378fcbc96534..2d5db2e10f17d9c1d6561b314a0c378fcbc96534
mode 100755,100755..100644
index f0171e7d4f4496395e6c509802fd0d57e092817c,9666c110f98b5b86a3754670e6682ee27a241c87..9666c110f98b5b86a3754670e6682ee27a241c87
mode 100755,100755..100644
index 29d0df9b58997845b2e85b53480c63466835f6c7,5e8e250704baaecd23f67b1ad83e19a1405ff629..5e8e250704baaecd23f67b1ad83e19a1405ff629
mode 100755,100755..100644
index 09f2d2b31e4a3aba0e0f1b2d6625243b8c23c8c6,8228b674b8f4b9dfc677466114a3e54478c432aa..8228b674b8f4b9dfc677466114a3e54478c432aa
mode 100755,100755..100644
index c4d5402988f343d04ff36f84d82dbf96b5eafa6f,35717e299a1432edf90e2b71802a30e689d7ac42..35717e299a1432edf90e2b71802a30e689d7ac42
mode 100755,100755..100644
index 35bd577cc666884df7131b1e95126c5e744ba7fa,1b9a30d5884ad14b245f0543287d7884a850b284..1b9a30d5884ad14b245f0543287d7884a850b284
mode 100755,100755..100644
index 193ede02d9c59ea1ef68338bda3e2f54a52692ea,042f0ada3a826d9e11fc16736ccffd942b90db9a..1f03f0257b9b4517705b56f8b56e3fe1ef0b49c0
mode 100755,100755..100644
@@@ -80,10 -80,17 +79,10 @@@ bool InitializeInterfaces(XW_GetInterfa
      g_permission = reinterpret_cast<const XW_Internal_PermissionsInterface*>(
          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<const XW_Internal_DataInterface*>(
 -        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;
    }
  
index adae62d89b52bfb20e1fa6ff5af607defc47bbd4,4abf525f26f5ea24635be623a25b89389eac8fdf..27906a941eb2e67557c07dccbd320e68a307986e
mode 100755,100755..100644
@@@ -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<Instance*> all_instances_;
  
    XW_Instance xw_instance_;
index 309c5818b69bec330694b21154a3daefe3ea6b76,252bcd56411294161480bdff81cc59a66e0c8158..a02b6a7ae84e44010c776b35d9acd8e996c26e2b
@@@ -144,17 -144,14 +144,8 @@@ class AccessControlImpl 
  
    bool CheckAccess(const std::vector<std::string>& 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
index ca8061cc586407fca2330899c0b8e952cc917890,96bc52e14fc67d1f1cbe378bce5913c274801abb..96bc52e14fc67d1f1cbe378bce5913c274801abb
mode 100755,100755..100644
index fdcb3a8522970f765c7577ec2d4d3834f92bfd2f,ed806575f719c57851cebd8e60b7e1113663e0fb..ed806575f719c57851cebd8e60b7e1113663e0fb
mode 100755,100755..100644
index 8a0c5999737294a2bf31324a98d329497fa46867,d71b2edb96d6d243dfdcbe07b5854936e1b1470a..d71b2edb96d6d243dfdcbe07b5854936e1b1470a
mode 100755,100755..100644
index 0109726bf6930c4940b9aef33128d077b5084e33,27ea7d3ccfa9e5504ff2f0d9327c114c10a99431..27ea7d3ccfa9e5504ff2f0d9327c114c10a99431
mode 100755,100755..100644
index 7856a3e6ed32055859468c517045a1816beca5ac,cf0c4680e53bd48ddb3ed3943508d5b5da3b4058..cf0c4680e53bd48ddb3ed3943508d5b5da3b4058
mode 100755,100755..100644
index 6ebf8b9a105c0027b8299c10361ca5c775ce1aff,36b52d58730aa4cd97b396818443af0af2c25973..36b52d58730aa4cd97b396818443af0af2c25973
mode 100755,100755..100644
index 40face01d85f57a9cfe842920f277d4cc9e0d340,d209d8acc63bcb39acb6853bd9a1691d1c408ff0..d209d8acc63bcb39acb6853bd9a1691d1c408ff0
mode 100755,100755..100644
index fc3d89c6800bcec6a8b9c27174b74dbac79df1ed,069aefca427863864ccb4bebbc43504bb05db95c..fc3d89c6800bcec6a8b9c27174b74dbac79df1ed
mode 100755,100755..100644
index 5779eafbf0fd8ac0d1c5fdef3d658e1241b64baf,e903e5c68fac645c8769a6c153b826965b897250..5779eafbf0fd8ac0d1c5fdef3d658e1241b64baf
mode 100755,100755..100644
index 5e4d10b9b3ea414f7e8f2963db195a806187c358,b487947258083beb213f7d908a87e25ddeeb2300..4065eed53f3a838d3489f2a2c30a7b9d541cafa9
mode 100755,100755..100644
index 6c30d3ab2e216778e6ca259dfde9cdb8d0b1a11f,71bf385dae970758e2046ad92a79cacb3fed605e..6c30d3ab2e216778e6ca259dfde9cdb8d0b1a11f
mode 100755,100755..100644
index 4e6a6e370e9095c53f5bfba44ebaf6a9eb28ccf0,c71fb7a7567cea4aa8e255b932ed6e9ea0700b12..4e6a6e370e9095c53f5bfba44ebaf6a9eb28ccf0
mode 100755,100755..100644
index 0492d345f864dacd8b01bac7a853f5efb15c024e,44522c28ad77bcc5fcc7e9876646906fd7de3784..0492d345f864dacd8b01bac7a853f5efb15c024e
mode 100755,100755..100644
index 7c8762e73bd94ed1f112fadd667ea1fa12b0ab86,3522c59ccf93803ed3db03126698b80c591ccba9..3522c59ccf93803ed3db03126698b80c591ccba9
mode 100755,100755..100644
index ed45ada63c0ce502f71ac65dcdbd04daaa6562b4,a0010cb6afee9c2c6477ce776c15114f862a13a5..1bc8ed305d4181c0906e5b850dbfcb77f4605c31
mode 100755,100755..100644
index c7d80b18cc2baaaa4b5933d7dd3502142c5b6726,7751273bdb60879695666b32db91eb814e1e3da3..278fdf60587d94399f2f71e4f85d18c792b657cf
mode 100755,100755..100644
@@@ -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) {
index b0ede171052ee218f806907bf9d9126e1dcf298d,1d9f5a60c844668f1cb432eaeab4060732db3a5f..b0ede171052ee218f806907bf9d9126e1dcf298d
mode 100755,100755..100644
index bd4102a03e554c14d797006df46e991eaa330f3a,1493d405ce352ad94d111a3f3da82ed36a02bb06..1493d405ce352ad94d111a3f3da82ed36a02bb06
mode 100755,100755..100644
index 3f40b31b70db78d651de6bb3014e2c8c2b255e55,a6e941ebbc7a9adb221b860425a4b25c03351eaa..a6e941ebbc7a9adb221b860425a4b25c03351eaa
mode 100644,100755..100644
index 8fad98ede145eaedcf630ef56a59ac1e95f2e965,0ac41e4dd7793b424b45476d8b7731d1a79eb53b..0ac41e4dd7793b424b45476d8b7731d1a79eb53b
mode 100755,100755..100644
index dd7e1a5cebbe02216c76c4e11425d89d85efb25b,009ae7836993557c7711c9588f2305691ddd0f67..009ae7836993557c7711c9588f2305691ddd0f67
mode 100755,100755..100644
index 71d0b6ccaf100b9a201379e2a5bc440f2d3147c2,b14ccbe4341bf75cd381c62bb93db8b055a5cdb9..b14ccbe4341bf75cd381c62bb93db8b055a5cdb9
mode 100755,100755..100644
index aaf9e54479cfc953260e9ce1ee6b0c6e3964ac46,4c0d8e1ef0f365d12d6f1af4256d8bb5b7ea6765..4c0d8e1ef0f365d12d6f1af4256d8bb5b7ea6765
mode 100755,100755..100644
index 4bc06070cd83f85cab8c540950a3971cfd389dc0,e6d2c3282889dbd23b8cb0f41f30622f43d31800..e6d2c3282889dbd23b8cb0f41f30622f43d31800
mode 100755,100755..100644
index 1ce91198df94b70a4860247b33a1e73f820d24ad,a3d92d0d63f476ed59af6d201ad7e0f299a414ae..a3d92d0d63f476ed59af6d201ad7e0f299a414ae
mode 100755,100755..100644
index f9dc60721356251bb722bb17c0a9be4edef24af6,d9491b182f09994447602168a0f63624d2c1c0ad..d9491b182f09994447602168a0f63624d2c1c0ad
mode 100755,100755..100644
index 43cb563139a24c3badcac030f132683d4f99eff0,9d82d82a8f12d5a2239056a86ccb53f3d591ee65..9d82d82a8f12d5a2239056a86ccb53f3d591ee65
mode 100755,100755..100644
index 36e0fd119ea9471db7d5169afd843ee711c6dd92,ca71198e04938edd7f4366f2bf897b9b16764c3b..ca71198e04938edd7f4366f2bf897b9b16764c3b
mode 100755,100755..100644
index cc3a800e45e1c7789dfe817c39f2c242117c89d9,8828d2968da33e67e308b591b3b5c93fb43b7202..8828d2968da33e67e308b591b3b5c93fb43b7202
mode 100755,100755..100644
index a2a0f0bf5c8498d78e4469380a245e798d8ad7ca,d77822824f8942f585d009e90ee299009e3f3a1f..d77822824f8942f585d009e90ee299009e3f3a1f
mode 100755,100755..100644
index 7e8b2223b6955dac8857479440e646c3ab950f7c,34a50769cead56830abbf673ff9954d401276390..34a50769cead56830abbf673ff9954d401276390
mode 100755,100755..100644
index 088db8cf4f76e4ff6f1974afb69ef7b99e08e826,68c4fc1c294e08d0be6abf7aeb6977331830832a..68c4fc1c294e08d0be6abf7aeb6977331830832a
mode 100755,100755..100644
index 95025e96312d56be6e6aafd535388e7e52079e80,7bccf995b25012f6ab21a5e06898be11611b0549..7bccf995b25012f6ab21a5e06898be11611b0549
mode 100755,100755..100644
index df914457242e009b588a23f5d1e49b2401521f7a,77e44b1041c87447060b7f226aba2a5b4cd67fe1..77e44b1041c87447060b7f226aba2a5b4cd67fe1
mode 100755,100755..100644
index b0c3f9e13ba8aecc1bc2b7d6083042c96d84ec15,1e8164a50b29c8aa211be670d78bd7379882db8c..1e8164a50b29c8aa211be670d78bd7379882db8c
mode 100755,100755..100644
index dde99f91c0cd6cb048927a6dcad907e7d6628db3,098c8cd9f1b347073ffba44203de677a590e94f7..098c8cd9f1b347073ffba44203de677a590e94f7
mode 100755,100755..100644
index 142b0f1dab78abb68c8e83a884baf959ec1c8b6b,5a2dc423b3b5247428e3bb8083a198a5b4d903b2..5a2dc423b3b5247428e3bb8083a198a5b4d903b2
mode 100755,100755..100644
index 8772d509b5ce1753424042ea2c650b3791a277fc,092834f649712d7bf5fad10de5c8abf8eacf4a99..092834f649712d7bf5fad10de5c8abf8eacf4a99
mode 100755,100755..100644
index 2e78bbb0b0036b4d78d9dafd8d1177c3bd2bd877,cb25250d2b718cbfc81e9b76791be59cc9e38f5b..cb25250d2b718cbfc81e9b76791be59cc9e38f5b
mode 100755,100755..100644
index 4584e8fa76a36c776e69d6e93651f040cca91d20,5aab33eda06ead735cc9a35fee76535bac82305f..5aab33eda06ead735cc9a35fee76535bac82305f
mode 100755,100755..100644
index b946440aaa42502d336e5310163000331c39c828,5b252ffd84cb7c34612407fb07fb5f93f5391e24..5b252ffd84cb7c34612407fb07fb5f93f5391e24
mode 100755,100755..100644
index a974ebe99d2e5f778bf9ea596aa4eb3b0ea7e263,6db19f1d9da5c8e24975521feb8ced6792a42d77..6db19f1d9da5c8e24975521feb8ced6792a42d77
mode 100755,100755..100644
index ea09c0716733ef1d5f98f976fd524d9c184e042f,fe943e75b0695dc483b7f6f75cd90cbb96aec9f9..fe943e75b0695dc483b7f6f75cd90cbb96aec9f9
mode 100755,100755..100644
Simple merge
index e4ef4054e0727f8052df5b55ffed0a77aaea990f,9307b1c98173c72cdc2a574b9c3811d476c2527f..74cdacc315e867c5c9c3914d18fdc6308c2a3831
@@@ -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);
index 99f3d03c28a9812be462bb52f680cc4f2ac1942c,f07657be408cf3a6a96a5f064cb53af0d3d4ca2b..2d104e333e1483b4a8a6926f6a4429e0975efbaa
@@@ -222,21 -225,14 +226,21 @@@ void MessagingInstance::MessageServiceS
      simIndex = static_cast<long>
        (MessagingUtil::getValueFromJSONObject<double>(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<long>(callbackId), PostPriority::HIGH);
+     callback->AddToQueue();
      auto service = manager_.getMessageService(serviceId);
  
      ret = service->sendMessage(callback);
index b7d570b97fa1846b92cc8a97b7caaf584d0c2741,cbd8bcd8e17373a761a0be94f7e67959513f64f7..cbd8bcd8e17373a761a0be94f7e67959513f64f7
mode 100755,100755..100644
index 78d3b720b42cf88c4a9cff245a0ac49454de2de5,2cb344efe372bf08577fa2941aaa78ab266305eb..55f40fa52e1953e436d2c5d665886cbe04b3ccad
mode 100755,100644..100644
@@@ -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;
    }
index bb935f225aed87f0eb5d44a8529ec21388d76782,9788d89da28125e983459411387c7e770913e3a1..8278982cac265edc37c5b21cc68bed3ecd93443a
mode 100755,100755..100644
@@@ -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;
      }
    } 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);
  }
  
  
index 6d45f17cf1b58cca9d7999bc9f1724ea6fceed27,5a9c4703d99933fec3aeead100b535274f21911a..5ccd90ffaa79930b6811163db00e8d84c7715af7
mode 100755,100755..100644
@@@ -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
index a88fb8a2c6a94d34cef27f862dc11caedc09dfd2,b9bce2db2701720f98324f81a2390fcdc4b8151e..8ffa60d50eb957e175384a224eb9ed786b7ea5a0
@@@ -1138,7 -1151,7 +1152,8 @@@ PlatformResult SysteminfoPropertiesMana
    array.push_back(picojson::value(picojson::object()));
    picojson::object& internal_obj = array.back().get<picojson::object>();
  
 -  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");
    }
index 05ae6315c066a9db9b7bba5383aba46d31e82afa,3f318d75e177b508abd89e6d4cbd7f519cd2250e..3f318d75e177b508abd89e6d4cbd7f519cd2250e
mode 100644,100755..100644
index 0000000000000000000000000000000000000000,898954a5d360eef9147fb3e19e25deb707f78b29..4bc6adb8925e338797dfafcadffda27e236f70b7
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,204 +1,204 @@@
 -  ssize_t len = readlink("/opt/etc/localtime", buf, sizeof(buf)-1);
+ /*
+  * 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 <unicode/timezone.h>
+ #include <unicode/calendar.h>
+ #include <unistd.h>
+ #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<UnicodeString> unicode_id (new UnicodeString(timezone_id.c_str()));
+   std::unique_ptr<TimeZone> 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<TimeManager*>(event_ptr);
+   TimeInstance* instance = manager->GetTimeInstance();
+   std::string defaultTimezone = GetDefaultTimezone();
+   if (manager->GetCurrentTimezone() != defaultTimezone) {
+     manager->SetCurrentTimezone(defaultTimezone);
+     //call timezone callback
+     const std::shared_ptr<picojson::value>& response =
+         std::shared_ptr<picojson::value>(new picojson::value(picojson::object()));
+     response->get<picojson::object>()["listenerId"] = picojson::value("TimezoneChangeListener");
+     //    ReportSuccess(result,response->get<picojson::object>());
+     Instance::PostMessage(instance, response->serialize().c_str());
+   }
+   //call date time callback
+   const std::shared_ptr<picojson::value>& response =
+       std::shared_ptr<picojson::value>(new picojson::value(picojson::object()));
+   response->get<picojson::object>()["listenerId"] = picojson::value("DateTimeChangeListener");
+   //  ReportSuccess(result,response->get<picojson::object>());
+   Instance::PostMessage(instance, response->serialize().c_str());
+ }
+ std::string TimeManager::GetDefaultTimezone() {
+   LoggerD("Entered");
+   char buf[1024];
+   std::string result;
++  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
index 60d4646aae41499c6a208fa4cefe872e115528fd,e0570ef9892e45a69c0614ce2d0a7678ea2fe764..3cc9d81699e703bf4dd2906f1601b375e2a5abf6
@@@ -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;
          }
  
index 981f2c4ae6c92c9288e1f583bd01dd7a7e5193e8,bc85eb7ceb21dcd8f2f0b74d3980a0f90e72830f..d4941e8f5b6921a4e6d51ac5905383fa9475a771
mode 100644,100755..100644
Simple merge