From 72d8102664080f2fde6db889b11ee972540633e1 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Tue, 24 May 2016 11:01:35 +0900 Subject: [PATCH 01/16] [version] 0.84 Change-Id: I28849306d0445925fb0ceddae710c2850892034e --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index ab427c5..c112217 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.83 +Version: 0.84 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 2a895c262ef8e757465b9379556f9a8a8140d548 Mon Sep 17 00:00:00 2001 From: "taekeun.kang" Date: Tue, 24 May 2016 20:28:21 +0900 Subject: [PATCH 02/16] [Downlaod] to enable download on wearable target [version] 0.85 Change-Id: I6987274563f2847def9a57018b19f8e6b6dfea14 Signed-off-by: taekeun.kang --- packaging/webapi-plugins.spec | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index c112217..f7bb648 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.84 +Version: 0.85 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries @@ -154,11 +154,7 @@ Source0: %{name}-%{version}.tar.gz %define tizen_feature_content_support 1 %define tizen_feature_datacontrol_support 1 %define tizen_feature_datasync_support 0 -%if 0%{?tizen_is_emulator} %define tizen_feature_download_support 1 -%else -%define tizen_feature_download_support 0 -%endif %define tizen_feature_exif_support 1 %define tizen_feature_feedback_support 1 %define tizen_feature_filesystem_support 1 -- 2.7.4 From f035749438373fc37a9b05aa0349c55b1ca0d762 Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Wed, 25 May 2016 09:01:22 +0200 Subject: [PATCH 03/16] [SecureElement] Added fixes for transmit function. [Verification] Code compiles. Related tests pass. Change-Id: I9bfe3acd7a94da866f7e8b928d1225ba3db1920f Signed-off-by: Tomasz Marciniak --- src/secureelement/secureelement_api.js | 3 +-- src/secureelement/secureelement_instance.cc | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/secureelement/secureelement_api.js b/src/secureelement/secureelement_api.js index 09b53b3..ccbcde2 100644 --- a/src/secureelement/secureelement_api.js +++ b/src/secureelement/secureelement_api.js @@ -267,8 +267,7 @@ Channel.prototype.transmit = function() { if ( native_.isFailure(result)) { native_.callIfPossible( args.errorCallback, native_.getErrorObject(result)); } else { - var result_obj = native_.getResultObject(result); - args.successCallback(result_obj.response); + args.successCallback(native_.getResultObject(result)); } } diff --git a/src/secureelement/secureelement_instance.cc b/src/secureelement/secureelement_instance.cc index acd45b5..3b78716 100644 --- a/src/secureelement/secureelement_instance.cc +++ b/src/secureelement/secureelement_instance.cc @@ -372,15 +372,15 @@ void SecureElementInstance::Transmit( const picojson::value& args, picojson::obj } ReportSuccess( result, response->get()); } catch (const ErrorIO& err) { - LogAndReportError(PlatformResult(ErrorCode::IO_ERR), &response->get()); + LogAndReportError(PlatformResult(ErrorCode::IO_ERR, "Failed to transmit command."), &response->get()); } catch (const ErrorIllegalState& err) { - LogAndReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR), &response->get()); + LogAndReportError(PlatformResult(ErrorCode::INVALID_STATE_ERR, "Failed to transmit command."), &response->get()); } catch (const ErrorIllegalParameter& err) { - LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR), &response->get()); + LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Failed to transmit command."), &response->get()); } catch (const ErrorSecurity& err) { - LogAndReportError(PlatformResult(ErrorCode::SECURITY_ERR), &response->get()); + LogAndReportError(PlatformResult(ErrorCode::SECURITY_ERR, "Failed to transmit command."), &response->get()); } catch (const ExceptionBase& err) { - LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR), &response->get()); + LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to transmit command."), &response->get()); } }; -- 2.7.4 From 700a97f10e3509c027c7d1b3fa1100db60f3b4ba Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Tue, 24 May 2016 14:55:19 +0200 Subject: [PATCH 04/16] [Common][Filesystem] Added support for global paths from Tizen 2.4 filesystem [Feature] Now Tizen 3.0 invalid global paths, like '/opt/usr/media/Documents' (valid for 2.4), are now converted to Tizen3.0, like '/home//content/Documents' if application required version is lower than 3.0. This commit is to resolve problems existing in some Store apps, when migrating to Tizen 3.0. [Verification] Tested in console. Paths are converted for older applications. TCT passrate for filesystem, archive and content is 100%. Store application ColorEffectImageEditor.wgt could save files correctly. Change-Id: I707f70e9f9ef3cb762b6370965d88651ebdec74f Signed-off-by: Piotr Kosko --- src/filesystem/js/common.js | 48 +++++++++++++++++++++++++++++++++++++++++++++ src/utils/utils_api.js | 32 +++++++++++++++--------------- 2 files changed, 64 insertions(+), 16 deletions(-) diff --git a/src/filesystem/js/common.js b/src/filesystem/js/common.js index 754d0c4..9e99384 100644 --- a/src/filesystem/js/common.js +++ b/src/filesystem/js/common.js @@ -47,12 +47,21 @@ var FileMode = { a: 'a' }; +var tizen24home = "/opt/usr/media"; + +//this variable need to match same variable in common/filesystem/filesystem_provider_storage.cc +var kVirtualRootImages = "images"; + var commonFS_ = (function() { var cacheReady = false; var listenerRegistered = false; var cacheVirtualToReal = {}; var cacheStorages = []; var uriPrefix = 'file://'; + // special condition for previous versions paths + // (global paths usage issue workaround) + var isAppForEarlierVersion = privUtils_.isAppVersionEarlierThan("3.0"); + var homeDir = undefined; function clearCache() { cacheVirtualToReal = {}; @@ -60,6 +69,21 @@ var commonFS_ = (function() { cacheReady = false; } + // initalize home directory for correct mapping global paths from tizen 2.4 + // (global paths usage issue workaround) + function initHomeDir(aPath) { + if (homeDir || !isAppForEarlierVersion) { + return; + } + var imagesPath = cacheVirtualToReal[kVirtualRootImages].path; + + if (imagesPath[imagesPath.length-1] === "/") { + homeDir = imagesPath.split("/").slice(0, -2).join("/"); + } else { + homeDir = imagesPath.split("/").slice(0, -1).join("/"); + } + } + function initCache() { if (cacheReady) { return; @@ -79,6 +103,9 @@ var commonFS_ = (function() { state: FileSystemStorageState.MOUNTED }; } + // initalize home directory for correct mapping global paths from tizen 2.4 + // (global paths usage issue workaround) + initHomeDir(); var result = native_.callSync('FileSystemManager_fetchStorages', {}); if (native_.isFailure(result)) { @@ -159,6 +186,16 @@ var commonFS_ = (function() { return true; } + function convertForEarlierVersionPath(aPath) { + if (isAppForEarlierVersion) { + if (aPath && aPath.indexOf(tizen24home) === 0) { + console.log("Converting 2.4 style path to 3.0 pattern"); + aPath = homeDir + aPath.substr(tizen24home.length); + } + } + return aPath; + } + function toRealPath(aPath) { var _fileRealPath = ''; @@ -197,6 +234,17 @@ var commonFS_ = (function() { // this line makes that '.' and '..' is supported in paths, but each method handle those cases // and return error (see commonFS_.checkPathWithoutDots() method) _fileRealPath = removeDotsFromPath(_fileRealPath); + // convert path to be compatibile with previous version of Tizen + // (global paths usage issue workaround) + _fileRealPath = convertForEarlierVersionPath(_fileRealPath); + // if path is valid try to cut last '/' if it is present + if (_fileRealPath) { + _fileRealPath = mergeMultipleSlashes(_fileRealPath); + var lastCharIndex = _fileRealPath.length-1; + if (_fileRealPath[lastCharIndex] === '/') { + _fileRealPath = _fileRealPath.substr(0,lastCharIndex); + } + } return _fileRealPath; } diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index b4a6e23..4b9ecbb 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -229,34 +229,34 @@ Utils.prototype.checkPrivilegeAccess = function(privilege) { } }; -Utils.prototype.checkPrivilegeAccess4Ver = function(new_ver, new_priv, old_priv) { +Utils.prototype.isAppVersionEarlierThan= function(ver) { var app_ver = this.getPkgApiVersion(); - var arr_new_ver = new_ver.split("."); - var arr_app_ver = app_ver.split("."); - var num_new; + var arr_ver = ver.split("."); // reference version + var arr_app_ver = app_ver.split("."); // application version + var num_ver; var num_app; - var sel = 0; var i; - var length = Math.min(arr_new_ver.length, arr_app_ver.length); + var length = Math.min(arr_ver.length, arr_app_ver.length); for (i = 0; i < length; i++) { - num_new = parseInt(arr_new_ver[i]); + num_ver = parseInt(arr_ver[i]); num_app = parseInt(arr_app_ver[i]); - if (num_app < num_new) { - sel = 1; - break; - } else if (num_app > num_new) { - sel = -1; - break; + if (num_app < num_ver) { + return true; + } else if (num_app > num_ver) { + return false; } } - if (sel == 0 && arr_new_ver.length > arr_app_ver.length) { - sel = 1; + if (arr_ver.length > arr_app_ver.length) { + return true; } + return false; +} - if (sel != 1) { +Utils.prototype.checkPrivilegeAccess4Ver = function(new_ver, new_priv, old_priv) { + if (this.isAppVersionEarlierThan(new_ver)) { this.checkPrivilegeAccess(new_priv); } else if (old_priv != undefined) { this.checkPrivilegeAccess(old_priv); -- 2.7.4 From b5ed8e1a6047329a8d6c99c8d619ff3304e64ac0 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Wed, 25 May 2016 16:45:33 +0900 Subject: [PATCH 05/16] [version] 0.86 Change-Id: I1671ea501243a1b34afee4dc95e1905c49a08144 --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index f7bb648..b396fe9 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.85 +Version: 0.86 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From d1dc4c41b93406088d514a8f4c57a1c15c32039c Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Wed, 25 May 2016 10:50:38 +0200 Subject: [PATCH 06/16] [Common] Dbus name is changed. [Feature] deviced name changed to storage. [Verification] Code compiles. Change-Id: Id0f1e834350c3bd65175be5f392e1b5cdd44c727 Signed-off-by: Tomasz Marciniak --- src/common/filesystem/filesystem_provider_deviced.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/filesystem/filesystem_provider_deviced.cc b/src/common/filesystem/filesystem_provider_deviced.cc index 7edd020..87e04a5 100644 --- a/src/common/filesystem/filesystem_provider_deviced.cc +++ b/src/common/filesystem/filesystem_provider_deviced.cc @@ -28,10 +28,10 @@ #include "common/logger.h" namespace { -static const char* kBus = "org.tizen.system.deviced"; -static const char* kBlockIface = "org.tizen.system.deviced.Block"; -static const char* kBlackManagerIface = "org.tizen.system.deviced.BlockManager"; -static const char* kPath = "/Org/Tizen/System/DeviceD/Block/Manager"; +static const char* kBus = "org.tizen.system.storage"; +static const char* kBlockIface = "org.tizen.system.storage.Block"; +static const char* kBlackManagerIface = "org.tizen.system.storage.BlockManager"; +static const char* kPath = "/Org/Tizen/System/Storage/Block/Manager"; static const char* kDeviceChangedMethod = "DeviceChanged"; static const char* kGetDeviceListMethod = "GetDeviceList"; } // namespace -- 2.7.4 From f8d231a4b598008cbfc0205cefc716ed4a50fad3 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Wed, 25 May 2016 18:28:59 +0900 Subject: [PATCH 07/16] [version] 0.87 Change-Id: Ia53e974338b15b8fbf88908f68031c63c479cc89 --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index b396fe9..ca46517 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.86 +Version: 0.87 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 9040925301c441e9d00458cd3a9713c72eba3e6a Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Wed, 25 May 2016 14:20:07 +0200 Subject: [PATCH 08/16] [InputDevice] Added missing privilege to utils_api. [Verification] Code compiles. There is no undefined privilege in cynara anymore. Change-Id: I9db54df23a1707d4ed907400425617c117a9cba5 Signed-off-by: Tomasz Marciniak --- src/utils/utils_api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 4b9ecbb..31ae67e 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -125,7 +125,8 @@ function Utils() { SYSTEMMANAGER: 'http://tizen.org/privilege/systemmanager', TELEPHONY: 'http://tizen.org/privilege/telephony', VOLUME_SET: 'http://tizen.org/privilege/volume.set', - WEBSETTING: 'http://tizen.org/privilege/websetting' + WEBSETTING: 'http://tizen.org/privilege/websetting', + TV_INPUT_DEVICE: 'http://tizen.org/privilege/tv.inputdevice' }; Object.freeze(privilege); -- 2.7.4 From 1571f1a07045d945ab06e6037e99b2c6ae95ffc2 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Thu, 26 May 2016 11:06:14 +0900 Subject: [PATCH 09/16] [version] 0.88 Change-Id: I9bef9a8e155bbeae4737c65ffe887c3de1e6ac52 --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index ca46517..19fc590 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.87 +Version: 0.88 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 4ba639194f96aa68b75ccb019c5cf6cf21fac654 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Fri, 27 May 2016 12:05:50 +0200 Subject: [PATCH 10/16] [Contact] Added more restrictive validation of filter in findByUsageCount [Feature] Added more validation of filter in findByUsageCount - value and type are checked for validyty - value shouldn't be less than 0, type should be one of values in enum. [Verification] Code compiles without errors. Contact TCT passrate r11 is 100%. Change-Id: Iee3b6a86eb931f6fda3fc9304771837d5a4f5ad5 Signed-off-by: Piotr Kosko --- src/contact/contact_manager.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/contact/contact_manager.cc b/src/contact/contact_manager.cc index 319811f..aeab4f2 100755 --- a/src/contact/contact_manager.cc +++ b/src/contact/contact_manager.cc @@ -925,6 +925,10 @@ PlatformResult ContactManagerFindByUsageCount(const JsonObject& args, JsonArray& const auto& match = filter.get("matchValue"); if (match.is()){ match_value = static_cast(match.get()); + if (match_value < 0) { + return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR, + "Match value cannot be less than 0"); + } ret = contacts_filter_add_int(filter_handle, _contacts_person_usage.times_used, CONTACTS_MATCH_EQUAL, @@ -989,6 +993,10 @@ PlatformResult ContactManagerFindByUsageCount(const JsonObject& args, JsonArray& } // adding usage type to filter contacts_usage_type_e type = Person::UsageTypeFromString(attribute_name); + if (CONTACTS_USAGE_STAT_TYPE_NONE == type) { + return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR, + "Type of usage in filter should be one of ContactUsageType values"); + } ret = contacts_filter_add_int(filter_handle, _contacts_person_usage.usage_type, CONTACTS_MATCH_EQUAL, -- 2.7.4 From 1d65a230d8bb47d5ddbe7b5f63da3d83dc5bb8a9 Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Fri, 27 May 2016 13:14:08 +0200 Subject: [PATCH 11/16] [Common][Filesystem] Fix for checking privilege. [Verification] Code compiles. TCT privilege pass rate 100% Change-Id: Ie81b929b657bde2d800198dda7cb12aa10a45ed7 Signed-off-by: Tomasz Marciniak --- src/utils/utils_api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 31ae67e..5502e3f 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -257,7 +257,7 @@ Utils.prototype.isAppVersionEarlierThan= function(ver) { } Utils.prototype.checkPrivilegeAccess4Ver = function(new_ver, new_priv, old_priv) { - if (this.isAppVersionEarlierThan(new_ver)) { + if (!this.isAppVersionEarlierThan(new_ver)) { this.checkPrivilegeAccess(new_priv); } else if (old_priv != undefined) { this.checkPrivilegeAccess(old_priv); -- 2.7.4 From 664b337bba51927b393f3d1047e01bc715d01727 Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Fri, 27 May 2016 14:39:32 +0200 Subject: [PATCH 12/16] [FileSystem] Remove code for cutting last '/' [Verification] Code compiles. FileSystem tct pass rate 100% Security tct related to paths pass. Change-Id: Ib1b90f6224e9909f9d1f4206b72fde08b88d3767 Signed-off-by: Tomasz Marciniak --- src/filesystem/js/common.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/filesystem/js/common.js b/src/filesystem/js/common.js index 9e99384..15cc697 100644 --- a/src/filesystem/js/common.js +++ b/src/filesystem/js/common.js @@ -240,10 +240,6 @@ var commonFS_ = (function() { // if path is valid try to cut last '/' if it is present if (_fileRealPath) { _fileRealPath = mergeMultipleSlashes(_fileRealPath); - var lastCharIndex = _fileRealPath.length-1; - if (_fileRealPath[lastCharIndex] === '/') { - _fileRealPath = _fileRealPath.substr(0,lastCharIndex); - } } return _fileRealPath; } -- 2.7.4 From e931312541c89ead2a995d2ea11c70a8803c3fd2 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Mon, 30 May 2016 11:03:29 +0900 Subject: [PATCH 13/16] [version] 0.89 Change-Id: I46473170e96bbe15640758cfd2961aea61b1c2db --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 19fc590..42571c6 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.88 +Version: 0.89 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries -- 2.7.4 From 7d5bd6089559f8e1ba034da99815363a6fcc7e8d Mon Sep 17 00:00:00 2001 From: "taekeun.kang" Date: Mon, 30 May 2016 14:54:54 +0900 Subject: [PATCH 14/16] [HAM] change codes to check whether the option is undefied [version] 0.89 Change-Id: Ic83d343669a4e283de1d3f637a0c07a80d983b21 Signed-off-by: taekeun.kang --- packaging/webapi-plugins.spec | 2 +- src/humanactivitymonitor/humanactivitymonitor_api.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 19fc590..42571c6 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 0.88 +Version: 0.89 Release: 0 License: Apache-2.0 and BSD-2.0 and MIT Group: Development/Libraries diff --git a/src/humanactivitymonitor/humanactivitymonitor_api.js b/src/humanactivitymonitor/humanactivitymonitor_api.js index 63bb34a..fd442d9 100755 --- a/src/humanactivitymonitor/humanactivitymonitor_api.js +++ b/src/humanactivitymonitor/humanactivitymonitor_api.js @@ -246,13 +246,13 @@ HumanActivityMonitorManager.prototype.start = function(type, changedCallback) { switch (args.type) { case HumanActivityType.GPS: - callbackInterval = !type_.isNullOrUndefined(args.option) ? + callbackInterval = !type_.isNullOrUndefined(args.option.callbackInterval) ? args.option.callbackInterval : 150000; - sampleInterval = !type_.isNullOrUndefined(args.option) ? + sampleInterval = !type_.isNullOrUndefined(args.option.sampleInterval) ? args.option.sampleInterval : 1000; break; case HumanActivityType.HRM: - callbackInterval = !type_.isNullOrUndefined(args.option) ? + callbackInterval = !type_.isNullOrUndefined(args.option.callbackInterval) ? args.option.callbackInterval : 100; if (callbackInterval < 10 || callbackInterval > 1000) { throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR, -- 2.7.4 From 20019d62e96f1cf46119f7f2e65b9b07838f2a60 Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Wed, 18 May 2016 09:28:52 +0200 Subject: [PATCH 15/16] [WidgetService] Adjusted privilege checking. [Verification] Code compiles. Change-Id: I2004b99232a4b71a158f4b75bef0c5325312b0bc Signed-off-by: Tomasz Marciniak --- src/widgetservice/widgetservice_instance.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/widgetservice/widgetservice_instance.cc b/src/widgetservice/widgetservice_instance.cc index 81ac3c9..be4d077 100755 --- a/src/widgetservice/widgetservice_instance.cc +++ b/src/widgetservice/widgetservice_instance.cc @@ -25,6 +25,7 @@ #include "widgetservice/widgetservice_utils.h" #include "common/scope_exit.h" +#include "common/tools.h" namespace extension { namespace widgetservice { @@ -37,7 +38,7 @@ std::mutex WidgetServiceInstance::listener_mutex_; namespace { const common::ListenerToken kWidgetChangeCallbackToken{"WidgetChangeCallback"}; -const std::string kPrivilegeWidget = "http://tizen.org/privilege/widget.viewer"; +const std::string kPrivilegeWidgetService = "http://tizen.org/privilege/widget.viewer"; const std::string kLang = "lang"; const std::string kInstanceId = "instanceId"; @@ -181,7 +182,8 @@ WidgetServiceInstance::~WidgetServiceInstance() { TizenResult WidgetServiceInstance::GetWidget(const picojson::object& args) { ScopeLogger(); - //CHECK_PRIVILEGE_ACCESS(kPrivilegeWidget, &out); + CHECK_PRIVILEGE(kPrivilegeWidgetService); + CHECK_EXIST(args, kWidgetId, out) const auto& widget_id = args.find(kWidgetId)->second.get(); @@ -201,7 +203,7 @@ TizenResult WidgetServiceInstance::GetWidgets(const picojson::object& args, const common::AsyncToken& token) { ScopeLogger(); - //CHECK_PRIVILEGE_ACCESS(kPrivilegeWidget, &out); + CHECK_PRIVILEGE(kPrivilegeWidgetService); std::string pkgid; const auto id = args.find(kPackageId); @@ -240,7 +242,8 @@ TizenResult WidgetServiceInstance::GetWidgets(const picojson::object& args, TizenResult WidgetServiceInstance::GetPrimaryWidgetId(const picojson::object& args) { ScopeLogger(); - //CHECK_PRIVILEGE_ACCESS(kPrivilegeWidget, &out); + CHECK_PRIVILEGE(kPrivilegeWidgetService); + CHECK_EXIST(args, kId, out) const auto& id = args.find(kId)->second.get(); @@ -282,7 +285,8 @@ TizenResult WidgetServiceInstance::GetSize(const picojson::object& args) { TizenResult WidgetServiceInstance::GetName(picojson::object const& args) { ScopeLogger(); - //CHECK_PRIVILEGE_ACCESS(kPrivilegeWidget, &out); + CHECK_PRIVILEGE(kPrivilegeWidgetService); + CHECK_EXIST(args, kWidgetId, out) const auto& widget_id = args.find(kWidgetId)->second.get(); @@ -372,7 +376,8 @@ TizenResult WidgetServiceInstance::GetVariant(picojson::object const& args) { TizenResult WidgetServiceInstance::GetVariants(picojson::object const& args, const common::AsyncToken& token) { ScopeLogger(); - //CHECK_PRIVILEGE_ACCESS(kPrivilegeWidget, &out); + CHECK_PRIVILEGE(kPrivilegeWidgetService); + CHECK_EXIST(args, kWidgetId, out) const auto& widget_id = args.find(kWidgetId)->second.get(); @@ -447,7 +452,8 @@ void WidgetServiceInstance::CallWidgetLifecycleListener(const std::string& widge TizenResult WidgetServiceInstance::AddChangeListener(picojson::object const& args) { ScopeLogger(); - //CHECK_PRIVILEGE_ACCESS(kPrivilegeWidget, &out); + CHECK_PRIVILEGE(kPrivilegeWidgetService); + CHECK_EXIST(args, kWidgetId, out) const auto& widget_id = args.find(kWidgetId)->second.get(); -- 2.7.4 From fd5910d98dbea00651b0f296d22b4a5f2f2250f5 Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Fri, 27 May 2016 08:47:56 +0200 Subject: [PATCH 16/16] [WidgetService] Adjusted to widl changes. [Verification] Code compiles. Change-Id: I06be32548c7c304ca6a08f9d478ee5e9c70a7343 Signed-off-by: Tomasz Marciniak --- src/widgetservice/widgetservice_api.js | 31 ++++++++++++------------- src/widgetservice/widgetservice_instance.cc | 36 ++++++++++++++--------------- src/widgetservice/widgetservice_instance.h | 4 ++-- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/widgetservice/widgetservice_api.js b/src/widgetservice/widgetservice_api.js index 9435b50..fa358f4 100755 --- a/src/widgetservice/widgetservice_api.js +++ b/src/widgetservice/widgetservice_api.js @@ -119,14 +119,14 @@ function WidgetInstance(data, widget) { WidgetInstance.prototype.changeUpdatePeriod = function() { var args = validator.validateMethod(arguments, [{ - name : 'period', + name : 'seconds', type : types.DOUBLE, }]); var callArgs = {}; callArgs.widgetId = this.widget.id; callArgs.instanceId = this.id; - callArgs.period = args.period; + callArgs.seconds = args.seconds; var ret = native.callSync('WidgetInstance_changeUpdatePeriod', callArgs); @@ -140,7 +140,7 @@ WidgetInstance.prototype.sendContent = function() { name : 'data', type: types.DICTIONARY, }, { - name : 'force', + name : 'updateIfPaused', type : types.BOOLEAN, }]); @@ -148,7 +148,7 @@ WidgetInstance.prototype.sendContent = function() { callArgs.widgetId = this.widget.id; callArgs.instanceId = this.id; callArgs.data = args.data; - callArgs.force = args.force; + callArgs.updateIfPaused = args.updateIfPaused; var ret = native.callSync('WidgetInstance_sendContent', callArgs); @@ -174,7 +174,6 @@ WidgetInstance.prototype.getContent = function() { if (native.isFailure(result)) { args.errorCallback(native.getErrorObject(result)); } else { - //TODO what is type of returned data args.successCallback(native.getResultObject(result)); } }; @@ -217,7 +216,7 @@ function Widget(data) { Widget.prototype.getName = function() { var args = validator.validateMethod(arguments, [{ - name : 'lang', + name : 'locale', type : types.STRING, optional : true, nullable : true @@ -226,8 +225,8 @@ Widget.prototype.getName = function() { var callArgs = {}; callArgs.widgetId = this.id; - if (args.lang) { - callArgs.lang = args.lang; + if (args.locale) { + callArgs.locale = args.locale; } var ret = native.callSync('Widget_getName', callArgs); @@ -354,16 +353,16 @@ ListenerManager.prototype.removeListener = function(watchId) { } }; -var WIDGET_CHANGE_LISTENER = 'WidgetChangeCallback'; -var widgetChangeListener = new ListenerManager(native, WIDGET_CHANGE_LISTENER); +var WIDGET_STATE_CHANGE_LISTENER = 'WidgetStateChangeCallback'; +var widgetStateChangeListener = new ListenerManager(native, WIDGET_STATE_CHANGE_LISTENER); -Widget.prototype.addChangeListener = function() { +Widget.prototype.addStateChangeListener = function() { var args = validator.validateMethod(arguments, [{ name : 'eventCallback', type : types.FUNCTION, }]); - var result = native.callSync('Widget_addChangeListener', {widgetId : this.id}); + var result = native.callSync('Widget_addStateChangeListener', {widgetId : this.id}); if (native.isFailure(result)) { throw native.getErrorObject(result); } @@ -374,18 +373,18 @@ Widget.prototype.addChangeListener = function() { } }.bind(this); - return widgetChangeListener.addListener(func); + return widgetStateChangeListener.addListener(func); }; -Widget.prototype.removeChangeListener = function() { +Widget.prototype.removeStateChangeListener = function() { var args = validator.validateMethod(arguments, [{ name : 'watchId', type : types.LONG, }]); - widgetChangeListener.removeListener(args.watchId); + widgetStateChangeListener.removeListener(args.watchId); - var result = native.callSync('Widget_removeChangeListener', {widgetId : this.id}); + var result = native.callSync('Widget_removeStateChangeListener', {widgetId : this.id}); if (native.isFailure(result)) { throw native.getErrorObject(result); } diff --git a/src/widgetservice/widgetservice_instance.cc b/src/widgetservice/widgetservice_instance.cc index be4d077..c60a3f5 100755 --- a/src/widgetservice/widgetservice_instance.cc +++ b/src/widgetservice/widgetservice_instance.cc @@ -36,14 +36,14 @@ using common::TizenSuccess; std::mutex WidgetServiceInstance::listener_mutex_; namespace { -const common::ListenerToken kWidgetChangeCallbackToken{"WidgetChangeCallback"}; +const common::ListenerToken kWidgetChangeCallbackToken{"WidgetStateChangeCallback"}; const std::string kPrivilegeWidgetService = "http://tizen.org/privilege/widget.viewer"; -const std::string kLang = "lang"; +const std::string kLocale = "locale"; const std::string kInstanceId = "instanceId"; -const std::string kPeriod = "period"; -const std::string kForce = "force"; +const std::string kSeconds = "seconds"; +const std::string kUpdateIfPaused = "updateIfPaused"; const std::string kData = "data"; const std::string kEvent = "event"; @@ -148,8 +148,8 @@ WidgetServiceInstance::WidgetServiceInstance() { REGISTER_SYNC("WidgetServiceManager_getSize", GetSize); REGISTER_SYNC("Widget_getName", GetName); REGISTER_SYNC("Widget_getVariant", GetVariant); - REGISTER_SYNC("Widget_addChangeListener", AddChangeListener); - REGISTER_SYNC("Widget_removeChangeListener", RemoveChangeListener); + REGISTER_SYNC("Widget_addStateChangeListener", AddStateChangeListener); + REGISTER_SYNC("Widget_removeStateChangeListener", RemoveStateChangeListener); REGISTER_SYNC("WidgetInstance_changeUpdatePeriod", ChangeUpdatePeriod); REGISTER_SYNC("WidgetInstance_sendContent", SendContent); @@ -290,14 +290,14 @@ TizenResult WidgetServiceInstance::GetName(picojson::object const& args) { CHECK_EXIST(args, kWidgetId, out) const auto& widget_id = args.find(kWidgetId)->second.get(); - char* lang = nullptr; + char* locale = nullptr; - const auto lang_it = args.find(kLang); - if (args.end() != lang_it) { - lang = const_cast(lang_it->second.get().c_str()); + const auto locale_it = args.find(kLocale); + if (args.end() != locale_it) { + locale = const_cast(locale_it->second.get().c_str()); } - char* name = widget_service_get_name(widget_id.c_str(), lang); + char* name = widget_service_get_name(widget_id.c_str(), locale); if (!name) { LogAndReturnTizenError( WidgetServiceUtils::ConvertErrorCode(get_last_result()), ("widget_service_get_name() failed")); @@ -449,7 +449,7 @@ void WidgetServiceInstance::CallWidgetLifecycleListener(const std::string& widge LoggerW("widget id was not found."); } -TizenResult WidgetServiceInstance::AddChangeListener(picojson::object const& args) { +TizenResult WidgetServiceInstance::AddStateChangeListener(picojson::object const& args) { ScopeLogger(); CHECK_PRIVILEGE(kPrivilegeWidgetService); @@ -476,7 +476,7 @@ TizenResult WidgetServiceInstance::AddChangeListener(picojson::object const& arg return TizenSuccess(); } -TizenResult WidgetServiceInstance::RemoveChangeListener(picojson::object const& args) { +TizenResult WidgetServiceInstance::RemoveStateChangeListener(picojson::object const& args) { ScopeLogger(); CHECK_EXIST(args, kWidgetId, out) @@ -507,13 +507,13 @@ TizenResult WidgetServiceInstance::ChangeUpdatePeriod(picojson::object const& ar CHECK_EXIST(args, kWidgetId, out) CHECK_EXIST(args, kInstanceId, out) - CHECK_EXIST(args, kPeriod, out) + CHECK_EXIST(args, kSeconds, out) const auto& widget_id = args.find(kWidgetId)->second.get(); const auto& instance_id = args.find(kInstanceId)->second.get(); - const double period = args.find(kPeriod)->second.get(); + const double seconds = args.find(kSeconds)->second.get(); - int ret = widget_service_change_period(widget_id.c_str(), instance_id.c_str(), period); + int ret = widget_service_change_period(widget_id.c_str(), instance_id.c_str(), seconds); if (WIDGET_ERROR_NONE != ret) { LogAndReturnTizenError( @@ -529,11 +529,11 @@ TizenResult WidgetServiceInstance::SendContent(picojson::object const& args) { CHECK_EXIST(args, kWidgetId, out) CHECK_EXIST(args, kInstanceId, out) CHECK_EXIST(args, kData, out) - CHECK_EXIST(args, kForce, out) + CHECK_EXIST(args, kUpdateIfPaused, out) const auto& widget_id = args.find(kWidgetId)->second.get(); const auto& instance_id = args.find(kInstanceId)->second.get(); - const int force = args.find(kForce)->second.get() ? 1 : 0; + const int force = args.find(kUpdateIfPaused)->second.get() ? 1 : 0; bundle* data = bundle_create(); int ret = get_last_result(); diff --git a/src/widgetservice/widgetservice_instance.h b/src/widgetservice/widgetservice_instance.h index 8aadbfa..747f100 100755 --- a/src/widgetservice/widgetservice_instance.h +++ b/src/widgetservice/widgetservice_instance.h @@ -41,8 +41,8 @@ class WidgetServiceInstance : public common::TizenInstance { common::TizenResult GetInstances(picojson::object const& args, const common::AsyncToken& token); common::TizenResult GetVariant(picojson::object const& args); common::TizenResult GetVariants(picojson::object const& args, const common::AsyncToken& token); - common::TizenResult AddChangeListener(picojson::object const& args); - common::TizenResult RemoveChangeListener(picojson::object const& args); + common::TizenResult AddStateChangeListener(picojson::object const& args); + common::TizenResult RemoveStateChangeListener(picojson::object const& args); //WidgetInstance common::TizenResult ChangeUpdatePeriod(picojson::object const& args); common::TizenResult SendContent(picojson::object const& args); -- 2.7.4