Add new functions to add app group 30/240130/5
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 4 Aug 2020 00:23:11 +0000 (09:23 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Wed, 5 Aug 2020 04:51:49 +0000 (04:51 +0000)
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 <h.jhun@samsung.com>
include/aul_app_group.h
include/aul_cmd.h
include/aul_key.h
src/app_group.c
src/aul_cmd.c

index 67fa338..1eb8c44 100644 (file)
@@ -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
index 37ed230..7050cf9 100644 (file)
@@ -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
 };
index 80bd72b..039d0fb 100644 (file)
  * @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"
index 7941975..9b57c92 100644 (file)
@@ -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);
+}
index 6a58bfb..110f31d 100755 (executable)
@@ -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"
        };