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 #ifndef OHOS_ROSEN_WINDOW_SCENE_WS_COMMON_H
17 #define OHOS_ROSEN_WINDOW_SCENE_WS_COMMON_H
18
19 #include <inttypes.h>
20 #include <iomanip>
21 #include <map>
22 #include <sstream>
23 #include <string>
24
25 #include <iremote_broker.h>
26 #include <want.h>
27
28 namespace OHOS::AAFwk {
29 class AbilityStartSetting;
30 class ProcessOptions;
31 class StartWindowOption;
32 }
33 namespace OHOS::AppExecFwk {
34 struct AbilityInfo;
35 enum class SupportWindowMode;
36 }
37
38 namespace OHOS::Rosen {
39 class RSTransaction;
40 constexpr int32_t ROTATE_ANIMATION_DURATION = 400;
41 constexpr int32_t INVALID_SESSION_ID = 0;
42 const std::string UI_TYPE_PHONE = "phone";
43 const std::string UI_TYPE_PC = "pc";
44 const std::string UI_TYPE_PAD = "pad";
45 constexpr int32_t WINDOW_SUPPORT_MODE_MAX_SIZE = 4;
46
47 enum class WSError : int32_t {
48 WS_OK = 0,
49 WS_DO_NOTHING,
50 WS_ERROR_NO_MEM,
51 WS_ERROR_DESTROYED_OBJECT,
52 WS_ERROR_INVALID_WINDOW,
53 WS_ERROR_INVALID_WINDOW_MODE_OR_SIZE,
54 WS_ERROR_INVALID_OPERATION,
55 WS_ERROR_INVALID_PERMISSION,
56 WS_ERROR_NOT_SYSTEM_APP,
57 WS_ERROR_NO_REMOTE_ANIMATION,
58 WS_ERROR_INVALID_DISPLAY,
59 WS_ERROR_INVALID_PARENT,
60 WS_ERROR_OPER_FULLSCREEN_FAILED,
61 WS_ERROR_REPEAT_OPERATION,
62 WS_ERROR_INVALID_SESSION,
63 WS_ERROR_INVALID_CALLING,
64 WS_ERROR_UNCLEARABLE_SESSION,
65 WS_ERROR_FAIL_TO_GET_SNAPSHOT,
66 WS_ERROR_INTERNAL_ERROR,
67 WS_ERROR_NO_UI_CONTENT_ERROR,
68
69 WS_ERROR_DEVICE_NOT_SUPPORT = 801, // the value do not change.It is defined on all system
70
71 WS_ERROR_NEED_REPORT_BASE = 1000, // error code > 1000 means need report
72 WS_ERROR_NULLPTR,
73 WS_ERROR_INVALID_TYPE,
74 WS_ERROR_INVALID_PARAM,
75 WS_ERROR_SAMGR,
76 WS_ERROR_IPC_FAILED,
77 WS_ERROR_NEED_REPORT_END,
78 WS_ERROR_START_ABILITY_FAILED,
79 WS_ERROR_SET_SESSION_LABEL_FAILED,
80 WS_ERROR_SET_SESSION_ICON_FAILED,
81 WS_ERROR_INVALID_SESSION_LISTENER,
82 WS_ERROR_START_UI_EXTENSION_ABILITY_FAILED,
83 WS_ERROR_MIN_UI_EXTENSION_ABILITY_FAILED,
84 WS_ERROR_TERMINATE_UI_EXTENSION_ABILITY_FAILED,
85 WS_ERROR_PRE_HANDLE_COLLABORATOR_FAILED,
86
87 WS_ERROR_EDM_CONTROLLED = 2097215, // enterprise limit
88 };
89
90 enum class WSErrorCode : int32_t {
91 WS_OK = 0,
92 WS_ERROR_NO_PERMISSION = 201,
93 WS_ERROR_INVALID_PARAM = 401,
94 WS_ERROR_DEVICE_NOT_SUPPORT = 801,
95 WS_ERROR_NOT_REGISTER_SYNC_CALLBACK = 100011,
96 WS_ERROR_TRANSFER_DATA_FAILED = 100012,
97 WS_ERROR_REPEAT_OPERATION = 1300001,
98 WS_ERROR_STATE_ABNORMALLY = 1300002,
99 WS_ERROR_SYSTEM_ABNORMALLY = 1300003,
100 WS_ERROR_INVALID_CALLING = 1300004,
101 WS_ERROR_STAGE_ABNORMALLY = 1300005,
102 WS_ERROR_CONTEXT_ABNORMALLY = 1300006,
103
104 WS_ERROR_EDM_CONTROLLED = 16000013, // enterprise limit
105 };
106
107 const std::map<WSError, WSErrorCode> WS_JS_TO_ERROR_CODE_MAP {
108 { WSError::WS_OK, WSErrorCode::WS_OK },
109 { WSError::WS_DO_NOTHING, WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
110 { WSError::WS_ERROR_INVALID_SESSION, WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
111 { WSError::WS_ERROR_INVALID_PARAM, WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
112 { WSError::WS_ERROR_IPC_FAILED, WSErrorCode::WS_ERROR_SYSTEM_ABNORMALLY },
113 { WSError::WS_ERROR_NULLPTR, WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
114 { WSError::WS_ERROR_EDM_CONTROLLED, WSErrorCode::WS_ERROR_EDM_CONTROLLED },
115 { WSError::WS_ERROR_INVALID_WINDOW, WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
116 };
117
118 enum class SessionState : uint32_t {
119 STATE_DISCONNECT = 0,
120 STATE_CONNECT,
121 STATE_FOREGROUND,
122 STATE_ACTIVE,
123 STATE_INACTIVE,
124 STATE_BACKGROUND,
125 STATE_END,
126 };
127
128 enum ContinueState {
129 CONTINUESTATE_UNKNOWN = -1,
130 CONTINUESTATE_ACTIVE = 0,
131 CONTINUESTATE_INACTIVE = 1,
132 CONTINUESTATE_MAX
133 };
134
135 enum class StartMethod : int32_t {
136 START_NORMAL,
137 START_CALL
138 };
139
140 enum class SingleHandMode : int32_t {
141 LEFT = 0,
142 RIGHT,
143 MIDDLE
144 };
145
146 /**
147 * @brief collaborator type.
148 */
149 enum CollaboratorType : int32_t {
150 DEFAULT_TYPE = 0,
151 RESERVE_TYPE,
152 OTHERS_TYPE,
153 };
154
155 enum AncoSceneState: int32_t {
156 DEFAULT_STATE = 0,
157 NOTIFY_START,
158 NOTIFY_CREATE,
159 NOTIFY_LOAD,
160 NOTIFY_UPDATE,
161 NOTIFY_FOREGROUND,
162 };
163
164 /**
165 * @brief collaborator type.
166 */
167 enum SessionOperationType : int32_t {
168 TYPE_DEFAULT = 0,
169 TYPE_CLEAR,
170 };
171
172 enum class ManagerState : uint32_t {
173 MANAGER_STATE_SCREEN_LOCKED = 0,
174 };
175
176 /**
177 * @brief Enumerates picture in picture control status.
178 */
179 enum class WsPiPControlStatus : int32_t {
180 PLAY = 1,
181 PAUSE = 0,
182 OPEN = 1,
183 CLOSE = 0,
184 ENABLED = -2,
185 DISABLED = -3,
186 };
187
188 /**
189 * @brief Enumerates picture in picture control type.
190 */
191 enum class WsPiPControlType : uint32_t {
192 VIDEO_PLAY_PAUSE = 0,
193 VIDEO_PREVIOUS = 1,
194 VIDEO_NEXT = 2,
195 FAST_FORWARD = 3,
196 FAST_BACKWARD = 4,
197 HANG_UP_BUTTON = 5,
198 MICROPHONE_SWITCH = 6,
199 CAMERA_SWITCH = 7,
200 MUTE_SWITCH = 8,
201 END,
202 };
203
204 enum class FocusChangeReason {
205 /**
206 * default focus change reason
207 */
208 DEFAULT = 0,
209 /**
210 * focus change for move up
211 */
212 MOVE_UP,
213 /**
214 * focus change for click
215 */
216 CLICK,
217 /**
218 * focus change for foreground
219 */
220 FOREGROUND,
221 /**
222 * focus change for background
223 */
224 BACKGROUND,
225 /**
226 * focus change for split screen.5
227 */
228 SPLIT_SCREEN,
229 /**
230 * focus change for full screen
231 */
232 FULL_SCREEN,
233 /**
234 * focus change for global search
235 */
236 SCB_SESSION_REQUEST,
237 /**
238 * focus change for floating scene
239 */
240 FLOATING_SCENE,
241 /**
242 * focus change for losing focus
243 */
244 SCB_SESSION_REQUEST_UNFOCUS,
245 /**
246 * focus change for client requerst.10
247 */
248 CLIENT_REQUEST,
249 /**
250 * focus change for wind
251 */
252 WIND,
253 /**
254 * focus change for app foreground
255 */
256 APP_FOREGROUND,
257 /**
258 * focus change for app background
259 */
260 APP_BACKGROUND,
261 /**
262 * focus change for recent,Multitasking
263 */
264 RECENT,
265 /**
266 * focus change for inner app.
267 */
268 SCB_START_APP,
269 /**
270 * focus for setting focuable.
271 */
272 FOCUSABLE,
273 /**
274 * select last focused app when requestSessionUnFocus.
275 */
276 LAST_FOCUSED_APP,
277 /**
278 * focus for zOrder pass through VOICE_INTERACTION.
279 */
280 VOICE_INTERACTION,
281 /**
282 * focus change max.
283 */
284 MAX,
285 };
286
287 enum class SceneType : uint8_t {
288 DEFAULT = 0,
289 WINDOW_SCENE,
290 SYSTEM_WINDOW_SCENE,
291 TRANSFORM_SCENE,
292 PANEL_SCENE,
293 INPUT_SCENE,
294 };
295
296 struct SessionInfo {
297 std::string bundleName_ = "";
298 std::string moduleName_ = "";
299 std::string abilityName_ = "";
300 int32_t appIndex_ = 0;
301 bool isSystem_ = false;
302 SceneType sceneType_ = SceneType::WINDOW_SCENE;
303 uint32_t windowType_ = 1; // WINDOW_TYPE_APP_MAIN_WINDOW
304 sptr<IRemoteObject> callerToken_ = nullptr;
305 sptr<IRemoteObject> rootToken_ = nullptr;
306 uint64_t screenId_ = -1ULL; // -1ULL: SCREEN_ID_INVALID
307 bool isPersistentRecover_ = false;
308 bool isFromIcon_ = false;
309
310 mutable std::shared_ptr<AAFwk::Want> want = nullptr; // want for ability start
311 std::shared_ptr<AAFwk::Want> closeAbilityWant = nullptr;
312 std::shared_ptr<AAFwk::AbilityStartSetting> startSetting = nullptr;
313 std::shared_ptr<AAFwk::ProcessOptions> processOptions = nullptr;
314 std::shared_ptr<AAFwk::StartWindowOption> startWindowOption = nullptr;
315 mutable std::shared_ptr<AppExecFwk::AbilityInfo> abilityInfo = nullptr;
316 int32_t resultCode = -1;
317 int32_t requestCode = -1;
318 int32_t errorCode = -1;
319 std::string errorReason = "";
320 int32_t persistentId_ = INVALID_SESSION_ID;
321 int32_t callerPersistentId_ = INVALID_SESSION_ID;
322 std::string callerBundleName_ = "";
323 std::string callerAbilityName_ = "";
324 uint32_t callState_ = 0;
325 uint32_t callingTokenId_ = 0;
326 bool reuse = false;
327 int32_t windowMode = 0;
328 StartMethod startMethod = StartMethod::START_NORMAL;
329 bool lockedState = false;
330 std::string time = "";
331 ContinueState continueState = ContinueState::CONTINUESTATE_ACTIVE;
332 int64_t uiAbilityId_ = 0;
333 int32_t ancoSceneState = 0;
334 bool isClearSession = false;
335 std::string sessionAffinity = "";
336 int32_t collaboratorType_ = CollaboratorType::DEFAULT_TYPE;
337 SessionState sessionState_ = SessionState::STATE_DISCONNECT;
338 uint32_t requestOrientation_ = 0;
339 bool isRotable_ = false;
340 bool isSetPointerAreas_ = false;
341 bool isCastSession_ = false;
342 uint32_t windowInputType_ = 0;
343 std::string continueSessionId_ = "";
344 bool isCalledRightlyByCallerId_ = false;
345 bool fullScreenStart_ = false;
346 bool isAtomicService_ = false;
347 bool isBackTransition_ = false;
348 bool needClearInNotShowRecent_ = false;
349 int32_t specifiedId = 0;
350
351 /*
352 * App Use Control
353 */
354 bool isUseControlSession = false; // Indicates whether the session is used for controlling a main session.
355
356 /*
357 * UIExtension
358 */
359 int32_t realParentId_ = INVALID_SESSION_ID;
360 uint32_t uiExtensionUsage_ = 0;
361 bool isAsyncModalBinding_ = false;
362 uint32_t parentWindowType_ = 1; // WINDOW_TYPE_APP_MAIN_WINDOW
363
364 /**
365 * PC Window
366 */
367 std::vector<AppExecFwk::SupportWindowMode> supportedWindowModes;
368 };
369
370 enum class SessionFlag : uint32_t {
371 SESSION_FLAG_NEED_AVOID = 1,
372 SESSION_FLAG_PARENT_LIMIT = 1 << 1,
373 SESSION_FLAG_SHOW_WHEN_LOCKED = 1 << 2,
374 SESSION_FLAG_FORBID_SPLIT_MOVE = 1 << 3,
375 SESSION_FLAG_WATER_MARK = 1 << 4,
376 SESSION_FLAG_END = 1 << 5,
377 };
378
379 enum class SizeChangeReason : uint32_t {
380 UNDEFINED = 0,
381 MAXIMIZE,
382 RECOVER,
383 ROTATION,
384 DRAG,
385 DRAG_START,
386 DRAG_END,
387 RESIZE,
388 MOVE,
389 HIDE,
390 TRANSFORM,
391 CUSTOM_ANIMATION_SHOW,
392 FULL_TO_SPLIT,
393 SPLIT_TO_FULL,
394 FULL_TO_FLOATING,
395 FLOATING_TO_FULL,
396 PIP_START,
397 PIP_SHOW,
398 PIP_AUTO_START,
399 PIP_RATIO_CHANGE,
400 PIP_RESTORE,
401 UPDATE_DPI_SYNC,
402 DRAG_MOVE,
403 AVOID_AREA_CHANGE,
404 END,
405 };
406
IsMoveToOrDragMove(SizeChangeReason reason)407 inline bool IsMoveToOrDragMove(SizeChangeReason reason)
408 {
409 return reason == SizeChangeReason::MOVE || reason == SizeChangeReason::DRAG_MOVE;
410 }
411
412 enum class SessionEvent : uint32_t {
413 EVENT_MAXIMIZE = 100,
414 EVENT_RECOVER,
415 EVENT_MINIMIZE,
416 EVENT_CLOSE,
417 EVENT_START_MOVE,
418 EVENT_END_MOVE,
419 EVENT_MAXIMIZE_FLOATING,
420 EVENT_TERMINATE,
421 EVENT_EXCEPTION,
422 EVENT_SPLIT_PRIMARY,
423 EVENT_SPLIT_SECONDARY,
424 EVENT_DRAG_START,
425 EVENT_DRAG,
426 };
427
428 enum class BrokerStates: uint32_t {
429 BROKER_UNKOWN = 1,
430 BROKER_STARTED = 0,
431 BROKER_NOT_START = -1,
432 };
433
GreatOrEqual(double left,double right)434 inline bool GreatOrEqual(double left, double right)
435 {
436 constexpr double epsilon = -0.00001f;
437 return (left - right) > epsilon;
438 }
439
LessOrEqual(double left,double right)440 inline bool LessOrEqual(double left, double right)
441 {
442 constexpr double epsilon = 0.00001f;
443 return (left - right) < epsilon;
444 }
445
NearEqual(const double left,const double right,const double epsilon)446 inline bool NearEqual(const double left, const double right, const double epsilon)
447 {
448 return (std::fabs(left - right) <= epsilon);
449 }
450
NearEqual(const float & left,const float & right)451 inline bool NearEqual(const float& left, const float& right)
452 {
453 constexpr double epsilon = 0.001f;
454 return NearEqual(left, right, epsilon);
455 }
456
NearEqual(const int32_t & left,const int32_t & right)457 inline bool NearEqual(const int32_t& left, const int32_t& right)
458 {
459 return left == right;
460 }
461
NearZero(const double left)462 inline bool NearZero(const double left)
463 {
464 constexpr double epsilon = 0.001f;
465 return NearEqual(left, 0.0, epsilon);
466 }
467
468 template<typename T>
469 struct WSRectT {
470 T posX_ = 0;
471 T posY_ = 0;
472 T width_ = 0;
473 T height_ = 0;
474
475 bool operator==(const WSRectT<T>& a) const
476 {
477 return (NearEqual(posX_, a.posX_) && NearEqual(posY_, a.posY_) &&
478 NearEqual(width_, a.width_) && NearEqual(height_, a.height_));
479 }
480
481 bool operator!=(const WSRectT<T>& a) const
482 {
483 return !this->operator==(a);
484 }
485
IsEmptyWSRectT486 bool IsEmpty() const
487 {
488 if (NearZero(posX_) && NearZero(posY_) && NearZero(width_) && NearZero(height_)) {
489 return true;
490 }
491 return false;
492 }
493
IsInRegionWSRectT494 inline bool IsInRegion(int32_t pointX, int32_t pointY)
495 {
496 return GreatOrEqual(pointX, posX_) && LessOrEqual(pointX, posX_ + width_) &&
497 GreatOrEqual(pointY, posY_) && LessOrEqual(pointY, posY_ + height_);
498 }
499
IsInvalidWSRectT500 inline bool IsInvalid() const
501 {
502 return IsEmpty() || LessOrEqual(width_, 0) || LessOrEqual(height_, 0);
503 }
504
ToStringWSRectT505 inline std::string ToString() const
506 {
507 constexpr int precision = 2;
508 std::stringstream ss;
509 ss << "[" << std::fixed << std::setprecision(precision) << posX_ << " " << posY_ << " " <<
510 width_ << " " << height_ << "]";
511 return ss.str();
512 }
513 };
514
515 using WSRect = WSRectT<int32_t>;
516 using WSRectF = WSRectT<float>;
517
518 struct WindowShadowConfig {
519 float offsetX_ = 0.0f;
520 float offsetY_ = 0.0f;
521 float alpha_ = 0.0f;
522 float radius_ = 0.0f;
523 std::string color_ = "#000000";
524 };
525
526 struct KeyboardSceneAnimationConfig {
527 std::string curveType_ = "default";
528 float ctrlX1_ = 0.2f;
529 float ctrlY1_ = 0.0f;
530 float ctrlX2_ = 0.2f;
531 float ctrlY2_ = 1.0f;
532 uint32_t duration_ = 150;
533 };
534
535 struct WindowAnimationConfig {
536 int32_t duration_ = 0;
537 std::string curveType_ = "easeOut";
538 float ctrlX1_ = 0.2f;
539 float ctrlY1_ = 0.0f;
540 float ctrlX2_ = 0.2f;
541 float ctrlY2_ = 1.0f;
542 float scaleX_ = 0.0f;
543 float scaleY_ = 0.0f;
544 float rotationX_ = 0.0f;
545 float rotationY_ = 0.0f;
546 float rotationZ_ = 0.0f;
547 int32_t angle_ = 0;
548 float translateX_ = 0.0f;
549 float translateY_ = 0.0f;
550 float opacity_ = 0;
551 };
552
553 struct StartingWindowInfo {
554 int32_t startingWindowBackgroundId_;
555 int32_t startingWindowIconId_;
556 uint32_t startingWindowBackgroundColor_;
557 std::string startingWindowIconPath_;
558 };
559
560 struct StartingWindowAnimationConfig {
561 bool enabled_ = true;
562 int duration_ = 200;
563 std::string curve_ = "linear";
564 float opacityStart_ = 1;
565 float opacityEnd_ = 0;
566 };
567
568 struct SystemUIStatusBarConfig {
569 bool showInLandscapeMode_ = false;
570 std::string immersiveStatusBarBgColor_ = "#4c000000";
571 std::string immersiveStatusBarContentColor_ = "#ffffff";
572 };
573
574 struct StatusBarConfig {
575 bool showHide_ = false;
576 std::string contentColor_;
577 std::string backgroundColor_;
578 };
579
580 struct WindowImmersive {
581 StatusBarConfig desktopStatusBarConfig_;
582 StatusBarConfig leftRightStatusBarConfig_;
583 StatusBarConfig upDownStatusBarConfig_;
584 };
585
586 struct AppWindowSceneConfig {
587 float floatCornerRadius_ = 0.0f;
588 std::string uiType_ = UI_TYPE_PHONE;
589 bool backgroundScreenLock_ = false;
590 std::string rotationMode_ = "windowRotation";
591 WindowShadowConfig focusedShadow_;
592 WindowShadowConfig unfocusedShadow_;
593 KeyboardSceneAnimationConfig keyboardAnimationIn_;
594 KeyboardSceneAnimationConfig keyboardAnimationOut_;
595 WindowAnimationConfig windowAnimation_;
596 StartingWindowAnimationConfig startingWindowAnimationConfig_;
597 SystemUIStatusBarConfig systemUIStatusBarConfig_;
598 WindowImmersive windowImmersive_;
599 };
600
601 struct DeviceScreenConfig {
602 std::string rotationPolicy_ = "11"; // default use phone policy
603 std::string defaultRotationPolicy_ = "1"; // default unspecified policy
604 bool isRightPowerButton_ = true;
605 };
606
607 struct SceneAnimationConfig {
608 std::shared_ptr<RSTransaction> rsTransaction_ = nullptr;
609 int32_t animationDuration_ = ROTATE_ANIMATION_DURATION;
610 };
611
612 struct RotateAnimationConfig {
613 int32_t duration_ = ROTATE_ANIMATION_DURATION;
614 };
615
616
617 struct SessionEventParam {
618 int32_t pointerX_ = 0;
619 int32_t pointerY_ = 0;
620 int32_t sessionWidth_ = 0;
621 int32_t sessionHeight_ = 0;
622 uint32_t dragResizeType = 0;
623 };
624
625 /**
626 * @brief Enumerates session gravity.
627 */
628 enum class SessionGravity : uint32_t {
629 SESSION_GRAVITY_FLOAT = 0,
630 SESSION_GRAVITY_BOTTOM,
631 SESSION_GRAVITY_DEFAULT,
632 };
633
634 /**
635 * @brief TerminateType session terminate type.
636 */
637 enum class TerminateType : uint32_t {
638 CLOSE_AND_KEEP_MULTITASK = 0,
639 CLOSE_AND_CLEAR_MULTITASK,
640 CLOSE_AND_START_CALLER,
641 CLOSE_BY_EXCEPTION,
642 };
643
644 /**
645 * @brief System animaged scene type.
646 */
647 enum class SystemAnimatedSceneType : uint32_t {
648 SCENE_ENTER_MISSION_CENTER, // Enter the mission center
649 SCENE_EXIT_MISSION_CENTER, // Exit the mission center
650 SCENE_ENTER_TFS_WINDOW, // Three-finger sliding window recovery
651 SCENE_EXIT_TFU_WINDOW, // The three-finger up window disappears
652 SCENE_ENTER_WINDOW_FULL_SCREEN, // Enter the window full screen
653 SCENE_EXIT_WINDOW_FULL_SCREEN, // Exit the window full screen
654 SCENE_ENTER_MAX_WINDOW, // Enter the window maximization state
655 SCENE_EXIT_MAX_WINDOW, // Exit the window maximization state
656 SCENE_ENTER_SPLIT_SCREEN, // Enter the split screen
657 SCENE_EXIT_SPLIT_SCREEN, // Exit the split screen
658 SCENE_ENTER_APP_CENTER, // Enter the app center
659 SCENE_EXIT_APP_CENTER, // Exit the app center
660 SCENE_APPEAR_MISSION_CENTER, // A special case scenario that displays the mission center
661 SCENE_ENTER_WIND_CLEAR, // Enter win+D in clear screen mode
662 SCENE_ENTER_WIND_RECOVER, // Enter win+D in recover mode
663 SCENE_ENTER_RECENTS, // Enter recents
664 SCENE_EXIT_RECENTS, // Exit recent.
665 SCENE_OTHERS, // 1.Default state 2.The state in which the animation ends
666 };
667
668 /**
669 * @brief Session UI parameters
670 */
671 struct SessionUIParam {
672 bool interactive_ { true };
673 WSRect rect_;
674 float scaleX_ { 1.0f };
675 float scaleY_ { 1.0f };
676 float pivotX_ { 1.0f };
677 float pivotY_ { 1.0f };
678 float transX_ { 0.0f }; // global translateX
679 float transY_ { 0.0f }; // global translateY
680 uint32_t zOrder_ { 0 };
681 std::string sessionName_;
682 bool needSync_ { true };
683 };
684
685 enum class SessionUIDirtyFlag {
686 NONE = 0,
687 VISIBLE = 1,
688 INTERACTIVE = 1 << 1,
689 RECT = 1 << 2,
690 SCALE = 1 << 3,
691 TOUCH_HOT_AREA = 1 << 4,
692 Z_ORDER = 1 << 5,
693 AVOID_AREA = 1 << 6,
694 GLOBAL_RECT = 1 << 8,
695 };
696
697 /**
698 * @brief State for post-process focus
699 */
700 struct PostProcessFocusState {
701 bool enabled_ { false };
702 bool isFocused_ { false };
703 FocusChangeReason reason_ { FocusChangeReason::DEFAULT };
704
ResetPostProcessFocusState705 void Reset()
706 {
707 enabled_ = false;
708 isFocused_ = false;
709 reason_ = FocusChangeReason::DEFAULT;
710 }
711 };
712 } // namespace OHOS::Rosen
713 #endif // OHOS_ROSEN_WINDOW_SCENE_WS_COMMON_H
714