records[0].get(NULL, BATTERY_LAST_HEART_ACCESS_TIME, &__lastHeartAccessTime);
}
+ int currentTime = CURRENT_TIME;
if (__lastFullTime == 0) {
- __lastFullTime = CURRENT_TIME;
+ __lastFullTime = currentTime;
_I("Device has not fully charged until now. Start time of recent battery usage will be %d", __lastFullTime);
__updateLastInfo();
+ } else if (__lastFullTime > currentTime || currentTime - __lastFullTime > LOG_RETENTION_PERIOD) {
+ __lastFullTime = currentTime;
+ __lastHeartAccessTime = currentTime;
+ _I("Last fully charged time changed: %d", __lastFullTime);
+ __updateLastInfo();
}
return true;
__needSync = true;
instance->__lastFullTime = CURRENT_TIME;
- _D("Charger is disconnected after fully charged. Last fully charged time: %d", instance->__lastFullTime);
+ _I("Charger is disconnected after fully charged. Last fully charged time: %d", instance->__lastFullTime);
bool ret = instance->__updateLastInfo();
IF_FAIL_VOID_TAG(ret, _E, "Failed to update last reset time and last percent time");
int timeDiff = vconf_keynode_get_int(node);
IF_FAIL_VOID(timeDiff != 0);
- _D("Time changed. Related timestamps will be modified.");
+ _I("Time changed(diff: %d). Related timestamps will be modified.", timeDiff);
BatteryMonitor* instance = static_cast<BatteryMonitor*>(userData);
__needSync = true;
bool BatteryMonitor::__processBatteryUsage()
{
+ int currentTime = CURRENT_TIME;
+ if (__lastHeartAccessTime > currentTime) {
+ __lastHeartAccessTime = currentTime - DEFAULT_TIME_DIFF;
+ __lastFullTime = currentTime - DEFAULT_TIME_DIFF;
+ __updateLastInfo();
+ _W("Last fully charged time & last heart access time changed(%d)", __lastFullTime);
+ }
+
// Read from heart cpu table
bool ret = __heartReader->dbOpen();
IF_FAIL_RETURN_TAG(ret, true, _E, "Failed to open heart db");