RPC_PORT_DESTROY = 166,
RPC_PORT_EXIST = 167,
APP_WINDOW_ATTACH_BELOW = 168,
+ PROC_GROUP_ADD = 169,
+ PROC_GROUP_REMOVE = 170,
APP_CMD_MAX
};
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AUL_PROC_GROUP_H__
+#define __AUL_RPOC_GROUP_H__
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <aul.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Adds the process to the process group.
+ * @remarks This function is only for App Framework internally.
+ * @remarks If the pid is not equal to the process ID of the caller,
+ * the caller MUST have a permission that is signed by platform certificate.
+ * If the caller doesn't have the permission, the function returns AUL_R_EILLACC.
+ * @since_tizen 6.5
+ * @param[in] pid The process ID
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_R_OK Successful
+ * @retval #AUL_R_EINVAL Invalid parameter
+ * @retval #AUL_R_ECOMM Communication error on send
+ * @retval #AUL_R_EILLACC Permission denied
+ */
+int aul_proc_group_add(pid_t pid);
+
+/**
+ * @brief Removes the process from the process group.
+ * @remarks This function is only for App Framework internally.
+ * @remarks If the pid is not equal to the process ID of the caller,
+ * the caller MUST have a permission that is signed by platform certificate.
+ * If the caller doesn't have the permission, the function returns AUL_R_EILLACC.
+ * @since_tizen 6.5
+ * @param[in] pid The process ID
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_R_OK Successful
+ * @retval #AUL_R_EINVAL Invalid parameter
+ * @retval #AUL_R_ECOMM Communication error on send
+ * @retval #AUL_R_EILLACC Permission denied
+ */
+int aul_proc_group_remove(pid_t pid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AUL_PROC_GROUP_H__ */
"RPC_PORT_DESTROY",
"RPC_PORT_EXIST",
"APP_WINDOW_ATTACH_BELOW",
+ "PROC_GROUP_ADD",
+ "PROC_GROUP_REMOVE",
"CUSTOM_COMMAND"
};
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul_proc_group.h"
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "app_request.h"
+#include "aul_api.h"
+#include "aul_util.h"
+#include "include/aul_error.h"
+#include "include/aul_sock.h"
+
+using namespace aul;
+using namespace aul::internal;
+
+extern "C" API int aul_proc_group_add(pid_t pid) {
+ if (pid < 1) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ int ret = AppRequest(PROC_GROUP_ADD, getuid())
+ .SetPid(pid)
+ .SendSimply();
+ if (ret < 0) {
+ _E("Failed to send the request. error(%d)", ret);
+ return aul_error_convert(ret);
+ }
+
+ return AUL_R_OK;
+}
+
+extern "C" API int aul_proc_group_remove(pid_t pid) {
+ if (pid < 1) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ int ret = AppRequest(PROC_GROUP_REMOVE, getuid())
+ .SetPid(pid)
+ .SendSimply();
+ if (ret < 0) {
+ _E("Failed to send the request. error(%d)", ret);
+ return aul_error_convert(ret);
+ }
+
+ return AUL_R_OK;
+}
#include "aul/api/aul_app_lifecycle.h"
#include "aul_svc.h"
#include "aul_proc.h"
+#include "aul_proc_group.h"
#include "menu_db_util.h"
#define MAX_LOCAL_BUFSZ 128
return ret;
}
+static int add_proc_group_test(void)
+{
+ int ret;
+
+ printf("[aul_proc_group_add] %s\n", gargv[2]);
+ ret = aul_proc_group_add(atoi(gargv[2]));
+
+ return ret;
+}
+
+static int remove_proc_group_test(void)
+{
+ int ret;
+
+ printf("[aul_proc_group_remove] %s\n", gargv[2]);
+ ret = aul_proc_group_remove(atoi(gargv[2]));
+
+ return ret;
+}
+
static int test_regex()
{
char *token;
"[usage] get_proc_name <pid>"},
{"get_proc_extra", get_proc_extra_test, "aul_proc_get_extra",
"[usage] get_proc_extra <pid>"},
+ {"add_proc_group", add_proc_group_test, "aul_proc_group_add",
+ "[usage] add_proc_group <pid>"},
+ {"remove_proc_group", remove_proc_group_test, "aul_proc_group_remove",
+ "[usage] remove_proc_group <pid>"},
};
int callfunc(char *testname)