Fix watch holder launch interface 76/224276/6
authorhyunho <hhstark.kang@samsung.com>
Fri, 7 Feb 2020 09:36:54 +0000 (18:36 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Mon, 10 Feb 2020 09:40:01 +0000 (09:40 +0000)
Change-Id: I44b7ec47ba8e84a651ae546af9ba4ffd97e19f71
Signed-off-by: hyunho <hhstark.kang@samsung.com>
watch-holder/api/watch_holder.cc
watch-holder/api/watch_holder.h
watch-holder/src/watch_holder.cc
watch-holder/src/watch_holder.hh

index 6a9ff35..6a1cd81 100644 (file)
@@ -98,11 +98,11 @@ C_EXPORT int watch_holder_destroy(watch_holder_h handle) {
   return WATCH_HOLDER_ERROR_NONE;
 }
 
-C_EXPORT int watch_holder_launch(watch_holder_h handle, bool background, app_control_h control) {
-  if (handle == nullptr)
+C_EXPORT int watch_holder_launch(watch_holder_h handle, bool background, const char *appid, bundle *extra) {
+  if (handle == nullptr || appid == nullptr)
     return WATCH_HOLDER_ERROR_INVALID_PARAMETER;
 
-  return handle->Launch(control, background, nullptr);
+  return handle->Launch(std::string(appid), background, extra);
 }
 
 C_EXPORT int watch_holder_enable_rendering(watch_holder_h handle) {
index 850e929..94bda42 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <app_control.h>
 #include <Evas.h>
+#include <bundle.h>
 
 #include "watch.h"
 
@@ -47,7 +48,7 @@ int watch_holder_create(Evas_Object *viewer_win, watch_holder_h *handle);
 
 int watch_holder_destroy(watch_holder_h handle);
 
-int watch_holder_launch(watch_holder_h handle, bool background, app_control_h control);
+int watch_holder_launch(watch_holder_h handle, bool background, const char *appid, bundle *extra);
 
 int watch_holder_enable_rendering(watch_holder_h handle);
 
index 7f0c7eb..900145d 100644 (file)
@@ -16,7 +16,9 @@
 #include <aul.h>
 #include <dlog.h>
 #include <app_control_internal.h>
+#include <app_control.h>
 #include <appsvc.h>
+#include <aul_svc.h>
 
 #include "watch_holder.hh"
 #include "bundle_cpp.h"
@@ -31,6 +33,7 @@ using namespace tizen_base;
 using namespace std;
 namespace watch_holder {
 
+WatchHolder::~WatchHolder() = default;
 WatchHolder::WatchHolder(Evas_Object* win) : win_(win) {
   if (aul_app_com_create("watch.dead", nullptr,
       OnDeadSignal, this, &dead_signal_conn_) != AUL_R_OK) {
@@ -51,16 +54,17 @@ WatchHolder::WatchHolder(Evas_Object* win) : win_(win) {
 }
 
 int WatchHolder::Launch(
-    app_control_h control, bool background, bundle* extra) {
+    string watch_appid, bool background, bundle* extra) {
   Evas_Coord x, y, w, h;
   evas_object_geometry_get(win_, &x, &y, &w, &h);
-       app_control_add_extra_data(control, "WATCH_WIDTH", std::to_string(w).c_str());
-  app_control_add_extra_data(control, "WATCH_HEIGHT", std::to_string(h).c_str());
-
-  bundle* data;
-  app_control_to_bundle(control, &data);
-  bundle_add_str(data, AUL_K_WIDGET_VIEWER, appid_.c_str());
-  int pid = appsvc_run_service(data, 0, nullptr, nullptr);
+  Bundle data;
+  if (extra != nullptr)
+    data = Bundle(extra, true, true);
+  aul_svc_set_appid(data.GetHandle(), watch_appid.c_str());
+  data.Add("WATCH_WIDTH", std::to_string(w));
+  data.Add("WATCH_HEIGHT", std::to_string(h));
+  data.Add(AUL_K_WIDGET_VIEWER, appid_);
+  int pid = appsvc_run_service(data.GetHandle(), 0, nullptr, nullptr);
   if (pid < 0) {
     LOGE("Fail to run watch (%d)", pid);
     return -1;
@@ -85,12 +89,12 @@ std::shared_ptr<Watch> WatchHolder::GetCurrent() const {
 }
 
 int WatchHolder::OnDeadSignal(const char *endpoint, aul_app_com_result_e e,
-               bundle *envelope, void *user_data) {
+    bundle *envelope, void *user_data) {
   return 0;
 }
 
 int WatchHolder::OnLaunchSignal(const char *endpoint,
-               aul_app_com_result_e res, bundle *envelope, void *user_data) {
+    aul_app_com_result_e res, bundle *envelope, void *user_data) {
   Bundle launch_data(envelope, false, false);
   WatchHolder* holder = (WatchHolder*)user_data;
 
index 7fd65c3..dbc2b94 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <Evas.h>
 #include <bundle.h>
-#include <app_control.h>
 #include <aul_app_com.h>
 
 #include "watch.hh"
@@ -35,7 +34,7 @@ class EXPORT_API WatchHolder : public Watch::IEvent {
  public:
   WatchHolder(Evas_Object* win);
   virtual ~WatchHolder() = 0;
-  int Launch(app_control_h control, bool background, bundle* extra);
+  int Launch(std::string appid, bool background, bundle* extra);
   void EnableRendering();
   void DisableRendering(int timeout);
   const std::list<std::shared_ptr<Watch>>& GetStack() const;