Support vconf key modification related to booting status 43/248743/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 2 Dec 2020 04:13:54 +0000 (13:13 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 2 Dec 2020 04:16:38 +0000 (13:16 +0900)
The product developer wants to change the vconf key/value related to
booting status. The product developer can change starting time of
onboot service apps using the vconf key/value modification.

Change-Id: I61a589dc37fb76bc773d4f258c44cf8a12c4836e
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
packaging/amd.conf
src/lib/amd_config.c
src/lib/amd_config.h
src/lib/amd_login_monitor.c

index 9f2245bdcb47f34a4156a2c0b043ed2ae9a535ed..12e13f1c042a6d4e07edee97aed0db4191bcb240 100644 (file)
@@ -6,3 +6,5 @@ watchdog_interval=10000
 wathcdog_max_retry=3
 launchpad_max_launch_failure=5
 logger_path=/run/aul/log
+booting_status_key=memory/sysman/booting_status
+booting_success_value=1
index 8f330fef4b97c590cd724b16c362e1c6c0e1b679..242fb7ecfe63681957a08eb0cef9450880f774c2 100644 (file)
@@ -18,6 +18,7 @@
 #include <stdlib.h>
 #include <system_info.h>
 #include <iniparser.h>
+#include <vconf.h>
 
 #include "amd_config.h"
 #include "amd_util.h"
@@ -29,6 +30,8 @@
 #define CONFIG_FG_TIMEOUT "fg_timeout"
 #define CONFIG_LAUNCHPAD_MAX_LAUNCH_FAILURE "launchpad_max_launch_failure"
 #define CONFIG_LOGGER_PATH "logger_path"
+#define CONFIG_BOOTING_STATUS_KEY "booting_status_key"
+#define CONFIG_BOOTING_SUCCESS_VALUE "booting_success_value"
 
 typedef struct config_s {
        tizen_profile_t profile;
@@ -37,6 +40,8 @@ typedef struct config_s {
        unsigned int fg_timeout;
        unsigned int max_launch_failure;
        char *logger_path;
+       char *booting_status_key;
+       int booting_success_value;
 } config;
 
 static config __config;
@@ -104,6 +109,16 @@ const char *_config_get_logger_path(void)
        return __config.logger_path;
 }
 
+const char *_config_get_booting_status_key(void)
+{
+       return __config.booting_status_key;
+}
+
+int _config_get_booting_success_value(void)
+{
+       return __config.booting_success_value;
+}
+
 static int __get_config_int(dictionary *d, const char *key)
 {
        char buf[512];
@@ -186,6 +201,20 @@ static int __load_config_file(const char *path)
                _I("[__CONFIG__] Logger path: %s", __config.logger_path);
        }
 
+       str = __get_config_string(d, CONFIG_BOOTING_STATUS_KEY);
+       if (str) {
+               free(__config.booting_status_key);
+               __config.booting_status_key = strdup(str);
+               _I("[__CONFIG__] Booting status key: %s",
+                               __config.booting_status_key);
+       }
+
+       r = __get_config_int(d, CONFIG_BOOTING_SUCCESS_VALUE);
+       if (r >= 0) {
+               __config.booting_success_value = r;
+               _I("[__CONFIG__] Booting Success value: %d",
+                               __config.booting_success_value);
+       }
 
        iniparser_freedict(d);
 
@@ -202,6 +231,8 @@ int _config_init(void)
        __config.fg_timeout = 5000;
        __config.max_launch_failure = 5;
        __config.logger_path = strdup("/var/log/appfw");
+       __config.booting_status_key = strdup(VCONFKEY_SYSMAN_BOOTINGSTATUS);
+       __config.booting_success_value = VCONFKEY_SYSMAN_BOOTING_SUCCESS;
 
        if (__load_config_file(CONFIG_FILE_PATH) < 0)
                _W("Failed to load config file");
index 3e560161c107ce29e1d4f34811dada6ecad93508..b9437dab018db1fb4cf72ffb61bcbdfb98661eac 100644 (file)
@@ -56,6 +56,10 @@ unsigned int _config_get_max_launch_failure(void);
 
 const char *_config_get_logger_path(void);
 
+const char *_config_get_booting_status_key(void);
+
+int _config_get_booting_success_value(void);
+
 int _config_init(void);
 
 void _config_fini(void);
index 96149a6316e17e2105b9396c9d12204ca9e7cf92..546e44f39713128942b12f33f5b96e33cac92466 100644 (file)
 #include <vconf.h>
 
 #include "amd_api_noti.h"
-#include "amd_util.h"
-#include "amd_login_monitor.h"
-#include "amd_appinfo.h"
 #include "amd_app_property.h"
 #include "amd_app_status.h"
-#include "amd_socket.h"
-#include "amd_request.h"
-#include "amd_launch.h"
-#include "amd_signal.h"
+#include "amd_appinfo.h"
+#include "amd_config.h"
 #include "amd_cynara.h"
+#include "amd_launch.h"
+#include "amd_login_monitor.h"
 #include "amd_noti.h"
+#include "amd_request.h"
+#include "amd_signal.h"
+#include "amd_socket.h"
+#include "amd_util.h"
 
 #define PATH_AUL_DAEMONS "/run/aul/daemons"
 #define LOGIN_TIMEOUT_SEC 90
@@ -970,7 +971,7 @@ static void __booting_status_changed_cb(keynode_t *node, void *user_data)
                                login_monitor->booting_status,
                                booting_status);
                login_monitor->booting_status = booting_status;
-               if (booting_status != VCONFKEY_SYSMAN_BOOTING_SUCCESS)
+               if (_config_get_booting_success_value() != booting_status)
                        return;
 
                iter = user_list;
@@ -993,13 +994,15 @@ static bool __check_system_boot_finished(void)
 {
        bool boot_finished = false;
        int booting_status;
+       int booting_success;
        int ret;
 
-       if (login_monitor->booting_status == VCONFKEY_SYSMAN_BOOTING_SUCCESS)
+       booting_success = _config_get_booting_success_value();
+       if (login_monitor->booting_status == booting_success)
                return true;
 
-       ret = vconf_get_int(VCONFKEY_SYSMAN_BOOTINGSTATUS, &booting_status);
-       if (ret == 0 && booting_status == VCONFKEY_SYSMAN_BOOTING_SUCCESS) {
+       ret = vconf_get_int(_config_get_booting_status_key(), &booting_status);
+       if (ret == 0 && booting_status == booting_success) {
                _W("Booting success");
                login_monitor->booting_status = booting_status;
                return true;
@@ -1055,13 +1058,13 @@ int _login_monitor_init(void)
                return -1;
        }
 
-       r = vconf_get_int(VCONFKEY_SYSMAN_BOOTINGSTATUS, &booting_status);
+       r = vconf_get_int(_config_get_booting_status_key(), &booting_status);
        if (r == 0) {
                _W("booting status(%d)", booting_status);
                login_monitor->booting_status = booting_status;
        }
 
-       r = vconf_notify_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS,
+       r = vconf_notify_key_changed(_config_get_booting_status_key(),
                        __booting_status_changed_cb, NULL);
        if (r != 0)
                _W("Failed to register callback for checking booting");
@@ -1126,7 +1129,7 @@ void _login_monitor_fini(void)
        if (user_list)
                g_list_free_full(user_list, __destroy_user);
 
-       vconf_ignore_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS,
+       vconf_ignore_key_changed(_config_get_booting_status_key(),
                        __booting_status_changed_cb);
 
        __fini_login_monitor();