From 304992bee928ffaffc13aa304e11ac95b9d07dd7 Mon Sep 17 00:00:00 2001 From: ReCoder Date: Mon, 24 Mar 2025 10:06:53 +0800 Subject: [PATCH] fix: use target version Signed-off-by: ReCoder --- previewer/include/window_impl.h | 1 + previewer/src/window_impl.cpp | 11 ++++++++++- wm/include/window_impl.h | 2 +- wm/include/window_session_impl.h | 1 - wm/src/window_impl.cpp | 6 +++--- wm/src/window_session_impl.cpp | 11 +---------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/previewer/include/window_impl.h b/previewer/include/window_impl.h index b2602cb110..0fd1e251e6 100644 --- a/previewer/include/window_impl.h +++ b/previewer/include/window_impl.h @@ -247,6 +247,7 @@ public: */ static void UpdateConfigurationSyncForAll(const std::shared_ptr& configuration); void UpdateConfigurationSync(const std::shared_ptr& configuration) override; + uint32_t GetApiTargetVersion() const; private: static sptr FindWindowById(uint32_t windowId); diff --git a/previewer/src/window_impl.cpp b/previewer/src/window_impl.cpp index 404e420e22..d78c388ba9 100644 --- a/previewer/src/window_impl.cpp +++ b/previewer/src/window_impl.cpp @@ -480,7 +480,7 @@ void WindowImpl::UpdateSpecificSystemBarEnabled(bool systemBarEnable, bool syste property.enable_ = systemBarEnable; property.enableAnimation_ = systemBarEnableAnimation; // isolate on api 18 - if (GetApiCompatibleVersion() >= API_VERSION_18) { + if (GetApiTargetVersion() >= API_VERSION_18) { property.settingFlag_ |= SystemBarSettingFlag::ENABLE_SETTING; } } @@ -1250,5 +1250,14 @@ bool WindowImpl::GetImmersiveModeEnabledState() const { return true; } + +uint32_t WindowImpl::GetApiTargetVersion() const +{ + uint32_t version = 0; + if ((context_ != nullptr) && (context_->GetApplicationInfo() != nullptr)) { + version = context_->GetApplicationInfo()->apiTargetVersion % API_VERSION_MOD; + } + return version; +} } // namespace Rosen } // namespace OHOS diff --git a/wm/include/window_impl.h b/wm/include/window_impl.h index 5a68cbc22b..f1cbcb9544 100644 --- a/wm/include/window_impl.h +++ b/wm/include/window_impl.h @@ -353,7 +353,7 @@ public: static void UpdateConfigurationSyncForAll(const std::shared_ptr& configuration); void UpdateConfigurationSync(const std::shared_ptr& configuration) override; void RegisterWindowInspectorCallback(); - uint32_t GetApiCompatibleVersion() const override; + uint32_t GetApiTargetVersion() const; /* * Keyboard diff --git a/wm/include/window_session_impl.h b/wm/include/window_session_impl.h index 9c2c464275..721c522f16 100644 --- a/wm/include/window_session_impl.h +++ b/wm/include/window_session_impl.h @@ -389,7 +389,6 @@ public: * Window Property */ WSError NotifyDisplayIdChange(DisplayId displayId); - uint32_t GetApiCompatibleVersion() const override; /* * Window Input Event diff --git a/wm/src/window_impl.cpp b/wm/src/window_impl.cpp index 2def6cf82e..56f7afca97 100644 --- a/wm/src/window_impl.cpp +++ b/wm/src/window_impl.cpp @@ -973,7 +973,7 @@ void WindowImpl::UpdateSpecificSystemBarEnabled(bool systemBarEnable, bool syste property.enable_ = systemBarEnable; property.enableAnimation_ = systemBarEnableAnimation; // isolate on api 18 - if (GetApiCompatibleVersion() >= API_VERSION_18) { + if (GetApiTargetVersion() >= API_VERSION_18) { property.settingFlag_ |= SystemBarSettingFlag::ENABLE_SETTING; } } @@ -4465,11 +4465,11 @@ void WindowImpl::RegisterWindowInspectorCallback() WindowInspector::GetInstance().RegisterGetWMSWindowListCallback(GetWindowId(), std::move(getWMSWindowListCallback)); } -uint32_t WindowImpl::GetApiCompatibleVersion() const +uint32_t WindowImpl::GetApiTargetVersion() const { uint32_t version = 0; if ((context_ != nullptr) && (context_->GetApplicationInfo() != nullptr)) { - version = context_->GetApplicationInfo()->apiCompatibleVersion % API_VERSION_MOD; + version = context_->GetApplicationInfo()->apiTargetVersion % API_VERSION_MOD; } return version; } diff --git a/wm/src/window_session_impl.cpp b/wm/src/window_session_impl.cpp index 03f73e1de3..0b81520b7e 100644 --- a/wm/src/window_session_impl.cpp +++ b/wm/src/window_session_impl.cpp @@ -4560,15 +4560,6 @@ WSError WindowSessionImpl::NotifyDisplayIdChange(DisplayId displayId) return WSError::WS_OK; } -uint32_t WindowSessionImpl::GetApiCompatibleVersion() const -{ - uint32_t version = 0; - if ((context_ != nullptr) && (context_->GetApplicationInfo() != nullptr)) { - version = context_->GetApplicationInfo()->apiCompatibleVersion % API_VERSION_MOD; - } - return version; -} - WMError WindowSessionImpl::NotifyWatchGestureConsumeResult(int32_t keyCode, bool isConsumed) { TLOGD(WmsLogTag::WMS_EVENT, "keyCode:%{public}d, isConsumed:%{public}d", keyCode, isConsumed); @@ -5111,7 +5102,7 @@ void WindowSessionImpl::UpdateSpecificSystemBarEnabled(bool systemBarEnable, boo property.enable_ = systemBarEnable; property.enableAnimation_ = systemBarEnableAnimation; // isolate on api 18 - if (GetApiCompatibleVersion() >= API_VERSION_18) { + if (GetTargetAPIVersion() >= API_VERSION_18) { property.settingFlag_ |= SystemBarSettingFlag::ENABLE_SETTING; } }