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