-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+/* * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, /**< (bool) Indicates whether the motion service is activated */
SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, /**< (string) The file path of the current email alert ringtone */
SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, /**< (bool) Indicates whether the USB debugging is enabled (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */
- SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, /**< bool) Indicates whether the 3G data network is enabled (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */
+ SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, /**< (bool) Indicates whether the 3G data network is enabled (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */
SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP = SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED+2, /**< (string) Indicates lockscreen app pkg name */
SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,/**< (string) The current system default font type (only support Get) */
SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, /**< (string) Indicates the current country setting in the <LANGUAGE>_<REGION> syntax. The country setting is in the ISO 639-2 format, and the region setting is in the ISO 3166-1 alpha-2 format */
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_ADS_ID, /**< (string) Indicates Ads ID for each device (Since 3.0) */
+ SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE, /**< (int) Indicates Ultra Data Save status, one of #system_settings_uds_state_e values (Since 4.0) */
+ SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST, /**< (string) Indicates Ultra Data Save Package List (Since 4.0), the list is a string containing whitelisted package names separated with semicolons (;) */
SYSTEM_SETTINGS_KEY_MAX,
} system_settings_key_e;
SYSTEM_SETTINGS_FONT_SIZE_GIANT, /**< A giant size */
} system_settings_font_size_e;
+/**
+ * @brief Enumeration for Ultra Data Save
+ * @since_tizen 4.0
+ */
+typedef enum {
+ SYSTEM_SETTINGS_UDS_OFF = 0, /**< OFF */
+ SYSTEM_SETTINGS_UDS_ON, /**< ON */
+ SYSTEM_SETTINGS_UDS_ON_WHITELISTED, /**< UDS on and the app is whitelisted */
+} system_settings_uds_state_e;
+
+
/**
* @brief Called when the system settings changes.
*/
int system_setting_unset_changed_callback_ads_id(system_settings_key_e key);
+/**
+ * @internal
+ * @brief get current UDS status
+ * @since_tizen 3.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_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);
+
+/**
+ * @internal
+ * @since_tizen 3.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_PERMISSION_DENIED Permission violation error
+ */
+int system_setting_set_changed_callback_uds_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
+
+/**
+ * @internal
+ * @since_tizen 3.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_PERMISSION_DENIED Permission violation error
+ */
+int system_setting_unset_changed_callback_uds_state(system_settings_key_e key);
+
+
+/**
+ * @internal
+ * @since_tizen 3.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_PERMISSION_DENIED Permission violation error
+ */
+int system_setting_set_changed_callback_uds_pkg_list(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
+
+
+
+/**
+ * @internal
+ * @since_tizen 3.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_PERMISSION_DENIED Permission violation error
+ */
+int system_setting_unset_changed_callback_uds_pkg_list(system_settings_key_e key);
+
/*// */
Name: capi-system-system-settings
Summary: A System Settings library in Tizen Native API
-Version: 0.0.2
+Version: 0.0.3
Release: 3
Group: System/System Info
License: Apache-2.0
BuildRequires: pkgconfig(alarm-service)
BuildRequires: pkgconfig(uuid)
BuildRequires: pkgconfig(capi-media-metadata-extractor)
-
BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(glib-2.0)
-
-
+BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(capi-appfw-package-manager)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
#include <fontconfig/fontconfig.h>
#include <pkgmgr-info.h>
+#include <package_manager.h>
+#include <app_manager.h>
#include <system_settings.h>
#include <system_settings_private.h>
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
SETTING_TRACE_BEGIN;
return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AD_ID, 0);
}
+//
+//----------------------------------------------------------------------------------------------------------------------------
+
+/* LCOV_EXCL_START */
+int system_setting_get_uds_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ int ** p_value = (int**)value;
+ int vconf_value;
+ char *vconf_string_value = NULL;
+
+ if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_UDSM, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ SETTING_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value);
+
+ if (vconf_value == SYSTEM_SETTINGS_UDS_ON) {
+ if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, &vconf_string_value))
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+ if (vconf_string_value) {
+ if (!strcmp(vconf_string_value, "NONE")) {
+ vconf_value = SYSTEM_SETTINGS_UDS_ON;
+ } else {
+ char *app_id = NULL;
+ char *package_id = NULL;
+ pid_t pid = getpid();
+ app_manager_get_app_id(pid, &app_id);
+
+ if (app_id) {
+ package_manager_get_package_id_by_app_id(app_id, &package_id);
+ SETTING_TRACE("[%s] udsm_pkg_list : %s", __FUNCTION__, vconf_string_value);
+ }
+
+ if (package_id && strstr(vconf_string_value, package_id)) {
+ vconf_value = SYSTEM_SETTINGS_UDS_ON_WHITELISTED;
+ SETTING_TRACE("[%s] pkg id : %s", __FUNCTION__, package_id);
+ } else {
+ vconf_value = SYSTEM_SETTINGS_UDS_ON;
+ }
+
+ }
+ if (vconf_string_value)
+ free(vconf_string_value);
+ }
+ }
+
+ **p_value = vconf_value;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_changed_callback_uds_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_UDSM, SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE, 4, user_data);
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_unset_changed_callback_uds_state(system_settings_key_e key)
+{
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_UDSM, 4);
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_changed_callback_uds_pkg_list(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST, 4, user_data);
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_unset_changed_callback_uds_pkg_list(system_settings_key_e key)
+{
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, 4);
+}
+/* LCOV_EXCL_STOP */
+
},
{
+ SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE,
+ SYSTEM_SETTING_DATA_TYPE_INT,
+ system_setting_get_uds_state,
+ NULL,
+ system_setting_set_changed_callback_uds_state,
+ system_setting_unset_changed_callback_uds_state,
+ NULL,
+ NULL /* user data */
+ },
+ {
+ SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST,
+ SYSTEM_SETTING_DATA_TYPE_STRING,
+ NULL,
+ NULL,
+ system_setting_set_changed_callback_uds_pkg_list,
+ system_setting_unset_changed_callback_uds_pkg_list,
+ NULL,
+ NULL /* user data */
+ },
+ {
SYSTEM_SETTINGS_MAX, -1, NULL, NULL, NULL, NULL, NULL, NULL
}
};