From: Piotr Kosko Date: Wed, 10 Jun 2020 11:19:07 +0000 (+0200) Subject: [Systeminfo] Fixed behaviour of Network property X-Git-Tag: submit/tizen_3.0/20200610.123619^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F73%2F235873%2F1;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Systeminfo] Fixed behaviour of Network property [Bug] When using device with not supported feature http://tizen.org/feature/network.telephony e.g. R800 device, below code returns no error: tizen.systeminfo.getPropertyValueArray("NETWORK", (s) => {console.log(s)}, (s) => {console.log(s)}) listener for "NETWORK" property is never triggered also: tizen.systeminfo.addPropertyValueChangeListener("NETWORK", (s) => console.log(s)); [verification] Systeminfo TCT 100% passrate. After fix, listener and getter works properly on TW3. Change-Id: I9f0d533055926d186305fb7c39418de1fed76f5b --- diff --git a/src/systeminfo/systeminfo-utils.cpp b/src/systeminfo/systeminfo-utils.cpp index 8882280..4854376 100644 --- a/src/systeminfo/systeminfo-utils.cpp +++ b/src/systeminfo/systeminfo-utils.cpp @@ -78,6 +78,21 @@ PlatformResult SysteminfoUtils::CheckTelephonySupport() { return PlatformResult(ErrorCode::NO_ERROR); } +PlatformResult SysteminfoUtils::CheckWifiSupport() { + ScopeLogger(); + bool supported = false; + PlatformResult ret = + SystemInfoDeviceCapability::GetValueBool("tizen.org/feature/network.wifi", &supported); + if (ret.IsError()) { + return ret; + } + if (!supported) { + return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, + "Wifi is not supported on this device"); + } + return PlatformResult(ErrorCode::NO_ERROR); +} + PlatformResult SysteminfoUtils::CheckCameraFlashSupport() { ScopeLogger(); bool supported = false; diff --git a/src/systeminfo/systeminfo-utils.h b/src/systeminfo/systeminfo-utils.h index 2541e08..2832c62 100644 --- a/src/systeminfo/systeminfo-utils.h +++ b/src/systeminfo/systeminfo-utils.h @@ -44,6 +44,7 @@ class SysteminfoUtils { static common::PlatformResult GetRuntimeInfoString(system_settings_key_e key, std::string *platform_string); static common::PlatformResult CheckTelephonySupport(); + static common::PlatformResult CheckWifiSupport(); static common::PlatformResult CheckCameraFlashSupport(); static common::PlatformResult CheckIfEthernetNetworkSupported(); static common::PlatformResult GetTotalMemory(long long *result); diff --git a/src/systeminfo/systeminfo_manager.cc b/src/systeminfo/systeminfo_manager.cc index f7afef0..2dc2be7 100644 --- a/src/systeminfo/systeminfo_manager.cc +++ b/src/systeminfo/systeminfo_manager.cc @@ -1346,6 +1346,11 @@ PlatformResult SysteminfoManager::GetPropertyCount(const std::string& property, PlatformResult ret = SysteminfoUtils::CheckTelephonySupport(); if (ret.IsError()) { *count = 0; + if ("NETWORK" == property && SysteminfoUtils::CheckWifiSupport()) { + // Telephony is not supported in this case, but WiFi is still supported, thus setting + // counter to 1. + *count = 1; + } } else { *count = tapi_manager_->GetSimCount(); }