Check AUL initialization 49/271449/1
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 21 Feb 2022 10:28:42 +0000 (19:28 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 21 Feb 2022 10:28:42 +0000 (19:28 +0900)
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 <h.jhun@samsung.com>
legacy/src/base/appcore_base.c
tizen-cpp/app-core-cpp/app_core_base.cc

index bc59c73..01f7d09 100644 (file)
@@ -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);
index 5adf51c..bfef0ff 100644 (file)
@@ -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<AppCoreBase*>(data);
         if (base->impl_->core_delegator_) {