From f9bb113dda5661ea0cc2c19af7adb5c80e3c9b80 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 21 Feb 2022 19:28:42 +0900 Subject: [PATCH] Check AUL initialization If the aul_is_initialized() returns true, the OnCreate() function returns 0. Because, it means the aul_launch_init() function and the aul_launch_argv_handler() function are already called. Change-Id: Ia7e2be8e97c9d04429b0cc9fb65cf573713d741e Signed-off-by: Hwankyu Jhun --- legacy/src/base/appcore_base.c | 7 +++++++ tizen-cpp/app-core-cpp/app_core_base.cc | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/legacy/src/base/appcore_base.c b/legacy/src/base/appcore_base.c index bc59c73..01f7d09 100644 --- a/legacy/src/base/appcore_base.c +++ b/legacy/src/base/appcore_base.c @@ -92,6 +92,8 @@ static guint __suspend_dbus_handler_initialized; static char *__locale_dir; static appcore_base_rotation __rotation; +extern int aul_is_initialized(); + appcore_base_tizen_profile_t appcore_base_get_tizen_profile(void) { static appcore_base_tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN; @@ -1330,6 +1332,11 @@ EXPORT_API int appcore_base_on_create(void) { int r; + if (aul_is_initialized()) { + _ERR("Aul is already initialized"); + return 0; + } + r = aul_launch_init(__context.ops.receive, __context.data); if (r < 0 && r != AUL_R_ECANCELED) { _ERR("Aul init failed: %d", r); diff --git a/tizen-cpp/app-core-cpp/app_core_base.cc b/tizen-cpp/app-core-cpp/app_core_base.cc index 5adf51c..bfef0ff 100644 --- a/tizen-cpp/app-core-cpp/app_core_base.cc +++ b/tizen-cpp/app-core-cpp/app_core_base.cc @@ -45,6 +45,7 @@ #include "app-core-cpp/app_core_base.hh" #include "common/log_private.hh" +extern "C" int aul_is_initialized(); extern "C" void aul_finalize(); namespace tizen_cpp { @@ -626,6 +627,11 @@ int AppCoreBase::OnReceive(aul_type type, tizen_base::Bundle b) { } int AppCoreBase::OnCreate() { + if (aul_is_initialized()) { + _E("AUL is already initialized"); + return 0; + } + int ret = aul_launch_init([](aul_type type, bundle* b, void* data) -> int { AppCoreBase* base = reinterpret_cast(data); if (base->impl_->core_delegator_) { -- 2.7.4