To enable/disable the watchdog timer, appcore uses aul watchdog APIs.
appcore watchdog APIs are added for application developers.
Adds:
- appcore_watchdog_enable()
- appcore_watchdog_disable()
- appcore_watchdog_kick()
Requires:
- https://review.tizen.org/gerrit/#/c/185276/ [aul-1]
- https://review.tizen.org/gerrit/#/c/185882/ [app-core]
- https://review.tizen.org/gerrit/#/c/185884/ [amd]
- https://review.tizen.org/gerrit/#/c/186247/ [app-common]
Change-Id: I1fc869aed8d54ed473f210eb81d95d25d67a0842
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
# Build appcore-common Library
# ------------------------------
SET(APPCORE_COMMON "appcore-common")
-SET(SRCS_common src/legacy/appcore.c src/legacy/appcore-measure.c src/legacy/appcore-rotation.c src/legacy/appcore-i18n.c src/base/appcore_base.c)
-
-SET(HEADERS_common appcore-common.h appcore_base.h)
+SET(SRCS_common
+ src/legacy/appcore.c
+ src/legacy/appcore-measure.c
+ src/legacy/appcore-rotation.c
+ src/legacy/appcore-i18n.c
+ src/base/appcore_base.c
+ src/watchdog/appcore_watchdog.c)
+
+SET(HEADERS_common
+ appcore-common.h
+ appcore_base.h
+ appcore_watchdog.h)
INCLUDE(FindPkgConfig)
SET(APPCORE_PKG_CHECK_MODULES "gio-2.0 vconf sensor aul dlog capi-system-info")
--- /dev/null
+/*
+ * Copyright (c) 2018 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 __APPCORE_WATCHDOG_H__
+#define __APPCORE_WATCHDOG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enables watchdog timer.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ */
+int appcore_watchdog_enable(void);
+
+/**
+ * @brief Disables watchdog timer.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ */
+int appcore_watchdog_disable(void);
+
+/**
+ * @brief Kicks watchdog timer.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ */
+int appcore_watchdog_kick(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __APPCORE_WATCHDOG_H__ */
%{_libdir}/pkgconfig/appcore-common.pc
%{_includedir}/appcore/appcore-common.h
%{_includedir}/appcore/appcore_base.h
+%{_includedir}/appcore/appcore_watchdog.h
%files ui
%manifest %{name}.manifest
#include <sensor_internal.h>
#include <ttrace.h>
#include <system_info.h>
+
#include "appcore_base.h"
#include "appcore_base_private.h"
+#include "appcore_watchdog.h"
#define PATH_LOCALE "locale"
#define RESOURCED_FREEZER_PATH "/Org/Tizen/ResourceD/Freezer"
if (__context.ops.set_i18n)
__context.ops.set_i18n(__context.data);
+ appcore_watchdog_enable();
+
if (__context.ops.create) {
traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:CREATE");
r = __context.ops.create(__context.data);
int i;
aul_status_update(STATUS_DYING);
+ appcore_watchdog_disable();
if (__context.ops.terminate) {
traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:TERMINATE");
__context.ops.terminate(__context.data);
--- /dev/null
+/*
+ * Copyright (c) 2018 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 <string.h>
+#include <stdbool.h>
+#include <glib.h>
+#include <aul.h>
+#include <aul_watchdog.h>
+
+#include "appcore_watchdog.h"
+#include "appcore_watchdog_private.h"
+
+EXPORT_API int appcore_watchdog_enable(void)
+{
+ _W("[__APPCORE_WATCHDOG__] enable");
+ return aul_watchdog_enable();
+}
+
+EXPORT_API int appcore_watchdog_disable(void)
+{
+ _W("[__APPCORE_WATCHDOG__] kick");
+ return aul_watchdog_disable();
+}
+
+EXPORT_API int appcore_watchdog_kick(void)
+{
+ _W("[__APPCORE_WATCHDOG__] kick");
+ return aul_watchdog_kick();
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 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 __APPCORE_WATCHDOG_PRIVATE_H__
+#define __APPCORE_WATCHDOG_PRIVATE_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "APP_CORE_WATCHDOG"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
+#endif
+
+#ifndef _E
+#define _E(fmt, arg...) LOGE(fmt, ##arg)
+#endif
+
+#ifndef _W
+#define _W(fmt, arg...) LOGW(fmt, ##arg)
+#endif
+
+#ifndef _I
+#define _I(fmt, arg...) LOGI(fmt, ##arg)
+#endif
+
+#ifndef _D
+#define _D(fmt, arg...) LOGD(fmt, ##arg)
+#endif
+
+#endif /* __APPCORE_WATCHDOG_PRIVATE_H__ */