From: jinwang.an Date: Mon, 18 Dec 2017 09:18:59 +0000 (+0900) Subject: Added multi-callback for system-settings keys. X-Git-Tag: submit/tizen_4.0/20171222.091947^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d937f54732efa0156d9db0f153c866d276f4b23;p=platform%2Fcore%2Fapi%2Fsystem-settings.git Added multi-callback for system-settings keys. - Merged from tizen branch. .Changed internal source code in multi callback APIs. .Added multi-callback for system-settings keys Change-Id: I78f64092881dfe51d6ae814b3dba62b18054245e Signed-off-by: jinwang.an --- diff --git a/include/system_settings.h b/include/system_settings.h index 86b0fe9..92d4a24 100644 --- a/include/system_settings.h +++ b/include/system_settings.h @@ -346,6 +346,42 @@ int system_settings_add_value_string(system_settings_key_e key, const char *valu */ int system_settings_delete_value_string(system_settings_key_e key, const char *value); + +/** + * @brief Adds a change event callback for the given system settings key. + * @details The difference between this function and system_settings_set_changed_cb() is that system_settings_set_changed_cb() can set only one callback for a given key, while system_settings_add_changed_cb() can set multiple callbacks for a given key. + * @since_tizen 4.0 + * @remarks The @a key cannot be #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE. When the feature related to the @a key is not supported on the device, #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED will be returned. + * @param[in] key The key name of the system settings + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device + * @post system_settings_changed_cb() will be invoked. + * + * @see system_settings_remove_changed_cb() + * @see system_settings_changed_cb() + * +*/ +int system_settings_add_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data); + +/** + * @brief Removes a change event callback function. + * @details The difference between this function and system_settings_unset_changed_cb() is that system_settings_unset_changed_cb() unsets the callback set with system_settings_set_changed_cb(), while system_settings_remove_changed_cb() removes callbacks added with system_settings_add_changed_cb() + * @since_tizen 4.0 + * @remarks The @a key cannot be #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE. When the feature related to the @a key is not supported on the device, #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED will be returned. + * @param[in] key The key name of the system settings + * @param[in] callback The callback function to be removed + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device + * + * @see system_settings_add_changed_cb() + */ +int system_settings_remove_changed_cb(system_settings_key_e key, system_settings_changed_cb callback); /** * @} */ diff --git a/include/system_settings_multi_callback.h b/include/system_settings_multi_callback.h new file mode 100644 index 0000000..1c352d6 --- /dev/null +++ b/include/system_settings_multi_callback.h @@ -0,0 +1,24 @@ +#ifndef __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ +#define __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ +#include +#include +#include + +typedef struct __st_multi_callback_node_ +{ + system_settings_changed_cb callback; + void* user_data; +}callback_node; + +typedef struct __st_multi_callback_list_ +{ + GList * list; + int is_registered; +}callback_list; + +int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, void* user_data); +int delete_multi_callback(callback_list *handle, system_settings_changed_cb ptr); +int invoke_callback_list(callback_list *handle, system_settings_key_e key); + + +#endif /* __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ */ diff --git a/include/system_settings_private.h b/include/system_settings_private.h index 431af71..12b3e17 100644 --- a/include/system_settings_private.h +++ b/include/system_settings_private.h @@ -25,6 +25,7 @@ extern "C" #include #include +#include #ifdef LOG_TAG #undef LOG_TAG @@ -109,7 +110,7 @@ system_setting_supported_profile_info_e; * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -typedef int (*system_setting_get_value_cb)(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +typedef int (*system_setting_get_value_cb)(system_settings_key_e key, void **value); /** * @internal @@ -120,11 +121,10 @@ typedef int (*system_setting_get_value_cb)(system_settings_key_e key, system_set * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -typedef int (*system_setting_set_value_cb)(system_settings_key_e key, system_setting_data_type_e data_type, void *value); - -typedef int (*system_setting_add_value_cb)(system_settings_key_e key, system_setting_data_type_e data_type, void *value); -typedef int (*system_setting_del_value_cb)(system_settings_key_e key, system_setting_data_type_e data_type, void *value); -typedef int (*system_setting_list_value_cb)(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *user_data); +typedef int (*system_setting_set_value_cb)(system_settings_key_e key, void *value); +typedef int (*system_setting_add_value_cb)(system_settings_key_e key, void *value); +typedef int (*system_setting_del_value_cb)(system_settings_key_e key, void *value); +typedef int (*system_setting_list_value_cb)(system_settings_key_e key, system_settings_iter_cb callback, void *user_data); typedef int (*system_setting_feature_check_cb)(void *value); @@ -175,6 +175,8 @@ typedef struct { system_setting_feature_check_cb feature_check_cb; + callback_list changed_cb_list; + void *user_data; /* user_data */ } system_setting_s; @@ -303,6 +305,43 @@ int system_setting_vconf_set_changed_cb(const char *vconf_key, system_settings_k */ int system_setting_vconf_unset_changed_cb(const char *vconf_key, int slot); +/** + * @internal + * @brief Unset the system settings notification callback + * @since_tizen 4.0 + * @param[in] key system_settings_key_e value to get vconf string + * @param[out] key_string string pointer to be assigned vconf string + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + */ +int system_settings_vconf_get_key_string(system_settings_key_e key, char **key_string); + + +/** + * @internal + * @brief Unset the system settings notification callback + * @since_tizen 4.0 + * @param[in] vconf_key vconf key name used in the code + * @param[in] key system_settings_key_e value. + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + */ +int system_setting_vconf_set_changed_multi_cb(const char *vconf_key, system_settings_key_e key); + +/** + * @internal + * @brief Unset the system settings notification callback + * @since_tizen 4.0 + * @param[in] vconf_key vconf key name used in the code + * @param[in] key system_settings_key_e value. + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + */ +int system_setting_vconf_unset_changed_multi_cb(const char *vconf_key, system_settings_key_e key); + /** * @internal * @brief get current font size @@ -314,7 +353,7 @@ int system_setting_vconf_unset_changed_cb(const char *vconf_key, int slot); * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_font_size(system_settings_key_e key, void **value); /** * @internal @@ -328,7 +367,7 @@ int system_setting_get_font_size(system_settings_key_e key, system_setting_data_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_font_size(system_settings_key_e key, void *value); /** * @internal @@ -351,7 +390,7 @@ int system_setting_unset_changed_callback_font_size(system_settings_key_e key); * @since_tizen 2.3 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_incoming_call_ringtone(system_settings_key_e key, void **value); /** * @internal @@ -365,25 +404,25 @@ int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_incoming_call_ringtone(system_settings_key_e key, void *value); /** * @todo add comment here */ -int system_setting_add_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *value); /** * @todo add comment here */ -int system_setting_del_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_del_incoming_call_ringtone(system_settings_key_e key, void *value); /** * @todo add comment here */ -int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data); +int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_settings_iter_cb callback, void *data); /** * @internal @@ -405,7 +444,7 @@ int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings * @since_tizen 2.3 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_email_alert_ringtone(system_settings_key_e key, void **value); /** * @internal @@ -419,7 +458,7 @@ int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_se * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_email_alert_ringtone(system_settings_key_e key, void *value); /** * @internal @@ -442,7 +481,7 @@ int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_k * @since_tizen 2.3 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_wallpaper_home_screen(system_settings_key_e key, void **value); /** * @internal @@ -456,7 +495,7 @@ int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_s * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_wallpaper_home_screen(system_settings_key_e key, void *value); /** * @internal @@ -479,7 +518,7 @@ int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_ * @since_tizen 2.3 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, void **value); /** * @internal @@ -493,7 +532,7 @@ int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_s * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, void *value); /** * @internal @@ -515,7 +554,7 @@ int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_ * @since_tizen 2.3 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_default_font_type(system_settings_key_e key, void **value); /** @@ -523,7 +562,7 @@ int system_setting_get_default_font_type(system_settings_key_e key, system_setti * @since_tizen 2.3 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_font_type(system_settings_key_e key, void **value); /** * @internal @@ -537,7 +576,7 @@ int system_setting_get_font_type(system_settings_key_e key, system_setting_data_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_font_type(system_settings_key_e key, void *value); /** * @internal @@ -559,7 +598,7 @@ int system_setting_unset_changed_callback_font_type(system_settings_key_e key); * @since_tizen 2.3 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_motion_activation(system_settings_key_e key, void **value); /** * @internal @@ -573,7 +612,7 @@ int system_setting_get_motion_activation(system_settings_key_e key, system_setti * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_motion_activation(system_settings_key_e key, void *value); /** * @internal @@ -595,7 +634,7 @@ int system_setting_unset_changed_callback_motion_activation(system_settings_key_ * @since_tizen 2.3 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_usb_debugging_option(system_settings_key_e key, void **value); /** * @internal @@ -609,7 +648,7 @@ int system_setting_get_usb_debugging_option(system_settings_key_e key, system_se * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_usb_debugging_option(system_settings_key_e key, void *value); /** * @internal @@ -631,7 +670,7 @@ int system_setting_unset_changed_callback_usb_debugging_option(system_settings_k * @since_tizen 2.3 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_3g_data_network(system_settings_key_e key, void **value); /** * @internal @@ -645,7 +684,7 @@ int system_setting_get_3g_data_network(system_settings_key_e key, system_setting * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_3g_data_network(system_settings_key_e key, void *value); /** * @internal @@ -675,7 +714,7 @@ int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_tap_and_hold_delay(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_tap_and_hold_delay(system_settings_key_e key, void **value); /** * @internal @@ -685,7 +724,7 @@ int system_setting_get_tap_and_hold_delay(system_settings_key_e key, system_sett * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_tap_and_hold_delay(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_tap_and_hold_delay(system_settings_key_e key, void *value); /** * @internal @@ -715,7 +754,7 @@ int system_setting_unset_changed_callback_tap_and_hold_delay(system_settings_key * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_lockscreen_app(system_settings_key_e key, void **value); /** * @internal @@ -725,7 +764,7 @@ int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_lockscreen_app(system_settings_key_e key, void *value); /** * @internal @@ -755,7 +794,7 @@ int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e k * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_locale_country(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -764,7 +803,7 @@ int system_setting_get_locale_country(system_settings_key_e key, system_setting_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_locale_country(system_settings_key_e key, void *value); /** * @internal * @since_tizen 2.3 @@ -792,7 +831,7 @@ int system_setting_unset_changed_callback_locale_country(system_settings_key_e k * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_locale_language(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -801,7 +840,7 @@ int system_setting_get_locale_language(system_settings_key_e key, system_setting * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_locale_language(system_settings_key_e key, void *value); /** * @internal * @since_tizen 2.3 @@ -829,7 +868,7 @@ int system_setting_unset_changed_callback_locale_language(system_settings_key_e * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -838,7 +877,7 @@ int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, syste * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, void *value); /** * @internal * @since_tizen 2.3 @@ -866,7 +905,7 @@ int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settin * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_locale_timezone(system_settings_key_e key, void **value); /** * @internal @@ -876,7 +915,7 @@ int system_setting_get_locale_timezone(system_settings_key_e key, system_setting * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_locale_timezone(system_settings_key_e key, void *value); /** * @internal @@ -927,7 +966,7 @@ int system_setting_unset_changed_callback_locale_timezone_changed(system_setting * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_time_changed(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -956,7 +995,7 @@ int system_setting_unset_changed_callback_time_changed(system_settings_key_e key * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_sound_lock(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -984,7 +1023,7 @@ int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key); * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_sound_silent_mode(system_settings_key_e key, void **value); /** * @internal @@ -994,7 +1033,7 @@ int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setti * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_sound_silent_mode(system_settings_key_e key, void *value); /** * @internal @@ -1023,7 +1062,7 @@ int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_sound_touch(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -1051,7 +1090,7 @@ int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key) * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_auto_rotation_mode(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -1060,7 +1099,7 @@ int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_sett * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_auto_rotation_mode(system_settings_key_e key, void *value); /** * @internal * @since_tizen 2.3 @@ -1088,7 +1127,7 @@ int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_screen_backlight_time(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -1097,7 +1136,7 @@ int system_setting_get_screen_backlight_time(system_settings_key_e key, system_s * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_screen_backlight_time(system_settings_key_e key, void *value); /** * @internal * @since_tizen 2.3 @@ -1125,7 +1164,7 @@ int system_setting_unset_changed_callback_screen_backlight_time(system_settings_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_sound_notification(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -1134,7 +1173,7 @@ int system_setting_get_sound_notification(system_settings_key_e key, system_sett * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_sound_notification(system_settings_key_e key, void *value); /** * @internal * @since_tizen 2.3 @@ -1162,7 +1201,7 @@ int system_setting_unset_changed_callback_sound_notification(system_settings_key * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_notification_repetition_period(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -1171,7 +1210,7 @@ int system_setting_get_notification_repetition_period(system_settings_key_e key, * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_notification_repetition_period(system_settings_key_e key, void *value); /** * @internal * @since_tizen 2.3 @@ -1199,7 +1238,7 @@ int system_setting_unset_changed_callback_notification_repetition_period(system_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_device_name(system_settings_key_e key, void **value); /** * @internal * @since_tizen 2.3 @@ -1228,7 +1267,7 @@ int system_setting_unset_changed_callback_device_name(system_settings_key_e key) * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_network_flight_mode(system_settings_key_e key, void **value); /** * @internal @@ -1260,7 +1299,7 @@ int system_setting_unset_changed_callback_network_flight_mode(system_settings_ke * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_network_wifi_notification(system_settings_key_e key, void **value); /** * @internal @@ -1292,7 +1331,7 @@ int system_setting_unset_changed_callback_network_wifi_notification(system_setti * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_lock_state(system_settings_key_e key, void **value); /** * @internal @@ -1302,7 +1341,7 @@ int system_setting_get_lock_state(system_settings_key_e key, system_setting_data * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_lock_state(system_settings_key_e key, void *value); /** * @internal @@ -1333,7 +1372,7 @@ int system_setting_unset_changed_callback_lock_state(system_settings_key_e key); * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_ads_id(system_settings_key_e key, void **value); /** * @internal @@ -1344,7 +1383,7 @@ int system_setting_get_ads_id(system_settings_key_e key, system_setting_data_typ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_ads_id(system_settings_key_e key, void *value); /** * @internal @@ -1375,7 +1414,7 @@ int system_setting_unset_changed_callback_ads_id(system_settings_key_e key); * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_uds_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_uds_state(system_settings_key_e key, void **value); /** * @internal @@ -1417,7 +1456,7 @@ int system_setting_set_changed_callback_uds_pkg_list(system_settings_key_e key, * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_accessibility_tts(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_accessibility_tts(system_settings_key_e key, void **value); /** * @internal * @since_tizen 4.0 @@ -1445,7 +1484,7 @@ int system_setting_unset_changed_callback_accessibility_tts(system_settings_key_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_get_vibration(system_settings_key_e key, system_setting_data_type_e data_type, void **value); +int system_setting_get_vibration(system_settings_key_e key, void **value); /** * @internal @@ -1455,7 +1494,7 @@ int system_setting_get_vibration(system_settings_key_e key, system_setting_data_ * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error */ -int system_setting_set_vibration(system_settings_key_e key, system_setting_data_type_e data_type, void *value); +int system_setting_set_vibration(system_settings_key_e key, void *value); /** * @internal diff --git a/src/system_setting_platform.c b/src/system_setting_platform.c index b7ffc47..2c7ea35 100644 --- a/src/system_setting_platform.c +++ b/src/system_setting_platform.c @@ -85,22 +85,12 @@ static int dl_is_available_font(char *str); static void dl_font_size_set(); static void dl_font_config_set_notification(); - -#ifndef VCONFKEY_SETAPPL_UDSM -#define VCONFKEY_SETAPPL_UDSM "db/setting/udsm" -#endif - -#ifndef VCONFKEY_SETAPPL_UDSM_PKGID_LIST -#define VCONFKEY_SETAPPL_UDSM_PKGID_LIST "db/setting/udsm/pkgid_list" -#endif - - /** * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose * @return the ringtone file path specified by user in normal case * if it's not accessable, return the default ringtone path */ -int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_incoming_call_ringtone(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *vconf_value; @@ -122,7 +112,7 @@ int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_ } -int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_email_alert_ringtone(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *vconf_value; @@ -143,7 +133,7 @@ int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_se } -int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_wallpaper_home_screen(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *vconf_value; @@ -155,7 +145,7 @@ int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_s } -int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *vconf_value; @@ -170,7 +160,7 @@ int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_s /* [int] vconf GET */ -int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_font_size(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; int vconf_value; @@ -185,7 +175,7 @@ int system_setting_get_font_size(system_settings_key_e key, system_setting_data_ } -int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_default_font_type(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *font_name = dl_get_default_font_info(); @@ -198,7 +188,7 @@ int system_setting_get_default_font_type(system_settings_key_e key, system_setti } /* [int] vconf GET */ -int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_font_type(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *font_name = NULL; @@ -212,7 +202,7 @@ int system_setting_get_font_type(system_settings_key_e key, system_setting_data_ } -int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_motion_activation(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool vconf_value; @@ -225,7 +215,7 @@ int system_setting_get_motion_activation(system_settings_key_e key, system_setti return SYSTEM_SETTINGS_ERROR_NONE; } -int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_usb_debugging_option(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool vconf_value; @@ -238,7 +228,7 @@ int system_setting_get_usb_debugging_option(system_settings_key_e key, system_se return SYSTEM_SETTINGS_ERROR_NONE; } -int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_3g_data_network(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool vconf_value; @@ -258,7 +248,7 @@ int system_setting_get_3g_data_network(system_settings_key_e key, system_setting * * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password' */ -int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_lockscreen_app(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *pkg_name = NULL; @@ -313,7 +303,7 @@ static char* _get_json_file_path() } #endif -int system_setting_add_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char* pathval = (char*)value; @@ -358,7 +348,7 @@ int system_setting_add_incoming_call_ringtone(system_settings_key_e key, system_ return ret; } -int system_setting_del_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_del_incoming_call_ringtone(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char* pathval = (char*)value; @@ -394,7 +384,7 @@ static int _compare_cb(const void *d1, const void *d2) /* * get the RINGTONE list */ -static void _get_default_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data) +static void _get_default_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data) { SETTING_TRACE_BEGIN; /*Get file list */ @@ -449,7 +439,7 @@ static void _get_default_ringtones(system_settings_key_e key, system_setting_dat } -static void _get_user_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data) +static void _get_user_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data) { SETTING_TRACE_BEGIN; @@ -482,22 +472,22 @@ static void _get_user_ringtones(system_settings_key_e key, system_setting_data_t } } -int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data) +int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_settings_iter_cb callback, void *data) { SETTING_TRACE_BEGIN; - _get_default_ringtones(key, data_type, callback, data); + _get_default_ringtones(key, callback, data); //----------------------------------------------------------------------------------------------------------------- // 2. get the USER ringtone list //----------------------------------------------------------------------------------------------------------------- - _get_user_ringtones(key, data_type, callback, data); + _get_user_ringtones(key, callback, data); return SYSTEM_SETTINGS_ERROR_NONE; } /* LCOV_EXCL_START */ -int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_incoming_call_ringtone(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value; @@ -519,7 +509,7 @@ int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_ /* LCOV_EXCL_START */ -int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_email_alert_ringtone(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value; @@ -834,7 +824,7 @@ static int system_setting_check_extended_wallpaper(const char *file_path) #define WALLPAPER_MAX_COUNT 10 #endif /* LCOV_EXCL_START */ -int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_wallpaper_home_screen(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value; @@ -935,7 +925,7 @@ int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_s /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value; @@ -963,7 +953,7 @@ int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_s /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_font_size(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; int *vconf_value; @@ -1083,7 +1073,7 @@ void *font_conf_doc_parse(char *doc_name, char *font_name) /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_font_type(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *font_name = NULL; @@ -1128,7 +1118,7 @@ int system_setting_set_font_type(system_settings_key_e key, system_setting_data_ /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_motion_activation(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; bool *vconf_value; @@ -1141,7 +1131,7 @@ int system_setting_set_motion_activation(system_settings_key_e key, system_setti /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_usb_debugging_option(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; bool *vconf_value; @@ -1155,7 +1145,7 @@ int system_setting_set_usb_debugging_option(system_settings_key_e key, system_se /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_3g_data_network(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; bool *vconf_value; @@ -1192,7 +1182,7 @@ static int category_func(const char *name, void *user_data) */ /* LCOV_EXCL_START */ -int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_lockscreen_app(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value; @@ -1367,7 +1357,7 @@ int system_setting_unset_changed_callback_motion_activation(system_settings_key_ /*//////////////////////////////////////////////////////////////////////////////////////// */ /*--------------------------------------- */ -int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_locale_country(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *vconf_value = NULL; @@ -1388,7 +1378,7 @@ int system_setting_get_locale_country(system_settings_key_e key, system_setting_ } /* LCOV_EXCL_START */ -int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_locale_country(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value = NULL; @@ -1420,7 +1410,7 @@ int system_setting_unset_changed_callback_locale_country(system_settings_key_e k /*--------------------------------------- */ -int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_locale_language(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *vconf_value = NULL; @@ -1440,7 +1430,7 @@ int system_setting_get_locale_language(system_settings_key_e key, system_setting } /* LCOV_EXCL_START */ -int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_locale_language(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value = NULL; @@ -1473,7 +1463,7 @@ int system_setting_unset_changed_callback_locale_language(system_settings_key_e /*--------------------------------------- */ /* LCOV_EXCL_START */ -int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; int vconf_value; @@ -1494,7 +1484,7 @@ int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, syste } /* LCOV_EXCL_STOP */ -int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; bool *vconf_value; @@ -1528,7 +1518,7 @@ int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settin return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3); } -int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_locale_timezone(system_settings_key_e key, void **value) { char tzpath[256]; ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1); @@ -1545,7 +1535,7 @@ int system_setting_get_locale_timezone(system_settings_key_e key, system_setting } /* LCOV_EXCL_START */ -int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_locale_timezone(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *timezone_value = NULL; @@ -1601,7 +1591,7 @@ int system_setting_unset_changed_callback_locale_timezone_changed(system_setting /* LCOV_EXCL_START */ -int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_time_changed(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; time_t cur_tick; @@ -1630,7 +1620,7 @@ int system_setting_unset_changed_callback_time_changed(system_settings_key_e key /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */ -int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_sound_lock(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool vconf_value; @@ -1663,7 +1653,7 @@ int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key) * a == false, b == true --> vibration mode */ /* LCOV_EXCL_START */ -int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_sound_silent_mode(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool sound_cond; @@ -1695,7 +1685,7 @@ int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setti * a == false, b == false --> silent mode * a == true, b == false --> sound mode */ -int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_sound_silent_mode(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; bool *vconf_value; @@ -1740,7 +1730,7 @@ int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_ } /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */ -int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_sound_touch(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool vconf_value; @@ -1767,7 +1757,7 @@ int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key) #if 0 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */ -int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_sound_lock(system_settings_key_e key, void **value) { bool vconf_value; @@ -1780,7 +1770,7 @@ int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data } #endif -int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_auto_rotation_mode(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool vconf_value; @@ -1794,7 +1784,7 @@ int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_sett } /* LCOV_EXCL_START */ -int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_auto_rotation_mode(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; bool *vconf_value; @@ -1819,7 +1809,7 @@ int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2); } -int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_screen_backlight_time(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; int vconf_value; @@ -1835,7 +1825,7 @@ int system_setting_get_screen_backlight_time(system_settings_key_e key, system_s /* LCOV_EXCL_START */ -int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_screen_backlight_time(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; int *vconf_value; @@ -1866,7 +1856,7 @@ int system_setting_unset_changed_callback_screen_backlight_time(system_settings_ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2); } -int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_sound_notification(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *vconf_value = NULL; @@ -1879,7 +1869,7 @@ int system_setting_get_sound_notification(system_settings_key_e key, system_sett } /* LCOV_EXCL_START */ -int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_sound_notification(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value = NULL; @@ -1913,7 +1903,7 @@ int system_setting_unset_changed_callback_sound_notification(system_settings_key return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0); } -int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_notification_repetition_period(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; int ** val = (int**)value; @@ -1928,7 +1918,7 @@ int system_setting_get_notification_repetition_period(system_settings_key_e key, } /* LCOV_EXCL_START */ -int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_notification_repetition_period(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; int *vconf_value; @@ -1954,7 +1944,7 @@ int system_setting_unset_changed_callback_notification_repetition_period(system_ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1); } -int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_device_name(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; char *vconf_value = NULL; @@ -1967,7 +1957,7 @@ int system_setting_get_device_name(system_settings_key_e key, system_setting_dat } /* LCOV_EXCL_START */ -int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_device_name(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value = NULL; @@ -1994,7 +1984,7 @@ int system_setting_unset_changed_callback_device_name(system_settings_key_e key) } /*---------------------------------------------- */ -int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_network_flight_mode(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool vconf_value; @@ -2018,7 +2008,7 @@ int system_setting_unset_changed_callback_network_flight_mode(system_settings_ke return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3); } -int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_network_wifi_notification(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; int vconf_value; @@ -2045,7 +2035,7 @@ int system_setting_unset_changed_callback_network_wifi_notification(system_setti } /* LCOV_EXCL_START */ -int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_lock_state(system_settings_key_e key, void **value) { int vconf_value; int ** val = (int**)value; @@ -2060,7 +2050,7 @@ int system_setting_get_lock_state(system_settings_key_e key, system_setting_data /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_lock_state(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; int *vconf_value; @@ -2092,7 +2082,7 @@ int system_setting_unset_changed_callback_lock_state(system_settings_key_e key) #define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000" -int system_setting_get_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_ads_id(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; int optout_value = 0; @@ -2126,7 +2116,7 @@ void make_ad_id(void) } #endif /* LCOV_EXCL_START */ -int system_setting_set_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_ads_id(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; char *vconf_value = NULL; @@ -2247,7 +2237,7 @@ int system_setting_feature_check_telephony(void * value) } /* LCOV_EXCL_START */ -int system_setting_get_uds_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_uds_state(system_settings_key_e key, void **value) { int ** p_value = (int**)value; int vconf_value; @@ -2326,7 +2316,7 @@ int system_setting_unset_changed_callback_uds_pkg_list(system_settings_key_e key /* LCOV_EXCL_STOP */ /* SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS */ -int system_setting_get_accessibility_tts(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_accessibility_tts(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool vconf_value; @@ -2352,7 +2342,7 @@ int system_setting_unset_changed_callback_accessibility_tts(system_settings_key_ } /* SYSTEM_SETTINGS_KEY_VIBRATION */ -int system_setting_get_vibration(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +int system_setting_get_vibration(system_settings_key_e key, void **value) { SETTING_TRACE_BEGIN; bool vconf_value; @@ -2366,7 +2356,7 @@ int system_setting_get_vibration(system_settings_key_e key, system_setting_data_ } /* LCOV_EXCL_START */ -int system_setting_set_vibration(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +int system_setting_set_vibration(system_settings_key_e key, void *value) { SETTING_TRACE_BEGIN; bool *vconf_value; @@ -2390,3 +2380,30 @@ int system_setting_unset_changed_callback_vibration(system_settings_key_e key) SETTING_TRACE_BEGIN; return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, 2); } + +#ifdef UNIT_TEST +static void simple_test_case(void) +{ + /* a suitable test */ + g_assert(g_bit_storage(1) == 1); + + /* a test with verbose error message */ + g_assert_cmpint(g_bit_storage(1), ==, 1); +} + +static void simple_test_case02(void) +{ + /* a suitable test */ + g_assert(g_bit_storage(1) == 1); + + /* a test with verbose error message */ + g_assert_cmpint(g_bit_storage(1), ==, 1); +} +void unittest_platform() +{ + /* hook up your test functions */ + g_test_add_func("/Simple Test Case", simple_test_case); + g_test_add_func("/Simple Test Case02", simple_test_case02); + /* run tests from the suite */ +} +#endif diff --git a/src/system_settings.c b/src/system_settings.c index b44a3a1..b0b2bd6 100644 --- a/src/system_settings.c +++ b/src/system_settings.c @@ -16,8 +16,6 @@ #include #include -#include - #include #include @@ -50,6 +48,7 @@ system_setting_s system_setting_table[] = { system_setting_del_incoming_call_ringtone, /* DEL */ system_setting_list_incoming_call_ringtone, /* LIST */ system_setting_feature_check_incoming_call, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, @@ -65,6 +64,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ system_setting_feature_check_home_screen, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, @@ -80,6 +80,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ system_setting_feature_check_lock_screen, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, @@ -95,6 +96,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, @@ -110,6 +112,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, @@ -125,6 +128,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, @@ -140,6 +144,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ system_setting_feature_check_notification_email, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -154,6 +159,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -168,6 +174,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -182,6 +189,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ system_setting_feature_check_lock_screen, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -196,6 +204,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -210,6 +219,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -224,6 +234,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -238,6 +249,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -252,6 +264,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -266,6 +279,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -280,6 +294,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -294,6 +309,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -308,6 +324,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -322,6 +339,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -336,6 +354,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -350,6 +369,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ system_setting_feature_check_incoming_call, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -364,6 +384,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -378,6 +399,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -392,6 +414,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -406,6 +429,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -420,6 +444,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ system_setting_feature_check_wifi, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -434,6 +459,7 @@ system_setting_s system_setting_table[] = { NULL, /* del */ NULL, /* list */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -448,6 +474,7 @@ system_setting_s system_setting_table[] = { NULL, /* del */ NULL, /* list */ system_setting_feature_check_telephony, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, @@ -463,6 +490,7 @@ system_setting_s system_setting_table[] = { NULL, /* del */ NULL, /* list */ system_setting_feature_check_telephony, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -477,6 +505,7 @@ system_setting_s system_setting_table[] = { NULL, /* del */ NULL, /* list */ system_setting_feature_check_telephony, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -491,6 +520,7 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { @@ -505,10 +535,11 @@ system_setting_s system_setting_table[] = { NULL, /* DEL */ NULL, /* LIST */ NULL, /* feature check */ + { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, { - SYSTEM_SETTINGS_MAX, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL + SYSTEM_SETTINGS_MAX, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, { NULL, 0 }, NULL } }; @@ -626,7 +657,7 @@ int system_settings_get_value(system_settings_key_e key, system_setting_data_typ return SYSTEM_SETTINGS_ERROR_IO_ERROR; } - return system_setting_getter(key, system_setting_item->data_type, value); + return system_setting_getter(key, value); } /* LCOV_EXCL_START */ @@ -662,7 +693,7 @@ int system_settings_set_value(system_settings_key_e key, system_setting_data_typ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } - return system_setting_setter(key, system_setting_item->data_type, value); + return system_setting_setter(key, value); } /* LCOV_EXCL_STOP */ @@ -700,7 +731,7 @@ int system_settings_add_value(system_settings_key_e key, system_setting_data_typ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } - return system_setting_adder(key, system_setting_item->data_type, value); + return system_setting_adder(key, value); } @@ -735,7 +766,7 @@ int system_settings_del_value(system_settings_key_e key, system_setting_data_typ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } - return system_setting_deler(key, system_setting_item->data_type, value); + return system_setting_deler(key, value); } @@ -775,7 +806,7 @@ int system_settings_list_value(system_settings_key_e key, system_setting_data_ty return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } - return system_setting_lister(key, system_setting_item->data_type, system_setting_data_iterator, user_data); + return system_setting_lister(key, system_setting_data_iterator, user_data); } @@ -955,6 +986,85 @@ int system_settings_unset_changed_cb(system_settings_key_e key) return system_setting_unset_changed_cb(key); } +int system_settings_add_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data) +{ + LOGE("Enter [%s]", __FUNCTION__); + char *vconf_string = NULL; + system_setting_h system_setting_item; + + if (callback == NULL) { + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + } + + if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + int ret = system_settings_get_item(key, &system_setting_item); + if (ret != 0) { + if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) + LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + return ret; + } + + system_settings_vconf_get_key_string(key, &vconf_string); + LOGE("[%s] key = %d %s", __FUNCTION__, key, vconf_string ? vconf_string : "NULL"); + + /* Store the callback function from application side */ + ret = add_multi_callback(&system_setting_item->changed_cb_list, callback, user_data); + if (ret != SYSTEM_SETTINGS_ERROR_NONE) { + LOGE("[%s] IO_ERROR(0x%08x) : failed to add muti-callback for the system settings", __FUNCTION__, ret); + return ret; + } + + if (!system_setting_item->changed_cb_list.is_registered) { + int ret = system_setting_vconf_set_changed_multi_cb(vconf_string, key); + if (ret == SYSTEM_SETTINGS_ERROR_NONE) + system_setting_item->changed_cb_list.is_registered = 1; + LOGE("Leave [%s]", __FUNCTION__); + return ret; + } + + LOGE("Leave [%s]", __FUNCTION__); + return SYSTEM_SETTINGS_ERROR_NONE; +} + +int system_settings_remove_changed_cb(system_settings_key_e key, system_settings_changed_cb callback) +{ + LOGE("Enter [%s]", __FUNCTION__); + char *vconf_string = NULL; + system_setting_h system_setting_item; + + if (callback == NULL) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + int ret = system_settings_get_item(key, &system_setting_item); + if (ret != 0) { + if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) + LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + return ret; + } + + delete_multi_callback(&system_setting_item->changed_cb_list, callback); + + if (system_setting_item->changed_cb_list.list == NULL) { + int ret = 0; + system_settings_vconf_get_key_string(key, &vconf_string); + if (vconf_string == NULL) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + ret = system_setting_vconf_unset_changed_multi_cb(vconf_string, key); + if (ret == SYSTEM_SETTINGS_ERROR_NONE) + system_setting_item->changed_cb_list.is_registered = 0; + LOGE("Leave [%s]", __FUNCTION__); + return ret; + } + + LOGE("Leave [%s]", __FUNCTION__); + return SYSTEM_SETTINGS_ERROR_NONE; +} + ////////////////////////////////////////////////////////////////////////////////////////////////// // list ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -997,4 +1107,3 @@ int system_settings_delete_value_string(system_settings_key_e key, const char* v return system_settings_del_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void *)value); } - diff --git a/src/system_settings_json.c b/src/system_settings_json.c index 4ed88a5..6380c93 100644 --- a/src/system_settings_json.c +++ b/src/system_settings_json.c @@ -7,6 +7,7 @@ //#define VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST +/* LCOV_EXCL_START */ static void ss_json_ringtone_save(JsonNode *root) { // write here @@ -22,6 +23,7 @@ static void ss_json_ringtone_save(JsonNode *root) #endif g_object_unref(generator); } +/* LCOV_EXCL_STOP */ JsonParser* ss_json_ringtone_open_file(char* path) @@ -146,6 +148,7 @@ bool ss_json_ringtone_contain(JsonNode *root, char* newfile) return ret; } +/* LCOV_EXCL_START */ void ss_json_ringtone_list(JsonNode *root) { int size = json_array_get_length(json_node_get_array(root)); @@ -158,5 +161,6 @@ void ss_json_ringtone_list(JsonNode *root) SETTING_TRACE("(%s) --- (%s) \n", name, path); } } +/* LCOV_EXCL_STOP */ diff --git a/src/system_settings_multi_callback.c b/src/system_settings_multi_callback.c new file mode 100644 index 0000000..490841e --- /dev/null +++ b/src/system_settings_multi_callback.c @@ -0,0 +1,111 @@ +#include +#include + +void clean_node(callback_node* node) +{ + if (!node) + return; + + node->callback = NULL; + node->user_data = NULL; +} + + +callback_node* alloc_multi_callback_node() +{ + callback_node* node = NULL; + node = (callback_node*)malloc(sizeof(callback_node)); + + if (node == NULL) { + SETTING_TRACE("Not enough node...."); + return NULL; + } + + clean_node(node); + + return node; +} + +void free_multi_callback_node(callback_node* node) +{ + if (node) + free(node); + return; +} + +GList* find_callback_node(callback_list *handle, system_settings_changed_cb ptr) +{ + if (!handle) + return NULL; + + GList * itr = g_list_first(handle->list); + while (itr != NULL) { + callback_node* node = (callback_node*)itr->data; + if (node->callback == ptr) + return itr; + itr = g_list_next(itr); + } + + return itr; /* itr == NULL NOT found! */ +} + + +int delete_multi_callback(callback_list *handle, system_settings_changed_cb ptr) +{ + SETTING_TRACE_BEGIN; + if (!handle || !ptr) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + GList* itr = find_callback_node(handle, ptr); + if (itr) { + handle->list = g_list_remove_link(handle->list, itr); + free_multi_callback_node((callback_node*)itr->data); + g_list_free(itr); + } + + SETTING_TRACE_END; + return SYSTEM_SETTINGS_ERROR_NONE; +} + +int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, void *user_data) +{ + SETTING_TRACE_BEGIN; + if (!handle || !ptr) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + GList* itr = find_callback_node(handle, ptr); + if (itr != NULL) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + callback_node* node = alloc_multi_callback_node(); + + if (node == NULL) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + node->callback = ptr; + node->user_data = user_data; + + /* append the node to list. free_multi_callback_node will free the node */ + handle->list = g_list_append(handle->list, node); + + SETTING_TRACE_END; + return SYSTEM_SETTINGS_ERROR_NONE; +} + +int invoke_callback_list(callback_list *handle, system_settings_key_e key) +{ + SETTING_TRACE_BEGIN; + if (!handle) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + GList * itr = g_list_first(handle->list); + while (itr != NULL) { + callback_node* node = (callback_node*)itr->data; + if (node->callback) + node->callback(key, node->user_data); + itr = g_list_next(itr); + } + + SETTING_TRACE_END; + return SYSTEM_SETTINGS_ERROR_NONE; +} diff --git a/src/system_settings_ringtones.c b/src/system_settings_ringtones.c index 7e69221..d0c1a0f 100644 --- a/src/system_settings_ringtones.c +++ b/src/system_settings_ringtones.c @@ -24,6 +24,7 @@ #include "system_settings_ringtones.h" #include "system_settings_json.h" +/* LCOV_EXCL_START */ /*remove ext name */ char *get_filename_from_fullname(const char *fullname) { @@ -39,6 +40,7 @@ char *get_filename_from_fullname(const char *fullname) return strdup((char*)tmp); } +/* LCOV_EXCL_STOP */ char *get_media_basename(const char *dir_path, const char *name) { diff --git a/src/system_settings_vconf.c b/src/system_settings_vconf.c index 3c9e778..66b4c3f 100644 --- a/src/system_settings_vconf.c +++ b/src/system_settings_vconf.c @@ -30,6 +30,43 @@ #define LOG_TAG "TIZEN_N_SYSTEM_SETTINGS" +static char* _system_settings_vconf_table[38] = { + VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, + VCONFKEY_BGSET, + VCONFKEY_IDLE_LOCK_BGSET, + VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, + VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, + VCONFKEY_SETAPPL_MOTION_ACTIVATION, + VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, + VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, + VCONFKEY_3G_ENABLE, + NULL, + VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, + NULL, + VCONFKEY_REGIONFORMAT, + VCONFKEY_LANGSET, + VCONFKEY_REGIONFORMAT_TIME1224, + VCONFKEY_SETAPPL_TIMEZONE_ID, + VCONFKEY_SYSTEM_TIME_CHANGED, + VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, + VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, + VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, + VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, + VCONFKEY_SETAPPL_DEVICE_NAME_STR, + VCONFKEY_SETAPPL_MOTION_ACTIVATION, + VCONFKEY_WIFI_ENABLE_QS, + VCONFKEY_TELEPHONY_FLIGHT_MODE, + VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, + VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, + VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, + VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, + VCONFKEY_SETAPPL_AD_ID, + VCONFKEY_SETAPPL_UDSM, + VCONFKEY_SETAPPL_UDSM_PKGID_LIST, + VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, + VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, + "MAX" +}; int system_setting_vconf_get_value_int(const char *vconf_key, int *value) { @@ -273,4 +310,120 @@ int system_setting_vconf_unset_changed_cb(const char *vconf_key, int slot) return SYSTEM_SETTINGS_ERROR_NONE; } +int system_settings_vconf_get_key_string(system_settings_key_e key, char **key_string) +{ + if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE) { + *key_string = NULL; /* Not Supported changed callback*/ + return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + } + + *key_string = _system_settings_vconf_table[(int)key]; + + if (*key_string == NULL) + return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + + return SYSTEM_SETTINGS_ERROR_NONE; +} + +static void system_setting_vconf_event_multi_cb(keynode_t *node, void *event_data) +{ + LOGE("Enter [%s]", __FUNCTION__); + system_settings_key_e pkey = (system_settings_key_e)event_data; + + if (node != NULL) { + system_setting_h system_setting_item; + + int ret = system_settings_get_item(pkey, &system_setting_item); + if (ret != 0) { + if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) + LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + } + + invoke_callback_list(&system_setting_item->changed_cb_list, pkey); + } + LOGE("Leave [%s]", __FUNCTION__); +} + +static void system_setting_vconf_event_multi_cb_slot_0(keynode_t *node, void *event_data) +{ + system_setting_vconf_event_multi_cb(node, event_data); +} + +static void system_setting_vconf_event_multi_cb_slot_1(keynode_t *node, void *event_data) +{ + system_setting_vconf_event_multi_cb(node, event_data); +} + +static void system_setting_vconf_event_multi_cb_slot_2(keynode_t *node, void *event_data) +{ + system_setting_vconf_event_multi_cb(node, event_data); +} + +static void system_setting_vconf_event_multi_cb_slot_3(keynode_t *node, void *event_data) +{ + system_setting_vconf_event_multi_cb(node, event_data); +} + +static system_setting_vconf_event_cb system_setting_vconf_get_event_multi_cb_slot(system_settings_key_e key) +{ + int cal = (int) key; + int slot = cal % 4; + + switch (slot) { + case 0: + return system_setting_vconf_event_multi_cb_slot_0; + + case 1: + return system_setting_vconf_event_multi_cb_slot_1; + + case 2: + return system_setting_vconf_event_multi_cb_slot_2; + + case 3: + return system_setting_vconf_event_multi_cb_slot_3; + + default: + return NULL; + } +} + +int system_setting_vconf_set_changed_multi_cb(const char *vconf_key, system_settings_key_e key) +{ + LOGE("Enter [%s]", __FUNCTION__); + system_setting_vconf_event_cb vconf_event_cb; + + vconf_event_cb = system_setting_vconf_get_event_multi_cb_slot(key); + + if (vconf_event_cb == NULL) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + int ret = vconf_notify_key_changed(vconf_key, vconf_event_cb, (void *)key); + if (ret != 0) { + LOGE("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_notify_key_changed error"); + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + + LOGE("Leave [%s]", __FUNCTION__); + return SYSTEM_SETTINGS_ERROR_NONE; +} + +int system_setting_vconf_unset_changed_multi_cb(const char *vconf_key, system_settings_key_e key) +{ + LOGE("Enter [%s]", __FUNCTION__); + system_setting_vconf_event_cb vconf_event_cb; + + vconf_event_cb = system_setting_vconf_get_event_multi_cb_slot(key); + + if (vconf_event_cb == NULL) + return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + + int ret = vconf_ignore_key_changed(vconf_key, vconf_event_cb); + if (ret != 0) { + LOGE("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_ignore_key_changed error"); + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + + LOGE("Leave [%s]", __FUNCTION__); + return SYSTEM_SETTINGS_ERROR_NONE; +}