Get BrandName from DeviceInfo.brandname
Change-Id: Iee79deb5fecdf8b305493e59671b8b9ecff746cc
(cherry picked from commit 1b58b2d79ddd1da7a7c3742c6af62546a03929a4)
diff --git a/src/third_party/starboard/rdk/shared/rdkservices.cc b/src/third_party/starboard/rdk/shared/rdkservices.cc
index 6355fe5..215ef9f 100644
--- a/src/third_party/starboard/rdk/shared/rdkservices.cc
+++ b/src/third_party/starboard/rdk/shared/rdkservices.cc
@@ -1161,6 +1161,8 @@
needs_refresh_.store(true);
}
+ bool GetBrandName(std::string& out);
+
private:
struct DeviceDetailsData : public Core::JSON::Container {
DeviceDetailsData()
@@ -1252,6 +1254,7 @@
::starboard::Mutex mutex_;
std::vector<SbMediaAudioConfiguration> audio_configurations_;
+ Core::OptionalType<std::string> brand_name_;
static constexpr SbMediaAudioConnector kAudioConnectorUnknown = static_cast<SbMediaAudioConnector>(0);
};
@@ -1432,6 +1435,33 @@
return false;
}
+bool DeviceInfoImpl::GetBrandName(std::string& out) {
+ if (!brand_name_.IsSet()) {
+ struct BrandNameInfo : public Core::JSON::Container {
+ BrandNameInfo() : Core::JSON::Container() {
+ Add(_T("brand"), &BrandName);
+ }
+ Core::JSON::String BrandName;
+ } info;
+ uint32_t rc = device_info_.Get(kDefaultTimeoutMs, "brandname", info);
+ if (Core::ERROR_NONE != rc) {
+ SB_LOG(ERROR) << "Failed to get '" << kDeviceInfoCallsign
+ << ".brandname', rc=" << rc
+ << " ( " << Core::ErrorToString(rc) << " ).";
+ if (rc == Core::ERROR_ASYNC_FAILED || rc == Core::ERROR_TIMEDOUT) {
+ brand_name_.Clear();
+ } else {
+ brand_name_ = "";
+ }
+ } else {
+ brand_name_ = info.BrandName.Value();
+ SB_LOG(INFO) << "Device brandname: " << brand_name_.Value();
+ }
+ }
+ out = brand_name_.Value();
+ return !out.empty();
+}
+
} // namespace
ResolutionInfo DisplayInfo::GetResolution() {
@@ -1562,6 +1592,10 @@
return GetDeviceInfo()->GetAudioConfiguration(index, out_audio_configuration);
}
+bool DeviceInfo::GetBrandName(std::string& out) {
+ return GetDeviceInfo()->GetBrandName(out);
+}
+
void TeardownJSONRPCLink() {
GetDisplayInfo()->Teardown();
GetTextToSpeech()->Teardown();
diff --git a/src/third_party/starboard/rdk/shared/rdkservices.h b/src/third_party/starboard/rdk/shared/rdkservices.h
index e317ebe..b7bccc8 100644
--- a/src/third_party/starboard/rdk/shared/rdkservices.h
+++ b/src/third_party/starboard/rdk/shared/rdkservices.h
@@ -115,6 +115,7 @@
class DeviceInfo {
public:
static bool GetAudioConfiguration(int index, SbMediaAudioConfiguration* out_audio_configuration);
+ static bool GetBrandName(std::string& out);
};
void TeardownJSONRPCLink();
diff --git a/src/third_party/starboard/rdk/shared/system/system_get_property.cc b/src/third_party/starboard/rdk/shared/system/system_get_property.cc
index 6207ec2..c46abe5 100644
--- a/src/third_party/starboard/rdk/shared/system/system_get_property.cc
+++ b/src/third_party/starboard/rdk/shared/system/system_get_property.cc
@@ -139,7 +139,7 @@
bool GetOperatorName(char* out_value, int value_length) {
std::string prop;
- if (SystemProperties::GetBrandName(prop)) {
+ if (SystemProperties::GetBrandName(prop) || DeviceInfo::GetBrandName(prop)) {
return CopyStringAndTestIfSuccess(
out_value, value_length, prop.c_str());
}