#define __TIZEN_CONTEXT_HISTORY_H__
-#include <tizen_error.h>
+#include <tizen.h>
#ifdef __cplusplus
extern "C" {
#define CONTEXT_HISTORY_LAST_TIME "LastTime"
/**
+ * @deprecated Deprecated since 4.0.
* @brief Definition for the attribute key denoting "hour of day".
* @details This can be used as a key of context_history_record_get_int().
* @since_tizen 2.4
#define CONTEXT_HISTORY_HOUR_OF_DAY "HourOfDay"
/**
+ * @deprecated Deprecated since 4.0.
* @brief Definition for the attribute key denoting "audio jack status".
* @details This can be used as a key of context_history_record_get_int().
* @since_tizen 2.4
#define CONTEXT_HISTORY_AUDIO_JACK "AudioJack"
/**
+ * @deprecated Deprecated since 4.0.
* @brief Definition for the attribute key denoting "system volume".
* @details This can be used as a key of context_history_record_get_int().
* @since_tizen 2.4
#define CONTEXT_HISTORY_SYSTEM_VOLUME "SystemVolume"
/**
+ * @deprecated Deprecated since 4.0.
* @brief Definition for the attribute key denoting "media volume".
* @details This can be used as a key of context_history_record_get_int().
* @since_tizen 2.4
#define CONTEXT_HISTORY_MEDIA_VOLUME "MediaVolume"
/**
+ * @deprecated Deprecated since 4.0.
* @brief Definition for the attribute key denoting "address".
* @details This can be used as a key of context_history_record_get_string().
* @since_tizen 2.4
typedef enum {
CONTEXT_HISTORY_RECENTLY_USED_APP = 1, /**< Recently used application.@n Privilege : http://tizen.org/privilege/apphistory.read*/
CONTEXT_HISTORY_FREQUENTLY_USED_APP, /**< Frequently used application.@n Privilege : http://tizen.org/privilege/apphistory.read*/
- CONTEXT_HISTORY_RARELY_USED_APP, /**< Rarely used application.@n Privilege : http://tizen.org/privilege/apphistory.read*/
- CONTEXT_HISTORY_PEAK_TIME_FOR_APP, /**< Peak time of application use activity.@n Privilege : http://tizen.org/privilege/apphistory.read*/
- CONTEXT_HISTORY_PEAK_TIME_FOR_MUSIC, /**< Peak time of music listening activity.@n Privilege : http://tizen.org/privilege/mediahistory.read*/
- CONTEXT_HISTORY_PEAK_TIME_FOR_VIDEO, /**< Peak time of video watching activity.@n Privilege : http://tizen.org/privilege/mediahistory.read*/
- CONTEXT_HISTORY_COMMON_SETTING_FOR_APP, /**< Common setting value of application use activity.@n Privilege : http://tizen.org/privilege/apphistory.read*/
- CONTEXT_HISTORY_COMMON_SETTING_FOR_MUSIC, /**< Common setting value of music listening activity.@n Privilege : http://tizen.org/privilege/mediahistory.read*/
- CONTEXT_HISTORY_COMMON_SETTING_FOR_VIDEO, /**< Common setting value of video watching activity.@n Privilege : http://tizen.org/privilege/mediahistory.read*/
- CONTEXT_HISTORY_FREQUENTLY_COMMUNICATED_ADDRESS, /**< Frequently communicated address.@n Privilege : http://tizen.org/privilege/callhistory.read*/
+ CONTEXT_HISTORY_RARELY_USED_APP, /**< Rarely used application.@n Privilege : http://tizen.org/privilege/apphistory.read (Deprecated since 4.0)*/
+ CONTEXT_HISTORY_PEAK_TIME_FOR_APP, /**< Peak time of application use activity.@n Privilege : http://tizen.org/privilege/apphistory.read (Deprecated since 4.0)*/
+ CONTEXT_HISTORY_PEAK_TIME_FOR_MUSIC, /**< Peak time of music listening activity.@n Privilege : http://tizen.org/privilege/mediahistory.read (Deprecated since 4.0)*/
+ CONTEXT_HISTORY_PEAK_TIME_FOR_VIDEO, /**< Peak time of video watching activity.@n Privilege : http://tizen.org/privilege/mediahistory.read (Deprecated since 4.0)*/
+ CONTEXT_HISTORY_COMMON_SETTING_FOR_APP, /**< Common setting value of application use activity.@n Privilege : http://tizen.org/privilege/apphistory.read (Deprecated since 4.0)*/
+ CONTEXT_HISTORY_COMMON_SETTING_FOR_MUSIC, /**< Common setting value of music listening activity.@n Privilege : http://tizen.org/privilege/mediahistory.read (Deprecated since 4.0)*/
+ CONTEXT_HISTORY_COMMON_SETTING_FOR_VIDEO, /**< Common setting value of video watching activity.@n Privilege : http://tizen.org/privilege/mediahistory.read (Deprecated since 4.0)*/
+ CONTEXT_HISTORY_FREQUENTLY_COMMUNICATED_ADDRESS, /**< Frequently communicated address.@n Privilege : http://tizen.org/privilege/callhistory.read (Deprecated since 4.0)*/
CONTEXT_HISTORY_BATTERY_USAGE, /**< Per-app battery usage in percentage (Since 3.0) @n Privilege : http://tizen.org/privilege/apphistory.read*/
CONTEXT_HISTORY_RECENT_BATTERY_USAGE, /**< Per-app battery usage in percentage since last charge (Since 3.0) @n Privilege : http://tizen.org/privilege/apphistory.read*/
} context_history_data_e;
typedef enum {
CONTEXT_HISTORY_FILTER_TIME_SPAN = 1, /**< Time span of data in days*/
CONTEXT_HISTORY_FILTER_RESULT_SIZE, /**< Result size of data records*/
- CONTEXT_HISTORY_FILTER_APP_ID, /**< Application id*/
- CONTEXT_HISTORY_FILTER_DAY_OF_WEEK, /**< Weekdays, weekends*/
+ CONTEXT_HISTORY_FILTER_APP_ID, /**< Application id (Deprecated since 4.0)*/
+ CONTEXT_HISTORY_FILTER_DAY_OF_WEEK, /**< Weekdays, weekends (Deprecated since 4.0)*/
CONTEXT_HISTORY_FILTER_START_TIME, /**< Start time of data in epoch time*/
CONTEXT_HISTORY_FILTER_END_TIME, /**< End time of data in epoch time*/
- CONTEXT_HISTORY_FILTER_WIFI_BSSID, /**< Wi-Fi BSSID value*/
+ CONTEXT_HISTORY_FILTER_WIFI_BSSID, /**< Wi-Fi BSSID value (Deprecated since 4.0)*/
CONTEXT_HISTORY_FILTER_AUDIO_JACK, /**< Audio jack status value*/
- CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE /**< Type of phone log*/
+ CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE /**< Type of phone log (Deprecated since 4.0)*/
} context_history_filter_e;
/**
+ * @deprecated Deprecated since 4.0.
* @brief Enumeration for day of week filter.
* @since_tizen 2.4
*/
} context_history_filter_audio_jack_e;
/**
+ * @deprecated Deprecated since 4.0.
* @brief Enumeration for log type filter.
* @since_tizen 2.4
*/
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported filter type contained
*
* @pre context_history_filter_create()
* @see context_history_filter_set_string()
int context_history_filter_set_int(context_history_filter_h filter, context_history_filter_e filter_type, int value);
/**
+ * @deprecated Deprecate since 4.0.
* @brief Sets a string to a filter.
* @details This sets the value to a filter.
* @since_tizen 2.4
* @return @c 0 on success, otherwise a negative error value
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Not supported filter type contained
*
* @pre context_history_filter_create()
* @see context_history_filter_set_int()
*/
-int context_history_filter_set_string(context_history_filter_h filter, context_history_filter_e filter_type, const char* value);
+int context_history_filter_set_string(context_history_filter_h filter, context_history_filter_e filter_type, const char* value) TIZEN_DEPRECATED_API;
/**
* @brief Reads context statistics or patterns.
* @retval #CONTEXT_HISTORY_ERROR_NONE Successful
* @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CONTEXT_HISTORY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CONTEXT_HISTORY_ERROR_NOT_SUPPORTED Unsupported history data contained
* @retval #CONTEXT_HISTORY_ERROR_OPERATION_FAILED Operation failed
* @retval #CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY Out of memory
* @retval #CONTEXT_HISTORY_ERROR_NO_DATA Requested data does not exist
#include <AppHistoryTypes.h>
#include <context_history.h>
+#define HISTORY_DEPRECATED_DATA "DEPRECATION WARNING: This history data type is deprecated and will be removed from next release"
#define TYPE_NUMERIC 0
#define TYPE_STRING 1
#define FILTER_KEY_LIMIT 10
static bool check_filter_data_string(context_history_filter_e filter_type, const char* val);
static bool check_invalid_filter(context_history_data_e data_type, context_history_filter_h filter);
static int __getIndexOf(context_history_record_h record, const std::string& key);
+static bool history_is_deprecated(context_history_data_e data_type);
+static bool history_filter_is_supported(context_history_filter_e filter_type);
// life-cycle
EXPORT_API int context_history_create(context_history_h* handle)
{
ASSERT_NOT_NULL(filter);
+ IF_FAIL_RETURN_TAG(history_filter_is_supported(filter_type), CONTEXT_HISTORY_ERROR_NOT_SUPPORTED, _E, "Filter not supported");
+
std::string filter_str = convert_filter_to_string(filter_type);
if (filter_str.empty()) {
return CONTEXT_HISTORY_ERROR_INVALID_PARAMETER;
ASSERT_NOT_NULL(filter);
ASSERT_NOT_NULL(val);
+ _W("DEPRECATION WARNING: context_history_filter_set_string() is deprecated and will be removed from next release.");
+
+ IF_FAIL_RETURN_TAG(history_filter_is_supported(filter_type), CONTEXT_HISTORY_ERROR_NOT_SUPPORTED, _E, "Filter not supported");
+
std::string filter_str = convert_filter_to_string(filter_type);
if (filter_str.empty()) {
return CONTEXT_HISTORY_ERROR_INVALID_PARAMETER;
ASSERT_NOT_NULL(list);
*list = NULL;
+ if (history_is_deprecated(data_type)) {
+ _W(HISTORY_DEPRECATED_DATA);
+ }
/*TODO: Boundary check for filter values has to be done*/
std::string data_type_str = convert_data_to_string(data_type);
ASSERT_ALLOC(*list);
int err = _ctx_history_query(data_type_str.c_str(), filter ? filter->jfilter.str().c_str() : "", &((*list)->cursor));
- if (err == TIZEN_ERROR_NOT_SUPPORTED)
- err = CONTEXT_HISTORY_ERROR_NO_DATA;
IF_FAIL_RETURN_TAG(err == E_NONE, err, _E, "Query failed");
return CONTEXT_HISTORY_ERROR_NONE;
}
return -1;
}
+
+bool history_is_deprecated(context_history_data_e data_type)
+{
+ bool ret = false;
+ switch (data_type) {
+ case CONTEXT_HISTORY_RARELY_USED_APP:
+ case CONTEXT_HISTORY_PEAK_TIME_FOR_APP:
+ case CONTEXT_HISTORY_PEAK_TIME_FOR_MUSIC:
+ case CONTEXT_HISTORY_PEAK_TIME_FOR_VIDEO:
+ case CONTEXT_HISTORY_COMMON_SETTING_FOR_APP:
+ case CONTEXT_HISTORY_COMMON_SETTING_FOR_MUSIC:
+ case CONTEXT_HISTORY_COMMON_SETTING_FOR_VIDEO:
+ case CONTEXT_HISTORY_FREQUENTLY_COMMUNICATED_ADDRESS:
+ ret = true;
+ break;
+ default:
+ break;
+ }
+ return ret;
+}
+
+bool history_filter_is_supported(context_history_filter_e filter_type)
+{
+ bool ret = false;
+ switch (filter_type) {
+ case CONTEXT_HISTORY_FILTER_TIME_SPAN:
+ case CONTEXT_HISTORY_FILTER_RESULT_SIZE:
+ case CONTEXT_HISTORY_FILTER_START_TIME:
+ case CONTEXT_HISTORY_FILTER_END_TIME:
+ case CONTEXT_HISTORY_FILTER_AUDIO_JACK:
+ ret = true;
+ break;
+ case CONTEXT_HISTORY_FILTER_APP_ID:
+ case CONTEXT_HISTORY_FILTER_DAY_OF_WEEK:
+ case CONTEXT_HISTORY_FILTER_WIFI_BSSID:
+ case CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE:
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}