From 2babdcb632db998233f53f3bfbe5e68c63a34e99 Mon Sep 17 00:00:00 2001 From: hyunho Date: Fri, 7 Feb 2020 18:36:54 +0900 Subject: [PATCH] Fix watch holder launch interface Change-Id: I44b7ec47ba8e84a651ae546af9ba4ffd97e19f71 Signed-off-by: hyunho --- watch-holder/api/watch_holder.cc | 6 +++--- watch-holder/api/watch_holder.h | 3 ++- watch-holder/src/watch_holder.cc | 24 ++++++++++++++---------- watch-holder/src/watch_holder.hh | 3 +-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/watch-holder/api/watch_holder.cc b/watch-holder/api/watch_holder.cc index 6a9ff35..6a1cd81 100644 --- a/watch-holder/api/watch_holder.cc +++ b/watch-holder/api/watch_holder.cc @@ -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) { diff --git a/watch-holder/api/watch_holder.h b/watch-holder/api/watch_holder.h index 850e929..94bda42 100644 --- a/watch-holder/api/watch_holder.h +++ b/watch-holder/api/watch_holder.h @@ -19,6 +19,7 @@ #include #include +#include #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); diff --git a/watch-holder/src/watch_holder.cc b/watch-holder/src/watch_holder.cc index 7f0c7eb..900145d 100644 --- a/watch-holder/src/watch_holder.cc +++ b/watch-holder/src/watch_holder.cc @@ -16,7 +16,9 @@ #include #include #include +#include #include +#include #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 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; diff --git a/watch-holder/src/watch_holder.hh b/watch-holder/src/watch_holder.hh index 7fd65c3..dbc2b94 100644 --- a/watch-holder/src/watch_holder.hh +++ b/watch-holder/src/watch_holder.hh @@ -23,7 +23,6 @@ #include #include -#include #include #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>& GetStack() const; -- 2.7.4