#define __TIZEN_CONTEXT_HISTORY_H__
-#include <tizen_error.h>
+#include <tizen.h>
#ifdef __cplusplus
extern "C" {
#define CONTEXT_HISTORY_LAST_TIME "LastTime"
/**
- * @brief Definition for the attribute key denoting "hour of day".
- * @details This can be used as a key of context_history_record_get_int().
+ * @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"
/**
- * @brief Definition for the attribute key denoting "audio jack status".
- * @details This can be used as a key of context_history_record_get_int().
+ * @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"
/**
- * @brief Definition for the attribute key denoting "system volume".
- * @details This can be used as a key of context_history_record_get_int().
+ * @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"
/**
- * @brief Definition for the attribute key denoting "media volume".
- * @details This can be used as a key of context_history_record_get_int().
+ * @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"
/**
- * @brief Definition for the attribute key denoting "address".
- * @details This can be used as a key of context_history_record_get_string().
+ * @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
*/
#define CONTEXT_HISTORY_ADDRESS "Address"
* @since_tizen 2.4
*/
typedef enum {
- CONTEXT_HISTORY_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ CONTEXT_HISTORY_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
CONTEXT_HISTORY_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
CONTEXT_HISTORY_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
CONTEXT_HISTORY_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Memory allocation failed */
CONTEXT_HISTORY_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No Data */
- CONTEXT_HISTORY_ERROR_OUT_OF_RANGE = (TIZEN_ERROR_CONTEXT | 0x03), /**< Out of range */
- CONTEXT_HISTORY_ERROR_OPERATION_FAILED = (TIZEN_ERROR_CONTEXT | 0x04), /**< Operation failed */
+ CONTEXT_HISTORY_ERROR_OUT_OF_RANGE = (TIZEN_ERROR_CONTEXT | 0x03), /**< Out of range */
+ CONTEXT_HISTORY_ERROR_OPERATION_FAILED = (TIZEN_ERROR_CONTEXT | 0x04), /**< Operation failed */
} context_history_error_e;
/**
* @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_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_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 (Deprecated since 4.0)
+ @n Privilege : http://tizen.org/privilege/apphistory.read */
+ CONTEXT_HISTORY_PEAK_TIME_FOR_APP, /**< Peak time of application use activity (Deprecated since 4.0)
+ @n Privilege : http://tizen.org/privilege/apphistory.read */
+ CONTEXT_HISTORY_PEAK_TIME_FOR_MUSIC, /**< Peak time of music listening activity (Deprecated since 4.0)
+ @n Privilege : http://tizen.org/privilege/mediahistory.read */
+ CONTEXT_HISTORY_PEAK_TIME_FOR_VIDEO, /**< Peak time of video watching activity (Deprecated since 4.0)
+ @n Privilege : http://tizen.org/privilege/mediahistory.read */
+ CONTEXT_HISTORY_COMMON_SETTING_FOR_APP, /**< Common setting value of application use activity (Deprecated since 4.0)
+ @n Privilege : http://tizen.org/privilege/apphistory.read */
+ CONTEXT_HISTORY_COMMON_SETTING_FOR_MUSIC, /**< Common setting value of music listening activity (Deprecated since 4.0)
+ @n Privilege : http://tizen.org/privilege/mediahistory.read */
+ CONTEXT_HISTORY_COMMON_SETTING_FOR_VIDEO, /**< Common setting value of video watching activity (Deprecated since 4.0)
+ @n Privilege : http://tizen.org/privilege/mediahistory.read */
+ CONTEXT_HISTORY_FREQUENTLY_COMMUNICATED_ADDRESS, /**< Frequently communicated address (Deprecated since 4.0)
+ @n Privilege : http://tizen.org/privilege/callhistory.read */
+ 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;
/**
* @since_tizen 2.4
*/
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_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_AUDIO_JACK, /**< Audio jack status value*/
- CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE /**< Type of phone log*/
+ 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 (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 (Deprecated since 4.0) */
+ CONTEXT_HISTORY_FILTER_AUDIO_JACK, /**< Audio jack status value */
+ 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
*/
typedef enum {
- CONTEXT_HISTORY_FILTER_DAY_OF_WEEK_WEEKDAYS = 1, /**< Includes only weekdays*/
- CONTEXT_HISTORY_FILTER_DAY_OF_WEEK_WEEKENDS, /**< Includes only weekends*/
- CONTEXT_HISTORY_FILTER_DAY_OF_WEEK_ALL /**< Includes all days*/
+ CONTEXT_HISTORY_FILTER_DAY_OF_WEEK_WEEKDAYS = 1, /**< Includes only weekdays */
+ CONTEXT_HISTORY_FILTER_DAY_OF_WEEK_WEEKENDS, /**< Includes only weekends */
+ CONTEXT_HISTORY_FILTER_DAY_OF_WEEK_ALL /**< Includes all days */
} context_history_filter_day_of_week_e;
/**
* @since_tizen 2.4
*/
typedef enum {
- CONTEXT_HISTORY_FILTER_AUDIO_JACK_NOT_CONNECTED = 0, /**< Audio jack is not connected*/
- CONTEXT_HISTORY_FILTER_AUDIO_JACK_CONNECTED /**< Audio jack is connected*/
+ CONTEXT_HISTORY_FILTER_AUDIO_JACK_NOT_CONNECTED = 0, /**< Audio jack is not connected */
+ CONTEXT_HISTORY_FILTER_AUDIO_JACK_CONNECTED /**< Audio jack is connected */
} context_history_filter_audio_jack_e;
/**
+ * @deprecated Deprecated since 4.0.
* @brief Enumeration for log type filter.
* @since_tizen 2.4
*/
typedef enum {
- CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE_CALL = 1, /**< Includes only call logs*/
- CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE_MESSAGE, /**< Includes only message logs*/
- CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE_ALL /**< Includes all logs*/
+ CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE_CALL = 1, /**< Includes only call logs */
+ CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE_MESSAGE, /**< Includes only message logs */
+ CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE_ALL /**< Includes all logs */
} context_history_filter_communication_type_e;
/**
*
* @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_OUT_OF_MEMORY Out of memory
+ * @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY Out of memory
*
* @see context_history_destroy()
*/
*
* @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_INVALID_PARAMETER Invalid parameter
*
* @pre context_history_create()
*/
int context_history_filter_set_int(context_history_filter_h filter, context_history_filter_e filter_type, int value);
/**
+ * @deprecated Deprecated since 4.0.
* @brief Sets a string to a filter.
* @details This sets the value to a filter.
* @since_tizen 2.4
* @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 Checks whether a history data type is supported in the current device.
+ * @since_tizen 4.0
+ *
+ * @param[in] data_type Type of history data
+ * @param[out] supported If supported, @c true, otherwise @c false
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CONTEXT_TRIGGER_ERROR_NONE Successful
+ * @retval #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED Operation failed
+ */
+int context_history_is_supported(context_history_data_e data_type, bool* supported);
/**
* @brief Reads context statistics or patterns.
*
* @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_PERMISSION_DENIED Permission denied
+ * @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
* @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
+ * @retval #CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #CONTEXT_HISTORY_ERROR_NO_DATA Requested data does not exist
*
* @pre context_history_create()
* @post context_history_list_destroy()
*
* @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_INVALID_PARAMETER Invalid parameter
* @retval #CONTEXT_HISTORY_ERROR_OPERATION_FAILED Operation failed
*
* @pre context_history_get_list()
*
* @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_INVALID_PARAMETER Invalid parameter
* @retval #CONTEXT_HISTORY_ERROR_OPERATION_FAILED Operation failed
- * @retval #CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #CONTEXT_HISTORY_ERROR_OUT_OF_MEMORY Out of memory
*
* @pre context_history_get_list()
* @post context_history_record_destroy()
*
* @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_INVALID_PARAMETER Invalid parameter
*
* @pre context_history_get_list()
* @see context_history_list_get_count()
*
* @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_NO_DATA Requested data does not exist
+ * @retval #CONTEXT_HISTORY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONTEXT_HISTORY_ERROR_NO_DATA Requested data does not exist
*
* @pre context_history_get_list()
* @see context_history_list_get_count()
*
* @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_INVALID_PARAMETER Invalid parameter
*
* @pre context_history_get_list()
*/
#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 HISTORY_DEPRECATED_FILTER "DEPRECATION WARNING: This history filter 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_deprecated(context_history_filter_e filter_type);
// life-cycle
EXPORT_API int context_history_create(context_history_h* handle)
{
ASSERT_NOT_NULL(filter);
+ if (history_filter_is_deprecated(filter_type)) {
+ _W(HISTORY_DEPRECATED_FILTER);
+ }
+
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 (history_filter_is_deprecated(filter_type)) {
+ _W(HISTORY_DEPRECATED_FILTER);
+ }
+
std::string filter_str = convert_filter_to_string(filter_type);
if (filter_str.empty()) {
return CONTEXT_HISTORY_ERROR_INVALID_PARAMETER;
return CONTEXT_HISTORY_ERROR_NONE;
}
+EXPORT_API int context_history_is_supported(context_history_data_e data_type, bool* supported)
+{
+ ASSERT_NOT_NULL(supported);
+
+ if (history_is_deprecated(data_type)) {
+ _W(HISTORY_DEPRECATED_DATA);
+ }
+
+ std::string data_type_str = convert_data_to_string(data_type);
+ if (data_type_str.empty()) {
+ return CONTEXT_HISTORY_ERROR_INVALID_PARAMETER;
+ }
+
+ return ctx_history_is_supported(data_type_str.c_str(), supported);
+}
+
EXPORT_API int context_history_get_list(context_history_h handle, context_history_data_e data_type, context_history_filter_h filter, context_history_list_h* list)
{
ASSERT_NOT_NULL(handle);
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_deprecated(context_history_filter_e filter_type)
+{
+ bool ret = false;
+ switch (filter_type) {
+ 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:
+ ret = true;
+ break;
+ default:
+ break;
+ }
+ return ret;
+}