Merge "Fix puller callback with gauge/value metric" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-11 05:40:33 +00:00
committed by Android (Google) Code Review
3 changed files with 15 additions and 5 deletions

View File

@@ -276,7 +276,8 @@ bool StatsPullerManager::Pull(int tagId, vector<shared_ptr<LogEvent>>* data) {
}
bool StatsPullerManager::PullerForMatcherExists(int tagId) const {
return kAllPullAtomInfo.find(tagId) != kAllPullAtomInfo.end();
// Vendor pulled atoms might be registered after we parse the config.
return isVendorPulledAtom(tagId) || kAllPullAtomInfo.find(tagId) != kAllPullAtomInfo.end();
}
void StatsPullerManager::updateAlarmLocked() {
@@ -449,9 +450,8 @@ void StatsPullerManager::RegisterPullerCallback(int32_t atomTag,
const sp<IStatsPullerCallback>& callback) {
AutoMutex _l(mLock);
// Platform pullers cannot be changed.
if (atomTag < StatsdStats::kMaxPlatformAtomTag) {
VLOG("RegisterPullerCallback: atom tag %d is less than min tag %d",
atomTag, StatsdStats::kMaxPlatformAtomTag);
if (!isVendorPulledAtom(atomTag)) {
VLOG("RegisterPullerCallback: atom tag %d is not vendor pulled", atomTag);
return;
}
VLOG("RegisterPullerCallback: adding puller for tag %d", atomTag);
@@ -462,7 +462,7 @@ void StatsPullerManager::RegisterPullerCallback(int32_t atomTag,
void StatsPullerManager::UnregisterPullerCallback(int32_t atomTag) {
AutoMutex _l(mLock);
// Platform pullers cannot be changed.
if (atomTag < StatsdStats::kMaxPlatformAtomTag) {
if (!isVendorPulledAtom(atomTag)) {
return;
}
StatsdStats::getInstance().notePullerCallbackRegistrationChanged(atomTag, /*registered=*/false);

View File

@@ -160,6 +160,12 @@ public:
// Max platform atom tag number.
static const int32_t kMaxPlatformAtomTag = 100000;
// Vendor pulled atom start id.
static const int32_t kVendorPulledAtomStartTag = 150000;
// Max accepted atom id.
static const int32_t kMaxAtomTag = 200000;
static const int64_t kInt64Max = 0x7fffffffffffffffLL;
/**

View File

@@ -96,6 +96,10 @@ inline bool isPushedAtom(int atomId) {
return atomId <= util::kMaxPushedAtomId && atomId > 1;
}
inline bool isVendorPulledAtom(int atomId) {
return atomId >= StatsdStats::kVendorPulledAtomStartTag && atomId < StatsdStats::kMaxAtomTag;
}
} // namespace statsd
} // namespace os
} // namespace android