From 7beaf8924fe818b8be0824456fcc64a328cb2ee0 Mon Sep 17 00:00:00 2001 From: Bertrand SIMONNET Date: Thu, 24 Sep 2015 11:22:27 -0700 Subject: [PATCH] metricsd: Use product id instead of build target id. We decided to change the name of this identifier to "product id", the system property where it is stored will also be named ro.product.product_id. BUG: 24302729 Change-Id: I0d2f0867b364de98367f0072d216acec76401c33 --- metricsd/constants.h | 2 +- metricsd/uploader/system_profile_cache.cc | 8 ++++---- metricsd/uploader/system_profile_cache.h | 2 +- metricsd/uploader/upload_service_test.cc | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/metricsd/constants.h b/metricsd/constants.h index 717e5d2e2..8a00fc47d 100644 --- a/metricsd/constants.h +++ b/metricsd/constants.h @@ -28,7 +28,7 @@ static const char kFailedUploadCountName[] = "failed_upload_count"; static const char kDefaultVersion[] = "0.0.0.0"; // System properties used. -static const char kBuildTargetIdProperty[] = "ro.product.build_target_id"; +static const char kProductIdProperty[] = "ro.product.product_id"; static const char kChannelProperty[] = "ro.product.channel"; static const char kProductVersionProperty[] = "ro.product.version"; } // namespace metrics diff --git a/metricsd/uploader/system_profile_cache.cc b/metricsd/uploader/system_profile_cache.cc index e3f63398f..2437b5628 100644 --- a/metricsd/uploader/system_profile_cache.cc +++ b/metricsd/uploader/system_profile_cache.cc @@ -73,10 +73,10 @@ bool SystemProfileCache::Initialize() { CHECK(!initialized_) << "this should be called only once in the metrics_daemon lifetime."; - profile_.build_target_id = GetProperty(metrics::kBuildTargetIdProperty); + profile_.product_id = GetProperty(metrics::kProductIdProperty); - if (profile_.build_target_id.empty()) { - LOG(ERROR) << "System property " << metrics::kBuildTargetIdProperty + if (profile_.product_id.empty()) { + LOG(ERROR) << "System property " << metrics::kProductIdProperty << " is not set."; return false; } @@ -136,7 +136,7 @@ bool SystemProfileCache::Populate( profile_proto->set_channel(profile_.channel); metrics::SystemProfileProto_BrilloDeviceData* device_data = profile_proto->mutable_brillo(); - device_data->set_build_target_id(profile_.build_target_id); + device_data->set_build_target_id(profile_.product_id); return true; } diff --git a/metricsd/uploader/system_profile_cache.h b/metricsd/uploader/system_profile_cache.h index 1d22fa1ae..341015731 100644 --- a/metricsd/uploader/system_profile_cache.h +++ b/metricsd/uploader/system_profile_cache.h @@ -39,7 +39,7 @@ struct SystemProfile { std::string client_id; int session_id; metrics::SystemProfileProto::Channel channel; - std::string build_target_id; + std::string product_id; }; // Retrieves general system informations needed by the protobuf for context and diff --git a/metricsd/uploader/upload_service_test.cc b/metricsd/uploader/upload_service_test.cc index 09748db6e..0dd7db6e2 100644 --- a/metricsd/uploader/upload_service_test.cc +++ b/metricsd/uploader/upload_service_test.cc @@ -224,7 +224,7 @@ TEST_F(UploadServiceTest, ValuesInConfigFileAreSent) { upload_service_->sender_.reset(sender); SetTestingProperty(metrics::kChannelProperty, "beta"); - SetTestingProperty(metrics::kBuildTargetIdProperty, "hello"); + SetTestingProperty(metrics::kProductIdProperty, "hello"); SetTestingProperty(metrics::kProductVersionProperty, "1.2.3.4"); scoped_ptr histogram = @@ -267,7 +267,7 @@ TEST_F(UploadServiceTest, PersistentGUID) { } TEST_F(UploadServiceTest, SessionIdIncrementedAtInitialization) { - SetTestingProperty(metrics::kBuildTargetIdProperty, "hello"); + SetTestingProperty(metrics::kProductIdProperty, "hello"); SystemProfileCache cache(true, dir_.path()); cache.Initialize(); int session_id = cache.profile_.session_id;