Added Battery Satistics Parameters to Context History enums 77/83577/9
authorSomin Kim <somin926.kim@samsung.com>
Mon, 22 Aug 2016 07:25:02 +0000 (16:25 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Wed, 7 Sep 2016 10:15:58 +0000 (19:15 +0900)
Change-Id: I0c3ec3bbde75a44c43863df4344e5a70d6f89f96
Signed-off-by: Kunal Chawla <kunal.chawla@samsung.com>
include/context_history.h
src/context_history.cpp

index 39e8327..7183fb7 100644 (file)
@@ -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;
 
 /**
index 535c9ce..0a0982a 100644 (file)
@@ -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;
        }