summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2019-07-03 19:30:38 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2019-07-05 10:46:30 +0900
commitb812b45021368e35adf94af4c53f9222ab37f31d (patch)
treea3692b537a992c11761d0e3e9f4c65bcafaa45b3
parent350ac2c2bc51309aaebe1e601965e1ac7cb0292d (diff)
downloadaul-1-tizen_4.0.tar.gz
aul-1-tizen_4.0.tar.bz2
aul-1-tizen_4.0.zip
Support AUL watch controltizen_4.0
To enable manual render, the entry point of the app-control callback is needed. The aul_watch_control_cb() callback function is called before calling the app_control_cb() callback function. Adds: - aul_watch_control_add_handler() - aul_watch_control_remove_handler() Change-Id: I14443adf62a905d5887118be9f313f689ae9df11 Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--include/aul_watch_control.h81
-rw-r--r--src/aul_watch_control.c90
-rw-r--r--src/aul_watch_control_internal.h32
-rwxr-xr-xsrc/launch.c2
5 files changed, 206 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9281a9dd..763e4897 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,6 +64,7 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_job_scheduler.h DESTINATIO
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_rpc_port.h DESTINATION include/aul)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_debug_info.h DESTINATION include/aul)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_watchdog.h DESTINATION include/aul)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_watch_control.h DESTINATION include/aul)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/aul.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/feature/preexec_list.txt DESTINATION ${SHARE_INSTALL_PREFIX}/aul )
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/miregex DESTINATION ${SHARE_INSTALL_PREFIX}/aul )
diff --git a/include/aul_watch_control.h b/include/aul_watch_control.h
new file mode 100644
index 00000000..e6c8fd9d
--- /dev/null
+++ b/include/aul_watch_control.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2019 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_WATCH_CONTROL_H__
+#define __AUL_WATCH_CONTROL_H__
+
+#include <bundle.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The watch control handle.
+ * @since_tizen 5.5
+ */
+typedef void *aul_watch_control_h;
+
+/**
+ * @brief Called when another application sends a launch request to the application.
+ * @details Before calling app_control_cb() function, this callback function is called.
+ * @since_tizen 5.5
+ *
+ * @param[in] b The bundle object
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see aul_watch_control_add_handler()
+ *
+ * @remarks This is only for App Framework internally.
+ */
+typedef void (*aul_watch_control_cb)(bundle *b, void *user_data);
+
+/**
+ * @brief Adds the watch control handle.
+ * @since_tizen 5.5
+ *
+ * @param[in] callback The callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] handle The watch control handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @see aul_watch_control_remove_handler()
+ * @see aul_watch_control_cb()
+ *
+ * @remarks This is only for App Framework internally.
+ */
+int aul_watch_control_add_handler(aul_watch_control_cb callback,
+ void *user_data, aul_watch_control_h *handle);
+
+/**
+ * @brief Removes registered watch control handle.
+ * @since_tizen 5.5
+ *
+ * @param[in] handle The watch control handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @see aul_watch_control_add_handler()
+ *
+ * @remarks This is only for App Framework internally.
+ */
+int aul_watch_control_remove_handler(aul_watch_control_h handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AUL_WATCH_CONTROL_H__ */
diff --git a/src/aul_watch_control.c b/src/aul_watch_control.c
new file mode 100644
index 00000000..f9d57961
--- /dev/null
+++ b/src/aul_watch_control.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2019 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.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include "aul.h"
+#include "aul_api.h"
+#include "aul_util.h"
+#include "aul_watch_control.h"
+#include "aul_watch_control_internal.h"
+
+struct aul_watch_control_s {
+ aul_watch_control_cb callback;
+ void *user_data;
+};
+
+static GList *__controls;
+
+API int aul_watch_control_add_handler(aul_watch_control_cb callback,
+ void *user_data, aul_watch_control_h *handle)
+{
+ struct aul_watch_control_s *control;
+
+ if (!callback || !handle) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ control = calloc(1, sizeof(struct aul_watch_control_s));
+ if (!control) {
+ _E("Out of memory");
+ return AUL_R_ERROR;
+ }
+
+ control->callback = callback;
+ control->user_data = user_data;
+
+ __controls = g_list_append(__controls, control);
+
+ *handle = control;
+
+ return AUL_R_OK;
+}
+
+API int aul_watch_control_remove_handler(aul_watch_control_h handle)
+{
+ if (!handle || !g_list_find(__controls, handle)) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ __controls = g_list_remove(__controls, handle);
+ free(handle);
+
+ return AUL_R_OK;
+}
+
+static void __foreach_control_cb(gpointer data, gpointer user_data)
+{
+ struct aul_watch_control_s *control;
+ bundle *b = (bundle *)user_data;
+
+ control = (struct aul_watch_control_s *)data;
+ control->callback(b, control->user_data);
+}
+
+void aul_watch_control_invoke(bundle *b)
+{
+ if (!__controls)
+ return;
+
+ g_list_foreach(__controls, __foreach_control_cb, b);
+}
diff --git a/src/aul_watch_control_internal.h b/src/aul_watch_control_internal.h
new file mode 100644
index 00000000..cc3d3b6e
--- /dev/null
+++ b/src/aul_watch_control_internal.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2019 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_WATCH_CONTROL_INTENRAL_H__
+#define __AUL_WATCH_CONTROL_INTERNAL_H__
+
+#include <bundle.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void aul_watch_control_invoke(bundle *b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AUL_WATCH_CONTROL_INTERNAL_H__ */
diff --git a/src/launch.c b/src/launch.c
index 188c24b3..a88b7b79 100755
--- a/src/launch.c
+++ b/src/launch.c
@@ -39,6 +39,7 @@
#include "key.h"
#include "aul_app_com.h"
#include "aul_error.h"
+#include "aul_watch_control_internal.h"
#define TEP_ISMOUNT_MAX_RETRY_CNT 20
@@ -79,6 +80,7 @@ int app_start(bundle *kb)
const char *str = NULL;
_app_start_res_prepare(kb);
+ aul_watch_control_invoke(kb);
__call_aul_handler(AUL_START, kb);
/* Handle the DataControl callback */
str = bundle_get_val(kb, AUL_K_DATA_CONTROL_TYPE);