mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-06-30 21:47:58 -04:00
修改告警
Signed-off-by: xingyanan <xingyanan2@huawei.com> Change-Id: If850d8ff3493d2cc02afffbfa364d2b868cfe6c9 Signed-off-by: xingyanan <xingyanan2@huawei.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# Window Manager
|
||||
|
||||
## Introduction
|
||||
|
||||
The Window Manager subsystem provides basic capabilities of window and display management. It is the basis for UI display. The following figure shows the architecture of the Window Manager subsystem.
|
||||
|
||||
**Figure 1** Architecture of the Window Manager subsystem
|
||||
|
||||

|
||||
|
||||
- **Window Manager Client**
|
||||
|
||||
Provides window object abstraction and window management interfaces, and connects to the ability and UI framework.
|
||||
|
||||
- **Display Manager Client**
|
||||
|
||||
Provides display information abstraction and display management interfaces.
|
||||
|
||||
- **Window Manager Server**
|
||||
|
||||
Provides capabilities such as window layout, Z-order control, window tree structure, window dragging, and window snapshot, and offers the window layout and focus window for multimodal input.
|
||||
|
||||
- **Display Manager Server**
|
||||
|
||||
Provides display information, screenshot, screen on/off, and brightness processing control, and processes the mapping between the display and screen.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```text
|
||||
foundation/windowmanager/
|
||||
├── dm # Stores Display Manager Client implementation code
|
||||
├── dmserver # Stores Display Manager Server implementation code
|
||||
├── interfaces # Stores external APIs
|
||||
│ ├── innerkits # Stores native APIs
|
||||
│ └── kits # Stores JS APIs and native APIs
|
||||
├── resources # Stores resource files used by the framework
|
||||
├── sa_profile # Stores system service configuration files
|
||||
├── snapshot # Stores implementation code of the screenshot command line tool
|
||||
├── utils # Stores tools
|
||||
├── wm # Stores Window Manager Client implementation code
|
||||
├── wmserver # Stores Window Manager Server implementation code
|
||||
```
|
||||
|
||||
## Constraints
|
||||
|
||||
- Programming language version
|
||||
- C++ 11 or later
|
||||
|
||||
## Available APIs
|
||||
|
||||
- [Window](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-window.md)
|
||||
- [Display](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-display.md)
|
||||
|
||||
## Repositories Involved
|
||||
|
||||
- graphic_standard
|
||||
- ace_ace_engine
|
||||
- aafwk_standard
|
||||
- multimodalinput_input
|
||||
@@ -69,7 +69,7 @@ private:
|
||||
|
||||
class DisplayManager::Impl::DisplayManagerListener : public DisplayManagerAgentDefault {
|
||||
public:
|
||||
DisplayManagerListener(sptr<Impl> impl) : pImpl_(impl)
|
||||
explicit DisplayManagerListener(sptr<Impl> impl) : pImpl_(impl)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
|
||||
class DisplayManager::Impl::DisplayManagerAgent : public DisplayManagerAgentDefault {
|
||||
public:
|
||||
DisplayManagerAgent(sptr<Impl> impl) : pImpl_(impl)
|
||||
explicit DisplayManagerAgent(sptr<Impl> impl) : pImpl_(impl)
|
||||
{
|
||||
}
|
||||
~DisplayManagerAgent() = default;
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
OnAbstractScreenChangeCb onChange_;
|
||||
};
|
||||
|
||||
AbstractScreenController(std::recursive_mutex& mutex);
|
||||
explicit AbstractScreenController(std::recursive_mutex& mutex);
|
||||
~AbstractScreenController();
|
||||
WM_DISALLOW_COPY_AND_MOVE(AbstractScreenController);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class IDisplayManager : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IDisplayManager");
|
||||
|
||||
enum {
|
||||
enum class DisplayManagerMessage : uint32_t {
|
||||
TRANS_ID_GET_DEFAULT_DISPLAY_ID = 0,
|
||||
TRANS_ID_GET_DISPLAY_BY_ID,
|
||||
TRANS_ID_GET_DISPLAY_BY_SCREEN,
|
||||
|
||||
@@ -366,8 +366,13 @@ void AbstractDisplayController::BindAloneScreenLocked(sptr<AbstractScreen> realA
|
||||
return;
|
||||
}
|
||||
if (dummyDisplay_ == nullptr) {
|
||||
sptr<AbstractDisplay> display = new AbstractDisplay(displayCount_.fetch_add(1),
|
||||
sptr<AbstractDisplay> display = new(std::nothrow) AbstractDisplay(displayCount_.fetch_add(1),
|
||||
realAbsScreen->dmsId_, info->width_, info->height_, info->refreshRate_);
|
||||
if (display == nullptr) {
|
||||
WLOGFE("create display failed");
|
||||
return;
|
||||
}
|
||||
|
||||
abstractDisplayMap_.insert((std::make_pair(display->GetId(), display)));
|
||||
WLOGI("create display for new screen. screen:%{public}" PRIu64", display:%{public}" PRIu64"",
|
||||
realAbsScreen->dmsId_, display->GetId());
|
||||
@@ -447,14 +452,14 @@ void AbstractDisplayController::SetFreeze(std::vector<DisplayId> displayIds, boo
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
auto iter = abstractDisplayMap_.find(displayId);
|
||||
if (iter == abstractDisplayMap_.end()) {
|
||||
WLOGI("setfreeze fail, cannot get display %{public}" PRIu64"", displayId);
|
||||
WLOGE("setfreeze fail, cannot get display %{public}" PRIu64"", displayId);
|
||||
continue;
|
||||
}
|
||||
abstractDisplay = iter->second;
|
||||
FreezeFlag curFlag = abstractDisplay->GetFreezeFlag();
|
||||
if ((toFreeze && (curFlag == FreezeFlag::FREEZING))
|
||||
|| (!toFreeze && (curFlag == FreezeFlag::UNFREEZING))) {
|
||||
WLOGI("setfreeze fail, display %{public}" PRIu64" freezeflag is %{public}u",
|
||||
WLOGE("setfreeze fail, display %{public}" PRIu64" freezeflag is %{public}u",
|
||||
displayId, curFlag);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,11 @@ bool AbstractScreenController::FillAbstractScreen(sptr<AbstractScreen>& absScree
|
||||
return false;
|
||||
}
|
||||
for (const RSScreenModeInfo& rsScreenModeInfo : allModes) {
|
||||
sptr<SupportedScreenModes> info = new SupportedScreenModes();
|
||||
sptr<SupportedScreenModes> info = new(std::nothrow) SupportedScreenModes();
|
||||
if (info == nullptr) {
|
||||
WLOGFE("create SupportedScreenModes failed");
|
||||
return false;
|
||||
}
|
||||
info->width_ = static_cast<uint32_t>(rsScreenModeInfo.GetScreenWidth());
|
||||
info->height_ = static_cast<uint32_t>(rsScreenModeInfo.GetScreenHeight());
|
||||
info->refreshRate_ = rsScreenModeInfo.GetScreenRefreshRate();
|
||||
|
||||
@@ -42,7 +42,8 @@ DisplayId DisplayManagerProxy::GetDefaultDisplayId()
|
||||
WLOGFE("GetDefaultDisplayId: WriteInterfaceToken failed");
|
||||
return DISPLAY_ID_INVALID;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_GET_DEFAULT_DISPLAY_ID, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DEFAULT_DISPLAY_ID),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("GetDefaultDisplayId: SendRequest failed");
|
||||
return DISPLAY_ID_INVALID;
|
||||
}
|
||||
@@ -71,7 +72,8 @@ sptr<DisplayInfo> DisplayManagerProxy::GetDisplayInfoById(DisplayId displayId)
|
||||
WLOGFW("GetDisplayInfoById: WriteUint64 displayId failed");
|
||||
return nullptr;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_GET_DISPLAY_BY_ID, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DISPLAY_BY_ID),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("GetDisplayInfoById: SendRequest failed");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -103,7 +105,8 @@ sptr<DisplayInfo> DisplayManagerProxy::GetDisplayInfoByScreen(ScreenId screenId)
|
||||
WLOGFW("fail to get displayInfo by screenId: WriteUint64 displayId failed");
|
||||
return nullptr;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_GET_DISPLAY_BY_SCREEN, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DISPLAY_BY_SCREEN),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("fail to get displayInfo by screenId: SendRequest failed");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -151,7 +154,8 @@ ScreenId DisplayManagerProxy::CreateVirtualScreen(VirtualScreenOption virtualOpt
|
||||
WLOGFE("Write data failed");
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_CREATE_VIRTUAL_SCREEN, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_CREATE_VIRTUAL_SCREEN),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("CreateVirtualScreen: SendRequest failed");
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
@@ -180,7 +184,8 @@ DMError DisplayManagerProxy::DestroyVirtualScreen(ScreenId screenId)
|
||||
WLOGFW("DestroyVirtualScreen: WriteUint64 screenId failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_DESTROY_VIRTUAL_SCREEN, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_DESTROY_VIRTUAL_SCREEN),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("DestroyVirtualScreen: SendRequest failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
@@ -215,7 +220,8 @@ DMError DisplayManagerProxy::SetVirtualScreenSurface(ScreenId screenId, sptr<Sur
|
||||
WLOGFW("SetVirtualScreenSurface: Write screenId/surface failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SET_VIRTUAL_SCREEN_SURFACE, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_SURFACE),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SetVirtualScreenSurface: SendRequest failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
@@ -245,7 +251,8 @@ bool DisplayManagerProxy::SetOrientation(ScreenId screenId, Orientation orientat
|
||||
WLOGFW("fail to set orientation: Write orientation failed");
|
||||
return false;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SET_ORIENTATION, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_ORIENTATION),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("fail to set orientation: SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -273,7 +280,8 @@ std::shared_ptr<Media::PixelMap> DisplayManagerProxy::GetDisplaySnapshot(Display
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (remote->SendRequest(TRANS_ID_GET_DISPLAY_SNAPSHOT, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DISPLAY_SNAPSHOT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("GetDisplaySnapshot: SendRequest failed");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -306,7 +314,8 @@ DMError DisplayManagerProxy::GetScreenSupportedColorGamuts(ScreenId screenId,
|
||||
WLOGFW("DisplayManagerProxy::GetScreenSupportedColorGamuts: WriteUint64 screenId failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SCREEN_GET_SUPPORTED_COLOR_GAMUTS, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_GET_SUPPORTED_COLOR_GAMUTS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("DisplayManagerProxy::GetScreenSupportedColorGamuts: SendRequest failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
@@ -344,7 +353,8 @@ DMError DisplayManagerProxy::GetScreenColorGamut(ScreenId screenId, ScreenColorG
|
||||
WLOGFW("DisplayManagerProxy::GetScreenColorGamut: WriteUint64 uint64_t failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SCREEN_GET_COLOR_GAMUT, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_GET_COLOR_GAMUT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("DisplayManagerProxy::GetScreenColorGamut: SendRequest failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
@@ -375,7 +385,8 @@ DMError DisplayManagerProxy::SetScreenColorGamut(ScreenId screenId, int32_t colo
|
||||
WLOGFW("DisplayManagerProxy::SetScreenColorGamut: Write failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SCREEN_SET_COLOR_GAMUT, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_SET_COLOR_GAMUT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("DisplayManagerProxy::SetScreenColorGamut: SendRequest failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
@@ -401,7 +412,8 @@ DMError DisplayManagerProxy::GetScreenGamutMap(ScreenId screenId, ScreenGamutMap
|
||||
WLOGFW("DisplayManagerProxy::GetScreenGamutMap: WriteUint64 screenId failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SCREEN_GET_GAMUT_MAP, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_GET_GAMUT_MAP),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("DisplayManagerProxy::GetScreenGamutMap: SendRequest failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
@@ -432,7 +444,8 @@ DMError DisplayManagerProxy::SetScreenGamutMap(ScreenId screenId, ScreenGamutMap
|
||||
WLOGFW("DisplayManagerProxy::SetScreenGamutMap: Writ failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SCREEN_SET_GAMUT_MAP, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_SET_GAMUT_MAP),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("DisplayManagerProxy::SetScreenGamutMap: SendRequest failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
@@ -458,7 +471,8 @@ DMError DisplayManagerProxy::SetScreenColorTransform(ScreenId screenId)
|
||||
WLOGFW("DisplayManagerProxy::SetScreenColorTransform: WriteUint64 screenId failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SCREEN_SET_COLOR_TRANSFORM, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_SET_COLOR_TRANSFORM),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("DisplayManagerProxy::SetScreenColorTransform: SendRequest failed");
|
||||
return DMError::DM_ERROR_IPC_FAILED;
|
||||
}
|
||||
@@ -486,7 +500,8 @@ bool DisplayManagerProxy::RegisterDisplayManagerAgent(const sptr<IDisplayManager
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_REGISTER_DISPLAY_MANAGER_AGENT, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_REGISTER_DISPLAY_MANAGER_AGENT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -514,7 +529,8 @@ bool DisplayManagerProxy::UnregisterDisplayManagerAgent(const sptr<IDisplayManag
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UNREGISTER_DISPLAY_MANAGER_AGENT, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_UNREGISTER_DISPLAY_MANAGER_AGENT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -534,7 +550,8 @@ bool DisplayManagerProxy::WakeUpBegin(PowerStateChangeReason reason)
|
||||
WLOGFE("Write PowerStateChangeReason failed");
|
||||
return false;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_WAKE_UP_BEGIN, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_WAKE_UP_BEGIN),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -550,7 +567,8 @@ bool DisplayManagerProxy::WakeUpEnd()
|
||||
WLOGFE("WriteInterfaceToken failed");
|
||||
return false;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_WAKE_UP_END, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_WAKE_UP_END),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -570,7 +588,8 @@ bool DisplayManagerProxy::SuspendBegin(PowerStateChangeReason reason)
|
||||
WLOGFE("Write PowerStateChangeReason failed");
|
||||
return false;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_SUSPEND_BEGIN, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SUSPEND_BEGIN),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -586,7 +605,8 @@ bool DisplayManagerProxy::SuspendEnd()
|
||||
WLOGFE("WriteInterfaceToken failed");
|
||||
return false;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_SUSPEND_END, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SUSPEND_END),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -610,7 +630,8 @@ bool DisplayManagerProxy::SetScreenPowerForAll(ScreenPowerState state, PowerStat
|
||||
WLOGFE("Write PowerStateChangeReason failed");
|
||||
return false;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_SET_SCREEN_POWER_FOR_ALL, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_POWER_FOR_ALL),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -630,7 +651,8 @@ ScreenPowerState DisplayManagerProxy::GetScreenPower(ScreenId dmsScreenId)
|
||||
WLOGFE("Write dmsScreenId failed");
|
||||
return ScreenPowerState::INVALID_STATE;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_GET_SCREEN_POWER, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_SCREEN_POWER),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return ScreenPowerState::INVALID_STATE;
|
||||
}
|
||||
@@ -650,7 +672,8 @@ bool DisplayManagerProxy::SetDisplayState(DisplayState state)
|
||||
WLOGFE("Write DisplayState failed");
|
||||
return false;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_SET_DISPLAY_STATE, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_DISPLAY_STATE),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -670,7 +693,8 @@ DisplayState DisplayManagerProxy::GetDisplayState(DisplayId displayId)
|
||||
WLOGFE("Write displayId failed");
|
||||
return DisplayState::UNKNOWN;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_GET_DISPLAY_STATE, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DISPLAY_STATE),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return DisplayState::UNKNOWN;
|
||||
}
|
||||
@@ -687,7 +711,8 @@ std::vector<DisplayId> DisplayManagerProxy::GetAllDisplayIds()
|
||||
WLOGFE("WriteInterfaceToken failed");
|
||||
return allDisplayIds;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_GET_ALL_DISPLAYIDS, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_ALL_DISPLAYIDS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return allDisplayIds;
|
||||
}
|
||||
@@ -708,7 +733,8 @@ void DisplayManagerProxy::NotifyDisplayEvent(DisplayEvent event)
|
||||
WLOGFE("Write DisplayEvent failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_NOTIFY_DISPLAY_EVENT, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_NOTIFY_DISPLAY_EVENT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("SendRequest failed");
|
||||
return;
|
||||
}
|
||||
@@ -732,7 +758,8 @@ bool DisplayManagerProxy::SetFreeze(std::vector<DisplayId> displayIds, bool isFr
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_SET_FREEZE_EVENT, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_FREEZE_EVENT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
@@ -760,7 +787,8 @@ ScreenId DisplayManagerProxy::MakeMirror(ScreenId mainScreenId, std::vector<Scre
|
||||
WLOGFE("create mirror fail: data write failed");
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SCREEN_MAKE_MIRROR, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_MAKE_MIRROR),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("create mirror fail: SendRequest failed");
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
@@ -786,7 +814,8 @@ sptr<ScreenInfo> DisplayManagerProxy::GetScreenInfoById(ScreenId screenId)
|
||||
WLOGFE("GetScreenInfoById: Write screenId failed");
|
||||
return nullptr;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_GET_SCREEN_INFO_BY_ID, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_SCREEN_INFO_BY_ID),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("GetScreenInfoById: SendRequest failed");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -822,7 +851,8 @@ sptr<ScreenGroupInfo> DisplayManagerProxy::GetScreenGroupInfoById(ScreenId scree
|
||||
WLOGFE("GetScreenGroupInfoById: Write screenId failed");
|
||||
return nullptr;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_GET_SCREEN_GROUP_INFO_BY_ID, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_SCREEN_GROUP_INFO_BY_ID),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("GetScreenGroupInfoById: SendRequest failed");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -851,7 +881,8 @@ std::vector<sptr<ScreenInfo>> DisplayManagerProxy::GetAllScreenInfos()
|
||||
WLOGFE("GetAllScreenInfos: WriteInterfaceToken failed");
|
||||
return screenInfos;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_GET_ALL_SCREEN_INFOS, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_ALL_SCREEN_INFOS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("GetAllScreenInfos: SendRequest failed");
|
||||
return screenInfos;
|
||||
}
|
||||
@@ -885,7 +916,8 @@ ScreenId DisplayManagerProxy::MakeExpand(std::vector<ScreenId> screenId, std::ve
|
||||
WLOGFE("MakeExpand: write startPoint failed");
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SCREEN_MAKE_EXPAND, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_MAKE_EXPAND),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("MakeExpand: SendRequest failed");
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
@@ -912,7 +944,9 @@ void DisplayManagerProxy::RemoveVirtualScreenFromGroup(std::vector<ScreenId> scr
|
||||
WLOGFE("cancel make mirror or expand fail: write screens failed.");
|
||||
return;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_REMOVE_VIRTUAL_SCREEN_FROM_SCREEN_GROUP, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(
|
||||
DisplayManagerMessage::TRANS_ID_REMOVE_VIRTUAL_SCREEN_FROM_SCREEN_GROUP),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("cancel make mirror or expand fail: SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -936,7 +970,8 @@ bool DisplayManagerProxy::SetScreenActiveMode(ScreenId screenId, uint32_t modeId
|
||||
WLOGFE("SetScreenActiveMode: write screenId/modeId failed");
|
||||
return false;
|
||||
}
|
||||
if (remote->SendRequest(TRANS_ID_SET_SCREEN_ACTIVE_MODE, data, reply, option) != ERR_NONE) {
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_ACTIVE_MODE),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SetScreenActiveMode: SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,25 +37,26 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
WLOGFE("InterfaceToken check failed");
|
||||
return -1;
|
||||
}
|
||||
switch (code) {
|
||||
case TRANS_ID_GET_DEFAULT_DISPLAY_ID: {
|
||||
DisplayManagerMessage msgId = static_cast<DisplayManagerMessage>(code);
|
||||
switch (msgId) {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_DEFAULT_DISPLAY_ID: {
|
||||
DisplayId displayId = GetDefaultDisplayId();
|
||||
reply.WriteUint64(displayId);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_DISPLAY_BY_ID: {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_DISPLAY_BY_ID: {
|
||||
DisplayId displayId = data.ReadUint64();
|
||||
auto info = GetDisplayInfoById(displayId);
|
||||
reply.WriteParcelable(info);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_DISPLAY_BY_SCREEN: {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_DISPLAY_BY_SCREEN: {
|
||||
ScreenId screenId = data.ReadUint64();
|
||||
auto info = GetDisplayInfoByScreen(screenId);
|
||||
reply.WriteParcelable(info);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_CREATE_VIRTUAL_SCREEN: {
|
||||
case DisplayManagerMessage::TRANS_ID_CREATE_VIRTUAL_SCREEN: {
|
||||
std::string name = data.ReadString();
|
||||
uint32_t width = data.ReadUint32();
|
||||
uint32_t height = data.ReadUint32();
|
||||
@@ -83,13 +84,13 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
reply.WriteUint64(static_cast<uint64_t>(screenId));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_DESTROY_VIRTUAL_SCREEN: {
|
||||
case DisplayManagerMessage::TRANS_ID_DESTROY_VIRTUAL_SCREEN: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
DMError result = DestroyVirtualScreen(screenId);
|
||||
reply.WriteInt32(static_cast<int32_t>(result));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SET_VIRTUAL_SCREEN_SURFACE: {
|
||||
case DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_SURFACE: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
bool isSurfaceValid = data.ReadBool();
|
||||
sptr<Surface> surface = nullptr;
|
||||
@@ -102,55 +103,55 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
reply.WriteInt32(static_cast<int32_t>(result));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SET_ORIENTATION: {
|
||||
case DisplayManagerMessage::TRANS_ID_SET_ORIENTATION: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
Orientation orientation = static_cast<Orientation>(data.ReadUint32());
|
||||
reply.WriteBool(SetOrientation(screenId, orientation));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_DISPLAY_SNAPSHOT: {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_DISPLAY_SNAPSHOT: {
|
||||
DisplayId displayId = data.ReadUint64();
|
||||
std::shared_ptr<Media::PixelMap> displaySnapshot = GetDisplaySnapshot(displayId);
|
||||
reply.WriteParcelable(displaySnapshot == nullptr ? nullptr : displaySnapshot.get());
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_REGISTER_DISPLAY_MANAGER_AGENT: {
|
||||
case DisplayManagerMessage::TRANS_ID_REGISTER_DISPLAY_MANAGER_AGENT: {
|
||||
auto agent = iface_cast<IDisplayManagerAgent>(data.ReadRemoteObject());
|
||||
auto type = static_cast<DisplayManagerAgentType>(data.ReadUint32());
|
||||
reply.WriteBool(RegisterDisplayManagerAgent(agent, type));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UNREGISTER_DISPLAY_MANAGER_AGENT: {
|
||||
case DisplayManagerMessage::TRANS_ID_UNREGISTER_DISPLAY_MANAGER_AGENT: {
|
||||
auto agent = iface_cast<IDisplayManagerAgent>(data.ReadRemoteObject());
|
||||
auto type = static_cast<DisplayManagerAgentType>(data.ReadUint32());
|
||||
reply.WriteBool(UnregisterDisplayManagerAgent(agent, type));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_WAKE_UP_BEGIN: {
|
||||
case DisplayManagerMessage::TRANS_ID_WAKE_UP_BEGIN: {
|
||||
PowerStateChangeReason reason = static_cast<PowerStateChangeReason>(data.ReadUint32());
|
||||
reply.WriteBool(WakeUpBegin(reason));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_WAKE_UP_END: {
|
||||
case DisplayManagerMessage::TRANS_ID_WAKE_UP_END: {
|
||||
reply.WriteBool(WakeUpEnd());
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SUSPEND_BEGIN: {
|
||||
case DisplayManagerMessage::TRANS_ID_SUSPEND_BEGIN: {
|
||||
PowerStateChangeReason reason = static_cast<PowerStateChangeReason>(data.ReadUint32());
|
||||
reply.WriteBool(SuspendBegin(reason));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SUSPEND_END: {
|
||||
case DisplayManagerMessage::TRANS_ID_SUSPEND_END: {
|
||||
reply.WriteBool(SuspendEnd());
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SET_SCREEN_POWER_FOR_ALL: {
|
||||
case DisplayManagerMessage::TRANS_ID_SET_SCREEN_POWER_FOR_ALL: {
|
||||
ScreenPowerState state = static_cast<ScreenPowerState>(data.ReadUint32());
|
||||
PowerStateChangeReason reason = static_cast<PowerStateChangeReason>(data.ReadUint32());
|
||||
reply.WriteBool(SetScreenPowerForAll(state, reason));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_SCREEN_POWER: {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_SCREEN_POWER: {
|
||||
ScreenId dmsScreenId;
|
||||
if (!data.ReadUint64(dmsScreenId)) {
|
||||
WLOGFE("fail to read dmsScreenId.");
|
||||
@@ -159,28 +160,28 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
reply.WriteUint32(static_cast<uint32_t>(GetScreenPower(dmsScreenId)));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SET_DISPLAY_STATE: {
|
||||
case DisplayManagerMessage::TRANS_ID_SET_DISPLAY_STATE: {
|
||||
DisplayState state = static_cast<DisplayState>(data.ReadUint32());
|
||||
reply.WriteBool(SetDisplayState(state));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_DISPLAY_STATE: {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_DISPLAY_STATE: {
|
||||
DisplayState state = GetDisplayState(data.ReadUint64());
|
||||
reply.WriteUint32(static_cast<uint32_t>(state));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_NOTIFY_DISPLAY_EVENT: {
|
||||
case DisplayManagerMessage::TRANS_ID_NOTIFY_DISPLAY_EVENT: {
|
||||
DisplayEvent event = static_cast<DisplayEvent>(data.ReadUint32());
|
||||
NotifyDisplayEvent(event);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SET_FREEZE_EVENT: {
|
||||
case DisplayManagerMessage::TRANS_ID_SET_FREEZE_EVENT: {
|
||||
std::vector<DisplayId> ids;
|
||||
data.ReadUInt64Vector(&ids);
|
||||
SetFreeze(ids, data.ReadBool());
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SCREEN_MAKE_MIRROR: {
|
||||
case DisplayManagerMessage::TRANS_ID_SCREEN_MAKE_MIRROR: {
|
||||
ScreenId mainScreenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
std::vector<ScreenId> mirrorScreenId;
|
||||
if (!data.ReadUInt64Vector(&mirrorScreenId)) {
|
||||
@@ -191,31 +192,31 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
reply.WriteUint64(static_cast<uint64_t>(result));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_SCREEN_INFO_BY_ID: {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_SCREEN_INFO_BY_ID: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
auto screenInfo = GetScreenInfoById(screenId);
|
||||
reply.WriteStrongParcelable(screenInfo);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_SCREEN_GROUP_INFO_BY_ID: {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_SCREEN_GROUP_INFO_BY_ID: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
auto screenGroupInfo = GetScreenGroupInfoById(screenId);
|
||||
reply.WriteStrongParcelable(screenGroupInfo);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_ALL_SCREEN_INFOS: {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_ALL_SCREEN_INFOS: {
|
||||
std::vector<sptr<ScreenInfo>> screenInfos = GetAllScreenInfos();
|
||||
if (!MarshallingHelper::MarshallingVectorParcelableObj<ScreenInfo>(reply, screenInfos)) {
|
||||
WLOGE("fail to marshalling screenInfos in stub.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_ALL_DISPLAYIDS: {
|
||||
case DisplayManagerMessage::TRANS_ID_GET_ALL_DISPLAYIDS: {
|
||||
std::vector<DisplayId> allDisplayIds = GetAllDisplayIds();
|
||||
reply.WriteUInt64Vector(allDisplayIds);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SCREEN_MAKE_EXPAND: {
|
||||
case DisplayManagerMessage::TRANS_ID_SCREEN_MAKE_EXPAND: {
|
||||
std::vector<ScreenId> screenId;
|
||||
if (!data.ReadUInt64Vector(&screenId)) {
|
||||
WLOGE("fail to receive expand screen in stub.");
|
||||
@@ -232,7 +233,7 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
reply.WriteUint64(static_cast<uint64_t>(result));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_REMOVE_VIRTUAL_SCREEN_FROM_SCREEN_GROUP: {
|
||||
case DisplayManagerMessage::TRANS_ID_REMOVE_VIRTUAL_SCREEN_FROM_SCREEN_GROUP: {
|
||||
std::vector<ScreenId> screenId;
|
||||
if (!data.ReadUInt64Vector(&screenId)) {
|
||||
WLOGE("fail to receive screens in stub.");
|
||||
@@ -241,14 +242,14 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
RemoveVirtualScreenFromGroup(screenId);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SET_SCREEN_ACTIVE_MODE: {
|
||||
case DisplayManagerMessage::TRANS_ID_SET_SCREEN_ACTIVE_MODE: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
uint32_t modeId = data.ReadUint32();
|
||||
bool res = SetScreenActiveMode(screenId, modeId);
|
||||
reply.WriteBool(res);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SCREEN_GET_SUPPORTED_COLOR_GAMUTS: {
|
||||
case DisplayManagerMessage::TRANS_ID_SCREEN_GET_SUPPORTED_COLOR_GAMUTS: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
std::vector<ScreenColorGamut> colorGamuts;
|
||||
DMError ret = GetScreenSupportedColorGamuts(screenId, colorGamuts);
|
||||
@@ -263,7 +264,7 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SCREEN_GET_COLOR_GAMUT: {
|
||||
case DisplayManagerMessage::TRANS_ID_SCREEN_GET_COLOR_GAMUT: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
ScreenColorGamut colorGamut;
|
||||
DMError ret = GetScreenColorGamut(screenId, colorGamut);
|
||||
@@ -274,14 +275,14 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
reply.WriteUint32(static_cast<uint32_t>(colorGamut));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SCREEN_SET_COLOR_GAMUT: {
|
||||
case DisplayManagerMessage::TRANS_ID_SCREEN_SET_COLOR_GAMUT: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
int32_t colorGamutIdx = data.ReadInt32();
|
||||
DMError ret = SetScreenColorGamut(screenId, colorGamutIdx);
|
||||
reply.WriteInt32(static_cast<int32_t>(ret));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SCREEN_GET_GAMUT_MAP: {
|
||||
case DisplayManagerMessage::TRANS_ID_SCREEN_GET_GAMUT_MAP: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
ScreenGamutMap gamutMap;
|
||||
DMError ret = GetScreenGamutMap(screenId, gamutMap);
|
||||
@@ -292,14 +293,14 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
reply.WriteInt32(static_cast<uint32_t>(gamutMap));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SCREEN_SET_GAMUT_MAP: {
|
||||
case DisplayManagerMessage::TRANS_ID_SCREEN_SET_GAMUT_MAP: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
ScreenGamutMap gamutMap = static_cast<ScreenGamutMap>(data.ReadUint32());
|
||||
DMError ret = SetScreenGamutMap(screenId, gamutMap);
|
||||
reply.WriteInt32(static_cast<int32_t>(ret));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SCREEN_SET_COLOR_TRANSFORM: {
|
||||
case DisplayManagerMessage::TRANS_ID_SCREEN_SET_COLOR_TRANSFORM: {
|
||||
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
|
||||
DMError ret = SetScreenColorTransform(screenId);
|
||||
reply.WriteInt32(static_cast<int32_t>(ret));
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 104 KiB |
@@ -23,9 +23,9 @@
|
||||
namespace OHOS::Rosen {
|
||||
class DisplayInfo;
|
||||
|
||||
typedef enum DisplayType {
|
||||
enum class DisplayType : uint32_t {
|
||||
DEFAULT = 0,
|
||||
} DisplayType;
|
||||
};
|
||||
|
||||
class Display : public RefBase {
|
||||
friend class DisplayManager;
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
|
||||
sptr<WindowInfo> currentWindowInfo_;
|
||||
std::vector<sptr<WindowInfo>> windowList_;
|
||||
|
||||
|
||||
private:
|
||||
bool VectorMarshalling(Parcel& parcel) const;
|
||||
static void VectorUnmarshalling(Parcel& parcel, AccessibilityWindowInfo* windowInfo);
|
||||
|
||||
@@ -30,36 +30,121 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
class WindowScene : public RefBase {
|
||||
public:
|
||||
static const DisplayId DEFAULT_DISPLAY_ID = 0;
|
||||
static const std::string MAIN_WINDOW_ID;
|
||||
|
||||
/**
|
||||
* Default constructor used to create an empty WindowScene instance.
|
||||
*/
|
||||
WindowScene() = default;
|
||||
|
||||
/**
|
||||
* Default deconstructor used to deconstruct.
|
||||
*
|
||||
*/
|
||||
~WindowScene();
|
||||
|
||||
/**
|
||||
* Init a WindowScene instance based on the parameters displayId, context, listener and option.
|
||||
*
|
||||
* @param displayId the id of current display
|
||||
* @param context current ability context
|
||||
* @param listener the life cycle listener of the window
|
||||
* @param option the settings for window, such as WindowType, width, height, etc
|
||||
* @return the error code of window
|
||||
*/
|
||||
WMError Init(DisplayId displayId, const std::shared_ptr<AbilityRuntime::Context>& context,
|
||||
sptr<IWindowLifeCycle>& listener, sptr<WindowOption> option = nullptr);
|
||||
|
||||
/**
|
||||
* Create a window instance based on the parameters windowName and option.
|
||||
*
|
||||
* @param windowName the id of this window
|
||||
* @param option the settings for window, such as WindowType, width, height, etc.
|
||||
* @return the shared pointer of window
|
||||
*/
|
||||
sptr<Window> CreateWindow(const std::string& windowName, sptr<WindowOption>& option) const;
|
||||
|
||||
/**
|
||||
* Get shared pointer of main window.
|
||||
*
|
||||
* @return the shared pointer of window
|
||||
*/
|
||||
const sptr<Window>& GetMainWindow() const;
|
||||
|
||||
/**
|
||||
* Get a set of sub window.
|
||||
*
|
||||
* @return a set of sub window
|
||||
*/
|
||||
std::vector<sptr<Window>> GetSubWindow();
|
||||
|
||||
/**
|
||||
* window go foreground.
|
||||
*
|
||||
* @param reason the reason of window to go to foreground, default 0.
|
||||
* @return the error code of window
|
||||
*/
|
||||
WMError GoForeground(uint32_t reason = 0);
|
||||
|
||||
/**
|
||||
* Window go background.
|
||||
*
|
||||
* @param reason the reason of window to go to background, default 0.
|
||||
* @return the error code of window
|
||||
*/
|
||||
WMError GoBackground(uint32_t reason = 0);
|
||||
|
||||
/**
|
||||
* Window go distroy.
|
||||
*
|
||||
* @return the error code of window
|
||||
*/
|
||||
WMError GoDestroy();
|
||||
|
||||
/**
|
||||
* Request to get the focus.
|
||||
*
|
||||
* @return the error code of window
|
||||
*/
|
||||
WMError RequestFocus() const;
|
||||
|
||||
/**
|
||||
* Update ability configuration.
|
||||
*
|
||||
* @param configuration the configuration of ability
|
||||
*/
|
||||
void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration);
|
||||
|
||||
/**
|
||||
* Set main window system bar property
|
||||
*
|
||||
* @param type the type of window
|
||||
* @param property the property of system bar
|
||||
* @return the error code of window
|
||||
*/
|
||||
WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) const;
|
||||
|
||||
/**
|
||||
* Get content info of main window.
|
||||
*
|
||||
* @return content info of main window
|
||||
*/
|
||||
std::string GetContentInfo() const;
|
||||
|
||||
private:
|
||||
static inline std::atomic<uint32_t> count { 0 };
|
||||
sptr<Window> mainWindow_ = nullptr;
|
||||
DisplayId displayId_ = DEFAULT_DISPLAY_ID;
|
||||
public:
|
||||
static const DisplayId DEFAULT_DISPLAY_ID = 0;
|
||||
static const std::string MAIN_WINDOW_ID;
|
||||
|
||||
std::shared_ptr<AbilityRuntime::Context> context_ = nullptr;
|
||||
private:
|
||||
/**
|
||||
* @param context the context of a main window
|
||||
* @return the name of main window
|
||||
*/
|
||||
std::string GenerateMainWindowName(const std::shared_ptr<AbilityRuntime::Context>& context) const;
|
||||
|
||||
private:
|
||||
sptr<Window> mainWindow_ = nullptr;
|
||||
static inline std::atomic<uint32_t> count { 0 };
|
||||
DisplayId displayId_ = DEFAULT_DISPLAY_ID;
|
||||
std::shared_ptr<AbilityRuntime::Context> context_ = nullptr;
|
||||
};
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace OHOS::Rosen {
|
||||
bool DisplayInfo::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
return parcel.WriteUint64(id_) && parcel.WriteUint32(type_) &&
|
||||
return parcel.WriteUint64(id_) && parcel.WriteUint32(static_cast<uint32_t>(type_)) &&
|
||||
parcel.WriteInt32(width_) && parcel.WriteInt32(height_) &&
|
||||
parcel.WriteUint32(refreshRate_) && parcel.WriteUint64(screenId_) &&
|
||||
parcel.WriteFloat(virtualPixelRatio_) && parcel.WriteFloat(xDpi_) && parcel.WriteFloat(yDpi_) &&
|
||||
|
||||
@@ -131,11 +131,17 @@ bool SurfaceReader::ProcessBuffer(const sptr<SurfaceBuffer> &buf)
|
||||
errno_t ret = memcpy_s(data + width * i * BPP, width * BPP, addr + stride * i, width * BPP);
|
||||
if (ret != EOK) {
|
||||
WLOGFE("memcpy failed");
|
||||
free(data);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
sptr<PixelMap> pixelMap = new PixelMap();
|
||||
sptr<PixelMap> pixelMap = new(std::nothrow) PixelMap();
|
||||
if (pixelMap == nullptr) {
|
||||
WLOGFE("create pixelMap failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
ImageInfo info;
|
||||
info.size.width = static_cast<int32_t>(width);
|
||||
info.size.height = static_cast<int32_t>(height);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
class WindowAgent : public WindowStub {
|
||||
public:
|
||||
WindowAgent(sptr<WindowImpl>& window);
|
||||
explicit WindowAgent(sptr<WindowImpl>& window);
|
||||
~WindowAgent() = default;
|
||||
void UpdateWindowRect(const struct Rect& rect, WindowSizeChangeReason reason) override;
|
||||
void UpdateWindowMode(WindowMode mode) override;
|
||||
|
||||
@@ -72,7 +72,7 @@ class WindowImpl : public Window {
|
||||
} while (0)
|
||||
|
||||
public:
|
||||
WindowImpl(const sptr<WindowOption>& option);
|
||||
explicit WindowImpl(const sptr<WindowOption>& option);
|
||||
~WindowImpl();
|
||||
|
||||
static sptr<Window> Find(const std::string& id);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
class WindowInputChannel : public RefBase {
|
||||
public:
|
||||
WindowInputChannel(const sptr<Window>& window);
|
||||
explicit WindowInputChannel(const sptr<Window>& window);
|
||||
~WindowInputChannel() = default;
|
||||
void HandlePointerEvent(std::shared_ptr<MMI::PointerEvent>& pointerEvent);
|
||||
void HandleKeyEvent(std::shared_ptr<MMI::KeyEvent>& keyEvent);
|
||||
|
||||
@@ -28,7 +28,7 @@ class IWindow : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindow");
|
||||
|
||||
enum {
|
||||
enum class WindowMessage : uint32_t {
|
||||
TRANS_ID_UPDATE_WINDOW_RECT,
|
||||
TRANS_ID_UPDATE_WINDOW_MODE,
|
||||
TRANS_ID_UPDATE_FOCUS_STATUS,
|
||||
|
||||
@@ -33,7 +33,7 @@ class IWindowManagerAgent : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindowManagerAgent");
|
||||
|
||||
enum {
|
||||
enum class WindowManagerAgentMsg : uint32_t {
|
||||
TRANS_ID_UPDATE_FOCUS = 1,
|
||||
TRANS_ID_UPDATE_SYSTEM_BAR_PROPS,
|
||||
TRANS_ID_UPDATE_WINDOW_STATUS,
|
||||
|
||||
+18
-9
@@ -45,7 +45,8 @@ void WindowProxy::UpdateWindowRect(const struct Rect& rect, WindowSizeChangeReas
|
||||
return;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_WINDOW_RECT, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
return;
|
||||
@@ -65,7 +66,8 @@ void WindowProxy::UpdateWindowMode(WindowMode mode)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_WINDOW_MODE, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowMessage::TRANS_ID_UPDATE_WINDOW_MODE),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
return;
|
||||
@@ -85,7 +87,8 @@ void WindowProxy::UpdateFocusStatus(bool focused)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_FOCUS_STATUS, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowMessage::TRANS_ID_UPDATE_FOCUS_STATUS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
return;
|
||||
@@ -115,7 +118,8 @@ void WindowProxy::UpdateAvoidArea(const std::vector<Rect>& avoidArea)
|
||||
}
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_AVOID_AREA, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowMessage::TRANS_ID_UPDATE_AVOID_AREA),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
return;
|
||||
@@ -135,7 +139,8 @@ void WindowProxy::UpdateWindowState(WindowState state)
|
||||
WLOGFE("Write isStopped");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_WINDOW_STATE, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowMessage::TRANS_ID_UPDATE_WINDOW_STATE),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -158,7 +163,8 @@ void WindowProxy::UpdateWindowDragInfo(const PointInfo& point, DragEvent event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_DRAG_EVENT, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowMessage::TRANS_ID_UPDATE_DRAG_EVENT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest TRANS_ID_UPDATE_DRAG_EVENT failed");
|
||||
}
|
||||
}
|
||||
@@ -176,7 +182,8 @@ void WindowProxy::UpdateDisplayId(DisplayId from, DisplayId to)
|
||||
WLOGFE("Write displayid failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_DISPLAY_ID, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowMessage::TRANS_ID_UPDATE_DISPLAY_ID),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest TRANS_ID_UPDATE_DISPLAY_ID failed");
|
||||
}
|
||||
}
|
||||
@@ -194,7 +201,8 @@ void WindowProxy::UpdateOccupiedAreaChangeInfo(const sptr<OccupiedAreaChangeInfo
|
||||
WLOGFE("Write OccupiedAreaChangeInfo failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_OCCUPIED_AREA, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -213,7 +221,8 @@ void WindowProxy::UpdateActiveStatus(bool isActive)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_ACTIVE_STATUS, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowMessage::TRANS_ID_UPDATE_ACTIVE_STATUS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
return;
|
||||
|
||||
+11
-10
@@ -32,24 +32,25 @@ int WindowStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParce
|
||||
WLOGFE("InterfaceToken check failed");
|
||||
return -1;
|
||||
}
|
||||
switch (code) {
|
||||
case TRANS_ID_UPDATE_WINDOW_RECT: {
|
||||
WindowMessage msgId = static_cast<WindowMessage>(code);
|
||||
switch (msgId) {
|
||||
case WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT: {
|
||||
struct Rect rect { data.ReadInt32(), data.ReadInt32(), data.ReadUint32(), data.ReadUint32() };
|
||||
WindowSizeChangeReason reason = static_cast<WindowSizeChangeReason>(data.ReadUint32());
|
||||
UpdateWindowRect(rect, reason);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_WINDOW_MODE: {
|
||||
case WindowMessage::TRANS_ID_UPDATE_WINDOW_MODE: {
|
||||
WindowMode mode = static_cast<WindowMode>(data.ReadUint32());
|
||||
UpdateWindowMode(mode);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_FOCUS_STATUS: {
|
||||
case WindowMessage::TRANS_ID_UPDATE_FOCUS_STATUS: {
|
||||
bool focused = data.ReadBool();
|
||||
UpdateFocusStatus(focused);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_AVOID_AREA: {
|
||||
case WindowMessage::TRANS_ID_UPDATE_AVOID_AREA: {
|
||||
std::vector<Rect> avoidArea;
|
||||
uint32_t len = data.ReadUint32();
|
||||
if (len != MAX_AVOID_NUM) {
|
||||
@@ -74,11 +75,11 @@ int WindowStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParce
|
||||
UpdateAvoidArea(avoidArea);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_WINDOW_STATE: {
|
||||
case WindowMessage::TRANS_ID_UPDATE_WINDOW_STATE: {
|
||||
UpdateWindowState(static_cast<WindowState>(data.ReadUint32()));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_DRAG_EVENT: {
|
||||
case WindowMessage::TRANS_ID_UPDATE_DRAG_EVENT: {
|
||||
PointInfo point;
|
||||
point.x = data.ReadInt32();
|
||||
point.y = data.ReadInt32();
|
||||
@@ -86,16 +87,16 @@ int WindowStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParce
|
||||
UpdateWindowDragInfo(point, event);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_DISPLAY_ID: {
|
||||
case WindowMessage::TRANS_ID_UPDATE_DISPLAY_ID: {
|
||||
UpdateDisplayId(data.ReadUint64(), data.ReadUint64());
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_OCCUPIED_AREA: {
|
||||
case WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA: {
|
||||
sptr<OccupiedAreaChangeInfo> info = data.ReadParcelable<OccupiedAreaChangeInfo>();
|
||||
UpdateOccupiedAreaChangeInfo(info);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_ACTIVE_STATUS: {
|
||||
case WindowMessage::TRANS_ID_UPDATE_ACTIVE_STATUS: {
|
||||
bool isActive = data.ReadBool();
|
||||
UpdateActiveStatus(isActive);
|
||||
break;
|
||||
|
||||
@@ -54,7 +54,8 @@ void WindowManagerAgentProxy::UpdateFocusChangeInfo(const sptr<FocusChangeInfo>&
|
||||
return;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_FOCUS, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerAgentMsg::TRANS_ID_UPDATE_FOCUS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -85,7 +86,8 @@ void WindowManagerAgentProxy::UpdateSystemBarRegionTints(DisplayId displayId, co
|
||||
WLOGFE("Write SystemBarRegionTint failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_SYSTEM_BAR_PROPS, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerAgentMsg::TRANS_ID_UPDATE_SYSTEM_BAR_PROPS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -110,7 +112,8 @@ void WindowManagerAgentProxy::NotifyAccessibilityWindowInfo(const sptr<Accessibi
|
||||
WLOGFE("Write windowUpdateType failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_WINDOW_STATUS, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerAgentMsg::TRANS_ID_UPDATE_WINDOW_STATUS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -136,7 +139,8 @@ void WindowManagerAgentProxy::UpdateWindowVisibilityInfo(
|
||||
}
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_WINDOW_VISIBILITY, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerAgentMsg::TRANS_ID_UPDATE_WINDOW_VISIBILITY),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,9 @@ int WindowManagerAgentStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
|
||||
WLOGFE("InterfaceToken check failed");
|
||||
return -1;
|
||||
}
|
||||
switch (code) {
|
||||
case TRANS_ID_UPDATE_FOCUS: {
|
||||
WindowManagerAgentMsg msgId = static_cast<WindowManagerAgentMsg>(code);
|
||||
switch (msgId) {
|
||||
case WindowManagerAgentMsg::TRANS_ID_UPDATE_FOCUS: {
|
||||
sptr<FocusChangeInfo> info = data.ReadParcelable<FocusChangeInfo>();
|
||||
if (info != nullptr) {
|
||||
info->abilityToken_ = data.ReadRemoteObject();
|
||||
@@ -43,7 +44,7 @@ int WindowManagerAgentStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
|
||||
UpdateFocusChangeInfo(info, focused);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_SYSTEM_BAR_PROPS: {
|
||||
case WindowManagerAgentMsg::TRANS_ID_UPDATE_SYSTEM_BAR_PROPS: {
|
||||
DisplayId displayId = data.ReadUint64();
|
||||
SystemBarRegionTints tints;
|
||||
bool res = MarshallingHelper::UnmarshallingVectorObj<SystemBarRegionTint>(data, tints,
|
||||
@@ -68,13 +69,13 @@ int WindowManagerAgentStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
|
||||
UpdateSystemBarRegionTints(displayId, tints);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_WINDOW_STATUS: {
|
||||
case WindowManagerAgentMsg::TRANS_ID_UPDATE_WINDOW_STATUS: {
|
||||
sptr<AccessibilityWindowInfo> windowInfo = data.ReadParcelable<AccessibilityWindowInfo>();
|
||||
WindowUpdateType type = static_cast<WindowUpdateType>(data.ReadUint32());
|
||||
NotifyAccessibilityWindowInfo(windowInfo, type);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_WINDOW_VISIBILITY: {
|
||||
case WindowManagerAgentMsg::TRANS_ID_UPDATE_WINDOW_VISIBILITY: {
|
||||
std::vector<sptr<WindowVisibilityInfo>> infos;
|
||||
if (!MarshallingHelper::UnmarshallingVectorParcelableObj<WindowVisibilityInfo>(data, infos)) {
|
||||
WLOGFE("fail to read WindowVisibilityInfo.");
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
class DragController : public RefBase {
|
||||
public:
|
||||
DragController(sptr<WindowRoot>& root) : windowRoot_(root) {}
|
||||
explicit DragController(sptr<WindowRoot>& root) : windowRoot_(root) {}
|
||||
~DragController() = default;
|
||||
void StartDrag(uint32_t windowId);
|
||||
void UpdateDragInfo(uint32_t windowId);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
class InputWindowMonitor : public RefBase {
|
||||
public:
|
||||
InputWindowMonitor(sptr<WindowRoot>& root) : windowRoot_(root) {}
|
||||
explicit InputWindowMonitor(sptr<WindowRoot>& root) : windowRoot_(root) {}
|
||||
~InputWindowMonitor() = default;
|
||||
void UpdateInputWindow(uint32_t windowId);
|
||||
void UpdateInputWindowByDisplayId(DisplayId displayId);
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
enum InnerWMCmd : uint32_t {
|
||||
enum class InnerWMCmd : uint32_t {
|
||||
INNER_WM_CREATE_DIVIDER,
|
||||
INNER_WM_DESTROY_DIVIDER,
|
||||
INNER_WM_DESTROY_THREAD,
|
||||
};
|
||||
|
||||
struct WindowMessage {
|
||||
struct WindowInnerMessage {
|
||||
InnerWMCmd cmdType;
|
||||
DisplayId displayId;
|
||||
Rect dividerRect;
|
||||
@@ -56,9 +56,9 @@ private:
|
||||
|
||||
void HandleMessage();
|
||||
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 CreateAndShowDivider(std::unique_ptr<WindowInnerMessage> msg);
|
||||
void HideAndDestroyDivider(std::unique_ptr<WindowInnerMessage> msg);
|
||||
void DestroyThread(std::unique_ptr<WindowInnerMessage> msg);
|
||||
void DrawSurface(const sptr<Window>& window);
|
||||
void DrawColor(std::shared_ptr<RSSurface>& rsSurface, uint32_t width, uint32_t height);
|
||||
void DrawBitmap(std::shared_ptr<RSSurface>& rsSurface, uint32_t width, uint32_t height);
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
RenderContext* rc_ = nullptr;
|
||||
#endif
|
||||
std::map<uint32_t, sptr<Window>> dividerMap_;
|
||||
std::vector<std::unique_ptr<WindowMessage>> messages_;
|
||||
std::vector<std::unique_ptr<WindowInnerMessage>> messages_;
|
||||
bool hasInitThread_ = false;
|
||||
bool needDestroyThread_ = false;
|
||||
bool isDividerImageLoaded_ = false;
|
||||
|
||||
@@ -28,7 +28,7 @@ class IWindowManager : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindowManager");
|
||||
|
||||
enum {
|
||||
enum class WindowManagerMessage : uint32_t {
|
||||
TRANS_ID_CREATE_WINDOW,
|
||||
TRANS_ID_ADD_WINDOW,
|
||||
TRANS_ID_REMOVE_WINDOW,
|
||||
|
||||
@@ -27,7 +27,8 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
class SnapshotController : public SnapshotStub {
|
||||
public:
|
||||
SnapshotController(sptr<WindowRoot>& root) : windowRoot_(root), rsInterface_(RSInterfaces::GetInstance()) {};
|
||||
explicit SnapshotController(sptr<WindowRoot>& root) : windowRoot_(root),
|
||||
rsInterface_(RSInterfaces::GetInstance()) {};
|
||||
SnapshotController() : windowRoot_(nullptr), rsInterface_(RSInterfaces::GetInstance()) {};
|
||||
~SnapshotController() = default;
|
||||
void Init(sptr<WindowRoot>& root);
|
||||
|
||||
@@ -138,7 +138,7 @@ void InputWindowMonitor::TraverseWindowNodes(const std::vector<sptr<WindowNode>>
|
||||
iter->windowsInfo.clear();
|
||||
for (auto& windowNode: windowNodes) {
|
||||
if (windowTypeSkipped_.find(windowNode->GetWindowProperty()->GetWindowType()) != windowTypeSkipped_.end()) {
|
||||
WLOGFI("window has been skipped. [id: %{public}d, type: %{public}d]", windowNode->GetWindowId(),
|
||||
WLOGFI("window has been skipped. [id: %{public}u, type: %{public}d]", windowNode->GetWindowId(),
|
||||
windowNode->GetWindowProperty()->GetWindowType());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ sptr<Window> WindowInnerManager::CreateWindow(DisplayId displayId, const WindowT
|
||||
return window;
|
||||
}
|
||||
|
||||
void WindowInnerManager::CreateAndShowDivider(std::unique_ptr<WindowMessage> msg)
|
||||
void WindowInnerManager::CreateAndShowDivider(std::unique_ptr<WindowInnerMessage> msg)
|
||||
{
|
||||
auto window = CreateWindow(msg->displayId, WindowType::WINDOW_TYPE_DOCK_SLICE, msg->dividerRect);
|
||||
if (window == nullptr) {
|
||||
@@ -212,7 +212,7 @@ void WindowInnerManager::CreateAndShowDivider(std::unique_ptr<WindowMessage> msg
|
||||
WLOGFI("CreateAndShowDivider success");
|
||||
}
|
||||
|
||||
void WindowInnerManager::HideAndDestroyDivider(std::unique_ptr<WindowMessage> msg)
|
||||
void WindowInnerManager::HideAndDestroyDivider(std::unique_ptr<WindowInnerMessage> msg)
|
||||
{
|
||||
sptr<Window> window = GetDividerWindow(msg->displayId);
|
||||
if (window == nullptr) {
|
||||
@@ -233,7 +233,7 @@ void WindowInnerManager::HideAndDestroyDivider(std::unique_ptr<WindowMessage> ms
|
||||
WLOGFI("HideAndDestroyDivider success");
|
||||
}
|
||||
|
||||
void WindowInnerManager::DestroyThread(std::unique_ptr<WindowMessage> msg)
|
||||
void WindowInnerManager::DestroyThread(std::unique_ptr<WindowInnerMessage> msg)
|
||||
{
|
||||
hasInitThread_ = false;
|
||||
needDestroyThread_ = true;
|
||||
@@ -244,7 +244,7 @@ void WindowInnerManager::DestroyThread(std::unique_ptr<WindowMessage> msg)
|
||||
void WindowInnerManager::HandleMessage()
|
||||
{
|
||||
WLOGFI("HandleMessage");
|
||||
std::vector<std::unique_ptr<WindowMessage>> handleMsgs;
|
||||
std::vector<std::unique_ptr<WindowInnerMessage>> handleMsgs;
|
||||
while (!needDestroyThread_) {
|
||||
// lock to store massages
|
||||
{
|
||||
@@ -262,11 +262,11 @@ void WindowInnerManager::HandleMessage()
|
||||
continue;
|
||||
}
|
||||
auto cmdType = msg->cmdType;
|
||||
using Func_t = void(WindowInnerManager::*)(std::unique_ptr<WindowMessage> winMsg);
|
||||
using Func_t = void(WindowInnerManager::*)(std::unique_ptr<WindowInnerMessage> winMsg);
|
||||
static const std::map<InnerWMCmd, Func_t> funcMap = {
|
||||
std::make_pair(INNER_WM_CREATE_DIVIDER, &WindowInnerManager::CreateAndShowDivider),
|
||||
std::make_pair(INNER_WM_DESTROY_DIVIDER, &WindowInnerManager::HideAndDestroyDivider),
|
||||
std::make_pair(INNER_WM_DESTROY_THREAD, &WindowInnerManager::DestroyThread)};
|
||||
std::make_pair(InnerWMCmd::INNER_WM_CREATE_DIVIDER, &WindowInnerManager::CreateAndShowDivider),
|
||||
std::make_pair(InnerWMCmd::INNER_WM_DESTROY_DIVIDER, &WindowInnerManager::HideAndDestroyDivider),
|
||||
std::make_pair(InnerWMCmd::INNER_WM_DESTROY_THREAD, &WindowInnerManager::DestroyThread)};
|
||||
auto it = funcMap.find(cmdType);
|
||||
if (it != funcMap.end()) {
|
||||
(this->*(it->second))(std::move(msg));
|
||||
@@ -283,7 +283,7 @@ void WindowInnerManager::SendMessage(InnerWMCmd cmdType, DisplayId displayId)
|
||||
WLOGFI("Inner window manager thread has not been created");
|
||||
return;
|
||||
}
|
||||
std::unique_ptr<WindowMessage> winMsg = std::make_unique<WindowMessage>();
|
||||
std::unique_ptr<WindowInnerMessage> winMsg = std::make_unique<WindowInnerMessage>();
|
||||
if (!winMsg) {
|
||||
WLOGFI("alloc winMsg failed");
|
||||
return;
|
||||
|
||||
@@ -62,7 +62,7 @@ void WindowLayoutPolicyCascade::LayoutWindowNode(sptr<WindowNode>& node)
|
||||
}
|
||||
if (node->parent_ != nullptr) { // isn't root node
|
||||
if (!node->currentVisibility_) {
|
||||
WLOGFI("window[%{public}d] currently not visible, no need layout", node->GetWindowId());
|
||||
WLOGFI("window[%{public}u] currently not visible, no need layout", node->GetWindowId());
|
||||
return;
|
||||
}
|
||||
UpdateLayoutRect(node);
|
||||
@@ -369,7 +369,7 @@ void WindowLayoutPolicyCascade::Reorder()
|
||||
node->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
node->GetWindowToken()->UpdateWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
}
|
||||
WLOGFI("Cascade reorder Id: %{public}d, rect:[%{public}d, %{public}d, %{public}d, %{public}d]",
|
||||
WLOGFI("Cascade reorder Id: %{public}u, rect:[%{public}d, %{public}d, %{public}d, %{public}d]",
|
||||
node->GetWindowId(), rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
}
|
||||
}
|
||||
@@ -381,7 +381,7 @@ Rect WindowLayoutPolicyCascade::GetCurCascadeRect(const sptr<WindowNode>& node)
|
||||
{
|
||||
Rect cascadeRect = {0, 0, 0, 0};
|
||||
for (auto iter = appWindowNode_->children_.rbegin(); iter != appWindowNode_->children_.rend(); iter++) {
|
||||
WLOGFI("GetCurCascadeRect id: %{public}d,", (*iter)->GetWindowId());
|
||||
WLOGFI("GetCurCascadeRect id: %{public}u,", (*iter)->GetWindowId());
|
||||
if ((*iter)->GetWindowType() != WindowType::WINDOW_TYPE_DOCK_SLICE &&
|
||||
(*iter)->GetWindowId() != node->GetWindowId()) {
|
||||
auto property = (*iter)->GetWindowProperty();
|
||||
|
||||
@@ -56,7 +56,8 @@ WMError WindowManagerProxy::CreateWindow(sptr<IWindow>& window, sptr<WindowPrope
|
||||
}
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_CREATE_WINDOW, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_CREATE_WINDOW),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
windowId = reply.ReadUint32();
|
||||
@@ -79,7 +80,8 @@ WMError WindowManagerProxy::AddWindow(sptr<WindowProperty>& property)
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_ADD_WINDOW, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_ADD_WINDOW),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -102,7 +104,8 @@ WMError WindowManagerProxy::RemoveWindow(uint32_t windowId)
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_REMOVE_WINDOW, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_REMOVE_WINDOW),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -125,7 +128,8 @@ WMError WindowManagerProxy::DestroyWindow(uint32_t windowId, bool /* onlySelf */
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_DESTROY_WINDOW, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_DESTROY_WINDOW),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -147,7 +151,8 @@ WMError WindowManagerProxy::RequestFocus(uint32_t windowId)
|
||||
WLOGFE("Write windowId failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_REQUEST_FOCUS, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_REQUEST_FOCUS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -172,7 +177,8 @@ WMError WindowManagerProxy::SetWindowBackgroundBlur(uint32_t windowId, WindowBlu
|
||||
WLOGFE("Write blur level failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_SET_BACKGROUND_BLUR, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_SET_BACKGROUND_BLUR),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -197,7 +203,8 @@ WMError WindowManagerProxy::SetAlpha(uint32_t windowId, float alpha)
|
||||
WLOGFE("Write alpha failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_SET_APLPHA, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_SET_APLPHA),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -228,7 +235,8 @@ std::vector<Rect> WindowManagerProxy::GetAvoidAreaByType(uint32_t windowId, Avoi
|
||||
return avoidArea;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_GET_AVOID_AREA, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_GET_AVOID_AREA),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return avoidArea;
|
||||
}
|
||||
|
||||
@@ -275,7 +283,8 @@ void WindowManagerProxy::RegisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
return;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -301,7 +310,8 @@ void WindowManagerProxy::UnregisterWindowManagerAgent(WindowManagerAgentType typ
|
||||
return;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -323,7 +333,8 @@ void WindowManagerProxy::ProcessPointDown(uint32_t windowId, bool isStartDrag)
|
||||
WLOGFE("Write bool isStartDrag failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_PROCESS_POINT_DOWN, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_PROCESS_POINT_DOWN),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -341,7 +352,8 @@ void WindowManagerProxy::ProcessPointUp(uint32_t windowId)
|
||||
WLOGFE("Write windowId failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_PROCESS_POINT_UP, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_PROCESS_POINT_UP),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -359,7 +371,8 @@ void WindowManagerProxy::MinimizeAllAppWindows(DisplayId displayId)
|
||||
WLOGFE("Write displayId failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_MINIMIZE_ALL_APP_WINDOWS, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_MINIMIZE_ALL_APP_WINDOWS),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
}
|
||||
}
|
||||
@@ -377,7 +390,8 @@ WMError WindowManagerProxy::MaxmizeWindow(uint32_t windowId)
|
||||
WLOGFE("Write windowId failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_MAXMIZE_WINDOW, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_MAXMIZE_WINDOW),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -402,7 +416,8 @@ WMError WindowManagerProxy::SetWindowLayoutMode(DisplayId displayId, WindowLayou
|
||||
WLOGFE("Write mode failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_LAYOUT_MODE, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_UPDATE_LAYOUT_MODE),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -430,7 +445,8 @@ WMError WindowManagerProxy::UpdateProperty(sptr<WindowProperty>& windowProperty,
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_UPDATE_PROPERTY, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_UPDATE_PROPERTY),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -453,7 +469,8 @@ WMError WindowManagerProxy::GetTopWindowId(uint32_t mainWinId, uint32_t& topWinI
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
if (Remote()->SendRequest(TRANS_ID_GET_TOP_WINDOW_ID, data, reply, option) != ERR_NONE) {
|
||||
if (Remote()->SendRequest(static_cast<uint32_t>(WindowManagerMessage::TRANS_ID_GET_TOP_WINDOW_ID),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
topWinId = reply.ReadUint32();
|
||||
|
||||
@@ -105,7 +105,7 @@ bool WindowManagerService::Init()
|
||||
|
||||
void WindowManagerService::OnStop()
|
||||
{
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(INNER_WM_DESTROY_THREAD);
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(InnerWMCmd::INNER_WM_DESTROY_THREAD);
|
||||
WLOGFI("ready to stop service.");
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,9 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
|
||||
WLOGFE("InterfaceToken check failed");
|
||||
return -1;
|
||||
}
|
||||
switch (code) {
|
||||
case TRANS_ID_CREATE_WINDOW: {
|
||||
WindowManagerMessage msgId = static_cast<WindowManagerMessage>(code);
|
||||
switch (msgId) {
|
||||
case WindowManagerMessage::TRANS_ID_CREATE_WINDOW: {
|
||||
sptr<IRemoteObject> windowObject = data.ReadRemoteObject();
|
||||
sptr<IWindow> windowProxy = iface_cast<IWindow>(windowObject);
|
||||
sptr<WindowProperty> windowProperty = data.ReadStrongParcelable<WindowProperty>();
|
||||
@@ -49,45 +50,45 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_ADD_WINDOW: {
|
||||
case WindowManagerMessage::TRANS_ID_ADD_WINDOW: {
|
||||
sptr<WindowProperty> windowProperty = data.ReadStrongParcelable<WindowProperty>();
|
||||
WMError errCode = AddWindow(windowProperty);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_REMOVE_WINDOW: {
|
||||
case WindowManagerMessage::TRANS_ID_REMOVE_WINDOW: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
WMError errCode = RemoveWindow(windowId);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_DESTROY_WINDOW: {
|
||||
case WindowManagerMessage::TRANS_ID_DESTROY_WINDOW: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
WMError errCode = DestroyWindow(windowId);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_REQUEST_FOCUS: {
|
||||
case WindowManagerMessage::TRANS_ID_REQUEST_FOCUS: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
WMError errCode = RequestFocus(windowId);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SET_BACKGROUND_BLUR: {
|
||||
case WindowManagerMessage::TRANS_ID_SET_BACKGROUND_BLUR: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
WindowBlurLevel level = static_cast<WindowBlurLevel>(data.ReadUint32());
|
||||
WMError errCode = SetWindowBackgroundBlur(windowId, level);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SET_APLPHA: {
|
||||
case WindowManagerMessage::TRANS_ID_SET_APLPHA: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
float alpha = data.ReadFloat();
|
||||
WMError errCode = SetAlpha(windowId, alpha);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_AVOID_AREA: {
|
||||
case WindowManagerMessage::TRANS_ID_GET_AVOID_AREA: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
AvoidAreaType avoidAreaType = static_cast<AvoidAreaType>(data.ReadUint32());
|
||||
std::vector<Rect> avoidArea = GetAvoidAreaByType(windowId, avoidAreaType);
|
||||
@@ -103,7 +104,7 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT: {
|
||||
case WindowManagerMessage::TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT: {
|
||||
WindowManagerAgentType type = static_cast<WindowManagerAgentType>(data.ReadUint32());
|
||||
sptr<IRemoteObject> windowManagerAgentObject = data.ReadRemoteObject();
|
||||
sptr<IWindowManagerAgent> windowManagerAgentProxy =
|
||||
@@ -111,7 +112,7 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
|
||||
RegisterWindowManagerAgent(type, windowManagerAgentProxy);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT: {
|
||||
case WindowManagerMessage::TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT: {
|
||||
WindowManagerAgentType type = static_cast<WindowManagerAgentType>(data.ReadUint32());
|
||||
sptr<IRemoteObject> windowManagerAgentObject = data.ReadRemoteObject();
|
||||
sptr<IWindowManagerAgent> windowManagerAgentProxy =
|
||||
@@ -119,18 +120,18 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
|
||||
UnregisterWindowManagerAgent(type, windowManagerAgentProxy);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_PROCESS_POINT_DOWN: {
|
||||
case WindowManagerMessage::TRANS_ID_PROCESS_POINT_DOWN: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
bool isStartDrag = data.ReadBool();
|
||||
ProcessPointDown(windowId, isStartDrag);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_PROCESS_POINT_UP: {
|
||||
case WindowManagerMessage::TRANS_ID_PROCESS_POINT_UP: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
ProcessPointUp(windowId);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_TOP_WINDOW_ID: {
|
||||
case WindowManagerMessage::TRANS_ID_GET_TOP_WINDOW_ID: {
|
||||
uint32_t mainWinId = data.ReadUint32();
|
||||
uint32_t topWinId;
|
||||
WMError errCode = GetTopWindowId(mainWinId, topWinId);
|
||||
@@ -138,22 +139,22 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_MINIMIZE_ALL_APP_WINDOWS: {
|
||||
case WindowManagerMessage::TRANS_ID_MINIMIZE_ALL_APP_WINDOWS: {
|
||||
MinimizeAllAppWindows(data.ReadUint64());
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_MAXMIZE_WINDOW: {
|
||||
case WindowManagerMessage::TRANS_ID_MAXMIZE_WINDOW: {
|
||||
MaxmizeWindow(data.ReadUint32());
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_LAYOUT_MODE: {
|
||||
case WindowManagerMessage::TRANS_ID_UPDATE_LAYOUT_MODE: {
|
||||
DisplayId displayId = data.ReadUint64();
|
||||
WindowLayoutMode mode = static_cast<WindowLayoutMode>(data.ReadUint32());
|
||||
WMError errCode = SetWindowLayoutMode(displayId, mode);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_PROPERTY: {
|
||||
case WindowManagerMessage::TRANS_ID_UPDATE_PROPERTY: {
|
||||
sptr<WindowProperty> windowProperty = data.ReadStrongParcelable<WindowProperty>();
|
||||
PropertyChangeAction action = static_cast<PropertyChangeAction>(data.ReadUint32());
|
||||
WMError errCode = UpdateProperty(windowProperty, action);
|
||||
|
||||
@@ -140,7 +140,7 @@ WMError WindowNodeContainer::AddWindowNode(sptr<WindowNode>& node, sptr<WindowNo
|
||||
UpdateWindowVisibilityInfos(infos);
|
||||
DumpScreenWindowTree();
|
||||
NotifyAccessibilityWindowInfo(node, WindowUpdateType::WINDOW_UPDATE_ADDED);
|
||||
WLOGFI("AddWindowNode windowId: %{public}d end", node->GetWindowId());
|
||||
WLOGFI("AddWindowNode windowId: %{public}u end", node->GetWindowId());
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ WMError WindowNodeContainer::UpdateWindowNode(sptr<WindowNode>& node, WindowUpda
|
||||
NotifyIfSystemBarTintChanged();
|
||||
}
|
||||
DumpScreenWindowTree();
|
||||
WLOGFI("UpdateWindowNode windowId: %{public}d end", node->GetWindowId());
|
||||
WLOGFI("UpdateWindowNode windowId: %{public}u end", node->GetWindowId());
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
@@ -173,14 +173,14 @@ void WindowNodeContainer::UpdateSizeChangeReason(sptr<WindowNode>& node, WindowS
|
||||
childNode->GetWindowToken()->UpdateWindowRect(childNode->GetLayoutRect(), reason);
|
||||
childNode->ResetWindowSizeChangeReason();
|
||||
WLOGFI("Notify split window that the drag action is start or end, windowId: %{public}d, "
|
||||
"reason: %{public}d", childNode->GetWindowId(), reason);
|
||||
"reason: %{public}u", childNode->GetWindowId(), reason);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
node->GetWindowToken()->UpdateWindowRect(node->GetLayoutRect(), reason);
|
||||
node->ResetWindowSizeChangeReason();
|
||||
WLOGFI("Notify window that the drag action is start or end, windowId: %{public}d, "
|
||||
"reason: %{public}d", node->GetWindowId(), reason);
|
||||
"reason: %{public}u", node->GetWindowId(), reason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,6 @@ bool WindowNodeContainer::UpdateRSTree(sptr<WindowNode>& node, bool isAdd)
|
||||
static const RSAnimationTimingProtocol timingProtocol(350);
|
||||
// default transition curve: EASE OUT
|
||||
static const Rosen::RSAnimationTimingCurve curve = Rosen::RSAnimationTimingCurve::EASE_OUT;
|
||||
|
||||
// add or remove window with transition animation
|
||||
RSNode::Animate(timingProtocol, curve, updateRSTreeFunc);
|
||||
} else {
|
||||
@@ -312,7 +311,7 @@ WMError WindowNodeContainer::RemoveWindowNode(sptr<WindowNode>& node)
|
||||
UpdateWindowVisibilityInfos(infos);
|
||||
DumpScreenWindowTree();
|
||||
NotifyAccessibilityWindowInfo(node, WindowUpdateType::WINDOW_UPDATE_REMOVED);
|
||||
WLOGFI("RemoveWindowNode windowId: %{public}d end", node->GetWindowId());
|
||||
WLOGFI("RemoveWindowNode windowId: %{public}u end", node->GetWindowId());
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
@@ -618,7 +617,7 @@ void WindowNodeContainer::RaiseOrderedWindowToTop(std::vector<uint32_t> orderedI
|
||||
sptr<WindowNode> node = *iter;
|
||||
iter = windowNodes.erase(iter);
|
||||
UpdateWindowTree(node);
|
||||
WLOGFI("raise group window to top %{public}d", node->GetWindowId());
|
||||
WLOGFI("raise group window to top %{public}u", node->GetWindowId());
|
||||
} else {
|
||||
iter++;
|
||||
}
|
||||
@@ -637,7 +636,7 @@ void WindowNodeContainer::RaiseWindowToTop(uint32_t windowId, std::vector<sptr<W
|
||||
sptr<WindowNode> node = *iter;
|
||||
windowNodes.erase(iter);
|
||||
UpdateWindowTree(node);
|
||||
WLOGFI("raise window to top %{public}d", node->GetWindowId());
|
||||
WLOGFI("raise window to top %{public}u", node->GetWindowId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -875,7 +874,7 @@ WMError WindowNodeContainer::RaiseZOrderForAppWindow(sptr<WindowNode>& node, spt
|
||||
return WMError::WM_ERROR_NULLPTR;
|
||||
}
|
||||
if (IsTopAppWindow(node->GetWindowId())) {
|
||||
WLOGFI("it is already top app window, id: %{public}d", node->GetWindowId());
|
||||
WLOGFI("it is already top app window, id: %{public}u", node->GetWindowId());
|
||||
return WMError::WM_ERROR_INVALID_TYPE;
|
||||
}
|
||||
if (WindowHelper::IsSubWindow(node->GetWindowType())) {
|
||||
@@ -1050,16 +1049,16 @@ WMError WindowNodeContainer::MinimizeAppNodeExceptOptions(bool fromUser, const s
|
||||
WMError WindowNodeContainer::EnterSplitWindowMode(sptr<WindowNode>& node)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
WLOGFI("Enter split window mode: %{public}d", node->GetWindowId());
|
||||
WLOGFI("Enter split window mode: %{public}u", node->GetWindowId());
|
||||
SwitchLayoutPolicy(WindowLayoutMode::CASCADE); // window split mode is belong to cascade
|
||||
auto pairNode = FindSplitPairNode(node);
|
||||
if (pairNode != nullptr) {
|
||||
WLOGFI("Window %{public}d find pair %{public}d", node->GetWindowId(), pairNode->GetWindowId());
|
||||
WLOGFI("Window %{public}d find pair %{public}u", node->GetWindowId(), pairNode->GetWindowId());
|
||||
WMError ret = UpdateWindowPairInfo(node, pairNode);
|
||||
if (ret != WMError::WM_OK) {
|
||||
return ret;
|
||||
}
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(INNER_WM_CREATE_DIVIDER, displayId_);
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(InnerWMCmd::INNER_WM_CREATE_DIVIDER, displayId_);
|
||||
std::vector<uint32_t> exceptionalIds;
|
||||
for (auto iter = pairedWindowMap_.begin(); iter != pairedWindowMap_.end(); iter++) {
|
||||
exceptionalIds.emplace_back(iter->first);
|
||||
@@ -1083,7 +1082,7 @@ void WindowNodeContainer::ResetLayoutPolicy()
|
||||
WMError WindowNodeContainer::ExitSplitWindowMode(sptr<WindowNode>& node)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
WLOGFI("exit split window mode %{public}d", node->GetWindowId());
|
||||
WLOGFI("exit split window mode %{public}u", node->GetWindowId());
|
||||
node->GetWindowProperty()->ResumeLastWindowMode();
|
||||
node->GetWindowToken()->UpdateWindowMode(node->GetWindowMode());
|
||||
if (pairedWindowMap_.count(node->GetWindowId()) != 0) {
|
||||
@@ -1092,12 +1091,12 @@ WMError WindowNodeContainer::ExitSplitWindowMode(sptr<WindowNode>& node)
|
||||
pairNode->GetWindowToken()->UpdateWindowMode(pairNode->GetWindowMode());
|
||||
pairedWindowMap_.erase(pairNode->GetWindowId());
|
||||
pairedWindowMap_.erase(node->GetWindowId());
|
||||
WLOGFI("resume pair node mode, Id[%{public}d, %{public}d], Mode[%{public}d, %{public}d]", node->GetWindowId(),
|
||||
WLOGFI("resume pair node mode, Id[%{public}u, %{public}u], Mode[%{public}d, %{public}d]", node->GetWindowId(),
|
||||
pairNode->GetWindowId(), node->GetWindowMode(), pairNode->GetWindowMode());
|
||||
}
|
||||
if (pairedWindowMap_.empty()) {
|
||||
WLOGFI("send destroy msg to divider, Id: %{public}d", node->GetWindowId());
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(INNER_WM_DESTROY_DIVIDER, displayId_);
|
||||
WLOGFI("send destroy msg to divider, Id: %{public}u", node->GetWindowId());
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(InnerWMCmd::INNER_WM_DESTROY_DIVIDER, displayId_);
|
||||
}
|
||||
ResetLayoutPolicy();
|
||||
return WMError::WM_OK;
|
||||
@@ -1118,7 +1117,7 @@ WMError WindowNodeContainer::UpdateWindowPairInfo(sptr<WindowNode>& triggerNode,
|
||||
WLOGFE("Update window pair info failed");
|
||||
return ret;
|
||||
}
|
||||
WLOGFI("Pair FullScreen [%{public}d, %{public}d], Mode[%{public}d, %{public}d], splitRatio = %{public}f",
|
||||
WLOGFI("Pair FullScreen [%{public}u, %{public}u], Mode[%{public}d, %{public}d], splitRatio = %{public}f",
|
||||
triggerNode->GetWindowId(), pairNode->GetWindowId(), triggerMode, pairDstMode, splitRatio);
|
||||
} else {
|
||||
if (pairedWindowMap_.count(pairNode->GetWindowId()) != 0) {
|
||||
@@ -1157,7 +1156,7 @@ WMError WindowNodeContainer::SwitchLayoutPolicy(WindowLayoutMode dstMode, bool r
|
||||
if (layoutMode_ != dstMode) {
|
||||
if (layoutMode_ == WindowLayoutMode::CASCADE && !pairedWindowMap_.empty()) {
|
||||
pairedWindowMap_.clear();
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(INNER_WM_DESTROY_DIVIDER, displayId_);
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(InnerWMCmd::INNER_WM_DESTROY_DIVIDER, displayId_);
|
||||
}
|
||||
layoutMode_ = dstMode;
|
||||
layoutPolicy_->Clean();
|
||||
@@ -1171,7 +1170,7 @@ WMError WindowNodeContainer::SwitchLayoutPolicy(WindowLayoutMode dstMode, bool r
|
||||
if (!pairedWindowMap_.empty()) {
|
||||
// exit divider window when reorder
|
||||
pairedWindowMap_.clear();
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(INNER_WM_DESTROY_DIVIDER, displayId_);
|
||||
SingletonContainer::Get<WindowInnerManager>().SendMessage(InnerWMCmd::INNER_WM_DESTROY_DIVIDER, displayId_);
|
||||
}
|
||||
layoutPolicy_->Reorder();
|
||||
DumpScreenWindowTree();
|
||||
@@ -1201,17 +1200,17 @@ void WindowNodeContainer::MoveWindowNode(sptr<WindowNodeContainer>& container)
|
||||
WLOGFI("disconnect expand display: %{public}" PRId64 ", move window node to display: "
|
||||
"%{public}" PRId64 "", from, displayId_);
|
||||
for (auto& node : container->aboveAppWindowNode_->children_) {
|
||||
WLOGFI("aboveAppWindowNode_: move windowNode: %{public}d", node->GetWindowId());
|
||||
WLOGFI("aboveAppWindowNode_: move windowNode: %{public}u", node->GetWindowId());
|
||||
aboveAppWindowNode_->children_.push_back(node);
|
||||
layoutPolicy_->AddWindowNode(node);
|
||||
}
|
||||
for (auto& node : container->appWindowNode_->children_) {
|
||||
WLOGFI("appWindowNode_: move windowNode: %{public}d", node->GetWindowId());
|
||||
WLOGFI("appWindowNode_: move windowNode: %{public}u", node->GetWindowId());
|
||||
appWindowNode_->children_.push_back(node);
|
||||
layoutPolicy_->AddWindowNode(node);
|
||||
}
|
||||
for (auto& node : container->belowAppWindowNode_->children_) {
|
||||
WLOGFI("belowAppWindowNode_: move windowNode: %{public}d", node->GetWindowId());
|
||||
WLOGFI("belowAppWindowNode_: move windowNode: %{public}u", node->GetWindowId());
|
||||
belowAppWindowNode_->children_.push_back(node);
|
||||
layoutPolicy_->AddWindowNode(node);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ WMError WindowRoot::SaveWindow(const sptr<WindowNode>& node)
|
||||
WLOGFE("add window failed, node is nullptr");
|
||||
return WMError::WM_ERROR_NULLPTR;
|
||||
}
|
||||
WLOGFI("save windowId %{public}d", node->GetWindowId());
|
||||
WLOGFI("save windowId %{public}u", node->GetWindowId());
|
||||
windowNodeMap_.insert(std::make_pair(node->GetWindowId(), node));
|
||||
auto remoteObject = node->GetWindowToken()->AsObject();
|
||||
windowIdMap_.insert(std::make_pair(remoteObject, node->GetWindowId()));
|
||||
|
||||
Reference in New Issue
Block a user