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 TRANSTITION_ANIMATION_MAP_SIZE_MAX_NUM = 100;
26 }
27
28 const std::map<uint64_t, HandlWritePropertyFunc> WindowSessionProperty::writeFuncMap_ {
29 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON),
30 &WindowSessionProperty::WriteActionUpdateTurnScreenOn),
31 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON),
32 &WindowSessionProperty::WriteActionUpdateKeepScreenOn),
33 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_VIEW_KEEP_SCREEN_ON),
34 &WindowSessionProperty::WriteActionUpdateViewKeepScreenOn),
35 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_FOCUSABLE),
36 &WindowSessionProperty::WriteActionUpdateFocusable),
37 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TOUCHABLE),
38 &WindowSessionProperty::WriteActionUpdateTouchable),
39 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS),
40 &WindowSessionProperty::WriteActionUpdateSetBrightness),
41 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_ORIENTATION),
42 &WindowSessionProperty::WriteActionUpdateOrientation),
43 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE),
44 &WindowSessionProperty::WriteActionUpdatePrivacyMode),
45 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_SYSTEM_PRIVACY_MODE),
46 &WindowSessionProperty::WriteActionUpdatePrivacyMode),
47 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_SNAPSHOT_SKIP),
48 &WindowSessionProperty::WriteActionUpdateSnapshotSkip),
49 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_MAXIMIZE_STATE),
50 &WindowSessionProperty::WriteActionUpdateMaximizeState),
51 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_OTHER_PROPS),
52 &WindowSessionProperty::WriteActionUpdateSystemBar),
53 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_STATUS_PROPS),
54 &WindowSessionProperty::WriteActionUpdateSystemBar),
55 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_PROPS),
56 &WindowSessionProperty::WriteActionUpdateSystemBar),
57 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS),
58 &WindowSessionProperty::WriteActionUpdateSystemBar),
59 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_FLAGS),
60 &WindowSessionProperty::WriteActionUpdateFlags),
61 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_MODE),
62 &WindowSessionProperty::WriteActionUpdateMode),
63 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG),
64 &WindowSessionProperty::WriteActionUpdateAnimationFlag),
65 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA),
66 &WindowSessionProperty::WriteActionUpdateTouchHotArea),
67 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_KEYBOARD_TOUCH_HOT_AREA),
68 &WindowSessionProperty::WriteActionUpdateKeyboardTouchHotArea),
69 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE),
70 &WindowSessionProperty::WriteActionUpdateDecorEnable),
71 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS),
72 &WindowSessionProperty::WriteActionUpdateWindowLimits),
73 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED),
74 &WindowSessionProperty::WriteActionUpdateDragenabled),
75 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_RAISEENABLED),
76 &WindowSessionProperty::WriteActionUpdateRaiseenabled),
77 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS),
78 &WindowSessionProperty::WriteActionUpdateHideNonSystemFloatingWindows),
79 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TEXTFIELD_AVOID_INFO),
80 &WindowSessionProperty::WriteActionUpdateTextfieldAvoidInfo),
81 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_MASK),
82 &WindowSessionProperty::WriteActionUpdateWindowMask),
83 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TOPMOST),
84 &WindowSessionProperty::WriteActionUpdateTopmost),
85 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_SUB_WINDOW_Z_LEVEL),
86 &WindowSessionProperty::WriteActionUpdateSubWindowZLevel),
87 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO),
88 &WindowSessionProperty::WriteActionUpdateWindowModeSupportType),
89 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST),
90 &WindowSessionProperty::WriteActionUpdateMainWindowTopmost),
91 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_AVOID_AREA_OPTION),
92 &WindowSessionProperty::WriteActionUpdateAvoidAreaOption),
93 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_BACKGROUND_ALPHA),
94 &WindowSessionProperty::WriteActionUpdateBackgroundAlpha),
95 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_EXCLUSIVE_HIGHLIGHTED),
96 &WindowSessionProperty::WriteActionUpdateExclusivelyHighlighted),
97 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_FOLLOW_SCREEN_CHANGE),
98 &WindowSessionProperty::WriteActionUpdateFollowScreenChange),
99 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_SHADOW_ENABLED),
100 &WindowSessionProperty::WriteActionUpdateWindowShadowEnabled),
101 };
102
103 const std::map<uint64_t, HandlReadPropertyFunc> WindowSessionProperty::readFuncMap_ {
104 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON),
105 &WindowSessionProperty::ReadActionUpdateTurnScreenOn),
106 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON),
107 &WindowSessionProperty::ReadActionUpdateKeepScreenOn),
108 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_VIEW_KEEP_SCREEN_ON),
109 &WindowSessionProperty::ReadActionUpdateViewKeepScreenOn),
110 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_FOCUSABLE),
111 &WindowSessionProperty::ReadActionUpdateFocusable),
112 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TOUCHABLE),
113 &WindowSessionProperty::ReadActionUpdateTouchable),
114 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS),
115 &WindowSessionProperty::ReadActionUpdateSetBrightness),
116 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_ORIENTATION),
117 &WindowSessionProperty::ReadActionUpdateOrientation),
118 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_PRIVACY_MODE),
119 &WindowSessionProperty::ReadActionUpdatePrivacyMode),
120 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_SYSTEM_PRIVACY_MODE),
121 &WindowSessionProperty::ReadActionUpdatePrivacyMode),
122 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_SNAPSHOT_SKIP),
123 &WindowSessionProperty::ReadActionUpdateSnapshotSkip),
124 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_MAXIMIZE_STATE),
125 &WindowSessionProperty::ReadActionUpdateMaximizeState),
126 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_OTHER_PROPS),
127 &WindowSessionProperty::ReadActionUpdateSystemBar),
128 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_STATUS_PROPS),
129 &WindowSessionProperty::ReadActionUpdateSystemBar),
130 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_PROPS),
131 &WindowSessionProperty::ReadActionUpdateSystemBar),
132 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS),
133 &WindowSessionProperty::ReadActionUpdateSystemBar),
134 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_FLAGS),
135 &WindowSessionProperty::ReadActionUpdateFlags),
136 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_MODE),
137 &WindowSessionProperty::ReadActionUpdateMode),
138 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG),
139 &WindowSessionProperty::ReadActionUpdateAnimationFlag),
140 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA),
141 &WindowSessionProperty::ReadActionUpdateTouchHotArea),
142 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_KEYBOARD_TOUCH_HOT_AREA),
143 &WindowSessionProperty::ReadActionUpdateKeyboardTouchHotArea),
144 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_DECOR_ENABLE),
145 &WindowSessionProperty::ReadActionUpdateDecorEnable),
146 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS),
147 &WindowSessionProperty::ReadActionUpdateWindowLimits),
148 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_DRAGENABLED),
149 &WindowSessionProperty::ReadActionUpdateDragenabled),
150 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_RAISEENABLED),
151 &WindowSessionProperty::ReadActionUpdateRaiseenabled),
152 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS),
153 &WindowSessionProperty::ReadActionUpdateHideNonSystemFloatingWindows),
154 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TEXTFIELD_AVOID_INFO),
155 &WindowSessionProperty::ReadActionUpdateTextfieldAvoidInfo),
156 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_MASK),
157 &WindowSessionProperty::ReadActionUpdateWindowMask),
158 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_TOPMOST),
159 &WindowSessionProperty::ReadActionUpdateTopmost),
160 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_SUB_WINDOW_Z_LEVEL),
161 &WindowSessionProperty::ReadActionUpdateSubWindowZLevel),
162 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO),
163 &WindowSessionProperty::ReadActionUpdateWindowModeSupportType),
164 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_MAIN_WINDOW_TOPMOST),
165 &WindowSessionProperty::ReadActionUpdateMainWindowTopmost),
166 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_AVOID_AREA_OPTION),
167 &WindowSessionProperty::ReadActionUpdateAvoidAreaOption),
168 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_BACKGROUND_ALPHA),
169 &WindowSessionProperty::ReadActionUpdateBackgroundAlpha),
170 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_EXCLUSIVE_HIGHLIGHTED),
171 &WindowSessionProperty::ReadActionUpdateExclusivelyHighlighted),
172 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_FOLLOW_SCREEN_CHANGE),
173 &WindowSessionProperty::ReadActionUpdateFollowScreenChange),
174 std::make_pair(static_cast<uint64_t>(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_SHADOW_ENABLED),
175 &WindowSessionProperty::ReadActionUpdateWindowShadowEnabled),
176 };
177
WindowSessionProperty(const sptr<WindowSessionProperty> & property)178 WindowSessionProperty::WindowSessionProperty(const sptr<WindowSessionProperty>& property)
179 {
180 CopyFrom(property);
181 }
182
SetWindowName(const std::string & name)183 void WindowSessionProperty::SetWindowName(const std::string& name)
184 {
185 windowName_ = name;
186 }
187
SetSessionInfo(const SessionInfo & info)188 void WindowSessionProperty::SetSessionInfo(const SessionInfo& info)
189 {
190 sessionInfo_ = info;
191 }
192
SetTransitionAnimationConfig(WindowTransitionType transitionType,const TransitionAnimation & animation)193 void WindowSessionProperty::SetTransitionAnimationConfig(WindowTransitionType transitionType,
194 const TransitionAnimation& animation)
195 {
196 transitionAnimationConfig_[transitionType] = std::make_shared<TransitionAnimation>(animation);
197 }
198
SetWindowRect(const struct Rect & rect)199 void WindowSessionProperty::SetWindowRect(const struct Rect& rect)
200 {
201 std::lock_guard<std::mutex> lock(windowRectMutex_);
202 windowRect_ = rect;
203 }
204
SetRequestRect(const Rect & requestRect)205 void WindowSessionProperty::SetRequestRect(const Rect& requestRect)
206 {
207 std::lock_guard<std::mutex> lock(requestRectMutex_);
208 requestRect_ = requestRect;
209 }
210
SetRectAnimationConfig(const RectAnimationConfig & rectAnimationConfig)211 void WindowSessionProperty::SetRectAnimationConfig(const RectAnimationConfig& rectAnimationConfig)
212 {
213 std::lock_guard<std::mutex> lock(rectAnimationConfigMutex_);
214 rectAnimationConfig_ = rectAnimationConfig;
215 }
216
SetWindowType(WindowType type)217 void WindowSessionProperty::SetWindowType(WindowType type)
218 {
219 type_ = type;
220 }
221
SetFocusable(bool isFocusable)222 void WindowSessionProperty::SetFocusable(bool isFocusable)
223 {
224 focusable_ = isFocusable;
225 }
226
SetFocusableOnShow(bool isFocusableOnShow)227 void WindowSessionProperty::SetFocusableOnShow(bool isFocusableOnShow)
228 {
229 focusableOnShow_ = isFocusableOnShow;
230 }
231
SetTouchable(bool isTouchable)232 void WindowSessionProperty::SetTouchable(bool isTouchable)
233 {
234 touchable_ = isTouchable;
235 }
236
SetDragEnabled(bool dragEnabled)237 void WindowSessionProperty::SetDragEnabled(bool dragEnabled)
238 {
239 dragEnabled_ = dragEnabled;
240 }
241
SetHideNonSystemFloatingWindows(bool hide)242 void WindowSessionProperty::SetHideNonSystemFloatingWindows(bool hide)
243 {
244 hideNonSystemFloatingWindows_ = hide;
245 }
246
SetSkipSelfWhenShowOnVirtualScreen(bool isSkip)247 void WindowSessionProperty::SetSkipSelfWhenShowOnVirtualScreen(bool isSkip)
248 {
249 isSkipSelfWhenShowOnVirtualScreen_ = isSkip;
250 }
251
SetSkipEventOnCastPlus(bool isSkip)252 void WindowSessionProperty::SetSkipEventOnCastPlus(bool isSkip)
253 {
254 isSkipEventOnCastPlus_ = isSkip;
255 }
256
SetForceHide(bool hide)257 void WindowSessionProperty::SetForceHide(bool hide)
258 {
259 forceHide_ = hide;
260 }
261
SetRaiseEnabled(bool raiseEnabled)262 void WindowSessionProperty::SetRaiseEnabled(bool raiseEnabled)
263 {
264 raiseEnabled_ = raiseEnabled;
265 }
266
SetRequestedOrientation(Orientation orientation,bool needAnimation)267 void WindowSessionProperty::SetRequestedOrientation(Orientation orientation, bool needAnimation)
268 {
269 requestedOrientation_ = orientation;
270 needRotateAnimation_ = needAnimation;
271 }
272
SetDefaultRequestedOrientation(Orientation orientation)273 void WindowSessionProperty::SetDefaultRequestedOrientation(Orientation orientation)
274 {
275 defaultRequestedOrientation_ = orientation;
276 }
277
SetUserRequestedOrientation(Orientation orientation)278 void WindowSessionProperty::SetUserRequestedOrientation(Orientation orientation)
279 {
280 userRequestedOrientation_ = orientation;
281 }
282
SetPrivacyMode(bool isPrivate)283 void WindowSessionProperty::SetPrivacyMode(bool isPrivate)
284 {
285 isPrivacyMode_ = isPrivate;
286 }
287
SetSystemPrivacyMode(bool isSystemPrivate)288 void WindowSessionProperty::SetSystemPrivacyMode(bool isSystemPrivate)
289 {
290 isSystemPrivacyMode_ = isSystemPrivate;
291 }
292
SetSnapshotSkip(bool isSkip)293 void WindowSessionProperty::SetSnapshotSkip(bool isSkip)
294 {
295 isSnapshotSkip_ = isSkip;
296 }
297
SetBrightness(float brightness)298 void WindowSessionProperty::SetBrightness(float brightness)
299 {
300 brightness_ = brightness;
301 }
302
SetSystemCalling(bool isSystemCalling)303 void WindowSessionProperty::SetSystemCalling(bool isSystemCalling)
304 {
305 isSystemCalling_ = isSystemCalling;
306 }
307
SetDisplayId(DisplayId displayId)308 void WindowSessionProperty::SetDisplayId(DisplayId displayId)
309 {
310 displayId_ = displayId;
311 }
312
SetIsFollowParentWindowDisplayId(bool enabled)313 void WindowSessionProperty::SetIsFollowParentWindowDisplayId(bool enabled)
314 {
315 isFollowParentWindowDisplayId_ = enabled;
316 }
317
SetFloatingWindowAppType(bool isAppType)318 void WindowSessionProperty::SetFloatingWindowAppType(bool isAppType)
319 {
320 isFloatingWindowAppType_ = isAppType;
321 }
322
GetWindowName() const323 const std::string& WindowSessionProperty::GetWindowName() const
324 {
325 return windowName_;
326 }
327
GetSessionInfo() const328 const SessionInfo& WindowSessionProperty::GetSessionInfo() const
329 {
330 return sessionInfo_;
331 }
332
GetTransitionAnimationConfig() const333 TransitionAnimationMapType WindowSessionProperty::GetTransitionAnimationConfig() const
334 {
335 return transitionAnimationConfig_;
336 }
337
EditSessionInfo()338 SessionInfo& WindowSessionProperty::EditSessionInfo()
339 {
340 return sessionInfo_;
341 }
342
SetGlobalDisplayRect(const Rect & globalDisplayRect)343 void WindowSessionProperty::SetGlobalDisplayRect(const Rect& globalDisplayRect)
344 {
345 TLOGD(WmsLogTag::WMS_ATTRIBUTE, "globalDisplayRect=%{public}s", globalDisplayRect.ToString().c_str());
346 std::lock_guard<std::mutex> lock(globalDisplayRectMutex_);
347 globalDisplayRect_ = globalDisplayRect;
348 }
349
GetGlobalDisplayRect() const350 Rect WindowSessionProperty::GetGlobalDisplayRect() const
351 {
352 std::lock_guard<std::mutex> lock(globalDisplayRectMutex_);
353 return globalDisplayRect_;
354 }
355
GetWindowRect() const356 Rect WindowSessionProperty::GetWindowRect() const
357 {
358 std::lock_guard<std::mutex> lock(windowRectMutex_);
359 return windowRect_;
360 }
361
GetRequestRect() const362 Rect WindowSessionProperty::GetRequestRect() const
363 {
364 std::lock_guard<std::mutex> lock(requestRectMutex_);
365 return requestRect_;
366 }
367
GetRectAnimationConfig() const368 RectAnimationConfig WindowSessionProperty::GetRectAnimationConfig() const
369 {
370 std::lock_guard<std::mutex> lock(rectAnimationConfigMutex_);
371 return rectAnimationConfig_;
372 }
373
GetWindowType() const374 WindowType WindowSessionProperty::GetWindowType() const
375 {
376 return type_;
377 }
378
GetFocusable() const379 bool WindowSessionProperty::GetFocusable() const
380 {
381 return focusable_;
382 }
383
GetFocusableOnShow() const384 bool WindowSessionProperty::GetFocusableOnShow() const
385 {
386 return focusableOnShow_;
387 }
388
GetTouchable() const389 bool WindowSessionProperty::GetTouchable() const
390 {
391 return touchable_;
392 }
393
GetDragEnabled() const394 bool WindowSessionProperty::GetDragEnabled() const
395 {
396 return dragEnabled_;
397 }
398
GetHideNonSystemFloatingWindows() const399 bool WindowSessionProperty::GetHideNonSystemFloatingWindows() const
400 {
401 return hideNonSystemFloatingWindows_;
402 }
403
GetSkipSelfWhenShowOnVirtualScreen() const404 bool WindowSessionProperty::GetSkipSelfWhenShowOnVirtualScreen() const
405 {
406 return isSkipSelfWhenShowOnVirtualScreen_;
407 }
408
GetSkipEventOnCastPlus() const409 bool WindowSessionProperty::GetSkipEventOnCastPlus() const
410 {
411 return isSkipEventOnCastPlus_;
412 }
413
GetForceHide() const414 bool WindowSessionProperty::GetForceHide() const
415 {
416 return forceHide_;
417 }
418
GetRaiseEnabled() const419 bool WindowSessionProperty::GetRaiseEnabled() const
420 {
421 return raiseEnabled_;
422 }
423
GetRequestedOrientation() const424 Orientation WindowSessionProperty::GetRequestedOrientation() const
425 {
426 return requestedOrientation_;
427 }
428
GetRequestedAnimation() const429 bool WindowSessionProperty::GetRequestedAnimation() const
430 {
431 return needRotateAnimation_;
432 }
433
GetDefaultRequestedOrientation() const434 Orientation WindowSessionProperty::GetDefaultRequestedOrientation() const
435 {
436 return defaultRequestedOrientation_;
437 }
438
GetUserRequestedOrientation() const439 Orientation WindowSessionProperty::GetUserRequestedOrientation() const
440 {
441 return userRequestedOrientation_;
442 }
443
GetPrivacyMode() const444 bool WindowSessionProperty::GetPrivacyMode() const
445 {
446 return isPrivacyMode_;
447 }
448
GetSystemPrivacyMode() const449 bool WindowSessionProperty::GetSystemPrivacyMode() const
450 {
451 return isSystemPrivacyMode_;
452 }
453
GetSnapshotSkip() const454 bool WindowSessionProperty::GetSnapshotSkip() const
455 {
456 return isSnapshotSkip_;
457 }
458
GetBrightness() const459 float WindowSessionProperty::GetBrightness() const
460 {
461 return brightness_;
462 }
463
GetSystemCalling() const464 bool WindowSessionProperty::GetSystemCalling() const
465 {
466 return isSystemCalling_;
467 }
468
GetDisplayId() const469 DisplayId WindowSessionProperty::GetDisplayId() const
470 {
471 return displayId_;
472 }
473
IsFollowParentWindowDisplayId() const474 bool WindowSessionProperty::IsFollowParentWindowDisplayId() const
475 {
476 return isFollowParentWindowDisplayId_;
477 }
478
SetParentId(int32_t parentId)479 void WindowSessionProperty::SetParentId(int32_t parentId)
480 {
481 parentId_ = parentId;
482 }
483
GetParentId() const484 int32_t WindowSessionProperty::GetParentId() const
485 {
486 return parentId_;
487 }
488
SetWindowFlags(uint32_t flags)489 void WindowSessionProperty::SetWindowFlags(uint32_t flags)
490 {
491 flags_ = flags;
492 }
493
SetTopmost(bool topmost)494 void WindowSessionProperty::SetTopmost(bool topmost)
495 {
496 topmost_ = topmost;
497 }
498
IsTopmost() const499 bool WindowSessionProperty::IsTopmost() const
500 {
501 return topmost_;
502 }
503
SetAvoidAreaOption(uint32_t avoidAreaOption)504 void WindowSessionProperty::SetAvoidAreaOption(uint32_t avoidAreaOption)
505 {
506 avoidAreaOption_ = avoidAreaOption;
507 }
508
GetAvoidAreaOption() const509 uint32_t WindowSessionProperty::GetAvoidAreaOption() const
510 {
511 return avoidAreaOption_;
512 }
513
SetMainWindowTopmost(bool isTopmost)514 void WindowSessionProperty::SetMainWindowTopmost(bool isTopmost)
515 {
516 mainWindowTopmost_ = isTopmost;
517 }
518
IsMainWindowTopmost() const519 bool WindowSessionProperty::IsMainWindowTopmost() const
520 {
521 return mainWindowTopmost_;
522 }
523
SetWindowDelayRaiseEnabled(bool isEnabled)524 void WindowSessionProperty::SetWindowDelayRaiseEnabled(bool isEnabled)
525 {
526 isWindowDelayRaiseEnabled_ = isEnabled;
527 }
528
IsWindowDelayRaiseEnabled() const529 bool WindowSessionProperty::IsWindowDelayRaiseEnabled() const
530 {
531 return isWindowDelayRaiseEnabled_;
532 }
533
AddWindowFlag(WindowFlag flag)534 void WindowSessionProperty::AddWindowFlag(WindowFlag flag)
535 {
536 flags_ |= static_cast<uint32_t>(flag);
537 }
538
GetWindowFlags() const539 uint32_t WindowSessionProperty::GetWindowFlags() const
540 {
541 return flags_;
542 }
543
SetPersistentId(int32_t persistentId)544 void WindowSessionProperty::SetPersistentId(int32_t persistentId)
545 {
546 persistentId_ = persistentId;
547 }
548
GetPersistentId() const549 int32_t WindowSessionProperty::GetPersistentId() const
550 {
551 return persistentId_;
552 }
553
SetParentPersistentId(int32_t persistentId)554 void WindowSessionProperty::SetParentPersistentId(int32_t persistentId)
555 {
556 parentPersistentId_ = persistentId;
557 }
558
GetParentPersistentId() const559 int32_t WindowSessionProperty::GetParentPersistentId() const
560 {
561 return parentPersistentId_;
562 }
563
SetTurnScreenOn(bool turnScreenOn)564 void WindowSessionProperty::SetTurnScreenOn(bool turnScreenOn)
565 {
566 turnScreenOn_ = turnScreenOn;
567 }
568
IsTurnScreenOn() const569 bool WindowSessionProperty::IsTurnScreenOn() const
570 {
571 return turnScreenOn_;
572 }
573
SetKeepScreenOn(bool keepScreenOn)574 void WindowSessionProperty::SetKeepScreenOn(bool keepScreenOn)
575 {
576 keepScreenOn_ = keepScreenOn;
577 }
578
IsKeepScreenOn() const579 bool WindowSessionProperty::IsKeepScreenOn() const
580 {
581 return keepScreenOn_;
582 }
583
SetViewKeepScreenOn(bool keepScreenOn)584 void WindowSessionProperty::SetViewKeepScreenOn(bool keepScreenOn)
585 {
586 viewKeepScreenOn_ = keepScreenOn;
587 }
588
IsViewKeepScreenOn() const589 bool WindowSessionProperty::IsViewKeepScreenOn() const
590 {
591 return viewKeepScreenOn_;
592 }
593
SetWindowShadowEnabled(bool isEnabled)594 void WindowSessionProperty::SetWindowShadowEnabled(bool isEnabled)
595 {
596 windowShadowEnabled_ = isEnabled;
597 }
598
GetWindowShadowEnabled() const599 bool WindowSessionProperty::GetWindowShadowEnabled() const
600 {
601 return windowShadowEnabled_;
602 }
603
SetAccessTokenId(uint32_t accessTokenId)604 void WindowSessionProperty::SetAccessTokenId(uint32_t accessTokenId)
605 {
606 accessTokenId_ = accessTokenId;
607 }
608
GetAccessTokenId() const609 uint32_t WindowSessionProperty::GetAccessTokenId() const
610 {
611 return accessTokenId_;
612 }
613
SetTokenState(bool hasToken)614 void WindowSessionProperty::SetTokenState(bool hasToken)
615 {
616 tokenState_ = hasToken;
617 }
618
GetTokenState() const619 bool WindowSessionProperty::GetTokenState() const
620 {
621 return tokenState_;
622 }
623
GetMaximizeMode() const624 MaximizeMode WindowSessionProperty::GetMaximizeMode() const
625 {
626 return maximizeMode_;
627 }
628
SetMaximizeMode(MaximizeMode mode)629 void WindowSessionProperty::SetMaximizeMode(MaximizeMode mode)
630 {
631 maximizeMode_ = mode;
632 }
633
SetFollowScreenChange(bool isFollowScreenChange)634 void WindowSessionProperty::SetFollowScreenChange(bool isFollowScreenChange)
635 {
636 isFollowScreenChange_ = isFollowScreenChange;
637 }
638
GetFollowScreenChange() const639 bool WindowSessionProperty::GetFollowScreenChange() const
640 {
641 return isFollowScreenChange_;
642 }
643
SetSystemBarProperty(WindowType type,const SystemBarProperty & property)644 void WindowSessionProperty::SetSystemBarProperty(WindowType type, const SystemBarProperty& property)
645 {
646 if (type == WindowType::WINDOW_TYPE_STATUS_BAR ||
647 type == WindowType::WINDOW_TYPE_NAVIGATION_BAR ||
648 type == WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR) {
649 sysBarPropMap_[type] = property;
650 }
651 }
652
GetSystemBarProperty() const653 std::unordered_map<WindowType, SystemBarProperty> WindowSessionProperty::GetSystemBarProperty() const
654 {
655 return sysBarPropMap_;
656 }
657
SetWindowLimits(const WindowLimits & windowLimits)658 void WindowSessionProperty::SetWindowLimits(const WindowLimits& windowLimits)
659 {
660 limits_ = windowLimits;
661 }
662
GetWindowLimits() const663 WindowLimits WindowSessionProperty::GetWindowLimits() const
664 {
665 return limits_;
666 }
667
SetWindowMode(WindowMode mode)668 void WindowSessionProperty::SetWindowMode(WindowMode mode)
669 {
670 windowMode_ = mode;
671 }
672
GetWindowMode() const673 WindowMode WindowSessionProperty::GetWindowMode() const
674 {
675 return windowMode_;
676 }
677
GetWindowState() const678 WindowState WindowSessionProperty::GetWindowState() const
679 {
680 return windowState_;
681 }
682
SetWindowState(WindowState state)683 void WindowSessionProperty::SetWindowState(WindowState state)
684 {
685 windowState_ = state;
686 }
687
SetKeyboardLayoutParams(const KeyboardLayoutParams & params)688 void WindowSessionProperty::SetKeyboardLayoutParams(const KeyboardLayoutParams& params)
689 {
690 keyboardLayoutParams_.gravity_ = params.gravity_;
691 keyboardLayoutParams_.landscapeAvoidHeight_ = params.landscapeAvoidHeight_;
692 keyboardLayoutParams_.portraitAvoidHeight_ = params.portraitAvoidHeight_;
693 keyboardLayoutParams_.LandscapeKeyboardRect_ = params.LandscapeKeyboardRect_;
694 keyboardLayoutParams_.PortraitKeyboardRect_ = params.PortraitKeyboardRect_;
695 keyboardLayoutParams_.LandscapePanelRect_ = params.LandscapePanelRect_;
696 keyboardLayoutParams_.PortraitPanelRect_ = params.PortraitPanelRect_;
697 }
698
GetKeyboardLayoutParams() const699 KeyboardLayoutParams WindowSessionProperty::GetKeyboardLayoutParams() const
700 {
701 return keyboardLayoutParams_;
702 }
703
SetDecorEnable(bool isDecorEnable)704 void WindowSessionProperty::SetDecorEnable(bool isDecorEnable)
705 {
706 isDecorEnable_ = isDecorEnable;
707 }
708
IsDecorEnable()709 bool WindowSessionProperty::IsDecorEnable()
710 {
711 return isDecorEnable_;
712 }
713
SetWindowModeSupportType(uint32_t windowModeSupportType)714 void WindowSessionProperty::SetWindowModeSupportType(uint32_t windowModeSupportType)
715 {
716 windowModeSupportType_ = windowModeSupportType;
717 }
718
GetWindowModeSupportType() const719 uint32_t WindowSessionProperty::GetWindowModeSupportType() const
720 {
721 return windowModeSupportType_;
722 }
723
SetSupportedWindowModes(const std::vector<AppExecFwk::SupportWindowMode> & supportedWindowModes)724 void WindowSessionProperty::SetSupportedWindowModes(
725 const std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes)
726 {
727 std::lock_guard<std::mutex> lock(supportWindowModesMutex_);
728 supportedWindowModes_ = supportedWindowModes;
729 }
730
GetSupportedWindowModes(std::vector<AppExecFwk::SupportWindowMode> & supportedWindowModes) const731 void WindowSessionProperty::GetSupportedWindowModes(
732 std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes) const
733 {
734 std::lock_guard<std::mutex> lock(supportWindowModesMutex_);
735 supportedWindowModes = supportedWindowModes_;
736 }
737
SetWindowSizeLimits(const WindowSizeLimits & windowSizeLimits)738 void WindowSessionProperty::SetWindowSizeLimits(const WindowSizeLimits& windowSizeLimits)
739 {
740 windowSizeLimits_ = windowSizeLimits;
741 }
742
GetWindowSizeLimits() const743 WindowSizeLimits WindowSessionProperty::GetWindowSizeLimits() const
744 {
745 return windowSizeLimits_;
746 }
747
SetAnimationFlag(uint32_t animationFlag)748 void WindowSessionProperty::SetAnimationFlag(uint32_t animationFlag)
749 {
750 animationFlag_ = animationFlag;
751 }
752
GetAnimationFlag() const753 uint32_t WindowSessionProperty::GetAnimationFlag() const
754 {
755 return animationFlag_;
756 }
757
IsFloatingWindowAppType() const758 bool WindowSessionProperty::IsFloatingWindowAppType() const
759 {
760 return isFloatingWindowAppType_;
761 }
762
setTouchHotAreasInner(const std::vector<Rect> & rects,std::vector<Rect> & touchHotAreas)763 void WindowSessionProperty::setTouchHotAreasInner(const std::vector<Rect>& rects, std::vector<Rect>& touchHotAreas)
764 {
765 if (GetPersistentId() != 0 && rects != touchHotAreas) {
766 std::ostringstream oss;
767 for (const auto& rect : rects) {
768 oss << "[" << rect.posX_ << "," << rect.posY_ << "," << rect.width_ << "," << rect.height_ << "]";
769 }
770 TLOGI(WmsLogTag::WMS_EVENT, "id:%{public}d hot:%{public}s", GetPersistentId(), oss.str().c_str());
771 }
772 touchHotAreas = rects;
773 }
774
SetTouchHotAreas(const std::vector<Rect> & rects)775 void WindowSessionProperty::SetTouchHotAreas(const std::vector<Rect>& rects)
776 {
777 {
778 std::lock_guard lock(touchHotAreasMutex_);
779 setTouchHotAreasInner(rects, touchHotAreas_);
780 }
781 if (touchHotAreasChangeCallback_) {
782 touchHotAreasChangeCallback_();
783 }
784 }
785
SetKeyboardTouchHotAreas(const KeyboardTouchHotAreas & keyboardTouchHotAreas)786 void WindowSessionProperty::SetKeyboardTouchHotAreas(const KeyboardTouchHotAreas& keyboardTouchHotAreas)
787 {
788 {
789 std::lock_guard lock(touchHotAreasMutex_);
790 setTouchHotAreasInner(
791 keyboardTouchHotAreas.landscapeKeyboardHotAreas_, keyboardTouchHotAreas_.landscapeKeyboardHotAreas_);
792 setTouchHotAreasInner(
793 keyboardTouchHotAreas.portraitKeyboardHotAreas_, keyboardTouchHotAreas_.portraitKeyboardHotAreas_);
794 setTouchHotAreasInner(
795 keyboardTouchHotAreas.landscapePanelHotAreas_, keyboardTouchHotAreas_.landscapePanelHotAreas_);
796 setTouchHotAreasInner(
797 keyboardTouchHotAreas.portraitPanelHotAreas_, keyboardTouchHotAreas_.portraitPanelHotAreas_);
798 }
799 if (touchHotAreasChangeCallback_) {
800 touchHotAreasChangeCallback_();
801 }
802 }
803
GetTouchHotAreas(std::vector<Rect> & rects) const804 void WindowSessionProperty::GetTouchHotAreas(std::vector<Rect>& rects) const
805 {
806 std::lock_guard lock(touchHotAreasMutex_);
807 rects = touchHotAreas_;
808 }
809
GetKeyboardTouchHotAreas() const810 KeyboardTouchHotAreas WindowSessionProperty::GetKeyboardTouchHotAreas() const
811 {
812 std::lock_guard lock(touchHotAreasMutex_);
813 return keyboardTouchHotAreas_;
814 }
815
KeepKeyboardOnFocus(bool keepKeyboardFlag)816 void WindowSessionProperty::KeepKeyboardOnFocus(bool keepKeyboardFlag)
817 {
818 keepKeyboardFlag_ = keepKeyboardFlag;
819 }
820
GetKeepKeyboardFlag() const821 bool WindowSessionProperty::GetKeepKeyboardFlag() const
822 {
823 return keepKeyboardFlag_;
824 }
825
SetCallingSessionId(uint32_t sessionId)826 void WindowSessionProperty::SetCallingSessionId(uint32_t sessionId)
827 {
828 callingSessionId_ = sessionId;
829 }
830
GetCallingSessionId() const831 uint32_t WindowSessionProperty::GetCallingSessionId() const
832 {
833 return callingSessionId_;
834 }
835
SetPiPTemplateInfo(const PiPTemplateInfo & pipTemplateInfo)836 void WindowSessionProperty::SetPiPTemplateInfo(const PiPTemplateInfo& pipTemplateInfo)
837 {
838 pipTemplateInfo_ = pipTemplateInfo;
839 }
840
GetPiPTemplateInfo() const841 PiPTemplateInfo WindowSessionProperty::GetPiPTemplateInfo() const
842 {
843 return pipTemplateInfo_;
844 }
845
SetFbTemplateInfo(const FloatingBallTemplateInfo & fbTemplateInfo)846 void WindowSessionProperty::SetFbTemplateInfo(const FloatingBallTemplateInfo& fbTemplateInfo)
847 {
848 fbTemplateInfo_ = fbTemplateInfo;
849 }
850
GetFbTemplateInfo() const851 FloatingBallTemplateInfo WindowSessionProperty::GetFbTemplateInfo() const
852 {
853 return fbTemplateInfo_;
854 }
855
SetIsNeedUpdateWindowMode(bool isNeedUpdateWindowMode)856 void WindowSessionProperty::SetIsNeedUpdateWindowMode(bool isNeedUpdateWindowMode)
857 {
858 isNeedUpdateWindowMode_ = isNeedUpdateWindowMode;
859 }
860
GetIsNeedUpdateWindowMode() const861 bool WindowSessionProperty::GetIsNeedUpdateWindowMode() const
862 {
863 return isNeedUpdateWindowMode_;
864 }
865
SetWindowCornerRadius(float cornerRadius)866 void WindowSessionProperty::SetWindowCornerRadius(float cornerRadius)
867 {
868 std::lock_guard<std::mutex> lock(cornerRadiusMutex_);
869 cornerRadius_ = cornerRadius;
870 }
871
GetWindowCornerRadius() const872 float WindowSessionProperty::GetWindowCornerRadius() const
873 {
874 std::lock_guard<std::mutex> lock(cornerRadiusMutex_);
875 return cornerRadius_;
876 }
877
SetWindowShadows(const ShadowsInfo & shadowsInfo)878 void WindowSessionProperty::SetWindowShadows(const ShadowsInfo& shadowsInfo)
879 {
880 std::lock_guard<std::mutex> lock(shadowsInfoMutex_);
881 shadowsInfo_ = shadowsInfo;
882 }
883
GetWindowShadows() const884 ShadowsInfo WindowSessionProperty::GetWindowShadows() const
885 {
886 std::lock_guard<std::mutex> lock(shadowsInfoMutex_);
887 return shadowsInfo_;
888 }
889
SetUseControlState(bool isUseControlState)890 void WindowSessionProperty::SetUseControlState(bool isUseControlState)
891 {
892 std::lock_guard<std::mutex> lock(lifecycleUseControlMutex_);
893 isUseControlState_ = isUseControlState;
894 }
895
GetUseControlState() const896 bool WindowSessionProperty::GetUseControlState() const
897 {
898 std::lock_guard<std::mutex> lock(lifecycleUseControlMutex_);
899 return isUseControlState_;
900 }
901
MarshallingWindowLimits(Parcel & parcel) const902 bool WindowSessionProperty::MarshallingWindowLimits(Parcel& parcel) const
903 {
904 if (parcel.WriteUint32(limits_.maxWidth_) &&
905 parcel.WriteUint32(limits_.maxHeight_) && parcel.WriteUint32(limits_.minWidth_) &&
906 parcel.WriteUint32(limits_.minHeight_) && parcel.WriteFloat(limits_.maxRatio_) &&
907 parcel.WriteFloat(limits_.minRatio_) && parcel.WriteFloat(limits_.vpRatio_)) {
908 return true;
909 }
910 return false;
911 }
912
UnmarshallingWindowLimits(Parcel & parcel,WindowSessionProperty * property)913 void WindowSessionProperty::UnmarshallingWindowLimits(Parcel& parcel, WindowSessionProperty* property)
914 {
915 WindowLimits windowLimits = { parcel.ReadUint32(), parcel.ReadUint32(), parcel.ReadUint32(),
916 parcel.ReadUint32(), parcel.ReadFloat(), parcel.ReadFloat(), parcel.ReadFloat() };
917 property->SetWindowLimits(windowLimits);
918 }
919
MarshallingSystemBarMap(Parcel & parcel) const920 bool WindowSessionProperty::MarshallingSystemBarMap(Parcel& parcel) const
921 {
922 auto size = sysBarPropMap_.size();
923 uint32_t maxSystemBarNumber = 3;
924 if (size > maxSystemBarNumber) { // max systembar number
925 return false;
926 }
927
928 if (!parcel.WriteUint32(static_cast<uint32_t>(size))) {
929 return false;
930 }
931 for (auto it : sysBarPropMap_) {
932 if (!parcel.WriteUint32(static_cast<uint32_t>(it.first))) {
933 return false;
934 }
935 if (!(parcel.WriteBool(it.second.enable_) && parcel.WriteUint32(it.second.backgroundColor_) &&
936 parcel.WriteUint32(it.second.contentColor_) && parcel.WriteBool(it.second.enableAnimation_) &&
937 parcel.WriteUint32(static_cast<uint32_t>(it.second.settingFlag_)))) {
938 return false;
939 }
940 }
941 return true;
942 }
943
UnMarshallingSystemBarMap(Parcel & parcel,WindowSessionProperty * property)944 void WindowSessionProperty::UnMarshallingSystemBarMap(Parcel& parcel, WindowSessionProperty* property)
945 {
946 uint32_t size = parcel.ReadUint32();
947 uint32_t maxSystemBarNumber = 3;
948 if (size > maxSystemBarNumber) { // max systembar number
949 return;
950 }
951
952 for (uint32_t i = 0; i < size; i++) {
953 WindowType type = static_cast<WindowType>(parcel.ReadUint32());
954 SystemBarProperty prop = { parcel.ReadBool(), parcel.ReadUint32(), parcel.ReadUint32(), parcel.ReadBool(),
955 static_cast<SystemBarSettingFlag>(parcel.ReadUint32()) };
956 property->SetSystemBarProperty(type, prop);
957 }
958 }
959
MarshallingTouchHotAreasInner(const std::vector<Rect> & touchHotAreas,Parcel & parcel) const960 bool WindowSessionProperty::MarshallingTouchHotAreasInner(const std::vector<Rect>& touchHotAreas, Parcel& parcel) const
961 {
962 auto size = touchHotAreas.size();
963 if (size > TOUCH_HOT_AREA_MAX_NUM) {
964 return false;
965 }
966 if (!parcel.WriteUint32(static_cast<uint32_t>(size))) {
967 return false;
968 }
969 for (const auto& rect : touchHotAreas) {
970 if (!parcel.WriteInt32(rect.posX_) || !parcel.WriteInt32(rect.posY_) ||
971 !parcel.WriteUint32(rect.width_) || !parcel.WriteUint32(rect.height_)) {
972 return false;
973 }
974 }
975 return true;
976 }
977
MarshallingTouchHotAreas(Parcel & parcel) const978 bool WindowSessionProperty::MarshallingTouchHotAreas(Parcel& parcel) const
979 {
980 return MarshallingTouchHotAreasInner(touchHotAreas_, parcel);
981 }
982
MarshallingKeyboardTouchHotAreas(Parcel & parcel) const983 bool WindowSessionProperty::MarshallingKeyboardTouchHotAreas(Parcel& parcel) const
984 {
985 return MarshallingTouchHotAreasInner(keyboardTouchHotAreas_.landscapeKeyboardHotAreas_, parcel) &&
986 MarshallingTouchHotAreasInner(keyboardTouchHotAreas_.portraitKeyboardHotAreas_, parcel) &&
987 MarshallingTouchHotAreasInner(keyboardTouchHotAreas_.landscapePanelHotAreas_, parcel) &&
988 MarshallingTouchHotAreasInner(keyboardTouchHotAreas_.portraitPanelHotAreas_, parcel);
989 }
990
UnmarshallingTouchHotAreasInner(Parcel & parcel,std::vector<Rect> & touchHotAreas)991 void WindowSessionProperty::UnmarshallingTouchHotAreasInner(Parcel& parcel, std::vector<Rect>& touchHotAreas)
992 {
993 uint32_t size = parcel.ReadUint32();
994 if (size > TOUCH_HOT_AREA_MAX_NUM) {
995 return;
996 }
997 for (uint32_t i = 0; i < size; i++) {
998 touchHotAreas.emplace_back(
999 Rect{ parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() });
1000 }
1001 }
1002
UnmarshallingTouchHotAreas(Parcel & parcel,WindowSessionProperty * property)1003 void WindowSessionProperty::UnmarshallingTouchHotAreas(Parcel& parcel, WindowSessionProperty* property)
1004 {
1005 UnmarshallingTouchHotAreasInner(parcel, property->touchHotAreas_);
1006 }
1007
UnmarshallingKeyboardTouchHotAreas(Parcel & parcel,WindowSessionProperty * property)1008 void WindowSessionProperty::UnmarshallingKeyboardTouchHotAreas(Parcel& parcel, WindowSessionProperty* property)
1009 {
1010 UnmarshallingTouchHotAreasInner(parcel, property->keyboardTouchHotAreas_.landscapeKeyboardHotAreas_);
1011 UnmarshallingTouchHotAreasInner(parcel, property->keyboardTouchHotAreas_.portraitKeyboardHotAreas_);
1012 UnmarshallingTouchHotAreasInner(parcel, property->keyboardTouchHotAreas_.landscapePanelHotAreas_);
1013 UnmarshallingTouchHotAreasInner(parcel, property->keyboardTouchHotAreas_.portraitPanelHotAreas_);
1014 }
1015
MarshallingPiPTemplateInfo(Parcel & parcel) const1016 bool WindowSessionProperty::MarshallingPiPTemplateInfo(Parcel& parcel) const
1017 {
1018 if (!WindowHelper::IsPipWindow(type_)) {
1019 return true;
1020 }
1021 return parcel.WriteParcelable(&pipTemplateInfo_);
1022 }
1023
UnmarshallingPiPTemplateInfo(Parcel & parcel,WindowSessionProperty * property)1024 void WindowSessionProperty::UnmarshallingPiPTemplateInfo(Parcel& parcel, WindowSessionProperty* property)
1025 {
1026 if (!WindowHelper::IsPipWindow(property->GetWindowType())) {
1027 return;
1028 }
1029 sptr<PiPTemplateInfo> pipTemplateInfo = parcel.ReadParcelable<PiPTemplateInfo>();
1030 if (pipTemplateInfo == nullptr) {
1031 return;
1032 }
1033 property->SetPiPTemplateInfo(*pipTemplateInfo);
1034 }
1035
MarshallingFbTemplateInfo(Parcel & parcel) const1036 bool WindowSessionProperty::MarshallingFbTemplateInfo(Parcel& parcel) const
1037 {
1038 if (!WindowHelper::IsFbWindow(type_)) {
1039 return true;
1040 }
1041 return parcel.WriteParcelable(&fbTemplateInfo_);
1042 }
1043
UnmarshallingFbTemplateInfo(Parcel & parcel,WindowSessionProperty * property)1044 void WindowSessionProperty::UnmarshallingFbTemplateInfo(Parcel& parcel, WindowSessionProperty* property)
1045 {
1046 if (!WindowHelper::IsFbWindow(property->GetWindowType())) {
1047 return;
1048 }
1049 sptr<FloatingBallTemplateInfo> fbTemplateInfo = parcel.ReadParcelable<FloatingBallTemplateInfo>();
1050 if (fbTemplateInfo == nullptr) {
1051 return;
1052 }
1053 property->SetFbTemplateInfo(*fbTemplateInfo);
1054 }
1055
MarshallingWindowMask(Parcel & parcel) const1056 bool WindowSessionProperty::MarshallingWindowMask(Parcel& parcel) const
1057 {
1058 if (!parcel.WriteBool(isShaped_)) {
1059 return false;
1060 }
1061 if (isShaped_) {
1062 std::lock_guard<std::mutex> lock(windowMaskMutex_);
1063 if (!windowMask_->Marshalling(parcel)) {
1064 return false;
1065 }
1066 }
1067 return true;
1068 }
1069
UnmarshallingWindowMask(Parcel & parcel,WindowSessionProperty * property)1070 void WindowSessionProperty::UnmarshallingWindowMask(Parcel& parcel, WindowSessionProperty* property)
1071 {
1072 bool isShaped = parcel.ReadBool();
1073 property->SetIsShaped(isShaped);
1074 if (isShaped) {
1075 Media::PixelMap* windowMask = Media::PixelMap::Unmarshalling(parcel);
1076 if (windowMask != nullptr) {
1077 property->SetWindowMask(std::shared_ptr<Media::PixelMap>(windowMask));
1078 }
1079 }
1080 }
1081
MarshallingMainWindowTopmost(Parcel & parcel) const1082 bool WindowSessionProperty::MarshallingMainWindowTopmost(Parcel& parcel) const
1083 {
1084 if (!parcel.WriteBool(mainWindowTopmost_) || !parcel.WriteUint32(accessTokenId_)) {
1085 return false;
1086 }
1087 return true;
1088 }
1089
UnmarshallingMainWindowTopmost(Parcel & parcel,WindowSessionProperty * property)1090 void WindowSessionProperty::UnmarshallingMainWindowTopmost(Parcel& parcel, WindowSessionProperty* property)
1091 {
1092 property->SetMainWindowTopmost(parcel.ReadBool());
1093 property->SetAccessTokenId(parcel.ReadUint32());
1094 }
1095
MarshallingSessionInfo(Parcel & parcel) const1096 bool WindowSessionProperty::MarshallingSessionInfo(Parcel& parcel) const
1097 {
1098 if (!parcel.WriteString(sessionInfo_.bundleName_) || !parcel.WriteString(sessionInfo_.moduleName_) ||
1099 !parcel.WriteString(sessionInfo_.abilityName_) || !parcel.WriteInt32(sessionInfo_.currentRotation_) ||
1100 !parcel.WriteInt32(static_cast<int32_t>(sessionInfo_.continueState))) {
1101 return false;
1102 }
1103 const auto& want = sessionInfo_.want;
1104 bool hasWant = want != nullptr;
1105 if (!parcel.WriteBool(hasWant)) {
1106 return false;
1107 }
1108 if (hasWant && !parcel.WriteParcelable(want.get())) {
1109 return false;
1110 }
1111 if (!parcel.WriteBool(sessionInfo_.isFollowParentMultiScreenPolicy)) {
1112 return false;
1113 }
1114 if (!parcel.WriteBool(sessionInfo_.isKeyboardWillShowRegistered_) ||
1115 !parcel.WriteBool(sessionInfo_.isKeyboardWillHideRegistered_) ||
1116 !parcel.WriteBool(sessionInfo_.isKeyboardDidShowRegistered_) ||
1117 !parcel.WriteBool(sessionInfo_.isKeyboardDidHideRegistered_)) {
1118 return false;
1119 }
1120 return true;
1121 }
1122
UnmarshallingSessionInfo(Parcel & parcel,WindowSessionProperty * property)1123 bool WindowSessionProperty::UnmarshallingSessionInfo(Parcel& parcel, WindowSessionProperty* property)
1124 {
1125 std::string bundleName;
1126 std::string moduleName;
1127 std::string abilityName;
1128 if (!parcel.ReadString(bundleName) || !parcel.ReadString(moduleName) || !parcel.ReadString(abilityName)) {
1129 TLOGE(WmsLogTag::DEFAULT, "Failed to read String!");
1130 return false;
1131 }
1132 SessionInfo info = { bundleName, moduleName, abilityName };
1133 int32_t currentRotation;
1134 if (!parcel.ReadInt32(currentRotation)) {
1135 TLOGE(WmsLogTag::DEFAULT, "Failed to read currentRotation!");
1136 return false;
1137 }
1138 info.currentRotation_ = currentRotation;
1139 int32_t continueState;
1140 if (!parcel.ReadInt32(continueState)) {
1141 TLOGE(WmsLogTag::DEFAULT, "Failed to read continueState!");
1142 return false;
1143 }
1144 info.continueState = static_cast<ContinueState>(continueState);
1145 bool hasWant;
1146 if (!parcel.ReadBool(hasWant)) {
1147 TLOGE(WmsLogTag::DEFAULT, "Failed to read hasWant!");
1148 return false;
1149 }
1150 if (hasWant) {
1151 std::shared_ptr<AAFwk::Want> want(parcel.ReadParcelable<AAFwk::Want>());
1152 if (want == nullptr) {
1153 TLOGE(WmsLogTag::DEFAULT, "Failed to read want!");
1154 return false;
1155 }
1156 info.want = want;
1157 }
1158 bool isFollowParentMultiScreenPolicy = false;
1159 if (!parcel.ReadBool(isFollowParentMultiScreenPolicy)) {
1160 TLOGE(WmsLogTag::WMS_LAYOUT, "Failed to read isFollowParentMultiScreenPolicy!");
1161 return false;
1162 }
1163 info.isFollowParentMultiScreenPolicy = isFollowParentMultiScreenPolicy;
1164 if (!parcel.ReadBool(info.isKeyboardWillShowRegistered_) ||
1165 !parcel.ReadBool(info.isKeyboardWillHideRegistered_) ||
1166 !parcel.ReadBool(info.isKeyboardDidShowRegistered_) ||
1167 !parcel.ReadBool(info.isKeyboardDidHideRegistered_)) {
1168 TLOGE(WmsLogTag::DEFAULT, "Failed to read keyboard registered state!");
1169 return false;
1170 }
1171 property->SetSessionInfo(info);
1172 return true;
1173 }
1174
MarshallingTransitionAnimationMap(Parcel & parcel) const1175 bool WindowSessionProperty::MarshallingTransitionAnimationMap(Parcel& parcel) const
1176 {
1177 uint32_t transitionAnimationMapSize = transitionAnimationConfig_.size();
1178 if (transitionAnimationMapSize > TRANSTITION_ANIMATION_MAP_SIZE_MAX_NUM ||
1179 !parcel.WriteUint32(transitionAnimationMapSize)) {
1180 TLOGE(WmsLogTag::WMS_ANIMATION, "Failed to write transitionAnimationMapSize");
1181 return false;
1182 }
1183 for (const auto& [transitionType, animation] : transitionAnimationConfig_) {
1184 if (!parcel.WriteUint32(static_cast<uint32_t>(transitionType))) {
1185 TLOGE(WmsLogTag::WMS_ANIMATION, "Failed to write transitionType");
1186 return false;
1187 }
1188 if (animation == nullptr || !parcel.WriteParcelable(animation.get())) {
1189 TLOGE(WmsLogTag::WMS_ANIMATION, "Failed to write transitionAnimation");
1190 return false;
1191 }
1192 }
1193 return true;
1194 }
1195
UnmarshallingTransitionAnimationMap(Parcel & parcel,WindowSessionProperty * property)1196 bool WindowSessionProperty::UnmarshallingTransitionAnimationMap(Parcel& parcel, WindowSessionProperty* property)
1197 {
1198 uint32_t transitionAnimationMapSize = 0;
1199 if (!parcel.ReadUint32(transitionAnimationMapSize) ||
1200 transitionAnimationMapSize > TRANSTITION_ANIMATION_MAP_SIZE_MAX_NUM) {
1201 TLOGE(WmsLogTag::WMS_ANIMATION, "Failed to read transitionAnimationMapSize");
1202 return false;
1203 }
1204 uint32_t transitionType = 0;
1205 std::shared_ptr<TransitionAnimation> animation = nullptr;
1206 for (uint32_t i = 0; i < transitionAnimationMapSize; ++i) {
1207 if (!parcel.ReadUint32(transitionType)) {
1208 TLOGE(WmsLogTag::WMS_ANIMATION, "Failed to read transitionType");
1209 return false;
1210 }
1211 animation = std::shared_ptr<TransitionAnimation>(parcel.ReadParcelable<TransitionAnimation>());
1212 if (animation == nullptr) {
1213 TLOGE(WmsLogTag::WMS_ANIMATION, "Failed to read transitionAnimation");
1214 return false;
1215 }
1216 property->transitionAnimationConfig_[static_cast<WindowTransitionType>(transitionType)] = animation;
1217 }
1218 return true;
1219 }
1220
SetIsAppSupportPhoneInPc(bool isSupportPhone)1221 void WindowSessionProperty::SetIsAppSupportPhoneInPc(bool isSupportPhone)
1222 {
1223 isAppSupportPhoneInPc_ = isSupportPhone;
1224 }
1225
GetIsAppSupportPhoneInPc() const1226 bool WindowSessionProperty::GetIsAppSupportPhoneInPc() const
1227 {
1228 return isAppSupportPhoneInPc_;
1229 }
1230
SetIsPcAppInPad(bool isPcAppInLargeScreenDevice)1231 void WindowSessionProperty::SetIsPcAppInPad(bool isPcAppInLargeScreenDevice)
1232 {
1233 isPcAppInLargeScreenDevice_ = isPcAppInLargeScreenDevice;
1234 }
1235
GetIsPcAppInPad() const1236 bool WindowSessionProperty::GetIsPcAppInPad() const
1237 {
1238 return isPcAppInLargeScreenDevice_;
1239 }
1240
SetSubWindowLevel(uint32_t subWindowLevel)1241 void WindowSessionProperty::SetSubWindowLevel(uint32_t subWindowLevel)
1242 {
1243 subWindowLevel_ = subWindowLevel;
1244 }
1245
GetSubWindowLevel() const1246 uint32_t WindowSessionProperty::GetSubWindowLevel() const
1247 {
1248 return subWindowLevel_;
1249 }
1250
SetSubWindowZLevel(int32_t zLevel)1251 void WindowSessionProperty::SetSubWindowZLevel(int32_t zLevel)
1252 {
1253 zLevel_ = zLevel;
1254 }
1255
GetSubWindowZLevel() const1256 int32_t WindowSessionProperty::GetSubWindowZLevel() const
1257 {
1258 return zLevel_;
1259 }
1260
SetWindowAnchorInfo(const WindowAnchorInfo & windowAnchorInfo)1261 void WindowSessionProperty::SetWindowAnchorInfo(const WindowAnchorInfo& windowAnchorInfo)
1262 {
1263 windowAnchorInfo_ = windowAnchorInfo;
1264 }
1265
GetWindowAnchorInfo() const1266 WindowAnchorInfo WindowSessionProperty::GetWindowAnchorInfo() const
1267 {
1268 return windowAnchorInfo_;
1269 }
1270
SetZIndex(int32_t zIndex)1271 void WindowSessionProperty::SetZIndex(int32_t zIndex)
1272 {
1273 zIndex_ = zIndex;
1274 }
1275
GetZIndex() const1276 int32_t WindowSessionProperty::GetZIndex() const
1277 {
1278 return zIndex_;
1279 }
1280
SetIsAtomicService(bool isAtomicService)1281 void WindowSessionProperty::SetIsAtomicService(bool isAtomicService)
1282 {
1283 std::lock_guard lock(atomicServiceMutex_);
1284 isAtomicService_ = isAtomicService;
1285 }
1286
GetIsAtomicService() const1287 bool WindowSessionProperty::GetIsAtomicService() const
1288 {
1289 std::lock_guard lock(atomicServiceMutex_);
1290 return isAtomicService_;
1291 }
1292
SetSubWindowOutlineEnabled(bool subWindowOutlineEnabled)1293 void WindowSessionProperty::SetSubWindowOutlineEnabled(bool subWindowOutlineEnabled)
1294 {
1295 subWindowOutlineEnabled_ = subWindowOutlineEnabled;
1296 }
1297
IsSubWindowOutlineEnabled() const1298 bool WindowSessionProperty::IsSubWindowOutlineEnabled() const
1299 {
1300 return subWindowOutlineEnabled_;
1301 }
1302
Marshalling(Parcel & parcel) const1303 bool WindowSessionProperty::Marshalling(Parcel& parcel) const
1304 {
1305 auto globalDisplayRect = GetGlobalDisplayRect();
1306 return parcel.WriteString(windowName_) && parcel.WriteInt32(windowRect_.posX_) &&
1307 parcel.WriteInt32(windowRect_.posY_) && parcel.WriteUint32(windowRect_.width_) &&
1308 parcel.WriteUint32(windowRect_.height_) && parcel.WriteInt32(requestRect_.posX_) &&
1309 parcel.WriteInt32(requestRect_.posY_) && parcel.WriteUint32(requestRect_.width_) &&
1310 parcel.WriteUint32(requestRect_.height_) && parcel.WriteInt32(globalDisplayRect.posX_) &&
1311 parcel.WriteInt32(globalDisplayRect.posY_) && parcel.WriteUint32(globalDisplayRect.width_) &&
1312 parcel.WriteUint32(globalDisplayRect.height_) &&
1313 parcel.WriteUint32(rectAnimationConfig_.duration) && parcel.WriteFloat(rectAnimationConfig_.x1) &&
1314 parcel.WriteFloat(rectAnimationConfig_.y1) && parcel.WriteFloat(rectAnimationConfig_.x2) &&
1315 parcel.WriteFloat(rectAnimationConfig_.y2) &&
1316 parcel.WriteUint32(static_cast<uint32_t>(type_)) &&
1317 parcel.WriteBool(focusable_) && parcel.WriteBool(focusableOnShow_) &&
1318 parcel.WriteBool(touchable_) && parcel.WriteBool(tokenState_) &&
1319 parcel.WriteBool(turnScreenOn_) && parcel.WriteBool(keepScreenOn_) && parcel.WriteBool(viewKeepScreenOn_) &&
1320 parcel.WriteBool(isPrivacyMode_) && parcel.WriteBool(isSystemPrivacyMode_) &&
1321 parcel.WriteBool(isSnapshotSkip_) && parcel.WriteBool(windowShadowEnabled_) &&
1322 parcel.WriteUint64(displayId_) && parcel.WriteInt32(persistentId_) &&
1323 MarshallingSessionInfo(parcel) &&
1324 MarshallingTransitionAnimationMap(parcel) &&
1325 parcel.WriteInt32(parentPersistentId_) && parcel.WriteBool(isFollowParentWindowDisplayId_) &&
1326 parcel.WriteUint32(accessTokenId_) && parcel.WriteUint32(static_cast<uint32_t>(maximizeMode_)) &&
1327 parcel.WriteUint32(static_cast<uint32_t>(requestedOrientation_)) &&
1328 parcel.WriteBool(needRotateAnimation_) &&
1329 parcel.WriteUint32(static_cast<uint32_t>(userRequestedOrientation_)) &&
1330 parcel.WriteUint32(static_cast<uint32_t>(windowMode_)) &&
1331 parcel.WriteUint32(flags_) && parcel.WriteBool(raiseEnabled_) &&
1332 parcel.WriteBool(topmost_) && parcel.WriteBool(mainWindowTopmost_) &&
1333 parcel.WriteInt32(zLevel_) && parcel.WriteInt32(zIndex_) &&
1334 parcel.WriteBool(isDecorEnable_) && parcel.WriteBool(dragEnabled_) &&
1335 parcel.WriteBool(hideNonSystemFloatingWindows_) && parcel.WriteBool(forceHide_) &&
1336 MarshallingWindowLimits(parcel) && parcel.WriteFloat(brightness_) &&
1337 MarshallingSystemBarMap(parcel) && parcel.WriteUint32(animationFlag_) &&
1338 MarshallingPiPTemplateInfo(parcel) &&
1339 parcel.WriteBool(isFloatingWindowAppType_) && MarshallingTouchHotAreas(parcel) &&
1340 parcel.WriteBool(isSystemCalling_) &&
1341 parcel.WriteDouble(textFieldPositionY_) && parcel.WriteDouble(textFieldHeight_) &&
1342 parcel.WriteUint32(static_cast<uint32_t>(windowState_)) &&
1343 parcel.WriteBool(isNeedUpdateWindowMode_) && parcel.WriteUint32(callingSessionId_) &&
1344 parcel.WriteBool(isLayoutFullScreen_) &&
1345 parcel.WriteInt32(realParentId_) &&
1346 parcel.WriteBool(isUIExtFirstSubWindow_) &&
1347 parcel.WriteBool(isUIExtensionAbilityProcess_) &&
1348 parcel.WriteUint32(static_cast<uint32_t>(uiExtensionUsage_)) &&
1349 parcel.WriteUint32(static_cast<uint32_t>(parentWindowType_)) &&
1350 MarshallingWindowMask(parcel) &&
1351 parcel.WriteParcelable(&keyboardLayoutParams_) &&
1352 parcel.WriteBool(isAppSupportPhoneInPc_) &&
1353 parcel.WriteBool(isPcAppInLargeScreenDevice_) &&
1354 parcel.WriteString(appInstanceKey_) && parcel.WriteBool(isSystemKeyboard_) &&
1355 parcel.WriteUint32(avoidAreaOption_) && parcel.WriteBool(isWindowDelayRaiseEnabled_) &&
1356 parcel.WriteUint8(backgroundAlpha_) && parcel.WriteParcelable(&keyboardEffectOption_) &&
1357 parcel.WriteFloat(cornerRadius_) && parcel.WriteBool(isExclusivelyHighlighted_) &&
1358 parcel.WriteBool(isAtomicService_) && parcel.WriteUint32(apiVersion_) &&
1359 parcel.WriteBool(isFullScreenWaterfallMode_) && parcel.WriteBool(isAbilityHookOff_) &&
1360 parcel.WriteBool(isAbilityHook_) && parcel.WriteBool(isFollowScreenChange_) &&
1361 parcel.WriteParcelable(compatibleModeProperty_) && parcel.WriteBool(subWindowOutlineEnabled_) &&
1362 parcel.WriteUint32(windowModeSupportType_) &&
1363 MarshallingShadowsInfo(parcel) &&
1364 MarshallingFbTemplateInfo(parcel) &&
1365 MarshallingWindowAnchorInfo(parcel) &&
1366 parcel.WriteBool(isPcAppInpadSpecificSystemBarInvisible_) &&
1367 parcel.WriteBool(isPcAppInpadOrientationLandscape_) &&
1368 parcel.WriteBool(isPcAppInpadCompatibleMode_) &&
1369 parcel.WriteString(ancoRealBundleName_);
1370 }
1371
Unmarshalling(Parcel & parcel)1372 WindowSessionProperty* WindowSessionProperty::Unmarshalling(Parcel& parcel)
1373 {
1374 WindowSessionProperty* property = new(std::nothrow) WindowSessionProperty();
1375 if (property == nullptr) {
1376 return nullptr;
1377 }
1378 property->SetWindowName(parcel.ReadString());
1379 Rect rect = { parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() };
1380 property->SetWindowRect(rect);
1381 Rect reqRect = { parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() };
1382 property->SetRequestRect(reqRect);
1383 Rect globalDisplayRect = { parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() };
1384 property->SetGlobalDisplayRect(globalDisplayRect);
1385 RectAnimationConfig rectAnimationConfig = { parcel.ReadUint32(), parcel.ReadFloat(),
1386 parcel.ReadFloat(), parcel.ReadFloat(), parcel.ReadFloat() };
1387 property->SetRectAnimationConfig(rectAnimationConfig);
1388 property->SetWindowType(static_cast<WindowType>(parcel.ReadUint32()));
1389 property->SetFocusable(parcel.ReadBool());
1390 property->SetFocusableOnShow(parcel.ReadBool());
1391 property->SetTouchable(parcel.ReadBool());
1392 property->SetTokenState(parcel.ReadBool());
1393 property->SetTurnScreenOn(parcel.ReadBool());
1394 property->SetKeepScreenOn(parcel.ReadBool());
1395 property->SetViewKeepScreenOn(parcel.ReadBool());
1396 property->SetPrivacyMode(parcel.ReadBool());
1397 property->SetSystemPrivacyMode(parcel.ReadBool());
1398 property->SetSnapshotSkip(parcel.ReadBool());
1399 property->SetWindowShadowEnabled(parcel.ReadBool());
1400 property->SetDisplayId(parcel.ReadUint64());
1401 property->SetPersistentId(parcel.ReadInt32());
1402 if (!UnmarshallingSessionInfo(parcel, property)) {
1403 delete property;
1404 return nullptr;
1405 }
1406 if (!UnmarshallingTransitionAnimationMap(parcel, property)) {
1407 delete property;
1408 return nullptr;
1409 }
1410 property->SetParentPersistentId(parcel.ReadInt32());
1411 property->SetIsFollowParentWindowDisplayId(parcel.ReadBool());
1412 property->SetAccessTokenId(parcel.ReadUint32());
1413 property->SetMaximizeMode(static_cast<MaximizeMode>(parcel.ReadUint32()));
1414 property->SetRequestedOrientation(static_cast<Orientation>(parcel.ReadUint32()), parcel.ReadBool());
1415 property->SetUserRequestedOrientation(static_cast<Orientation>(parcel.ReadUint32()));
1416 property->SetWindowMode(static_cast<WindowMode>(parcel.ReadUint32()));
1417 property->SetWindowFlags(parcel.ReadUint32());
1418 property->SetRaiseEnabled(parcel.ReadBool());
1419 property->SetTopmost(parcel.ReadBool());
1420 property->SetMainWindowTopmost(parcel.ReadBool());
1421 property->SetSubWindowZLevel(parcel.ReadInt32());
1422 property->SetZIndex(parcel.ReadInt32());
1423 property->SetDecorEnable(parcel.ReadBool());
1424 property->SetDragEnabled(parcel.ReadBool());
1425 property->SetHideNonSystemFloatingWindows(parcel.ReadBool());
1426 property->SetForceHide(parcel.ReadBool());
1427 UnmarshallingWindowLimits(parcel, property);
1428 property->SetBrightness(parcel.ReadFloat());
1429 UnMarshallingSystemBarMap(parcel, property);
1430 property->SetAnimationFlag(parcel.ReadUint32());
1431 UnmarshallingPiPTemplateInfo(parcel, property);
1432 property->SetFloatingWindowAppType(parcel.ReadBool());
1433 UnmarshallingTouchHotAreas(parcel, property);
1434 property->SetSystemCalling(parcel.ReadBool());
1435 property->SetTextFieldPositionY(parcel.ReadDouble());
1436 property->SetTextFieldHeight(parcel.ReadDouble());
1437 property->SetWindowState(static_cast<WindowState>(parcel.ReadUint32()));
1438 property->SetIsNeedUpdateWindowMode(parcel.ReadBool());
1439 property->SetCallingSessionId(parcel.ReadUint32());
1440 property->SetIsLayoutFullScreen(parcel.ReadBool());
1441 property->SetRealParentId(parcel.ReadInt32());
1442 property->SetIsUIExtFirstSubWindow(parcel.ReadBool());
1443 property->SetIsUIExtensionAbilityProcess(parcel.ReadBool());
1444 property->SetUIExtensionUsage(static_cast<UIExtensionUsage>(parcel.ReadUint32()));
1445 property->SetParentWindowType(static_cast<WindowType>(parcel.ReadUint32()));
1446 UnmarshallingWindowMask(parcel, property);
1447 sptr<KeyboardLayoutParams> keyboardLayoutParams = parcel.ReadParcelable<KeyboardLayoutParams>();
1448 if (keyboardLayoutParams == nullptr) {
1449 delete property;
1450 return nullptr;
1451 }
1452 property->SetKeyboardLayoutParams(*keyboardLayoutParams);
1453 property->SetIsAppSupportPhoneInPc(parcel.ReadBool());
1454 property->SetIsPcAppInPad(parcel.ReadBool());
1455 property->SetAppInstanceKey(parcel.ReadString());
1456 property->SetIsSystemKeyboard(parcel.ReadBool());
1457 property->SetAvoidAreaOption(parcel.ReadUint32());
1458 property->SetWindowDelayRaiseEnabled(parcel.ReadBool());
1459 property->SetBackgroundAlpha(parcel.ReadUint8());
1460 sptr<KeyboardEffectOption> keyboardEffectOption = parcel.ReadParcelable<KeyboardEffectOption>();
1461 if (keyboardEffectOption == nullptr) {
1462 TLOGE(WmsLogTag::WMS_KEYBOARD, "Failed to read keyboardEffectOption");
1463 delete property;
1464 return nullptr;
1465 }
1466 property->SetKeyboardEffectOption(*keyboardEffectOption);
1467 property->SetWindowCornerRadius(parcel.ReadFloat());
1468 property->SetExclusivelyHighlighted(parcel.ReadBool());
1469 property->SetIsAtomicService(parcel.ReadBool());
1470 property->SetApiVersion(parcel.ReadUint32());
1471 property->SetIsFullScreenWaterfallMode(parcel.ReadBool());
1472 property->SetIsAbilityHookOff(parcel.ReadBool());
1473 property->SetIsAbilityHook(parcel.ReadBool());
1474 property->SetFollowScreenChange(parcel.ReadBool());
1475 property->SetCompatibleModeProperty(parcel.ReadParcelable<CompatibleModeProperty>());
1476 property->SetSubWindowOutlineEnabled(parcel.ReadBool());
1477 property->SetWindowModeSupportType(parcel.ReadUint32());
1478 UnmarshallingShadowsInfo(parcel, property);
1479 UnmarshallingFbTemplateInfo(parcel, property);
1480 UnmarshallingWindowAnchorInfo(parcel, property);
1481 property->SetPcAppInpadSpecificSystemBarInvisible(parcel.ReadBool());
1482 property->SetPcAppInpadOrientationLandscape(parcel.ReadBool());
1483 property->SetPcAppInpadCompatibleMode(parcel.ReadBool());
1484 property->SetAncoRealBundleName(parcel.ReadString());
1485 return property;
1486 }
1487
CopyFrom(const sptr<WindowSessionProperty> & property)1488 void WindowSessionProperty::CopyFrom(const sptr<WindowSessionProperty>& property)
1489 {
1490 windowName_ = property->windowName_;
1491 sessionInfo_ = property->sessionInfo_;
1492 requestRect_ = property->requestRect_;
1493 globalDisplayRect_ = property->GetGlobalDisplayRect();
1494 rectAnimationConfig_ = property->rectAnimationConfig_;
1495 windowRect_ = property->windowRect_;
1496 type_ = property->type_;
1497 focusable_ = property->focusable_;
1498 focusableOnShow_ = property->focusableOnShow_;
1499 touchable_ = property->touchable_;
1500 dragEnabled_ = property->dragEnabled_;
1501 raiseEnabled_ = property->raiseEnabled_;
1502 isSystemCalling_ = property->isSystemCalling_;
1503 tokenState_ = property->tokenState_;
1504 turnScreenOn_ = property->turnScreenOn_;
1505 keepScreenOn_ = property->keepScreenOn_;
1506 viewKeepScreenOn_ = property->viewKeepScreenOn_;
1507 windowShadowEnabled_ = property->windowShadowEnabled_;
1508 topmost_ = property->topmost_;
1509 mainWindowTopmost_ = property->mainWindowTopmost_;
1510 zLevel_ = property->zLevel_;
1511 zIndex_ = property->zIndex_;
1512 requestedOrientation_ = property->requestedOrientation_;
1513 defaultRequestedOrientation_ = property->defaultRequestedOrientation_;
1514 userRequestedOrientation_ = property->userRequestedOrientation_;
1515 isPrivacyMode_ = property->isPrivacyMode_;
1516 isSystemPrivacyMode_ = property->isSystemPrivacyMode_;
1517 isSnapshotSkip_ = property->isSnapshotSkip_;
1518 brightness_ = property->brightness_;
1519 displayId_ = property->displayId_;
1520 parentId_ = property->parentId_;
1521 flags_ = property->flags_;
1522 persistentId_ = property->persistentId_;
1523 isFollowParentWindowDisplayId_ = property->isFollowParentWindowDisplayId_;
1524 parentPersistentId_ = property->parentPersistentId_;
1525 accessTokenId_ = property->accessTokenId_;
1526 maximizeMode_ = property->maximizeMode_;
1527 windowMode_ = property->windowMode_;
1528 windowState_ = property->windowState_;
1529 limits_ = property->limits_;
1530 userLimits_ = property->userLimits_;
1531 configLimitsVP_ = property->configLimitsVP_;
1532 lastVpr_ = property->lastVpr_;
1533 pipTemplateInfo_ = property->pipTemplateInfo_;
1534 fbTemplateInfo_ = property->fbTemplateInfo_;
1535 keyboardLayoutParams_ = property->keyboardLayoutParams_;
1536 windowModeSupportType_ = property->windowModeSupportType_;
1537 sysBarPropMap_ = property->sysBarPropMap_;
1538 isDecorEnable_ = property->isDecorEnable_;
1539 animationFlag_ = property->animationFlag_;
1540 trans_ = property->trans_;
1541 isFloatingWindowAppType_ = property->isFloatingWindowAppType_;
1542 touchHotAreas_ = property->touchHotAreas_;
1543 keyboardTouchHotAreas_ = property->keyboardTouchHotAreas_;
1544 hideNonSystemFloatingWindows_ = property->hideNonSystemFloatingWindows_;
1545 isSkipSelfWhenShowOnVirtualScreen_ = property->isSkipSelfWhenShowOnVirtualScreen_;
1546 isSkipEventOnCastPlus_ = property->isSkipEventOnCastPlus_;
1547 forceHide_ = property->forceHide_;
1548 keepKeyboardFlag_ = property->keepKeyboardFlag_;
1549 callingSessionId_ = property->callingSessionId_;
1550 textFieldPositionY_ = property->textFieldPositionY_;
1551 textFieldHeight_ = property->textFieldHeight_;
1552 isNeedUpdateWindowMode_ = property->isNeedUpdateWindowMode_;
1553 touchHotAreasChangeCallback_ = property->touchHotAreasChangeCallback_;
1554 isLayoutFullScreen_ = property->isLayoutFullScreen_;
1555 isShaped_ = property->isShaped_;
1556 fullScreenStart_ = property->fullScreenStart_;
1557 {
1558 std::lock_guard<std::mutex> lock(windowMaskMutex_);
1559 windowMask_ = property->windowMask_;
1560 }
1561 collaboratorType_ = property->collaboratorType_;
1562 isAppSupportPhoneInPc_ = property->isAppSupportPhoneInPc_;
1563 isPcAppInLargeScreenDevice_ = property->isPcAppInLargeScreenDevice_;
1564 subWindowLevel_ = property->subWindowLevel_;
1565 realParentId_ = property->realParentId_;
1566 uiExtensionUsage_ = property->uiExtensionUsage_;
1567 isUIExtFirstSubWindow_ = property->isUIExtFirstSubWindow_;
1568 isUIExtensionAbilityProcess_ = property->isUIExtensionAbilityProcess_;
1569 isUIExtAnySubWindow_ = property->isUIExtAnySubWindow_;
1570 parentWindowType_ = property->parentWindowType_;
1571 appInstanceKey_ = property->appInstanceKey_;
1572 isSystemKeyboard_ = property->isSystemKeyboard_;
1573 avoidAreaOption_ = property->avoidAreaOption_;
1574 isWindowDelayRaiseEnabled_ = property->isWindowDelayRaiseEnabled_;
1575 backgroundAlpha_ = property->backgroundAlpha_;
1576 keyboardEffectOption_ = property->keyboardEffectOption_;
1577 isExclusivelyHighlighted_ = property->isExclusivelyHighlighted_;
1578 cornerRadius_ = property->cornerRadius_;
1579 isAtomicService_ = property->isAtomicService_;
1580 apiVersion_ = property->apiVersion_;
1581 isFullScreenWaterfallMode_ = property->isFullScreenWaterfallMode_;
1582 isAbilityHookOff_ = property->isAbilityHookOff_;
1583 isAbilityHook_ = property->isAbilityHook_;
1584 isFollowScreenChange_ = property->isFollowScreenChange_;
1585 subWindowOutlineEnabled_ = property->subWindowOutlineEnabled_;
1586 shadowsInfo_ = property->shadowsInfo_;
1587 windowAnchorInfo_ = property->windowAnchorInfo_;
1588 isPcAppInpadSpecificSystemBarInvisible_ = property->isPcAppInpadSpecificSystemBarInvisible_;
1589 isPcAppInpadOrientationLandscape_ = property->isPcAppInpadOrientationLandscape_;
1590 isPcAppInpadCompatibleMode_ = property->isPcAppInpadCompatibleMode_;
1591 ancoRealBundleName_ = property->ancoRealBundleName_;
1592 }
1593
Write(Parcel & parcel,WSPropertyChangeAction action)1594 bool WindowSessionProperty::Write(Parcel& parcel, WSPropertyChangeAction action)
1595 {
1596 const auto funcIter = writeFuncMap_.find(static_cast<uint64_t>(action));
1597 if (funcIter == writeFuncMap_.end()) {
1598 TLOGE(WmsLogTag::DEFAULT, "Failed to find func handler!");
1599 return false;
1600 }
1601 bool ret = parcel.WriteUint32(static_cast<uint32_t>(persistentId_));
1602 return ret && (this->*(funcIter->second))(parcel);
1603 }
1604
WriteActionUpdateTurnScreenOn(Parcel & parcel)1605 bool WindowSessionProperty::WriteActionUpdateTurnScreenOn(Parcel& parcel)
1606 {
1607 return parcel.WriteBool(turnScreenOn_);
1608 }
1609
WriteActionUpdateKeepScreenOn(Parcel & parcel)1610 bool WindowSessionProperty::WriteActionUpdateKeepScreenOn(Parcel& parcel)
1611 {
1612 return parcel.WriteBool(keepScreenOn_);
1613 }
1614
WriteActionUpdateViewKeepScreenOn(Parcel & parcel)1615 bool WindowSessionProperty::WriteActionUpdateViewKeepScreenOn(Parcel& parcel)
1616 {
1617 return parcel.WriteBool(viewKeepScreenOn_);
1618 }
1619
WriteActionUpdateFocusable(Parcel & parcel)1620 bool WindowSessionProperty::WriteActionUpdateFocusable(Parcel& parcel)
1621 {
1622 return parcel.WriteBool(focusable_);
1623 }
1624
WriteActionUpdateTouchable(Parcel & parcel)1625 bool WindowSessionProperty::WriteActionUpdateTouchable(Parcel& parcel)
1626 {
1627 return parcel.WriteBool(touchable_);
1628 }
1629
WriteActionUpdateSetBrightness(Parcel & parcel)1630 bool WindowSessionProperty::WriteActionUpdateSetBrightness(Parcel& parcel)
1631 {
1632 return parcel.WriteFloat(brightness_);
1633 }
1634
WriteActionUpdateOrientation(Parcel & parcel)1635 bool WindowSessionProperty::WriteActionUpdateOrientation(Parcel& parcel)
1636 {
1637 return parcel.WriteUint32(static_cast<uint32_t>(requestedOrientation_)) &&
1638 parcel.WriteBool(needRotateAnimation_);
1639 }
1640
WriteActionUpdatePrivacyMode(Parcel & parcel)1641 bool WindowSessionProperty::WriteActionUpdatePrivacyMode(Parcel& parcel)
1642 {
1643 return parcel.WriteBool(isPrivacyMode_) && parcel.WriteBool(isSystemPrivacyMode_);
1644 }
1645
WriteActionUpdateSnapshotSkip(Parcel & parcel)1646 bool WindowSessionProperty::WriteActionUpdateSnapshotSkip(Parcel& parcel)
1647 {
1648 return parcel.WriteBool(isSnapshotSkip_);
1649 }
1650
WriteActionUpdateMaximizeState(Parcel & parcel)1651 bool WindowSessionProperty::WriteActionUpdateMaximizeState(Parcel& parcel)
1652 {
1653 return parcel.WriteUint32(static_cast<uint32_t>(maximizeMode_)) &&
1654 parcel.WriteBool(isLayoutFullScreen_);
1655 }
1656
WriteActionUpdateSystemBar(Parcel & parcel)1657 bool WindowSessionProperty::WriteActionUpdateSystemBar(Parcel& parcel)
1658 {
1659 return MarshallingSystemBarMap(parcel);
1660 }
1661
WriteActionUpdateFlags(Parcel & parcel)1662 bool WindowSessionProperty::WriteActionUpdateFlags(Parcel& parcel)
1663 {
1664 return parcel.WriteUint32(flags_);
1665 }
1666
WriteActionUpdateMode(Parcel & parcel)1667 bool WindowSessionProperty::WriteActionUpdateMode(Parcel& parcel)
1668 {
1669 return parcel.WriteUint32(static_cast<uint32_t>(windowMode_));
1670 }
1671
WriteActionUpdateAnimationFlag(Parcel & parcel)1672 bool WindowSessionProperty::WriteActionUpdateAnimationFlag(Parcel& parcel)
1673 {
1674 return parcel.WriteUint32(animationFlag_);
1675 }
1676
WriteActionUpdateTouchHotArea(Parcel & parcel)1677 bool WindowSessionProperty::WriteActionUpdateTouchHotArea(Parcel& parcel)
1678 {
1679 return MarshallingTouchHotAreas(parcel);
1680 }
1681
WriteActionUpdateKeyboardTouchHotArea(Parcel & parcel)1682 bool WindowSessionProperty::WriteActionUpdateKeyboardTouchHotArea(Parcel& parcel)
1683 {
1684 return MarshallingKeyboardTouchHotAreas(parcel);
1685 }
1686
WriteActionUpdateDecorEnable(Parcel & parcel)1687 bool WindowSessionProperty::WriteActionUpdateDecorEnable(Parcel& parcel)
1688 {
1689 return parcel.WriteBool(isDecorEnable_);
1690 }
1691
WriteActionUpdateWindowLimits(Parcel & parcel)1692 bool WindowSessionProperty::WriteActionUpdateWindowLimits(Parcel& parcel)
1693 {
1694 return MarshallingWindowLimits(parcel);
1695 }
1696
WriteActionUpdateDragenabled(Parcel & parcel)1697 bool WindowSessionProperty::WriteActionUpdateDragenabled(Parcel& parcel)
1698 {
1699 return parcel.WriteBool(dragEnabled_);
1700 }
1701
WriteActionUpdateRaiseenabled(Parcel & parcel)1702 bool WindowSessionProperty::WriteActionUpdateRaiseenabled(Parcel& parcel)
1703 {
1704 return parcel.WriteBool(raiseEnabled_);
1705 }
1706
WriteActionUpdateHideNonSystemFloatingWindows(Parcel & parcel)1707 bool WindowSessionProperty::WriteActionUpdateHideNonSystemFloatingWindows(Parcel& parcel)
1708 {
1709 return parcel.WriteBool(hideNonSystemFloatingWindows_) &&
1710 parcel.WriteBool(isFloatingWindowAppType_) && parcel.WriteBool(forceHide_);
1711 }
1712
WriteActionUpdateTextfieldAvoidInfo(Parcel & parcel)1713 bool WindowSessionProperty::WriteActionUpdateTextfieldAvoidInfo(Parcel& parcel)
1714 {
1715 return parcel.WriteDouble(textFieldPositionY_) && parcel.WriteDouble(textFieldHeight_);
1716 }
1717
WriteActionUpdateWindowMask(Parcel & parcel)1718 bool WindowSessionProperty::WriteActionUpdateWindowMask(Parcel& parcel)
1719 {
1720 return MarshallingWindowMask(parcel);
1721 }
1722
WriteActionUpdateTopmost(Parcel & parcel)1723 bool WindowSessionProperty::WriteActionUpdateTopmost(Parcel& parcel)
1724 {
1725 return parcel.WriteBool(topmost_);
1726 }
1727
WriteActionUpdateMainWindowTopmost(Parcel & parcel)1728 bool WindowSessionProperty::WriteActionUpdateMainWindowTopmost(Parcel& parcel)
1729 {
1730 return MarshallingMainWindowTopmost(parcel);
1731 }
1732
WriteActionUpdateSubWindowZLevel(Parcel & parcel)1733 bool WindowSessionProperty::WriteActionUpdateSubWindowZLevel(Parcel& parcel)
1734 {
1735 return parcel.WriteInt32(zLevel_);
1736 }
1737
WriteActionUpdateWindowModeSupportType(Parcel & parcel)1738 bool WindowSessionProperty::WriteActionUpdateWindowModeSupportType(Parcel& parcel)
1739 {
1740 return parcel.WriteUint32(windowModeSupportType_);
1741 }
1742
WriteActionUpdateAvoidAreaOption(Parcel & parcel)1743 bool WindowSessionProperty::WriteActionUpdateAvoidAreaOption(Parcel& parcel)
1744 {
1745 return parcel.WriteUint32(avoidAreaOption_);
1746 }
1747
WriteActionUpdateBackgroundAlpha(Parcel & parcel)1748 bool WindowSessionProperty::WriteActionUpdateBackgroundAlpha(Parcel& parcel)
1749 {
1750 return parcel.WriteUint8(backgroundAlpha_);
1751 }
1752
WriteActionUpdateExclusivelyHighlighted(Parcel & parcel)1753 bool WindowSessionProperty::WriteActionUpdateExclusivelyHighlighted(Parcel& parcel)
1754 {
1755 return parcel.WriteBool(isExclusivelyHighlighted_);
1756 }
1757
WriteActionUpdateFollowScreenChange(Parcel & parcel)1758 bool WindowSessionProperty::WriteActionUpdateFollowScreenChange(Parcel& parcel)
1759 {
1760 return parcel.WriteBool(isFollowScreenChange_);
1761 }
1762
WriteActionUpdateWindowShadowEnabled(Parcel & parcel)1763 bool WindowSessionProperty::WriteActionUpdateWindowShadowEnabled(Parcel& parcel)
1764 {
1765 return parcel.WriteBool(windowShadowEnabled_);
1766 }
1767
Read(Parcel & parcel,WSPropertyChangeAction action)1768 void WindowSessionProperty::Read(Parcel& parcel, WSPropertyChangeAction action)
1769 {
1770 const auto funcIter = readFuncMap_.find(static_cast<uint64_t>(action));
1771 if (funcIter == readFuncMap_.end()) {
1772 TLOGE(WmsLogTag::DEFAULT, "Failed to find func handler!");
1773 return;
1774 }
1775 SetPersistentId(parcel.ReadUint32());
1776 (this->*(funcIter->second))(parcel);
1777 }
1778
ReadActionUpdateTurnScreenOn(Parcel & parcel)1779 void WindowSessionProperty::ReadActionUpdateTurnScreenOn(Parcel& parcel)
1780 {
1781 SetTurnScreenOn(parcel.ReadBool());
1782 }
1783
ReadActionUpdateKeepScreenOn(Parcel & parcel)1784 void WindowSessionProperty::ReadActionUpdateKeepScreenOn(Parcel& parcel)
1785 {
1786 SetKeepScreenOn(parcel.ReadBool());
1787 }
1788
ReadActionUpdateViewKeepScreenOn(Parcel & parcel)1789 void WindowSessionProperty::ReadActionUpdateViewKeepScreenOn(Parcel& parcel)
1790 {
1791 SetViewKeepScreenOn(parcel.ReadBool());
1792 }
1793
ReadActionUpdateFocusable(Parcel & parcel)1794 void WindowSessionProperty::ReadActionUpdateFocusable(Parcel& parcel)
1795 {
1796 SetFocusable(parcel.ReadBool());
1797 }
1798
ReadActionUpdateTouchable(Parcel & parcel)1799 void WindowSessionProperty::ReadActionUpdateTouchable(Parcel& parcel)
1800 {
1801 SetTouchable(parcel.ReadBool());
1802 }
1803
ReadActionUpdateSetBrightness(Parcel & parcel)1804 void WindowSessionProperty::ReadActionUpdateSetBrightness(Parcel& parcel)
1805 {
1806 SetBrightness(parcel.ReadFloat());
1807 }
1808
ReadActionUpdateOrientation(Parcel & parcel)1809 void WindowSessionProperty::ReadActionUpdateOrientation(Parcel& parcel)
1810 {
1811 SetRequestedOrientation(static_cast<Orientation>(parcel.ReadUint32()), parcel.ReadBool());
1812 }
1813
ReadActionUpdatePrivacyMode(Parcel & parcel)1814 void WindowSessionProperty::ReadActionUpdatePrivacyMode(Parcel& parcel)
1815 {
1816 SetPrivacyMode(parcel.ReadBool());
1817 SetSystemPrivacyMode(parcel.ReadBool());
1818 }
1819
ReadActionUpdateSnapshotSkip(Parcel & parcel)1820 void WindowSessionProperty::ReadActionUpdateSnapshotSkip(Parcel& parcel)
1821 {
1822 SetSnapshotSkip(parcel.ReadBool());
1823 }
1824
ReadActionUpdateMaximizeState(Parcel & parcel)1825 void WindowSessionProperty::ReadActionUpdateMaximizeState(Parcel& parcel)
1826 {
1827 SetMaximizeMode(static_cast<MaximizeMode>(parcel.ReadUint32()));
1828 SetIsLayoutFullScreen(parcel.ReadBool());
1829 }
1830
ReadActionUpdateSystemBar(Parcel & parcel)1831 void WindowSessionProperty::ReadActionUpdateSystemBar(Parcel& parcel)
1832 {
1833 UnMarshallingSystemBarMap(parcel, this);
1834 }
1835
ReadActionUpdateFlags(Parcel & parcel)1836 void WindowSessionProperty::ReadActionUpdateFlags(Parcel& parcel)
1837 {
1838 SetWindowFlags(parcel.ReadUint32());
1839 }
1840
ReadActionUpdateMode(Parcel & parcel)1841 void WindowSessionProperty::ReadActionUpdateMode(Parcel& parcel)
1842 {
1843 SetWindowMode(static_cast<WindowMode>(parcel.ReadUint32()));
1844 }
1845
ReadActionUpdateAnimationFlag(Parcel & parcel)1846 void WindowSessionProperty::ReadActionUpdateAnimationFlag(Parcel& parcel)
1847 {
1848 SetAnimationFlag(parcel.ReadUint32());
1849 }
1850
ReadActionUpdateTouchHotArea(Parcel & parcel)1851 void WindowSessionProperty::ReadActionUpdateTouchHotArea(Parcel& parcel)
1852 {
1853 UnmarshallingTouchHotAreas(parcel, this);
1854 }
1855
ReadActionUpdateKeyboardTouchHotArea(Parcel & parcel)1856 void WindowSessionProperty::ReadActionUpdateKeyboardTouchHotArea(Parcel& parcel)
1857 {
1858 UnmarshallingKeyboardTouchHotAreas(parcel, this);
1859 }
1860
ReadActionUpdateDecorEnable(Parcel & parcel)1861 void WindowSessionProperty::ReadActionUpdateDecorEnable(Parcel& parcel)
1862 {
1863 SetDecorEnable(parcel.ReadBool());
1864 }
1865
ReadActionUpdateWindowLimits(Parcel & parcel)1866 void WindowSessionProperty::ReadActionUpdateWindowLimits(Parcel& parcel)
1867 {
1868 UnmarshallingWindowLimits(parcel, this);
1869 }
1870
ReadActionUpdateDragenabled(Parcel & parcel)1871 void WindowSessionProperty::ReadActionUpdateDragenabled(Parcel& parcel)
1872 {
1873 SetDragEnabled(parcel.ReadBool());
1874 }
1875
ReadActionUpdateRaiseenabled(Parcel & parcel)1876 void WindowSessionProperty::ReadActionUpdateRaiseenabled(Parcel& parcel)
1877 {
1878 SetRaiseEnabled(parcel.ReadBool());
1879 }
1880
ReadActionUpdateHideNonSystemFloatingWindows(Parcel & parcel)1881 void WindowSessionProperty::ReadActionUpdateHideNonSystemFloatingWindows(Parcel& parcel)
1882 {
1883 SetHideNonSystemFloatingWindows(parcel.ReadBool());
1884 SetFloatingWindowAppType(parcel.ReadBool());
1885 SetForceHide(parcel.ReadBool());
1886 }
1887
ReadActionUpdateTextfieldAvoidInfo(Parcel & parcel)1888 void WindowSessionProperty::ReadActionUpdateTextfieldAvoidInfo(Parcel& parcel)
1889 {
1890 SetTextFieldPositionY(parcel.ReadDouble());
1891 SetTextFieldHeight(parcel.ReadDouble());
1892 }
1893
ReadActionUpdateWindowMask(Parcel & parcel)1894 void WindowSessionProperty::ReadActionUpdateWindowMask(Parcel& parcel)
1895 {
1896 UnmarshallingWindowMask(parcel, this);
1897 }
1898
ReadActionUpdateTopmost(Parcel & parcel)1899 void WindowSessionProperty::ReadActionUpdateTopmost(Parcel& parcel)
1900 {
1901 SetTopmost(parcel.ReadBool());
1902 }
1903
ReadActionUpdateMainWindowTopmost(Parcel & parcel)1904 void WindowSessionProperty::ReadActionUpdateMainWindowTopmost(Parcel& parcel)
1905 {
1906 UnmarshallingMainWindowTopmost(parcel, this);
1907 }
1908
ReadActionUpdateSubWindowZLevel(Parcel & parcel)1909 void WindowSessionProperty::ReadActionUpdateSubWindowZLevel(Parcel& parcel)
1910 {
1911 SetSubWindowZLevel(parcel.ReadInt32());
1912 }
1913
ReadActionUpdateWindowModeSupportType(Parcel & parcel)1914 void WindowSessionProperty::ReadActionUpdateWindowModeSupportType(Parcel& parcel)
1915 {
1916 SetWindowModeSupportType(parcel.ReadUint32());
1917 }
1918
ReadActionUpdateAvoidAreaOption(Parcel & parcel)1919 void WindowSessionProperty::ReadActionUpdateAvoidAreaOption(Parcel& parcel)
1920 {
1921 SetAvoidAreaOption(parcel.ReadUint32());
1922 }
1923
ReadActionUpdateBackgroundAlpha(Parcel & parcel)1924 void WindowSessionProperty::ReadActionUpdateBackgroundAlpha(Parcel& parcel)
1925 {
1926 SetBackgroundAlpha(parcel.ReadUint8());
1927 }
1928
ReadActionUpdateExclusivelyHighlighted(Parcel & parcel)1929 void WindowSessionProperty::ReadActionUpdateExclusivelyHighlighted(Parcel& parcel)
1930 {
1931 SetExclusivelyHighlighted(parcel.ReadBool());
1932 }
1933
ReadActionUpdateFollowScreenChange(Parcel & parcel)1934 void WindowSessionProperty::ReadActionUpdateFollowScreenChange(Parcel& parcel)
1935 {
1936 SetFollowScreenChange(parcel.ReadBool());
1937 }
1938
ReadActionUpdateWindowShadowEnabled(Parcel & parcel)1939 void WindowSessionProperty::ReadActionUpdateWindowShadowEnabled(Parcel& parcel)
1940 {
1941 SetWindowShadowEnabled(parcel.ReadBool());
1942 }
1943
SetTransform(const Transform & trans)1944 void WindowSessionProperty::SetTransform(const Transform& trans)
1945 {
1946 trans_ = trans;
1947 }
1948
GetTransform() const1949 const Transform& WindowSessionProperty::GetTransform() const
1950 {
1951 return trans_;
1952 }
1953
SetTextFieldPositionY(double textFieldPositionY)1954 void WindowSessionProperty::SetTextFieldPositionY(double textFieldPositionY)
1955 {
1956 textFieldPositionY_ = textFieldPositionY;
1957 }
1958
SetTextFieldHeight(double textFieldHeight)1959 void WindowSessionProperty::SetTextFieldHeight(double textFieldHeight)
1960 {
1961 textFieldHeight_ = textFieldHeight;
1962 }
1963
GetTextFieldPositionY() const1964 double WindowSessionProperty::GetTextFieldPositionY() const
1965 {
1966 return textFieldPositionY_;
1967 }
1968
GetTextFieldHeight() const1969 double WindowSessionProperty::GetTextFieldHeight() const
1970 {
1971 return textFieldHeight_;
1972 }
1973
SetSessionPropertyChangeCallback(std::function<void ()> && callback)1974 void WindowSessionProperty::SetSessionPropertyChangeCallback(std::function<void()>&& callback)
1975 {
1976 touchHotAreasChangeCallback_ = std::move(callback);
1977 }
1978
IsLayoutFullScreen() const1979 bool WindowSessionProperty::IsLayoutFullScreen() const
1980 {
1981 return isLayoutFullScreen_;
1982 }
1983
SetIsLayoutFullScreen(bool isLayoutFullScreen)1984 void WindowSessionProperty::SetIsLayoutFullScreen(bool isLayoutFullScreen)
1985 {
1986 isLayoutFullScreen_ = isLayoutFullScreen;
1987 }
1988
SetRealParentId(int32_t realParentId)1989 void WindowSessionProperty::SetRealParentId(int32_t realParentId)
1990 {
1991 realParentId_ = realParentId;
1992 }
1993
GetRealParentId() const1994 int32_t WindowSessionProperty::GetRealParentId() const
1995 {
1996 return realParentId_;
1997 }
1998
SetIsUIExtFirstSubWindow(bool isUIExtFirstSubWindow)1999 void WindowSessionProperty::SetIsUIExtFirstSubWindow(bool isUIExtFirstSubWindow)
2000 {
2001 isUIExtFirstSubWindow_ = isUIExtFirstSubWindow;
2002 }
2003
GetIsUIExtFirstSubWindow() const2004 bool WindowSessionProperty::GetIsUIExtFirstSubWindow() const
2005 {
2006 return isUIExtFirstSubWindow_;
2007 }
2008
SetIsUIExtensionAbilityProcess(bool isUIExtensionAbilityProcess)2009 void WindowSessionProperty::SetIsUIExtensionAbilityProcess(bool isUIExtensionAbilityProcess)
2010 {
2011 isUIExtensionAbilityProcess_ = isUIExtensionAbilityProcess;
2012 }
2013
GetIsUIExtensionAbilityProcess() const2014 bool WindowSessionProperty::GetIsUIExtensionAbilityProcess() const
2015 {
2016 return isUIExtensionAbilityProcess_;
2017 }
2018
SetIsUIExtAnySubWindow(bool isUIExtAnySubWindow)2019 void WindowSessionProperty::SetIsUIExtAnySubWindow(bool isUIExtAnySubWindow)
2020 {
2021 isUIExtAnySubWindow_ = isUIExtAnySubWindow;
2022 }
2023
GetIsUIExtAnySubWindow() const2024 bool WindowSessionProperty::GetIsUIExtAnySubWindow() const
2025 {
2026 return isUIExtAnySubWindow_;
2027 }
2028
SetUIExtensionUsage(UIExtensionUsage uiExtensionUsage)2029 void WindowSessionProperty::SetUIExtensionUsage(UIExtensionUsage uiExtensionUsage)
2030 {
2031 uiExtensionUsage_ = uiExtensionUsage;
2032 }
2033
GetUIExtensionUsage() const2034 UIExtensionUsage WindowSessionProperty::GetUIExtensionUsage() const
2035 {
2036 return uiExtensionUsage_;
2037 }
2038
SetParentWindowType(WindowType parentWindowType)2039 void WindowSessionProperty::SetParentWindowType(WindowType parentWindowType)
2040 {
2041 parentWindowType_= parentWindowType;
2042 }
2043
GetParentWindowType() const2044 WindowType WindowSessionProperty::GetParentWindowType() const
2045 {
2046 return parentWindowType_;
2047 }
2048
SetWindowMask(const std::shared_ptr<Media::PixelMap> & windowMask)2049 void WindowSessionProperty::SetWindowMask(const std::shared_ptr<Media::PixelMap>& windowMask)
2050 {
2051 std::lock_guard<std::mutex> lock(windowMaskMutex_);
2052 windowMask_ = windowMask;
2053 }
2054
GetWindowMask() const2055 std::shared_ptr<Media::PixelMap> WindowSessionProperty::GetWindowMask() const
2056 {
2057 std::lock_guard<std::mutex> lock(windowMaskMutex_);
2058 return windowMask_;
2059 }
2060
SetIsShaped(bool isShaped)2061 void WindowSessionProperty::SetIsShaped(bool isShaped)
2062 {
2063 isShaped_ = isShaped;
2064 }
2065
GetIsShaped() const2066 bool WindowSessionProperty::GetIsShaped() const
2067 {
2068 return isShaped_;
2069 }
2070
GetCollaboratorType() const2071 int32_t WindowSessionProperty::GetCollaboratorType() const
2072 {
2073 return collaboratorType_;
2074 }
2075
SetCollaboratorType(int32_t collaboratorType)2076 void WindowSessionProperty::SetCollaboratorType(int32_t collaboratorType)
2077 {
2078 collaboratorType_ = collaboratorType;
2079 }
2080
SetUserWindowLimits(const WindowLimits & windowUserLimits)2081 void WindowSessionProperty::SetUserWindowLimits(const WindowLimits& windowUserLimits)
2082 {
2083 userLimits_ = windowUserLimits;
2084 }
2085
GetUserWindowLimits() const2086 WindowLimits WindowSessionProperty::GetUserWindowLimits() const
2087 {
2088 return userLimits_;
2089 }
2090
SetConfigWindowLimitsVP(const WindowLimits & windowConfigLimitsVP)2091 void WindowSessionProperty::SetConfigWindowLimitsVP(const WindowLimits& windowConfigLimitsVP)
2092 {
2093 TLOGI(WmsLogTag::WMS_LAYOUT, "id:%{public}d, windowLimits:%{public}s", GetPersistentId(),
2094 windowConfigLimitsVP.ToString().c_str());
2095 configLimitsVP_ = windowConfigLimitsVP;
2096 }
2097
GetConfigWindowLimitsVP() const2098 WindowLimits WindowSessionProperty::GetConfigWindowLimitsVP() const
2099 {
2100 return configLimitsVP_;
2101 }
2102
SetLastLimitsVpr(float vpr)2103 void WindowSessionProperty::SetLastLimitsVpr(float vpr)
2104 {
2105 lastVpr_ = vpr;
2106 }
2107
GetLastLimitsVpr() const2108 float WindowSessionProperty::GetLastLimitsVpr() const
2109 {
2110 return lastVpr_;
2111 }
2112
GetFullScreenStart() const2113 bool WindowSessionProperty::GetFullScreenStart() const
2114 {
2115 return fullScreenStart_;
2116 }
2117
SetFullScreenStart(bool fullScreenStart)2118 void WindowSessionProperty::SetFullScreenStart(bool fullScreenStart)
2119 {
2120 fullScreenStart_ = fullScreenStart;
2121 }
2122
SetAppInstanceKey(const std::string & appInstanceKey)2123 void WindowSessionProperty::SetAppInstanceKey(const std::string& appInstanceKey)
2124 {
2125 appInstanceKey_ = appInstanceKey;
2126 }
2127
GetAppInstanceKey() const2128 std::string WindowSessionProperty::GetAppInstanceKey() const
2129 {
2130 return appInstanceKey_;
2131 }
2132
SetIsSystemKeyboard(bool isSystemKeyboard)2133 void WindowSessionProperty::SetIsSystemKeyboard(bool isSystemKeyboard)
2134 {
2135 isSystemKeyboard_ = isSystemKeyboard;
2136 }
2137
IsSystemKeyboard() const2138 bool WindowSessionProperty::IsSystemKeyboard() const
2139 {
2140 return isSystemKeyboard_;
2141 }
2142
SetKeyboardEffectOption(const KeyboardEffectOption & effectOption)2143 void WindowSessionProperty::SetKeyboardEffectOption(const KeyboardEffectOption& effectOption)
2144 {
2145 std::lock_guard<std::mutex> lock(keyboardMutex_);
2146 keyboardEffectOption_ = effectOption;
2147 }
2148
GetKeyboardEffectOption() const2149 KeyboardEffectOption WindowSessionProperty::GetKeyboardEffectOption() const
2150 {
2151 std::lock_guard<std::mutex> lock(keyboardMutex_);
2152 return keyboardEffectOption_;
2153 }
2154
GetBackgroundAlpha() const2155 uint8_t WindowSessionProperty::GetBackgroundAlpha() const
2156 {
2157 return backgroundAlpha_;
2158 }
2159
SetBackgroundAlpha(uint8_t alpha)2160 void WindowSessionProperty::SetBackgroundAlpha(uint8_t alpha)
2161 {
2162 backgroundAlpha_ = alpha;
2163 }
2164
SetExclusivelyHighlighted(bool isExclusivelyHighlighted)2165 void WindowSessionProperty::SetExclusivelyHighlighted(bool isExclusivelyHighlighted)
2166 {
2167 isExclusivelyHighlighted_ = isExclusivelyHighlighted;
2168 }
2169
GetExclusivelyHighlighted() const2170 bool WindowSessionProperty::GetExclusivelyHighlighted() const
2171 {
2172 return isExclusivelyHighlighted_;
2173 }
2174
SetConstrainedModal(bool isConstrained)2175 void WindowSessionProperty::SetConstrainedModal(bool isConstrained)
2176 {
2177 isConstrainedModal_ = isConstrained;
2178 }
2179
IsConstrainedModal() const2180 bool WindowSessionProperty::IsConstrainedModal() const
2181 {
2182 return isConstrainedModal_;
2183 }
2184
SetApiVersion(uint32_t version)2185 void WindowSessionProperty::SetApiVersion(uint32_t version)
2186 {
2187 apiVersion_ = version;
2188 }
2189
GetApiVersion() const2190 uint32_t WindowSessionProperty::GetApiVersion() const
2191 {
2192 return apiVersion_;
2193 }
2194
SetIsFullScreenWaterfallMode(bool isFullScreenWaterfallMode)2195 void WindowSessionProperty::SetIsFullScreenWaterfallMode(bool isFullScreenWaterfallMode)
2196 {
2197 isFullScreenWaterfallMode_ = isFullScreenWaterfallMode;
2198 }
2199
GetIsFullScreenWaterfallMode() const2200 bool WindowSessionProperty::GetIsFullScreenWaterfallMode() const
2201 {
2202 return isFullScreenWaterfallMode_;
2203 }
2204
SetIsAbilityHookOff(bool isAbilityHookOff)2205 void WindowSessionProperty::SetIsAbilityHookOff(bool isAbilityHookOff)
2206 {
2207 isAbilityHookOff_ = isAbilityHookOff;
2208 }
2209
GetIsAbilityHookOff() const2210 bool WindowSessionProperty::GetIsAbilityHookOff() const
2211 {
2212 return isAbilityHookOff_;
2213 }
2214
SetIsAbilityHook(bool isAbilityHook)2215 void WindowSessionProperty::SetIsAbilityHook(bool isAbilityHook)
2216 {
2217 isAbilityHook_ = isAbilityHook;
2218 }
2219
GetIsAbilityHook() const2220 bool WindowSessionProperty::GetIsAbilityHook() const
2221 {
2222 return isAbilityHook_;
2223 }
2224
GetCompatibleModeProperty() const2225 sptr<CompatibleModeProperty> WindowSessionProperty::GetCompatibleModeProperty() const
2226 {
2227 return compatibleModeProperty_;
2228 }
2229
SetCompatibleModeProperty(const sptr<CompatibleModeProperty> property)2230 void WindowSessionProperty::SetCompatibleModeProperty(const sptr<CompatibleModeProperty> property)
2231 {
2232 compatibleModeProperty_ = property;
2233 }
2234
IsAdaptToImmersive() const2235 bool WindowSessionProperty::IsAdaptToImmersive() const
2236 {
2237 return compatibleModeProperty_ && compatibleModeProperty_->IsAdaptToImmersive();
2238 }
2239
IsAdaptToEventMapping() const2240 bool WindowSessionProperty::IsAdaptToEventMapping() const
2241 {
2242 return compatibleModeProperty_ && compatibleModeProperty_->IsAdaptToEventMapping();
2243 }
2244
IsAdaptToProportionalScale() const2245 bool WindowSessionProperty::IsAdaptToProportionalScale() const
2246 {
2247 return compatibleModeProperty_ && compatibleModeProperty_->IsAdaptToProportionalScale();
2248 }
2249
IsAdaptToBackButton() const2250 bool WindowSessionProperty::IsAdaptToBackButton() const
2251 {
2252 return compatibleModeProperty_ && compatibleModeProperty_->IsAdaptToBackButton();
2253 }
2254
IsAdaptToDragScale() const2255 bool WindowSessionProperty::IsAdaptToDragScale() const
2256 {
2257 return compatibleModeProperty_ && compatibleModeProperty_->IsAdaptToDragScale();
2258 }
2259
IsDragResizeDisabled() const2260 bool WindowSessionProperty::IsDragResizeDisabled() const
2261 {
2262 return compatibleModeProperty_ && compatibleModeProperty_->IsDragResizeDisabled();
2263 }
2264
IsResizeWithDpiDisabled() const2265 bool WindowSessionProperty::IsResizeWithDpiDisabled() const
2266 {
2267 return compatibleModeProperty_ && compatibleModeProperty_->IsResizeWithDpiDisabled();
2268 }
2269
IsFullScreenDisabled() const2270 bool WindowSessionProperty::IsFullScreenDisabled() const
2271 {
2272 return compatibleModeProperty_ && compatibleModeProperty_->IsFullScreenDisabled();
2273 }
2274
IsSplitDisabled() const2275 bool WindowSessionProperty::IsSplitDisabled() const
2276 {
2277 return compatibleModeProperty_ && compatibleModeProperty_->IsSplitDisabled();
2278 }
2279
IsWindowLimitDisabled() const2280 bool WindowSessionProperty::IsWindowLimitDisabled() const
2281 {
2282 return compatibleModeProperty_ && compatibleModeProperty_->IsWindowLimitDisabled();
2283 }
2284
IsDecorFullscreenDisabled() const2285 bool WindowSessionProperty::IsDecorFullscreenDisabled() const
2286 {
2287 return compatibleModeProperty_ && compatibleModeProperty_->IsDecorFullscreenDisabled();
2288 }
2289
IsSupportRotateFullScreen() const2290 bool WindowSessionProperty::IsSupportRotateFullScreen() const
2291 {
2292 return compatibleModeProperty_ && compatibleModeProperty_->IsSupportRotateFullScreen();
2293 }
2294
IsAdaptToSubWindow() const2295 bool WindowSessionProperty::IsAdaptToSubWindow() const
2296 {
2297 return compatibleModeProperty_ && compatibleModeProperty_->IsAdaptToSubWindow();
2298 }
2299
IsAdaptToSimulationScale() const2300 bool WindowSessionProperty::IsAdaptToSimulationScale() const
2301 {
2302 return compatibleModeProperty_ && compatibleModeProperty_->IsAdaptToSimulationScale();
2303 }
2304
SetPcAppInpadCompatibleMode(bool enabled)2305 void WindowSessionProperty::SetPcAppInpadCompatibleMode(bool enabled)
2306 {
2307 isPcAppInpadCompatibleMode_ = enabled;
2308 }
2309
SetPcAppInpadSpecificSystemBarInvisible(bool isPcAppInpadSpecificSystemBarInvisible)2310 void WindowSessionProperty::SetPcAppInpadSpecificSystemBarInvisible(bool isPcAppInpadSpecificSystemBarInvisible)
2311 {
2312 isPcAppInpadSpecificSystemBarInvisible_ = isPcAppInpadSpecificSystemBarInvisible;
2313 }
2314
SetPcAppInpadOrientationLandscape(bool isPcAppInpadOrientationLandscape)2315 void WindowSessionProperty::SetPcAppInpadOrientationLandscape(bool isPcAppInpadOrientationLandscape)
2316 {
2317 isPcAppInpadOrientationLandscape_ = isPcAppInpadOrientationLandscape;
2318 }
2319
GetPcAppInpadCompatibleMode() const2320 bool WindowSessionProperty::GetPcAppInpadCompatibleMode() const
2321 {
2322 return isPcAppInpadCompatibleMode_;
2323 }
2324
GetPcAppInpadSpecificSystemBarInvisible() const2325 bool WindowSessionProperty::GetPcAppInpadSpecificSystemBarInvisible() const
2326 {
2327 return isPcAppInpadSpecificSystemBarInvisible_;
2328 }
2329
GetPcAppInpadOrientationLandscape() const2330 bool WindowSessionProperty::GetPcAppInpadOrientationLandscape() const
2331 {
2332 return isPcAppInpadOrientationLandscape_;
2333 }
2334
SetAncoRealBundleName(const std::string & ancoRealBundleName)2335 void WindowSessionProperty::SetAncoRealBundleName(const std::string& ancoRealBundleName)
2336 {
2337 ancoRealBundleName_ = ancoRealBundleName;
2338 }
2339
GetAncoRealBundleName() const2340 std::string WindowSessionProperty::GetAncoRealBundleName() const
2341 {
2342 return ancoRealBundleName_;
2343 }
2344
SetIsAdaptToImmersive(bool isAdaptToImmersive)2345 void CompatibleModeProperty::SetIsAdaptToImmersive(bool isAdaptToImmersive)
2346 {
2347 isAdaptToImmersive_ = isAdaptToImmersive;
2348 }
2349
IsAdaptToImmersive() const2350 bool CompatibleModeProperty::IsAdaptToImmersive() const
2351 {
2352 return isAdaptToImmersive_;
2353 }
2354
SetIsAdaptToEventMapping(bool isAdaptToEventMapping)2355 void CompatibleModeProperty::SetIsAdaptToEventMapping(bool isAdaptToEventMapping)
2356 {
2357 isAdaptToEventMapping_ = isAdaptToEventMapping;
2358 }
2359
IsAdaptToEventMapping() const2360 bool CompatibleModeProperty::IsAdaptToEventMapping() const
2361 {
2362 return isAdaptToEventMapping_;
2363 }
2364
SetIsAdaptToProportionalScale(bool isAdaptToProportionalScale)2365 void CompatibleModeProperty::SetIsAdaptToProportionalScale(bool isAdaptToProportionalScale)
2366 {
2367 isAdaptToProportionalScale_ = isAdaptToProportionalScale;
2368 }
2369
IsAdaptToProportionalScale() const2370 bool CompatibleModeProperty::IsAdaptToProportionalScale() const
2371 {
2372 return isAdaptToProportionalScale_;
2373 }
2374
SetIsAdaptToBackButton(bool isAdaptToBackButton)2375 void CompatibleModeProperty::SetIsAdaptToBackButton(bool isAdaptToBackButton)
2376 {
2377 isAdaptToBackButton_ = isAdaptToBackButton;
2378 }
2379
IsAdaptToBackButton() const2380 bool CompatibleModeProperty::IsAdaptToBackButton() const
2381 {
2382 return isAdaptToBackButton_;
2383 }
2384
SetIsAdaptToDragScale(bool isAdaptToDragScale)2385 void CompatibleModeProperty::SetIsAdaptToDragScale(bool isAdaptToDragScale)
2386 {
2387 isAdaptToDragScale_ = isAdaptToDragScale;
2388 }
2389
IsAdaptToDragScale() const2390 bool CompatibleModeProperty::IsAdaptToDragScale() const
2391 {
2392 return isAdaptToDragScale_;
2393 }
2394
SetDisableDragResize(bool disableDragResize)2395 void CompatibleModeProperty::SetDisableDragResize(bool disableDragResize)
2396 {
2397 disableDragResize_ = disableDragResize;
2398 }
2399
IsDragResizeDisabled() const2400 bool CompatibleModeProperty::IsDragResizeDisabled() const
2401 {
2402 return disableDragResize_;
2403 }
2404
SetDisableResizeWithDpi(bool disableResizeWithDpi)2405 void CompatibleModeProperty::SetDisableResizeWithDpi(bool disableResizeWithDpi)
2406 {
2407 disableResizeWithDpi_ = disableResizeWithDpi;
2408 }
2409
IsResizeWithDpiDisabled() const2410 bool CompatibleModeProperty::IsResizeWithDpiDisabled() const
2411 {
2412 return disableResizeWithDpi_;
2413 }
2414
SetDisableFullScreen(bool disableFullScreen)2415 void CompatibleModeProperty::SetDisableFullScreen(bool disableFullScreen)
2416 {
2417 disableFullScreen_ = disableFullScreen;
2418 }
2419
IsFullScreenDisabled() const2420 bool CompatibleModeProperty::IsFullScreenDisabled() const
2421 {
2422 return disableFullScreen_;
2423 }
2424
SetDisableSplit(bool disableSplit)2425 void CompatibleModeProperty::SetDisableSplit(bool disableSplit)
2426 {
2427 disableSplit_ = disableSplit;
2428 }
2429
IsSplitDisabled() const2430 bool CompatibleModeProperty::IsSplitDisabled() const
2431 {
2432 return disableSplit_;
2433 }
2434
SetDisableWindowLimit(bool disableWindowLimit)2435 void CompatibleModeProperty::SetDisableWindowLimit(bool disableWindowLimit)
2436 {
2437 disableWindowLimit_ = disableWindowLimit;
2438 }
2439
IsWindowLimitDisabled() const2440 bool CompatibleModeProperty::IsWindowLimitDisabled() const
2441 {
2442 return disableWindowLimit_;
2443 }
2444
SetDisableDecorFullscreen(bool disableDecorFullscreen)2445 void CompatibleModeProperty::SetDisableDecorFullscreen(bool disableDecorFullscreen)
2446 {
2447 disableDecorFullscreen_ = disableDecorFullscreen;
2448 }
2449
IsDecorFullscreenDisabled() const2450 bool CompatibleModeProperty::IsDecorFullscreenDisabled() const
2451 {
2452 return disableDecorFullscreen_;
2453 }
2454
SetIsSupportRotateFullScreen(bool isSupportRotateFullScreen)2455 void CompatibleModeProperty::SetIsSupportRotateFullScreen(bool isSupportRotateFullScreen)
2456 {
2457 isSupportRotateFullScreen_ = isSupportRotateFullScreen;
2458 }
2459
IsSupportRotateFullScreen() const2460 bool CompatibleModeProperty::IsSupportRotateFullScreen() const
2461 {
2462 return isSupportRotateFullScreen_;
2463 }
2464
SetIsAdaptToSubWindow(bool isAdaptToSubWindow)2465 void CompatibleModeProperty::SetIsAdaptToSubWindow(bool isAdaptToSubWindow)
2466 {
2467 isAdaptToSubWindow_ = isAdaptToSubWindow;
2468 }
2469
IsAdaptToSubWindow() const2470 bool CompatibleModeProperty::IsAdaptToSubWindow() const
2471 {
2472 return isAdaptToSubWindow_;
2473 }
2474
SetIsAdaptToSimulationScale(bool isAdaptToSimulationScale)2475 void CompatibleModeProperty::SetIsAdaptToSimulationScale(bool isAdaptToSimulationScale)
2476 {
2477 isAdaptToSimulationScale_ = isAdaptToSimulationScale;
2478 }
2479
IsAdaptToSimulationScale() const2480 bool CompatibleModeProperty::IsAdaptToSimulationScale() const
2481 {
2482 return isAdaptToSimulationScale_;
2483 }
2484
Marshalling(Parcel & parcel) const2485 bool CompatibleModeProperty::Marshalling(Parcel& parcel) const
2486 {
2487 return parcel.WriteBool(isAdaptToImmersive_) &&
2488 parcel.WriteBool(isAdaptToEventMapping_) &&
2489 parcel.WriteBool(isAdaptToProportionalScale_) &&
2490 parcel.WriteBool(isAdaptToBackButton_) &&
2491 parcel.WriteBool(isAdaptToDragScale_) &&
2492 parcel.WriteBool(disableDragResize_) &&
2493 parcel.WriteBool(disableResizeWithDpi_) &&
2494 parcel.WriteBool(disableFullScreen_) &&
2495 parcel.WriteBool(disableSplit_) &&
2496 parcel.WriteBool(disableWindowLimit_) &&
2497 parcel.WriteBool(disableDecorFullscreen_) &&
2498 parcel.WriteBool(isSupportRotateFullScreen_) &&
2499 parcel.WriteBool(isAdaptToSubWindow_) &&
2500 parcel.WriteBool(isAdaptToSimulationScale_);
2501 }
2502
Unmarshalling(Parcel & parcel)2503 CompatibleModeProperty* CompatibleModeProperty::Unmarshalling(Parcel& parcel)
2504 {
2505 CompatibleModeProperty* property = new(std::nothrow) CompatibleModeProperty();
2506 if (property == nullptr) {
2507 return nullptr;
2508 }
2509 property->isAdaptToImmersive_ = parcel.ReadBool();
2510 property->isAdaptToEventMapping_ = parcel.ReadBool();
2511 property->isAdaptToProportionalScale_ = parcel.ReadBool();
2512 property->isAdaptToBackButton_ = parcel.ReadBool();
2513 property->isAdaptToDragScale_ = parcel.ReadBool();
2514 property->disableDragResize_ = parcel.ReadBool();
2515 property->disableResizeWithDpi_ = parcel.ReadBool();
2516 property->disableFullScreen_ = parcel.ReadBool();
2517 property->disableSplit_ = parcel.ReadBool();
2518 property->disableWindowLimit_ = parcel.ReadBool();
2519 property->disableDecorFullscreen_ = parcel.ReadBool();
2520 property->isSupportRotateFullScreen_ = parcel.ReadBool();
2521 property->isAdaptToSubWindow_ = parcel.ReadBool();
2522 property->isAdaptToSimulationScale_ = parcel.ReadBool();
2523 return property;
2524 }
2525
CopyFrom(const sptr<CompatibleModeProperty> & property)2526 void CompatibleModeProperty::CopyFrom(const sptr<CompatibleModeProperty>& property)
2527 {
2528 if (property == nullptr) {
2529 return;
2530 }
2531 isAdaptToImmersive_ = property->isAdaptToImmersive_;
2532 isAdaptToEventMapping_ = property->isAdaptToEventMapping_;
2533 isAdaptToProportionalScale_ = property->isAdaptToProportionalScale_;
2534 isAdaptToBackButton_ = property->isAdaptToBackButton_;
2535 disableDragResize_ = property->disableDragResize_;
2536 disableResizeWithDpi_ = property->disableResizeWithDpi_;
2537 disableFullScreen_ = property->disableFullScreen_;
2538 disableWindowLimit_ = property->disableWindowLimit_;
2539 isAdaptToSimulationScale_= property->isAdaptToSimulationScale_;
2540 }
2541
MarshallingWindowAnchorInfo(Parcel & parcel) const2542 bool WindowSessionProperty::MarshallingWindowAnchorInfo(Parcel& parcel) const
2543 {
2544 return parcel.WriteParcelable(&windowAnchorInfo_);
2545 }
2546
UnmarshallingWindowAnchorInfo(Parcel & parcel,WindowSessionProperty * property)2547 void WindowSessionProperty::UnmarshallingWindowAnchorInfo(Parcel& parcel, WindowSessionProperty* property)
2548 {
2549 sptr<WindowAnchorInfo> windowAnchorInfo = parcel.ReadParcelable<WindowAnchorInfo>();
2550 if (windowAnchorInfo == nullptr) {
2551 TLOGE(WmsLogTag::WMS_SUB, "windowAnchorInfo is null");
2552 return;
2553 }
2554 property->SetWindowAnchorInfo(*windowAnchorInfo);
2555 }
2556
MarshallingShadowsInfo(Parcel & parcel) const2557 bool WindowSessionProperty::MarshallingShadowsInfo(Parcel& parcel) const
2558 {
2559 return parcel.WriteParcelable(&shadowsInfo_);
2560 }
2561
UnmarshallingShadowsInfo(Parcel & parcel,WindowSessionProperty * property)2562 void WindowSessionProperty::UnmarshallingShadowsInfo(Parcel& parcel, WindowSessionProperty* property)
2563 {
2564 sptr<ShadowsInfo> shadowsInfo = parcel.ReadParcelable<ShadowsInfo>();
2565 if (shadowsInfo == nullptr) {
2566 TLOGE(WmsLogTag::WMS_ANIMATION, "shadowsInfo is null");
2567 return;
2568 }
2569 property->SetWindowShadows(*shadowsInfo);
2570 }
2571 } // namespace Rosen
2572 } // namespace OHOS