[Application] Wrapped code for context API with ifdef 37/128537/1
authorPiotr Kosko <p.kosko@samsung.com>
Wed, 10 May 2017 09:21:01 +0000 (11:21 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Wed, 10 May 2017 09:46:28 +0000 (11:46 +0200)
[Verification] Code compiles without errors.
  Feature checked in chrome console.

Change-Id: I6e88d5d8da383e1f0d227e11905eeffb3235d1ba
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/application/application_instance.cc
src/application/application_manager.cc

index 0d05a287a8fdf3e1c25b54dcba4a390e8340aecf..eb4ee2ddb41d10beb9ad69eff78c865f56c60948 100755 (executable)
@@ -163,15 +163,9 @@ void ApplicationInstance::GetAppMetaData(const picojson::value& args, picojson::
 
 void ApplicationInstance::GetBatteryUsageInfo(const picojson::value& args, picojson::object& out) {
   LoggerD("Entered");
-#ifdef TIZEN_MOBILE
   CHECK_PRIVILEGE_ACCESS(kPrivilegeAppHistoryRead, &out);
 
   manager_.GetBatteryUsageInfo(args, &out);
-#else
-  LogAndReportError(PlatformResult(ErrorCode::NOT_SUPPORTED_ERR, "This feature is not supported on this profile."), &out,
-                    ("NOT_SUPPORTED_ERR: This feature is not supported on this profile"));
-  return;
-#endif
 }
 
 void ApplicationInstance::AddAppInfoEventListener(const picojson::value& args, picojson::object& out) {
index 8a33081cfbc5bd59ab715e76a26e88feb1f1cc7c..8af357a9324637b3d6d1c931d687a5fe4db5607f 100755 (executable)
@@ -29,7 +29,9 @@
 #include <bundle_internal.h>
 #include <appsvc.h>
 #include <app_control_internal.h>
+#ifdef TIZEN_MOBILE
 #include <context-service/context_history.h>
+#endif
 
 #include "common/current_application.h"
 #include "common/logger.h"
@@ -1159,6 +1161,7 @@ void ApplicationManager::GetAppSharedUri(const std::string& app_id, picojson::ob
 void ApplicationManager::GetBatteryUsageInfo(const picojson::value& args, picojson::object* out) {
   LoggerD("Entered");
 
+#ifdef TIZEN_MOBILE
   context_history_list_h list = nullptr;
   context_history_h handle = nullptr;
   context_history_filter_h filter = nullptr;
@@ -1274,6 +1277,11 @@ void ApplicationManager::GetBatteryUsageInfo(const picojson::value& args, picojs
     }
   }
   ReportSuccess(result_array, *out);
+#else
+  // 20170510 Context API is supported only for mobile profile, other ones would result with NotSupportedError
+  LogAndReportError(PlatformResult(ErrorCode::NOT_SUPPORTED_ERR, "This feature is not supported on this profile."), out,
+                    ("NOT_SUPPORTED_ERR: This feature is not supported on this profile"));
+#endif
 }
 
 void ApplicationManager::GetAppMetaData(const std::string& app_id, picojson::object* out) {