From f19bb9cf21580a38219f2ea4467c6978582852ed Mon Sep 17 00:00:00 2001 From: wangxinpeng Date: Thu, 20 Jan 2022 21:49:34 +0800 Subject: [PATCH] fix int32_t displayId to uint64_t Signed-off-by: wangxinpeng Change-Id: I837bc7ec0af63c1bdad244e4b40609eae043889c --- dm/include/display_manager_adapter.h | 2 +- dm/src/display_manager.cpp | 2 +- dm/src/display_manager_adapter.cpp | 2 +- dm/test/systemtest/display_power_test.cpp | 2 +- dmserver/include/abstract_display.h | 2 -- dmserver/include/display_manager_interface.h | 2 +- dmserver/include/display_manager_proxy.h | 2 +- dmserver/include/display_manager_service.h | 2 +- dmserver/include/display_power_controller.h | 3 ++- dmserver/src/display_manager_proxy.cpp | 6 ++--- dmserver/src/display_manager_service.cpp | 2 +- dmserver/src/display_manager_stub.cpp | 2 +- dmserver/src/display_power_controller.cpp | 2 +- interfaces/innerkits/dm/display.h | 1 - interfaces/innerkits/dm/display_manager.h | 2 +- interfaces/innerkits/dm/dm_common.h | 1 - interfaces/innerkits/wm/window_manager.h | 10 ++++---- interfaces/innerkits/wm/window_option.h | 7 +++--- interfaces/innerkits/wm/window_scene.h | 6 ++--- interfaces/innerkits/wm/wm_common.h | 1 + .../window_napi/js_window_listener.cpp | 2 +- .../window_napi/js_window_listener.h | 2 +- utils/include/window_property.h | 6 ++--- utils/src/window_property.cpp | 8 +++---- wm/include/window_manager_agent.h | 4 ++-- .../zidl/window_manager_agent_interface.h | 4 ++-- wm/include/zidl/window_manager_agent_proxy.h | 4 ++-- wm/src/window_impl.cpp | 7 +++--- wm/src/window_manager.cpp | 23 ++++++++++--------- wm/src/window_manager_agent.cpp | 4 ++-- wm/src/window_option.cpp | 4 ++-- wm/src/window_scene.cpp | 2 +- wm/src/zidl/window_manager_agent_proxy.cpp | 6 ++--- wm/src/zidl/window_manager_agent_stub.cpp | 4 ++-- wm/test/systemtest/window_immersive_test.cpp | 6 ++--- wm/test/systemtest/window_layout_test.cpp | 2 +- wm/test/unittest/window_scene_test.cpp | 8 +++---- wmserver/include/input_window_monitor.h | 4 ++-- wmserver/include/window_inner_manager.h | 10 ++++---- .../include/window_manager_agent_controller.h | 4 ++-- wmserver/include/window_manager_service.h | 2 +- wmserver/include/window_node.h | 4 ++-- wmserver/include/window_root.h | 4 ++-- wmserver/src/input_window_monitor.cpp | 14 +++++------ wmserver/src/window_inner_manager.cpp | 14 ++++++----- .../src/window_manager_agent_controller.cpp | 4 ++-- wmserver/src/window_manager_service.cpp | 4 ++-- wmserver/src/window_node.cpp | 4 ++-- wmserver/src/window_root.cpp | 8 +++---- wmtest/test/wm_native_test.cpp | 2 +- 50 files changed, 118 insertions(+), 115 deletions(-) diff --git a/dm/include/display_manager_adapter.h b/dm/include/display_manager_adapter.h index b9de904315..514cf5042c 100644 --- a/dm/include/display_manager_adapter.h +++ b/dm/include/display_manager_adapter.h @@ -52,7 +52,7 @@ public: virtual bool SuspendEnd(); virtual bool SetScreenPowerForAll(DisplayPowerState state, PowerStateChangeReason reason); virtual bool SetDisplayState(DisplayState state); - virtual DisplayState GetDisplayState(uint64_t displayId); + virtual DisplayState GetDisplayState(DisplayId displayId); virtual void NotifyDisplayEvent(DisplayEvent event); virtual DMError AddMirror(ScreenId mainScreenId, ScreenId mirrorScreenId); virtual void Clear(); diff --git a/dm/src/display_manager.cpp b/dm/src/display_manager.cpp index 353d6ddb90..83ea3ff78a 100644 --- a/dm/src/display_manager.cpp +++ b/dm/src/display_manager.cpp @@ -353,7 +353,7 @@ bool DisplayManager::SetDisplayState(DisplayState state, DisplayStateCallback ca return ret; } -DisplayState DisplayManager::GetDisplayState(uint64_t displayId) +DisplayState DisplayManager::GetDisplayState(DisplayId displayId) { return SingletonContainer::Get().GetDisplayState(displayId); } diff --git a/dm/src/display_manager_adapter.cpp b/dm/src/display_manager_adapter.cpp index a42984f3c7..c06f5842b5 100644 --- a/dm/src/display_manager_adapter.cpp +++ b/dm/src/display_manager_adapter.cpp @@ -171,7 +171,7 @@ bool DisplayManagerAdapter::SetDisplayState(DisplayState state) return displayManagerServiceProxy_->SetDisplayState(state); } -DisplayState DisplayManagerAdapter::GetDisplayState(uint64_t displayId) +DisplayState DisplayManagerAdapter::GetDisplayState(DisplayId displayId) { std::lock_guard lock(mutex_); if (!InitDMSProxyLocked()) { diff --git a/dm/test/systemtest/display_power_test.cpp b/dm/test/systemtest/display_power_test.cpp index be5bad70ed..1cae1f6017 100644 --- a/dm/test/systemtest/display_power_test.cpp +++ b/dm/test/systemtest/display_power_test.cpp @@ -70,7 +70,7 @@ sptr DisplayPowerTest::listener_ = new DisplayPowerEv void DisplayPowerTest::SetUpTestCase() { defaultId_ = DisplayManager::GetInstance().GetDefaultDisplayId(); - if (defaultId_ == INVALID_DISPLAY_ID) { + if (defaultId_ == DISPLAY_ID_INVALD) { WLOGFE("GetDefaultDisplayId failed!"); } DisplayManager::GetInstance().RegisterDisplayPowerEventListener(listener_); diff --git a/dmserver/include/abstract_display.h b/dmserver/include/abstract_display.h index 91e543b5cb..13a8f268d6 100644 --- a/dmserver/include/abstract_display.h +++ b/dmserver/include/abstract_display.h @@ -22,8 +22,6 @@ #include "display_info.h" namespace OHOS::Rosen { -using DisplayId = uint64_t; - class AbstractDisplay : public RefBase { public: constexpr static int32_t DEFAULT_WIDTH = 720; diff --git a/dmserver/include/display_manager_interface.h b/dmserver/include/display_manager_interface.h index 743602d6d2..05bfffe5f7 100644 --- a/dmserver/include/display_manager_interface.h +++ b/dmserver/include/display_manager_interface.h @@ -66,7 +66,7 @@ public: virtual bool SuspendEnd() = 0; virtual bool SetScreenPowerForAll(DisplayPowerState state, PowerStateChangeReason reason) = 0; virtual bool SetDisplayState(DisplayState state) = 0; - virtual DisplayState GetDisplayState(uint64_t displayId) = 0; + virtual DisplayState GetDisplayState(DisplayId displayId) = 0; virtual void NotifyDisplayEvent(DisplayEvent event) = 0; virtual DMError AddMirror(ScreenId mainScreenId, ScreenId mirrorScreenId) = 0; }; diff --git a/dmserver/include/display_manager_proxy.h b/dmserver/include/display_manager_proxy.h index a3c33988c1..5604deeb08 100644 --- a/dmserver/include/display_manager_proxy.h +++ b/dmserver/include/display_manager_proxy.h @@ -48,7 +48,7 @@ public: bool SuspendEnd() override; bool SetScreenPowerForAll(DisplayPowerState state, PowerStateChangeReason reason) override; bool SetDisplayState(DisplayState state) override; - DisplayState GetDisplayState(uint64_t displayId) override; + DisplayState GetDisplayState(DisplayId displayId) override; void NotifyDisplayEvent(DisplayEvent event) override; DMError AddMirror(ScreenId mainScreenId, ScreenId mirrorScreenId) override; diff --git a/dmserver/include/display_manager_service.h b/dmserver/include/display_manager_service.h index ca28880fc6..fa1250d9e1 100644 --- a/dmserver/include/display_manager_service.h +++ b/dmserver/include/display_manager_service.h @@ -56,7 +56,7 @@ public: bool SuspendEnd() override; bool SetScreenPowerForAll(DisplayPowerState state, PowerStateChangeReason reason) override; bool SetDisplayState(DisplayState state) override; - DisplayState GetDisplayState(uint64_t displayId) override; + DisplayState GetDisplayState(DisplayId displayId) override; void NotifyDisplayEvent(DisplayEvent event) override; bool NotifyDisplayPowerEvent(DisplayPowerEvent event, EventStatus status); diff --git a/dmserver/include/display_power_controller.h b/dmserver/include/display_power_controller.h index 26830bf7ff..447b77375c 100644 --- a/dmserver/include/display_power_controller.h +++ b/dmserver/include/display_power_controller.h @@ -18,6 +18,7 @@ #include #include +#include "display.h" #include "dm_common.h" namespace OHOS { @@ -29,7 +30,7 @@ public: bool SuspendBegin(PowerStateChangeReason reason); bool SetDisplayState(DisplayState state); - DisplayState GetDisplayState(uint64_t displayId); + DisplayState GetDisplayState(DisplayId displayId); void NotifyDisplayEvent(DisplayEvent event); private: diff --git a/dmserver/src/display_manager_proxy.cpp b/dmserver/src/display_manager_proxy.cpp index be2a7307c5..b5c6746834 100644 --- a/dmserver/src/display_manager_proxy.cpp +++ b/dmserver/src/display_manager_proxy.cpp @@ -67,7 +67,7 @@ DisplayInfo DisplayManagerProxy::GetDisplayInfoById(DisplayId displayId) WLOGFE("GetDisplayInfoById: WriteInterfaceToken failed"); return DisplayInfo(); } - data.WriteUint64(static_cast(displayId)); + data.WriteUint64(displayId); if (remote->SendRequest(TRANS_ID_GET_DISPLAY_BY_ID, data, reply, option) != ERR_NONE) { WLOGFW("GetDisplayInfoById: SendRequest failed"); return DisplayInfo(); @@ -343,7 +343,7 @@ bool DisplayManagerProxy::SetDisplayState(DisplayState state) return reply.ReadBool(); } -DisplayState DisplayManagerProxy::GetDisplayState(uint64_t displayId) +DisplayState DisplayManagerProxy::GetDisplayState(DisplayId displayId) { MessageParcel data; MessageParcel reply; @@ -352,7 +352,7 @@ DisplayState DisplayManagerProxy::GetDisplayState(uint64_t displayId) WLOGFE("WriteInterfaceToken failed"); return DisplayState::UNKNOWN; } - if (!data.WriteUint64(static_cast(displayId))) { + if (!data.WriteUint64(displayId)) { WLOGFE("Write displayId failed"); return DisplayState::UNKNOWN; } diff --git a/dmserver/src/display_manager_service.cpp b/dmserver/src/display_manager_service.cpp index 24e7edec41..4584c8b3a7 100644 --- a/dmserver/src/display_manager_service.cpp +++ b/dmserver/src/display_manager_service.cpp @@ -195,7 +195,7 @@ bool DisplayManagerService::SetDisplayState(DisplayState state) return displayPowerController_.SetDisplayState(state); } -DisplayState DisplayManagerService::GetDisplayState(uint64_t displayId) +DisplayState DisplayManagerService::GetDisplayState(DisplayId displayId) { std::lock_guard lock(mutex_); return displayPowerController_.GetDisplayState(displayId); diff --git a/dmserver/src/display_manager_stub.cpp b/dmserver/src/display_manager_stub.cpp index 927bd23230..537ab45204 100644 --- a/dmserver/src/display_manager_stub.cpp +++ b/dmserver/src/display_manager_stub.cpp @@ -43,7 +43,7 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, break; } case TRANS_ID_GET_DISPLAY_BY_ID: { - DisplayId displayId = static_cast(data.ReadUint64()); + DisplayId displayId = data.ReadUint64(); auto info = GetDisplayInfoById(displayId); reply.WriteParcelable(&info); break; diff --git a/dmserver/src/display_power_controller.cpp b/dmserver/src/display_power_controller.cpp index 74aa0a3f85..23f8976a8d 100644 --- a/dmserver/src/display_power_controller.cpp +++ b/dmserver/src/display_power_controller.cpp @@ -60,7 +60,7 @@ bool DisplayPowerController::SetDisplayState(DisplayState state) return true; } -DisplayState DisplayPowerController::GetDisplayState(uint64_t displayId) +DisplayState DisplayPowerController::GetDisplayState(DisplayId displayId) { return displayState_; } diff --git a/interfaces/innerkits/dm/display.h b/interfaces/innerkits/dm/display.h index c4e09fd78a..2c6b6b38f1 100644 --- a/interfaces/innerkits/dm/display.h +++ b/interfaces/innerkits/dm/display.h @@ -17,7 +17,6 @@ #define FOUNDATION_DM_DISPLAY_H #include - #include namespace OHOS::Rosen { diff --git a/interfaces/innerkits/dm/display_manager.h b/interfaces/innerkits/dm/display_manager.h index 45aaaf1cea..b54c11c989 100644 --- a/interfaces/innerkits/dm/display_manager.h +++ b/interfaces/innerkits/dm/display_manager.h @@ -54,7 +54,7 @@ public: bool SetScreenPowerForAll(DisplayPowerState state, PowerStateChangeReason reason); DisplayPowerState GetScreenPower(uint64_t screenId); bool SetDisplayState(DisplayState state, DisplayStateCallback callback); - DisplayState GetDisplayState(uint64_t displayId); + DisplayState GetDisplayState(DisplayId displayId); bool SetScreenBrightness(uint64_t screenId, uint32_t level); uint32_t GetScreenBrightness(uint64_t screenId) const; void NotifyDisplayEvent(DisplayEvent event); diff --git a/interfaces/innerkits/dm/dm_common.h b/interfaces/innerkits/dm/dm_common.h index d1ae64824e..5deab23538 100644 --- a/interfaces/innerkits/dm/dm_common.h +++ b/interfaces/innerkits/dm/dm_common.h @@ -20,7 +20,6 @@ namespace OHOS { namespace Rosen { -constexpr int32_t INVALID_DISPLAY_ID = -1; enum class PowerStateChangeReason : uint32_t { POWER_BUTTON, }; diff --git a/interfaces/innerkits/wm/window_manager.h b/interfaces/innerkits/wm/window_manager.h index e7581c438c..3b18f803ea 100644 --- a/interfaces/innerkits/wm/window_manager.h +++ b/interfaces/innerkits/wm/window_manager.h @@ -38,15 +38,15 @@ using SystemBarRegionTints = std::vector; class IFocusChangedListener : public RefBase { public: virtual void OnFocused(uint32_t windowId, sptr abilityToken, - WindowType windowType, int32_t displayId) = 0; + WindowType windowType, DisplayId displayId) = 0; virtual void OnUnfocused(uint32_t windowId, sptr abilityToken, - WindowType windowType, int32_t displayId) = 0; + WindowType windowType, DisplayId displayId) = 0; }; class ISystemBarChangedListener : virtual public RefBase { public: - virtual void OnSystemBarPropertyChange(uint64_t displayId, const SystemBarRegionTints& tints) = 0; + virtual void OnSystemBarPropertyChange(DisplayId displayId, const SystemBarRegionTints& tints) = 0; }; class WindowManager { @@ -65,8 +65,8 @@ private: std::unique_ptr pImpl_; void UpdateFocusStatus(uint32_t windowId, const sptr& abilityToken, WindowType windowType, - int32_t displayId, bool focused) const; - void UpdateSystemBarRegionTints(uint64_t displayId, const SystemBarRegionTints& tints) const; + DisplayId displayId, bool focused) const; + void UpdateSystemBarRegionTints(DisplayId displayId, const SystemBarRegionTints& tints) const; }; } // namespace Rosen } // namespace OHOS diff --git a/interfaces/innerkits/wm/window_option.h b/interfaces/innerkits/wm/window_option.h index e2794660ef..afec542fec 100644 --- a/interfaces/innerkits/wm/window_option.h +++ b/interfaces/innerkits/wm/window_option.h @@ -18,6 +18,7 @@ #include #include #include + #include "wm_common.h" namespace OHOS { @@ -32,7 +33,7 @@ public: void SetWindowMode(WindowMode mode); void SetFocusable(bool isFocusable); void SetTouchable(bool isTouchable); - void SetDisplayId(int32_t displayId); + void SetDisplayId(DisplayId displayId); void SetParentName(const std::string& parentName); void SetWindowName(const std::string& windowName); void AddWindowFlag(WindowFlag flag); @@ -45,7 +46,7 @@ public: WindowMode GetWindowMode() const; bool GetFocusable() const; bool GetTouchable() const; - int32_t GetDisplayId() const; + DisplayId GetDisplayId() const; const std::string& GetParentName() const; const std::string& GetWindowName() const; uint32_t GetWindowFlags() const; @@ -56,7 +57,7 @@ private: WindowMode mode_ { WindowMode::WINDOW_MODE_FULLSCREEN }; bool focusable_ { true }; bool touchable_ { true }; - int32_t displayId_ { 0 }; + DisplayId displayId_ { 0 }; std::string parentName_ { "" }; std::string windowName_ { "" }; uint32_t flags_ { 0 }; diff --git a/interfaces/innerkits/wm/window_scene.h b/interfaces/innerkits/wm/window_scene.h index 30eac7456f..8ce65effb9 100644 --- a/interfaces/innerkits/wm/window_scene.h +++ b/interfaces/innerkits/wm/window_scene.h @@ -30,13 +30,13 @@ namespace OHOS { namespace Rosen { class WindowScene : public RefBase { public: - static const int32_t DEFAULT_DISPLAY_ID = 0; + static const DisplayId DEFAULT_DISPLAY_ID = 0; static const std::string MAIN_WINDOW_ID; WindowScene() = default; ~WindowScene(); - WMError Init(int32_t displayId, const std::shared_ptr& context, + WMError Init(DisplayId displayId, const std::shared_ptr& context, sptr& listener, sptr option = nullptr); sptr CreateWindow(const std::string& windowName, sptr& option) const; @@ -55,7 +55,7 @@ public: private: static inline std::atomic count { 0 }; sptr mainWindow_ = nullptr; - int32_t displayId_ = DEFAULT_DISPLAY_ID; + DisplayId displayId_ = DEFAULT_DISPLAY_ID; std::shared_ptr context_ = nullptr; }; diff --git a/interfaces/innerkits/wm/wm_common.h b/interfaces/innerkits/wm/wm_common.h index 9b5c82d6de..1ad09daade 100644 --- a/interfaces/innerkits/wm/wm_common.h +++ b/interfaces/innerkits/wm/wm_common.h @@ -18,6 +18,7 @@ namespace OHOS { namespace Rosen { +using DisplayId = uint64_t; enum class WindowType : uint32_t { APP_WINDOW_BASE = 1, APP_MAIN_WINDOW_BASE = APP_WINDOW_BASE, diff --git a/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.cpp b/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.cpp index 6c17bb424d..8a63899fca 100644 --- a/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.cpp +++ b/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.cpp @@ -96,7 +96,7 @@ void JsWindowListener::OnSizeChange(Rect rect) CallJsMethod("windowSizeChange", argv, ArraySize(argv)); } -void JsWindowListener::OnSystemBarPropertyChange(uint64_t displayId, const SystemBarRegionTints& tints) +void JsWindowListener::OnSystemBarPropertyChange(DisplayId displayId, const SystemBarRegionTints& tints) { std::lock_guard lock(mtx_); WLOGFI("JsWindowListener::OnSystemBarPropertyChange is called"); diff --git a/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.h b/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.h index 5bff0c025e..cfe4334862 100644 --- a/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.h +++ b/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.h @@ -37,7 +37,7 @@ public: void AddCallback(NativeValue* jsListenerObject); void RemoveAllCallback(); void RemoveCallback(NativeValue* jsListenerObject); - void OnSystemBarPropertyChange(uint64_t displayId, const SystemBarRegionTints& tints) override; + void OnSystemBarPropertyChange(DisplayId displayId, const SystemBarRegionTints& tints) override; void OnSizeChange(Rect rect) override; void OnAvoidAreaChanged(std::vector avoidAreas) override; diff --git a/utils/include/window_property.h b/utils/include/window_property.h index 11c9e0e851..ee53f21603 100644 --- a/utils/include/window_property.h +++ b/utils/include/window_property.h @@ -39,7 +39,7 @@ public: void SetPrivacyMode(bool isPrivate); void SetTransparent(bool isTransparent); void SetAlpha(float alpha); - void SetDisplayId(int32_t displayId); + void SetDisplayId(DisplayId displayId); void SetWindowId(uint32_t windowId); void SetParentId(uint32_t parentId); void SetWindowFlags(uint32_t flags); @@ -55,7 +55,7 @@ public: bool GetPrivacyMode() const; bool GetTransparent() const; float GetAlpha() const; - int32_t GetDisplayId() const; + DisplayId GetDisplayId() const; uint32_t GetWindowId() const; uint32_t GetParentId() const; uint32_t GetWindowFlags() const; @@ -76,7 +76,7 @@ private: bool isPrivacyMode_ { false }; bool isTransparent_ { false }; float alpha_ { 1.0f }; - int32_t displayId_ { 0 }; + DisplayId displayId_ { 0 }; uint32_t windowId_ { 0 }; uint32_t parentId_ { 0 }; std::unordered_map sysBarPropMap_ { diff --git a/utils/src/window_property.cpp b/utils/src/window_property.cpp index c112ffa753..52c29cf68f 100644 --- a/utils/src/window_property.cpp +++ b/utils/src/window_property.cpp @@ -69,7 +69,7 @@ void WindowProperty::SetAlpha(float alpha) alpha_ = alpha; } -void WindowProperty::SetDisplayId(int32_t displayId) +void WindowProperty::SetDisplayId(DisplayId displayId) { displayId_ = displayId; } @@ -141,7 +141,7 @@ float WindowProperty::GetAlpha() const return alpha_; } -int32_t WindowProperty::GetDisplayId() const +DisplayId WindowProperty::GetDisplayId() const { return displayId_; } @@ -264,7 +264,7 @@ bool WindowProperty::Marshalling(Parcel& parcel) const } // write displayId_ - if (!parcel.WriteInt32(displayId_)) { + if (!parcel.WriteUint64(displayId_)) { return false; } @@ -304,7 +304,7 @@ sptr WindowProperty::Unmarshalling(Parcel& parcel) property->SetPrivacyMode(parcel.ReadBool()); property->SetTransparent(parcel.ReadBool()); property->SetAlpha(parcel.ReadFloat()); - property->SetDisplayId(parcel.ReadInt32()); + property->SetDisplayId(parcel.ReadUint64()); property->SetWindowId(parcel.ReadUint32()); property->SetParentId(parcel.ReadUint32()); MapUnmarshalling(parcel, property); diff --git a/wm/include/window_manager_agent.h b/wm/include/window_manager_agent.h index 6d730c48f2..e15be1368c 100644 --- a/wm/include/window_manager_agent.h +++ b/wm/include/window_manager_agent.h @@ -26,8 +26,8 @@ public: ~WindowManagerAgent() = default; void UpdateFocusStatus(uint32_t windowId, const sptr& abilityToken, WindowType windowType, - int32_t displayId, bool focused) override; - void UpdateSystemBarRegionTints(uint64_t displayId, const SystemBarRegionTints& props) override; + DisplayId displayId, bool focused) override; + void UpdateSystemBarRegionTints(DisplayId displayId, const SystemBarRegionTints& props) override; }; } // namespace Rosen } // namespace OHOS diff --git a/wm/include/zidl/window_manager_agent_interface.h b/wm/include/zidl/window_manager_agent_interface.h index 81d7640655..8af87ee308 100644 --- a/wm/include/zidl/window_manager_agent_interface.h +++ b/wm/include/zidl/window_manager_agent_interface.h @@ -37,8 +37,8 @@ public: }; virtual void UpdateFocusStatus(uint32_t windowId, const sptr& abilityToken, WindowType windowType, - int32_t displayId, bool focused) = 0; - virtual void UpdateSystemBarRegionTints(uint64_t displayId, const SystemBarRegionTints& tints) = 0; + DisplayId displayId, bool focused) = 0; + virtual void UpdateSystemBarRegionTints(DisplayId displayId, const SystemBarRegionTints& tints) = 0; }; } // namespace Rosen } // namespace OHOS diff --git a/wm/include/zidl/window_manager_agent_proxy.h b/wm/include/zidl/window_manager_agent_proxy.h index f0857f2e87..bdcd902bcc 100644 --- a/wm/include/zidl/window_manager_agent_proxy.h +++ b/wm/include/zidl/window_manager_agent_proxy.h @@ -28,8 +28,8 @@ public: ~WindowManagerAgentProxy() {}; void UpdateFocusStatus(uint32_t windowId, const sptr& abilityToken, WindowType windowType, - int32_t displayId, bool focused) override; - void UpdateSystemBarRegionTints(uint64_t displayId, const SystemBarRegionTints& tints) override; + DisplayId displayId, bool focused) override; + void UpdateSystemBarRegionTints(DisplayId displayId, const SystemBarRegionTints& tints) override; private: static inline BrokerDelegator delegator_; diff --git a/wm/src/window_impl.cpp b/wm/src/window_impl.cpp index 84a572e53d..bfea787a56 100644 --- a/wm/src/window_impl.cpp +++ b/wm/src/window_impl.cpp @@ -613,7 +613,7 @@ void WindowImpl::UpdateRect(const struct Rect& rect) { auto display = DisplayManager::GetInstance().GetDisplayById(property_->GetDisplayId()); if (display == nullptr) { - WLOGFE("get display failed displayId:%{public}d, window id:%{public}u", property_->GetDisplayId(), + WLOGFE("get display failed displayId:%{public}" PRIu64", window id:%{public}u", property_->GetDisplayId(), property_->GetWindowId()); return; } @@ -765,13 +765,14 @@ void WindowImpl::SetDefaultOption() { auto display = DisplayManager::GetInstance().GetDisplayById(property_->GetDisplayId()); if (display == nullptr) { - WLOGFE("get display failed displayId:%{public}d, window id:%{public}u", property_->GetDisplayId(), + WLOGFE("get display failed displayId:%{public}" PRIu64", window id:%{public}u", property_->GetDisplayId(), property_->GetWindowId()); return; } uint32_t width = display->GetWidth(); uint32_t height = display->GetHeight(); - WLOGFI("width:%{public}u, height:%{public}u, displayId:%{public}d", width, height, property_->GetDisplayId()); + WLOGFI("width:%{public}u, height:%{public}u, displayId:%{public}" PRIu64"", + width, height, property_->GetDisplayId()); Rect rect; switch (property_->GetWindowType()) { diff --git a/wm/src/window_manager.cpp b/wm/src/window_manager.cpp index 0e9e208588..3404676b68 100644 --- a/wm/src/window_manager.cpp +++ b/wm/src/window_manager.cpp @@ -15,6 +15,7 @@ #include "foundation/windowmanager/interfaces/innerkits/wm/window_manager.h" #include +#include #include "window_adapter.h" #include "window_manager_agent.h" @@ -30,10 +31,10 @@ WM_IMPLEMENT_SINGLE_INSTANCE(WindowManager) class WindowManager::Impl { public: void NotifyFocused(uint32_t windowId, const sptr& abilityToken, - WindowType windowType, int32_t displayId) const; + WindowType windowType, DisplayId displayId) const; void NotifyUnfocused(uint32_t windowId, const sptr& abilityToken, - WindowType windowType, int32_t displayId) const; - void NotifySystemBarChanged(uint64_t displayId, const SystemBarRegionTints& tints) const; + WindowType windowType, DisplayId displayId) const; + void NotifySystemBarChanged(DisplayId displayId, const SystemBarRegionTints& tints) const; static inline SingletonDelegator delegator_; std::recursive_mutex mutex_; @@ -44,9 +45,9 @@ public: }; void WindowManager::Impl::NotifyFocused(uint32_t windowId, const sptr& abilityToken, - WindowType windowType, int32_t displayId) const + WindowType windowType, DisplayId displayId) const { - WLOGFI("NotifyFocused [%{public}d; %{public}p; %{public}d; %{public}d]", windowId, abilityToken.GetRefPtr(), + WLOGFI("NotifyFocused [%{public}d; %{public}p; %{public}d; %{public}" PRIu64"]", windowId, abilityToken.GetRefPtr(), static_cast(windowType), displayId); for (auto& listener : focusChangedListeners_) { listener->OnFocused(windowId, abilityToken, windowType, displayId); @@ -54,16 +55,16 @@ void WindowManager::Impl::NotifyFocused(uint32_t windowId, const sptr& abilityToken, - WindowType windowType, int32_t displayId) const + WindowType windowType, DisplayId displayId) const { - WLOGFI("NotifyUnfocused [%{public}d; %{public}p; %{public}d; %{public}d]", windowId, abilityToken.GetRefPtr(), - static_cast(windowType), displayId); + WLOGFI("NotifyUnfocused [%{public}d; %{public}p; %{public}d; %{public}" PRIu64"]", windowId, + abilityToken.GetRefPtr(), static_cast(windowType), displayId); for (auto& listener : focusChangedListeners_) { listener->OnUnfocused(windowId, abilityToken, windowType, displayId); } } -void WindowManager::Impl::NotifySystemBarChanged(uint64_t displayId, const SystemBarRegionTints& tints) const +void WindowManager::Impl::NotifySystemBarChanged(DisplayId displayId, const SystemBarRegionTints& tints) const { for (auto tint : tints) { WLOGFI("type:%{public}d, enable:%{public}d," \ @@ -161,7 +162,7 @@ void WindowManager::UnregisterSystemBarChangedListener(const sptr& abilityToken, WindowType windowType, - int32_t displayId, bool focused) const + DisplayId displayId, bool focused) const { WLOGFI("window focus status: %{public}d, id: %{public}d", focused, windowId); if (focused) { @@ -171,7 +172,7 @@ void WindowManager::UpdateFocusStatus(uint32_t windowId, const sptrNotifySystemBarChanged(displayId, tints); diff --git a/wm/src/window_manager_agent.cpp b/wm/src/window_manager_agent.cpp index c6be41fd44..7c052051d3 100644 --- a/wm/src/window_manager_agent.cpp +++ b/wm/src/window_manager_agent.cpp @@ -20,12 +20,12 @@ namespace OHOS { namespace Rosen { void WindowManagerAgent::UpdateFocusStatus(uint32_t windowId, const sptr& abilityToken, - WindowType windowType, int32_t displayId, bool focused) + WindowType windowType, DisplayId displayId, bool focused) { SingletonContainer::Get().UpdateFocusStatus(windowId, abilityToken, windowType, displayId, focused); } -void WindowManagerAgent::UpdateSystemBarRegionTints(uint64_t displayId, const SystemBarRegionTints& tints) +void WindowManagerAgent::UpdateSystemBarRegionTints(DisplayId displayId, const SystemBarRegionTints& tints) { SingletonContainer::Get().UpdateSystemBarRegionTints(displayId, tints); } diff --git a/wm/src/window_option.cpp b/wm/src/window_option.cpp index 46e71ea3ae..f506256905 100644 --- a/wm/src/window_option.cpp +++ b/wm/src/window_option.cpp @@ -51,7 +51,7 @@ void WindowOption::SetTouchable(bool isTouchable) touchable_ = isTouchable; } -void WindowOption::SetDisplayId(int32_t displayId) +void WindowOption::SetDisplayId(DisplayId displayId) { displayId_ = displayId; } @@ -113,7 +113,7 @@ bool WindowOption::GetTouchable() const return touchable_; } -int32_t WindowOption::GetDisplayId() const +DisplayId WindowOption::GetDisplayId() const { return displayId_; } diff --git a/wm/src/window_scene.cpp b/wm/src/window_scene.cpp index 01b3f6ccfa..4500f30d55 100644 --- a/wm/src/window_scene.cpp +++ b/wm/src/window_scene.cpp @@ -37,7 +37,7 @@ WindowScene::~WindowScene() } } -WMError WindowScene::Init(int32_t displayId, const std::shared_ptr& context, +WMError WindowScene::Init(DisplayId displayId, const std::shared_ptr& context, sptr& listener, sptr option) { displayId_ = displayId; diff --git a/wm/src/zidl/window_manager_agent_proxy.cpp b/wm/src/zidl/window_manager_agent_proxy.cpp index 198d26f2bb..0bf54bbdea 100644 --- a/wm/src/zidl/window_manager_agent_proxy.cpp +++ b/wm/src/zidl/window_manager_agent_proxy.cpp @@ -24,7 +24,7 @@ namespace { } void WindowManagerAgentProxy::UpdateFocusStatus(uint32_t windowId, const sptr& abilityToken, - WindowType windowType, int32_t displayId, bool focused) + WindowType windowType, DisplayId displayId, bool focused) { MessageParcel data; MessageParcel reply; @@ -48,7 +48,7 @@ void WindowManagerAgentProxy::UpdateFocusStatus(uint32_t windowId, const sptr abilityToken = data.ReadRemoteObject(); WindowType windowType = static_cast(data.ReadUint32()); - int32_t displayId = data.ReadInt32(); + DisplayId displayId = data.ReadUint64(); bool focused = data.ReadBool(); UpdateFocusStatus(windowId, abilityToken, windowType, displayId, focused); break; } case TRANS_ID_UPDATE_SYSTEM_BAR_PROPS: { - uint64_t displayId = data.ReadUint64(); + DisplayId displayId = data.ReadUint64(); SystemBarRegionTints tints; uint32_t size = data.ReadUint32(); for (uint32_t i = 0; i < size; i++) { diff --git a/wm/test/systemtest/window_immersive_test.cpp b/wm/test/systemtest/window_immersive_test.cpp index e119f43bab..8a1b6fc83c 100644 --- a/wm/test/systemtest/window_immersive_test.cpp +++ b/wm/test/systemtest/window_immersive_test.cpp @@ -60,7 +60,7 @@ const int WAIT_ASYNC_US = 100000; // 100000us class TestSystemBarChangedListener : public ISystemBarChangedListener { public: SystemBarRegionTints tints_; - void OnSystemBarPropertyChange(uint64_t displayId, const SystemBarRegionTints& tints) override; + void OnSystemBarPropertyChange(DisplayId displayId, const SystemBarRegionTints& tints) override; }; class TestAvoidAreaChangedListener : public IAvoidAreaChangedListener { @@ -78,7 +78,7 @@ public: void SetWindowSystemProps(const sptr& window, const SystemBarRegionTints& props); bool SystemBarPropsEqualsTo(const SystemBarRegionTints& expect); void DumpFailedInfo(const SystemBarRegionTints& expect); - int displayId_ = 0; + DisplayId displayId_ = 0; std::vector> activeWindows_; static vector fullScreenExpecteds_; static sptr testSystemBarChangedListener_; @@ -146,7 +146,7 @@ bool WindowImmersiveTest::SystemBarPropsEqualsTo(const SystemBarRegionTints& exp return true; } -void TestSystemBarChangedListener::OnSystemBarPropertyChange(uint64_t displayId, const SystemBarRegionTints& tints) +void TestSystemBarChangedListener::OnSystemBarPropertyChange(DisplayId displayId, const SystemBarRegionTints& tints) { WLOGFI("TestSystemBarChangedListener Display ID: %{public}" PRIu64"", displayId); tints_ = tints; diff --git a/wm/test/systemtest/window_layout_test.cpp b/wm/test/systemtest/window_layout_test.cpp index c8575ba37a..cec9eaf77a 100644 --- a/wm/test/systemtest/window_layout_test.cpp +++ b/wm/test/systemtest/window_layout_test.cpp @@ -28,7 +28,7 @@ public: static void TearDownTestCase(); virtual void SetUp() override; virtual void TearDown() override; - int displayId_ = 0; + DisplayId displayId_ = 0; std::vector> activeWindows_; static vector fullScreenExpecteds_; }; diff --git a/wm/test/unittest/window_scene_test.cpp b/wm/test/unittest/window_scene_test.cpp index b00ed6f9f3..549858ee08 100644 --- a/wm/test/unittest/window_scene_test.cpp +++ b/wm/test/unittest/window_scene_test.cpp @@ -26,7 +26,7 @@ namespace Rosen { using Mocker = SingletonMocker; void WindowSceneTest::SetUpTestCase() { - int displayId = 0; + DisplayId displayId = 0; sptr listener = nullptr; scene_ = new WindowScene(); abilityContext_ = std::make_shared(); @@ -60,7 +60,7 @@ HWTEST_F(WindowSceneTest, Init01, Function | SmallTest | Level2) std::unique_ptr m = std::make_unique(); sptr optionTest = new WindowOption(); EXPECT_CALL(m->Mock(), CreateWindow(_, _, _)).Times(1).WillOnce(Return(new WindowImpl(optionTest))); - int displayId = 0; + DisplayId displayId = 0; sptr listener = nullptr; sptr scene = new WindowScene(); std::shared_ptr abilityContext = nullptr; @@ -78,7 +78,7 @@ HWTEST_F(WindowSceneTest, Init02, Function | SmallTest | Level2) std::unique_ptr m = std::make_unique(); sptr optionTest = new WindowOption(); EXPECT_CALL(m->Mock(), CreateWindow(_, _, _)).Times(1).WillOnce(Return(nullptr)); - int displayId = 0; + DisplayId displayId = 0; sptr listener = nullptr; sptr scene = new WindowScene(); std::shared_ptr abilityContext = nullptr; @@ -96,7 +96,7 @@ HWTEST_F(WindowSceneTest, Init03, Function | SmallTest | Level2) std::unique_ptr m = std::make_unique(); sptr optionTest = new WindowOption(); EXPECT_CALL(m->Mock(), CreateWindow(_, _, _)).Times(1).WillOnce(Return(new WindowImpl(optionTest))); - int displayId = 0; + DisplayId displayId = 0; sptr listener = nullptr; sptr scene = new WindowScene(); ASSERT_EQ(WMError::WM_OK, scene->Init(displayId, abilityContext_, listener)); diff --git a/wmserver/include/input_window_monitor.h b/wmserver/include/input_window_monitor.h index 2f6ca7ed2a..606ebd65b9 100644 --- a/wmserver/include/input_window_monitor.h +++ b/wmserver/include/input_window_monitor.h @@ -21,6 +21,7 @@ #include #include "window_root.h" +#include "wm_common.h" namespace OHOS { namespace Rosen { @@ -29,14 +30,13 @@ public: InputWindowMonitor(sptr& root) : windowRoot_(root) {} ~InputWindowMonitor() = default; void UpdateInputWindow(uint32_t windowId); - void UpdateInputWindowByDisplayId(int32_t displayId); + void UpdateInputWindowByDisplayId(DisplayId displayId); private: sptr windowRoot_; std::vector physicalDisplays_; std::vector logicalDisplays_; std::unordered_set windowTypeSkipped_ { WindowType::WINDOW_TYPE_POINTER }; - const int INVALID_DISPLAY_ID = -1; const int INVALID_WINDOW_ID = -1; void TraverseWindowNodes(const std::vector>& windowNodes, std::vector::iterator& iter); diff --git a/wmserver/include/window_inner_manager.h b/wmserver/include/window_inner_manager.h index 4dc139842a..663c695ef5 100644 --- a/wmserver/include/window_inner_manager.h +++ b/wmserver/include/window_inner_manager.h @@ -39,7 +39,7 @@ enum InnerWMCmd : uint32_t { struct WindowMessage { InnerWMCmd cmdType; - uint32_t displayId; + DisplayId displayId; Rect dividerRect; }; @@ -47,18 +47,18 @@ class WindowInnerManager { WM_DECLARE_SINGLE_INSTANCE(WindowInnerManager); public: void Init(); - void SendMessage(InnerWMCmd cmdType, uint32_t displayId = 0); - void SendMessage(InnerWMCmd cmdType, uint32_t displayId, const Rect& rect); + void SendMessage(InnerWMCmd cmdType, DisplayId displayId = 0); + void SendMessage(InnerWMCmd cmdType, DisplayId displayId, const Rect& rect); void HandleMessage(); private: static inline SingletonDelegator delegator; - sptr CreateWindow(uint32_t displayId, const WindowType& type, const Rect& rect); + sptr CreateWindow(DisplayId displayId, const WindowType& type, const Rect& rect); void CreateAndShowDivider(std::unique_ptr msg); void HideAndDestroyDivider(std::unique_ptr msg); void DestroyThread(std::unique_ptr msg); void DrawSurface(const sptr& window, uint32_t color); - sptr GetDividerWindow(uint32_t displayId) const; + sptr GetDividerWindow(DisplayId displayId) const; std::mutex mutex_; std::condition_variable conVar_; diff --git a/wmserver/include/window_manager_agent_controller.h b/wmserver/include/window_manager_agent_controller.h index 5ad0811864..5515231057 100644 --- a/wmserver/include/window_manager_agent_controller.h +++ b/wmserver/include/window_manager_agent_controller.h @@ -32,8 +32,8 @@ public: WindowManagerAgentType type); void UpdateFocusStatus(uint32_t windowId, const sptr& abilityToken, WindowType windowType, - int32_t displayId, bool focused); - void UpdateSystemBarRegionTints(uint64_t displayId, const SystemBarRegionTints& tints); + DisplayId displayId, bool focused); + void UpdateSystemBarRegionTints(DisplayId displayId, const SystemBarRegionTints& tints); private: WindowManagerAgentController() : wmAgentContainer_(mutex_) {} diff --git a/wmserver/include/window_manager_service.h b/wmserver/include/window_manager_service.h index 1a3b46ac58..8bb22ece30 100644 --- a/wmserver/include/window_manager_service.h +++ b/wmserver/include/window_manager_service.h @@ -57,7 +57,7 @@ public: std::vector GetAvoidAreaByType(uint32_t windowId, AvoidAreaType avoidAreaType) override; WMError MinimizeAllAppNodeAbility(uint32_t windowId) override; - std::shared_ptr GetDisplayNode(int32_t displayId) const; + std::shared_ptr GetDisplayNode(DisplayId displayId) const; void RegisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent) override; void UnregisterWindowManagerAgent(WindowManagerAgentType type, diff --git a/wmserver/include/window_node.h b/wmserver/include/window_node.h index e7f18bbb88..b3a2cced0b 100644 --- a/wmserver/include/window_node.h +++ b/wmserver/include/window_node.h @@ -40,7 +40,7 @@ public: } ~WindowNode() = default; - void SetDisplayId(int32_t displayId); + void SetDisplayId(DisplayId displayId); void SetLayoutRect(const Rect& rect); void SetWindowRect(const Rect& rect); void SetWindowProperty(const sptr& property); @@ -49,7 +49,7 @@ public: const sptr& GetWindowToken() const; uint32_t GetWindowId() const; - int32_t GetDisplayId() const; + DisplayId GetDisplayId() const; const Rect& GetLayoutRect() const; WindowType GetWindowType() const; WindowMode GetWindowMode() const; diff --git a/wmserver/include/window_root.h b/wmserver/include/window_root.h index dd261feb32..e1dbe72b99 100644 --- a/wmserver/include/window_root.h +++ b/wmserver/include/window_root.h @@ -36,8 +36,8 @@ public: WindowRoot(std::recursive_mutex& mutex, Callback callback) : mutex_(mutex), callback_(callback) {} ~WindowRoot() = default; - sptr GetOrCreateWindowNodeContainer(int32_t displayId); - void NotifyDisplayRemoved(int32_t displayId); + sptr GetOrCreateWindowNodeContainer(DisplayId displayId); + void NotifyDisplayRemoved(DisplayId displayId); sptr GetWindowNode(uint32_t windowId) const; WMError SaveWindow(const sptr& node); diff --git a/wmserver/src/input_window_monitor.cpp b/wmserver/src/input_window_monitor.cpp index 64847cf3e1..9fa6c98663 100644 --- a/wmserver/src/input_window_monitor.cpp +++ b/wmserver/src/input_window_monitor.cpp @@ -42,13 +42,13 @@ void InputWindowMonitor::UpdateInputWindow(uint32_t windowId) if (windowTypeSkipped_.find(windowNode->GetWindowProperty()->GetWindowType()) != windowTypeSkipped_.end()) { return; } - int32_t displayId = windowNode->GetDisplayId(); + DisplayId displayId = windowNode->GetDisplayId(); UpdateInputWindowByDisplayId(displayId); } -void InputWindowMonitor::UpdateInputWindowByDisplayId(int32_t displayId) +void InputWindowMonitor::UpdateInputWindowByDisplayId(DisplayId displayId) { - if (displayId == INVALID_DISPLAY_ID) { + if (displayId == DISPLAY_ID_INVALD) { return; } auto container = windowRoot_->GetOrCreateWindowNodeContainer(displayId); @@ -61,7 +61,7 @@ void InputWindowMonitor::UpdateInputWindowByDisplayId(int32_t displayId) container->TraverseContainer(windowNodes); auto iter = std::find_if(logicalDisplays_.begin(), logicalDisplays_.end(), [displayId](MMI::LogicalDisplayInfo& logicalDisplay) { - return logicalDisplay.id == displayId; + return logicalDisplay.id == static_cast(displayId); }); if (iter != logicalDisplays_.end()) { TraverseWindowNodes(windowNodes, iter); @@ -80,8 +80,8 @@ void InputWindowMonitor::UpdateDisplaysInfo(const sptr& con { MMI::PhysicalDisplayInfo physicalDisplayInfo = { .id = static_cast(container->GetScreenId()), - .leftDisplayId = INVALID_DISPLAY_ID, - .upDisplayId = INVALID_DISPLAY_ID, + .leftDisplayId = static_cast(DISPLAY_ID_INVALD), + .upDisplayId = static_cast(DISPLAY_ID_INVALD), .topLeftX = container->GetDisplayRect().posX_, .topLeftY = container->GetDisplayRect().posY_, .width = static_cast(container->GetDisplayRect().width_), @@ -144,7 +144,7 @@ void InputWindowMonitor::TraverseWindowNodes(const std::vector> .topLeftY = windowNode->GetLayoutRect().posY_, .width = static_cast(windowNode->GetLayoutRect().width_), .height = static_cast(windowNode->GetLayoutRect().height_), - .displayId = windowNode->GetDisplayId(), + .displayId = static_cast(windowNode->GetDisplayId()), .agentWindowId = static_cast(windowNode->GetWindowId()), }; if (windowNode->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { diff --git a/wmserver/src/window_inner_manager.cpp b/wmserver/src/window_inner_manager.cpp index 591db98496..3b5b14b43d 100644 --- a/wmserver/src/window_inner_manager.cpp +++ b/wmserver/src/window_inner_manager.cpp @@ -15,6 +15,8 @@ #include "window_inner_manager.h" +#include + #include "include/core/SkCanvas.h" #include "include/core/SkImageInfo.h" #include "transaction/rs_transaction.h" @@ -80,7 +82,7 @@ void WindowInnerManager::DrawSurface(const sptr& window, uint32_t color) } -sptr WindowInnerManager::GetDividerWindow(uint32_t displayId) const +sptr WindowInnerManager::GetDividerWindow(DisplayId displayId) const { auto iter = dividerMap_.find(displayId); if (iter == dividerMap_.end()) { @@ -89,7 +91,7 @@ sptr WindowInnerManager::GetDividerWindow(uint32_t displayId) const return iter->second; } -sptr WindowInnerManager::CreateWindow(uint32_t displayId, const WindowType& type, const Rect& rect) +sptr WindowInnerManager::CreateWindow(DisplayId displayId, const WindowType& type, const Rect& rect) { sptr window = GetDividerWindow(displayId); if (window == nullptr) { @@ -197,7 +199,7 @@ void WindowInnerManager::HandleMessage() } } -void WindowInnerManager::SendMessage(InnerWMCmd cmdType, uint32_t displayId) +void WindowInnerManager::SendMessage(InnerWMCmd cmdType, DisplayId displayId) { std::unique_lock lk(mutex_); if (!hasInitThread_) { @@ -207,14 +209,14 @@ void WindowInnerManager::SendMessage(InnerWMCmd cmdType, uint32_t displayId) std::unique_ptr winMsg = std::make_unique(); winMsg->cmdType = cmdType; winMsg->displayId = displayId; - WLOGFI("SendMessage : displayId = %{public}d, type = %{public}d", + WLOGFI("SendMessage : displayId = %{public}" PRIu64", type = %{public}d", winMsg->displayId, static_cast(cmdType)); messages_.push_back(std::move(winMsg)); ready_ = true; conVar_.notify_one(); } -void WindowInnerManager::SendMessage(InnerWMCmd cmdType, uint32_t displayId, const Rect& dividerRect) +void WindowInnerManager::SendMessage(InnerWMCmd cmdType, DisplayId displayId, const Rect& dividerRect) { std::unique_lock lk(mutex_); if (!hasInitThread_) { @@ -225,7 +227,7 @@ void WindowInnerManager::SendMessage(InnerWMCmd cmdType, uint32_t displayId, con winMsg->cmdType = cmdType; winMsg->displayId = displayId; winMsg->dividerRect = dividerRect; - WLOGFI("SendMessage : displayId = %{public}d, type = %{public}d" \ + WLOGFI("SendMessage : displayId = %{public}" PRIu64", type = %{public}d" \ " Rect = [%{public}d %{public}d %{public}d %{public}d]", winMsg->displayId, static_cast(cmdType), winMsg->dividerRect.posX_, winMsg->dividerRect.posY_, diff --git a/wmserver/src/window_manager_agent_controller.cpp b/wmserver/src/window_manager_agent_controller.cpp index 9fbfd53b74..2af3251039 100644 --- a/wmserver/src/window_manager_agent_controller.cpp +++ b/wmserver/src/window_manager_agent_controller.cpp @@ -38,7 +38,7 @@ void WindowManagerAgentController::UnregisterWindowManagerAgent(const sptr& abilityToken, - WindowType windowType, int32_t displayId, bool focused) + WindowType windowType, DisplayId displayId, bool focused) { std::lock_guard lock(mutex_); WLOGFI("UpdateFocusStatus"); @@ -47,7 +47,7 @@ void WindowManagerAgentController::UpdateFocusStatus(uint32_t windowId, const sp } } -void WindowManagerAgentController::UpdateSystemBarRegionTints(uint64_t displayId, const SystemBarRegionTints& tints) +void WindowManagerAgentController::UpdateSystemBarRegionTints(DisplayId displayId, const SystemBarRegionTints& tints) { if (tints.empty()) { return; diff --git a/wmserver/src/window_manager_service.cpp b/wmserver/src/window_manager_service.cpp index 2334f6958e..a7e872d7ea 100644 --- a/wmserver/src/window_manager_service.cpp +++ b/wmserver/src/window_manager_service.cpp @@ -156,7 +156,7 @@ WMError WindowManagerService::DestroyWindow(uint32_t windowId) WLOGFI("[WMS] Destroy: %{public}d", windowId); WM_SCOPED_TRACE("wms:DestroyWindow(%d)", windowId); std::lock_guard lock(mutex_); - int32_t displayId = INVALID_DISPLAY_ID; + DisplayId displayId = DISPLAY_ID_INVALD; auto node = windowRoot_->GetWindowNode(windowId); if (node != nullptr) { displayId = node->GetDisplayId(); @@ -268,7 +268,7 @@ void WindowManagerService::UnregisterWindowManagerAgent(WindowManagerAgentType t WindowManagerAgentController::GetInstance().UnregisterWindowManagerAgent(windowManagerAgent, type); } -std::shared_ptr WindowManagerService::GetDisplayNode(int32_t displayId) const +std::shared_ptr WindowManagerService::GetDisplayNode(DisplayId displayId) const { return windowRoot_->GetOrCreateWindowNodeContainer(displayId)->GetDisplayNode(); } diff --git a/wmserver/src/window_node.cpp b/wmserver/src/window_node.cpp index 4c4f891688..c9e3e6ffee 100644 --- a/wmserver/src/window_node.cpp +++ b/wmserver/src/window_node.cpp @@ -18,7 +18,7 @@ namespace OHOS { namespace Rosen { -void WindowNode::SetDisplayId(int32_t displayId) +void WindowNode::SetDisplayId(DisplayId displayId) { property_->SetDisplayId(displayId); } @@ -53,7 +53,7 @@ const sptr& WindowNode::GetWindowToken() const return windowToken_; } -int32_t WindowNode::GetDisplayId() const +DisplayId WindowNode::GetDisplayId() const { return property_->GetDisplayId(); } diff --git a/wmserver/src/window_root.cpp b/wmserver/src/window_root.cpp index 6bfa3aef5b..5058279a67 100644 --- a/wmserver/src/window_root.cpp +++ b/wmserver/src/window_root.cpp @@ -25,7 +25,7 @@ namespace Rosen { namespace { constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, 0, "WindowRoot"}; } -sptr WindowRoot::GetOrCreateWindowNodeContainer(int32_t displayId) +sptr WindowRoot::GetOrCreateWindowNodeContainer(DisplayId displayId) { auto iter = windowNodeContainerMap_.find(displayId); if (iter != windowNodeContainerMap_.end()) { @@ -33,12 +33,12 @@ sptr WindowRoot::GetOrCreateWindowNodeContainer(int32_t dis } const sptr abstractDisplay = DisplayManagerServiceInner::GetInstance().GetDisplayById(displayId); if (abstractDisplay == nullptr) { - WLOGFE("get display failed displayId:%{public}d", displayId); + WLOGFE("get display failed displayId:%{public}" PRId64 "", displayId); return nullptr; } if (!CheckDisplayInfo(abstractDisplay)) { - WLOGFE("get display invailed infp:%{public}d", displayId); + WLOGFE("get display invailed infp:%{public}" PRId64 "", displayId); return nullptr; } @@ -63,7 +63,7 @@ bool WindowRoot::CheckDisplayInfo(const sptr& display) return true; } -void WindowRoot::NotifyDisplayRemoved(int32_t displayId) +void WindowRoot::NotifyDisplayRemoved(DisplayId displayId) { auto container = GetOrCreateWindowNodeContainer(displayId); if (container == nullptr) { diff --git a/wmtest/test/wm_native_test.cpp b/wmtest/test/wm_native_test.cpp index ab0e13686d..f5749e9757 100644 --- a/wmtest/test/wm_native_test.cpp +++ b/wmtest/test/wm_native_test.cpp @@ -56,7 +56,7 @@ uint32_t WMNativeTest::GetLastTime() const void WMNativeTest::Run(int32_t argc, const char **argv) { - int displayId = 0; + DisplayId displayId = 0; sptr listener = nullptr; sptr scene = new WindowScene(); std::shared_ptr abilityContext = nullptr; -- Gitee