From 57c864cfb4d70a7fda1a8334ea53504bb3818772 Mon Sep 17 00:00:00 2001 From: "jinwang.an" Date: Thu, 11 May 2017 16:32:02 +0900 Subject: [PATCH] Changed comment about SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED. Conflicts: doc/system_settings_doc.h Change-Id: I608b6d4c2cd5a6d29cf8610bae98f95f6845e0d9 Signed-off-by: jinwang.an --- doc/system_settings_doc.h | 33 ++++++++++- include/system_settings.h | 38 +++++++------ include/system_settings_private.h | 57 ++++++++++++++++++- src/system_setting_platform.c | 114 ++++++++++++++++++++++++-------------- src/system_settings.c | 30 ++++++---- 5 files changed, 201 insertions(+), 71 deletions(-) diff --git a/doc/system_settings_doc.h b/doc/system_settings_doc.h index 1c44d9d..6fe81cd 100644 --- a/doc/system_settings_doc.h +++ b/doc/system_settings_doc.h @@ -29,5 +29,36 @@ * System Settings API provides functions for getting the system configuration related to user preferences. * The main features of the System Settings API include accessing system-wide configurations, such as ringtones, wallpapers, and etc. * -* For more information on feature, see System Settings Programming Guide. +* @section CAPI_SYSTEM_SYSTEM_SETTINGS_MODULE_FEATURE Related Features +* +* This API is related with the following features: +* - http://tizen.org/feature/systemsetting +* - http://tizen.org/feature/systemsetting.home_screen +* - http://tizen.org/feature/systemsetting.lock_screen +* - http://tizen.org/feature/systemsetting.incoming_call +* - http://tizen.org/feature/systemsetting.notification_email +* - http://tizen.org/feature/network.wifi +* - http://tizen.org/feature/network.telephony +* +* It is recommended to design feature related codes in your application for reliability. +* +* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE,thereby controlling the procedure of your application. +* +* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK. +* +* More details on featuring your application can be found from Feature Element. + +* The table below shows addtional related features on which System Settings keys depend. +* +* +* +* +* +* +* +* +* +* +* +*
Additional Related Feature System-Settings Keys
http://tizen.org/feature/systemsetting.home_screen #SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN
http://tizen.org/feature/systemsetting.lock_screen #SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN
#SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP
http://tizen.org/feature/systemsetting.incoming_call #SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE
#SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION
http://tizen.org/feature/systemsetting.notification_email #SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE
http://tizen.org/feature/network.wifi #SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION
http://tizen.org/feature/network.telephony #SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE
#SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST
*/ diff --git a/include/system_settings.h b/include/system_settings.h index 22ca397..86dfbad 100644 --- a/include/system_settings.h +++ b/include/system_settings.h @@ -143,7 +143,7 @@ typedef void (*system_settings_changed_cb)(system_settings_key_e key, void *user * @since_tizen 2.3 * @privlevel platform * @privilege %http://tizen.org/privilege/systemsettings.admin - * @param[in] key The key name of the system settings changed + * @remarks 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[out] value The new system settings value of the given key * @return @c 0 on success, otherwise a negative error value @@ -151,13 +151,14 @@ typedef void (*system_settings_changed_cb)(system_settings_key_e key, void *user * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device */ int system_settings_set_value_int(system_settings_key_e key, int value); /** * @brief Gets the system settings value associated with the given key as an integer. * @since_tizen 2.3 + * @remarks 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[out] value The current system settings value of the given key * @return @c 0 on success, otherwise a negative error value @@ -165,7 +166,7 @@ int system_settings_set_value_int(system_settings_key_e key, int value); * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device * @warning %http://tizen.org/privilege/systemsettings (public level privilege) MUST NOT be declared to use this API since 2.3.1. */ int system_settings_get_value_int(system_settings_key_e key, int *value); @@ -177,6 +178,7 @@ int system_settings_get_value_int(system_settings_key_e key, int *value); * @since_tizen 2.3 * @privlevel platform * @privilege %http://tizen.org/privilege/systemsettings.admin + * @remarks 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[out] value The new system settings value of the given key * @return @c 0 on success, otherwise a negative error value @@ -184,13 +186,14 @@ int system_settings_get_value_int(system_settings_key_e key, int *value); * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device */ int system_settings_set_value_bool(system_settings_key_e key, bool value); /** * @brief Gets the system settings value associated with the given key as a boolean. * @since_tizen 2.3 + * @remarks 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[out] value The current system settings value of the given key * @return @c 0 on success, otherwise a negative error value @@ -198,7 +201,7 @@ int system_settings_set_value_bool(system_settings_key_e key, bool value); * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device * @warning %http://tizen.org/privilege/systemsettings (public level privilege) MUST NOT be declared to use this API since 2.3.1. */ int system_settings_get_value_bool(system_settings_key_e key, bool *value); @@ -209,7 +212,7 @@ int system_settings_get_value_bool(system_settings_key_e key, bool *value); * @since_tizen 2.3 * @privlevel platform * @privilege %http://tizen.org/privilege/systemsettings.admin - * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for setting. + * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for setting. 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[out] value The new system settings value of the given key * @return @c 0 on success, otherwise a negative error value @@ -217,14 +220,14 @@ int system_settings_get_value_bool(system_settings_key_e key, bool *value); * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device */ int system_settings_set_value_string(system_settings_key_e key, const char *value); /** * @brief Gets the system settings value associated with the given key as a string. * @since_tizen 2.3 - * @remarks You must release @a value using free(). + * @remarks You must release @a value using free(). 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[out] value The current system settings value of the given key * @return 0 on success, otherwise a negative error value @@ -232,7 +235,7 @@ int system_settings_set_value_string(system_settings_key_e key, const char *valu * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device * @warning %http://tizen.org/privilege/systemsettings (public level privilege) MUST NOT be declared to use this API since 2.3.1. */ int system_settings_get_value_string(system_settings_key_e key, char **value); @@ -240,7 +243,7 @@ int system_settings_get_value_string(system_settings_key_e key, char **value); /** * @brief Registers a change event callback for the given system settings key. * @since_tizen 2.3 - * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb. + * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb. 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 @@ -248,7 +251,7 @@ int system_settings_get_value_string(system_settings_key_e key, char **value); * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @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_unset_changed_cb() @@ -261,13 +264,13 @@ int system_settings_set_changed_cb(system_settings_key_e key, system_settings_ch /** * @brief Unregisters the callback function. * @since_tizen 2.3 - * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb. + * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb. 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 * @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_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device * * @see system_settings_set_changed_cb() * @warning %http://tizen.org/privilege/systemsettings (public level privilege) MUST NOT be declared to use this API since 2.3.1. @@ -292,6 +295,7 @@ typedef bool (*system_settings_iter_cb)(int index, const char* value, void *cb_d * @since_tizen 3.0 * @privlevel platform * @privilege %http://tizen.org/privilege/systemsettings.admin + * @remarks 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 name for iteration * @param[in] user_data The user data passed from caller-side @@ -300,7 +304,7 @@ typedef bool (*system_settings_iter_cb)(int index, const char* value, void *cb_d * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device */ int system_settings_foreach_value_string(system_settings_key_e key, system_settings_iter_cb callback, void *user_data); @@ -310,6 +314,7 @@ int system_settings_foreach_value_string(system_settings_key_e key, system_setti * @since_tizen 3.0 * @privlevel platform * @privilege %http://tizen.org/privilege/systemsettings.admin + * @remarks 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] value string typed value to be appended * @return @c 0 on success, otherwise a negative error value @@ -317,7 +322,7 @@ int system_settings_foreach_value_string(system_settings_key_e key, system_setti * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device */ int system_settings_add_value_string(system_settings_key_e key, const char *value); @@ -327,6 +332,7 @@ int system_settings_add_value_string(system_settings_key_e key, const char *valu * @since_tizen 3.0 * @privlevel platform * @privilege %http://tizen.org/privilege/systemsettings.admin + * @remarks 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] value string typed value to be removed * @return @c 0 on success, otherwise a negative error value @@ -334,7 +340,7 @@ int system_settings_add_value_string(system_settings_key_e key, const char *valu * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error - * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED The related feature is not supported on the device */ int system_settings_delete_value_string(system_settings_key_e key, const char *value); diff --git a/include/system_settings_private.h b/include/system_settings_private.h index db48495..5c9e8c2 100644 --- a/include/system_settings_private.h +++ b/include/system_settings_private.h @@ -63,7 +63,12 @@ extern "C" #define SETTING_PROFILE_PATH "tizen.org/feature/profile" -#define SETTING_3G_TELEPHONY_PATH "tizen.org/feature/network.telephony.service.cdma" +#define SETTING_INCOMING_CALL_PATH "tizen.org/feature/systemsetting.incoming_call " +#define SETTING_HOME_SCREEN_PATH "tizen.org/feature/systemsetting.home_screen" +#define SETTING_LOCK_SCREEN_PATH "tizen.org/feature/systemsetting.lock_screen" +#define SETTING_NOTIFICATION_EMAIL_PATH "tizen.org/feature/systemsetting.notification_email" +#define SETTING_WIFI_PATH "tizen.org/feature/network.wifi" +#define SETTING_TELEPHONY_PATH "tizen.org/feature/network.telephony" /** * @internal @@ -1424,6 +1429,56 @@ int system_setting_unset_changed_callback_uds_pkg_list(system_settings_key_e key * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API */ +int system_setting_feature_check_incoming_call(void * value); + +/** + * @internal + * @since_tizen 4.0 + * @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 + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + */ +int system_setting_feature_check_home_screen(void * value); + +/** + * @internal + * @since_tizen 4.0 + * @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 + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + */ +int system_setting_feature_check_lock_screen(void * value); + +/** + * @internal + * @since_tizen 4.0 + * @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 + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + */ +int system_setting_feature_check_notification_email(void * value); + +/** + * @internal + * @since_tizen 4.0 + * @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 + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + */ +int system_setting_feature_check_wifi(void * value); + +/** + * @internal + * @since_tizen 4.0 + * @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 + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + */ int system_setting_feature_check_telephony(void *value); /*// */ diff --git a/src/system_setting_platform.c b/src/system_setting_platform.c index b1d4e63..3b1856b 100644 --- a/src/system_setting_platform.c +++ b/src/system_setting_platform.c @@ -2170,68 +2170,98 @@ int system_setting_unset_changed_callback_ads_id(system_settings_key_e key) return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AD_ID, 0); } -int system_setting_get_profile_info(int *value) +int system_settings_feature_check_bool(char *path) { - char *profile_string = NULL; - static int is_first = 1; - static int profile_data = 0; + bool profile_data = false; + int ret = system_info_get_platform_bool(path, &profile_data); + if (ret != SYSTEM_INFO_ERROR_NONE) { + SETTING_TRACE("Setting - reading profile string failed, %d", ret); + return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + } - if (value == NULL) - return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; + ret = (profile_data == true) ? SYSTEM_SETTINGS_ERROR_NONE : SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + + return ret; - *value = 0; +} - if (!is_first) { - *value = profile_data; - return SYSTEM_SETTINGS_ERROR_NONE; +int system_setting_feature_check_incoming_call(void * value) +{ + static bool first_query = true; + static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + + if (first_query == true) { + ret = system_settings_feature_check_bool(SETTING_INCOMING_CALL_PATH); + first_query = false; } - is_first = 0; + return ret; +} - int ret = system_info_get_platform_string(SETTING_PROFILE_PATH, &profile_string); - if (ret != SYSTEM_INFO_ERROR_NONE) { - SETTING_TRACE("Setting - reading profile string failed, %d", ret); - return SYSTEM_SETTINGS_ERROR_IO_ERROR; +int system_setting_feature_check_home_screen(void * value) +{ + static bool first_query = true; + static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + + if (first_query == true) { + ret = system_settings_feature_check_bool(SETTING_HOME_SCREEN_PATH); + first_query = false; } - if (profile_string == NULL) - return SYSTEM_SETTINGS_ERROR_IO_ERROR; + return ret; +} - LOGE("Profile : %s", profile_string); - - if (!strcmp(profile_string, "mobile")) - *value = SYSTEM_SETTING_SUPPORTED_PROFILE_MOBILE; - else if (!strcmp(profile_string, "wearable")) - *value = SYSTEM_SETTING_SUPPORTED_PROFILE_WEARABLE; - else if (!strcmp(profile_string, "tv")) - *value = SYSTEM_SETTING_SUPPORTED_PROFILE_TV; - else if (!strcmp(profile_string, "common")) - *value = SYSTEM_SETTING_SUPPORTED_PROFILE_COMMON; - else { - FREE(profile_string); - return SYSTEM_SETTINGS_ERROR_IO_ERROR; +int system_setting_feature_check_lock_screen(void * value) +{ + static bool first_query = true; + static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + + if (first_query == true) { + ret = system_settings_feature_check_bool(SETTING_LOCK_SCREEN_PATH); + first_query = false; } - profile_data = *value; - FREE(profile_string); - return SYSTEM_SETTINGS_ERROR_NONE; + return ret; } -int system_setting_feature_check_telephony(void * value) +int system_setting_feature_check_notification_email(void * value) { - int profile_data = 0; + static bool first_query = true; + static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; - if (system_setting_get_profile_info(&profile_data) != SYSTEM_SETTINGS_ERROR_NONE) - return SYSTEM_SETTINGS_ERROR_IO_ERROR; + if (first_query == true) { + ret = system_settings_feature_check_bool(SETTING_NOTIFICATION_EMAIL_PATH); + first_query = false; + } - if (profile_data == SYSTEM_SETTING_SUPPORTED_PROFILE_MOBILE || - profile_data == SYSTEM_SETTING_SUPPORTED_PROFILE_WEARABLE) - return SYSTEM_SETTINGS_ERROR_NONE; - else { - return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + return ret; +} + +int system_setting_feature_check_wifi(void * value) +{ + static bool first_query = true; + static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + + if (first_query == true) { + ret = system_settings_feature_check_bool(SETTING_WIFI_PATH); + first_query = false; } + + return ret; } +int system_setting_feature_check_telephony(void * value) +{ + static bool first_query = true; + static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + + if (first_query == true) { + ret = system_settings_feature_check_bool(SETTING_TELEPHONY_PATH); + first_query = false; + } + + return ret; +} /* LCOV_EXCL_START */ int system_setting_get_uds_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value) diff --git a/src/system_settings.c b/src/system_settings.c index 0ffeb05..a5f095e 100644 --- a/src/system_settings.c +++ b/src/system_settings.c @@ -49,7 +49,7 @@ system_setting_s system_setting_table[] = { system_setting_add_incoming_call_ringtone, /* ADD */ system_setting_del_incoming_call_ringtone, /* DEL */ system_setting_list_incoming_call_ringtone, /* LIST */ - system_setting_feature_check_telephony, /* feature check */ + system_setting_feature_check_incoming_call, /* feature check */ NULL, /* user data */ }, @@ -64,7 +64,7 @@ system_setting_s system_setting_table[] = { NULL, /* ADD */ NULL, /* DEL */ NULL, /* LIST */ - system_setting_feature_check_telephony, /* feature check */ + system_setting_feature_check_home_screen, /* feature check */ NULL, /* user data */ }, @@ -79,7 +79,7 @@ system_setting_s system_setting_table[] = { NULL, /* ADD */ NULL, /* DEL */ NULL, /* LIST */ - system_setting_feature_check_telephony, /* feature check */ + system_setting_feature_check_lock_screen, /* feature check */ NULL, /* user data */ }, @@ -139,7 +139,7 @@ system_setting_s system_setting_table[] = { NULL, /* ADD */ NULL, /* DEL */ NULL, /* LIST */ - system_setting_feature_check_telephony, /* feature check */ + system_setting_feature_check_notification_email, /* feature check */ NULL, /* user data */ }, { @@ -181,7 +181,7 @@ system_setting_s system_setting_table[] = { NULL, /* ADD */ NULL, /* DEL */ NULL, /* LIST */ - system_setting_feature_check_telephony, /* feature check */ + system_setting_feature_check_lock_screen, /* feature check */ NULL, /* user data */ }, { @@ -349,7 +349,7 @@ system_setting_s system_setting_table[] = { NULL, /* ADD */ NULL, /* DEL */ NULL, /* LIST */ - system_setting_feature_check_telephony, /* feature check */ + system_setting_feature_check_incoming_call, /* feature check */ NULL, /* user data */ }, { @@ -419,7 +419,7 @@ system_setting_s system_setting_table[] = { NULL, /* ADD */ NULL, /* DEL */ NULL, /* LIST */ - NULL, /* feature check */ + system_setting_feature_check_wifi, /* feature check */ NULL, /* user data */ }, { @@ -447,7 +447,7 @@ system_setting_s system_setting_table[] = { NULL, /* add */ NULL, /* del */ NULL, /* list */ - NULL, /* feature check */ + system_setting_feature_check_telephony, /* feature check */ NULL, /* user data */ }, @@ -459,7 +459,11 @@ system_setting_s system_setting_table[] = { system_setting_set_changed_callback_uds_state, system_setting_unset_changed_callback_uds_state, NULL, - NULL /* user data */ + NULL, /* add */ + NULL, /* del */ + NULL, /* list */ + system_setting_feature_check_telephony, /* feature check */ + NULL, /* user data */ }, { SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST, @@ -469,10 +473,14 @@ system_setting_s system_setting_table[] = { system_setting_set_changed_callback_uds_pkg_list, system_setting_unset_changed_callback_uds_pkg_list, NULL, - NULL /* user data */ + NULL, /* add */ + NULL, /* del */ + NULL, /* list */ + system_setting_feature_check_telephony, /* feature check */ + NULL, /* user data */ }, { - SYSTEM_SETTINGS_MAX, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL + SYSTEM_SETTINGS_MAX, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } }; -- 2.7.4