Enums
NOTE
The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
For the system capability SystemCapability.Window.SessionManager, use canIUse() to check whether the device supports this system capability and the corresponding APIs.
WindowType7+
Enumerates the window types.
System capability: SystemCapability.WindowManager.WindowManager.Core
| Name | Value | Description |
|---|---|---|
| TYPE_APP | 0 | Child window of an application. Model restriction: This API can be used only in the FA model. |
| TYPE_SYSTEM_ALERT(deprecated) | 1 | System alert window. Note: This API has been deprecated since API version 11, and was supported since API version 7. |
| TYPE_FLOAT9+ | 8 | Global floating window. Model restriction: This API can be used only in the stage model. Atomic service API: This API can be used in atomic services since API version 12. |
| TYPE_DIALOG10+ | 16 | Modal window. Model restriction: This API can be used only in the stage model. Atomic service API: This API can be used in atomic services since API version 12. |
| TYPE_MAIN18+ | 32 | Main window of an application. This window type cannot be used during window creation. |
AvoidAreaType7+
Enumerates the types of areas to avoid for window content.
When adapting window content for an immersive layout, you should adjust the content based on the corresponding AvoidArea specified by AvoidAreaType.
| Name | Value | Description |
|---|---|---|
| TYPE_SYSTEM | 0 | Default area of the system. It contains the status bar and three-button navigation bar. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 11. |
| TYPE_CUTOUT | 1 | Cutout area. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 11. |
| TYPE_SYSTEM_GESTURE9+ | 2 | Side return gesture area. Currently, no devices support this type of avoid area. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 11. |
| TYPE_KEYBOARD9+ | 3 | Fixed soft keyboard area. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 11. |
| TYPE_NAVIGATION_INDICATOR11+ | 4 | Bottom navigation bar. OpenHarmony devices do not support this capability. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 11. |
| TYPE_FLOAT_NAVIGATION | 5 | Three-button navigation bar. OpenHarmony devices do not support this capability. System capability: SystemCapability.Window.SessionManager Since: 26.0.0 Model restriction: This API can be used only in the stage model. Atomic service API: This API can be used in atomic services since API version 26.0.0. |
Orientation9+
Enumerates the window orientations. For details of the differences between different enumerated values, see What is the difference between orientation values 8 to 10 or 12 and values 13 to 16 (API version 9).
| Name | Value | Description |
|---|---|---|
| UNSPECIFIED | 0 | Unspecified. The orientation is determined by the system. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.WindowManager.WindowManager.Core |
| PORTRAIT | 1 | Portrait. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 11. |
| LANDSCAPE | 2 | Landscape. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.WindowManager.WindowManager.Core |
| PORTRAIT_INVERTED | 3 | Reverse portrait. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 12. |
| LANDSCAPE_INVERTED | 4 | Reverse landscape. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 12. |
| AUTO_ROTATION | 5 | Automatically rotates with the sensor to four orientations: portrait, landscape, reverse portrait, and reverse landscape. This rotation is not controlled by the rotation switch in Control Panel. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 11. |
| AUTO_ROTATION_PORTRAIT | 6 | Automatically rotates with the sensor to two orientations: portrait and reverse portrait. This rotation is not controlled by the rotation switch in Control Panel. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.WindowManager.WindowManager.Core |
| AUTO_ROTATION_LANDSCAPE | 7 | Automatically rotates with the sensor to two orientations: landscape and reverse landscape. This rotation is not controlled by the rotation switch in Control Panel. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 12. |
| AUTO_ROTATION_RESTRICTED | 8 | Automatically rotates with the sensor to four orientations: portrait, landscape, reverse portrait, and reverse landscape. This rotation is controlled by the rotation switch in Control Panel. System capability: SystemCapability.WindowManager.WindowManager.Core Atomic service API: This API can be used in atomic services since API version 12. |
| AUTO_ROTATION_PORTRAIT_RESTRICTED | 9 | Automatically rotates with the sensor to two orientations: portrait and reverse portrait. This rotation is controlled by the rotation switch in Control Panel. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.WindowManager.WindowManager.Core |
| AUTO_ROTATION_LANDSCAPE_RESTRICTED | 10 | Automatically rotates with the sensor to two orientations: landscape and reverse landscape. This rotation is controlled by the rotation switch in Control Panel. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.WindowManager.WindowManager.Core |
| LOCKED | 11 | Locked mode, where the window orientation is consistent with the current screen orientation. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.WindowManager.WindowManager.Core |
| AUTO_ROTATION_UNSPECIFIED12+ | 12 | Automatically rotates with the sensor, under the restriction of the rotation switch in Control Panel. The orientation that can be rotated to is determined by the system. For example, the window can rotate to portrait, landscape, or reverse landscape, but not reverse portrait, on a certain device. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.Window.SessionManager |
| USER_ROTATION_PORTRAIT12+ | 13 | Temporarily rotates to portrait mode, and then automatically rotates with the sensor, under the restriction of the rotation switch in Control Panel. The orientation that can be rotated to is determined by the system. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.Window.SessionManager |
| USER_ROTATION_LANDSCAPE12+ | 14 | Temporarily rotates to landscape mode, and then automatically rotates with the sensor, under the restriction of the rotation switch in Control Panel. The orientation that can be rotated to is determined by the system. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.Window.SessionManager |
| USER_ROTATION_PORTRAIT_INVERTED12+ | 15 | Temporarily rotates to reverse portrait mode, and then automatically rotates with the sensor, under the restriction of the rotation switch in Control Panel. The orientation that can be rotated to is determined by the system. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.Window.SessionManager |
| USER_ROTATION_LANDSCAPE_INVERTED12+ | 16 | Temporarily rotates to reverse landscape mode, and then automatically rotates with the sensor, under the restriction of the rotation switch in Control Panel. The orientation that can be rotated to is determined by the system. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.Window.SessionManager |
| FOLLOW_DESKTOP12+ | 17 | Follows the orientation of the home screen, where the window will rotate if the home screen rotates and will not rotate if the home screen does not. Atomic service API: This API can be used in atomic services since API version 12. System capability: SystemCapability.Window.SessionManager |
RectChangeReason12+
Enumerates the reasons for window rectangle (position and size) changes.
System capability: SystemCapability.Window.SessionManager
Atomic service API: This API can be used in atomic services since API version 12.
| Name | Value | Description |
|---|---|---|
| UNDEFINED | 0 | Default value. |
| MAXIMIZE | 1 | The window is maximized. |
| RECOVER | 2 | The window is restored to the previous state. |
| MOVE | 3 | The window is moved. |
| DRAG | 4 | The window is zoomed in or out by dragging. |
| DRAG_START | 5 | The window starts zooming in or out. |
| DRAG_END | 6 | The window finishes zooming in or out. |
ColorSpace8+
Enumerates the color spaces.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.WindowManager.WindowManager.Core
| Name | Value | Description |
|---|---|---|
| DEFAULT | 0 | Default SRGB gamut. |
| WIDE_GAMUT | 1 | Wide-gamut. |
WindowEventType10+
Enumerates the window lifecycle states.
Atomic service API: This API can be used in atomic services since API version 11.
| Name | Value | Description |
|---|---|---|
| WINDOW_SHOWN | 1 | The window is running in the foreground. System capability: SystemCapability.WindowManager.WindowManager.Core |
| WINDOW_ACTIVE | 2 | The window gains focus. System capability: SystemCapability.WindowManager.WindowManager.Core |
| WINDOW_INACTIVE | 3 | The window loses focus. System capability: SystemCapability.WindowManager.WindowManager.Core |
| WINDOW_HIDDEN | 4 | The window is running in the background. System capability: SystemCapability.WindowManager.WindowManager.Core |
| WINDOW_DESTROYED11+ | 7 | The window is destroyed. System capability: SystemCapability.Window.SessionManager |
WindowStatusType11+
Enumerates the window modes.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| UNDEFINED | 0 | The window mode is not defined by the application. |
| FULL_SCREEN | 1 | The application is displayed in full screen. In freeform window state, the window occupies the entire screen with no dock, title bar, or status bar displayed by default. You can use maximize() and setTitleAndDockHoverShown() to configure whether to display the title bar and dock upon hovering over the hot zone. The last call takes precedence when both the maximize() and setTitleAndDockHoverShown() APIs are called. In non-freeform window state, the window occupies the entire screen with no title bar or dock displayed. You can use setSpecificSystemBarEnabled() to configure whether to display the status bar. |
| MAXIMIZE | 2 | The application window is maximized. In freeform window state, the window occupies the entire screen, and the dock, status bar, and title bar are displayed without requiring a hover. This state is unavailable in non-freeform window state. |
| MINIMIZE | 3 | The application window is minimized. |
| FLOATING | 4 | The application is displayed in a floating window. |
| SPLIT_SCREEN | 5 | The application is displayed in split-screen mode. |
PixelUnit22+
Enumerates the pixel units.
You can use px2vp and vp2px to convert between physical pixels and virtual pixels.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| PX | 0 | Physical pixel unit (px). |
| VP | 1 | Virtual pixel unit (vp). |
MaximizePresentation12+
Enumerates the layout when the window is maximized.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| FOLLOW_APP_IMMERSIVE_SETTING | 0 | The window, when maximized, follows the application's full-screen mode. Atomic service API: This API can be used in atomic services since API version 12. |
| EXIT_IMMERSIVE | 1 | The window, when maximized, exits full-screen mode if it is set to full-screen. Atomic service API: This API can be used in atomic services since API version 12. |
| ENTER_IMMERSIVE | 2 | The window, when maximized, transitions into the full-screen mode, and the window title bar and dock bar are displayed when the cursor hovers over the hot zone. Atomic service API: This API can be used in atomic services since API version 12. |
| ENTER_IMMERSIVE_DISABLE_TITLE_AND_DOCK_HOVER14+ | 3 | The window, when maximized, transitions into the full-screen mode, and the window title bar and dock bar are not displayed when the cursor hovers over the hot zone. Atomic service API: This API can be used in atomic services since API version 14. |
WindowAnimationCurve20+
Enumerates the types of window animation curves.
Atomic service API: This API can be used in atomic services since API version 20.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| LINEAR | 0 | The animation speed is constant from start to finish. When this curve type is used, duration in WindowAnimationConfig is mandatory. When this curve type is used, param in WindowAnimationConfig is optional and does not take effect. |
| INTERPOLATION_SPRING | 1 | Interpolator spring curve, an animation curve from 0 to 1, where the actual animation values are interpolated based on the curve. The animation duration is subject to the curve parameters, rather than the duration parameter in WindowAnimationConfig. When this curve type is used, duration in WindowAnimationConfig is optional and does not take effect. When this curve type is used, param in WindowAnimationConfig is mandatory. |
| CUBIC_BEZIER | 2 | Cubic Bézier curve. When this curve type is used, param and duration in WindowAnimationConfig are mandatory. |
WindowTransitionType20+
Enumerates the types of window transition animations.
Atomic service API: This API can be used in atomic services since API version 20.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| DESTROY | 0 | Transition animation when the window is destroyed. |
AnimationType20+
Enumerates the types of window animations.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| FADE_IN_OUT | 0 | Fade-in/fade-out animation. The fade-in animation takes effect during window display, and the fade-out animation takes effect during window hiding. |
WindowAnchor20+
Enumerates the window anchor points.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| TOP_START | 0 | Top-left corner of the window. |
| TOP | 1 | Horizontal center point along the top edge of the window. |
| TOP_END | 2 | Top-right corner of the window. |
| START | 3 | Vertical center point along the left edge of the window. |
| CENTER | 4 | Center point of the window, both horizontally and vertically. |
| END | 5 | Vertical center point along the right edge of the window. |
| BOTTOM_START | 6 | Bottom-left corner of the window. |
| BOTTOM | 7 | Horizontal center point along the bottom edge of the window. |
| BOTTOM_END | 8 | Bottom-right corner of the window. |
RotationChangeType19+
Enumerates the types of window rotation events.
Atomic service API: This API can be used in atomic services since API version 19.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| WINDOW_WILL_ROTATE | 0 | The window is about to rotate. |
| WINDOW_DID_ROTATE | 1 | The window has finished rotating. |
RectType19+
Enumerates the types of window rectangle coordinate systems.
Atomic service API: This API can be used in atomic services since API version 19.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| RELATIVE_TO_SCREEN | 0 | The window rectangle is relative to the screen coordinate system. |
| RELATIVE_TO_PARENT_WINDOW | 1 | The window rectangle is relative to the parent window coordinate system. |
GlobalWindowMode20+
Enumerates the window modes.
Atomic service API: This API can be used in atomic services since API version 20.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| FULLSCREEN | 1 | Full-screen window. The first binary bit from right to left is 1. |
| SPLIT | 1 << 1 | Split-screen window. The second binary bit from right to left is 1. |
| FLOAT | 1 << 2 | Floating window. The third binary bit from right to left is 1. |
| PIP | 1 << 3 | PiP window. The fourth binary bit from right to left is 1. |
OcclusionState22+
Enumerates the window visibility states.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| NO_OCCLUSION | 0 | The window is entirely visible, with no parts obscured by other non-transparent windows. |
| PARTIAL_OCCLUSION | 1 | The window is partially visible, with some parts obscured by other non-transparent windows. |
| FULL_OCCLUSION | 2 | The window is completely invisible, either fully obscured by other non-transparent windows, minimized, or hidden. |
WindowStageEventType9+
Enumerates the lifecycle event types of a WindowStage.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.WindowManager.WindowManager.Core
Atomic service API: This API can be used in atomic services since API version 11.
| Name | Value | Description |
|---|---|---|
| SHOWN | 1 | The WindowStage is shown in the foreground, for example, when launching from the application icon, triggered whether it is the first launch or resuming from the background. |
| ACTIVE | 2 | The WindowStage gains focus, for example, the state of the application window after handling a click event, or the state after the application is launched. |
| INACTIVE | 3 | The WindowStage loses focus, for example, the state of the window that was in focus when a new application is opened or another window is clicked. |
| HIDDEN | 4 | The WindowStage is running in the background, for example, when the application exists after swiping up or the application window is closed. |
| RESUMED11+ | 5 | The WindowStage is in the foreground and interactive, for example, when the application is open and can interact with the user. |
| PAUSED11+ | 6 | The WindowStage is in the foreground but not interactive, for example, when the application is in the foreground and is entering the multitasking screen. |
WindowStageLifecycleEventType20+
Enumerates the lifecycle state types of a WindowStage.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| SHOWN | 1 | The WindowStage is shown in the foreground, for example, when launching from the application icon, triggered whether it is the first launch or resuming from the background. |
| RESUMED | 2 | The WindowStage is in the foreground and interactive, for example, when the application is open and can interact with the user. |
| PAUSED | 3 | The WindowStage is in the foreground but not interactive, for example, when the application is in the foreground and is entering the multitasking screen. |
| HIDDEN | 4 | The WindowStage is running in the background, for example, when the application exists after swiping up or the application window is closed. |
ModalityType14+
Enumerates the modality types of the child window.
System capability: SystemCapability.Window.SessionManager
Atomic service API: This API can be used in atomic services since API version 14.
| Name | Value | Description |
|---|---|---|
| WINDOW_MODALITY | 0 | Select this value when only the parent window should not respond to user operations. |
| APPLICATION_MODALITY | 1 | Select this value when other instances of the application should also not respond to user operations. Device behavior differences: This enumeration can be called properly on a device that supports freeform windows and is in the freeform window state. If the device does not support freeform windows, or if the device supports freeform windows but is not in the freeform window state, error code 801 is returned. |
ScreenshotEventType20+
Enumerates the screenshot event types.
System capability: SystemCapability.WindowManager.WindowManager.Core
| Name | Value | Description |
|---|---|---|
| SYSTEM_SCREENSHOT | 0 | System screenshot succeeds. |
| SYSTEM_SCREENSHOT_ABORT | 1 | System screenshot aborted. |
| SCROLL_SHOT_START | 2 | Scroll screenshot starts. |
| SCROLL_SHOT_END | 3 | Scroll screenshot ends. |
| SCROLL_SHOT_ABORT | 4 | Scroll screenshot aborted. |
OrientationExecutionResult
Enumerates the result of setting the window display orientation.
Since: 26.0.0
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 26.0.0.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| ORIENTATION_APPLIED | 0 | The setting has taken effect. |
| ORIENTATION_IGNORED | 1 | The setting does not take effect. |
| ORIENTATION_PENDING | 2 | The setting will take effect after the system animation ends. |
RotationInfoType23+
Enumerates the types of rotation information.
System capability: SystemCapability.Window.SessionManager
| Name | Value | Description |
|---|---|---|
| WINDOW_ORIENTATION | 0 | Window's screen orientation, based on how the Window module defines landscape/portrait modes. Note that it maps to the orientation parameter in RotationChangeInfo. |
| DISPLAY_ORIENTATION | 1 | Physical screen orientation, based on how the Display module defines landscape/portrait modes. It maps to the orientation property of the display object. |
| DISPLAY_ROTATION | 2 | Physical rotation angle of the device's screen (in degrees, clockwise). It maps to the rotation property of the display object. |