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