diff --git a/adapter/ohos/osal/system_properties.cpp b/adapter/ohos/osal/system_properties.cpp index d3022281..670a1d2a 100644 --- a/adapter/ohos/osal/system_properties.cpp +++ b/adapter/ohos/osal/system_properties.cpp @@ -202,13 +202,14 @@ void SystemProperties::InitDeviceInfo( resolution_ = resolution; deviceWidth_ = deviceWidth; deviceHeight_ = deviceHeight; - brand_ = system::GetParameter("ro.product.brand", INVALID_PARAM); - manufacturer_ = system::GetParameter("ro.product.manufacturer", INVALID_PARAM); - model_ = system::GetParameter("ro.product.model", INVALID_PARAM); - product_ = system::GetParameter("ro.product.name", INVALID_PARAM); - apiVersion_ = system::GetParameter("hw_sc.build.os.apiversion", INVALID_PARAM); - releaseType_ = system::GetParameter("hw_sc.build.os.releasetype", INVALID_PARAM); - paramDeviceType_ = system::GetParameter("hw_sc.build.os.devicetype", INVALID_PARAM); + brand_ = system::GetParameter("const.product.brand", INVALID_PARAM); + manufacturer_ = system::GetParameter("const.product.manufacturer", INVALID_PARAM); + model_ = system::GetParameter("const.product.model", INVALID_PARAM); + product_ = system::GetParameter("const.product.name", INVALID_PARAM); + apiVersion_ = system::GetParameter("const.ohos.apiversion", INVALID_PARAM); + releaseType_ = system::GetParameter("const.ohos.releasetype", INVALID_PARAM); + paramDeviceType_ = system::GetParameter("const.build.characteristics", INVALID_PARAM); + debugEnabled_ = IsDebugEnabled(); traceEnabled_ = IsTraceEnabled(); accessibilityEnabled_ = IsAccessibilityEnabled(); @@ -254,4 +255,14 @@ bool SystemProperties::GetDebugEnabled() { return debugEnabled_; } + +std::string SystemProperties::GetLanguage() +{ + return system::GetParameter("const.global.language", INVALID_PARAM); +} + +std::string SystemProperties::GetRegion() +{ + return system::GetParameter("const.global.region", INVALID_PARAM); +} } // namespace OHOS::Ace diff --git a/adapter/preview/osal/system_properties.cpp b/adapter/preview/osal/system_properties.cpp index cca9ee00..014f8049 100644 --- a/adapter/preview/osal/system_properties.cpp +++ b/adapter/preview/osal/system_properties.cpp @@ -156,4 +156,14 @@ bool SystemProperties::GetDebugEnabled() { return false; } + +std::string SystemProperties::GetLanguage() +{ + return UNDEFINED_PARAM; +} + +std::string SystemProperties::GetRegion() +{ + return UNDEFINED_PARAM; +} } // namespace OHOS::Ace diff --git a/frameworks/base/utils/system_properties.h b/frameworks/base/utils/system_properties.h index 509bbf3d..dadc72c1 100644 --- a/frameworks/base/utils/system_properties.h +++ b/frameworks/base/utils/system_properties.h @@ -172,6 +172,10 @@ public: return paramDeviceType_; } + static std::string GetLanguage(); + + static std::string GetRegion(); + static bool GetRosenBackendEnabled() { return rosenBackendEnabled_; diff --git a/frameworks/bridge/common/plugin_adapter/plugin_bridge.cpp b/frameworks/bridge/common/plugin_adapter/plugin_bridge.cpp index d94b0056..2fcde969 100644 --- a/frameworks/bridge/common/plugin_adapter/plugin_bridge.cpp +++ b/frameworks/bridge/common/plugin_adapter/plugin_bridge.cpp @@ -52,6 +52,16 @@ void PluginBridge::ProcessSystemParam(std::unique_ptr& infoList) if (tmp != SystemProperties::INVALID_PARAM) { infoList->Put("deviceType", tmp.c_str()); } + + tmp = SystemProperties::GetLanguage(); + if (tmp != SystemProperties::INVALID_PARAM) { + infoList->Put("language", tmp.c_str()); + } + + tmp = SystemProperties::GetRegion(); + if (tmp != SystemProperties::INVALID_PARAM) { + infoList->Put("region", tmp.c_str()); + } } std::pair PluginBridge::GetDeviceInfo() @@ -60,13 +70,6 @@ std::pair PluginBridge::GetDeviceInfo() auto infoList = JsonUtil::Create(true); ProcessSystemParam(infoList); - if (!AceApplicationInfo::GetInstance().GetLanguage().empty()) { - infoList->Put("language", AceApplicationInfo::GetInstance().GetLanguage().c_str()); - } - if (!AceApplicationInfo::GetInstance().GetCountryOrRegion().empty()) { - infoList->Put("region", AceApplicationInfo::GetInstance().GetCountryOrRegion().c_str()); - } - auto container = Container::Current(); int32_t width = container ? container->GetViewWidth() : 0; if (width != 0) {