From 4133aebcd37dd5075b90fa2876452a6eb77b2690 Mon Sep 17 00:00:00 2001 From: Somin Kim Date: Mon, 22 Aug 2016 16:25:02 +0900 Subject: [PATCH] Added Battery Satistics Parameters to Context History enums Change-Id: I0c3ec3bbde75a44c43863df4344e5a70d6f89f96 Signed-off-by: Kunal Chawla --- include/context_history.h | 10 +++++++++- src/context_history.cpp | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/include/context_history.h b/include/context_history.h index 39e8327..7183fb7 100644 --- a/include/context_history.h +++ b/include/context_history.h @@ -42,6 +42,12 @@ extern "C" { #define CONTEXT_HISTORY_TOTAL_COUNT "TotalCount" /** + * @brief The attribute key denoting "total amount" + * @since_tizen 3.0 + */ +#define CONTEXT_HISTORY_TOTAL_AMOUNT "TotalAmount" + +/** * @brief The attribute key denoting "total duration" * @since_tizen 2.4 */ @@ -112,7 +118,9 @@ typedef enum { 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_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_data_e; /** diff --git a/src/context_history.cpp b/src/context_history.cpp index 535c9ce..0a0982a 100644 --- a/src/context_history.cpp +++ b/src/context_history.cpp @@ -360,6 +360,12 @@ std::string convert_data_to_string(context_history_data_e data_type) case CONTEXT_HISTORY_FREQUENTLY_COMMUNICATED_ADDRESS: str = SUBJ_SOCIAL_FREQ_ADDRESS; break; + case CONTEXT_HISTORY_BATTERY_USAGE: + str = SUBJ_BATTERY_USAGE; + break; + case CONTEXT_HISTORY_RECENT_BATTERY_USAGE: + str = SUBJ_BATTERY_RECENT_USAGE; + break; default: break; } @@ -374,6 +380,7 @@ bool check_record_key_data_type(int type, std::string key) } if ((key.compare(CONTEXT_HISTORY_TOTAL_COUNT) == 0) || + key.compare(CONTEXT_HISTORY_TOTAL_AMOUNT) == 0 || key.compare(CONTEXT_HISTORY_TOTAL_DURATION) == 0 || key.compare(CONTEXT_HISTORY_LAST_TIME) == 0 || key.compare(CONTEXT_HISTORY_HOUR_OF_DAY) == 0 || @@ -490,6 +497,15 @@ bool check_invalid_filter(context_history_data_e data_type, context_history_filt allowed[CONTEXT_HISTORY_FILTER_COMMUNICATION_TYPE] = true; break; + case CONTEXT_HISTORY_BATTERY_USAGE: + break; + + case CONTEXT_HISTORY_RECENT_BATTERY_USAGE: + allowed[CONTEXT_HISTORY_FILTER_TIME_SPAN] = false; + allowed[CONTEXT_HISTORY_FILTER_START_TIME] = false; + allowed[CONTEXT_HISTORY_FILTER_END_TIME] = false; + break; + default: return false; } -- 2.7.4