From f7af441469909e6bc09a98bc3fe968639047cc5f Mon Sep 17 00:00:00 2001 From: "jinwang.an" Date: Wed, 20 Feb 2019 11:36:28 +0900 Subject: [PATCH] Remove dependency libsystem-settings-util.so - efl-extension Change-Id: I1f34c84f067292eb7a226b8fe6f5140ff24a9008 Signed-off-by: jinwang.an --- include/system_settings_ringtones.h | 2 +- src/system_setting_platform.c | 1 + src/system_settings_vconf.c | 2 +- .../include/system_settings_font.h | 2 + system-settings-util/src/system_settings_util.c | 73 ++++++++++++++++++---- 5 files changed, 66 insertions(+), 14 deletions(-) diff --git a/include/system_settings_ringtones.h b/include/system_settings_ringtones.h index b466fb7..6271d4f 100644 --- a/include/system_settings_ringtones.h +++ b/include/system_settings_ringtones.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include typedef struct _ugFsNodeInfo fileNodeInfo; struct _ugFsNodeInfo { diff --git a/src/system_setting_platform.c b/src/system_setting_platform.c index 33a365b..6c8a8b6 100644 --- a/src/system_setting_platform.c +++ b/src/system_setting_platform.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/src/system_settings_vconf.c b/src/system_settings_vconf.c index 3285ea6..d5a470e 100644 --- a/src/system_settings_vconf.c +++ b/src/system_settings_vconf.c @@ -30,7 +30,7 @@ #define LOG_TAG "TIZEN_N_SYSTEM_SETTINGS" -static char* _system_settings_vconf_table[38] = { +static char *_system_settings_vconf_table[] = { VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, VCONFKEY_BGSET, VCONFKEY_IDLE_LOCK_BGSET, diff --git a/system-settings-util/include/system_settings_font.h b/system-settings-util/include/system_settings_font.h index 1b14575..bf716d4 100644 --- a/system-settings-util/include/system_settings_font.h +++ b/system-settings-util/include/system_settings_font.h @@ -88,5 +88,7 @@ int (*d_evas_shutdown) (void); +Eina_Bool +(*d_eext_config_font_set)(char *name, int size); diff --git a/system-settings-util/src/system_settings_util.c b/system-settings-util/src/system_settings_util.c index 4dd835f..64f1fb9 100644 --- a/system-settings-util/src/system_settings_util.c +++ b/system-settings-util/src/system_settings_util.c @@ -28,8 +28,6 @@ #include #include -#include - #ifdef TIZEN_WEARABLE #define SMALL_FONT_DPI (-90) #endif @@ -56,6 +54,7 @@ #define SETTING_FONT_CONFIG_SO_PATH "/usr/lib/libfontconfig.so.1" #define SETTING_ECORE_EVAS_SO_PATH "/usr/lib/libecore_evas.so.1" +#define SETTING_EFL_EXTENSION_SO_PATH "/usr/lib/libefl-extension.so.0" #define SETTING_EVAS_SO_PATH "/usr/lib/libevas.so.1" static int __font_size_get(); @@ -63,19 +62,30 @@ static int __font_size_get(); void *d_font_handle = NULL; void *d_ecore_evas_handle = NULL; void *d_evas_handle = NULL; +void *d_efl_eext_handle = NULL; #define DYM_FUNC_LOADING(error, handle, pfunc, func_name) do { \ pfunc = (void*)dlsym(handle, func_name); \ if ((error = dlerror()) != NULL) { \ - SETTING_TRACE("ERROR!! canNOT find %s function at /usr/lib/libfontconfig.so.1", func_name); \ + SETTING_TRACE("ERROR!! canNOT find %s function at %s", func_name, #handle); \ if (handle) \ dlclose(handle); \ return false; \ } \ } while (0) +#define DYM_CLOSE_HANDLE(handle) do { \ + if (handle) { \ + dlclose(handle); \ + handle = NULL; \ + } \ + } while (0) + + + + int loading_dym_font() { char *error = NULL; @@ -83,7 +93,7 @@ int loading_dym_font() if (!d_font_handle) { d_font_handle = dlopen(SETTING_FONT_CONFIG_SO_PATH, RTLD_LAZY); if (!d_font_handle) { - SETTING_TRACE("ERROR!! canNOT find /usr/lib/libfontconfig.so.1"); + SETTING_TRACE("ERROR!! canNOT find "SETTING_FONT_CONFIG_SO_PATH); return false; } } @@ -113,7 +123,7 @@ int loading_dym_efl() if (!d_ecore_evas_handle) { d_ecore_evas_handle = dlopen(SETTING_ECORE_EVAS_SO_PATH, RTLD_LAZY); if (!d_ecore_evas_handle) { - SETTING_TRACE("ERROR!! canNOT find /usr/lib/libecore_evas.so.1"); + SETTING_TRACE("ERROR!! canNOT find"SETTING_ECORE_EVAS_SO_PATH); return false; } } @@ -121,7 +131,7 @@ int loading_dym_efl() if (!d_evas_handle) { d_evas_handle = dlopen(SETTING_EVAS_SO_PATH, RTLD_LAZY); if (!d_evas_handle) { - SETTING_TRACE("ERROR!! canNOT find /usr/lib/libevas.so.1"); + SETTING_TRACE("ERROR!! canNOT find"SETTING_EVAS_SO_PATH); return false; } } @@ -139,6 +149,29 @@ int loading_dym_efl() return true; } +void close_dym_efl() +{ + DYM_CLOSE_HANDLE(d_evas_handle); + DYM_CLOSE_HANDLE(d_ecore_evas_handle); +} + +int loading_dym_efl_eext() +{ + char *error = NULL; + + if (!d_efl_eext_handle) { + d_efl_eext_handle = dlopen(SETTING_EFL_EXTENSION_SO_PATH, RTLD_LAZY); + if (!d_efl_eext_handle) { + SETTING_TRACE("ERROR!! canNOT find "SETTING_EFL_EXTENSION_SO_PATH); + return false; + } + } + + + DYM_FUNC_LOADING(error, d_efl_eext_handle, d_eext_config_font_set, "eext_config_font_set"); + + return true; +} /* Returned family name should be free'd manually. */ char *__get_main_font_family_name_by_alias(char *alias) @@ -155,8 +188,10 @@ char *__get_main_font_family_name_by_alias(char *alias) return NULL; font_config = d_FcInitLoadConfigAndFonts(); - if (font_config == NULL) + if (font_config == NULL) { + DYM_CLOSE_HANDLE(d_font_handle); return ret; + } pat = d_FcPatternBuild(0, FC_FAMILY, FcTypeString, alias, (char *)0); @@ -165,6 +200,7 @@ char *__get_main_font_family_name_by_alias(char *alias) d_FcConfigDestroy(font_config); font_config = NULL; } + DYM_CLOSE_HANDLE(d_font_handle); return ret; } @@ -196,7 +232,7 @@ char *__get_main_font_family_name_by_alias(char *alias) d_FcConfigDestroy(font_config); font_config = NULL; } - + DYM_CLOSE_HANDLE(d_font_handle); return ret; } @@ -209,8 +245,10 @@ bool __is_supported_image_type_load(char *path) Ecore_Evas *ee; Evas *evas; - if (!d_evas_init()) + if (!d_evas_init()) { + close_dym_efl(); return false; + } ee = d_ecore_evas_new(NULL, 0, 0, 100, 100, NULL); evas = d_ecore_evas_get(ee); @@ -229,6 +267,7 @@ bool __is_supported_image_type_load(char *path) } d_ecore_evas_free(ee); d_evas_shutdown(); + close_dym_efl(); return result; } /* LCOV_EXCL_STOP */ @@ -259,8 +298,10 @@ int __is_available_font(char *font_name) if (!loading_dym_font()) return -1; - if (font_name == NULL) + if (font_name == NULL) { + DYM_CLOSE_HANDLE(d_font_handle); return -1; + } font_config = d_FcInitLoadConfigAndFonts(); @@ -345,6 +386,7 @@ int __is_available_font(char *font_name) } d_FcConfigDestroy(font_config); font_config = NULL; + DYM_CLOSE_HANDLE(d_font_handle); return ret; } /* LCOV_EXCL_STOP */ @@ -360,8 +402,12 @@ char *_get_default_font() bool font_config_set(char *font_name) { SETTING_TRACE_BEGIN; + if (!loading_dym_efl_eext()) + return false; int font_size = __font_size_get(); - return eext_config_font_set(font_name, font_size); + bool ret = d_eext_config_font_set(font_name, font_size); + DYM_CLOSE_HANDLE(d_efl_eext_handle); + return ret; } /* LCOV_EXCL_STOP */ @@ -369,12 +415,15 @@ bool font_config_set(char *font_name) void __font_size_set() { SETTING_TRACE_BEGIN; + if (!loading_dym_efl_eext()) + return; int font_size = __font_size_get(); char *font_name = NULL; font_name = vconf_get_str(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME); - eext_config_font_set(font_name, font_size); + d_eext_config_font_set(font_name, font_size); + DYM_CLOSE_HANDLE(d_efl_eext_handle); g_free(font_name); } /* LCOV_EXCL_STOP */ -- 2.7.4