Merge "Merge "StateTracker handles active state changes" into rvc-dev am: 0d45553327 am: e806ea28e3" into rvc-d1-dev-plus-aosp am: e481191ee7
Change-Id: Ice40cdf347db450113db129a00732671b19c422d
This commit is contained in:
@@ -187,8 +187,9 @@ void ValueMetricProducer::onStateChanged(int64_t eventTimeNs, int32_t atomId,
|
|||||||
VLOG("ValueMetric %lld onStateChanged time %lld, State %d, key %s, %d -> %d",
|
VLOG("ValueMetric %lld onStateChanged time %lld, State %d, key %s, %d -> %d",
|
||||||
(long long)mMetricId, (long long)eventTimeNs, atomId, primaryKey.toString().c_str(),
|
(long long)mMetricId, (long long)eventTimeNs, atomId, primaryKey.toString().c_str(),
|
||||||
oldState.mValue.int_value, newState.mValue.int_value);
|
oldState.mValue.int_value, newState.mValue.int_value);
|
||||||
// If condition is not true, we do not need to pull for this state change.
|
// If condition is not true or metric is not active, we do not need to pull
|
||||||
if (mCondition != ConditionState::kTrue) {
|
// for this state change.
|
||||||
|
if (mCondition != ConditionState::kTrue || !mIsActive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -329,7 +329,10 @@ void OringDurationTracker::onConditionChanged(bool condition, const int64_t time
|
|||||||
|
|
||||||
void OringDurationTracker::onStateChanged(const int64_t timestamp, const int32_t atomId,
|
void OringDurationTracker::onStateChanged(const int64_t timestamp, const int32_t atomId,
|
||||||
const FieldValue& newState) {
|
const FieldValue& newState) {
|
||||||
// If no keys are being tracked, update the current state key and return.
|
// Nothing needs to be done on a state change if we have not seen a start
|
||||||
|
// event, the metric is currently not active, or condition is false.
|
||||||
|
// For these cases, no keys are being tracked in mStarted, so update
|
||||||
|
// the current state key and return.
|
||||||
if (mStarted.empty()) {
|
if (mStarted.empty()) {
|
||||||
updateCurrentStateKey(atomId, newState);
|
updateCurrentStateKey(atomId, newState);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user