/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "zidl/window_manager_proxy.h" #include #include #include "marshalling_helper.h" #include "window_manager_hilog.h" namespace OHOS { namespace Rosen { namespace { constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowManagerProxy"}; } WMError WindowManagerProxy::CreateWindow(sptr& window, sptr& property, const std::shared_ptr& surfaceNode, uint32_t& windowId, sptr token) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteRemoteObject(window->AsObject())) { WLOGFE("Write IWindow failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteParcelable(property.GetRefPtr())) { WLOGFE("Write windowProperty failed"); return WMError::WM_ERROR_IPC_FAILED; } if (surfaceNode == nullptr || !surfaceNode->Marshalling(data)) { WLOGFE("Write windowProperty failed"); return WMError::WM_ERROR_IPC_FAILED; } if (token != nullptr) { if (!data.WriteRemoteObject(token)) { WLOGFE("Write abilityToken failed"); return WMError::WM_ERROR_IPC_FAILED; } } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_CREATE_WINDOW), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } windowId = reply.ReadUint32(); int32_t ret = reply.ReadInt32(); return static_cast(ret); } WMError WindowManagerProxy::AddWindow(sptr& property) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteParcelable(property.GetRefPtr())) { WLOGFE("Write windowProperty failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_ADD_WINDOW), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } int32_t ret = reply.ReadInt32(); return static_cast(ret); } WMError WindowManagerProxy::RemoveWindow(uint32_t windowId) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_REMOVE_WINDOW), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } int32_t ret = reply.ReadInt32(); return static_cast(ret); } WMError WindowManagerProxy::DestroyWindow(uint32_t windowId, bool /* onlySelf */) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_DESTROY_WINDOW), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } int32_t ret = reply.ReadInt32(); return static_cast(ret); } WMError WindowManagerProxy::RequestFocus(uint32_t windowId) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_REQUEST_FOCUS), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } int32_t ret = reply.ReadInt32(); return static_cast(ret); } AvoidArea WindowManagerProxy::GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type) { MessageParcel data; MessageParcel reply; MessageOption option; AvoidArea avoidArea; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return avoidArea; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return avoidArea; } if (!data.WriteUint32(static_cast(type))) { WLOGFE("Write AvoidAreaType failed"); return avoidArea; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_GET_AVOID_AREA), data, reply, option) != ERR_NONE) { return avoidArea; } sptr area = reply.ReadParcelable(); if (area == nullptr) { return avoidArea; } return *area; } bool WindowManagerProxy::RegisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return false; } if (!data.WriteUint32(static_cast(type))) { WLOGFE("Write type failed"); return false; } if (!data.WriteRemoteObject(windowManagerAgent->AsObject())) { WLOGFE("Write IWindowManagerAgent failed"); return false; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); return false; } return reply.ReadBool(); } bool WindowManagerProxy::UnregisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return false; } if (!data.WriteUint32(static_cast(type))) { WLOGFE("Write type failed"); return false; } if (!data.WriteRemoteObject(windowManagerAgent->AsObject())) { WLOGFE("Write IWindowManagerAgent failed"); return false; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); return false; } return reply.ReadBool(); } WMError WindowManagerProxy::SetWindowAnimationController(const sptr& controller) { MessageParcel data; MessageParcel reply; MessageOption option; if (controller == nullptr) { WLOGFE("RSWindowAnimation Failed to set window animation controller, controller is null!"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("RSWindowAnimation Failed to WriteInterfaceToken!"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteRemoteObject(controller->AsObject())) { WLOGFE("RSWindowAnimation Failed to write controller!"); return WMError::WM_ERROR_IPC_FAILED; } auto error = Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_ANIMATION_SET_CONTROLLER), data, reply, option); if (error != ERR_NONE) { WLOGFE("RSWindowAnimation Send request error: %{public}d", error); return WMError::WM_ERROR_IPC_FAILED; } int32_t ret = reply.ReadInt32(); return static_cast(ret); } void WindowManagerProxy::NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return; } if (!data.WriteParcelable(windowProperty.GetRefPtr())) { WLOGFE("Failed to write windowProperty!"); return; } if (!data.WriteParcelable(moveDragProperty.GetRefPtr())) { WLOGFE("Failed to write moveDragProperty!"); return; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); } } void WindowManagerProxy::ProcessPointDown(uint32_t windowId, bool isPointDown) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return; } if (!data.WriteBool(isPointDown)) { WLOGFE("Write isPointDown failed"); return; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_PROCESS_POINT_DOWN), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); } } void WindowManagerProxy::ProcessPointUp(uint32_t windowId) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_PROCESS_POINT_UP), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); } } void WindowManagerProxy::MinimizeAllAppWindows(DisplayId displayId) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return; } if (!data.WriteUint64(displayId)) { WLOGFE("Write displayId failed"); return; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_MINIMIZE_ALL_APP_WINDOWS), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); } } WMError WindowManagerProxy::ToggleShownStateForAllAppWindows() { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest( static_cast(WindowManagerMessage::TRANS_ID_TOGGLE_SHOWN_STATE_FOR_ALL_APP_WINDOWS), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); return WMError::WM_ERROR_IPC_FAILED; } int32_t ret; if (!reply.ReadInt32(ret)) { return WMError::WM_ERROR_IPC_FAILED; } return static_cast(ret); } WMError WindowManagerProxy::SetWindowLayoutMode(WindowLayoutMode mode) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint32(static_cast(mode))) { WLOGFE("Write mode failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_UPDATE_LAYOUT_MODE), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } int32_t ret = reply.ReadInt32(); return static_cast(ret); } WMError WindowManagerProxy::UpdateProperty(sptr& windowProperty, PropertyChangeAction action, bool isAsyncTask) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint32(static_cast(action))) { WLOGFE("Write PropertyChangeAction failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!windowProperty->Write(data, action)) { WLOGFE("Write windowProperty failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_UPDATE_PROPERTY), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } int32_t ret = reply.ReadInt32(); return static_cast(ret); } WMError WindowManagerProxy::GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint32(mainWinId)) { WLOGFE("Write mainWinId failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_GET_TOP_WINDOW_ID), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } topWinId = reply.ReadUint32(); int32_t ret = reply.ReadInt32(); return static_cast(ret); } WMError WindowManagerProxy::GetAccessibilityWindowInfo(std::vector>& infos) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_GET_ACCESSIBILITY_WINDOW_INFO_ID), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } if (!MarshallingHelper::UnmarshallingVectorParcelableObj(reply, infos)) { WLOGFE("read accessibility window infos failed"); return WMError::WM_ERROR_IPC_FAILED; } return static_cast(reply.ReadInt32()); } WMError WindowManagerProxy::GetVisibilityWindowInfo(std::vector>& infos) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } if (!MarshallingHelper::UnmarshallingVectorParcelableObj(reply, infos)) { WLOGFE("read visibility window infos failed"); return WMError::WM_ERROR_IPC_FAILED; } return static_cast(reply.ReadInt32()); } WMError WindowManagerProxy::GetSystemConfig(SystemConfig& systemConfig) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_GET_SYSTEM_CONFIG), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } sptr config = reply.ReadParcelable(); systemConfig = *config; int32_t ret = reply.ReadInt32(); return static_cast(ret); } WMError WindowManagerProxy::NotifyWindowTransition(sptr& from, sptr& to, bool isFromClient) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("Failed to WriteInterfaceToken!"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteParcelable(from)) { WLOGFE("Failed to write from ability window info!"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteParcelable(to)) { WLOGFE("Failed to write to ability window info!"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteBool(isFromClient)) { WLOGFE("Failed to write to isFromClient!"); return WMError::WM_ERROR_IPC_FAILED; } auto error = Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_NOTIFY_WINDOW_TRANSITION), data, reply, option); if (error != ERR_NONE) { WLOGFE("Send request error: %{public}d", static_cast(error)); return WMError::WM_ERROR_IPC_FAILED; } auto ret = static_cast(reply.ReadInt32()); return ret; } WMError WindowManagerProxy::GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint64(displayId)) { WLOGFE("Write displayId failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_GET_FULLSCREEN_AND_SPLIT_HOT_ZONE), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } auto ret = static_cast(reply.ReadInt32()); if (ret == WMError::WM_OK) { hotZones.fullscreen_.posX_ = reply.ReadInt32(); hotZones.fullscreen_.posY_ = reply.ReadInt32(); hotZones.fullscreen_.width_ = reply.ReadUint32(); hotZones.fullscreen_.height_ = reply.ReadUint32(); hotZones.primary_.posX_ = reply.ReadInt32(); hotZones.primary_.posY_ = reply.ReadInt32(); hotZones.primary_.width_ = reply.ReadUint32(); hotZones.primary_.height_ = reply.ReadUint32(); hotZones.secondary_.posX_ = reply.ReadInt32(); hotZones.secondary_.posY_ = reply.ReadInt32(); hotZones.secondary_.width_ = reply.ReadUint32(); hotZones.secondary_.height_ = reply.ReadUint32(); } return ret; } void WindowManagerProxy::MinimizeWindowsByLauncher(std::vector windowIds, bool isAnimated, sptr& finishCallback) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return; } if (!data.WriteUInt32Vector(windowIds)) { WLOGFE("Write windowIds failed"); return; } if (!data.WriteBool(isAnimated)) { WLOGFE("Write isAnimated failed"); return; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_GET_ANIMATION_CALLBACK), data, reply, option) != ERR_NONE) { WLOGFE("Send request error"); return; } ; if (reply.ReadBool()) { sptr finishCallbackObject = reply.ReadRemoteObject(); finishCallback = iface_cast(finishCallbackObject); } else { finishCallback = nullptr; } return; } WMError WindowManagerProxy::UpdateAvoidAreaListener(uint32_t windowId, bool haveListener) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteBool(haveListener)) { WLOGFE("Write avoid area listener failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_UPDATE_AVOIDAREA_LISTENER), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } return static_cast(reply.ReadInt32()); } WMError WindowManagerProxy::UpdateRsTree(uint32_t windowId, bool isAdd) { MessageParcel data; MessageParcel reply; MessageOption option(MessageOption::TF_ASYNC); if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteBool(isAdd)) { WLOGFE("Write avoid area listener failed"); return WMError::WM_ERROR_IPC_FAILED; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_UPDATE_RS_TREE), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } return static_cast(reply.ReadInt32()); } WMError WindowManagerProxy::BindDialogTarget(uint32_t& windowId, sptr targetToken) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return WMError::WM_ERROR_IPC_FAILED; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return WMError::WM_ERROR_IPC_FAILED; } if (targetToken != nullptr) { if (!data.WriteRemoteObject(targetToken)) { WLOGFE("Write targetToken failed"); return WMError::WM_ERROR_IPC_FAILED; } } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_BIND_DIALOG_TARGET), data, reply, option) != ERR_NONE) { return WMError::WM_ERROR_IPC_FAILED; } int32_t ret = reply.ReadInt32(); return static_cast(ret); } void WindowManagerProxy::SetAnchorAndScale(int32_t x, int32_t y, float scale) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return; } if (!data.WriteInt32(x)) { WLOGFE("Write anchor x failed"); return; } if (!data.WriteInt32(y)) { WLOGFE("Write anchor y failed"); return; } if (!data.WriteFloat(scale)) { WLOGFE("Write scale failed"); return; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_SET_ANCHOR_AND_SCALE), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); } } void WindowManagerProxy::SetAnchorOffset(int32_t deltaX, int32_t deltaY) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return; } if (!data.WriteInt32(deltaX)) { WLOGFE("Write anchor delatX failed"); return; } if (!data.WriteInt32(deltaY)) { WLOGFE("Write anchor deltaY failed"); return; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_SET_ANCHOR_OFFSET), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); } } void WindowManagerProxy::OffWindowZoom() { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_OFF_WINDOW_ZOOM), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); } } std::shared_ptr WindowManagerProxy::GetSnapshot(int32_t windowId) { MessageParcel data; MessageParcel reply; MessageOption option; Media::InitializationOptions opts; opts.size.width = 200; // 200:default width opts.size.height = 300; // 300:default height std::shared_ptr pixelMap(Media::PixelMap::Create(opts).release()); if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return pixelMap; } if (!data.WriteUint32(windowId)) { WLOGFE("Write windowId failed"); return pixelMap; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_GET_SNAPSHOT), data, reply, option) != ERR_NONE) { return pixelMap; } std::shared_ptr map(reply.ReadParcelable()); if (map == nullptr) { return pixelMap; } return map; } void WindowManagerProxy::NotifyDumpInfoResult(const std::vector& info) { MessageParcel data; MessageParcel reply; MessageOption option(MessageOption::TF_ASYNC); if (!data.WriteInterfaceToken(GetDescriptor())) { WLOGFE("WriteInterfaceToken failed"); return; } if (!data.WriteStringVector(info)) { WLOGFE("Write info failed"); return; } if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_NOTIFY_DUMP_INFO_RESULT), data, reply, option) != ERR_NONE) { WLOGFE("SendRequest failed"); return; } } } // namespace Rosen } // namespace OHOS