From 38b445a0270a971078c04da6935f28bc3c0e3493 Mon Sep 17 00:00:00 2001 From: MyoungJune Park Date: Mon, 14 Dec 2015 14:42:48 +0900 Subject: [PATCH] Change key for lock_state api Change-Id: Icc5f2189968c428d040ea652d7137a4ec6f45614 Signed-off-by: MyoungJune Park --- CMakeLists.txt | 4 +-- doc/system_settings_doc.h | 2 +- include/system_settings.h | 21 +++++++++--- include/system_settings_private.h | 41 +++++++++++++++++++++++ packaging/capi-system-system-settings.spec | 6 +++- src/system_setting_platform.c | 52 ++++++++++++++++++++++++++---- src/system_settings.c | 10 ++++++ 7 files changed, 121 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 626e069..b4bc7b4 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ SET(LIBDIR "${CMAKE_LIBDIR}") SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -#SET(requires "elementary ecore ecore-file dlog vconf appcore-efl capi-base-common glib-2.0 gobject-2.0 fontconfig libxml-2.0 efl-assist") -SET(requires "elementary ecore ecore-file dlog vconf appcore-efl capi-base-common glib-2.0 gobject-2.0 fontconfig libxml-2.0") +SET(requires "elementary ecore ecore-file dlog vconf appcore-efl capi-base-common glib-2.0 gobject-2.0 fontconfig libxml-2.0 bundle capi-appfw-application pkgmgr pkgmgr-info") + SET(pc_requires "capi-base-common") IF(TIZEN_WEARABLE) diff --git a/doc/system_settings_doc.h b/doc/system_settings_doc.h index bec661e..6387527 100644 --- a/doc/system_settings_doc.h +++ b/doc/system_settings_doc.h @@ -29,5 +29,5 @@ * 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. +* For more information on feature, see System Settings Programming Guide. */ diff --git a/include/system_settings.h b/include/system_settings.h index 2c6066f..c30184e 100644 --- a/include/system_settings.h +++ b/include/system_settings.h @@ -91,10 +91,21 @@ typedef enum { SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, /**< (string) Indicates the file path of the current notification tone set by the user. */ SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD, /**< (int) Indicates the time period for notification repetitions. */ + SYSTEM_SETTINGS_KEY_LOCK_STATE, /**< (int) Indicates the current lock state */ SYSTEM_SETTINGS_KEY_MAX, } system_settings_key_e; +/** + * @brief Enumeration for Idle Lock State + * @since_tizen 2.3.1 + */ +typedef enum { + SYSTEM_SETTINGS_LOCK_STATE_UNLOCK = 0, /**< Device is unlocked */ + SYSTEM_SETTINGS_LOCK_STATE_LOCK, /**< Device is locked */ + SYSTEM_SETTINGS_LOCK_STATE_LAUNCHING_LOCK /**< Device is being locked */ +} system_settings_idle_lock_state_e; + /** * @brief Enumeration for font size. @@ -140,7 +151,6 @@ 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 - * @privlevel public * @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 @@ -148,6 +158,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 + * @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); @@ -171,7 +182,6 @@ 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 - * @privlevel public * @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 @@ -179,6 +189,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 + * @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); @@ -202,7 +213,6 @@ int system_settings_set_value_string(system_settings_key_e key, const char *valu /** * @brief Gets the system settings value associated with the given key as a string. * @since_tizen 2.3 - * @privlevel public * @remarks You must release @a value using free(). * @param[in] key The key name of the system settings * @param[out] value The current system settings value of the given key @@ -211,13 +221,13 @@ 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 + * @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); /** * @brief Registers a change event callback for the given system settings key. * @since_tizen 2.3 - * @privlevel public * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb. * @param[in] key The key name of the system settings * @param[in] callback The callback function to invoke @@ -230,6 +240,7 @@ int system_settings_get_value_string(system_settings_key_e key, char **value); * * @see system_settings_unset_changed_cb() * @see system_settings_changed_cb() + * @warning %http://tizen.org/privilege/systemsettings (public level privilege) MUST NOT be declared to use this API since 2.3.1. * */ int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data); @@ -237,7 +248,6 @@ int system_settings_set_changed_cb(system_settings_key_e key, system_settings_ch /** * @brief Unregisters the callback function. * @since_tizen 2.3 - * @privlevel public * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb. * @param[in] key The key name of the system settings * @return 0 on success, otherwise a negative error value @@ -246,6 +256,7 @@ int system_settings_set_changed_cb(system_settings_key_e key, system_settings_ch * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error * * @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. */ int system_settings_unset_changed_cb(system_settings_key_e key); diff --git a/include/system_settings_private.h b/include/system_settings_private.h index 7cf1ac0..463c421 100644 --- a/include/system_settings_private.h +++ b/include/system_settings_private.h @@ -1198,6 +1198,47 @@ int system_setting_set_changed_callback_network_wifi_notification(system_setting int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key); +/** + * @internal + * @brief get current Idle Lock State + * @since_tizen 2.3.1 + * @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_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); + +/** + * @internal + * @since_tizen 2.3 + * @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_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); + +/** + * @internal + * @since_tizen 2.3 + * @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_PERMISSION_DENIED Permission violation error + */ +int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data); + +/** + * @internal + * @since_tizen 2.3 + * @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_PERMISSION_DENIED Permission violation error + */ +int system_setting_unset_changed_callback_lock_state(system_settings_key_e key); + /*// */ diff --git a/packaging/capi-system-system-settings.spec b/packaging/capi-system-system-settings.spec index 3a07209..144f57d 100755 --- a/packaging/capi-system-system-settings.spec +++ b/packaging/capi-system-system-settings.spec @@ -3,7 +3,7 @@ Summary: A System Settings library in Tizen Native API Version: 0.0.2 Release: 3 Group: System/System Info -License: Apache-1.0 +License: Apache-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: cmake BuildRequires: pkgconfig(dlog) @@ -13,11 +13,15 @@ BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(ecore-file) BuildRequires: pkgconfig(appcore-efl) +BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gobject-2.0) BuildRequires: pkgconfig(fontconfig) BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(bundle) +BuildRequires: pkgconfig(pkgmgr) +BuildRequires: pkgconfig(pkgmgr-info) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig diff --git a/src/system_setting_platform.c b/src/system_setting_platform.c index c9b0db1..12b156f 100644 --- a/src/system_setting_platform.c +++ b/src/system_setting_platform.c @@ -36,11 +36,17 @@ #include +//#include #include #include #include +#include +#include +#include +#include + #include #include @@ -602,6 +608,7 @@ int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_s int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value) { + SETTING_TRACE_BEGIN; char *vconf_value; vconf_value = (char *)value; @@ -647,6 +654,7 @@ int system_setting_set_font_size(system_settings_key_e key, system_setting_data_ */ void *font_conf_doc_parse(char *doc_name, char *font_name) { + SETTING_TRACE_BEGIN; xmlDocPtr doc = NULL; xmlNodePtr cur = NULL; xmlNodePtr cur2 = NULL; @@ -776,6 +784,7 @@ int system_setting_set_font_type(system_settings_key_e key, system_setting_data_ char *vconf_value; vconf_value = (char *)value; + if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } @@ -813,6 +822,7 @@ int system_setting_set_3g_data_network(system_settings_key_e key, system_setting if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } + return SYSTEM_SETTINGS_ERROR_NONE; } @@ -842,7 +852,6 @@ int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_ char *vconf_value; vconf_value = (char *)value; /* ex) com.samsung.lockscreen */ -#if 0 int r = 0; pkgmgrinfo_appinfo_h handle; char *apptype = NULL; @@ -879,7 +888,6 @@ int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_ return SYSTEM_SETTINGS_ERROR_IO_ERROR; } } -#endif return SYSTEM_SETTINGS_ERROR_NONE; } @@ -1459,7 +1467,6 @@ int system_setting_set_locale_country(system_settings_key_e key, system_setting_ if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } - return SYSTEM_SETTINGS_ERROR_NONE; } @@ -1510,7 +1517,6 @@ int system_setting_set_locale_language(system_settings_key_e key, system_setting if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } - return SYSTEM_SETTINGS_ERROR_NONE; } @@ -1582,7 +1588,6 @@ int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settin return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3); } - //VCONFKEY_SETAPPL_TIMEZONE_ID int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value) { SETTING_TRACE_BEGIN; @@ -1813,6 +1818,7 @@ int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_sett if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } + return SYSTEM_SETTINGS_ERROR_NONE; } @@ -1943,7 +1949,7 @@ int system_setting_set_notification_repetition_period(system_settings_key_e key, int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data) { SETTING_TRACE_BEGIN; - return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 1, user_data); + return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD, 1, user_data); } int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key) @@ -2040,5 +2046,39 @@ int system_setting_unset_changed_callback_network_wifi_notification(system_setti return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4); } +int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +{ + int vconf_value; + + if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) { + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + *value = (void *)vconf_value; + + return SYSTEM_SETTINGS_ERROR_NONE; +} + +int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +{ + SETTING_TRACE_BEGIN; + int *vconf_value; + vconf_value = (int *)value; + + if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) { + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + SETTING_TRACE_END; + return SYSTEM_SETTINGS_ERROR_NONE; +} + +int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data) +{ + return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data); +} + +int system_setting_unset_changed_callback_lock_state(system_settings_key_e key) +{ + return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4); +} diff --git a/src/system_settings.c b/src/system_settings.c index bcf7213..1ad039e 100644 --- a/src/system_settings.c +++ b/src/system_settings.c @@ -316,6 +316,16 @@ system_setting_s system_setting_table[] = { NULL /* user data */ }, { + SYSTEM_SETTINGS_KEY_LOCK_STATE, + SYSTEM_SETTING_DATA_TYPE_INT, + system_setting_get_lock_state, + system_setting_set_lock_state, + system_setting_set_changed_callback_lock_state, + system_setting_unset_changed_callback_lock_state, + NULL, + NULL /* user data */ + }, + { SYSTEM_SETTINGS_MAX, -1, NULL, NULL, NULL, NULL, NULL, NULL } }; -- 2.7.4