Add a new API to attach window below parent window 14/261414/3
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 19 Jul 2021 02:19:24 +0000 (11:19 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Wed, 21 Jul 2021 05:37:11 +0000 (05:37 +0000)
The function attaches the child window below the parent window.

Adds:
 - aul_window_attach_window_below();

Change-Id: Ib3c2bc624617eda94d272b81e5aad07fe64f17e9
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
include/aul_cmd.h
include/aul_window.h
src/aul_cmd.c
src/aul_window.cc
tool/aul_window/aul_window.cc

index 305c4fe..f9bbadd 100644 (file)
@@ -209,6 +209,7 @@ enum app_cmd {
 
        RPC_PORT_DESTROY = 166,
        RPC_PORT_EXIST = 167,
+       APP_WINDOW_ATTACH_BELOW = 168,
 
        APP_CMD_MAX
 };
index 561e005..5012ef8 100644 (file)
@@ -229,6 +229,19 @@ int aul_window_detach(const char *child_appid);
  */
 int aul_window_info_get_opaque(aul_window_info_h info, bool *opaque);
 
+/**
+ * @brief Attach the window below the window of the parent application.
+ * @since_tizen 6.5
+ * @remarks This function is only available for platform level signed applications.
+ *
+ * @param[in]   parent_appid    The application ID of the parent
+ * @param[in]   child_appid     The application ID of the child
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @remarks This function is only for App Framework internally.
+ */
+int aul_window_attach_below(const char *parent_appid, const char *child_appid);
+
 #ifdef __cplusplus
 }
 #endif
index 2c9a1c2..540881f 100644 (file)
@@ -211,6 +211,7 @@ API const char *aul_cmd_convert_to_string(int cmd)
 
                "RPC_PORT_DESTROY",
                "RPC_PORT_EXIST",
+               "APP_WINDOW_ATTACH_BELOW",
 
                "CUSTOM_COMMAND"
        };
index ec5c224..aa09949 100644 (file)
@@ -477,3 +477,25 @@ extern "C" API int aul_window_detach(const char* child_appid) {
 
   return AUL_R_OK;
 }
+
+extern "C" API int aul_window_attach_below(const char* parent_appid,
+    const char* child_appid) {
+  if (parent_appid == nullptr || child_appid == nullptr) {
+    _E("Invalid parameter");
+    return AUL_R_EINVAL;
+  }
+
+  tizen_base::Bundle b {
+    { AUL_K_PARENT_APPID, parent_appid },
+    { AUL_K_CHILD_APPID, child_appid }
+  };
+  int ret = AppRequest(APP_WINDOW_ATTACH_BELOW, getuid())
+      .With(b)
+      .SendSimply();
+  if (ret < 0) {
+    _E("Failed to send request. error(%d)", ret);
+    return ret;
+  }
+
+  return AUL_R_OK;
+}
index 38fea00..a3c9cad 100644 (file)
@@ -33,6 +33,7 @@ void PrintUsage(const char* cmdline) {
   printf("   get_focused_pid\n");
   printf("   attach_window <parent_appid> <child_appid>\n");
   printf("   detach_window <child_appid>\n");
+  printf("   attach_window_below <parent_appid> <child_appid>\n");
 }
 
 const char* GetNotificationLevelString(aul_window_notification_level_e level) {
@@ -138,11 +139,24 @@ int HandleDetachWindow(int argc, char** argv) {
   return ret;
 }
 
+int HandleAttachWindowBelow(int argc, char** argv) {
+  if (argc < 4) {
+    PrintUsage(argv[0]);
+    return -1;
+  }
+
+  printf("[%s] parent_appid(%s), child_appid(%s)\n", argv[1], argv[2], argv[3]);
+  int ret = aul_window_attach_below(argv[2], argv[3]);
+  printf("[%s] result: %d\n", argv[1], ret);
+  return ret;
+}
+
 std::map<std::string, HandleFunc> handlers = {
   { "foreach_window_stack", HandleForeachWindowStack },
   { "get_focused_pid", HandleGetFocusedPid },
   { "attach_window", HandleAttachWindow },
   { "detach_window", HandleDetachWindow },
+  { "attach_window_below", HandleAttachWindowBelow },
 };
 
 }  // namespace