git customization config path

Signed-off-by: qianlf <qianliangfang@huawei.com>
Change-Id: Ic33b5e3810c919dfc007f3253e7256c2a34e6792
This commit is contained in:
qianlf
2022-06-24 19:09:30 +08:00
parent ef0d9642ba
commit 2b31a4a929
10 changed files with 39 additions and 10 deletions
+1
View File
@@ -57,6 +57,7 @@ ohos_shared_library("libdms") {
external_deps = [
"access_token:libaccesstoken_sdk",
"config_policy:configpolicy_util",
"graphic_standard:surface",
"hilog_native:libhilog",
"hitrace_native:hitrace_meter",
+2 -1
View File
@@ -30,7 +30,7 @@ public:
DisplayManagerConfig() = delete;
~DisplayManagerConfig() = default;
static bool LoadConfigXml(const std::string& configFilePath);
static bool LoadConfigXml();
static const std::map<std::string, std::vector<int>>& GetIntNumbersConfig();
static void DumpConfig();
@@ -39,6 +39,7 @@ private:
static bool IsValidNode(const xmlNode& currNode);
static void ReadIntNumbersConfigInfo(const xmlNodePtr& currNode);
static std::string GetConfigPath(const std::string& configFileName);
static std::vector<std::string> Split(std::string str, std::string pattern);
static inline bool IsNumber(std::string str);
@@ -35,9 +35,6 @@
#include "singleton_delegator.h"
namespace OHOS::Rosen {
namespace {
const std::string DISPLAY_MANAGER_CONFIG_XML = "/system/etc/window/resources/display_manager_config.xml";
}
class DisplayManagerService : public SystemAbility, public DisplayManagerStub {
DECLARE_SYSTEM_ABILITY(DisplayManagerService);
WM_DECLARE_SINGLE_INSTANCE_BASE(DisplayManagerService);
+15 -1
View File
@@ -14,6 +14,7 @@
*/
#include "display_manager_config.h"
#include "config_policy_utils.h"
#include "window_manager_hilog.h"
namespace OHOS {
@@ -51,8 +52,21 @@ bool inline DisplayManagerConfig::IsNumber(std::string str)
return true;
}
bool DisplayManagerConfig::LoadConfigXml(const std::string& configFilePath)
std::string DisplayManagerConfig::GetConfigPath(const std::string& configFileName)
{
char buf[PATH_MAX + 1];
char* configPath = GetOneCfgFile(configFileName.c_str(), buf, PATH_MAX + 1);
char tmpPath[PATH_MAX + 1] = { 0 };
if (!configPath || strlen(configPath) == 0 || strlen(configPath) > PATH_MAX || !realpath(configPath, tmpPath)) {
WLOGFI("[DmConfig] can not get customization config file");
return "/system/" + configFileName;
}
return std::string(tmpPath);
}
bool DisplayManagerConfig::LoadConfigXml()
{
auto configFilePath = GetConfigPath("etc/window/resources/display_manager_config.xml");
xmlDocPtr docPtr = xmlReadFile(configFilePath.c_str(), nullptr, XML_PARSE_NOBLANKS);
WLOGFI("[DmConfig] filePath: %{public}s", configFilePath.c_str());
if (docPtr == nullptr) {
+1 -1
View File
@@ -84,7 +84,7 @@ bool DisplayManagerService::Init()
WLOGFW("DisplayManagerService::Init failed");
return false;
}
if (DisplayManagerConfig::LoadConfigXml(DISPLAY_MANAGER_CONFIG_XML)) {
if (DisplayManagerConfig::LoadConfigXml()) {
DisplayManagerConfig::DumpConfig();
ConfigureDisplayManagerService();
}
-1
View File
@@ -145,7 +145,6 @@ namespace {
constexpr uint32_t MIN_VERTICAL_SPLIT_HEIGHT = 240;
constexpr uint32_t MIN_HORIZONTAL_SPLIT_WIDTH = 320;
constexpr uint32_t MAX_FLOATING_SIZE = 2560;
const std::string WINDOW_MANAGER_CONFIG_XML = "/system/etc/window/resources/window_manager_config.xml";
const Rect INVALID_EMPTY_RECT = {0, 0, 0, 0};
}
}
+1
View File
@@ -91,6 +91,7 @@ ohos_shared_library("libwms") {
"ability_base:want",
"ability_runtime:ability_manager",
"common_event_service:cesfwk_innerkits",
"config_policy:configpolicy_util",
"display_manager_native:displaymgr",
"graphic_standard:surface",
"graphic_standard:window_animation",
+2 -1
View File
@@ -31,7 +31,7 @@ public:
WindowManagerConfig() = delete;
~WindowManagerConfig() = default;
static bool LoadConfigXml(const std::string& configFilePath);
static bool LoadConfigXml();
static const std::map<std::string, bool>& GetEnableConfig();
static const std::map<std::string, std::vector<int>>& GetIntNumbersConfig();
static const std::map<std::string, std::vector<float>>& GetFloatNumbersConfig();
@@ -46,6 +46,7 @@ private:
static void ReadEnableConfigInfo(const xmlNodePtr& currNode);
static void ReadIntNumbersConfigInfo(const xmlNodePtr& currNode);
static void ReadFloatNumbersConfigInfo(const xmlNodePtr& currNode);
static std::string GetConfigPath(const std::string& configFileName);
};
} // namespace Rosen
} // namespace OHOS
+16 -1
View File
@@ -14,6 +14,7 @@
*/
#include "window_manager_config.h"
#include "config_policy_utils.h"
#include "window_helper.h"
#include "window_manager_hilog.h"
@@ -27,8 +28,22 @@ std::map<std::string, bool> WindowManagerConfig::enableConfig_;
std::map<std::string, std::vector<int>> WindowManagerConfig::intNumbersConfig_;
std::map<std::string, std::vector<float>> WindowManagerConfig::floatNumbersConfig_;
bool WindowManagerConfig::LoadConfigXml(const std::string& configFilePath)
std::string WindowManagerConfig::GetConfigPath(const std::string& configFileName)
{
char buf[PATH_MAX + 1];
char* configPath = GetOneCfgFile(configFileName.c_str(), buf, PATH_MAX + 1);
char tmpPath[PATH_MAX + 1] = { 0 };
if (!configPath || strlen(configPath) == 0 || strlen(configPath) > PATH_MAX || !realpath(configPath, tmpPath)) {
WLOGFI("[WmConfig] can not get customization config file");
return "/system/" + configFileName;
}
return std::string(tmpPath);
}
bool WindowManagerConfig::LoadConfigXml()
{
auto configFilePath = GetConfigPath("etc/window/resources/window_manager_config.xml");
xmlDocPtr docPtr = xmlReadFile(configFilePath.c_str(), nullptr, XML_PARSE_NOBLANKS);
WLOGFI("[WmConfig] filePath: %{public}s", configFilePath.c_str());
if (docPtr == nullptr) {
+1 -1
View File
@@ -219,7 +219,7 @@ bool WindowManagerService::Init()
WLOGFW("WindowManagerService::Init failed");
return false;
}
if (WindowManagerConfig::LoadConfigXml(WINDOW_MANAGER_CONFIG_XML)) {
if (WindowManagerConfig::LoadConfigXml()) {
WindowManagerConfig::DumpConfig();
ConfigureWindowManagerService();
}