1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <refbase.h> 17 #include <iremote_object.h> 18 19 20 #include "window_manager.h" 21 #include "wm_common.h" 22 23 namespace OHOS { 24 namespace Rosen { Marshalling(Parcel & parcel) const25bool AccessibilityWindowInfo::Marshalling(Parcel& parcel) const 26 { 27 return parcel.WriteInt32(wid_) && parcel.WriteInt32(innerWid_) && parcel.WriteInt32(uiNodeId_) && 28 parcel.WriteUint32(windowRect_.width_) && 29 parcel.WriteUint32(windowRect_.height_) && parcel.WriteInt32(windowRect_.posX_) && 30 parcel.WriteInt32(windowRect_.posY_) && parcel.WriteBool(focused_) && parcel.WriteBool(isDecorEnable_) && 31 parcel.WriteUint64(displayId_) && parcel.WriteUint32(layer_) && parcel.WriteFloat(scaleVal_) && 32 parcel.WriteFloat(scaleX_) && parcel.WriteFloat(scaleY_) && 33 parcel.WriteUint32(static_cast<uint32_t>(mode_)) && parcel.WriteUint32(static_cast<uint32_t>(type_)); 34 } 35 Unmarshalling(Parcel & parcel)36AccessibilityWindowInfo* AccessibilityWindowInfo::Unmarshalling(Parcel& parcel) 37 { 38 auto info = new (std::nothrow) AccessibilityWindowInfo(); 39 if (info == nullptr) { 40 return nullptr; 41 } 42 bool res = parcel.ReadInt32(info->wid_) && parcel.ReadInt32(info->innerWid_) && parcel.ReadInt32(info->uiNodeId_) && 43 parcel.ReadUint32(info->windowRect_.width_) && 44 parcel.ReadUint32(info->windowRect_.height_) && parcel.ReadInt32(info->windowRect_.posX_) && 45 parcel.ReadInt32(info->windowRect_.posY_) && parcel.ReadBool(info->focused_) && 46 parcel.ReadBool(info->isDecorEnable_) && parcel.ReadUint64(info->displayId_) && 47 parcel.ReadUint32(info->layer_) && parcel.ReadFloat(info->scaleVal_) && 48 parcel.ReadFloat(info->scaleX_) && parcel.ReadFloat(info->scaleY_); 49 if (!res) { 50 delete info; 51 return nullptr; 52 } 53 info->mode_ = static_cast<WindowMode>(parcel.ReadUint32()); 54 info->type_ = static_cast<WindowType>(parcel.ReadUint32()); 55 return info; 56 } 57 } 58 }