!126 统一displayId为uint64_t

Merge pull request !126 from wangxinpeng/master
This commit is contained in:
openharmony_ci
2022-01-26 07:52:05 +00:00
committed by Gitee
50 changed files with 118 additions and 115 deletions
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -357,7 +357,7 @@ bool DisplayManager::SetDisplayState(DisplayState state, DisplayStateCallback ca
return ret;
}
DisplayState DisplayManager::GetDisplayState(uint64_t displayId)
DisplayState DisplayManager::GetDisplayState(DisplayId displayId)
{
return SingletonContainer::Get<DisplayManagerAdapter>().GetDisplayState(displayId);
}
+1 -1
View File
@@ -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<std::recursive_mutex> lock(mutex_);
if (!InitDMSProxyLocked()) {
+1 -1
View File
@@ -70,7 +70,7 @@ sptr<DisplayPowerEventListener> 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_);
-2
View File
@@ -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;
+1 -1
View File
@@ -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;
};
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -59,7 +59,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;
sptr<AbstractScreenController> GetAbstractScreenController();
+2 -1
View File
@@ -18,6 +18,7 @@
#include <map>
#include <mutex>
#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:
+3 -3
View File
@@ -67,7 +67,7 @@ DisplayInfo DisplayManagerProxy::GetDisplayInfoById(DisplayId displayId)
WLOGFE("GetDisplayInfoById: WriteInterfaceToken failed");
return DisplayInfo();
}
data.WriteUint64(static_cast<uint64_t>(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<uint32_t>(displayId))) {
if (!data.WriteUint64(displayId)) {
WLOGFE("Write displayId failed");
return DisplayState::UNKNOWN;
}
+1 -1
View File
@@ -208,7 +208,7 @@ bool DisplayManagerService::SetDisplayState(DisplayState state)
return displayPowerController_.SetDisplayState(state);
}
DisplayState DisplayManagerService::GetDisplayState(uint64_t displayId)
DisplayState DisplayManagerService::GetDisplayState(DisplayId displayId)
{
std::lock_guard<std::recursive_mutex> lock(mutex_);
return displayPowerController_.GetDisplayState(displayId);
+1 -1
View File
@@ -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<DisplayId>(data.ReadUint64());
DisplayId displayId = data.ReadUint64();
auto info = GetDisplayInfoById(displayId);
reply.WriteParcelable(&info);
break;
+1 -1
View File
@@ -61,7 +61,7 @@ bool DisplayPowerController::SetDisplayState(DisplayState state)
return true;
}
DisplayState DisplayPowerController::GetDisplayState(uint64_t displayId)
DisplayState DisplayPowerController::GetDisplayState(DisplayId displayId)
{
return displayState_;
}
-1
View File
@@ -17,7 +17,6 @@
#define FOUNDATION_DM_DISPLAY_H
#include <string>
#include <refbase.h>
namespace OHOS::Rosen {
+1 -1
View File
@@ -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);
-1
View File
@@ -20,7 +20,6 @@
namespace OHOS {
namespace Rosen {
constexpr int32_t INVALID_DISPLAY_ID = -1;
enum class PowerStateChangeReason : uint32_t {
POWER_BUTTON,
};
+5 -5
View File
@@ -38,15 +38,15 @@ using SystemBarRegionTints = std::vector<SystemBarRegionTint>;
class IFocusChangedListener : public RefBase {
public:
virtual void OnFocused(uint32_t windowId, sptr<IRemoteObject> abilityToken,
WindowType windowType, int32_t displayId) = 0;
WindowType windowType, DisplayId displayId) = 0;
virtual void OnUnfocused(uint32_t windowId, sptr<IRemoteObject> 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<Impl> pImpl_;
void UpdateFocusStatus(uint32_t windowId, const sptr<IRemoteObject>& 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
+4 -3
View File
@@ -18,6 +18,7 @@
#include <refbase.h>
#include <string>
#include <unordered_map>
#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 };
+3 -3
View File
@@ -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<AbilityRuntime::Context>& context,
WMError Init(DisplayId displayId, const std::shared_ptr<AbilityRuntime::Context>& context,
sptr<IWindowLifeCycle>& listener, sptr<WindowOption> option = nullptr);
sptr<Window> CreateWindow(const std::string& windowName, sptr<WindowOption>& option) const;
@@ -55,7 +55,7 @@ public:
private:
static inline std::atomic<uint32_t> count { 0 };
sptr<Window> mainWindow_ = nullptr;
int32_t displayId_ = DEFAULT_DISPLAY_ID;
DisplayId displayId_ = DEFAULT_DISPLAY_ID;
std::shared_ptr<AbilityRuntime::Context> context_ = nullptr;
};
+1
View File
@@ -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,
@@ -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<std::mutex> lock(mtx_);
WLOGFI("JsWindowListener::OnSystemBarPropertyChange is called");
@@ -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<Rect> avoidAreas) override;
+3 -3
View File
@@ -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<WindowType, SystemBarProperty> sysBarPropMap_ {
+4 -4
View File
@@ -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> 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);
+2 -2
View File
@@ -26,8 +26,8 @@ public:
~WindowManagerAgent() = default;
void UpdateFocusStatus(uint32_t windowId, const sptr<IRemoteObject>& 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
@@ -37,8 +37,8 @@ public:
};
virtual void UpdateFocusStatus(uint32_t windowId, const sptr<IRemoteObject>& 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
+2 -2
View File
@@ -28,8 +28,8 @@ public:
~WindowManagerAgentProxy() {};
void UpdateFocusStatus(uint32_t windowId, const sptr<IRemoteObject>& 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<WindowManagerAgentProxy> delegator_;
+4 -3
View File
@@ -598,7 +598,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;
}
@@ -778,13 +778,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()) {
+12 -11
View File
@@ -15,6 +15,7 @@
#include "foundation/windowmanager/interfaces/innerkits/wm/window_manager.h"
#include <algorithm>
#include <cinttypes>
#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<IRemoteObject>& abilityToken,
WindowType windowType, int32_t displayId) const;
WindowType windowType, DisplayId displayId) const;
void NotifyUnfocused(uint32_t windowId, const sptr<IRemoteObject>& 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<WindowManager> delegator_;
std::recursive_mutex mutex_;
@@ -44,9 +45,9 @@ public:
};
void WindowManager::Impl::NotifyFocused(uint32_t windowId, const sptr<IRemoteObject>& 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<uint32_t>(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<IRemoteObj
}
void WindowManager::Impl::NotifyUnfocused(uint32_t windowId, const sptr<IRemoteObject>& 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<uint32_t>(windowType), displayId);
WLOGFI("NotifyUnfocused [%{public}d; %{public}p; %{public}d; %{public}" PRIu64"]", windowId,
abilityToken.GetRefPtr(), static_cast<uint32_t>(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<ISystemBarChan
}
void WindowManager::UpdateFocusStatus(uint32_t windowId, const sptr<IRemoteObject>& 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 sptr<IRemoteObjec
}
}
void WindowManager::UpdateSystemBarRegionTints(uint64_t displayId,
void WindowManager::UpdateSystemBarRegionTints(DisplayId displayId,
const SystemBarRegionTints& tints) const
{
pImpl_->NotifySystemBarChanged(displayId, tints);
+2 -2
View File
@@ -20,12 +20,12 @@
namespace OHOS {
namespace Rosen {
void WindowManagerAgent::UpdateFocusStatus(uint32_t windowId, const sptr<IRemoteObject>& abilityToken,
WindowType windowType, int32_t displayId, bool focused)
WindowType windowType, DisplayId displayId, bool focused)
{
SingletonContainer::Get<WindowManager>().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<WindowManager>().UpdateSystemBarRegionTints(displayId, tints);
}
+2 -2
View File
@@ -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_;
}
+1 -1
View File
@@ -37,7 +37,7 @@ WindowScene::~WindowScene()
}
}
WMError WindowScene::Init(int32_t displayId, const std::shared_ptr<AbilityRuntime::Context>& context,
WMError WindowScene::Init(DisplayId displayId, const std::shared_ptr<AbilityRuntime::Context>& context,
sptr<IWindowLifeCycle>& listener, sptr<WindowOption> option)
{
displayId_ = displayId;
+3 -3
View File
@@ -24,7 +24,7 @@ namespace {
}
void WindowManagerAgentProxy::UpdateFocusStatus(uint32_t windowId, const sptr<IRemoteObject>& 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<IR
return;
}
if (!data.WriteInt32(displayId)) {
if (!data.WriteUint64(displayId)) {
WLOGFE("Write displayId failed");
return;
}
@@ -63,7 +63,7 @@ void WindowManagerAgentProxy::UpdateFocusStatus(uint32_t windowId, const sptr<IR
}
}
void WindowManagerAgentProxy::UpdateSystemBarRegionTints(uint64_t displayId, const SystemBarRegionTints& tints)
void WindowManagerAgentProxy::UpdateSystemBarRegionTints(DisplayId displayId, const SystemBarRegionTints& tints)
{
MessageParcel data;
MessageParcel reply;
+2 -2
View File
@@ -37,13 +37,13 @@ int WindowManagerAgentStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
uint32_t windowId = data.ReadUint32();
sptr<IRemoteObject> abilityToken = data.ReadRemoteObject();
WindowType windowType = static_cast<WindowType>(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++) {
+3 -3
View File
@@ -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>& window, const SystemBarRegionTints& props);
bool SystemBarPropsEqualsTo(const SystemBarRegionTints& expect);
void DumpFailedInfo(const SystemBarRegionTints& expect);
int displayId_ = 0;
DisplayId displayId_ = 0;
std::vector<sptr<Window>> activeWindows_;
static vector<Rect> fullScreenExpecteds_;
static sptr<TestSystemBarChangedListener> 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;
+1 -1
View File
@@ -28,7 +28,7 @@ public:
static void TearDownTestCase();
virtual void SetUp() override;
virtual void TearDown() override;
int displayId_ = 0;
DisplayId displayId_ = 0;
std::vector<sptr<Window>> activeWindows_;
static vector<Rect> fullScreenExpecteds_;
};
+4 -4
View File
@@ -26,7 +26,7 @@ namespace Rosen {
using Mocker = SingletonMocker<StaticCall, MockStaticCall>;
void WindowSceneTest::SetUpTestCase()
{
int displayId = 0;
DisplayId displayId = 0;
sptr<IWindowLifeCycle> listener = nullptr;
scene_ = new WindowScene();
abilityContext_ = std::make_shared<AbilityRuntime::AbilityContextImpl>();
@@ -60,7 +60,7 @@ HWTEST_F(WindowSceneTest, Init01, Function | SmallTest | Level2)
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
sptr<WindowOption> optionTest = new WindowOption();
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _)).Times(1).WillOnce(Return(new WindowImpl(optionTest)));
int displayId = 0;
DisplayId displayId = 0;
sptr<IWindowLifeCycle> listener = nullptr;
sptr<WindowScene> scene = new WindowScene();
std::shared_ptr<AbilityRuntime::AbilityContext> abilityContext = nullptr;
@@ -78,7 +78,7 @@ HWTEST_F(WindowSceneTest, Init02, Function | SmallTest | Level2)
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
sptr<WindowOption> optionTest = new WindowOption();
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _)).Times(1).WillOnce(Return(nullptr));
int displayId = 0;
DisplayId displayId = 0;
sptr<IWindowLifeCycle> listener = nullptr;
sptr<WindowScene> scene = new WindowScene();
std::shared_ptr<AbilityRuntime::AbilityContext> abilityContext = nullptr;
@@ -96,7 +96,7 @@ HWTEST_F(WindowSceneTest, Init03, Function | SmallTest | Level2)
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
sptr<WindowOption> optionTest = new WindowOption();
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _)).Times(1).WillOnce(Return(new WindowImpl(optionTest)));
int displayId = 0;
DisplayId displayId = 0;
sptr<IWindowLifeCycle> listener = nullptr;
sptr<WindowScene> scene = new WindowScene();
ASSERT_EQ(WMError::WM_OK, scene->Init(displayId, abilityContext_, listener));
+2 -2
View File
@@ -21,6 +21,7 @@
#include <refbase.h>
#include "window_root.h"
#include "wm_common.h"
namespace OHOS {
namespace Rosen {
@@ -29,14 +30,13 @@ public:
InputWindowMonitor(sptr<WindowRoot>& root) : windowRoot_(root) {}
~InputWindowMonitor() = default;
void UpdateInputWindow(uint32_t windowId);
void UpdateInputWindowByDisplayId(int32_t displayId);
void UpdateInputWindowByDisplayId(DisplayId displayId);
private:
sptr<WindowRoot> windowRoot_;
std::vector<MMI::PhysicalDisplayInfo> physicalDisplays_;
std::vector<MMI::LogicalDisplayInfo> logicalDisplays_;
std::unordered_set<WindowType> windowTypeSkipped_ { WindowType::WINDOW_TYPE_POINTER };
const int INVALID_DISPLAY_ID = -1;
const int INVALID_WINDOW_ID = -1;
void TraverseWindowNodes(const std::vector<sptr<WindowNode>>& windowNodes,
std::vector<MMI::LogicalDisplayInfo>::iterator& iter);
+5 -5
View File
@@ -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<WindowInnerManager> delegator;
sptr<Window> CreateWindow(uint32_t displayId, const WindowType& type, const Rect& rect);
sptr<Window> CreateWindow(DisplayId displayId, const WindowType& type, const Rect& rect);
void CreateAndShowDivider(std::unique_ptr<WindowMessage> msg);
void HideAndDestroyDivider(std::unique_ptr<WindowMessage> msg);
void DestroyThread(std::unique_ptr<WindowMessage> msg);
void DrawSurface(const sptr<Window>& window, uint32_t color);
sptr<Window> GetDividerWindow(uint32_t displayId) const;
sptr<Window> GetDividerWindow(DisplayId displayId) const;
std::mutex mutex_;
std::condition_variable conVar_;
@@ -32,8 +32,8 @@ public:
WindowManagerAgentType type);
void UpdateFocusStatus(uint32_t windowId, const sptr<IRemoteObject>& 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_) {}
+1 -1
View File
@@ -62,7 +62,7 @@ public:
std::vector<Rect> GetAvoidAreaByType(uint32_t windowId, AvoidAreaType avoidAreaType) override;
WMError MinimizeAllAppNodeAbility(uint32_t windowId) override;
std::shared_ptr<RSDisplayNode> GetDisplayNode(int32_t displayId) const;
std::shared_ptr<RSDisplayNode> GetDisplayNode(DisplayId displayId) const;
void RegisterWindowManagerAgent(WindowManagerAgentType type,
const sptr<IWindowManagerAgent>& windowManagerAgent) override;
void UnregisterWindowManagerAgent(WindowManagerAgentType type,
+2 -2
View File
@@ -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<WindowProperty>& property);
@@ -49,7 +49,7 @@ public:
const sptr<IWindow>& GetWindowToken() const;
uint32_t GetWindowId() const;
int32_t GetDisplayId() const;
DisplayId GetDisplayId() const;
const Rect& GetLayoutRect() const;
WindowType GetWindowType() const;
WindowMode GetWindowMode() const;
+2 -2
View File
@@ -36,8 +36,8 @@ public:
WindowRoot(std::recursive_mutex& mutex, Callback callback) : mutex_(mutex), callback_(callback) {}
~WindowRoot() = default;
sptr<WindowNodeContainer> GetOrCreateWindowNodeContainer(int32_t displayId);
void NotifyDisplayRemoved(int32_t displayId);
sptr<WindowNodeContainer> GetOrCreateWindowNodeContainer(DisplayId displayId);
void NotifyDisplayRemoved(DisplayId displayId);
sptr<WindowNode> GetWindowNode(uint32_t windowId) const;
WMError SaveWindow(const sptr<WindowNode>& node);
+7 -7
View File
@@ -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<int32_t>(displayId);
});
if (iter != logicalDisplays_.end()) {
TraverseWindowNodes(windowNodes, iter);
@@ -80,8 +80,8 @@ void InputWindowMonitor::UpdateDisplaysInfo(const sptr<WindowNodeContainer>& con
{
MMI::PhysicalDisplayInfo physicalDisplayInfo = {
.id = static_cast<int32_t>(container->GetScreenId()),
.leftDisplayId = INVALID_DISPLAY_ID,
.upDisplayId = INVALID_DISPLAY_ID,
.leftDisplayId = static_cast<int32_t>(DISPLAY_ID_INVALD),
.upDisplayId = static_cast<int32_t>(DISPLAY_ID_INVALD),
.topLeftX = container->GetDisplayRect().posX_,
.topLeftY = container->GetDisplayRect().posY_,
.width = static_cast<int32_t>(container->GetDisplayRect().width_),
@@ -144,7 +144,7 @@ void InputWindowMonitor::TraverseWindowNodes(const std::vector<sptr<WindowNode>>
.topLeftY = windowNode->GetLayoutRect().posY_,
.width = static_cast<int32_t>(windowNode->GetLayoutRect().width_),
.height = static_cast<int32_t>(windowNode->GetLayoutRect().height_),
.displayId = windowNode->GetDisplayId(),
.displayId = static_cast<int32_t>(windowNode->GetDisplayId()),
.agentWindowId = static_cast<int32_t>(windowNode->GetWindowId()),
};
if (windowNode->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) {
+8 -6
View File
@@ -15,6 +15,8 @@
#include "window_inner_manager.h"
#include <cinttypes>
#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>& window, uint32_t color)
}
sptr<Window> WindowInnerManager::GetDividerWindow(uint32_t displayId) const
sptr<Window> WindowInnerManager::GetDividerWindow(DisplayId displayId) const
{
auto iter = dividerMap_.find(displayId);
if (iter == dividerMap_.end()) {
@@ -89,7 +91,7 @@ sptr<Window> WindowInnerManager::GetDividerWindow(uint32_t displayId) const
return iter->second;
}
sptr<Window> WindowInnerManager::CreateWindow(uint32_t displayId, const WindowType& type, const Rect& rect)
sptr<Window> WindowInnerManager::CreateWindow(DisplayId displayId, const WindowType& type, const Rect& rect)
{
sptr<Window> 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<std::mutex> lk(mutex_);
if (!hasInitThread_) {
@@ -207,14 +209,14 @@ void WindowInnerManager::SendMessage(InnerWMCmd cmdType, uint32_t displayId)
std::unique_ptr<WindowMessage> winMsg = std::make_unique<WindowMessage>();
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<uint32_t>(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<std::mutex> 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<uint32_t>(cmdType),
winMsg->dividerRect.posX_, winMsg->dividerRect.posY_,
@@ -38,7 +38,7 @@ void WindowManagerAgentController::UnregisterWindowManagerAgent(const sptr<IWind
}
void WindowManagerAgentController::UpdateFocusStatus(uint32_t windowId, const sptr<IRemoteObject>& abilityToken,
WindowType windowType, int32_t displayId, bool focused)
WindowType windowType, DisplayId displayId, bool focused)
{
std::lock_guard<std::recursive_mutex> 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;
+2 -2
View File
@@ -159,7 +159,7 @@ WMError WindowManagerService::DestroyWindow(uint32_t windowId)
WLOGFI("[WMS] Destroy: %{public}d", windowId);
WM_SCOPED_TRACE("wms:DestroyWindow(%d)", windowId);
std::lock_guard<std::recursive_mutex> lock(mutex_);
int32_t displayId = INVALID_DISPLAY_ID;
DisplayId displayId = DISPLAY_ID_INVALD;
auto node = windowRoot_->GetWindowNode(windowId);
if (node != nullptr) {
displayId = node->GetDisplayId();
@@ -271,7 +271,7 @@ void WindowManagerService::UnregisterWindowManagerAgent(WindowManagerAgentType t
WindowManagerAgentController::GetInstance().UnregisterWindowManagerAgent(windowManagerAgent, type);
}
std::shared_ptr<RSDisplayNode> WindowManagerService::GetDisplayNode(int32_t displayId) const
std::shared_ptr<RSDisplayNode> WindowManagerService::GetDisplayNode(DisplayId displayId) const
{
return windowRoot_->GetOrCreateWindowNodeContainer(displayId)->GetDisplayNode();
}
+2 -2
View File
@@ -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<IWindow>& WindowNode::GetWindowToken() const
return windowToken_;
}
int32_t WindowNode::GetDisplayId() const
DisplayId WindowNode::GetDisplayId() const
{
return property_->GetDisplayId();
}
+4 -4
View File
@@ -25,7 +25,7 @@ namespace Rosen {
namespace {
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, 0, "WindowRoot"};
}
sptr<WindowNodeContainer> WindowRoot::GetOrCreateWindowNodeContainer(int32_t displayId)
sptr<WindowNodeContainer> WindowRoot::GetOrCreateWindowNodeContainer(DisplayId displayId)
{
auto iter = windowNodeContainerMap_.find(displayId);
if (iter != windowNodeContainerMap_.end()) {
@@ -33,12 +33,12 @@ sptr<WindowNodeContainer> WindowRoot::GetOrCreateWindowNodeContainer(int32_t dis
}
const sptr<AbstractDisplay> 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<AbstractDisplay>& display)
return true;
}
void WindowRoot::NotifyDisplayRemoved(int32_t displayId)
void WindowRoot::NotifyDisplayRemoved(DisplayId displayId)
{
auto container = GetOrCreateWindowNodeContainer(displayId);
if (container == nullptr) {
+1 -1
View File
@@ -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<IWindowLifeCycle> listener = nullptr;
sptr<WindowScene> scene = new WindowScene();
std::shared_ptr<AbilityRuntime::AbilityContext> abilityContext = nullptr;