From 3f83bb2e18e6c5d5aab0f64c9e1a170f1cf2353e Mon Sep 17 00:00:00 2001 From: Raymond Hernandez Date: Thu, 6 Jul 2023 15:10:08 -0700 Subject: Increase event queue size to 50k Increase event queue size to 50k. Flag guarded. Bug: 290236224 Test: atest statsd_test Test: m -j Change-Id: I5da8b443d00a0b31703b3ee1adf005b4e161fc06 Merged-In: I5da8b443d00a0b31703b3ee1adf005b4e161fc06 --- statsd/src/flags/FlagProvider.h | 1 + statsd/src/main.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/statsd/src/flags/FlagProvider.h b/statsd/src/flags/FlagProvider.h index 4fae751f..411b0121 100644 --- a/statsd/src/flags/FlagProvider.h +++ b/statsd/src/flags/FlagProvider.h @@ -38,6 +38,7 @@ const std::string STATSD_NATIVE_NAMESPACE = "statsd_native"; const std::string STATSD_NATIVE_BOOT_NAMESPACE = "statsd_native_boot"; const std::string STATSD_INIT_COMPLETED_NO_DELAY_FLAG = "statsd_init_completed_no_delay"; +const std::string INCREASE_EVENT_QUEUE_50000_FLAG = "increase_event_queue_50000"; const std::string FLAG_TRUE = "true"; const std::string FLAG_FALSE = "false"; diff --git a/statsd/src/main.cpp b/statsd/src/main.cpp index 8c62decc..ca3d097d 100644 --- a/statsd/src/main.cpp +++ b/statsd/src/main.cpp @@ -74,11 +74,14 @@ int main(int /*argc*/, char** /*argv*/) { ABinderProcess_setThreadPoolMaxThreadCount(9); ABinderProcess_startThreadPool(); - std::shared_ptr eventQueue = - std::make_shared(8000 /*buffer limit. Buffer is NOT pre-allocated*/); - // Initialize boot flags - FlagProvider::getInstance().initBootFlags({STATSD_INIT_COMPLETED_NO_DELAY_FLAG}); + FlagProvider::getInstance().initBootFlags( + {STATSD_INIT_COMPLETED_NO_DELAY_FLAG, INCREASE_EVENT_QUEUE_50000_FLAG}); + + std::shared_ptr eventQueue = std::make_shared( + FlagProvider::getInstance().getBootFlagBool(INCREASE_EVENT_QUEUE_50000_FLAG, FLAG_FALSE) + ? 50000 + : 8000 /*buffer limit. Buffer is NOT pre-allocated*/); sp uidMap = UidMap::getInstance(); -- cgit v1.2.3 From b340685d00cdf31a4392985bba8b7b8d9dc4d8d0 Mon Sep 17 00:00:00 2001 From: Vova Sharaienko Date: Wed, 13 Sep 2023 01:47:53 +0000 Subject: [statsd] Improved performance for get sdk version APIs - added helper APIs to cache IsAtLeastS/IsAtLeastU results These API calls contribute measureble CPU time consumption (~3%) Bug: 212755214 Test: build Ignore-AOSP-First: changed internal features (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:93e7698392897f37f7ddab101b38aeec16b1fa6a) Merged-In: Ia6122727a9d6ef778451383e7124fd1d9446c94b Change-Id: Ia6122727a9d6ef778451383e7124fd1d9446c94b --- statsd/src/StatsLogProcessor.cpp | 16 +++++++--------- statsd/src/StatsService.cpp | 6 ++---- statsd/src/flags/FlagProvider.cpp | 3 +-- statsd/src/flags/FlagProvider.h | 19 +++++++++---------- statsd/src/logd/LogEvent.cpp | 6 ++---- statsd/src/metrics/MetricsManager.cpp | 7 ++----- statsd/src/stats_util.h | 14 +++++++++++++- statsd/src/storage/StorageManager.cpp | 4 +--- statsd/tests/LogEvent_test.cpp | 16 +++++++--------- statsd/tests/MetricsManager_test.cpp | 8 +++----- statsd/tests/StatsLogProcessor_test.cpp | 6 ++---- statsd/tests/StatsService_test.cpp | 1 - statsd/tests/e2e/RestrictedConfig_e2e_test.cpp | 9 +++------ statsd/tests/e2e/RestrictedEventMetric_e2e_test.cpp | 4 +--- statsd/tests/flags/FlagProvider_test.cpp | 4 +--- .../metrics/RestrictedEventMetricProducer_test.cpp | 9 +++------ statsd/tests/storage/StorageManager_test.cpp | 7 +++---- statsd/tests/utils/DbUtils_test.cpp | 6 ++---- 18 files changed, 62 insertions(+), 83 deletions(-) diff --git a/statsd/src/StatsLogProcessor.cpp b/statsd/src/StatsLogProcessor.cpp index f076ce53..7ca2b09e 100644 --- a/statsd/src/StatsLogProcessor.cpp +++ b/statsd/src/StatsLogProcessor.cpp @@ -20,7 +20,6 @@ #include "StatsLogProcessor.h" #include -#include #include #include #include @@ -40,7 +39,6 @@ using namespace android; using android::base::StringPrintf; -using android::modules::sdklevel::IsAtLeastU; using android::util::FIELD_COUNT_REPEATED; using android::util::FIELD_TYPE_BOOL; using android::util::FIELD_TYPE_FLOAT; @@ -555,7 +553,7 @@ void StatsLogProcessor::OnConfigUpdatedLocked(const int64_t timestampNs, const C VLOG("Updated configuration for key %s", key.ToString().c_str()); const auto& it = mMetricsManagers.find(key); bool configValid = false; - if (IsAtLeastU() && it != mMetricsManagers.end()) { + if (isAtLeastU() && it != mMetricsManagers.end()) { if (it->second->hasRestrictedMetricsDelegate() != config.has_restricted_metrics_delegate_package_name()) { // Not a modular update if has_restricted_metrics_delegate changes @@ -618,7 +616,7 @@ void StatsLogProcessor::OnConfigUpdatedLocked(const int64_t timestampNs, const C // Remove any existing config with the same key. ALOGE("StatsdConfig NOT valid"); // Send an empty restricted metrics broadcast if the previous config was restricted. - if (IsAtLeastU() && it != mMetricsManagers.end() && + if (isAtLeastU() && it != mMetricsManagers.end() && it->second->hasRestrictedMetricsDelegate()) { mSendRestrictedMetricsBroadcast(key, it->second->getRestrictedMetricsDelegate(), {}); StatsdStats::getInstance().noteDbConfigInvalid(key); @@ -852,7 +850,7 @@ void StatsLogProcessor::OnConfigRemoved(const ConfigKey& key) { if (it != mMetricsManagers.end()) { WriteDataToDiskLocked(key, getElapsedRealtimeNs(), getWallClockNs(), CONFIG_REMOVED, NO_TIME_CONSTRAINTS); - if (IsAtLeastU() && it->second->hasRestrictedMetricsDelegate()) { + if (isAtLeastU() && it->second->hasRestrictedMetricsDelegate()) { StatsdStats::getInstance().noteDbDeletionConfigRemoved(key); dbutils::deleteDb(key); mSendRestrictedMetricsBroadcast(key, it->second->getRestrictedMetricsDelegate(), {}); @@ -888,7 +886,7 @@ void StatsLogProcessor::OnConfigRemoved(const ConfigKey& key) { // TODO(b/267501143): Add unit tests when metric producer is ready void StatsLogProcessor::enforceDataTtlsIfNecessaryLocked(const int64_t wallClockNs, const int64_t elapsedRealtimeNs) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { return; } if (elapsedRealtimeNs - mLastTtlTime < StatsdStats::kMinTtlCheckPeriodNs) { @@ -898,7 +896,7 @@ void StatsLogProcessor::enforceDataTtlsIfNecessaryLocked(const int64_t wallClock } void StatsLogProcessor::flushRestrictedDataIfNecessaryLocked(const int64_t elapsedRealtimeNs) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { return; } if (elapsedRealtimeNs - mLastFlushRestrictedTime < StatsdStats::kMinFlushRestrictedPeriodNs) { @@ -915,7 +913,7 @@ void StatsLogProcessor::querySql(const string& sqlQuery, const int32_t minSqlCli std::lock_guard lock(mMetricsMutex); string err = ""; - if (!IsAtLeastU()) { + if (!isAtLeastU()) { ALOGW("Restricted metrics query invoked on U- device"); StatsdStats::getInstance().noteQueryRestrictedMetricFailed( configId, configPackage, std::nullopt, callingUid, @@ -1041,7 +1039,7 @@ set StatsLogProcessor::getRestrictedConfigKeysToQueryLocked( void StatsLogProcessor::EnforceDataTtls(const int64_t wallClockNs, const int64_t elapsedRealtimeNs) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { return; } std::lock_guard lock(mMetricsMutex); diff --git a/statsd/src/StatsService.cpp b/statsd/src/StatsService.cpp index ebbc634d..6b8154d8 100644 --- a/statsd/src/StatsService.cpp +++ b/statsd/src/StatsService.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -48,7 +47,6 @@ using namespace android; using android::base::StringPrintf; -using android::modules::sdklevel::IsAtLeastU; using android::util::FIELD_COUNT_REPEATED; using android::util::FIELD_TYPE_MESSAGE; @@ -1433,7 +1431,7 @@ Status StatsService::setRestrictedMetricsChangedOperation(const int64_t configId const int32_t callingUid, vector* output) { ENFORCE_UID(AID_SYSTEM); - if (!IsAtLeastU()) { + if (!isAtLeastU()) { ALOGW("setRestrictedMetricsChangedOperation invoked on U- device"); return Status::ok(); } @@ -1450,7 +1448,7 @@ Status StatsService::removeRestrictedMetricsChangedOperation(const int64_t confi const string& configPackage, const int32_t callingUid) { ENFORCE_UID(AID_SYSTEM); - if (!IsAtLeastU()) { + if (!isAtLeastU()) { ALOGW("removeRestrictedMetricsChangedOperation invoked on U- device"); return Status::ok(); } diff --git a/statsd/src/flags/FlagProvider.cpp b/statsd/src/flags/FlagProvider.cpp index 7edcf628..795ac3af 100644 --- a/statsd/src/flags/FlagProvider.cpp +++ b/statsd/src/flags/FlagProvider.cpp @@ -16,7 +16,6 @@ #include "FlagProvider.h" -using android::modules::sdklevel::IsAtLeastS; using server_configurable_flags::GetServerConfigurableFlag; using std::string; using std::vector; @@ -26,7 +25,7 @@ namespace os { namespace statsd { FlagProvider::FlagProvider() - : mIsAtLeastSFunc(IsAtLeastS), mGetServerFlagFunc(GetServerConfigurableFlag) { + : mIsAtLeastSFunc(isAtLeastS), mGetServerFlagFunc(GetServerConfigurableFlag) { } FlagProvider& FlagProvider::getInstance() { diff --git a/statsd/src/flags/FlagProvider.h b/statsd/src/flags/FlagProvider.h index 902966be..6fb6c444 100644 --- a/statsd/src/flags/FlagProvider.h +++ b/statsd/src/flags/FlagProvider.h @@ -16,7 +16,6 @@ #pragma once -#include #include #include @@ -26,6 +25,8 @@ #include #include +#include "stats_util.h" + namespace android { namespace os { namespace statsd { @@ -66,15 +67,13 @@ private: FlagProvider(); // TODO(b/194347008): Remove the GetServerConfigurableFlag override. - void overrideFuncs( - const IsAtLeastSFunc& isAtLeastSFunc = &android::modules::sdklevel::IsAtLeastS, - const GetServerFlagFunc& getServerFlagFunc = - &server_configurable_flags::GetServerConfigurableFlag); - - void overrideFuncsLocked( - const IsAtLeastSFunc& isAtLeastSFunc = &android::modules::sdklevel::IsAtLeastS, - const GetServerFlagFunc& getServerFlagFunc = - &server_configurable_flags::GetServerConfigurableFlag); + void overrideFuncs(const IsAtLeastSFunc& isAtLeastSFunc = &isAtLeastS, + const GetServerFlagFunc& getServerFlagFunc = + &server_configurable_flags::GetServerConfigurableFlag); + + void overrideFuncsLocked(const IsAtLeastSFunc& isAtLeastSFunc = &isAtLeastS, + const GetServerFlagFunc& getServerFlagFunc = + &server_configurable_flags::GetServerConfigurableFlag); inline void resetOverrides() { std::lock_guard lock(mFlagsMutex); diff --git a/statsd/src/logd/LogEvent.cpp b/statsd/src/logd/LogEvent.cpp index 4cb76afb..d3251860 100644 --- a/statsd/src/logd/LogEvent.cpp +++ b/statsd/src/logd/LogEvent.cpp @@ -20,7 +20,6 @@ #include "logd/LogEvent.h" #include -#include #include #include @@ -38,7 +37,6 @@ const int FIELD_ID_EXPERIMENT_ID = 1; using namespace android::util; using android::base::StringPrintf; -using android::modules::sdklevel::IsAtLeastU; using android::util::ProtoOutputStream; using std::string; using std::vector; @@ -452,7 +450,7 @@ void LogEvent::parseAnnotations(uint8_t numAnnotations, std::optional n parseStateNestedAnnotation(annotationType, numElements); break; case ASTATSLOG_ANNOTATION_ID_RESTRICTION_CATEGORY: - if (IsAtLeastU()) { + if (isAtLeastU()) { parseRestrictionCategoryAnnotation(annotationType); } else { mValid = false; @@ -468,7 +466,7 @@ void LogEvent::parseAnnotations(uint8_t numAnnotations, std::optional n case ASTATSLOG_ANNOTATION_ID_FIELD_RESTRICTION_USER_ENGAGEMENT: case ASTATSLOG_ANNOTATION_ID_FIELD_RESTRICTION_AMBIENT_SENSING: case ASTATSLOG_ANNOTATION_ID_FIELD_RESTRICTION_DEMOGRAPHIC_CLASSIFICATION: - if (IsAtLeastU()) { + if (isAtLeastU()) { parseFieldRestrictionAnnotation(annotationType); } else { mValid = false; diff --git a/statsd/src/metrics/MetricsManager.cpp b/statsd/src/metrics/MetricsManager.cpp index 528257ae..c8ee3eed 100644 --- a/statsd/src/metrics/MetricsManager.cpp +++ b/statsd/src/metrics/MetricsManager.cpp @@ -18,7 +18,6 @@ #include "MetricsManager.h" -#include #include #include "CountMetricProducer.h" @@ -36,8 +35,6 @@ #include "statslog_statsd.h" #include "utils/DbUtils.h" -using android::modules::sdklevel::IsAtLeastU; - using android::util::FIELD_COUNT_REPEATED; using android::util::FIELD_TYPE_INT32; using android::util::FIELD_TYPE_INT64; @@ -81,7 +78,7 @@ MetricsManager::MetricsManager(const ConfigKey& key, const StatsdConfig& config, mWhitelistedAtomIds(config.whitelisted_atom_ids().begin(), config.whitelisted_atom_ids().end()), mShouldPersistHistory(config.persist_locally()) { - if (!IsAtLeastU() && config.has_restricted_metrics_delegate_package_name()) { + if (!isAtLeastU() && config.has_restricted_metrics_delegate_package_name()) { mInvalidConfigReason = InvalidConfigReason(INVALID_CONFIG_REASON_RESTRICTED_METRIC_NOT_ENABLED); return; @@ -131,7 +128,7 @@ bool MetricsManager::updateConfig(const StatsdConfig& config, const int64_t time const int64_t currentTimeNs, const sp& anomalyAlarmMonitor, const sp& periodicAlarmMonitor) { - if (!IsAtLeastU() && config.has_restricted_metrics_delegate_package_name()) { + if (!isAtLeastU() && config.has_restricted_metrics_delegate_package_name()) { mInvalidConfigReason = InvalidConfigReason(INVALID_CONFIG_REASON_RESTRICTED_METRIC_NOT_ENABLED); return false; diff --git a/statsd/src/stats_util.h b/statsd/src/stats_util.h index bb919d45..fde18254 100644 --- a/statsd/src/stats_util.h +++ b/statsd/src/stats_util.h @@ -16,10 +16,12 @@ #pragma once -#include "HashableDimensionKey.h" +#include #include +#include "HashableDimensionKey.h" + namespace android { namespace os { namespace statsd { @@ -47,6 +49,16 @@ using StateLinks = google::protobuf::RepeatedPtrField; struct Empty {}; +inline bool isAtLeastS() { + const static bool isAtLeastS = android::modules::sdklevel::IsAtLeastS(); + return isAtLeastS; +} + +inline bool isAtLeastU() { + const static bool isAtLeastU = android::modules::sdklevel::IsAtLeastU(); + return isAtLeastU; +} + } // namespace statsd } // namespace os } // namespace android diff --git a/statsd/src/storage/StorageManager.cpp b/statsd/src/storage/StorageManager.cpp index 02c2128a..7ca88fe1 100644 --- a/statsd/src/storage/StorageManager.cpp +++ b/statsd/src/storage/StorageManager.cpp @@ -20,7 +20,6 @@ #include "storage/StorageManager.h" #include -#include #include #include @@ -35,7 +34,6 @@ namespace android { namespace os { namespace statsd { -using android::modules::sdklevel::IsAtLeastU; using android::util::FIELD_COUNT_REPEATED; using android::util::FIELD_TYPE_MESSAGE; using std::map; @@ -825,7 +823,7 @@ void StorageManager::printDirStats(int outFd, const char* path) { void StorageManager::enforceDbGuardrails(const char* path, const int64_t currWallClockSec, const int64_t maxBytes) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { return; } unique_ptr dir(opendir(path), closedir); diff --git a/statsd/tests/LogEvent_test.cpp b/statsd/tests/LogEvent_test.cpp index 1a9b920b..674b5463 100644 --- a/statsd/tests/LogEvent_test.cpp +++ b/statsd/tests/LogEvent_test.cpp @@ -14,7 +14,6 @@ #include "src/logd/LogEvent.h" -#include #include #include "flags/FlagProvider.h" @@ -31,7 +30,6 @@ namespace android { namespace os { namespace statsd { -using android::modules::sdklevel::IsAtLeastU; using std::string; using std::vector; using ::util::ProtoOutputStream; @@ -998,7 +996,7 @@ TEST_P(LogEventTest, TestResetStateAnnotation) { } TEST_P(LogEventTest, TestRestrictionCategoryAnnotation) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } int32_t restrictionCategory = ASTATSLOG_RESTRICTION_CATEGORY_DIAGNOSTIC; @@ -1011,7 +1009,7 @@ TEST_P(LogEventTest, TestRestrictionCategoryAnnotation) { } TEST_P(LogEventTest, TestInvalidRestrictionCategoryAnnotation) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } int32_t restrictionCategory = 619; // unknown category @@ -1022,7 +1020,7 @@ TEST_P(LogEventTest, TestInvalidRestrictionCategoryAnnotation) { } TEST_P(LogEventTest, TestRestrictionCategoryAnnotationBelowUDevice) { - if (IsAtLeastU()) { + if (isAtLeastU()) { GTEST_SKIP(); } int32_t restrictionCategory = ASTATSLOG_RESTRICTION_CATEGORY_DIAGNOSTIC; @@ -1150,7 +1148,7 @@ INSTANTIATE_TEST_SUITE_P( LogEvent_FieldRestrictionTest::ToString); TEST_P(LogEvent_FieldRestrictionTest, TestFieldRestrictionAnnotation) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } LogEvent event(/*uid=*/0, /*pid=*/0); @@ -1164,7 +1162,7 @@ TEST_P(LogEvent_FieldRestrictionTest, TestFieldRestrictionAnnotation) { } TEST_P(LogEvent_FieldRestrictionTest, TestInvalidAnnotationIntType) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } LogEvent event(/*uid=*/0, /*pid=*/0); @@ -1174,7 +1172,7 @@ TEST_P(LogEvent_FieldRestrictionTest, TestInvalidAnnotationIntType) { } TEST_P(LogEvent_FieldRestrictionTest, TestInvalidAnnotationAtomLevel) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } LogEvent event(/*uid=*/0, /*pid=*/0); @@ -1184,7 +1182,7 @@ TEST_P(LogEvent_FieldRestrictionTest, TestInvalidAnnotationAtomLevel) { } TEST_P(LogEvent_FieldRestrictionTest, TestRestrictionCategoryAnnotationBelowUDevice) { - if (IsAtLeastU()) { + if (isAtLeastU()) { GTEST_SKIP(); } int32_t restrictionCategory = ASTATSLOG_RESTRICTION_CATEGORY_DIAGNOSTIC; diff --git a/statsd/tests/MetricsManager_test.cpp b/statsd/tests/MetricsManager_test.cpp index e30f7bf0..6d090d14 100644 --- a/statsd/tests/MetricsManager_test.cpp +++ b/statsd/tests/MetricsManager_test.cpp @@ -35,8 +35,6 @@ using namespace testing; using android::sp; -using android::modules::sdklevel::IsAtLeastS; -using android::modules::sdklevel::IsAtLeastU; using android::os::statsd::Predicate; using std::map; using std::set; @@ -298,7 +296,7 @@ protected: } bool shouldSkipTest() const { - return !IsAtLeastS(); + return !isAtLeastS(); } string skipReason() const { @@ -384,7 +382,7 @@ TEST_P(MetricsManagerTest_SPlus, TestRestrictedMetricsConfig) { MetricsManager metricsManager(kConfigKey, config, timeBaseSec, timeBaseSec, uidMap, pullerManager, anomalyAlarmMonitor, periodicAlarmMonitor); - if (IsAtLeastU()) { + if (isAtLeastU()) { EXPECT_TRUE(metricsManager.isConfigValid()); } else { EXPECT_EQ(metricsManager.mInvalidConfigReason, @@ -410,7 +408,7 @@ TEST_P(MetricsManagerTest_SPlus, TestRestrictedMetricsConfigUpdate) { metricsManager.updateConfig(config, timeBaseSec, timeBaseSec, anomalyAlarmMonitor, periodicAlarmMonitor); - if (IsAtLeastU()) { + if (isAtLeastU()) { EXPECT_TRUE(metricsManager.isConfigValid()); } else { EXPECT_EQ(metricsManager.mInvalidConfigReason, diff --git a/statsd/tests/StatsLogProcessor_test.cpp b/statsd/tests/StatsLogProcessor_test.cpp index 3fbe48b9..02ed8440 100644 --- a/statsd/tests/StatsLogProcessor_test.cpp +++ b/statsd/tests/StatsLogProcessor_test.cpp @@ -15,7 +15,6 @@ #include "StatsLogProcessor.h" #include -#include #include #include #include @@ -43,7 +42,6 @@ namespace os { namespace statsd { using android::base::StringPrintf; -using android::modules::sdklevel::IsAtLeastU; using android::util::ProtoOutputStream; using ::testing::Expectation; @@ -2176,12 +2174,12 @@ class StatsLogProcessorTestRestricted : public Test { protected: const ConfigKey mConfigKey = ConfigKey(1, 12345); void SetUp() override { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } } void TearDown() override { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } FlagProvider::getInstance().resetOverrides(); diff --git a/statsd/tests/StatsService_test.cpp b/statsd/tests/StatsService_test.cpp index 4683dede..5bc2f747 100644 --- a/statsd/tests/StatsService_test.cpp +++ b/statsd/tests/StatsService_test.cpp @@ -31,7 +31,6 @@ namespace android { namespace os { namespace statsd { -using android::modules::sdklevel::IsAtLeastU; using android::util::ProtoOutputStream; using ::ndk::SharedRefBase; diff --git a/statsd/tests/e2e/RestrictedConfig_e2e_test.cpp b/statsd/tests/e2e/RestrictedConfig_e2e_test.cpp index 2f47a892..3d4c3f6c 100644 --- a/statsd/tests/e2e/RestrictedConfig_e2e_test.cpp +++ b/statsd/tests/e2e/RestrictedConfig_e2e_test.cpp @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include "flags/FlagProvider.h" @@ -23,8 +22,6 @@ namespace android { namespace os { namespace statsd { -using android::modules::sdklevel::IsAtLeastU; - #ifdef __ANDROID__ namespace { @@ -83,7 +80,7 @@ protected: string error; void SetUp() override { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } StatsServiceConfigTest::SetUp(); @@ -119,7 +116,7 @@ protected: service->mUidMap->updateMap(startTimeNs, uidData); } void TearDown() override { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } Mock::VerifyAndClear(mockStatsQueryCallback.get()); @@ -475,4 +472,4 @@ GTEST_LOG_(INFO) << "This test does nothing.\n"; } // namespace statsd } // namespace os -} // namespace android \ No newline at end of file +} // namespace android diff --git a/statsd/tests/e2e/RestrictedEventMetric_e2e_test.cpp b/statsd/tests/e2e/RestrictedEventMetric_e2e_test.cpp index 6aed3740..3ea02b26 100644 --- a/statsd/tests/e2e/RestrictedEventMetric_e2e_test.cpp +++ b/statsd/tests/e2e/RestrictedEventMetric_e2e_test.cpp @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include @@ -31,7 +30,6 @@ namespace android { namespace os { namespace statsd { -using android::modules::sdklevel::IsAtLeastU; using base::StringPrintf; #ifdef __ANDROID__ @@ -66,7 +64,7 @@ protected: private: void SetUp() override { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } diff --git a/statsd/tests/flags/FlagProvider_test.cpp b/statsd/tests/flags/FlagProvider_test.cpp index 55463b52..bd790a32 100644 --- a/statsd/tests/flags/FlagProvider_test.cpp +++ b/statsd/tests/flags/FlagProvider_test.cpp @@ -14,7 +14,6 @@ #include "src/flags/FlagProvider.h" -#include #include #include "tests/statsd_test_util.h" @@ -25,7 +24,6 @@ namespace statsd { #ifdef __ANDROID__ -using android::modules::sdklevel::IsAtLeastS; using namespace std; const string TEST_FLAG = "MyFlagTest"; @@ -77,7 +75,7 @@ TEST_P(FlagProviderTest_SPlus, TestOverrideLocalFlags) { class FlagProviderTest_SPlus_RealValues : public testing::TestWithParam { void SetUp() override { - if (!IsAtLeastS()) { + if (!isAtLeastS()) { GTEST_SKIP() << "Cannot query flags from system property on R-."; } } diff --git a/statsd/tests/metrics/RestrictedEventMetricProducer_test.cpp b/statsd/tests/metrics/RestrictedEventMetricProducer_test.cpp index b6c45451..44b812f1 100644 --- a/statsd/tests/metrics/RestrictedEventMetricProducer_test.cpp +++ b/statsd/tests/metrics/RestrictedEventMetricProducer_test.cpp @@ -1,6 +1,5 @@ #include "src/metrics/RestrictedEventMetricProducer.h" -#include #include #include "flags/FlagProvider.h" @@ -20,8 +19,6 @@ namespace android { namespace os { namespace statsd { -using android::modules::sdklevel::IsAtLeastU; - namespace { const ConfigKey configKey(/*uid=*/0, /*id=*/12345); const int64_t metricId1 = 123; @@ -41,12 +38,12 @@ bool metricTableExist(int64_t metricId) { class RestrictedEventMetricProducerTest : public Test { protected: void SetUp() override { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } } void TearDown() override { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } dbutils::deleteDb(configKey); @@ -263,4 +260,4 @@ TEST_F(RestrictedEventMetricProducerTest, TestLoadMetricMetadataSetsCategory) { #else GTEST_LOG_(INFO) << "This test does nothing.\n"; -#endif \ No newline at end of file +#endif diff --git a/statsd/tests/storage/StorageManager_test.cpp b/statsd/tests/storage/StorageManager_test.cpp index db80e778..27b8e987 100644 --- a/statsd/tests/storage/StorageManager_test.cpp +++ b/statsd/tests/storage/StorageManager_test.cpp @@ -15,7 +15,6 @@ #include "src/storage/StorageManager.h" #include -#include #include #include #include @@ -32,7 +31,7 @@ namespace os { namespace statsd { using namespace testing; -using android::modules::sdklevel::IsAtLeastU; + using std::make_shared; using std::shared_ptr; using std::vector; @@ -283,7 +282,7 @@ TEST(StorageManagerTest, TrainInfoReadWrite32To64BitTest) { } TEST(StorageManagerTest, DeleteUnmodifiedOldDbFiles) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } ConfigKey key(123, 12345); @@ -301,7 +300,7 @@ TEST(StorageManagerTest, DeleteUnmodifiedOldDbFiles) { } TEST(StorageManagerTest, DeleteLargeDbFiles) { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } ConfigKey key(123, 12345); diff --git a/statsd/tests/utils/DbUtils_test.cpp b/statsd/tests/utils/DbUtils_test.cpp index 8a9b3377..9bc1d61a 100644 --- a/statsd/tests/utils/DbUtils_test.cpp +++ b/statsd/tests/utils/DbUtils_test.cpp @@ -16,7 +16,6 @@ #include "utils/DbUtils.h" -#include #include #include "android-base/stringprintf.h" @@ -32,7 +31,6 @@ namespace os { namespace statsd { namespace dbutils { -using android::modules::sdklevel::IsAtLeastU; using base::StringPrintf; namespace { @@ -56,12 +54,12 @@ LogEvent makeLogEvent(AStatsEvent* statsEvent) { class DbUtilsTest : public ::testing::Test { public: void SetUp() override { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } } void TearDown() override { - if (!IsAtLeastU()) { + if (!isAtLeastU()) { GTEST_SKIP(); } deleteDb(key); -- cgit v1.2.3