Add API for get setup-appid metadata 49/134949/1 accepted/tizen/3.0/ivi/20170630.081301 accepted/tizen/3.0/mobile/20170630.081150 accepted/tizen/3.0/tv/20170630.081207 accepted/tizen/3.0/wearable/20170630.081246 submit/tizen_3.0/20170621.082024
authorHyunho Kang <hhstark.kang@samsung.com>
Tue, 20 Jun 2017 10:23:00 +0000 (19:23 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Tue, 20 Jun 2017 10:23:46 +0000 (19:23 +0900)
- watch_manager_get_setup_appid

Change-Id: I536b583a09e084c6386507dd6cc6f84cd88224df
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
watch-control/include/watch_control.h
watch-control/src/control.c

index ed51a1ff7a62e00943b417673cfaa28d83f190f7..4808709a67cd8a08533a070355572e88262b8e27 100644 (file)
@@ -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
index 84408b4247a589faeadab2475a355d7af70f7228..ceb6290f7ed46e984d59bda87f7c34814d58e809 100644 (file)
@@ -27,6 +27,7 @@
 #include <Elementary.h>
 #include <system_info.h>
 #include <tbm_surface.h>
+#include <pkgmgr-info.h>
 
 #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;
+}