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) {
#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"
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) {
}
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;
}
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;