• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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) const25 bool 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_) &&
32         parcel.WriteUint32(static_cast<uint32_t>(mode_)) && parcel.WriteUint32(static_cast<uint32_t>(type_));
33 }
34 
Unmarshalling(Parcel & parcel)35 AccessibilityWindowInfo* AccessibilityWindowInfo::Unmarshalling(Parcel& parcel)
36 {
37     auto info = new (std::nothrow) AccessibilityWindowInfo();
38     if (info == nullptr) {
39         return nullptr;
40     }
41     bool res = parcel.ReadInt32(info->wid_) && parcel.ReadInt32(info->innerWid_) && parcel.ReadInt32(info->uiNodeId_) &&
42         parcel.ReadUint32(info->windowRect_.width_) &&
43         parcel.ReadUint32(info->windowRect_.height_) && parcel.ReadInt32(info->windowRect_.posX_) &&
44         parcel.ReadInt32(info->windowRect_.posY_) && parcel.ReadBool(info->focused_) &&
45         parcel.ReadBool(info->isDecorEnable_) && parcel.ReadUint64(info->displayId_) &&
46         parcel.ReadUint32(info->layer_);
47     if (!res) {
48         delete info;
49         return nullptr;
50     }
51     info->mode_ = static_cast<WindowMode>(parcel.ReadUint32());
52     info->type_ = static_cast<WindowType>(parcel.ReadUint32());
53     return info;
54 }
55 }
56 }