N_SE-9079
authorKairong Yin <kairong78.yin@samsung.com>
Thu, 6 Sep 2012 05:27:07 +0000 (22:27 -0700)
committerKairong Yin <kairong78.yin@samsung.com>
Thu, 6 Sep 2012 05:27:07 +0000 (22:27 -0700)
Change-Id: Ia66a8396732c7024cae58298743f9bcea30e278d

setting-common/include/setting-common-general-func.h
setting-common/src/setting-common-general-func.c
setting-display/src/setting-display.c
setting-reset/src/setting-reset-settings.c

index 1742a5d..b3406af 100755 (executable)
@@ -87,7 +87,7 @@ extern bool isEmptyStr(const char *str);
 extern int safeStrLen(const char *str);
 extern bool get_substring_int(const char **ipStr, int *ipValue, char delim);
 extern bool is_ip_string(const char *ipstr);
-extern int setting_invoke_reset_function(char *lib_name, service_h service, void *ext);
+extern int setting_invoke_reset_function(char *ug_name, service_h service, void *ext);
 extern int excuteCmd(char* exec_path, int option_num, ...);
 extern void create_fontlink(const char *linkpath, const char *linkname,
                    const char *fontfilepath, const char *fontfilename);
index 18cbe02..b6e051e 100755 (executable)
@@ -677,13 +677,29 @@ bool is_ip_string(const char *ipstr)
        return TRUE;
 }
 
-int setting_invoke_reset_function(char *lib_name, service_h service, void *ext)
+int setting_invoke_reset_function(char *ug_name, service_h service, void *ext)
 {
-       SETTING_TRACE("Enter %s with lib_name:%s", __FUNCTION__, lib_name);
+       SETTING_TRACE("Enter %s with ug_name:%s", __FUNCTION__, ug_name);
        int (*reset) (service_h pair, void *ptr);
        int ret = OPERATE_LIB_SUCESS;
 
-       void *handle = dlopen(lib_name, RTLD_LAZY);
+       //1.first do exist-checking in /opt/ug/lib
+       char ug_file[PATH_MAX + 1];
+       snprintf(ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH, ug_name);
+       struct stat st;
+       if(stat(ug_file, &st) != 0) { 
+
+               //2.if it does not exit in /opt/ug/lib, then do exist-checking in /usr/ug/lib
+               memset(ug_file, 0x00, PATH_MAX + 1);
+               snprintf(ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH_USR, ug_name);
+               if(stat(ug_file, &st) != 0) {
+                       //both not exist,skip it
+                       SETTING_TRACE_ERROR(" libug-%s.so is *NOT* present, so skip it..\n", ug_name);
+                       return OPERATE_LIB_SUCESS;
+               }
+       }
+       //-------------------------------------------------------------------------------------
+       void *handle = dlopen(ug_file, RTLD_LAZY);
        if (!handle) {
                SETTING_TRACE_ERROR(" >>>>>>>>>>> %s", dlerror());
                return LOAD_LIB_FAILED;
index 48378b4..e8fbcc2 100755 (executable)
@@ -379,7 +379,7 @@ static int setting_reset_display_lc_screen(void)
        SETTING_TRACE_BEGIN;
        int ret = 0;
        ret += vconf_set_str(VCONFKEY_IDLE_LOCK_BGSET, IMG_DEFAULT_HOME_SCREEN);
-       ret += setting_invoke_reset_function("/opt/ug/lib/libug-setting-lock.so", 0, NULL);
+       ret += setting_invoke_reset_function("setting-lock", 0, NULL);
        return ret;
 }
 
@@ -438,7 +438,7 @@ UG_MODULE_API int setting_plugin_reset(service_h service, void *priv)
                ret += setting_reset_display_lc_screen();*/
 #if SUPPORT_RUN_SYSTEM_COMMAND
                ret += excuteCmd(SETTING_POSTINST_FILE, 1, "wallpaper");
-               ret += setting_invoke_reset_function("/opt/ug/lib/libug-setting-lock.so", service, NULL);
+               ret += setting_invoke_reset_function("setting-lock", service, NULL);
 #else
                ret += setting_reset_home_wallpaper();
                ret += setting_reset_display_lc_screen();
index b44e0a4..f5574be 100755 (executable)
@@ -165,10 +165,10 @@ bool __reset_all_idler(void *data)
                                path = get_ug_path_from_ug_args((void *)ug_args);
                                svc = get_bundle_from_ug_args((void *)ug_args);
 
-                               if (snprintf(ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH, path) < 0)
-                                       return FALSE;
+                               //if (snprintf(ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH, path) < 0)
+                               //      return FALSE;
 
-                               ret = setting_invoke_reset_function(ug_file, svc, NULL);
+                               ret = setting_invoke_reset_function(path, svc, NULL);
                                //SETTING_TRACE("load %s[plugin_ret:%d]", ug_file, ret);
 
                                if (OPERATE_LIB_SUCESS > ret)
@@ -438,12 +438,9 @@ static void __reset_an_item(Setting_Done_List_Data *list_data,
        {
                char *path = get_ug_path_from_ug_args((void *)ug_args);
                service_h svc = get_bundle_from_ug_args((void *)ug_args);
-               char ug_file[PATH_MAX];
-               if (snprintf(ug_file, PATH_MAX,
-                       "%s/libug-%s.so", SETTING_UG_PATH, path) < 0) return;
 
-               int plugin_ret = setting_invoke_reset_function(ug_file, svc, NULL);
-               SETTING_TRACE("load %s[plugin_ret:%d]", ug_file, plugin_ret);
+               int plugin_ret = setting_invoke_reset_function(path, svc, NULL);
+               SETTING_TRACE("load libug-%s.so[plugin_ret:%d]", path, plugin_ret);
 
                if (LOAD_LIB_FAILED == plugin_ret) // -1
                {