Add functions for change application label 79/100579/3 submit/tizen_3.0/20161201.024001
authorJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 28 Nov 2016 12:01:23 +0000 (21:01 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 29 Nov 2016 06:33:47 +0000 (22:33 -0800)
Related changes:
[pkgmgr-server] : https://review.tizen.org/gerrit/100580

Change-Id: I806d2ab020b53159474676da13b2aff4270ba518
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
client/include/package-manager.h
client/src/pkgmgr.c

index d0722f379875c743d1c55c34c63e757edfd7aeee..11d60cf2b8943ae5f9b13e3c5aa656a3c93332fc 100644 (file)
@@ -1075,6 +1075,22 @@ int pkgmgr_client_usr_unset_pkg_restriction_mode(pkgmgr_client *pc, const char *
 int pkgmgr_client_get_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int *mode);
 int pkgmgr_client_usr_get_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int *mode, uid_t uid);
 
+/**
+ * @brief      Change application's label
+ *
+ * This API sets label of application specified.\n
+ *
+ * @param[in]  pc      The pointer to pkgmgr_client instance
+ * @param[in]  appid   app id to be changed.
+ * @param[in]  label   application's label to change.
+ * @param[out] mode    restriction mode bit
+ * @return     0 if success, error code(<0) if fail\n
+ * @retval     PKGMGR_R_OK     success
+ * @retval     PKGMGR_R_EINVAL invalid argument
+ * @retval     PKGMGR_R_ECOMM  communication error
+ */
+int pkgmgr_client_set_app_label(pkgmgr_client *pc, char *appid, char *label);
+int pkgmgr_client_usr_set_app_label(pkgmgr_client *pc, char *appid, char *label, uid_t uid);
 
 /** @} */
 
index 3a711d5f67e2a25083d0433dcede8f0e0a73f7e2..73aae94aa537831b3556824a46964bdacfcca1df 100644 (file)
@@ -2119,3 +2119,34 @@ API int pkgmgr_client_free_pkginfo(pkgmgr_info *info)
 
        return PKGMGR_R_OK;
 }
+
+API int pkgmgr_client_usr_set_app_label(pkgmgr_client *pc, char *appid,
+               char *label, uid_t uid)
+{
+       GVariant *result;
+       int ret = -1;
+       struct pkgmgr_client_t *client = (struct pkgmgr_client_t *)pc;
+
+       if (pc == NULL || appid == NULL || label == NULL) {
+               ERR("Invalid parameter");
+               return PKGMGR_R_EINVAL;
+       }
+
+       ret = pkgmgr_client_connection_send_request(client,
+                       "set_app_label",
+                       g_variant_new("(uss)", uid, appid, label), &result);
+       if (ret != PKGMGR_R_OK) {
+               ERR("Request failed: %d", ret);
+               return ret;
+       }
+
+       g_variant_get(result, "(i)", &ret);
+       g_variant_unref(result);
+
+       return ret;
+}
+
+API int pkgmgr_client_set_app_label(pkgmgr_client *pc, char *appid, char *label)
+{
+       return pkgmgr_client_usr_set_app_label(pc, appid, label, _getuid());
+}