make org.tizen.oobe start on boot 86/216686/6 accepted/tizen/unified/20191213.115121 submit/tizen/20191213.072546 submit/tpk/20191211.103649
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Wed, 30 Oct 2019 15:42:40 +0000 (16:42 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 6 Dec 2019 13:04:50 +0000 (14:04 +0100)
Change-Id: Iac9a28685c315456c66c529b1e946673e3e238db

CMakeLists.txt
include/common/oobe_mgr.h [new file with mode: 0644]
src/common/oobe_mgr.c [new file with mode: 0644]
src/common/starter.c

index b4ac2d0..8a96794 100644 (file)
@@ -173,6 +173,7 @@ SET(BUILD_SOURCE
        src/common/starter.c
        src/common/popup.c
        src/common/hw_key.c
+       src/common/oobe_mgr.c
 )
 
 ELSEIF("${TIZEN_PROFILE_NAME}" STREQUAL "MOBILE")
diff --git a/include/common/oobe_mgr.h b/include/common/oobe_mgr.h
new file mode 100644 (file)
index 0000000..4f02391
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * 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 OOBE_MGR_H
+#define OOBE_MGR_H
+
+void oobe_mgr_init(void);
+void oobe_mgr_fini(void);
+int oobe_mgr_get_oobe_setup_pid(void);
+void oobe_mgr_oobe_setup_terminated(void);
+
+#endif /* end of include guard: OOBE_MGR_H */
diff --git a/src/common/oobe_mgr.c b/src/common/oobe_mgr.c
new file mode 100644 (file)
index 0000000..a75fdbf
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+#include "oobe_mgr.h"
+#include "process_mgr.h"
+
+#include <unistd.h>
+#include <Ecore.h>
+
+#define OOBE_SETUP_APPID "org.tizen.oobe"
+
+static struct {
+       pid_t oobe_setup_pid;
+} g_oobe_mgr;
+
+static void _after_launch_oobe_setup(int pid)
+{
+       g_oobe_mgr.oobe_setup_pid = pid;
+}
+
+static void oobe_mgr_launch_oobe_setup()
+{
+       process_mgr_must_launch(OOBE_SETUP_APPID, NULL, NULL, NULL, _after_launch_oobe_setup);
+}
+
+static Eina_Bool _launch_apps_idler_cb(void *data)
+{
+       oobe_mgr_launch_oobe_setup();
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void oobe_mgr_init(void)
+{
+       ecore_idler_add(_launch_apps_idler_cb, NULL);
+}
+
+void oobe_mgr_fini(void)
+{
+       if (g_oobe_mgr.oobe_setup_pid > 0)
+               process_mgr_terminate_app(g_oobe_mgr.oobe_setup_pid, 1);
+}
+
+int oobe_mgr_get_oobe_setup_pid(void)
+{
+       return g_oobe_mgr.oobe_setup_pid;
+}
+
+void oobe_mgr_oobe_setup_terminated(void)
+{
+       g_oobe_mgr.oobe_setup_pid = 0;
+}
index ebfc2b5..d518d5e 100755 (executable)
@@ -36,6 +36,7 @@
 #include "util.h"
 #include "status.h"
 #include "hw_key.h"
+#include "oobe_mgr.h"
 
 #define LOCKSCREEN_ENABLE 0
 
@@ -197,6 +198,7 @@ static int _check_dead_signal(int pid, void *data)
 #if LOCKSCREEN_ENABLE
        int lock_pid = 0;
 #endif
+       int oobe_setup_pid = 0;
 
        _D("Process %d is termianted", pid);
 
@@ -212,6 +214,7 @@ static int _check_dead_signal(int pid, void *data)
 #if LOCKSCREEN_ENABLE
        lock_pid = lock_mgr_get_lock_pid();
 #endif
+       oobe_setup_pid = oobe_mgr_get_oobe_setup_pid();
 
        if (pid == home_pid) {
                _D("Homescreen is dead");
@@ -230,8 +233,10 @@ static int _check_dead_signal(int pid, void *data)
        } else if (pid == quickpanel_pid) {
                _D("quickpanel is dead");
                home_mgr_relaunch_quickpanel();
-       }
-       else {
+       } else if (pid == oobe_setup_pid) {
+               _D("oobe setup is dead");
+               oobe_mgr_oobe_setup_terminated();
+       } else {
                _D("Unknown process, ignore it");
        }
 
@@ -296,6 +301,7 @@ static void _init(void)
 
        hw_key_create_window();
        home_mgr_init(NULL);
+       oobe_mgr_init();
 
        r = aul_listen_app_dead_signal(_check_dead_signal, NULL);
        if (r < 0) {
@@ -312,6 +318,7 @@ static void _fini(void)
 #if LOCKSCREEN_ENABLE
        lock_mgr_daemon_end();
 #endif
+       oobe_mgr_fini();
 
        status_active_unregister_cb(STATUS_ACTIVE_KEY_SYSMAN_POWER_OFF_STATUS, _power_off_cb);
        status_active_unregister_cb(STATUS_ACTIVE_KEY_BOOT_ANIMATION_FINISHED, _boot_animation_finished_cb);