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