summaryrefslogtreecommitdiff
path: root/cmds/statsd/src/metrics/MetricsManager.cpp
diff options
context:
space:
mode:
authorMuhammad Qureshi <muhammadq@google.com>2020-05-13 15:13:33 -0700
committerMuhammad Qureshi <muhammadq@google.com>2020-05-15 12:54:02 -0700
commitf681646d82f0824932cf9606456e20df4b0e8736 (patch)
treee53d7697bca0e6fa047548d0524741f3e7921079 /cmds/statsd/src/metrics/MetricsManager.cpp
parent331ac296f7ec30daba3510597fd482fa7c27c2ce (diff)
Add whitelisted atom ids to StatsdConfig
Get whitelisted atom ids from StatsdConfig which can be logged from any uid. Fixes: 155521934 Test: statsd_test Change-Id: Ib2db310d1cd8479d4996e70ac09d40e8dc45af48
Diffstat (limited to 'cmds/statsd/src/metrics/MetricsManager.cpp')
-rw-r--r--cmds/statsd/src/metrics/MetricsManager.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmds/statsd/src/metrics/MetricsManager.cpp b/cmds/statsd/src/metrics/MetricsManager.cpp
index d7ad27bd9134..e8c575a1adea 100644
--- a/cmds/statsd/src/metrics/MetricsManager.cpp
+++ b/cmds/statsd/src/metrics/MetricsManager.cpp
@@ -71,6 +71,8 @@ MetricsManager::MetricsManager(const ConfigKey& key, const StatsdConfig& config,
mLastReportTimeNs(currentTimeNs),
mLastReportWallClockNs(getWallClockNs()),
mPullerManager(pullerManager),
+ mWhitelistedAtomIds(config.whitelisted_atom_ids().begin(),
+ config.whitelisted_atom_ids().end()),
mShouldPersistHistory(config.persist_locally()) {
// Init the ttl end timestamp.
refreshTtl(timeBaseNs);
@@ -366,11 +368,16 @@ void MetricsManager::onDumpReport(const int64_t dumpTimeStampNs,
bool MetricsManager::checkLogCredentials(const LogEvent& event) {
+ // TODO(b/154856835): Remove this check once we get whitelist from the config.
if (android::util::AtomsInfo::kWhitelistedAtoms.find(event.GetTagId()) !=
android::util::AtomsInfo::kWhitelistedAtoms.end())
{
return true;
}
+
+ if (mWhitelistedAtomIds.find(event.GetTagId()) != mWhitelistedAtomIds.end()) {
+ return true;
+ }
std::lock_guard<std::mutex> lock(mAllowedLogSourcesMutex);
if (mAllowedLogSources.find(event.GetUid()) == mAllowedLogSources.end()) {
VLOG("log source %d not on the whitelist", event.GetUid());