Add api for send widget status change request 27/155527/2
authorHyunho Kang <hhstark.kang@samsung.com>
Fri, 13 Oct 2017 10:51:28 +0000 (19:51 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Fri, 13 Oct 2017 10:53:51 +0000 (10:53 +0000)
https://review.tizen.org/gerrit/#/c/155525/ (appcore-widget)
https://review.tizen.org/gerrit/#/c/155526/ (amd)
https://review.tizen.org/gerrit/#/c/155527/ (aul-1)

Change-Id: I26f330ac8058513f4c9c68bb2d4beee9d8aa720a
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
include/aul_cmd.h
include/aul_widget.h
src/widget.c

index f39bdf4..c6ff097 100644 (file)
@@ -127,6 +127,7 @@ enum app_cmd {
        UPDATE_SCREEN_VIEWER_STATUS = 96,
        WIDGET_RUNNING_INFO = 97,
        JOB_STATUS_UPDATE = 98,
+       WIDGET_CHANGE_STATUS = 99,
 
        APP_CMD_MAX
 };
index 892d081..ec45fa1 100755 (executable)
@@ -128,6 +128,16 @@ int aul_widget_info_get_package_id(aul_widget_info_h info, char **package_id);
  */
 int aul_widget_info_get_app_path(aul_widget_info_h info, char **app_path);
 
+/**
+ * @par Description:
+ *      Change app status.
+ * @param[in]   widget_id      The widget app id
+ * @param[in]   status         The widget app status
+ * @return      @c 0 on success,
+ *              otherwise a negative error value
+ */
+int aul_widget_instance_change_status(const char *widget_id, const char *status);
+
 #ifdef __cplusplus
 }
 #endif
index 18de67b..1b9a22a 100644 (file)
@@ -506,3 +506,29 @@ API int aul_widget_info_get_app_path(aul_widget_info_h info, char **app_path)
 
        return AUL_R_OK;
 }
+
+API int aul_widget_instance_change_status(const char *widget_id,
+               const char *status)
+{
+       int ret;
+       bundle *kb;
+
+       kb = bundle_create();
+       if (kb == NULL) {
+               _E("out of memory");
+               return AUL_R_ERROR;
+       }
+
+       bundle_add_str(kb, AUL_K_STATUS, status);
+       bundle_add_str(kb, AUL_K_WIDGET_ID, widget_id);
+       ret = aul_sock_send_bundle(AUL_UTIL_PID, getuid(),
+                       WIDGET_CHANGE_STATUS, kb, AUL_SOCK_ASYNC);
+
+       bundle_free(kb);
+       if (ret < 0) {
+               _E("send error %d, %s", ret, status);
+               return aul_error_convert(ret);
+       }
+
+       return AUL_R_OK;
+}