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 "common/include/window_session_property.h"
17 #include "window_manager_hilog.h"
18 #include "wm_common.h"
19 #include "window_helper.h"
20 
21 namespace OHOS {
22 namespace Rosen {
23 namespace {
24 constexpr uint32_t TOUCH_HOT_AREA_MAX_NUM = 50;
25 constexpr uint32_t MAX_SIZE_PIP_CONTROL_GROUP = 8;
26 constexpr uint32_t MAX_SIZE_PIP_CONTROL = 9;
27 }
28 
29 const std::map<uint32_t, HandlWritePropertyFunc> WindowSessionProperty::writeFuncMap_ {
30     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON),
31         &WindowSessionProperty::WriteActionUpdateTurnScreenOn),
32     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON),
33         &WindowSessionProperty::WriteActionUpdateKeepScreenOn),
34     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_FOCUSABLE),
35         &WindowSessionProperty::WriteActionUpdateFocusable),
36     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TOUCHABLE),
37         &WindowSessionProperty::WriteActionUpdateTouchable),
38     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS),
39         &WindowSessionProperty::WriteActionUpdateSetBrightness),
40     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_ORIENTATION),
41         &WindowSessionProperty::WriteActionUpdateOrientation),
42     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE),
43         &WindowSessionProperty::WriteActionUpdatePrivacyMode),
44     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_SYSTEM_PRIVACY_MODE),
45         &WindowSessionProperty::WriteActionUpdatePrivacyMode),
46     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_SNAPSHOT_SKIP),
47         &WindowSessionProperty::WriteActionUpdateSnapshotSkip),
48     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_MAXIMIZE_STATE),
49         &WindowSessionProperty::WriteActionUpdateMaximizeState),
50     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_OTHER_PROPS),
51         &WindowSessionProperty::WriteActionUpdateSystemBar),
52     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_STATUS_PROPS),
53         &WindowSessionProperty::WriteActionUpdateSystemBar),
54     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_PROPS),
55         &WindowSessionProperty::WriteActionUpdateSystemBar),
56     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS),
57         &WindowSessionProperty::WriteActionUpdateSystemBar),
58     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_FLAGS),
59         &WindowSessionProperty::WriteActionUpdateFlags),
60     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_MODE),
61         &WindowSessionProperty::WriteActionUpdateMode),
62     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG),
63         &WindowSessionProperty::WriteActionUpdateAnimationFlag),
64     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA),
65         &WindowSessionProperty::WriteActionUpdateTouchHotArea),
66     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE),
67         &WindowSessionProperty::WriteActionUpdateDecorEnable),
68     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS),
69         &WindowSessionProperty::WriteActionUpdateWindowLimits),
70     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED),
71         &WindowSessionProperty::WriteActionUpdateDragenabled),
72     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_RAISEENABLED),
73         &WindowSessionProperty::WriteActionUpdateRaiseenabled),
74     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS),
75         &WindowSessionProperty::WriteActionUpdateHideNonSystemFloatingWindows),
76     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TEXTFIELD_AVOID_INFO),
77         &WindowSessionProperty::WriteActionUpdateTextfieldAvoidInfo),
78     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_MASK),
79         &WindowSessionProperty::WriteActionUpdateWindowMask),
80     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TOPMOST),
81         &WindowSessionProperty::WriteActionUpdateTopmost),
82     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO),
83         &WindowSessionProperty::WriteActionUpdateModeSupportInfo),
84     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST),
85         &WindowSessionProperty::WriteActionUpdateMainWindowTopmost),
86 };
87 
88 const std::map<uint32_t, HandlReadPropertyFunc> WindowSessionProperty::readFuncMap_ {
89     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON),
90         &WindowSessionProperty::ReadActionUpdateTurnScreenOn),
91     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON),
92         &WindowSessionProperty::ReadActionUpdateKeepScreenOn),
93     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_FOCUSABLE),
94         &WindowSessionProperty::ReadActionUpdateFocusable),
95     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TOUCHABLE),
96         &WindowSessionProperty::ReadActionUpdateTouchable),
97     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS),
98         &WindowSessionProperty::ReadActionUpdateSetBrightness),
99     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_ORIENTATION),
100         &WindowSessionProperty::ReadActionUpdateOrientation),
101     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE),
102         &WindowSessionProperty::ReadActionUpdatePrivacyMode),
103     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_SYSTEM_PRIVACY_MODE),
104         &WindowSessionProperty::ReadActionUpdatePrivacyMode),
105     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_SNAPSHOT_SKIP),
106         &WindowSessionProperty::ReadActionUpdateSnapshotSkip),
107     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_MAXIMIZE_STATE),
108         &WindowSessionProperty::ReadActionUpdateMaximizeState),
109     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_OTHER_PROPS),
110         &WindowSessionProperty::ReadActionUpdateSystemBar),
111     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_STATUS_PROPS),
112         &WindowSessionProperty::ReadActionUpdateSystemBar),
113     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_PROPS),
114         &WindowSessionProperty::ReadActionUpdateSystemBar),
115     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS),
116         &WindowSessionProperty::ReadActionUpdateSystemBar),
117     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_FLAGS),
118         &WindowSessionProperty::ReadActionUpdateFlags),
119     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_MODE),
120         &WindowSessionProperty::ReadActionUpdateMode),
121     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG),
122         &WindowSessionProperty::ReadActionUpdateAnimationFlag),
123     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA),
124         &WindowSessionProperty::ReadActionUpdateTouchHotArea),
125     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE),
126         &WindowSessionProperty::ReadActionUpdateDecorEnable),
127     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS),
128         &WindowSessionProperty::ReadActionUpdateWindowLimits),
129     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED),
130         &WindowSessionProperty::ReadActionUpdateDragenabled),
131     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_RAISEENABLED),
132         &WindowSessionProperty::ReadActionUpdateRaiseenabled),
133     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS),
134         &WindowSessionProperty::ReadActionUpdateHideNonSystemFloatingWindows),
135     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TEXTFIELD_AVOID_INFO),
136         &WindowSessionProperty::ReadActionUpdateTextfieldAvoidInfo),
137     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_MASK),
138         &WindowSessionProperty::ReadActionUpdateWindowMask),
139     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_TOPMOST),
140         &WindowSessionProperty::ReadActionUpdateTopmost),
141     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO),
142         &WindowSessionProperty::ReadActionUpdateModeSupportInfo),
143     std::make_pair(static_cast<uint32_t>(WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST),
144         &WindowSessionProperty::ReadActionUpdateMainWindowTopmost),
145 };
146 
WindowSessionProperty(const sptr<WindowSessionProperty>& property)147 WindowSessionProperty::WindowSessionProperty(const sptr<WindowSessionProperty>& property)
148 {
149     CopyFrom(property);
150 }
151 
SetWindowName(const std::string& name)152 void WindowSessionProperty::SetWindowName(const std::string& name)
153 {
154     windowName_ = name;
155 }
156 
SetSessionInfo(const SessionInfo& info)157 void WindowSessionProperty::SetSessionInfo(const SessionInfo& info)
158 {
159     sessionInfo_ = info;
160 }
161 
SetWindowRect(const struct Rect& rect)162 void WindowSessionProperty::SetWindowRect(const struct Rect& rect)
163 {
164     windowRect_ = rect;
165 }
166 
SetRequestRect(const Rect& requestRect)167 void WindowSessionProperty::SetRequestRect(const Rect& requestRect)
168 {
169     requestRect_ = requestRect;
170 }
171 
SetWindowType(WindowType type)172 void WindowSessionProperty::SetWindowType(WindowType type)
173 {
174     type_ = type;
175 }
176 
SetFocusable(bool isFocusable)177 void WindowSessionProperty::SetFocusable(bool isFocusable)
178 {
179     focusable_ = isFocusable;
180 }
181 
SetTouchable(bool isTouchable)182 void WindowSessionProperty::SetTouchable(bool isTouchable)
183 {
184     touchable_ = isTouchable;
185 }
186 
SetDragEnabled(bool dragEnabled)187 void WindowSessionProperty::SetDragEnabled(bool dragEnabled)
188 {
189     dragEnabled_ = dragEnabled;
190 }
191 
SetHideNonSystemFloatingWindows(bool hide)192 void WindowSessionProperty::SetHideNonSystemFloatingWindows(bool hide)
193 {
194     hideNonSystemFloatingWindows_ = hide;
195 }
196 
SetForceHide(bool hide)197 void WindowSessionProperty::SetForceHide(bool hide)
198 {
199     forceHide_ = hide;
200 }
201 
SetRaiseEnabled(bool raiseEnabled)202 void WindowSessionProperty::SetRaiseEnabled(bool raiseEnabled)
203 {
204     raiseEnabled_ = raiseEnabled;
205 }
206 
SetRequestedOrientation(Orientation orientation)207 void WindowSessionProperty::SetRequestedOrientation(Orientation orientation)
208 {
209     requestedOrientation_ = orientation;
210 }
211 
SetDefaultRequestedOrientation(Orientation orientation)212 void WindowSessionProperty::SetDefaultRequestedOrientation(Orientation orientation)
213 {
214     defaultRequestedOrientation_ = orientation;
215 }
216 
SetPrivacyMode(bool isPrivate)217 void WindowSessionProperty::SetPrivacyMode(bool isPrivate)
218 {
219     isPrivacyMode_ = isPrivate;
220 }
221 
SetSystemPrivacyMode(bool isSystemPrivate)222 void WindowSessionProperty::SetSystemPrivacyMode(bool isSystemPrivate)
223 {
224     isSystemPrivacyMode_ = isSystemPrivate;
225 }
226 
SetSnapshotSkip(bool isSkip)227 void WindowSessionProperty::SetSnapshotSkip(bool isSkip)
228 {
229     isSnapshotSkip_ = isSkip;
230 }
231 
SetBrightness(float brightness)232 void WindowSessionProperty::SetBrightness(float brightness)
233 {
234     brightness_ = brightness;
235 }
236 
SetSystemCalling(bool isSystemCalling)237 void WindowSessionProperty::SetSystemCalling(bool isSystemCalling)
238 {
239     isSystemCalling_ = isSystemCalling;
240 }
241 
SetDisplayId(DisplayId displayId)242 void WindowSessionProperty::SetDisplayId(DisplayId displayId)
243 {
244     displayId_ = displayId;
245 }
246 
SetFloatingWindowAppType(bool isAppType)247 void WindowSessionProperty::SetFloatingWindowAppType(bool isAppType)
248 {
249     isFloatingWindowAppType_ = isAppType;
250 }
251 
GetWindowName() const252 const std::string& WindowSessionProperty::GetWindowName() const
253 {
254     return windowName_;
255 }
256 
GetSessionInfo() const257 const SessionInfo& WindowSessionProperty::GetSessionInfo() const
258 {
259     return sessionInfo_;
260 }
261 
EditSessionInfo()262 SessionInfo& WindowSessionProperty::EditSessionInfo()
263 {
264     return sessionInfo_;
265 }
266 
GetWindowRect() const267 Rect WindowSessionProperty::GetWindowRect() const
268 {
269     return windowRect_;
270 }
271 
GetRequestRect() const272 Rect WindowSessionProperty::GetRequestRect() const
273 {
274     return requestRect_;
275 }
276 
GetWindowType() const277 WindowType WindowSessionProperty::GetWindowType() const
278 {
279     return type_;
280 }
281 
GetFocusable() const282 bool WindowSessionProperty::GetFocusable() const
283 {
284     return focusable_;
285 }
286 
GetTouchable() const287 bool WindowSessionProperty::GetTouchable() const
288 {
289     return touchable_;
290 }
291 
GetDragEnabled() const292 bool WindowSessionProperty::GetDragEnabled() const
293 {
294     return dragEnabled_;
295 }
296 
GetHideNonSystemFloatingWindows() const297 bool WindowSessionProperty::GetHideNonSystemFloatingWindows() const
298 {
299     return hideNonSystemFloatingWindows_;
300 }
301 
GetForceHide() const302 bool WindowSessionProperty::GetForceHide() const
303 {
304     return forceHide_;
305 }
306 
GetRaiseEnabled() const307 bool WindowSessionProperty::GetRaiseEnabled() const
308 {
309     return raiseEnabled_;
310 }
311 
GetRequestedOrientation() const312 Orientation WindowSessionProperty::GetRequestedOrientation() const
313 {
314     return requestedOrientation_;
315 }
316 
GetDefaultRequestedOrientation() const317 Orientation WindowSessionProperty::GetDefaultRequestedOrientation() const
318 {
319     return defaultRequestedOrientation_;
320 }
321 
GetPrivacyMode() const322 bool WindowSessionProperty::GetPrivacyMode() const
323 {
324     return isPrivacyMode_;
325 }
326 
GetSystemPrivacyMode() const327 bool WindowSessionProperty::GetSystemPrivacyMode() const
328 {
329     return isSystemPrivacyMode_;
330 }
331 
GetSnapshotSkip() const332 bool WindowSessionProperty::GetSnapshotSkip() const
333 {
334     return isSnapshotSkip_;
335 }
336 
GetBrightness() const337 float WindowSessionProperty::GetBrightness() const
338 {
339     return brightness_;
340 }
341 
GetSystemCalling() const342 bool WindowSessionProperty::GetSystemCalling() const
343 {
344     return isSystemCalling_;
345 }
346 
GetDisplayId() const347 DisplayId WindowSessionProperty::GetDisplayId() const
348 {
349     return displayId_;
350 }
351 
SetParentId(int32_t parentId)352 void WindowSessionProperty::SetParentId(int32_t parentId)
353 {
354     parentId_ = parentId;
355 }
356 
GetParentId() const357 int32_t WindowSessionProperty::GetParentId() const
358 {
359     return parentId_;
360 }
361 
SetWindowFlags(uint32_t flags)362 void WindowSessionProperty::SetWindowFlags(uint32_t flags)
363 {
364     flags_ = flags;
365 }
366 
SetTopmost(bool topmost)367 void WindowSessionProperty::SetTopmost(bool topmost)
368 {
369     topmost_ = topmost;
370 }
371 
IsTopmost() const372 bool WindowSessionProperty::IsTopmost() const
373 {
374     return topmost_;
375 }
376 
SetMainWindowTopmost(bool isTopmost)377 void WindowSessionProperty::SetMainWindowTopmost(bool isTopmost)
378 {
379     mainWindowTopmost_ = isTopmost;
380 }
381 
IsMainWindowTopmost() const382 bool WindowSessionProperty::IsMainWindowTopmost() const
383 {
384     return mainWindowTopmost_;
385 }
386 
AddWindowFlag(WindowFlag flag)387 void WindowSessionProperty::AddWindowFlag(WindowFlag flag)
388 {
389     flags_ |= static_cast<uint32_t>(flag);
390 }
391 
GetWindowFlags() const392 uint32_t WindowSessionProperty::GetWindowFlags() const
393 {
394     return flags_;
395 }
396 
SetPersistentId(int32_t persistentId)397 void WindowSessionProperty::SetPersistentId(int32_t persistentId)
398 {
399     persistentId_ = persistentId;
400 }
401 
GetPersistentId() const402 int32_t WindowSessionProperty::GetPersistentId() const
403 {
404     return persistentId_;
405 }
406 
SetParentPersistentId(int32_t persistentId)407 void WindowSessionProperty::SetParentPersistentId(int32_t persistentId)
408 {
409     parentPersistentId_ = persistentId;
410 }
411 
GetParentPersistentId() const412 int32_t WindowSessionProperty::GetParentPersistentId() const
413 {
414     return parentPersistentId_;
415 }
416 
SetTurnScreenOn(bool turnScreenOn)417 void WindowSessionProperty::SetTurnScreenOn(bool turnScreenOn)
418 {
419     turnScreenOn_ = turnScreenOn;
420 }
421 
IsTurnScreenOn() const422 bool WindowSessionProperty::IsTurnScreenOn() const
423 {
424     return turnScreenOn_;
425 }
426 
SetKeepScreenOn(bool keepScreenOn)427 void WindowSessionProperty::SetKeepScreenOn(bool keepScreenOn)
428 {
429     keepScreenOn_ = keepScreenOn;
430 }
431 
IsKeepScreenOn() const432 bool WindowSessionProperty::IsKeepScreenOn() const
433 {
434     return keepScreenOn_;
435 }
436 
SetAccessTokenId(uint32_t accessTokenId)437 void WindowSessionProperty::SetAccessTokenId(uint32_t accessTokenId)
438 {
439     accessTokenId_ = accessTokenId;
440 }
441 
GetAccessTokenId() const442 uint32_t WindowSessionProperty::GetAccessTokenId() const
443 {
444     return accessTokenId_;
445 }
446 
SetTokenState(bool hasToken)447 void WindowSessionProperty::SetTokenState(bool hasToken)
448 {
449     tokenState_ = hasToken;
450 }
451 
GetTokenState() const452 bool WindowSessionProperty::GetTokenState() const
453 {
454     return tokenState_;
455 }
456 
GetMaximizeMode() const457 MaximizeMode WindowSessionProperty::GetMaximizeMode() const
458 {
459     return maximizeMode_;
460 }
461 
SetMaximizeMode(MaximizeMode mode)462 void WindowSessionProperty::SetMaximizeMode(MaximizeMode mode)
463 {
464     maximizeMode_ = mode;
465 }
466 
SetSystemBarProperty(WindowType type, const SystemBarProperty& property)467 void WindowSessionProperty::SetSystemBarProperty(WindowType type, const SystemBarProperty& property)
468 {
469     if (type == WindowType::WINDOW_TYPE_STATUS_BAR
470         || type ==WindowType::WINDOW_TYPE_NAVIGATION_BAR
471         || type == WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR) {
472         sysBarPropMap_[type] = property;
473     }
474 }
475 
GetSystemBarProperty() const476 std::unordered_map<WindowType, SystemBarProperty> WindowSessionProperty::GetSystemBarProperty() const
477 {
478     return sysBarPropMap_;
479 }
480 
SetWindowLimits(const WindowLimits& windowLimits)481 void WindowSessionProperty::SetWindowLimits(const WindowLimits& windowLimits)
482 {
483     limits_ = windowLimits;
484 }
485 
GetWindowLimits() const486 WindowLimits WindowSessionProperty::GetWindowLimits() const
487 {
488     return limits_;
489 }
490 
SetWindowMode(WindowMode mode)491 void WindowSessionProperty::SetWindowMode(WindowMode mode)
492 {
493     windowMode_ = mode;
494 }
495 
GetWindowMode() const496 WindowMode WindowSessionProperty::GetWindowMode() const
497 {
498     return windowMode_;
499 }
500 
GetWindowState() const501 WindowState WindowSessionProperty::GetWindowState() const
502 {
503     return windowState_;
504 }
505 
SetWindowState(WindowState state)506 void WindowSessionProperty::SetWindowState(WindowState state)
507 {
508     windowState_ = state;
509 }
510 
SetKeyboardSessionGravity(SessionGravity gravity, uint32_t percent)511 void WindowSessionProperty::SetKeyboardSessionGravity(SessionGravity gravity, uint32_t percent)
512 {
513     sessionGravity_ = gravity;
514     sessionGravitySizePercent_ = percent;
515 }
516 
GetSessionGravity(SessionGravity& gravity, uint32_t& percent)517 void WindowSessionProperty::GetSessionGravity(SessionGravity& gravity, uint32_t& percent)
518 {
519     gravity = sessionGravity_;
520     percent = sessionGravitySizePercent_;
521 }
522 
SetKeyboardLayoutParams(const KeyboardLayoutParams& params)523 void WindowSessionProperty::SetKeyboardLayoutParams(const KeyboardLayoutParams& params)
524 {
525     keyboardLayoutParams_.gravity_ = params.gravity_;
526     keyboardLayoutParams_.LandscapeKeyboardRect_ = params.LandscapeKeyboardRect_;
527     keyboardLayoutParams_.PortraitKeyboardRect_ = params.PortraitKeyboardRect_;
528     keyboardLayoutParams_.LandscapePanelRect_ = params.LandscapePanelRect_;
529     keyboardLayoutParams_.PortraitPanelRect_ = params.PortraitPanelRect_;
530 }
531 
GetKeyboardLayoutParams() const532 KeyboardLayoutParams WindowSessionProperty::GetKeyboardLayoutParams() const
533 {
534     return keyboardLayoutParams_;
535 }
536 
SetDecorEnable(bool isDecorEnable)537 void WindowSessionProperty::SetDecorEnable(bool isDecorEnable)
538 {
539     isDecorEnable_ = isDecorEnable;
540 }
541 
IsDecorEnable()542 bool WindowSessionProperty::IsDecorEnable()
543 {
544     return isDecorEnable_;
545 }
546 
SetModeSupportInfo(uint32_t modeSupportInfo)547 void WindowSessionProperty::SetModeSupportInfo(uint32_t modeSupportInfo)
548 {
549     modeSupportInfo_ = modeSupportInfo;
550 }
551 
GetModeSupportInfo() const552 uint32_t WindowSessionProperty::GetModeSupportInfo() const
553 {
554     return modeSupportInfo_;
555 }
556 
SetAnimationFlag(uint32_t animationFlag)557 void WindowSessionProperty::SetAnimationFlag(uint32_t animationFlag)
558 {
559     animationFlag_ = animationFlag;
560 }
561 
GetAnimationFlag() const562 uint32_t WindowSessionProperty::GetAnimationFlag() const
563 {
564     return animationFlag_;
565 }
566 
IsFloatingWindowAppType() const567 bool WindowSessionProperty::IsFloatingWindowAppType() const
568 {
569     return isFloatingWindowAppType_;
570 }
571 
SetTouchHotAreas(const std::vector<Rect>& rects)572 void WindowSessionProperty::SetTouchHotAreas(const std::vector<Rect>& rects)
573 {
574     {
575         std::lock_guard<std::mutex> lock(touchHotAreasMutex_);
576         if (GetPersistentId() != 0 && rects != touchHotAreas_) {
577             std::string rectStr;
578             for (const auto& rect : rects) {
579                 rectStr = rectStr + " hot : [ " + std::to_string(rect.posX_) + " , " + std::to_string(rect.posY_) +
580                     " , " + std::to_string(rect.width_) + " , " + std::to_string(rect.height_) + "]";
581             }
582             TLOGI(WmsLogTag::WMS_EVENT, "id:%{public}d rects:%{public}s", GetPersistentId(), rectStr.c_str());
583         }
584         touchHotAreas_ = rects;
585     }
586     if (touchHotAreasChangeCallback_) {
587         touchHotAreasChangeCallback_();
588     }
589 }
590 
GetTouchHotAreas(std::vector<Rect>& rects) const591 void WindowSessionProperty::GetTouchHotAreas(std::vector<Rect>& rects) const
592 {
593     std::lock_guard<std::mutex> lock(touchHotAreasMutex_);
594     rects = touchHotAreas_;
595 }
596 
KeepKeyboardOnFocus(bool keepKeyboardFlag)597 void WindowSessionProperty::KeepKeyboardOnFocus(bool keepKeyboardFlag)
598 {
599     keepKeyboardFlag_ = keepKeyboardFlag;
600 }
601 
GetKeepKeyboardFlag() const602 bool WindowSessionProperty::GetKeepKeyboardFlag() const
603 {
604     return keepKeyboardFlag_;
605 }
606 
SetCallingSessionId(uint32_t sessionId)607 void WindowSessionProperty::SetCallingSessionId(uint32_t sessionId)
608 {
609     callingSessionId_ = sessionId;
610 }
611 
GetCallingSessionId() const612 uint32_t WindowSessionProperty::GetCallingSessionId() const
613 {
614     return callingSessionId_;
615 }
616 
SetPiPTemplateInfo(const PiPTemplateInfo& pipTemplateInfo)617 void WindowSessionProperty::SetPiPTemplateInfo(const PiPTemplateInfo& pipTemplateInfo)
618 {
619     pipTemplateInfo_ = pipTemplateInfo;
620 }
621 
GetPiPTemplateInfo() const622 PiPTemplateInfo WindowSessionProperty::GetPiPTemplateInfo() const
623 {
624     return pipTemplateInfo_;
625 }
626 
SetIsNeedUpdateWindowMode(bool isNeedUpdateWindowMode)627 void WindowSessionProperty::SetIsNeedUpdateWindowMode(bool isNeedUpdateWindowMode)
628 {
629     isNeedUpdateWindowMode_ = isNeedUpdateWindowMode;
630 }
631 
GetIsNeedUpdateWindowMode() const632 bool WindowSessionProperty::GetIsNeedUpdateWindowMode() const
633 {
634     return isNeedUpdateWindowMode_;
635 }
636 
MarshallingWindowLimits(Parcel& parcel) const637 bool WindowSessionProperty::MarshallingWindowLimits(Parcel& parcel) const
638 {
639     if (parcel.WriteUint32(limits_.maxWidth_) &&
640         parcel.WriteUint32(limits_.maxHeight_) && parcel.WriteUint32(limits_.minWidth_) &&
641         parcel.WriteUint32(limits_.minHeight_) && parcel.WriteFloat(limits_.maxRatio_) &&
642         parcel.WriteFloat(limits_.minRatio_) && parcel.WriteFloat(limits_.vpRatio_)) {
643         return true;
644     }
645     return false;
646 }
647 
UnmarshallingWindowLimits(Parcel& parcel, WindowSessionProperty* property)648 void WindowSessionProperty::UnmarshallingWindowLimits(Parcel& parcel, WindowSessionProperty* property)
649 {
650     WindowLimits windowLimits = { parcel.ReadUint32(), parcel.ReadUint32(), parcel.ReadUint32(),
651         parcel.ReadUint32(), parcel.ReadFloat(), parcel.ReadFloat(), parcel.ReadFloat() };
652     property->SetWindowLimits(windowLimits);
653 }
654 
MarshallingSystemBarMap(Parcel& parcel) const655 bool WindowSessionProperty::MarshallingSystemBarMap(Parcel& parcel) const
656 {
657     auto size = sysBarPropMap_.size();
658     uint32_t maxSystemBarNumber = 3;
659     if (size > maxSystemBarNumber) { // max systembar number
660         return false;
661     }
662 
663     if (!parcel.WriteUint32(static_cast<uint32_t>(size))) {
664         return false;
665     }
666     for (auto it : sysBarPropMap_) {
667         if (!parcel.WriteUint32(static_cast<uint32_t>(it.first))) {
668             return false;
669         }
670         if (!(parcel.WriteBool(it.second.enable_) && parcel.WriteUint32(it.second.backgroundColor_) &&
671               parcel.WriteUint32(it.second.contentColor_) && parcel.WriteBool(it.second.enableAnimation_) &&
672               parcel.WriteUint32(static_cast<uint32_t>(it.second.settingFlag_)))) {
673             return false;
674         }
675     }
676     return true;
677 }
678 
UnMarshallingSystemBarMap(Parcel& parcel, WindowSessionProperty* property)679 void WindowSessionProperty::UnMarshallingSystemBarMap(Parcel& parcel, WindowSessionProperty* property)
680 {
681     uint32_t size = parcel.ReadUint32();
682     uint32_t maxSystemBarNumber = 3;
683     if (size > maxSystemBarNumber) { // max systembar number
684         return;
685     }
686 
687     for (uint32_t i = 0; i < size; i++) {
688         WindowType type = static_cast<WindowType>(parcel.ReadUint32());
689         SystemBarProperty prop = { parcel.ReadBool(), parcel.ReadUint32(), parcel.ReadUint32(), parcel.ReadBool(),
690             static_cast<SystemBarSettingFlag>(parcel.ReadUint32()) };
691         property->SetSystemBarProperty(type, prop);
692     }
693 }
694 
MarshallingTouchHotAreas(Parcel& parcel) const695 bool WindowSessionProperty::MarshallingTouchHotAreas(Parcel& parcel) const
696 {
697     auto size = touchHotAreas_.size();
698     if (size > TOUCH_HOT_AREA_MAX_NUM) {
699         return false;
700     }
701     if (!parcel.WriteUint32(static_cast<uint32_t>(size))) {
702         return false;
703     }
704     for (const auto& rect : touchHotAreas_) {
705         if (!(parcel.WriteInt32(rect.posX_) && parcel.WriteInt32(rect.posY_) &&
706             parcel.WriteUint32(rect.width_) && parcel.WriteUint32(rect.height_))) {
707             return false;
708         }
709     }
710     return true;
711 }
712 
UnmarshallingTouchHotAreas(Parcel& parcel, WindowSessionProperty* property)713 void WindowSessionProperty::UnmarshallingTouchHotAreas(Parcel& parcel, WindowSessionProperty* property)
714 {
715     uint32_t size = parcel.ReadUint32();
716     if (size > TOUCH_HOT_AREA_MAX_NUM) {
717         return;
718     }
719     for (uint32_t i = 0; i < size; i++) {
720         property->touchHotAreas_.emplace_back(
721             Rect{ parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() });
722     }
723 }
724 
MarshallingPiPTemplateInfo(Parcel& parcel) const725 bool WindowSessionProperty::MarshallingPiPTemplateInfo(Parcel& parcel) const
726 {
727     if (!WindowHelper::IsPipWindow(type_)) {
728         return true;
729     }
730     if (!parcel.WriteUint32(pipTemplateInfo_.pipTemplateType)) {
731         return false;
732     }
733     if (!parcel.WriteUint32(pipTemplateInfo_.priority)) {
734         return false;
735     }
736     auto size = pipTemplateInfo_.controlGroup.size();
737     if (size > MAX_SIZE_PIP_CONTROL_GROUP) {
738         return false;
739     }
740     if (!parcel.WriteUint32(static_cast<uint32_t>(size))) {
741         return false;
742     }
743     for (uint32_t i = 0; i < size; i++) {
744         if (!parcel.WriteUint32(pipTemplateInfo_.controlGroup[i])) {
745             return false;
746         }
747     }
748     auto controlStatusSize = pipTemplateInfo_.pipControlStatusInfoList.size();
749     if (controlStatusSize > MAX_SIZE_PIP_CONTROL) {
750         return false;
751     }
752     if (!parcel.WriteUint32(static_cast<uint32_t>(controlStatusSize))) {
753         return false;
754     }
755     for (uint32_t i = 0; i < controlStatusSize; i++) {
756         if (!parcel.WriteUint32(static_cast<uint32_t>(pipTemplateInfo_.pipControlStatusInfoList[i].controlType)) ||
757             !parcel.WriteInt32(static_cast<int32_t>(pipTemplateInfo_.pipControlStatusInfoList[i].status))) {
758             return false;
759         }
760     }
761     auto controlEnableSize = pipTemplateInfo_.pipControlEnableInfoList.size();
762     if (controlEnableSize > MAX_SIZE_PIP_CONTROL) {
763         return false;
764     }
765     if (!parcel.WriteUint32(static_cast<uint32_t>(controlEnableSize))) {
766         return false;
767     }
768     for (uint32_t i = 0; i < controlEnableSize; i++) {
769         if (!parcel.WriteUint32(static_cast<uint32_t>(pipTemplateInfo_.pipControlEnableInfoList[i].controlType)) ||
770             !parcel.WriteInt32(static_cast<int32_t>(pipTemplateInfo_.pipControlEnableInfoList[i].enabled))) {
771             return false;
772         }
773     }
774     return true;
775 }
776 
UnmarshallingPiPTemplateInfo(Parcel& parcel, WindowSessionProperty* property)777 void WindowSessionProperty::UnmarshallingPiPTemplateInfo(Parcel& parcel, WindowSessionProperty* property)
778 {
779     if (!WindowHelper::IsPipWindow(property->GetWindowType())) {
780         return;
781     }
782     PiPTemplateInfo pipTemplateInfo;
783     pipTemplateInfo.pipTemplateType = parcel.ReadUint32();
784     pipTemplateInfo.priority = parcel.ReadUint32();
785     auto size = parcel.ReadUint32();
786     if (size > MAX_SIZE_PIP_CONTROL_GROUP) {
787         return;
788     }
789     for (uint32_t i = 0; i < size; i++) {
790         uint32_t controlGroupId = 0;
791         if (!parcel.ReadUint32(controlGroupId)) {
792             return;
793         }
794         pipTemplateInfo.controlGroup.push_back(controlGroupId);
795     }
796     auto controlStatusSize = parcel.ReadUint32();
797     if (controlStatusSize > MAX_SIZE_PIP_CONTROL) {
798         return;
799     }
800     for (uint32_t i = 0; i < controlStatusSize; i++) {
801         PiPControlStatusInfo pipControlStatusInfo;
802         uint32_t controlType = 0;
803         int32_t status = 0;
804         if (!parcel.ReadUint32(controlType) || !parcel.ReadInt32(status)) {
805             return;
806         }
807         pipControlStatusInfo.controlType = static_cast<PiPControlType>(controlType);
808         pipControlStatusInfo.status = static_cast<PiPControlStatus>(status);
809         pipTemplateInfo.pipControlStatusInfoList.push_back(pipControlStatusInfo);
810     }
811     auto controlEnableSize = parcel.ReadUint32();
812     if (controlEnableSize > MAX_SIZE_PIP_CONTROL) {
813         return;
814     }
815     for (uint32_t i = 0; i < controlEnableSize; i++) {
816         PiPControlEnableInfo pipControlEnableInfo;
817         uint32_t controlType = 0;
818         int32_t enabled = 0;
819         if (!parcel.ReadUint32(controlType) || !parcel.ReadInt32(enabled)) {
820             return;
821         }
822         pipControlEnableInfo.controlType = static_cast<PiPControlType>(controlType);
823         pipControlEnableInfo.enabled = static_cast<PiPControlStatus>(enabled);
824         pipTemplateInfo.pipControlEnableInfoList.push_back(pipControlEnableInfo);
825     }
826     property->SetPiPTemplateInfo(pipTemplateInfo);
827 }
828 
MarshallingWindowMask(Parcel& parcel) const829 bool WindowSessionProperty::MarshallingWindowMask(Parcel& parcel) const
830 {
831     if (!parcel.WriteBool(isShaped_)) {
832         return false;
833     }
834     if (isShaped_) {
835         if (!windowMask_->Marshalling(parcel)) {
836             return false;
837         }
838     }
839     return true;
840 }
841 
UnmarshallingWindowMask(Parcel& parcel, WindowSessionProperty* property)842 void WindowSessionProperty::UnmarshallingWindowMask(Parcel& parcel, WindowSessionProperty* property)
843 {
844     bool isShaped = parcel.ReadBool();
845     property->SetIsShaped(isShaped);
846     if (isShaped) {
847         Media::PixelMap* windowMask = Media::PixelMap::Unmarshalling(parcel);
848         if (windowMask != nullptr) {
849             property->SetWindowMask(std::shared_ptr<Media::PixelMap>(windowMask));
850         }
851     }
852 }
853 
MarshallingMainWindowTopmost(Parcel& parcel) const854 bool WindowSessionProperty::MarshallingMainWindowTopmost(Parcel& parcel) const
855 {
856     if (!parcel.WriteBool(mainWindowTopmost_)) {
857         return false;
858     }
859     if (!parcel.WriteUint32(accessTokenId_)) {
860         return false;
861     }
862     return true;
863 }
864 
UnmarshallingMainWindowTopmost(Parcel& parcel, WindowSessionProperty* property)865 void WindowSessionProperty::UnmarshallingMainWindowTopmost(Parcel& parcel, WindowSessionProperty* property)
866 {
867     property->SetMainWindowTopmost(parcel.ReadBool());
868     property->SetAccessTokenId(parcel.ReadUint32());
869 }
870 
MarshallingSessionInfo(Parcel& parcel) const871 bool WindowSessionProperty::MarshallingSessionInfo(Parcel& parcel) const
872 {
873     if (!parcel.WriteString(sessionInfo_.bundleName_) || !parcel.WriteString(sessionInfo_.moduleName_) ||
874         !parcel.WriteString(sessionInfo_.abilityName_) ||
875         !parcel.WriteInt32(static_cast<int32_t>(sessionInfo_.continueState))) {
876         return false;
877     }
878     const auto& want = sessionInfo_.want;
879     bool hasWant = want != nullptr;
880     if (!parcel.WriteBool(hasWant)) {
881         return false;
882     }
883     if (hasWant && !parcel.WriteParcelable(want.get())) {
884         return false;
885     }
886     return true;
887 }
888 
UnmarshallingSessionInfo(Parcel& parcel, WindowSessionProperty* property)889 bool WindowSessionProperty::UnmarshallingSessionInfo(Parcel& parcel, WindowSessionProperty* property)
890 {
891     std::string bundleName;
892     std::string moduleName;
893     std::string abilityName;
894     if (!parcel.ReadString(bundleName) || !parcel.ReadString(moduleName) || !parcel.ReadString(abilityName)) {
895         TLOGE(WmsLogTag::DEFAULT, "Failed to read String!");
896         return false;
897     }
898     SessionInfo info = { bundleName, moduleName, abilityName };
899     int32_t continueState;
900     if (!parcel.ReadInt32(continueState)) {
901         TLOGE(WmsLogTag::DEFAULT, "Failed to read continueState!");
902         return false;
903     }
904     info.continueState = static_cast<ContinueState>(continueState);
905     bool hasWant;
906     if (!parcel.ReadBool(hasWant)) {
907         TLOGE(WmsLogTag::DEFAULT, "Failed to read hasWant!");
908         return false;
909     }
910     if (hasWant) {
911         std::shared_ptr<AAFwk::Want> want(parcel.ReadParcelable<AAFwk::Want>());
912         if (want == nullptr) {
913             TLOGE(WmsLogTag::DEFAULT, "Failed to read want!");
914             return false;
915         }
916         info.want = want;
917     }
918     property->SetSessionInfo(info);
919     return true;
920 }
921 
SetCompatibleModeInPc(bool compatibleModeInPc)922 void WindowSessionProperty::SetCompatibleModeInPc(bool compatibleModeInPc)
923 {
924     compatibleModeInPc_ = compatibleModeInPc;
925 }
926 
GetCompatibleModeInPc() const927 bool WindowSessionProperty::GetCompatibleModeInPc() const
928 {
929     return compatibleModeInPc_;
930 }
931 
SetCompatibleWindowSizeInPc(int32_t portraitWidth, int32_t portraitHeight, int32_t landscapeWidth, int32_t landscapeHeight)932 void WindowSessionProperty::SetCompatibleWindowSizeInPc(int32_t portraitWidth,
933     int32_t portraitHeight, int32_t landscapeWidth, int32_t landscapeHeight)
934 {
935     compatibleInPcPortraitWidth_ = portraitWidth;
936     compatibleInPcPortraitHeight_ = portraitHeight;
937     compatibleInPcLandscapeWidth_ = landscapeWidth;
938     compatibleInPcLandscapeHeight_ = landscapeHeight;
939 }
940 
GetCompatibleInPcPortraitWidth() const941 int32_t WindowSessionProperty::GetCompatibleInPcPortraitWidth() const
942 {
943     return compatibleInPcPortraitWidth_;
944 }
945 
GetCompatibleInPcPortraitHeight() const946 int32_t WindowSessionProperty::GetCompatibleInPcPortraitHeight() const
947 {
948     return compatibleInPcPortraitHeight_;
949 }
950 
GetCompatibleInPcLandscapeWidth() const951 int32_t WindowSessionProperty::GetCompatibleInPcLandscapeWidth() const
952 {
953     return compatibleInPcLandscapeWidth_;
954 }
955 
GetCompatibleInPcLandscapeHeight() const956 int32_t WindowSessionProperty::GetCompatibleInPcLandscapeHeight() const
957 {
958     return compatibleInPcLandscapeHeight_;
959 }
960 
SetIsAppSupportPhoneInPc(bool isSupportPhone)961 void WindowSessionProperty::SetIsAppSupportPhoneInPc(bool isSupportPhone)
962 {
963     isAppSupportPhoneInPc_ = isSupportPhone;
964 }
965 
GetIsAppSupportPhoneInPc() const966 bool WindowSessionProperty::GetIsAppSupportPhoneInPc() const
967 {
968     return isAppSupportPhoneInPc_;
969 }
970 
SetIsPcAppInPad(bool isPcAppInPad)971 void WindowSessionProperty::SetIsPcAppInPad(bool isPcAppInPad)
972 {
973     isPcAppInPad_ = isPcAppInPad;
974 }
975 
GetIsPcAppInPad() const976 bool WindowSessionProperty::GetIsPcAppInPad() const
977 {
978     return isPcAppInPad_;
979 }
980 
SetCompatibleModeEnableInPad(bool enable)981 void WindowSessionProperty::SetCompatibleModeEnableInPad(bool enable)
982 {
983     std::lock_guard<std::mutex> lock(compatibleModeMutex_);
984     compatibleModeEnableInPad_ = enable;
985 }
986 
GetCompatibleModeEnableInPad() const987 bool WindowSessionProperty::GetCompatibleModeEnableInPad() const
988 {
989     std::lock_guard<std::mutex> lock(compatibleModeMutex_);
990     return compatibleModeEnableInPad_;
991 }
992 
SetSubWindowLevel(uint32_t subWindowLevel)993 void WindowSessionProperty::SetSubWindowLevel(uint32_t subWindowLevel)
994 {
995     subWindowLevel_ = subWindowLevel;
996 }
997 
GetSubWindowLevel() const998 uint32_t WindowSessionProperty::GetSubWindowLevel() const
999 {
1000     return subWindowLevel_;
1001 }
1002 
SetIsSupportDragInPcCompatibleMode(bool isSupportDragInPcCompatibleMode)1003 void WindowSessionProperty::SetIsSupportDragInPcCompatibleMode(bool isSupportDragInPcCompatibleMode)
1004 {
1005     isSupportDragInPcCompatibleMode_ = isSupportDragInPcCompatibleMode;
1006 }
1007 
GetIsSupportDragInPcCompatibleMode() const1008 bool WindowSessionProperty::GetIsSupportDragInPcCompatibleMode() const
1009 {
1010     return isSupportDragInPcCompatibleMode_;
1011 }
1012 
Marshalling(Parcel& parcel) const1013 bool WindowSessionProperty::Marshalling(Parcel& parcel) const
1014 {
1015     return parcel.WriteString(windowName_) && parcel.WriteInt32(windowRect_.posX_) &&
1016         parcel.WriteInt32(windowRect_.posY_) && parcel.WriteUint32(windowRect_.width_) &&
1017         parcel.WriteUint32(windowRect_.height_) && parcel.WriteInt32(requestRect_.posX_) &&
1018         parcel.WriteInt32(requestRect_.posY_) && parcel.WriteUint32(requestRect_.width_) &&
1019         parcel.WriteUint32(requestRect_.height_) &&
1020         parcel.WriteUint32(static_cast<uint32_t>(type_)) &&
1021         parcel.WriteBool(focusable_) && parcel.WriteBool(touchable_) && parcel.WriteBool(tokenState_) &&
1022         parcel.WriteBool(turnScreenOn_) && parcel.WriteBool(keepScreenOn_) &&
1023         parcel.WriteBool(isPrivacyMode_) && parcel.WriteBool(isSystemPrivacyMode_) &&
1024         parcel.WriteBool(isSnapshotSkip_) &&
1025         parcel.WriteUint64(displayId_) && parcel.WriteInt32(persistentId_) &&
1026         MarshallingSessionInfo(parcel) &&
1027         parcel.WriteInt32(parentPersistentId_) &&
1028         parcel.WriteUint32(accessTokenId_) && parcel.WriteUint32(static_cast<uint32_t>(maximizeMode_)) &&
1029         parcel.WriteUint32(static_cast<uint32_t>(requestedOrientation_)) &&
1030         parcel.WriteUint32(static_cast<uint32_t>(windowMode_)) &&
1031         parcel.WriteUint32(flags_) && parcel.WriteBool(raiseEnabled_) &&
1032         parcel.WriteBool(topmost_) && parcel.WriteBool(mainWindowTopmost_) &&
1033         parcel.WriteBool(isDecorEnable_) && parcel.WriteBool(dragEnabled_) &&
1034         parcel.WriteBool(hideNonSystemFloatingWindows_) && parcel.WriteBool(forceHide_) &&
1035         MarshallingWindowLimits(parcel) && parcel.WriteFloat(brightness_) &&
1036         MarshallingSystemBarMap(parcel) && parcel.WriteUint32(animationFlag_) &&
1037         MarshallingPiPTemplateInfo(parcel) &&
1038         parcel.WriteBool(isFloatingWindowAppType_) && MarshallingTouchHotAreas(parcel) &&
1039         parcel.WriteBool(isSystemCalling_) &&
1040         parcel.WriteUint32(static_cast<uint32_t>(sessionGravity_)) && parcel.WriteUint32(sessionGravitySizePercent_) &&
1041         parcel.WriteDouble(textFieldPositionY_) && parcel.WriteDouble(textFieldHeight_) &&
1042         parcel.WriteUint32(static_cast<uint32_t>(windowState_)) &&
1043         parcel.WriteBool(isNeedUpdateWindowMode_) && parcel.WriteUint32(callingSessionId_) &&
1044         parcel.WriteBool(isLayoutFullScreen_) &&
1045         parcel.WriteInt32(realParentId_) &&
1046         parcel.WriteBool(isUIExtFirstSubWindow_) &&
1047         parcel.WriteBool(isUIExtensionAbilityProcess_) &&
1048         parcel.WriteUint32(static_cast<uint32_t>(uiExtensionUsage_)) &&
1049         parcel.WriteUint32(static_cast<uint32_t>(parentWindowType_)) &&
1050         MarshallingWindowMask(parcel) &&
1051         parcel.WriteParcelable(&keyboardLayoutParams_) &&
1052         parcel.WriteBool(compatibleModeInPc_) &&
1053         parcel.WriteInt32(compatibleInPcPortraitWidth_) && parcel.WriteInt32(compatibleInPcPortraitHeight_) &&
1054         parcel.WriteInt32(compatibleInPcLandscapeWidth_) && parcel.WriteInt32(compatibleInPcLandscapeHeight_) &&
1055         parcel.WriteBool(isAppSupportPhoneInPc_) &&
1056         parcel.WriteBool(isSupportDragInPcCompatibleMode_) &&
1057         parcel.WriteBool(isPcAppInPad_) && parcel.WriteBool(compatibleModeEnableInPad_) &&
1058         parcel.WriteString(appInstanceKey_);
1059 }
1060 
Unmarshalling(Parcel& parcel)1061 WindowSessionProperty* WindowSessionProperty::Unmarshalling(Parcel& parcel)
1062 {
1063     WindowSessionProperty* property = new(std::nothrow) WindowSessionProperty();
1064     if (property == nullptr) {
1065         return nullptr;
1066     }
1067     property->SetWindowName(parcel.ReadString());
1068     Rect rect = { parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() };
1069     property->SetWindowRect(rect);
1070     Rect reqRect = { parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() };
1071     property->SetRequestRect(reqRect);
1072     property->SetWindowType(static_cast<WindowType>(parcel.ReadUint32()));
1073     property->SetFocusable(parcel.ReadBool());
1074     property->SetTouchable(parcel.ReadBool());
1075     property->SetTokenState(parcel.ReadBool());
1076     property->SetTurnScreenOn(parcel.ReadBool());
1077     property->SetKeepScreenOn(parcel.ReadBool());
1078     property->SetPrivacyMode(parcel.ReadBool());
1079     property->SetSystemPrivacyMode(parcel.ReadBool());
1080     property->SetSnapshotSkip(parcel.ReadBool());
1081     property->SetDisplayId(parcel.ReadUint64());
1082     property->SetPersistentId(parcel.ReadInt32());
1083     if (!UnmarshallingSessionInfo(parcel, property)) {
1084         delete property;
1085         return nullptr;
1086     }
1087     property->SetParentPersistentId(parcel.ReadInt32());
1088     property->SetAccessTokenId(parcel.ReadUint32());
1089     property->SetMaximizeMode(static_cast<MaximizeMode>(parcel.ReadUint32()));
1090     property->SetRequestedOrientation(static_cast<Orientation>(parcel.ReadUint32()));
1091     property->SetWindowMode(static_cast<WindowMode>(parcel.ReadUint32()));
1092     property->SetWindowFlags(parcel.ReadUint32());
1093     property->SetRaiseEnabled(parcel.ReadBool());
1094     property->SetTopmost(parcel.ReadBool());
1095     property->SetMainWindowTopmost(parcel.ReadBool());
1096     property->SetDecorEnable(parcel.ReadBool());
1097     property->SetDragEnabled(parcel.ReadBool());
1098     property->SetHideNonSystemFloatingWindows(parcel.ReadBool());
1099     property->SetForceHide(parcel.ReadBool());
1100     UnmarshallingWindowLimits(parcel, property);
1101     property->SetBrightness(parcel.ReadFloat());
1102     UnMarshallingSystemBarMap(parcel, property);
1103     property->SetAnimationFlag(parcel.ReadUint32());
1104     UnmarshallingPiPTemplateInfo(parcel, property);
1105     property->SetFloatingWindowAppType(parcel.ReadBool());
1106     UnmarshallingTouchHotAreas(parcel, property);
1107     property->SetSystemCalling(parcel.ReadBool());
1108     property->SetKeyboardSessionGravity(static_cast<SessionGravity>(parcel.ReadUint32()), parcel.ReadUint32());
1109     property->SetTextFieldPositionY(parcel.ReadDouble());
1110     property->SetTextFieldHeight(parcel.ReadDouble());
1111     property->SetWindowState(static_cast<WindowState>(parcel.ReadUint32()));
1112     property->SetIsNeedUpdateWindowMode(parcel.ReadBool());
1113     property->SetCallingSessionId(parcel.ReadUint32());
1114     property->SetIsLayoutFullScreen(parcel.ReadBool());
1115     property->SetRealParentId(parcel.ReadInt32());
1116     property->SetIsUIExtFirstSubWindow(parcel.ReadBool());
1117     property->SetIsUIExtensionAbilityProcess(parcel.ReadBool());
1118     property->SetUIExtensionUsage(static_cast<UIExtensionUsage>(parcel.ReadUint32()));
1119     property->SetParentWindowType(static_cast<WindowType>(parcel.ReadUint32()));
1120     UnmarshallingWindowMask(parcel, property);
1121     sptr<KeyboardLayoutParams> keyboardLayoutParams = parcel.ReadParcelable<KeyboardLayoutParams>();
1122     if (keyboardLayoutParams == nullptr) {
1123         delete property;
1124         return nullptr;
1125     }
1126     property->SetKeyboardLayoutParams(*keyboardLayoutParams);
1127     property->SetCompatibleModeInPc(parcel.ReadBool());
1128     property->SetCompatibleWindowSizeInPc(parcel.ReadInt32(), parcel.ReadInt32(),
1129                                           parcel.ReadInt32(), parcel.ReadInt32());
1130     property->SetIsAppSupportPhoneInPc(parcel.ReadBool());
1131     property->SetIsSupportDragInPcCompatibleMode(parcel.ReadBool());
1132     property->SetIsPcAppInPad(parcel.ReadBool());
1133     property->SetCompatibleModeEnableInPad(parcel.ReadBool());
1134     property->SetAppInstanceKey(parcel.ReadString());
1135     return property;
1136 }
1137 
CopyFrom(const sptr<WindowSessionProperty>& property)1138 void WindowSessionProperty::CopyFrom(const sptr<WindowSessionProperty>& property)
1139 {
1140     windowName_ = property->windowName_;
1141     sessionInfo_ = property->sessionInfo_;
1142     requestRect_ = property->requestRect_;
1143     windowRect_ = property->windowRect_;
1144     type_ = property->type_;
1145     focusable_= property->focusable_;
1146     touchable_ = property->touchable_;
1147     dragEnabled_ = property->dragEnabled_;
1148     hideNonSystemFloatingWindows_ = property->hideNonSystemFloatingWindows_;
1149     forceHide_ = property->forceHide_;
1150     raiseEnabled_ = property->raiseEnabled_;
1151     topmost_ = property->topmost_;
1152     mainWindowTopmost_ = property->mainWindowTopmost_;
1153     tokenState_ = property->tokenState_;
1154     turnScreenOn_ = property->turnScreenOn_;
1155     keepScreenOn_ = property->keepScreenOn_;
1156     requestedOrientation_ = property->requestedOrientation_;
1157     defaultRequestedOrientation_ = property->defaultRequestedOrientation_;
1158     isPrivacyMode_ = property->isPrivacyMode_;
1159     isSystemPrivacyMode_ = property->isSystemPrivacyMode_;
1160     isSnapshotSkip_ = property->isSnapshotSkip_;
1161     brightness_ = property->brightness_;
1162     displayId_ = property->displayId_;
1163     parentId_ = property->parentId_;
1164     flags_ = property->flags_;
1165     persistentId_ = property->persistentId_;
1166     parentPersistentId_ = property->parentPersistentId_;
1167     accessTokenId_ = property->accessTokenId_;
1168     maximizeMode_ = property->maximizeMode_;
1169     windowMode_ = property->windowMode_;
1170     limits_ = property->limits_;
1171     sysBarPropMap_ = property->sysBarPropMap_;
1172     isDecorEnable_ = property->isDecorEnable_;
1173     animationFlag_ = property->animationFlag_;
1174     isFloatingWindowAppType_ = property->isFloatingWindowAppType_;
1175     touchHotAreas_ = property->touchHotAreas_;
1176     isSystemCalling_ = property->isSystemCalling_;
1177     textFieldPositionY_ = property->textFieldPositionY_;
1178     textFieldHeight_ = property->textFieldHeight_;
1179     isNeedUpdateWindowMode_ = property->isNeedUpdateWindowMode_;
1180     callingSessionId_ = property->callingSessionId_;
1181     isLayoutFullScreen_ = property->isLayoutFullScreen_;
1182     windowMask_ = property->windowMask_;
1183     isShaped_ = property->isShaped_;
1184     appInstanceKey_ = property->appInstanceKey_;
1185 }
1186 
Write(Parcel& parcel, WSPropertyChangeAction action)1187 bool WindowSessionProperty::Write(Parcel& parcel, WSPropertyChangeAction action)
1188 {
1189     const auto funcIter = writeFuncMap_.find(static_cast<uint32_t>(action));
1190     if (funcIter == writeFuncMap_.end()) {
1191         TLOGE(WmsLogTag::DEFAULT, "Failed to find func handler!");
1192         return false;
1193     }
1194     bool ret = parcel.WriteUint32(static_cast<uint32_t>(persistentId_));
1195     return ret && (this->*(funcIter->second))(parcel);
1196 }
1197 
WriteActionUpdateTurnScreenOn(Parcel& parcel)1198 bool WindowSessionProperty::WriteActionUpdateTurnScreenOn(Parcel& parcel)
1199 {
1200     return parcel.WriteBool(turnScreenOn_);
1201 }
1202 
WriteActionUpdateKeepScreenOn(Parcel& parcel)1203 bool WindowSessionProperty::WriteActionUpdateKeepScreenOn(Parcel& parcel)
1204 {
1205     return parcel.WriteBool(keepScreenOn_);
1206 }
1207 
WriteActionUpdateFocusable(Parcel& parcel)1208 bool WindowSessionProperty::WriteActionUpdateFocusable(Parcel& parcel)
1209 {
1210     return parcel.WriteBool(focusable_);
1211 }
1212 
WriteActionUpdateTouchable(Parcel& parcel)1213 bool WindowSessionProperty::WriteActionUpdateTouchable(Parcel& parcel)
1214 {
1215     return parcel.WriteBool(touchable_);
1216 }
1217 
WriteActionUpdateSetBrightness(Parcel& parcel)1218 bool WindowSessionProperty::WriteActionUpdateSetBrightness(Parcel& parcel)
1219 {
1220     return parcel.WriteFloat(brightness_);
1221 }
1222 
WriteActionUpdateOrientation(Parcel& parcel)1223 bool WindowSessionProperty::WriteActionUpdateOrientation(Parcel& parcel)
1224 {
1225     return parcel.WriteUint32(static_cast<uint32_t>(requestedOrientation_));
1226 }
1227 
WriteActionUpdatePrivacyMode(Parcel& parcel)1228 bool WindowSessionProperty::WriteActionUpdatePrivacyMode(Parcel& parcel)
1229 {
1230     return parcel.WriteBool(isPrivacyMode_) && parcel.WriteBool(isSystemPrivacyMode_);
1231 }
1232 
WriteActionUpdateSnapshotSkip(Parcel& parcel)1233 bool WindowSessionProperty::WriteActionUpdateSnapshotSkip(Parcel& parcel)
1234 {
1235     return parcel.WriteBool(isSnapshotSkip_);
1236 }
1237 
WriteActionUpdateMaximizeState(Parcel& parcel)1238 bool WindowSessionProperty::WriteActionUpdateMaximizeState(Parcel& parcel)
1239 {
1240     return parcel.WriteUint32(static_cast<uint32_t>(maximizeMode_)) &&
1241         parcel.WriteBool(isLayoutFullScreen_);
1242 }
1243 
WriteActionUpdateSystemBar(Parcel& parcel)1244 bool WindowSessionProperty::WriteActionUpdateSystemBar(Parcel& parcel)
1245 {
1246     return MarshallingSystemBarMap(parcel);
1247 }
1248 
WriteActionUpdateFlags(Parcel& parcel)1249 bool WindowSessionProperty::WriteActionUpdateFlags(Parcel& parcel)
1250 {
1251     return parcel.WriteUint32(flags_);
1252 }
1253 
WriteActionUpdateMode(Parcel& parcel)1254 bool WindowSessionProperty::WriteActionUpdateMode(Parcel& parcel)
1255 {
1256     return parcel.WriteUint32(static_cast<uint32_t>(windowMode_));
1257 }
1258 
WriteActionUpdateAnimationFlag(Parcel& parcel)1259 bool WindowSessionProperty::WriteActionUpdateAnimationFlag(Parcel& parcel)
1260 {
1261     return parcel.WriteUint32(animationFlag_);
1262 }
1263 
WriteActionUpdateTouchHotArea(Parcel& parcel)1264 bool WindowSessionProperty::WriteActionUpdateTouchHotArea(Parcel& parcel)
1265 {
1266     return MarshallingTouchHotAreas(parcel);
1267 }
1268 
WriteActionUpdateDecorEnable(Parcel& parcel)1269 bool WindowSessionProperty::WriteActionUpdateDecorEnable(Parcel& parcel)
1270 {
1271     return parcel.WriteBool(isDecorEnable_);
1272 }
1273 
WriteActionUpdateWindowLimits(Parcel& parcel)1274 bool WindowSessionProperty::WriteActionUpdateWindowLimits(Parcel& parcel)
1275 {
1276     return MarshallingWindowLimits(parcel);
1277 }
1278 
WriteActionUpdateDragenabled(Parcel& parcel)1279 bool WindowSessionProperty::WriteActionUpdateDragenabled(Parcel& parcel)
1280 {
1281     return parcel.WriteBool(dragEnabled_);
1282 }
1283 
WriteActionUpdateRaiseenabled(Parcel& parcel)1284 bool WindowSessionProperty::WriteActionUpdateRaiseenabled(Parcel& parcel)
1285 {
1286     return parcel.WriteBool(raiseEnabled_);
1287 }
1288 
WriteActionUpdateHideNonSystemFloatingWindows(Parcel& parcel)1289 bool WindowSessionProperty::WriteActionUpdateHideNonSystemFloatingWindows(Parcel& parcel)
1290 {
1291     return parcel.WriteBool(hideNonSystemFloatingWindows_) &&
1292         parcel.WriteBool(isFloatingWindowAppType_) && parcel.WriteBool(forceHide_);
1293 }
1294 
WriteActionUpdateTextfieldAvoidInfo(Parcel& parcel)1295 bool WindowSessionProperty::WriteActionUpdateTextfieldAvoidInfo(Parcel& parcel)
1296 {
1297     return parcel.WriteDouble(textFieldPositionY_) && parcel.WriteDouble(textFieldHeight_);
1298 }
1299 
WriteActionUpdateWindowMask(Parcel& parcel)1300 bool WindowSessionProperty::WriteActionUpdateWindowMask(Parcel& parcel)
1301 {
1302     return MarshallingWindowMask(parcel);
1303 }
1304 
WriteActionUpdateTopmost(Parcel& parcel)1305 bool WindowSessionProperty::WriteActionUpdateTopmost(Parcel& parcel)
1306 {
1307     return parcel.WriteBool(topmost_);
1308 }
1309 
WriteActionUpdateMainWindowTopmost(Parcel& parcel)1310 bool WindowSessionProperty::WriteActionUpdateMainWindowTopmost(Parcel& parcel)
1311 {
1312     return MarshallingMainWindowTopmost(parcel);
1313 }
1314 
WriteActionUpdateModeSupportInfo(Parcel& parcel)1315 bool WindowSessionProperty::WriteActionUpdateModeSupportInfo(Parcel& parcel)
1316 {
1317     return parcel.WriteUint32(modeSupportInfo_);
1318 }
1319 
Read(Parcel& parcel, WSPropertyChangeAction action)1320 void WindowSessionProperty::Read(Parcel& parcel, WSPropertyChangeAction action)
1321 {
1322     const auto funcIter = readFuncMap_.find(static_cast<uint32_t>(action));
1323     if (funcIter == readFuncMap_.end()) {
1324         TLOGE(WmsLogTag::DEFAULT, "Failed to find func handler!");
1325         return;
1326     }
1327     SetPersistentId(parcel.ReadUint32());
1328     (this->*(funcIter->second))(parcel);
1329 }
1330 
ReadActionUpdateTurnScreenOn(Parcel& parcel)1331 void WindowSessionProperty::ReadActionUpdateTurnScreenOn(Parcel& parcel)
1332 {
1333     SetTurnScreenOn(parcel.ReadBool());
1334 }
1335 
ReadActionUpdateKeepScreenOn(Parcel& parcel)1336 void WindowSessionProperty::ReadActionUpdateKeepScreenOn(Parcel& parcel)
1337 {
1338     SetKeepScreenOn(parcel.ReadBool());
1339 }
1340 
ReadActionUpdateFocusable(Parcel& parcel)1341 void WindowSessionProperty::ReadActionUpdateFocusable(Parcel& parcel)
1342 {
1343     SetFocusable(parcel.ReadBool());
1344 }
1345 
ReadActionUpdateTouchable(Parcel& parcel)1346 void WindowSessionProperty::ReadActionUpdateTouchable(Parcel& parcel)
1347 {
1348     SetTouchable(parcel.ReadBool());
1349 }
1350 
ReadActionUpdateSetBrightness(Parcel& parcel)1351 void WindowSessionProperty::ReadActionUpdateSetBrightness(Parcel& parcel)
1352 {
1353     SetBrightness(parcel.ReadFloat());
1354 }
1355 
ReadActionUpdateOrientation(Parcel& parcel)1356 void WindowSessionProperty::ReadActionUpdateOrientation(Parcel& parcel)
1357 {
1358     SetRequestedOrientation(static_cast<Orientation>(parcel.ReadUint32()));
1359 }
1360 
ReadActionUpdatePrivacyMode(Parcel& parcel)1361 void WindowSessionProperty::ReadActionUpdatePrivacyMode(Parcel& parcel)
1362 {
1363     SetPrivacyMode(parcel.ReadBool());
1364     SetSystemPrivacyMode(parcel.ReadBool());
1365 }
1366 
ReadActionUpdateSnapshotSkip(Parcel& parcel)1367 void WindowSessionProperty::ReadActionUpdateSnapshotSkip(Parcel& parcel)
1368 {
1369     SetSnapshotSkip(parcel.ReadBool());
1370 }
1371 
ReadActionUpdateMaximizeState(Parcel& parcel)1372 void WindowSessionProperty::ReadActionUpdateMaximizeState(Parcel& parcel)
1373 {
1374     SetMaximizeMode(static_cast<MaximizeMode>(parcel.ReadUint32()));
1375     SetIsLayoutFullScreen(parcel.ReadBool());
1376 }
1377 
ReadActionUpdateSystemBar(Parcel& parcel)1378 void WindowSessionProperty::ReadActionUpdateSystemBar(Parcel& parcel)
1379 {
1380     UnMarshallingSystemBarMap(parcel, this);
1381 }
1382 
ReadActionUpdateFlags(Parcel& parcel)1383 void WindowSessionProperty::ReadActionUpdateFlags(Parcel& parcel)
1384 {
1385     SetWindowFlags(parcel.ReadUint32());
1386 }
1387 
ReadActionUpdateMode(Parcel& parcel)1388 void WindowSessionProperty::ReadActionUpdateMode(Parcel& parcel)
1389 {
1390     SetWindowMode(static_cast<WindowMode>(parcel.ReadUint32()));
1391 }
1392 
ReadActionUpdateAnimationFlag(Parcel& parcel)1393 void WindowSessionProperty::ReadActionUpdateAnimationFlag(Parcel& parcel)
1394 {
1395     SetAnimationFlag(parcel.ReadUint32());
1396 }
1397 
ReadActionUpdateTouchHotArea(Parcel& parcel)1398 void WindowSessionProperty::ReadActionUpdateTouchHotArea(Parcel& parcel)
1399 {
1400     UnmarshallingTouchHotAreas(parcel, this);
1401 }
1402 
ReadActionUpdateDecorEnable(Parcel& parcel)1403 void WindowSessionProperty::ReadActionUpdateDecorEnable(Parcel& parcel)
1404 {
1405     SetDecorEnable(parcel.ReadBool());
1406 }
1407 
ReadActionUpdateWindowLimits(Parcel& parcel)1408 void WindowSessionProperty::ReadActionUpdateWindowLimits(Parcel& parcel)
1409 {
1410     UnmarshallingWindowLimits(parcel, this);
1411 }
1412 
ReadActionUpdateDragenabled(Parcel& parcel)1413 void WindowSessionProperty::ReadActionUpdateDragenabled(Parcel& parcel)
1414 {
1415     SetDragEnabled(parcel.ReadBool());
1416 }
1417 
ReadActionUpdateRaiseenabled(Parcel& parcel)1418 void WindowSessionProperty::ReadActionUpdateRaiseenabled(Parcel& parcel)
1419 {
1420     SetRaiseEnabled(parcel.ReadBool());
1421 }
1422 
ReadActionUpdateHideNonSystemFloatingWindows(Parcel& parcel)1423 void WindowSessionProperty::ReadActionUpdateHideNonSystemFloatingWindows(Parcel& parcel)
1424 {
1425     SetHideNonSystemFloatingWindows(parcel.ReadBool());
1426     SetFloatingWindowAppType(parcel.ReadBool());
1427     SetForceHide(parcel.ReadBool());
1428 }
1429 
ReadActionUpdateTextfieldAvoidInfo(Parcel& parcel)1430 void WindowSessionProperty::ReadActionUpdateTextfieldAvoidInfo(Parcel& parcel)
1431 {
1432     SetTextFieldPositionY(parcel.ReadDouble());
1433     SetTextFieldHeight(parcel.ReadDouble());
1434 }
1435 
ReadActionUpdateWindowMask(Parcel& parcel)1436 void WindowSessionProperty::ReadActionUpdateWindowMask(Parcel& parcel)
1437 {
1438     UnmarshallingWindowMask(parcel, this);
1439 }
1440 
ReadActionUpdateTopmost(Parcel& parcel)1441 void WindowSessionProperty::ReadActionUpdateTopmost(Parcel& parcel)
1442 {
1443     SetTopmost(parcel.ReadBool());
1444 }
1445 
ReadActionUpdateMainWindowTopmost(Parcel& parcel)1446 void WindowSessionProperty::ReadActionUpdateMainWindowTopmost(Parcel& parcel)
1447 {
1448     UnmarshallingMainWindowTopmost(parcel, this);
1449 }
1450 
ReadActionUpdateModeSupportInfo(Parcel& parcel)1451 void WindowSessionProperty::ReadActionUpdateModeSupportInfo(Parcel& parcel)
1452 {
1453     SetModeSupportInfo(parcel.ReadUint32());
1454 }
1455 
SetTransform(const Transform& trans)1456 void WindowSessionProperty::SetTransform(const Transform& trans)
1457 {
1458     trans_ = trans;
1459 }
1460 
GetTransform() const1461 const Transform& WindowSessionProperty::GetTransform() const
1462 {
1463     return trans_;
1464 }
1465 
SetTextFieldPositionY(double textFieldPositionY)1466 void WindowSessionProperty::SetTextFieldPositionY(double textFieldPositionY)
1467 {
1468     textFieldPositionY_ = textFieldPositionY;
1469 }
1470 
SetTextFieldHeight(double textFieldHeight)1471 void WindowSessionProperty::SetTextFieldHeight(double textFieldHeight)
1472 {
1473     textFieldHeight_ = textFieldHeight;
1474 }
1475 
GetTextFieldPositionY() const1476 double WindowSessionProperty::GetTextFieldPositionY() const
1477 {
1478     return textFieldPositionY_;
1479 }
1480 
GetTextFieldHeight() const1481 double WindowSessionProperty::GetTextFieldHeight() const
1482 {
1483     return textFieldHeight_;
1484 }
1485 
SetSessionPropertyChangeCallback(std::function<void()>&& callback)1486 void WindowSessionProperty::SetSessionPropertyChangeCallback(std::function<void()>&& callback)
1487 {
1488     touchHotAreasChangeCallback_ = std::move(callback);
1489 }
1490 
IsLayoutFullScreen() const1491 bool WindowSessionProperty::IsLayoutFullScreen() const
1492 {
1493     return isLayoutFullScreen_;
1494 }
1495 
SetIsLayoutFullScreen(bool isLayoutFullScreen)1496 void WindowSessionProperty::SetIsLayoutFullScreen(bool isLayoutFullScreen)
1497 {
1498     isLayoutFullScreen_ = isLayoutFullScreen;
1499 }
1500 
SetRealParentId(int32_t realParentId)1501 void WindowSessionProperty::SetRealParentId(int32_t realParentId)
1502 {
1503     realParentId_ = realParentId;
1504 }
1505 
GetRealParentId() const1506 int32_t WindowSessionProperty::GetRealParentId() const
1507 {
1508     return realParentId_;
1509 }
1510 
SetIsUIExtFirstSubWindow(bool isUIExtFirstSubWindow)1511 void WindowSessionProperty::SetIsUIExtFirstSubWindow(bool isUIExtFirstSubWindow)
1512 {
1513     isUIExtFirstSubWindow_ = isUIExtFirstSubWindow;
1514 }
1515 
GetIsUIExtFirstSubWindow() const1516 bool WindowSessionProperty::GetIsUIExtFirstSubWindow() const
1517 {
1518     return isUIExtFirstSubWindow_;
1519 }
1520 
SetIsUIExtensionAbilityProcess(bool isUIExtensionAbilityProcess)1521 void WindowSessionProperty::SetIsUIExtensionAbilityProcess(bool isUIExtensionAbilityProcess)
1522 {
1523     isUIExtensionAbilityProcess_ = isUIExtensionAbilityProcess;
1524 }
1525 
GetIsUIExtensionAbilityProcess() const1526 bool WindowSessionProperty::GetIsUIExtensionAbilityProcess() const
1527 {
1528     return isUIExtensionAbilityProcess_;
1529 }
1530 
SetIsUIExtAnySubWindow(bool isUIExtAnySubWindow)1531 void WindowSessionProperty::SetIsUIExtAnySubWindow(bool isUIExtAnySubWindow)
1532 {
1533     isUIExtAnySubWindow_ = isUIExtAnySubWindow;
1534 }
1535 
GetIsUIExtAnySubWindow() const1536 bool WindowSessionProperty::GetIsUIExtAnySubWindow() const
1537 {
1538     return isUIExtAnySubWindow_;
1539 }
1540 
SetUIExtensionUsage(UIExtensionUsage uiExtensionUsage)1541 void WindowSessionProperty::SetUIExtensionUsage(UIExtensionUsage uiExtensionUsage)
1542 {
1543     uiExtensionUsage_ = uiExtensionUsage;
1544 }
1545 
GetUIExtensionUsage() const1546 UIExtensionUsage WindowSessionProperty::GetUIExtensionUsage() const
1547 {
1548     return uiExtensionUsage_;
1549 }
1550 
SetParentWindowType(WindowType parentWindowType)1551 void WindowSessionProperty::SetParentWindowType(WindowType parentWindowType)
1552 {
1553     parentWindowType_= parentWindowType;
1554 }
1555 
GetParentWindowType() const1556 WindowType WindowSessionProperty::GetParentWindowType() const
1557 {
1558     return parentWindowType_;
1559 }
1560 
SetWindowMask(const std::shared_ptr<Media::PixelMap>& windowMask)1561 void WindowSessionProperty::SetWindowMask(const std::shared_ptr<Media::PixelMap>& windowMask)
1562 {
1563     windowMask_ = windowMask;
1564 }
1565 
GetWindowMask() const1566 std::shared_ptr<Media::PixelMap> WindowSessionProperty::GetWindowMask() const
1567 {
1568     return windowMask_;
1569 }
1570 
SetIsShaped(bool isShaped)1571 void WindowSessionProperty::SetIsShaped(bool isShaped)
1572 {
1573     isShaped_ = isShaped;
1574 }
1575 
GetIsShaped() const1576 bool WindowSessionProperty::GetIsShaped() const
1577 {
1578     return isShaped_;
1579 }
1580 
GetCollaboratorType() const1581 int32_t WindowSessionProperty::GetCollaboratorType() const
1582 {
1583     return collaboratorType_;
1584 }
1585 
SetCollaboratorType(int32_t collaboratorType)1586 void WindowSessionProperty::SetCollaboratorType(int32_t collaboratorType)
1587 {
1588     collaboratorType_ = collaboratorType;
1589 }
1590 
SetUserWindowLimits(const WindowLimits& windowUserLimits)1591 void WindowSessionProperty::SetUserWindowLimits(const WindowLimits& windowUserLimits)
1592 {
1593     userLimits_ = windowUserLimits;
1594 }
1595 
GetUserWindowLimits() const1596 WindowLimits WindowSessionProperty::GetUserWindowLimits() const
1597 {
1598     return userLimits_;
1599 }
1600 
SetConfigWindowLimitsVP(const WindowLimits& windowConfigLimitsVP)1601 void WindowSessionProperty::SetConfigWindowLimitsVP(const WindowLimits& windowConfigLimitsVP)
1602 {
1603     configLimitsVP_ = windowConfigLimitsVP;
1604 }
1605 
GetConfigWindowLimitsVP() const1606 WindowLimits WindowSessionProperty::GetConfigWindowLimitsVP() const
1607 {
1608     return configLimitsVP_;
1609 }
1610 
SetLastLimitsVpr(float vpr)1611 void WindowSessionProperty::SetLastLimitsVpr(float vpr)
1612 {
1613     lastVpr_ = vpr;
1614 }
1615 
GetLastLimitsVpr() const1616 float WindowSessionProperty::GetLastLimitsVpr() const
1617 {
1618     return lastVpr_;
1619 }
1620 
GetFullScreenStart() const1621 bool WindowSessionProperty::GetFullScreenStart() const
1622 {
1623     return fullScreenStart_;
1624 }
1625 
SetFullScreenStart(bool fullScreenStart)1626 void WindowSessionProperty::SetFullScreenStart(bool fullScreenStart)
1627 {
1628     fullScreenStart_ = fullScreenStart;
1629 }
1630 
SetAppInstanceKey(const std::string& appInstanceKey)1631 void WindowSessionProperty::SetAppInstanceKey(const std::string& appInstanceKey)
1632 {
1633     appInstanceKey_ = appInstanceKey;
1634 }
1635 
GetAppInstanceKey() const1636 std::string WindowSessionProperty::GetAppInstanceKey() const
1637 {
1638     return appInstanceKey_;
1639 }
1640 } // namespace Rosen
1641 } // namespace OHOS
1642