[Application] Extending Native Context History API usage to wearable profile 26/154726/3
authorSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Wed, 11 Oct 2017 07:32:02 +0000 (09:32 +0200)
committerSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Wed, 11 Oct 2017 09:59:22 +0000 (09:59 +0000)
Currently getBatteryUsageInfo() and getAppsUsageInfo() methods are
available only on mobile profile.

[Verification] Tested manually in console. Both methods seem to work properly.

Change-Id: Ifc1835054281d995ade4859546aa981e5d289bdf
Signed-off-by: Szymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
src/application/application.gyp
src/application/application_manager.cc
src/application/application_manager.h

index 38d04d045fcc5df0f909ed8fba12bd019b903c50..29acdf2fc6e0a5c2071304dfd7fef2b2e3104f29 100644 (file)
@@ -43,7 +43,7 @@
             ]
           },
         }],
-        ['extension_host_os == "mobile"', {
+        ['extension_host_os == "mobile" or extension_host_os == "wearable"', {
           'variables': {
             'packages': [
               'capi-context',
index a5e69f90681a3b98182abf80acbf077a37f2b504..a8dded06dc8118ffd1fc21644160bdff912542ad 100644 (file)
@@ -97,7 +97,7 @@ const std::map<std::string, std::string> event_map_ = {
     {SYSTEM_EVENT_DATA_ROAMING_STATE, EVENT_KEY_DATA_ROAMING_STATE},
     {SYSTEM_EVENT_FONT_SET, EVENT_KEY_FONT_SET}};
 
-#ifdef TIZEN_MOBILE
+#if defined(TIZEN_MOBILE) || defined(TIZEN_WEARABLE)
 const int kMaximumBatteryRetrievedObjects = 30;
 const int kMaximumAppsRetrievedObjects = 10;
 const int kDefaultPeriodOfTime = 30;
@@ -1175,7 +1175,7 @@ void ApplicationManager::GetAppSharedUri(const std::string& app_id, picojson::ob
   ReportSuccess(result, *out);
 }
 
-#ifdef TIZEN_MOBILE
+#if defined(TIZEN_MOBILE) || defined(TIZEN_WEARABLE)
 PlatformResult ApplicationManager::BatteryUsageFilter(const picojson::value& args,
                                                       const context_history_filter_h filter,
                                                       context_history_data_e* data_type_out) {
@@ -1363,7 +1363,7 @@ PlatformResult ApplicationManager::AppsUsageAttributes(const context_history_rec
 void ApplicationManager::GetBatteryUsageInfo(const picojson::value& args, picojson::object* out) {
   LoggerD("Entered");
 
-#ifdef TIZEN_MOBILE
+#if defined(TIZEN_MOBILE) || defined(TIZEN_WEARABLE)
   int callback_id = -1;
   const auto& callback = args.get(kCallbackId);
   if (callback.is<double>()) {
@@ -1404,7 +1404,7 @@ void ApplicationManager::GetBatteryUsageInfo(const picojson::value& args, picojs
 void ApplicationManager::GetAppsUsageInfo(const picojson::value& args, picojson::object* out) {
   LoggerD("Entered");
 
-#ifdef TIZEN_MOBILE
+#if defined(TIZEN_MOBILE) || defined(TIZEN_WEARABLE)
   int callback_id = static_cast<int>(args.get(kCallbackId).get<double>());
 
   auto get_apps_usage = [args](const std::shared_ptr<picojson::value>& response) -> void {
@@ -1956,7 +1956,7 @@ void ApplicationManager::OnStatusEvent(const char* type, const char* app_id,
   manager->status_callback_(&event);
 }
 
-#ifdef TIZEN_MOBILE
+#if defined(TIZEN_MOBILE) || defined(TIZEN_WEARABLE)
 PlatformResult ApplicationManager::GetContextHistory(
     const picojson::value& args, picojson::object* out,
     common::PlatformResult (*modify_filter_cb)(const picojson::value&,
index 6bb4eccc6d6ef63c34f133886529bc876f7b6909..c1fa8ad2f54e1e0842687213845c338f13ca1514 100644 (file)
 #include <functional>
 #include <memory>
 #include <string>
-#ifdef TIZEN_MOBILE
+#if defined(TIZEN_MOBILE)
 #include <context-service/context_history.h>
+#elif defined(TIZEN_WEARABLE)
+#include <context-service/wearable/context_history.h>
 #endif
 
 #include "common/picojson.h"
@@ -88,7 +90,7 @@ class ApplicationManager {
                             app_manager_event_state_e event_state, app_manager_event_h handle,
                             void* user_data);
 
-#ifdef TIZEN_MOBILE
+#if defined(TIZEN_MOBILE) || defined(TIZEN_WEARABLE)
   static common::PlatformResult GetContextHistory(
       const picojson::value& args, picojson::object* out,
       common::PlatformResult (*)(const picojson::value&, const context_history_filter_h,