diff --git a/frameworks/resmgr/include/hilog_wrapper.h b/frameworks/resmgr/include/hilog_wrapper.h index df09e934511f97783a7e1cd252c2e6f8f6fd594c..1648a65d970bc00bb663d41d06bb1533d847b0e7 100644 --- a/frameworks/resmgr/include/hilog_wrapper.h +++ b/frameworks/resmgr/include/hilog_wrapper.h @@ -38,6 +38,10 @@ namespace OHOS::HiviewDFX { #define RESMGR_HILOGI(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_INFO, 0xD001E00, tag, fmt, ##__VA_ARGS__) #define RESMGR_HILOGD(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_DEBUG, 0xD001E00, tag, fmt, ##__VA_ARGS__) #define RESMGR_HILOGF(tag, fmt, ...) HILOG_IMPL(LOG_CORE, LOG_FATAL, 0xD001E00, tag, fmt, ##__VA_ARGS__) + #define RESMGR_HILOGI_BY_FLAG(flag, tag, fmt, ...) \ + if (flag) { \ + HILOG_IMPL(LOG_CORE, LOG_INFO, 0xD001E00, tag, fmt, ##__VA_ARGS__); \ + } } namespace OHOS { @@ -55,6 +59,7 @@ extern LogLevel g_logLevel; #define RESMGR_HILOGI(tag, fmt, ...) #define RESMGR_HILOGD(tag, fmt, ...) #define RESMGR_HILOGF(tag, fmt, ...) +#define RESMGR_HILOGI_BY_FLAG(flag, tag, fmt, ...) #endif // CONFIG_HILOG diff --git a/frameworks/resmgr/include/theme_pack_manager.h b/frameworks/resmgr/include/theme_pack_manager.h index c5d90a64a68ea53b7a319561e485a6386aa4d1dc..a512441037fad851b6b62e905edd0a9afacbc45c 100644 --- a/frameworks/resmgr/include/theme_pack_manager.h +++ b/frameworks/resmgr/include/theme_pack_manager.h @@ -163,6 +163,7 @@ private: std::string themeMask; void ClearSkinResource(); void ClearIconResource(); + const std::string GetMaskString(const std::string &path); std::vector> skinResource_; std::vector> iconResource_; std::vector, size_t>> iconMaskValues_; @@ -187,6 +188,7 @@ private: uint32_t themeId_{0}; bool isFirstCreate = true; int32_t currentUserId_ = 0; + bool isLogFlag_ = false; }; } // namespace Resource } // namespace Global diff --git a/frameworks/resmgr/src/theme_pack_manager.cpp b/frameworks/resmgr/src/theme_pack_manager.cpp index ee6872bcea93b18aa4b34df71b34038aa7e2e550..82f8aa6319603f000293fb8f1f55040870b3fe96 100644 --- a/frameworks/resmgr/src/theme_pack_manager.cpp +++ b/frameworks/resmgr/src/theme_pack_manager.cpp @@ -45,6 +45,7 @@ const std::string absoluteThemeSkinA = "/data/service/el1/public/themes/iconResource_.emplace_back(pThemeResource); } } ClearIconResource(); + RESMGR_HILOGI_BY_FLAG(isLogFlag_, RESMGR_TAG, "load img end, size is %{public}u", iconResource_.size()); } const std::string ThemePackManager::FindThemeIconResource(const std::pair &bundleInfo, @@ -354,6 +358,7 @@ const std::string ThemePackManager::FindThemeIconResource(const std::pairGetThemeAppIcon(bundleInfo, iconName, abilityName); if (!result.empty()) { + RESMGR_HILOGI_BY_FLAG(isLogFlag_, RESMGR_TAG, "find img, %{public}s", GetMaskString(result).c_str()); break; } } @@ -475,6 +480,14 @@ void ThemePackManager::UpdateUserId(int32_t userId) currentUserId_ = userId; } } + +const std::string ThemePackManager::GetMaskString(const std::string &path) +{ + if (path.empty() || path.find(absoluteThemePath) == std::string::npos) { + return path; + } + return path.substr(absoluteThemePath.length(), path.length() - absoluteThemePath.length()); +} } // namespace Resource } // namespace Global } // namespace OHOS