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
20 namespace OHOS {
21 namespace Rosen {
22 namespace {
23 constexpr uint32_t TOUCH_HOT_AREA_MAX_NUM = 10;
24 }
25
WindowSessionProperty(const sptr<WindowSessionProperty> & property)26 WindowSessionProperty::WindowSessionProperty(const sptr<WindowSessionProperty>& property)
27 {
28 CopyFrom(property);
29 }
30
SetWindowName(const std::string & name)31 void WindowSessionProperty::SetWindowName(const std::string& name)
32 {
33 windowName_ = name;
34 }
35
SetSessionInfo(const SessionInfo & info)36 void WindowSessionProperty::SetSessionInfo(const SessionInfo& info)
37 {
38 sessionInfo_ = info;
39 }
40
SetWindowRect(const struct Rect & rect)41 void WindowSessionProperty::SetWindowRect(const struct Rect& rect)
42 {
43 windowRect_ = rect;
44 }
45
SetRequestRect(const Rect & requestRect)46 void WindowSessionProperty::SetRequestRect(const Rect& requestRect)
47 {
48 requestRect_ = requestRect;
49 }
50
SetWindowType(WindowType type)51 void WindowSessionProperty::SetWindowType(WindowType type)
52 {
53 type_ = type;
54 }
55
SetFocusable(bool isFocusable)56 void WindowSessionProperty::SetFocusable(bool isFocusable)
57 {
58 focusable_ = isFocusable;
59 }
60
SetTouchable(bool isTouchable)61 void WindowSessionProperty::SetTouchable(bool isTouchable)
62 {
63 touchable_ = isTouchable;
64 }
65
SetDragEnabled(bool dragEnabled)66 void WindowSessionProperty::SetDragEnabled(bool dragEnabled)
67 {
68 dragEnabled_ = dragEnabled;
69 }
70
SetHideNonSystemFloatingWindows(bool hide)71 void WindowSessionProperty::SetHideNonSystemFloatingWindows(bool hide)
72 {
73 hideNonSystemFloatingWindows_ = hide;
74 }
75
SetForceHide(bool hide)76 void WindowSessionProperty::SetForceHide(bool hide)
77 {
78 forceHide_ = hide;
79 }
80
SetRaiseEnabled(bool raiseEnabled)81 void WindowSessionProperty::SetRaiseEnabled(bool raiseEnabled)
82 {
83 raiseEnabled_ = raiseEnabled;
84 }
85
SetRequestedOrientation(Orientation orientation)86 void WindowSessionProperty::SetRequestedOrientation(Orientation orientation)
87 {
88 requestedOrientation_ = orientation;
89 }
90
SetPrivacyMode(bool isPrivate)91 void WindowSessionProperty::SetPrivacyMode(bool isPrivate)
92 {
93 isPrivacyMode_ = isPrivate;
94 }
95
SetSystemPrivacyMode(bool isSystemPrivate)96 void WindowSessionProperty::SetSystemPrivacyMode(bool isSystemPrivate)
97 {
98 isSystemPrivacyMode_ = isSystemPrivate;
99 }
100
SetBrightness(float brightness)101 void WindowSessionProperty::SetBrightness(float brightness)
102 {
103 brightness_ = brightness;
104 }
105
SetSystemCalling(bool isSystemCalling)106 void WindowSessionProperty::SetSystemCalling(bool isSystemCalling)
107 {
108 isSystemCalling_ = isSystemCalling;
109 }
110
SetDisplayId(DisplayId displayId)111 void WindowSessionProperty::SetDisplayId(DisplayId displayId)
112 {
113 displayId_ = displayId;
114 }
115
SetFloatingWindowAppType(bool isAppType)116 void WindowSessionProperty::SetFloatingWindowAppType(bool isAppType)
117 {
118 isFloatingWindowAppType_ = isAppType;
119 }
120
GetWindowName() const121 const std::string& WindowSessionProperty::GetWindowName() const
122 {
123 return windowName_;
124 }
125
GetSessionInfo() const126 const SessionInfo& WindowSessionProperty::GetSessionInfo() const
127 {
128 return sessionInfo_;
129 }
130
GetWindowRect() const131 Rect WindowSessionProperty::GetWindowRect() const
132 {
133 return windowRect_;
134 }
135
GetRequestRect() const136 Rect WindowSessionProperty::GetRequestRect() const
137 {
138 return requestRect_;
139 }
140
GetWindowType() const141 WindowType WindowSessionProperty::GetWindowType() const
142 {
143 return type_;
144 }
145
GetFocusable() const146 bool WindowSessionProperty::GetFocusable() const
147 {
148 return focusable_;
149 }
150
GetTouchable() const151 bool WindowSessionProperty::GetTouchable() const
152 {
153 return touchable_;
154 }
155
GetDragEnabled() const156 bool WindowSessionProperty::GetDragEnabled() const
157 {
158 return dragEnabled_;
159 }
160
GetHideNonSystemFloatingWindows() const161 bool WindowSessionProperty::GetHideNonSystemFloatingWindows() const
162 {
163 return hideNonSystemFloatingWindows_;
164 }
165
GetForceHide() const166 bool WindowSessionProperty::GetForceHide() const
167 {
168 return forceHide_;
169 }
170
GetRaiseEnabled() const171 bool WindowSessionProperty::GetRaiseEnabled() const
172 {
173 return raiseEnabled_;
174 }
175
GetRequestedOrientation() const176 Orientation WindowSessionProperty::GetRequestedOrientation() const
177 {
178 return requestedOrientation_;
179 }
180
GetPrivacyMode() const181 bool WindowSessionProperty::GetPrivacyMode() const
182 {
183 return isPrivacyMode_;
184 }
185
GetSystemPrivacyMode() const186 bool WindowSessionProperty::GetSystemPrivacyMode() const
187 {
188 return isSystemPrivacyMode_;
189 }
190
GetBrightness() const191 float WindowSessionProperty::GetBrightness() const
192 {
193 return brightness_;
194 }
195
GetSystemCalling() const196 bool WindowSessionProperty::GetSystemCalling() const
197 {
198 return isSystemCalling_;
199 }
200
GetDisplayId() const201 DisplayId WindowSessionProperty::GetDisplayId() const
202 {
203 return displayId_;
204 }
205
SetParentId(int32_t parentId)206 void WindowSessionProperty::SetParentId(int32_t parentId)
207 {
208 parentId_ = parentId;
209 }
210
GetParentId() const211 int32_t WindowSessionProperty::GetParentId() const
212 {
213 return parentId_;
214 }
215
SetWindowFlags(uint32_t flags)216 void WindowSessionProperty::SetWindowFlags(uint32_t flags)
217 {
218 flags_ = flags;
219 }
220
AddWindowFlag(WindowFlag flag)221 void WindowSessionProperty::AddWindowFlag(WindowFlag flag)
222 {
223 flags_ |= static_cast<uint32_t>(flag);
224 }
225
GetWindowFlags() const226 uint32_t WindowSessionProperty::GetWindowFlags() const
227 {
228 return flags_;
229 }
230
SetPersistentId(int32_t persistentId)231 void WindowSessionProperty::SetPersistentId(int32_t persistentId)
232 {
233 persistentId_ = persistentId;
234 }
235
GetPersistentId() const236 int32_t WindowSessionProperty::GetPersistentId() const
237 {
238 return persistentId_;
239 }
240
SetParentPersistentId(int32_t persistentId)241 void WindowSessionProperty::SetParentPersistentId(int32_t persistentId)
242 {
243 parentPersistentId_ = persistentId;
244 }
245
GetParentPersistentId() const246 int32_t WindowSessionProperty::GetParentPersistentId() const
247 {
248 return parentPersistentId_;
249 }
250
SetTurnScreenOn(bool turnScreenOn)251 void WindowSessionProperty::SetTurnScreenOn(bool turnScreenOn)
252 {
253 turnScreenOn_ = turnScreenOn;
254 }
255
IsTurnScreenOn() const256 bool WindowSessionProperty::IsTurnScreenOn() const
257 {
258 return turnScreenOn_;
259 }
260
SetKeepScreenOn(bool keepScreenOn)261 void WindowSessionProperty::SetKeepScreenOn(bool keepScreenOn)
262 {
263 keepScreenOn_ = keepScreenOn;
264 }
265
IsKeepScreenOn() const266 bool WindowSessionProperty::IsKeepScreenOn() const
267 {
268 return keepScreenOn_;
269 }
270
SetAccessTokenId(uint32_t accessTokenId)271 void WindowSessionProperty::SetAccessTokenId(uint32_t accessTokenId)
272 {
273 accessTokenId_ = accessTokenId;
274 }
275
GetAccessTokenId() const276 uint32_t WindowSessionProperty::GetAccessTokenId() const
277 {
278 return accessTokenId_;
279 }
280
SetTokenState(bool hasToken)281 void WindowSessionProperty::SetTokenState(bool hasToken)
282 {
283 tokenState_ = hasToken;
284 }
285
GetTokenState() const286 bool WindowSessionProperty::GetTokenState() const
287 {
288 return tokenState_;
289 }
290
GetMaximizeMode() const291 MaximizeMode WindowSessionProperty::GetMaximizeMode() const
292 {
293 return maximizeMode_;
294 }
295
SetMaximizeMode(MaximizeMode mode)296 void WindowSessionProperty::SetMaximizeMode(MaximizeMode mode)
297 {
298 maximizeMode_ = mode;
299 }
300
SetSystemBarProperty(WindowType type,const SystemBarProperty & property)301 void WindowSessionProperty::SetSystemBarProperty(WindowType type, const SystemBarProperty& property)
302 {
303 if (type == WindowType::WINDOW_TYPE_STATUS_BAR
304 || type ==WindowType::WINDOW_TYPE_NAVIGATION_BAR
305 || type == WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR) {
306 sysBarPropMap_[type] = property;
307 }
308 }
309
GetSystemBarProperty() const310 std::unordered_map<WindowType, SystemBarProperty> WindowSessionProperty::GetSystemBarProperty() const
311 {
312 return sysBarPropMap_;
313 }
314
SetWindowLimits(const WindowLimits & windowLimits)315 void WindowSessionProperty::SetWindowLimits(const WindowLimits& windowLimits)
316 {
317 limits_ = windowLimits;
318 }
319
GetWindowLimits() const320 WindowLimits WindowSessionProperty::GetWindowLimits() const
321 {
322 return limits_;
323 }
324
SetWindowMode(WindowMode mode)325 void WindowSessionProperty::SetWindowMode(WindowMode mode)
326 {
327 windowMode_ = mode;
328 }
329
GetWindowMode() const330 WindowMode WindowSessionProperty::GetWindowMode() const
331 {
332 return windowMode_;
333 }
334
GetWindowState() const335 WindowState WindowSessionProperty::GetWindowState() const
336 {
337 return windowState_;
338 }
339
SetWindowState(WindowState state)340 void WindowSessionProperty::SetWindowState(WindowState state)
341 {
342 windowState_ = state;
343 }
344
SetSessionGravity(SessionGravity gravity,uint32_t percent)345 void WindowSessionProperty::SetSessionGravity(SessionGravity gravity, uint32_t percent)
346 {
347 sessionGravity_ = gravity;
348 sessionGravitySizePercent_ = percent;
349 }
350
GetSessionGravity(SessionGravity & gravity,uint32_t & percent)351 void WindowSessionProperty::GetSessionGravity(SessionGravity& gravity, uint32_t& percent)
352 {
353 gravity = sessionGravity_;
354 percent = sessionGravitySizePercent_;
355 }
356
SetDecorEnable(bool isDecorEnable)357 void WindowSessionProperty::SetDecorEnable(bool isDecorEnable)
358 {
359 isDecorEnable_ = isDecorEnable;
360 }
361
IsDecorEnable()362 bool WindowSessionProperty::IsDecorEnable()
363 {
364 return isDecorEnable_;
365 }
366
SetModeSupportInfo(uint32_t modeSupportInfo)367 void WindowSessionProperty::SetModeSupportInfo(uint32_t modeSupportInfo)
368 {
369 modeSupportInfo_ = modeSupportInfo;
370 }
371
GetModeSupportInfo() const372 uint32_t WindowSessionProperty::GetModeSupportInfo() const
373 {
374 return modeSupportInfo_;
375 }
376
SetAnimationFlag(uint32_t animationFlag)377 void WindowSessionProperty::SetAnimationFlag(uint32_t animationFlag)
378 {
379 animationFlag_ = animationFlag;
380 }
381
GetAnimationFlag() const382 uint32_t WindowSessionProperty::GetAnimationFlag() const
383 {
384 return animationFlag_;
385 }
386
IsFloatingWindowAppType() const387 bool WindowSessionProperty::IsFloatingWindowAppType() const
388 {
389 return isFloatingWindowAppType_;
390 }
391
SetTouchHotAreas(const std::vector<Rect> & rects)392 void WindowSessionProperty::SetTouchHotAreas(const std::vector<Rect>& rects)
393 {
394 touchHotAreas_ = rects;
395 if (touchHotAreasChangeCallback_) {
396 touchHotAreasChangeCallback_();
397 }
398 }
399
GetTouchHotAreas(std::vector<Rect> & rects) const400 void WindowSessionProperty::GetTouchHotAreas(std::vector<Rect>& rects) const
401 {
402 rects = touchHotAreas_;
403 }
404
KeepKeyboardOnFocus(bool keepKeyboardFlag)405 void WindowSessionProperty::KeepKeyboardOnFocus(bool keepKeyboardFlag)
406 {
407 keepKeyboardFlag_ = keepKeyboardFlag;
408 }
409
GetKeepKeyboardFlag() const410 bool WindowSessionProperty::GetKeepKeyboardFlag() const
411 {
412 return keepKeyboardFlag_;
413 }
414
SetCallingWindow(uint32_t windowId)415 void WindowSessionProperty::SetCallingWindow(uint32_t windowId)
416 {
417 callingWindowId_ = windowId;
418 }
419
GetCallingWindow() const420 uint32_t WindowSessionProperty::GetCallingWindow() const
421 {
422 return callingWindowId_;
423 }
424
SetIsNeedUpdateWindowMode(bool isNeedUpdateWindowMode)425 void WindowSessionProperty::SetIsNeedUpdateWindowMode(bool isNeedUpdateWindowMode)
426 {
427 isNeedUpdateWindowMode_ = isNeedUpdateWindowMode;
428 }
429
GetIsNeedUpdateWindowMode() const430 bool WindowSessionProperty::GetIsNeedUpdateWindowMode() const
431 {
432 return isNeedUpdateWindowMode_;
433 }
434
MarshallingWindowLimits(Parcel & parcel) const435 bool WindowSessionProperty::MarshallingWindowLimits(Parcel& parcel) const
436 {
437 if (parcel.WriteUint32(limits_.maxWidth_) &&
438 parcel.WriteUint32(limits_.maxHeight_) && parcel.WriteUint32(limits_.minWidth_) &&
439 parcel.WriteUint32(limits_.minHeight_) && parcel.WriteFloat(limits_.maxRatio_) &&
440 parcel.WriteFloat(limits_.minRatio_)) {
441 return true;
442 }
443 return false;
444 }
445
UnmarshallingWindowLimits(Parcel & parcel,WindowSessionProperty * property)446 void WindowSessionProperty::UnmarshallingWindowLimits(Parcel& parcel, WindowSessionProperty* property)
447 {
448 WindowLimits windowLimits = { parcel.ReadUint32(), parcel.ReadUint32(), parcel.ReadUint32(),
449 parcel.ReadUint32(), parcel.ReadFloat(), parcel.ReadFloat() };
450 property->SetWindowLimits(windowLimits);
451 }
452
MarshallingSystemBarMap(Parcel & parcel) const453 bool WindowSessionProperty::MarshallingSystemBarMap(Parcel& parcel) const
454 {
455 auto size = sysBarPropMap_.size();
456 uint32_t maxSystemBarNumber = 3;
457 if (size > maxSystemBarNumber) { // max systembar number
458 return false;
459 }
460
461 if (!parcel.WriteUint32(static_cast<uint32_t>(size))) {
462 return false;
463 }
464 for (auto it : sysBarPropMap_) {
465 if (!parcel.WriteUint32(static_cast<uint32_t>(it.first))) {
466 return false;
467 }
468 if (!(parcel.WriteBool(it.second.enable_) && parcel.WriteUint32(it.second.backgroundColor_) &&
469 parcel.WriteUint32(it.second.contentColor_))) {
470 return false;
471 }
472 }
473 return true;
474 }
475
UnMarshallingSystemBarMap(Parcel & parcel,WindowSessionProperty * property)476 void WindowSessionProperty::UnMarshallingSystemBarMap(Parcel& parcel, WindowSessionProperty* property)
477 {
478 uint32_t size = parcel.ReadUint32();
479 uint32_t maxSystemBarNumber = 3;
480 if (size > maxSystemBarNumber) { // max systembar number
481 return;
482 }
483
484 for (uint32_t i = 0; i < size; i++) {
485 WindowType type = static_cast<WindowType>(parcel.ReadUint32());
486 SystemBarProperty prop = { parcel.ReadBool(), parcel.ReadUint32(), parcel.ReadUint32() };
487 property->SetSystemBarProperty(type, prop);
488 }
489 }
490
MarshallingTouchHotAreas(Parcel & parcel) const491 bool WindowSessionProperty::MarshallingTouchHotAreas(Parcel& parcel) const
492 {
493 auto size = touchHotAreas_.size();
494 if (size > TOUCH_HOT_AREA_MAX_NUM) {
495 return false;
496 }
497 if (!parcel.WriteUint32(static_cast<uint32_t>(size))) {
498 return false;
499 }
500 for (const auto& rect : touchHotAreas_) {
501 if (!(parcel.WriteInt32(rect.posX_) && parcel.WriteInt32(rect.posY_) &&
502 parcel.WriteUint32(rect.width_) && parcel.WriteUint32(rect.height_))) {
503 return false;
504 }
505 }
506 return true;
507 }
508
UnmarshallingTouchHotAreas(Parcel & parcel,WindowSessionProperty * property)509 void WindowSessionProperty::UnmarshallingTouchHotAreas(Parcel& parcel, WindowSessionProperty* property)
510 {
511 uint32_t size = parcel.ReadUint32();
512 if (size > TOUCH_HOT_AREA_MAX_NUM) {
513 return;
514 }
515 for (uint32_t i = 0; i < size; i++) {
516 property->touchHotAreas_.emplace_back(
517 Rect{ parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() });
518 }
519 }
520
Marshalling(Parcel & parcel) const521 bool WindowSessionProperty::Marshalling(Parcel& parcel) const
522 {
523 return parcel.WriteString(windowName_) && parcel.WriteInt32(windowRect_.posX_) &&
524 parcel.WriteInt32(windowRect_.posY_) && parcel.WriteUint32(windowRect_.width_) &&
525 parcel.WriteUint32(windowRect_.height_) && parcel.WriteInt32(requestRect_.posX_) &&
526 parcel.WriteInt32(requestRect_.posY_) && parcel.WriteUint32(requestRect_.width_) &&
527 parcel.WriteUint32(requestRect_.height_) &&
528 parcel.WriteUint32(static_cast<uint32_t>(type_)) &&
529 parcel.WriteBool(focusable_) && parcel.WriteBool(touchable_) && parcel.WriteBool(tokenState_) &&
530 parcel.WriteBool(turnScreenOn_) && parcel.WriteBool(keepScreenOn_) &&
531 parcel.WriteBool(isPrivacyMode_) && parcel.WriteBool(isSystemPrivacyMode_) &&
532 parcel.WriteUint64(displayId_) && parcel.WriteInt32(persistentId_) &&
533 parcel.WriteString(sessionInfo_.bundleName_) && parcel.WriteString(sessionInfo_.moduleName_) &&
534 parcel.WriteString(sessionInfo_.abilityName_) &&
535 parcel.WriteInt32(parentPersistentId_) &&
536 parcel.WriteUint32(accessTokenId_) && parcel.WriteUint32(static_cast<uint32_t>(maximizeMode_)) &&
537 parcel.WriteUint32(static_cast<uint32_t>(requestedOrientation_)) &&
538 parcel.WriteUint32(static_cast<uint32_t>(windowMode_)) &&
539 parcel.WriteUint32(flags_) && parcel.WriteBool(raiseEnabled_) &&
540 parcel.WriteBool(isDecorEnable_) && parcel.WriteBool(dragEnabled_) &&
541 parcel.WriteBool(hideNonSystemFloatingWindows_) && parcel.WriteBool(forceHide_) &&
542 MarshallingWindowLimits(parcel) && parcel.WriteFloat(brightness_) &&
543 MarshallingSystemBarMap(parcel) && parcel.WriteUint32(animationFlag_) &&
544 parcel.WriteBool(isFloatingWindowAppType_) && MarshallingTouchHotAreas(parcel) &&
545 parcel.WriteBool(isSystemCalling_) &&
546 parcel.WriteUint32(static_cast<uint32_t>(sessionGravity_)) && parcel.WriteUint32(sessionGravitySizePercent_) &&
547 parcel.WriteDouble(textFieldPositionY_) && parcel.WriteDouble(textFieldHeight_) &&
548 parcel.WriteUint32(static_cast<uint32_t>(windowState_)) &&
549 parcel.WriteBool(isNeedUpdateWindowMode_) && parcel.WriteUint32(callingWindowId_) &&
550 parcel.WriteBool(isLayoutFullScreen_);
551 }
552
Unmarshalling(Parcel & parcel)553 WindowSessionProperty* WindowSessionProperty::Unmarshalling(Parcel& parcel)
554 {
555 WindowSessionProperty* property = new(std::nothrow) WindowSessionProperty();
556 if (property == nullptr) {
557 return nullptr;
558 }
559 property->SetWindowName(parcel.ReadString());
560 Rect rect = { parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() };
561 property->SetWindowRect(rect);
562 Rect reqRect = { parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadUint32(), parcel.ReadUint32() };
563 property->SetRequestRect(reqRect);
564 property->SetWindowType(static_cast<WindowType>(parcel.ReadUint32()));
565 property->SetFocusable(parcel.ReadBool());
566 property->SetTouchable(parcel.ReadBool());
567 property->SetTokenState(parcel.ReadBool());
568 property->SetTurnScreenOn(parcel.ReadBool());
569 property->SetKeepScreenOn(parcel.ReadBool());
570 property->SetPrivacyMode(parcel.ReadBool());
571 property->SetSystemPrivacyMode(parcel.ReadBool());
572 property->SetDisplayId(parcel.ReadUint64());
573 property->SetPersistentId(parcel.ReadInt32());
574 SessionInfo info = { parcel.ReadString(), parcel.ReadString(), parcel.ReadString() };
575 property->SetSessionInfo(info);
576 property->SetParentPersistentId(parcel.ReadInt32());
577 property->SetAccessTokenId(parcel.ReadUint32());
578 property->SetMaximizeMode(static_cast<MaximizeMode>(parcel.ReadUint32()));
579 property->SetRequestedOrientation(static_cast<Orientation>(parcel.ReadUint32()));
580 property->SetWindowMode(static_cast<WindowMode>(parcel.ReadUint32()));
581 property->SetWindowFlags(parcel.ReadUint32());
582 property->SetRaiseEnabled(parcel.ReadBool());
583 property->SetDecorEnable(parcel.ReadBool());
584 property->SetDragEnabled(parcel.ReadBool());
585 property->SetHideNonSystemFloatingWindows(parcel.ReadBool());
586 property->SetForceHide(parcel.ReadBool());
587 UnmarshallingWindowLimits(parcel, property);
588 property->SetBrightness(parcel.ReadFloat());
589 UnMarshallingSystemBarMap(parcel, property);
590 property->SetAnimationFlag(parcel.ReadUint32());
591 property->SetFloatingWindowAppType(parcel.ReadBool());
592 UnmarshallingTouchHotAreas(parcel, property);
593 property->SetSystemCalling(parcel.ReadBool());
594 property->SetSessionGravity(static_cast<SessionGravity>(parcel.ReadUint32()), parcel.ReadUint32());
595 property->SetTextFieldPositionY(parcel.ReadDouble());
596 property->SetTextFieldHeight(parcel.ReadDouble());
597 property->SetWindowState(static_cast<WindowState>(parcel.ReadUint32()));
598 property->SetIsNeedUpdateWindowMode(parcel.ReadBool());
599 property->SetCallingWindow(parcel.ReadUint32());
600 return property;
601 }
602
CopyFrom(const sptr<WindowSessionProperty> & property)603 void WindowSessionProperty::CopyFrom(const sptr<WindowSessionProperty>& property)
604 {
605 windowName_ = property->windowName_;
606 sessionInfo_ = property->sessionInfo_;
607 requestRect_ = property->requestRect_;
608 windowRect_ = property->windowRect_;
609 type_ = property->type_;
610 focusable_= property->focusable_;
611 touchable_ = property->touchable_;
612 dragEnabled_ = property->dragEnabled_;
613 hideNonSystemFloatingWindows_ = property->hideNonSystemFloatingWindows_;
614 forceHide_ = property->forceHide_;
615 raiseEnabled_ = property->raiseEnabled_;
616 tokenState_ = property->tokenState_;
617 turnScreenOn_ = property->turnScreenOn_;
618 keepScreenOn_ = property->keepScreenOn_;
619 requestedOrientation_ = property->requestedOrientation_;
620 isPrivacyMode_ = property->isPrivacyMode_;
621 isSystemPrivacyMode_ = property->isSystemPrivacyMode_;
622 brightness_ = property->brightness_;
623 displayId_ = property->displayId_;
624 parentId_ = property->parentId_;
625 flags_ = property->flags_;
626 persistentId_ = property->persistentId_;
627 parentPersistentId_ = property->parentPersistentId_;
628 accessTokenId_ = property->accessTokenId_;
629 maximizeMode_ = property->maximizeMode_;
630 windowMode_ = property->windowMode_;
631 limits_ = property->limits_;
632 sysBarPropMap_ = property->sysBarPropMap_;
633 isDecorEnable_ = property->isDecorEnable_;
634 animationFlag_ = property->animationFlag_;
635 isFloatingWindowAppType_ = property->isFloatingWindowAppType_;
636 touchHotAreas_ = property->touchHotAreas_;
637 isSystemCalling_ = property->isSystemCalling_;
638 textFieldPositionY_ = property->textFieldPositionY_;
639 textFieldHeight_ = property->textFieldHeight_;
640 isNeedUpdateWindowMode_ = property->isNeedUpdateWindowMode_;
641 isLayoutFullScreen_ = property->isLayoutFullScreen_;
642 }
643
SetTransform(const Transform & trans)644 void WindowSessionProperty::SetTransform(const Transform& trans)
645 {
646 trans_ = trans;
647 }
648
GetTransform() const649 const Transform& WindowSessionProperty::GetTransform() const
650 {
651 return trans_;
652 }
653
SetTextFieldPositionY(double textFieldPositionY)654 void WindowSessionProperty::SetTextFieldPositionY(double textFieldPositionY)
655 {
656 textFieldPositionY_ = textFieldPositionY;
657 }
658
SetTextFieldHeight(double textFieldHeight)659 void WindowSessionProperty::SetTextFieldHeight(double textFieldHeight)
660 {
661 textFieldHeight_ = textFieldHeight;
662 }
663
GetTextFieldPositionY() const664 double WindowSessionProperty::GetTextFieldPositionY() const
665 {
666 return textFieldPositionY_;
667 }
668
GetTextFieldHeight() const669 double WindowSessionProperty::GetTextFieldHeight() const
670 {
671 return textFieldHeight_;
672 }
673
SetSessionPropertyChangeCallback(std::function<void ()> && callback)674 void WindowSessionProperty::SetSessionPropertyChangeCallback(std::function<void()>&& callback)
675 {
676 touchHotAreasChangeCallback_ = std::move(callback);
677 }
678
IsLayoutFullScreen() const679 bool WindowSessionProperty::IsLayoutFullScreen() const
680 {
681 return isLayoutFullScreen_;
682 }
683
SetIsLayoutFullScreen(bool isLayoutFullScreen)684 void WindowSessionProperty::SetIsLayoutFullScreen(bool isLayoutFullScreen)
685 {
686 isLayoutFullScreen_ = isLayoutFullScreen;
687 }
688 } // namespace Rosen
689 } // namespace OHOS
690