From 72be72d258b24896a16e099e27d9d0dc550d611e Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 4 Aug 2020 09:23:11 +0900 Subject: Add new functions to add app group The application can add a new app group to the app group. The window will be attached to the app group of the main window. Adds: - aul_app_group_add() - aul_app_group_remove() Change-Id: I5432e2fa5d3e6354d4e6e4c2d2b70034cdfc6113 Signed-off-by: Hwankyu Jhun --- include/aul_app_group.h | 25 +++++++++++++++++++++++++ include/aul_cmd.h | 2 ++ include/aul_key.h | 8 ++++++++ src/app_group.c | 35 +++++++++++++++++++++++++++++++++++ src/aul_cmd.c | 2 ++ 5 files changed, 72 insertions(+) diff --git a/include/aul_app_group.h b/include/aul_app_group.h index 67fa3387..1eb8c44d 100644 --- a/include/aul_app_group.h +++ b/include/aul_app_group.h @@ -196,6 +196,31 @@ int aul_app_group_set_window_v2(const char *id, int wid); */ int aul_app_group_lower_v2(const char *id, bool *exit); +/** + * @brief Adds a new app group to the app group. + * @details A new app group will be added using the given window ID. + * @since_tizen 6.0 + * + * @param[in] wid The window(surface) ID + * @return @c 0 on success, + * otherwise a negatvie error value + * + * @remarks This function is only for App Framework internally. + */ +int aul_app_group_add(int wid); + +/** + * @brief Removes the app group using the given window ID. + * @since_tizen 6.0 + * + * @param[in] wid The window(surface) ID + * @return @c 0 on success, + * otherwise a negative error value + * + * @remarks This function is only for App Framework internally. + */ +int aul_app_group_remove(int wid); + #ifdef __cplusplus } #endif diff --git a/include/aul_cmd.h b/include/aul_cmd.h index 37ed2301..7050cf95 100644 --- a/include/aul_cmd.h +++ b/include/aul_cmd.h @@ -186,6 +186,8 @@ enum app_cmd { APP_CONTEXT_GET = 146, APP_CONTEXT_GET_BY_INSTANCE_ID = 147, APP_CONTEXT_GET_BY_PID = 148, + APP_GROUP_ADD = 149, + APP_GROUP_REMOVE = 150, APP_CMD_MAX }; diff --git a/include/aul_key.h b/include/aul_key.h index 80bd72b6..039d0fb9 100644 --- a/include/aul_key.h +++ b/include/aul_key.h @@ -775,3 +775,11 @@ * @since_tizen 5.5 */ #define AUL_K_EVENT_DATA "__AUL_EVENT_DATA__" + +/** + * @brief Definition for AUL: The value for supporting positioning of the app group. + * @details If the key exists, the callee app group will be inserted into + * the app group before the given position. + * @since_tizen 6.0 + */ +#define AUL_K_INSERT_BEFORE_WINDOW "__K_INSERT_BEFORE_WINDOW" diff --git a/src/app_group.c b/src/app_group.c index 7941975b..9b57c92e 100644 --- a/src/app_group.c +++ b/src/app_group.c @@ -661,3 +661,38 @@ API int aul_app_group_info_get_status(aul_app_group_info_h h, int *status) return AUL_R_OK; } + +static int __send_cmd_with_wid(int cmd, int wid) +{ + char buf[12]; + bundle *b; + int ret; + + if (wid <= 0) { + _E("Invalid parameter"); + return AUL_R_EINVAL; + } + + b = bundle_create(); + if (!b) { + _E("Out of memory"); + return AUL_R_ENOMEM; + } + + snprintf(buf, sizeof(buf), "%d", wid); + bundle_add(b, AUL_K_WID, buf); + + ret = app_send_cmd_with_noreply(AUL_UTIL_PID, cmd, b); + bundle_free(b); + return ret; +} + +API int aul_app_group_add(int wid) +{ + return __send_cmd_with_wid(APP_GROUP_ADD, wid); +} + +API int aul_app_group_remove(int wid) +{ + return __send_cmd_with_wid(APP_GROUP_REMOVE, wid); +} diff --git a/src/aul_cmd.c b/src/aul_cmd.c index 6a58bfb4..110f31d7 100755 --- a/src/aul_cmd.c +++ b/src/aul_cmd.c @@ -188,6 +188,8 @@ API const char *aul_cmd_convert_to_string(int cmd) "APP_CONTEXT_GET", "APP_CONTEXT_GET_BY_INSTANCE_ID", "APP_CONTEXT_GET_BY_PID", + "APP_GROUP_ADD", + "APP_GROUP_REMOVE", "CUSTOM_COMMAND" }; -- cgit v1.2.3