From 25cedf7e7e38e5ee3655031b4ae62fe0a2fda2d0 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Tue, 20 Jun 2017 19:23:00 +0900 Subject: [PATCH] Add API for get setup-appid metadata - watch_manager_get_setup_appid Change-Id: I536b583a09e084c6386507dd6cc6f84cd88224df Signed-off-by: Hyunho Kang --- watch-control/include/watch_control.h | 10 ++++++++++ watch-control/src/control.c | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/watch-control/include/watch_control.h b/watch-control/include/watch_control.h index ed51a1ff..4808709a 100644 --- a/watch-control/include/watch_control.h +++ b/watch-control/include/watch_control.h @@ -102,6 +102,16 @@ extern int watch_manager_window_bind(Evas_Object *win); */ extern int watch_manager_window_unbind(void); +/** + * @brief Gets watch's setup appid. + * @since_tizen 3.0 + * @remarks setup_appid should be freed. + * @param[in] app_id A watch app id + * @param[out] setup_appid A watch app id + * @return @c 0 on success, otherwise a negative error value + */ +extern int watch_manager_get_setup_appid(const char *app_id, char **setup_appid); + #ifdef __cplusplus } #endif diff --git a/watch-control/src/control.c b/watch-control/src/control.c index 84408b42..ceb6290f 100644 --- a/watch-control/src/control.c +++ b/watch-control/src/control.c @@ -27,6 +27,7 @@ #include #include #include +#include #define API __attribute__((visibility("default"))) @@ -42,6 +43,7 @@ #endif #define KEY_SCREEN_SHAPE_CIRCLE "http://tizen.org/feature/screen.shape.circle" +#define METADATA_SETUP_APPID "http://tizen.org/metadata/watch/setup-appid" static int __watch_viewer_initialized = 0; static int __watch_size_policy = WATCH_POLICY_HINT_EXPAND; @@ -431,3 +433,25 @@ API int watch_manager_window_unbind(void) return screen_connector_toolkit_evas_unbind(__toolkit); } +API int watch_manager_get_setup_appid(const char *app_id, char **setup_appid) +{ + int ret = 0; + pkgmgrinfo_appinfo_h handle; + char *tmp_appid = NULL; + + ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &handle); + if (ret != PMINFO_R_OK) + return -1; + + ret = pkgmgrinfo_appinfo_get_metadata_value(handle, METADATA_SETUP_APPID, &tmp_appid); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return -1; + } + + if (tmp_appid) + *setup_appid = strdup(tmp_appid); + + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return ret; +} -- 2.34.1