From: Piotr Czaja
Date: Mon, 20 Jul 2015 09:57:43 +0000 (+0200)
Subject: [Systeminfo] Fix implementation for 'CAMERA_FLASH' property
X-Git-Tag: submit/tizen/20151026.073646^2^2~193^2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c015f2675142aec6e4a88ed6c72c4f59a556b0d;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Systeminfo] Fix implementation for 'CAMERA_FLASH' property
Change-Id: I55abdca650f6c6ebc59f84780dbbeaae9ca03c79
Signed-off-by: Piotr Czaja
---
diff --git a/src/systeminfo/systeminfo-utils.cpp b/src/systeminfo/systeminfo-utils.cpp
index e8d52d80..94be7b11 100644
--- a/src/systeminfo/systeminfo-utils.cpp
+++ b/src/systeminfo/systeminfo-utils.cpp
@@ -953,6 +953,21 @@ common::PlatformResult CheckTelephonySupport() {
return PlatformResult(ErrorCode::NO_ERROR);
}
+common::PlatformResult CheckCameraFlashSupport() {
+ bool supported = false;
+ PlatformResult ret = SystemInfoDeviceCapability::GetValueBool(
+ "tizen.org/feature/camera.back.flash", &supported);
+ if (ret.IsError()) {
+ return ret;
+ }
+ if (!supported) {
+ LoggerD("Back-facing camera with a flash is not supported on this device");
+ return PlatformResult(ErrorCode::NOT_SUPPORTED_ERR,
+ "Back-facing camera with a flash is not supported on this device");
+ }
+ return PlatformResult(ErrorCode::NO_ERROR);
+}
+
PlatformResult SystemInfoListeners::RegisterEthernetNetworkListener(const SysteminfoUtilsCallback& callback,
SysteminfoInstance& instance)
{
@@ -1671,7 +1686,9 @@ PlatformResult SysteminfoUtils::GetCount(const std::string& property, unsigned l
}
} else if ("CAMERA_FLASH" == property) {
const int numberOfCameraFlashProperties = 3;
- count = numberOfCameraFlashProperties;
+ PlatformResult ret = CheckCameraFlashSupport();
+ if (ret.IsError()) count = 0;
+ else count = numberOfCameraFlashProperties;
} else if ("ETHERNET_NETWORK" == property) {
PlatformResult ret = CheckIfEthernetNetworkSupported();
if (ret.IsError()) count = 0;
@@ -2736,7 +2753,11 @@ PlatformResult SysteminfoUtils::ReportStorage(picojson::object& out) {
return PlatformResult(ErrorCode::NO_ERROR);
}
PlatformResult SysteminfoUtils::ReportCameraFlash(picojson::object& out) {
- return PlatformResult(ErrorCode::NO_ERROR);
+ PlatformResult ret = CheckCameraFlashSupport();
+ if (ret.IsError()) {
+ return ret;
+ }
+ return PlatformResult(ErrorCode::NO_ERROR);
}
PlatformResult SysteminfoUtils::RegisterBatteryListener(const SysteminfoUtilsCallback& callback,