• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.window (Window)
2
3The **Window** module provides basic window management capabilities, such as creating and destroying the current window, setting properties for the current window, and managing and scheduling windows.
4
5This module provides the following common window-related functions:
6
7- [Window](#window): the current window instance, which is the basic unit managed by the window manager.
8- [WindowStage](#windowstage9): window manager that manages windows.
9
10> **NOTE**
11>
12> 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.
13
14## Modules to Import
15
16```js
17import window from '@ohos.window';
18```
19
20## WindowType<sup>7+</sup>
21
22Enumerates the window types.
23
24**System capability**: SystemCapability.WindowManager.WindowManager.Core
25
26| Name             | Value| Description              |
27| ----------------- | ------ | ------------------ |
28| TYPE_APP          | 0      | Application subwindow.<br>**Model restriction**: This API can be used only in the FA model.|
29| TYPE_SYSTEM_ALERT | 1      | System alert window.|
30| TYPE_INPUT_METHOD<sup>9+</sup> | 2      | Input method window.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
31| TYPE_STATUS_BAR<sup>9+</sup>   | 3      | Status bar.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
32| TYPE_PANEL<sup>9+</sup>        | 4      | Notification panel.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
33| TYPE_KEYGUARD<sup>9+</sup>     | 5      | Lock screen.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
34| TYPE_VOLUME_OVERLAY<sup>9+</sup> | 6      | Volume bar.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
35| TYPE_NAVIGATION_BAR<sup>9+</sup> | 7      | Navigation bar.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
36| TYPE_FLOAT<sup>9+</sup> | 8      | Floating window.<br>**Model restriction**: This API can be used only in the stage model.<br>**Required permissions**: ohos.permission.SYSTEM_FLOAT_WINDOW|
37| TYPE_WALLPAPER<sup>9+</sup> | 9      | Wallpaper.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
38| TYPE_DESKTOP<sup>9+</sup> | 10      | Home screen.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
39| TYPE_LAUNCHER_RECENT<sup>9+</sup> | 11      | Recent tasks screen.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
40| TYPE_LAUNCHER_DOCK<sup>9+</sup> | 12      | Dock bar on the home screen.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
41| TYPE_VOICE_INTERACTION<sup>9+</sup> | 13      | Voice assistant.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
42| TYPE_POINTER<sup>9+</sup> | 14      | Mouse.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
43| TYPE_FLOAT_CAMERA<sup>9+</sup> | 15      | Floating camera window.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
44| TYPE_DIALOG<sup>9+</sup>  | 16      | Modal window.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
45| TYPE_SCREENSHOT<sup>9+</sup>  | 17      | Screenshot window.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.|
46
47## Configuration<sup>9+</sup>
48
49Defines the parameters for creating a subwindow or system window.
50
51**System capability**: SystemCapability.WindowManager.WindowManager.Core
52
53| Name| Type| Mandatory| Description|
54| ---------- | -------------------------- | -- | ----------------------------------- |
55| name       | string                     | Yes| Name of the window.                        |
56| windowType | [WindowType](#windowtype7) | Yes| Type of the window.                        |
57| ctx        | [BaseContext](js-apis-inner-application-baseContext.md) | No| Current application context. If this parameter is not set, no context is used.<br>You do not need to set this parameter to create a subwindow in the FA model or a system window in the stage model.|
58| displayId  | number                     | No| ID of the current physical screen. If this parameter is not set, the default value **-1** is used.|
59| parentId   | number                     | No| ID of the parent window. If this parameter is not set, the default value **-1** is used.     |
60
61## AvoidAreaType<sup>7+</sup>
62
63Enumerates the types of the area where the window cannot be displayed.
64
65**System capability**: SystemCapability.WindowManager.WindowManager.Core
66
67| Name                            | Value  | Description                                                        |
68| -------------------------------- | ---- | ------------------------------------------------------------ |
69| TYPE_SYSTEM                      | 0    | Default area of the system. Generally, the status bar and navigation bar are included. The default area may vary according to the device in use.|
70| TYPE_CUTOUT                      | 1    | Notch.                                            |
71| TYPE_SYSTEM_GESTURE<sup>9+</sup> | 2    | Gesture area.                                              |
72| TYPE_KEYBOARD<sup>9+</sup>       | 3    | Soft keyboard area.                                            |
73
74## WindowMode<sup>7+</sup>
75
76Enumerates the window modes.
77
78**System API**: This is a system API.
79
80**System capability**: SystemCapability.WindowManager.WindowManager.Core
81
82| Name      | Value  | Description                         |
83| ---------- | ---- | ----------------------------- |
84| UNDEFINED  | 1    | The window mode is not defined by the application.      |
85| FULLSCREEN | 2    | The application is displayed in full screen.            |
86| PRIMARY    | 3    | The application is displayed in the primary window in split-screen mode.  |
87| SECONDARY  | 4    | The application is displayed in the secondary window in split-screen mode.  |
88| FLOATING   | 5    | The application is displayed in a floating window.|
89
90## WindowLayoutMode<sup>9+</sup>
91
92Enumerates the window layout modes.
93
94**System API**: This is a system API.
95
96**System capability**: SystemCapability.WindowManager.WindowManager.Core
97
98| Name      | Value  | Description                         |
99| ---------- | ---- | ----------------------------- |
100| WINDOW_LAYOUT_MODE_CASCADE  | 0    | Cascade mode.      |
101| WINDOW_LAYOUT_MODE_TILE | 1    | Tile mode.            |
102
103## SystemBarProperties
104
105Describes the properties of the status bar and navigation bar.
106
107**System capability**: SystemCapability.WindowManager.WindowManager.Core
108
109| Name                                  | Type|  Mandatory| Description                                                        |
110| -------------------------------------- | -------- | ---- | ------------------------------------------------------------ |
111| statusBarColor                         | string   |  No  | Background color of the status bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**. |
112| isStatusBarLightIcon<sup>7+</sup>      | boolean  |  No  | Whether any icon on the status bar is highlighted. The value **true** means that the icon is highlighted, and **false** means the opposite. The default value is **false**.|
113| statusBarContentColor<sup>8+</sup>     | string   |  No  | Color of the text on the status bar. After this property is set, the setting of **isStatusBarLightIcon** is invalid. The default value is **0xE5FFFFFF**.|
114| navigationBarColor                     | string   |  No  | Background color of the navigation bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**. |
115| isNavigationBarLightIcon<sup>7+</sup>  | boolean  |  No  | Whether any icon on the navigation bar is highlighted. The value **true** means that the icon is highlighted, and **false** means the opposite. The default value is **false**.|
116| navigationBarContentColor<sup>8+</sup> | string   |  No  | Color of the text on the navigation bar. After this property is set, the setting of **isNavigationBarLightIcon** is invalid. The default value is **0xE5FFFFFF**.|
117
118## Orientation<sup>9+</sup>
119
120Enumerates the window orientations.
121
122**System capability**: SystemCapability.WindowManager.WindowManager.Core
123
124| Name                                 | Value  | Description                         |
125| ------------------------------------- | ---- | ----------------------------- |
126| UNSPECIFIED                           | 0    | Unspecified. The orientation is determined by the system.|
127| PORTRAIT                              | 1    | Portrait.            |
128| LANDSCAPE                             | 2    | Landscape.  |
129| PORTRAIT_INVERTED                     | 3    | Reverse portrait.  |
130| LANDSCAPE_INVERTED                    | 4    | Reverse landscape.|
131| AUTO_ROTATION                         | 5    | Auto rotation.|
132| AUTO_ROTATION_PORTRAIT                | 6    | Auto rotation in the vertical direction.|
133| AUTO_ROTATION_LANDSCAPE               | 7    | Auto rotation in the horizontal direction.|
134| AUTO_ROTATION_RESTRICTED              | 8    | Switched-determined auto rotation.|
135| AUTO_ROTATION_PORTRAIT_RESTRICTED     | 9    | Switched-determined auto rotation in the vertical direction.|
136| AUTO_ROTATION_LANDSCAPE_RESTRICTED    | 10   | Switched-determined auto rotation in the horizontal direction.|
137| LOCKED                                | 11   | Locked.|
138
139## BlurStyle<sup>9+</sup>
140
141Enumerates the window blur styles.
142
143**System API**: This is a system API.
144
145**System capability**: SystemCapability.WindowManager.WindowManager.Core
146
147| Name   | Value  | Description                |
148| ------- | ---- | -------------------- |
149| OFF     | 0    | Blur disabled.      |
150| THIN    | 1    | Thin blur.|
151| REGULAR | 2    | Regular blur.|
152| THICK   | 3    | Thick blur.|
153
154## SystemBarRegionTint<sup>8+</sup>
155
156Describes the callback for a single system bar.
157
158**System API**: This is a system API.
159
160**System capability**: SystemCapability.WindowManager.WindowManager.Core
161
162| Name           | Type                 | Readable| Writable| Description                                                        |
163| --------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ |
164| type            | [WindowType](#windowtype7) | Yes  | No  | Type of the system bar whose properties are changed. Only the status bar and navigation bar are supported.|
165| isEnable        | boolean                   | Yes  | No  | Whether the system bar is displayed. The value **true** means that the system bar is displayed, and **false** means the opposite.|
166| region          | [Rect](#rect7)             | Yes  | No  | Current position and size of the system bar.                                    |
167| backgroundColor | string                    | Yes  | No  | Background color of the system bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. |
168| contentColor    | string                    | Yes  | No  | Color of the text on the system bar.                                            |
169
170## SystemBarTintState<sup>8+</sup>
171
172Describes the callback for the current system bar.
173
174**System API**: This is a system API.
175
176**System capability**: SystemCapability.WindowManager.WindowManager.Core
177
178| Name      | Type                                           | Readable| Writable| Description                        |
179| ---------- | --------------------------------------------------- | ---- | ---- | ---------------------------- |
180| displayId  | number                                              | Yes  | No  | ID of the current physical screen.            |
181| regionTint | Array<[SystemBarRegionTint](#systembarregiontint8)> | Yes  | No  | All system bar information that has been changed.|
182
183## Rect<sup>7+</sup>
184
185Describes the rectangular area of the window.
186
187**System capability**: SystemCapability.WindowManager.WindowManager.Core
188
189| Name  | Type| Readable| Writable| Description              |
190| ------ | -------- | ---- | ---- | ------------------ |
191| left   | number   | Yes  | Yes  | Left boundary of the rectangle, in pixels.|
192| top    | number   | Yes  | Yes  | Top boundary of the rectangle, in pixels.|
193| width  | number   | Yes  | Yes  | Width of the rectangle, in pixels.|
194| height | number   | Yes  | Yes  | Height of the rectangle, in pixels.|
195
196## AvoidArea<sup>7+</sup>
197
198Describes the area where the window cannot be displayed.
199
200**System capability**: SystemCapability.WindowManager.WindowManager.Core
201
202| Name      | Type     | Readable| Writable| Description              |
203| ---------- | ------------- | ---- | ---- | ------------------ |
204| visible<sup>9+</sup>    | boolean       | Yes  | Yes  | Whether the window can be displayed in the area. The value **true** means that the window can be displayed in the area, and **false** means the opposite.|
205| leftRect   | [Rect](#rect7) | Yes  | Yes  | Rectangle on the left of the screen.|
206| topRect    | [Rect](#rect7) | Yes  | Yes  | Rectangle at the top of the screen.|
207| rightRect  | [Rect](#rect7) | Yes  | Yes  | Rectangle on the right of the screen.|
208| bottomRect | [Rect](#rect7) | Yes  | Yes  | Rectangle at the bottom of the screen.|
209
210## Size<sup>7+</sup>
211
212Describes the window size.
213
214**System capability**: SystemCapability.WindowManager.WindowManager.Core
215
216| Name  | Type| Readable| Writable| Description      |
217| ------ | -------- | ---- | ---- | ---------- |
218| width  | number   | Yes  | Yes  | Window width, in pixels.|
219| height | number   | Yes  | Yes  | Window height, in pixels.|
220
221## WindowProperties
222
223Describes the window properties.
224
225**System capability**: SystemCapability.WindowManager.WindowManager.Core
226
227| Name                                 | Type                 | Readable| Writable| Description                                                        |
228| ------------------------------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ |
229| windowRect<sup>7+</sup>               | [Rect](#rect7)             | Yes  | Yes  | Window size.                                                  |
230| type<sup>7+</sup>                     | [WindowType](#windowtype7) | Yes  | Yes  | Window type.                                                  |
231| isFullScreen                          | boolean                   | Yes  | Yes  | Whether the window is displayed in full screen mode. The default value is **false**. The value **true** means that the window is displayed in full screen mode, and **false** means the opposite.|
232| isLayoutFullScreen<sup>7+</sup>       | boolean                   | Yes  | Yes  | Whether the window layout is in full-screen mode (whether the window is immersive). The default value is **false**. The value **true** means that the window is immersive, and **false** means the opposite.|
233| focusable<sup>7+</sup>                | boolean                   | Yes  | No  | Whether the window can gain focus. The default value is **true**. The value **true** means that the window can gain focus, and **false** means the opposite.|
234| touchable<sup>7+</sup>                | boolean                   | Yes  | No  | Whether the window is touchable. The default value is **true**. The value **true** means that the window is touchable, and **false** means the opposite.|
235| brightness                            | number                    | Yes  | Yes  | Screen brightness. The value ranges from 0 to 1. The value **1** indicates the maximum brightness. If no value is passed, the brightness follows the system. In this case, the obtained brightness value is –1.|
236| dimBehindValue<sup>(deprecated)</sup> | number                    | Yes  | Yes  | Dimness of the window that is not on top. The value ranges from 0 to 1. The value **1** indicates the maximum dimness.<br>**NOTE**<br>This property is supported since API version 7 and deprecated since API version 9.<br> |
237| isKeepScreenOn                        | boolean                   | Yes  | Yes  | Whether the screen is always on. The default value is **false**. The value **true** means that the screen is always on, and **false** means the opposite.|
238| isPrivacyMode<sup>7+</sup>            | boolean                   | Yes  | Yes  | Whether the window is in privacy mode. The default value is **false**. The value **true** means that the window is in privacy mode, and **false** means the opposite.|
239| isRoundCorner<sup>(deprecated)</sup>  | boolean                   | Yes  | Yes  | Whether the window has rounded corners. The default value is **false**. The value **true** means that the window has rounded corners, and **false** means the opposite.<br>**NOTE**<br>This property is supported since API version 7 and deprecated since API version 9.<br> |
240| isTransparent<sup>7+</sup>            | boolean                   | Yes  | Yes  | Whether the window is transparent. The default value is **false**. The value **true** means that the window is transparent, and **false** means the opposite.|
241| id<sup>9+</sup>                       | number                    | Yes  | No  | Window ID. The default value is **0.0**.                                                 |
242
243## ColorSpace<sup>8+</sup>
244
245Enumerates the color spaces.
246
247**System capability**: SystemCapability.WindowManager.WindowManager.Core
248
249| Name      | Value| Description          |
250| ---------- | ------ | -------------- |
251| DEFAULT    | 0      | Default SRGB gamut.|
252| WIDE_GAMUT | 1      | Wide-gamut.  |
253
254## ScaleOptions<sup>9+</sup>
255
256Describes the scale parameters.
257
258**System API**: This is a system API.
259
260**System capability**: SystemCapability.WindowManager.WindowManager.Core
261
262| Name  | Type| Readable| Writable| Description                                              |
263| ------ | -------- | ---- | ---- | -------------------------------------------------- |
264| x      | number   | No  | Yes  | Scale factor along the x-axis. The default value is **1.0**.                      |
265| y      | number   | No  | Yes  | Scale factor along the y-axis. The default value is **1.0**.                      |
266| pivotX | number   | No  | Yes  | X coordinate of the scale center. The value ranges from 0.0 to 1.0, and the default value is **0.5**.|
267| pivotY | number   | No  | Yes  | Y coordinate of the scale center. The value ranges from 0.0 to 1.0, and the default value is **0.5**.|
268
269## RotateOptions<sup>9+</sup>
270
271Describes the rotation parameters.
272
273**System API**: This is a system API.
274
275**System capability**: SystemCapability.WindowManager.WindowManager.Core
276
277| Name  | Type| Readable| Writable| Description                                              |
278| ------ | -------- | ---- | ---- | -------------------------------------------------- |
279| x      | number   | No  | Yes  | Rotation angle around the x-axis. The default value is **0.0**.                    |
280| y      | number   | No  | Yes  | Rotation angle around the y-axis. The default value is **0.0**.                    |
281| z      | number   | No  | Yes  | Rotation angle around the z-xis. The default value is **0.0**.                    |
282| pivotX | number   | No  | Yes  | X coordinate of the rotation center. The value ranges from 0.0 to 1.0, and the default value is **0.5**.|
283| pivotY | number   | No  | Yes  | Y coordinate of the rotation center. The value ranges from 0.0 to 1.0, and the default value is **0.5**.|
284
285## TranslateOptions<sup>9+</sup>
286
287Describes the translation parameters.
288
289**System API**: This is a system API.
290
291**System capability**: SystemCapability.WindowManager.WindowManager.Core
292
293| Name| Type| Readable| Writable| Description                        |
294| ---- | -------- | ---- | ---- | ---------------------------- |
295| x    | number   | No  | Yes  | Distance to translate along the x-axis. The default value is **0.0**.|
296| y    | number   | No  | Yes  | Distance to translate along the y-axis. The default value is **0.0**.|
297| z    | number   | No  | Yes  | Distance to translate along the z-axis. The default value is **0.0**.|
298
299## window.createWindow<sup>9+</sup>
300
301createWindow(config: Configuration, callback: AsyncCallback&lt;Window&gt;): void
302
303Creates a subwindow or system window. This API uses an asynchronous callback to return the result.
304
305**System capability**: SystemCapability.WindowManager.WindowManager.Core
306
307**Parameters**
308
309| Name| Type| Mandatory| Description|
310| -------- | -------------------------------------- | -- | --------------------------------- |
311| config   | [Configuration](#configuration9)       | Yes| Parameters used for creating the window.  |
312| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes| Callback used to return the window created.|
313
314**Error codes**
315
316For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
317
318| ID| Error Message|
319| ------- | -------------------------------- |
320| 1300001 | Repeated operation. |
321| 1300006 | This window context is abnormal. |
322
323**Example**
324
325```js
326let windowClass = null;
327let config = {name: "alertWindow", windowType: window.WindowType.TYPE_SYSTEM_ALERT, ctx: this.context};
328try {
329    window.createWindow(config, (err, data) => {
330        if (err.code) {
331            console.error('Failed to create the window. Cause: ' + JSON.stringify(err));
332            return;
333        }
334        windowClass = data;
335        console.info('Succeeded in creating the window. Data: ' + JSON.stringify(data));
336        windowClass.resetSize(500, 1000);
337    });
338} catch (exception) {
339    console.error('Failed to create the window. Cause: ' + JSON.stringify(exception));
340}
341```
342
343## window.createWindow<sup>9+</sup>
344
345createWindow(config: Configuration): Promise&lt;Window&gt;
346
347Creates a subwindow or system window. This API uses a promise to return the result.
348
349**System capability**: SystemCapability.WindowManager.WindowManager.Core
350
351**Parameters**
352
353| Name| Type| Mandatory| Description|
354| ------ | -------------------------------- | -- | ------------------ |
355| config | [Configuration](#configuration9) | Yes| Parameters used for creating the window.|
356
357**Return value**
358
359| Type| Description|
360| -------------------------------- | ------------------------------------ |
361| Promise&lt;[Window](#window)&gt; | Promise used to return the window created.|
362
363**Error codes**
364
365For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
366
367| ID| Error Message|
368| ------- | -------------------------------- |
369| 1300001 | Repeated operation. |
370| 1300006 | This window context is abnormal. |
371
372**Example**
373
374```js
375let windowClass = null;
376let config = {name: "alertWindow", windowType: window.WindowType.TYPE_SYSTEM_ALERT, ctx: this.context};
377try {
378    let promise = window.createWindow(config);
379    promise.then((data)=> {
380        windowClass = data;
381        console.info('Succeeded in creating the window. Data:' + JSON.stringify(data));
382    }).catch((err)=>{
383        console.error('Failed to create the Window. Cause:' + JSON.stringify(err));
384    });
385} catch (exception) {
386    console.error('Failed to create the window. Cause: ' + JSON.stringify(exception));
387}
388```
389
390## window.findWindow<sup>9+</sup>
391
392findWindow(name: string): Window
393
394Finds a window based on the name.
395
396**System capability**: SystemCapability.WindowManager.WindowManager.Core
397
398**Parameters**
399
400| Name| Type  | Mandatory| Description    |
401| ------ | ------ | ---- | -------- |
402| name   | string | Yes  | Window ID.|
403
404**Return value**
405
406| Type| Description|
407| ----------------- | ------------------- |
408| [Window](#window) | Window found.|
409
410**Example**
411
412```js
413let windowClass = null;
414try {
415    windowClass = window.findWindow('alertWindow');
416} catch (exception) {
417    console.error('Failed to find the Window. Cause: ' + JSON.stringify(exception));
418}
419```
420
421## window.getLastWindow<sup>9+</sup>
422
423getLastWindow(ctx: BaseContext, callback: AsyncCallback&lt;Window&gt;): void
424
425Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
426
427**System capability**: SystemCapability.WindowManager.WindowManager.Core
428
429**Parameters**
430
431| Name| Type| Mandatory| Description|
432| -------- | -------------------------------------- | -- | ---------------------------------------- |
433| ctx      | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Current application context.|
434| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes| Callback used to return the top window obtained.|
435
436**Error codes**
437
438For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
439
440| ID| Error Message|
441| ------- | -------------------------------- |
442| 1300002 | This window state is abnormal.   |
443| 1300006 | This window context is abnormal. |
444
445**Example**
446
447```js
448let windowClass = null;
449try {
450    window.getLastWindow(this.context, (err, data) => {
451        if (err.code) {
452            console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
453            return;
454        }
455        windowClass = data;
456        console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
457    });
458} catch (exception) {
459    console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception));
460}
461```
462
463## window.getLastWindow<sup>9+</sup>
464
465getLastWindow(ctx: BaseContext): Promise&lt;Window&gt;
466
467Obtains the top window of the current application. This API uses a promise to return the result.
468
469**System capability**: SystemCapability.WindowManager.WindowManager.Core
470
471**Parameters**
472
473| Name| Type| Mandatory| Description|
474| ------ | ----------- | ---- | ------------------------------------------------------------ |
475| ctx    | [BaseContext](js-apis-inner-application-baseContext.md) | Yes  | Current application context.|
476
477**Return value**
478
479| Type| Description|
480| -------------------------------- | ------------------------------------------- |
481| Promise&lt;[Window](#window)&gt; | Promise used to return the top window obtained.|
482
483**Error codes**
484
485For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
486
487| ID| Error Message|
488| ------- | -------------------------------- |
489| 1300002 | This window state is abnormal.   |
490| 1300006 | This window context is abnormal. |
491
492**Example**
493
494```js
495let windowClass = null;
496try {
497    let promise = window.getLastWindow(this.context);
498    promise.then((data)=> {
499        windowClass = data;
500        console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
501    }).catch((err)=>{
502        console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
503    });
504} catch (exception) {
505    console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception));
506}
507```
508
509## window.minimizeAll<sup>9+</sup>
510minimizeAll(id: number, callback: AsyncCallback&lt;void&gt;): void
511
512Minimizes all windows on a display. This API uses an asynchronous callback to return the result.
513
514**System API**: This is a system API.
515
516**System capability**: SystemCapability.WindowManager.WindowManager.Core
517
518**Parameters**
519
520| Name  | Type                     | Mandatory| Description          |
521| -------- | ------------------------- | ---- | -------------- |
522| id       | number                    | Yes  | ID of the [display](js-apis-display.md#display).|
523| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.    |
524
525**Error codes**
526
527For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
528
529| ID| Error Message|
530| ------- | -------------------------------------------- |
531| 1300003 | This window manager service works abnormally. |
532
533**Example**
534
535```js
536import display from '@ohos.display'
537
538let displayClass = null;
539try {
540    displayClass = display.getDefaultDisplaySync();
541
542    try {
543        window.minimizeAll(displayClass.id, (err) => {
544            if(err.code) {
545                console.error('Failed to minimize all windows. Cause: ' + JSON.stringify(err));
546                return;
547            }
548            console.info('Succeeded in minimizing all windows.');
549        });
550    } catch (exception) {
551        console.error('Failed to minimize all windows. Cause: ' + JSON.stringify(exception));
552    }
553} catch (exception) {
554    console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
555}
556```
557
558## window.minimizeAll<sup>9+</sup>
559minimizeAll(id: number): Promise&lt;void&gt;
560
561Minimizes all windows on a display. This API uses a promise to return the result.
562
563**System API**: This is a system API.
564
565**System capability**: SystemCapability.WindowManager.WindowManager.Core
566
567**Parameters**
568
569| Name  | Type                     | Mandatory| Description          |
570| -------- | ------------------------- | ---- | -------------- |
571| id       | number                    | Yes  | ID of the [display](js-apis-display.md#display).|
572
573**Return value**
574
575| Type               | Description                     |
576| ------------------- | ------------------------- |
577| Promise&lt;void&gt; | Promise that returns no value.|
578
579**Error codes**
580
581For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
582
583| ID| Error Message|
584| ------- | -------------------------------------------- |
585| 1300003 | This window manager service works abnormally. |
586
587**Example**
588
589```js
590import display from '@ohos.display'
591
592let displayClass = null;
593try {
594    displayClass = display.getDefaultDisplaySync();
595
596    try {
597        let promise = window.minimizeAll(displayClass.id);
598        promise.then(()=> {
599            console.info('Succeeded in minimizing all windows.');
600        }).catch((err)=>{
601            console.error('Failed to minimize all windows. Cause: ' + JSON.stringify(err));
602        });
603    } catch (exception) {
604        console.error('Failed to minimize all windows. Cause: ' + JSON.stringify(exception));
605    }
606} catch (exception) {
607    console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
608}
609```
610
611## window.toggleShownStateForAllAppWindows<sup>9+</sup>
612toggleShownStateForAllAppWindows(callback: AsyncCallback&lt;void&gt;): void
613
614Hides or restores the application's windows during quick multi-window switching. This API uses an asynchronous callback to return the result.
615
616**System API**: This is a system API.
617
618**System capability**: SystemCapability.WindowManager.WindowManager.Core
619
620**Parameters**
621
622| Name  | Type                     | Mandatory| Description          |
623| -------- | ------------------------- | ---- | -------------- |
624| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.    |
625
626**Error codes**
627
628For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
629
630| ID| Error Message|
631| ------- | -------------------------------------------- |
632| 1300003 | This window manager service works abnormally. |
633
634**Example**
635
636```js
637window.toggleShownStateForAllAppWindows((err) => {
638    if (err.code) {
639        console.error('Failed to toggle shown state for all app windows. Cause: ' + JSON.stringify(err));
640        return;
641    }
642    console.info('Succeeded in toggling shown state for all app windows.');
643});
644```
645
646## window.toggleShownStateForAllAppWindows<sup>9+</sup>
647toggleShownStateForAllAppWindows(): Promise&lt;void&gt;
648
649Hides or restores the application's windows during quick multi-window switching. This API uses a promise to return the result.
650
651**System API**: This is a system API.
652
653**System capability**: SystemCapability.WindowManager.WindowManager.Core
654
655**Return value**
656
657| Type               | Description                     |
658| ------------------- | ------------------------- |
659| Promise&lt;void&gt; | Promise that returns no value.|
660
661**Error codes**
662
663For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
664
665| ID| Error Message|
666| ------- | -------------------------------------------- |
667| 1300003 | This window manager service works abnormally. |
668
669**Example**
670
671```js
672let promise = window.toggleShownStateForAllAppWindows();
673promise.then(()=> {
674    console.info('Succeeded in toggling shown state for all app windows.');
675}).catch((err)=>{
676    console.error('Failed to toggle shown state for all app windows. Cause: ' + JSON.stringify(err));
677});
678```
679
680## window.setWindowLayoutMode<sup>9+</sup>
681setWindowLayoutMode(mode: WindowLayoutMode, callback: AsyncCallback&lt;void&gt;): void
682
683Sets the window layout mode. This API uses an asynchronous callback to return the result.
684
685**System API**: This is a system API.
686
687**System capability**: SystemCapability.WindowManager.WindowManager.Core
688
689**Parameters**
690
691| Name  | Type                     | Mandatory| Description          |
692| -------- | ------------------------- | ---- | -------------- |
693| mode       | [WindowLayoutMode](#windowlayoutmode9)                  | Yes  | Window layout mode to set.|
694| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.    |
695
696**Error codes**
697
698For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
699
700| ID| Error Message|
701| ------- | -------------------------------------------- |
702| 1300003 | This window manager service works abnormally. |
703
704**Example**
705
706```js
707try {
708    window.setWindowLayoutMode(window.WindowLayoutMode.WINDOW_LAYOUT_MODE_CASCADE, (err) => {
709        if(err.code) {
710            console.error('Failed to set window layout mode. Cause: ' + JSON.stringify(err));
711            return;
712        }
713        console.info('Succeeded in setting window layout mode.');
714    });
715} catch (exception) {
716    console.error('Failed to set window layout mode. Cause: ' + JSON.stringify(exception));
717}
718```
719
720## window.setWindowLayoutMode<sup>9+</sup>
721setWindowLayoutMode(mode: WindowLayoutMode): Promise&lt;void&gt;
722
723Sets the window layout mode. This API uses a promise to return the result.
724
725**System API**: This is a system API.
726
727**System capability**: SystemCapability.WindowManager.WindowManager.Core
728
729**Parameters**
730
731| Name  | Type                     | Mandatory| Description          |
732| -------- | ------------------------- | ---- | -------------- |
733| mode       | [WindowLayoutMode](#windowlayoutmode9)                    | Yes  | Window layout mode to set.|
734
735**Return value**
736
737| Type               | Description                     |
738| ------------------- | ------------------------- |
739| Promise&lt;void&gt; | Promise that returns no value.|
740
741**Error codes**
742
743For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
744
745| ID| Error Message|
746| ------- | -------------------------------------------- |
747| 1300003 | This window manager service works abnormally. |
748
749**Example**
750
751```js
752try {
753    let promise = window.setWindowLayoutMode(window.WindowLayoutMode.WINDOW_LAYOUT_MODE_CASCADE);
754    promise.then(()=> {
755        console.info('Succeeded in setting window layout mode.');
756    }).catch((err)=>{
757        console.error('Failed to set window layout mode. Cause: ' + JSON.stringify(err));
758    });
759} catch (exception) {
760    console.error('Failed to set window layout mode. Cause: ' + JSON.stringify(exception));
761}
762```
763
764## window.on('systemBarTintChange')<sup>8+</sup>
765
766on(type: 'systemBarTintChange', callback: Callback&lt;SystemBarTintState&gt;): void
767
768Enables listening for properties changes of the status bar and navigation bar.
769
770**System API**: This is a system API.
771
772**System capability**: SystemCapability.WindowManager.WindowManager.Core
773
774**Parameters**
775
776| Name  | Type                                                      | Mandatory| Description                                                        |
777| -------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
778| type     | string                                                     | Yes  | Event type. The value is fixed at **'systemBarTintChange'**, indicating the property change event of the status bar and navigation bar.|
779| callback | Callback&lt;[SystemBarTintState](#systembartintstate8)&gt; | Yes  | Callback used to return the properties of the status bar and navigation bar.                |
780
781**Example**
782
783```js
784try {
785    window.on('systemBarTintChange', (data) => {
786        console.info('Succeeded in enabling the listener for systemBarTint changes. Data: ' + JSON.stringify(data));
787    });
788} catch (exception) {
789    console.error('Failed to enable the listener for systemBarTint changes. Cause: ' + JSON.stringify(exception));
790}
791```
792
793## window.off('systemBarTintChange')<sup>8+</sup>
794
795off(type: 'systemBarTintChange', callback?: Callback&lt;SystemBarTintState &gt;): void
796
797Disables listening for properties changes of the status bar and navigation bar.
798
799**System API**: This is a system API.
800
801**System capability**: SystemCapability.WindowManager.WindowManager.Core
802
803**Parameters**
804
805| Name  | Type                                                      | Mandatory| Description                                                        |
806| -------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
807| type     | string                                                     | Yes  | Event type. The value is fixed at **'systemBarTintChange'**, indicating the property change event of the status bar and navigation bar.|
808| callback | Callback&lt;[SystemBarTintState](#systembartintstate8)&gt; | No  | Callback used to return the properties of the status bar and navigation bar.                |
809
810**Example**
811
812```js
813try {
814    window.off('systemBarTintChange');
815} catch (exception) {
816    console.error('Failed to disable the listener for systemBarTint changes. Cause: ' + JSON.stringify(exception));
817}
818```
819
820## window.create<sup>(deprecated)</sup>
821
822create(id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): void
823
824Creates a subwindow. This API uses an asynchronous callback to return the result.
825
826> **NOTE**
827>
828> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9) instead.
829
830**Model restriction**: This API can be used only in the FA model.
831
832**System capability**: SystemCapability.WindowManager.WindowManager.Core
833
834**Parameters**
835
836| Name  | Type                                  | Mandatory| Description                                |
837| -------- | -------------------------------------- | ---- | ------------------------------------ |
838| id       | string                                 | Yes  | Window ID.                            |
839| type     | [WindowType](#windowtype7)              | Yes  | Window type.                          |
840| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes  | Callback used to return the subwindow created.|
841
842**Example**
843
844```js
845let windowClass = null;
846window.create('first', window.WindowType.TYPE_APP,(err,data) => {
847    if(err.code){
848        console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err));
849        return;
850    }
851    windowClass = data;
852    console.info('Succeeded in creating the subWindow. Data: ' + JSON.stringify(data));
853});
854```
855
856## window.create<sup>(deprecated)</sup>
857
858create(id: string, type: WindowType): Promise&lt;Window&gt;
859
860Creates a subwindow. This API uses a promise to return the result.
861
862> **NOTE**
863>
864> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9-1) instead.
865
866**Model restriction**: This API can be used only in the FA model.
867
868**System capability**: SystemCapability.WindowManager.WindowManager.Core
869
870**Parameters**
871
872| Name| Type                     | Mandatory| Description      |
873| ------ | ------------------------- | ---- | ---------- |
874| id     | string                    | Yes  | Window ID.  |
875| type   | [WindowType](#windowtype7) | Yes  | Window type.|
876
877**Return value**
878
879| Type                            | Description                                   |
880| -------------------------------- | --------------------------------------- |
881| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow created.|
882
883**Example**
884
885```js
886let windowClass = null;
887let promise = window.create('first', window.WindowType.TYPE_APP);
888promise.then((data)=> {
889    windowClass = data;
890    console.info('Succeeded in creating the subWindow. Data: ' + JSON.stringify(data));
891}).catch((err)=>{
892    console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err));
893});
894```
895
896## window.create<sup>(deprecated)</sup>
897
898create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): void
899
900Creates a system window. This API uses an asynchronous callback to return the result.
901
902> **NOTE**
903>
904> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9) instead.
905
906**System capability**: SystemCapability.WindowManager.WindowManager.Core
907
908**Parameters**
909
910| Name  | Type                                                   | Mandatory| Description                                |
911| -------- | ------------------------------------------------------- | ---- | ------------------------------------ |
912| ctx      | [BaseContext](js-apis-inner-application-baseContext.md) | Yes  | Current application context.                |
913| id       | string                                                  | Yes  | Window ID.                            |
914| type     | [WindowType](#windowtype7)                              | Yes  | Window type.                          |
915| callback | AsyncCallback&lt;[Window](#window)&gt;                  | Yes  | Callback used to return the subwindow created.|
916
917**Example**
918
919```js
920let windowClass = null;
921window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT, (err, data) => {
922    if (err.code) {
923        console.error('Failed to create the window. Cause: ' + JSON.stringify(err));
924        return;
925    }
926    windowClass = data;
927    console.info('Succeeded in creating the window. Data: ' + JSON.stringify(data));
928    windowClass.resetSize(500, 1000);
929});
930```
931
932## window.create<sup>(deprecated)</sup>
933
934create(ctx: BaseContext, id: string, type: WindowType): Promise&lt;Window&gt;
935
936Creates a system window. This API uses a promise to return the result.
937
938> **NOTE**
939>
940> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createWindow()](#windowcreatewindow9-1) instead.
941
942**System capability**: SystemCapability.WindowManager.WindowManager.Core
943
944**Parameters**
945
946| Name| Type                     | Mandatory| Description                                                        |
947| ------ | ------------------------- | ---- | ------------------------------------------------------------ |
948| ctx    | [BaseContext](js-apis-inner-application-baseContext.md) | Yes  | Current application context.|
949| id     | string                    | Yes  | Window ID.                                                    |
950| type   | [WindowType](#windowtype7) | Yes  | Window type.                                                  |
951
952**Return value**
953
954| Type                            | Description                                   |
955| -------------------------------- | --------------------------------------- |
956| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow created.|
957
958**Example**
959
960```js
961let windowClass = null;
962let promise = window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT);
963promise.then((data)=> {
964    windowClass = data;
965    console.info('Succeeded in creating the window. Data:' + JSON.stringify(data));
966}).catch((err)=>{
967    console.error('Failed to create the Window. Cause:' + JSON.stringify(err));
968});
969```
970
971## window.find<sup>(deprecated)</sup>
972
973find(id: string, callback: AsyncCallback&lt;Window&gt;): void
974
975Finds a window based on the ID. This API uses an asynchronous callback to return the result.
976
977> **NOTE**
978>
979> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [findWindow()](#windowfindwindow9) instead.
980
981**System capability**: SystemCapability.WindowManager.WindowManager.Core
982
983**Parameters**
984
985| Name  | Type                                  | Mandatory| Description                                |
986| -------- | -------------------------------------- | ---- | ------------------------------------ |
987| id       | string                                 | Yes  | Window ID.                            |
988| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes  | Callback used to return the window found.|
989
990**Example**
991
992```js
993let windowClass = null;
994window.find('alertWindow', (err, data) => {
995    if (err.code) {
996        console.error('Failed to find the Window. Cause: ' + JSON.stringify(err));
997        return;
998    }
999    windowClass = data;
1000    console.info('Succeeded in finding the window. Data: ' + JSON.stringify(data));
1001});
1002```
1003
1004## window.find<sup>(deprecated)</sup>
1005
1006find(id: string): Promise&lt;Window&gt;
1007
1008Finds a window based on the ID. This API uses a promise to return the result.
1009
1010> **NOTE**
1011>
1012> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [findWindow()](#windowfindwindow9) instead.
1013
1014**System capability**: SystemCapability.WindowManager.WindowManager.Core
1015
1016**Parameters**
1017
1018| Name| Type  | Mandatory| Description    |
1019| ------ | ------ | ---- | -------- |
1020| id     | string | Yes  | Window ID.|
1021
1022**Return value**
1023
1024| Type                            | Description                                 |
1025| -------------------------------- | ------------------------------------- |
1026| Promise&lt;[Window](#window)&gt; | Promise used to return the window found.|
1027
1028**Example**
1029
1030```js
1031let windowClass = null;
1032let promise = window.find('alertWindow');
1033promise.then((data)=> {
1034    windowClass = data;
1035    console.info('Succeeded in finding the window. Data: ' + JSON.stringify(data));
1036}).catch((err)=>{
1037    console.error('Failed to find the Window. Cause: ' + JSON.stringify(err));
1038});
1039```
1040
1041## window.getTopWindow<sup>(deprecated)</sup>
1042
1043getTopWindow(callback: AsyncCallback&lt;Window&gt;): void
1044
1045Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
1046
1047> **NOTE**
1048>
1049> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9) instead.
1050
1051**Model restriction**: This API can be used only in the FA model.
1052
1053**System capability**: SystemCapability.WindowManager.WindowManager.Core
1054
1055**Parameters**
1056
1057| Name  | Type                                  | Mandatory| Description                                        |
1058| -------- | -------------------------------------- | ---- | -------------------------------------------- |
1059| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes  | Callback used to return the top window obtained.|
1060
1061**Example**
1062
1063```js
1064let windowClass = null;
1065window.getTopWindow((err, data) => {
1066    if (err.code) {
1067        console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
1068        return;
1069    }
1070    windowClass = data;
1071    console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
1072});
1073```
1074
1075## window.getTopWindow<sup>(deprecated)</sup>
1076
1077getTopWindow(): Promise&lt;Window&gt;
1078
1079Obtains the top window of the current application. This API uses a promise to return the result.
1080
1081> **NOTE**
1082>
1083> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9-1) instead.
1084
1085**Model restriction**: This API can be used only in the FA model.
1086
1087**System capability**: SystemCapability.WindowManager.WindowManager.Core
1088
1089**Return value**
1090
1091| Type                            | Description                                           |
1092| -------------------------------- | ----------------------------------------------- |
1093| Promise&lt;[Window](#window)&gt; | Promise used to return the top window obtained.|
1094
1095**Example**
1096
1097```js
1098let windowClass = null;
1099let promise = window.getTopWindow();
1100promise.then((data)=> {
1101    windowClass = data;
1102    console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
1103}).catch((err)=>{
1104    console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
1105});
1106```
1107
1108## window.getTopWindow<sup>(deprecated)</sup>
1109
1110getTopWindow(ctx: BaseContext, callback: AsyncCallback&lt;Window&gt;): void
1111
1112Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
1113
1114> **NOTE**
1115>
1116> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9) instead.
1117
1118**System capability**: SystemCapability.WindowManager.WindowManager.Core
1119
1120**Parameters**
1121
1122| Name  | Type                                  | Mandatory| Description                                                        |
1123| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
1124| ctx      | [BaseContext](js-apis-inner-application-baseContext.md)                            | Yes  | Current application context.|
1125| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes  | Callback used to return the top window obtained.                |
1126
1127**Example**
1128
1129```js
1130let windowClass = null;
1131window.getTopWindow(this.context, (err, data) => {
1132    if (err.code) {
1133        console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
1134        return;
1135    }
1136    windowClass = data;
1137    console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
1138});
1139```
1140
1141## window.getTopWindow<sup>(deprecated)</sup>
1142
1143getTopWindow(ctx: BaseContext): Promise&lt;Window&gt;
1144
1145Obtains the top window of the current application. This API uses a promise to return the result.
1146
1147> **NOTE**
1148>
1149> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getLastWindow()](#windowgetlastwindow9-1) instead.
1150
1151**System capability**: SystemCapability.WindowManager.WindowManager.Core
1152
1153**Parameters**
1154
1155| Name| Type   | Mandatory| Description                                                        |
1156| ------ | ----------- | ---- | ------------------------------------------------------------ |
1157| ctx    | [BaseContext](js-apis-inner-application-baseContext.md) | Yes  | Current application context.|
1158
1159**Return value**
1160
1161| Type                            | Description                                           |
1162| -------------------------------- | ----------------------------------------------- |
1163| Promise&lt;[Window](#window)&gt; | Promise used to return the top window obtained.|
1164
1165**Example**
1166
1167```js
1168let windowClass = null;
1169let promise = window.getTopWindow(this.context);
1170promise.then((data)=> {
1171 	windowClass = data;
1172    console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
1173}).catch((err)=>{
1174    console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
1175});
1176```
1177
1178## Window
1179
1180Represents the current window instance, which is the basic unit managed by the window manager.
1181
1182In the following API examples, you must use [getLastWindow()](#windowgetlastwindow9), [createWindow()](#windowcreatewindow9), or [findWindow()](#windowfindwindow9) to obtain a **Window** instance and then call a method in this instance.
1183
1184### hide<sup>7+</sup>
1185
1186hide (callback: AsyncCallback&lt;void&gt;): void
1187
1188Hides this window. This API uses an asynchronous callback to return the result.
1189
1190**System API**: This is a system API.
1191
1192**System capability**: SystemCapability.WindowManager.WindowManager.Core
1193
1194**Parameters**
1195
1196| Name  | Type                     | Mandatory| Description      |
1197| -------- | ------------------------- | ---- | ---------- |
1198| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
1199
1200**Error codes**
1201
1202For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1203
1204| ID| Error Message|
1205| ------- | ------------------------------ |
1206| 1300002 | This window state is abnormal. |
1207
1208**Example**
1209
1210```js
1211windowClass.hide((err) => {
1212    if (err.code) {
1213        console.error('Failed to hide the window. Cause: ' + JSON.stringify(err));
1214        return;
1215    }
1216    console.info('Succeeded in hiding the window.');
1217});
1218```
1219
1220### hide<sup>7+</sup>
1221
1222hide(): Promise&lt;void&gt;
1223
1224Hides this window. This API uses a promise to return the result.
1225
1226**System API**: This is a system API.
1227
1228**System capability**: SystemCapability.WindowManager.WindowManager.Core
1229
1230**Return value**
1231
1232| Type               | Description                     |
1233| ------------------- | ------------------------- |
1234| Promise&lt;void&gt; | Promise that returns no value.|
1235
1236**Error codes**
1237
1238For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1239
1240| ID| Error Message|
1241| ------- | ------------------------------ |
1242| 1300002 | This window state is abnormal. |
1243
1244**Example**
1245
1246```js
1247let promise = windowClass.hide();
1248promise.then(()=> {
1249    console.info('Succeeded in hiding the window.');
1250}).catch((err)=>{
1251    console.error('Failed to hide the window. Cause: ' + JSON.stringify(err));
1252});
1253```
1254
1255### hideWithAnimation<sup>9+</sup>
1256
1257hideWithAnimation(callback: AsyncCallback&lt;void&gt;): void
1258
1259Hides this window and plays an animation during the process. This API uses an asynchronous callback to return the result.
1260
1261**System API**: This is a system API.
1262
1263**System capability**: SystemCapability.WindowManager.WindowManager.Core
1264
1265**Parameters**
1266
1267| Name  | Type                     | Mandatory| Description      |
1268| -------- | ------------------------- | ---- | ---------- |
1269| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
1270
1271**Error codes**
1272
1273For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1274
1275| ID| Error Message|
1276| ------- | -------------------------------------------- |
1277| 1300002 | This window state is abnormal.               |
1278| 1300003 | This window manager service works abnormally. |
1279| 1300004 | Unauthorized operation.                |
1280
1281**Example**
1282
1283```js
1284windowClass.hideWithAnimation((err) => {
1285    if (err.code) {
1286        console.error('Failed to hide the window with animation. Cause: ' + JSON.stringify(err));
1287        return;
1288    }
1289    console.info('Succeeded in hiding the window with animation.');
1290});
1291```
1292
1293### hideWithAnimation<sup>9+</sup>
1294
1295hideWithAnimation(): Promise&lt;void&gt;
1296
1297Hides this window and plays an animation during the process. This API uses a promise to return the result.
1298
1299**System API**: This is a system API.
1300
1301**System capability**: SystemCapability.WindowManager.WindowManager.Core
1302
1303**Return value**
1304
1305| Type               | Description                     |
1306| ------------------- | ------------------------- |
1307| Promise&lt;void&gt; | Promise that returns no value.|
1308
1309**Error codes**
1310
1311For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1312
1313| ID| Error Message|
1314| ------- | -------------------------------------------- |
1315| 1300002 | This window state is abnormal.               |
1316| 1300003 | This window manager service works abnormally. |
1317| 1300004 | Unauthorized operation.                |
1318
1319**Example**
1320
1321```js
1322let promise = windowClass.hideWithAnimation();
1323promise.then(()=> {
1324    console.info('Succeeded in hiding the window with animation.');
1325}).catch((err)=>{
1326    console.error('Failed to hide the window with animation. Cause: ' + JSON.stringify(err));
1327});
1328```
1329
1330### showWindow<sup>9+</sup>
1331
1332showWindow(callback: AsyncCallback&lt;void&gt;): void
1333
1334Shows this window. This API uses an asynchronous callback to return the result.
1335
1336**System capability**: SystemCapability.WindowManager.WindowManager.Core
1337
1338**Parameters**
1339
1340| Name| Type| Mandatory| Description|
1341| -------- | ------------------------- | -- | --------- |
1342| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
1343
1344**Error codes**
1345
1346For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1347
1348| ID| Error Message|
1349| ------- | ------------------------------ |
1350| 1300002 | This window state is abnormal. |
1351
1352**Example**
1353
1354```js
1355windowClass.showWindow((err) => {
1356    if (err.code) {
1357        console.error('Failed to show the window. Cause: ' + JSON.stringify(err));
1358        return;
1359    }
1360    console.info('Succeeded in showing the window.');
1361});
1362```
1363
1364### showWindow<sup>9+</sup>
1365
1366showWindow(): Promise&lt;void&gt;
1367
1368Shows this window. This API uses a promise to return the result.
1369
1370**System capability**: SystemCapability.WindowManager.WindowManager.Core
1371
1372**Return value**
1373
1374| Type| Description|
1375| ------------------- | ----------------------- |
1376| Promise&lt;void&gt; | Promise that returns no value.|
1377
1378**Error codes**
1379
1380For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1381
1382| ID| Error Message|
1383| ------- | ------------------------------ |
1384| 1300002 | This window state is abnormal. |
1385
1386**Example**
1387
1388```js
1389let promise = windowClass.showWindow();
1390promise.then(()=> {
1391    console.info('Succeeded in showing the window.');
1392}).catch((err)=>{
1393    console.error('Failed to show the window. Cause: ' + JSON.stringify(err));
1394});
1395```
1396
1397### showWithAnimation<sup>9+</sup>
1398
1399showWithAnimation(callback: AsyncCallback&lt;void&gt;): void
1400
1401Shows this window and plays an animation during the process. This API uses an asynchronous callback to return the result.
1402
1403**System API**: This is a system API.
1404
1405**System capability**: SystemCapability.WindowManager.WindowManager.Core
1406
1407**Parameters**
1408
1409| Name  | Type                     | Mandatory| Description      |
1410| -------- | ------------------------- | ---- | ---------- |
1411| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
1412
1413**Error codes**
1414
1415For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1416
1417| ID| Error Message|
1418| ------- | -------------------------------------------- |
1419| 1300002 | This window state is abnormal.               |
1420| 1300003 | This window manager service works abnormally. |
1421| 1300004 | Unauthorized operation.                |
1422
1423**Example**
1424
1425```js
1426windowClass.showWithAnimation((err) => {
1427    if (err.code) {
1428        console.error('Failed to show the window with animation. Cause: ' + JSON.stringify(err));
1429        return;
1430    }
1431    console.info('Succeeded in showing the window with animation.');
1432});
1433```
1434
1435### showWithAnimation<sup>9+</sup>
1436
1437showWithAnimation(): Promise&lt;void&gt;
1438
1439Shows this window and plays an animation during the process. This API uses a promise to return the result.
1440
1441**System API**: This is a system API.
1442
1443**System capability**: SystemCapability.WindowManager.WindowManager.Core
1444
1445**Return value**
1446
1447| Type               | Description                     |
1448| ------------------- | ------------------------- |
1449| Promise&lt;void&gt; | Promise that returns no value.|
1450
1451**Error codes**
1452
1453For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1454
1455| ID| Error Message|
1456| ------- | -------------------------------------------- |
1457| 1300002 | This window state is abnormal.               |
1458| 1300003 | This window manager service works abnormally. |
1459| 1300004 | Unauthorized operation.                |
1460
1461**Example**
1462
1463```js
1464let promise = windowClass.showWithAnimation();
1465promise.then(()=> {
1466    console.info('Succeeded in showing the window with animation.');
1467}).catch((err)=>{
1468    console.error('Failed to show the window with animation. Cause: ' + JSON.stringify(err));
1469});
1470```
1471
1472### destroyWindow<sup>9+</sup>
1473
1474destroyWindow(callback: AsyncCallback&lt;void&gt;): void
1475
1476Destroys this window. This API uses an asynchronous callback to return the result.
1477
1478**System capability**: SystemCapability.WindowManager.WindowManager.Core
1479
1480**Parameters**
1481
1482| Name| Type| Mandatory| Description|
1483| -------- | ------------------------- | -- | --------- |
1484| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
1485
1486**Error codes**
1487
1488For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1489
1490| ID| Error Message|
1491| ------- | -------------------------------------------- |
1492| 1300002 | This window state is abnormal.               |
1493| 1300003 | This window manager service works abnormally. |
1494
1495**Example**
1496
1497```js
1498windowClass.destroyWindow((err) => {
1499    if (err.code) {
1500        console.error('Failed to destroy the window. Cause:' + JSON.stringify(err));
1501        return;
1502    }
1503    console.info('Succeeded in destroying the window.');
1504});
1505```
1506
1507### destroyWindow<sup>9+</sup>
1508
1509destroyWindow(): Promise&lt;void&gt;
1510
1511Destroys this window. This API uses a promise to return the result.
1512
1513**System capability**: SystemCapability.WindowManager.WindowManager.Core
1514
1515**Return value**
1516
1517| Type| Description|
1518| ------------------- | ------------------------ |
1519| Promise&lt;void&gt; | Promise that returns no value.|
1520
1521**Error codes**
1522
1523For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1524
1525| ID| Error Message|
1526| ------- | -------------------------------------------- |
1527| 1300002 | This window state is abnormal.               |
1528| 1300003 | This window manager service works abnormally. |
1529
1530**Example**
1531
1532```js
1533let promise = windowClass.destroyWindow();
1534promise.then(()=> {
1535    console.info('Succeeded in destroying the window.');
1536}).catch((err)=>{
1537    console.error('Failed to destroy the window. Cause: ' + JSON.stringify(err));
1538});
1539```
1540
1541### moveWindowTo<sup>9+</sup>
1542
1543moveWindowTo(x: number, y: number, callback: AsyncCallback&lt;void&gt;): void
1544
1545Moves this window. This API uses an asynchronous callback to return the result.
1546
1547This operation is not supported in a window in full-screen mode.
1548
1549**System capability**: SystemCapability.WindowManager.WindowManager.Core
1550
1551**Parameters**
1552
1553| Name| Type| Mandatory| Description|
1554| -------- | ------------------------- | -- | --------------------------------------------- |
1555| x        | number                    | Yes| Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.|
1556| y        | number                    | Yes| Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.|
1557| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                                    |
1558
1559**Error codes**
1560
1561For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1562
1563| ID| Error Message|
1564| ------- | -------------------------------------------- |
1565| 1300002 | This window state is abnormal.               |
1566| 1300003 | This window manager service works abnormally. |
1567
1568**Example**
1569
1570```js
1571try {
1572    windowClass.moveWindowTo(300, 300, (err)=>{
1573        if (err.code) {
1574            console.error('Failed to move the window. Cause:' + JSON.stringify(err));
1575            return;
1576        }
1577        console.info('Succeeded in moving the window.');
1578    });
1579} catch (exception) {
1580    console.error('Failed to move the window. Cause:' + JSON.stringify(exception));
1581}
1582```
1583
1584### moveWindowTo<sup>9+</sup>
1585
1586moveWindowTo(x: number, y: number): Promise&lt;void&gt;
1587
1588Moves this window. This API uses a promise to return the result.
1589
1590This operation is not supported in a window in full-screen mode.
1591
1592**System capability**: SystemCapability.WindowManager.WindowManager.Core
1593
1594**Parameters**
1595
1596| Name| Type| Mandatory| Description|
1597| -- | ----- | -- | --------------------------------------------- |
1598| x | number | Yes| Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.|
1599| y | number | Yes| Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.|
1600
1601**Return value**
1602
1603| Type| Description|
1604| ------------------- | ------------------------ |
1605| Promise&lt;void&gt; | Promise that returns no value.|
1606
1607**Error codes**
1608
1609For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1610
1611| ID| Error Message|
1612| ------- | -------------------------------------------- |
1613| 1300002 | This window state is abnormal.               |
1614| 1300003 | This window manager service works abnormally. |
1615
1616**Example**
1617
1618```js
1619try {
1620    let promise = windowClass.moveWindowTo(300, 300);
1621    promise.then(()=> {
1622        console.info('Succeeded in moving the window.');
1623    }).catch((err)=>{
1624        console.error('Failed to move the window. Cause: ' + JSON.stringify(err));
1625    });
1626} catch (exception) {
1627    console.error('Failed to move the window. Cause:' + JSON.stringify(exception));
1628}
1629```
1630
1631### resize<sup>9+</sup>
1632
1633resize(width: number, height: number, callback: AsyncCallback&lt;void&gt;): void
1634
1635Changes the size of this window. This API uses an asynchronous callback to return the result.
1636
1637The main window and subwindow have the following size limits: [320, 2560] in width and [240, 2560] in height, both in units of vp.
1638
1639The system window has the following size limits: [0, 2560] in width and [0, 2560] in height, both in units of vp.
1640
1641The new width and height you set must meet the limits.
1642
1643This operation is not supported in a window in full-screen mode.
1644
1645**System capability**: SystemCapability.WindowManager.WindowManager.Core
1646
1647**Parameters**
1648
1649| Name| Type| Mandatory| Description|
1650| -------- | ------------------------- | -- | ------------------------ |
1651| width    | number                    | Yes| New width of the window, in px.|
1652| height   | number                    | Yes| New height of the window, in px.|
1653| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.               |
1654
1655**Error codes**
1656
1657For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1658
1659| ID| Error Message|
1660| ------- | -------------------------------------------- |
1661| 1300002 | This window state is abnormal.               |
1662| 1300003 | This window manager service works abnormally. |
1663
1664**Example**
1665
1666```js
1667try {
1668    windowClass.resize(500, 1000, (err) => {
1669        if (err.code) {
1670            console.error('Failed to change the window size. Cause:' + JSON.stringify(err));
1671            return;
1672        }
1673        console.info('Succeeded in changing the window size.');
1674    });
1675} catch (exception) {
1676    console.error('Failed to change the window size. Cause:' + JSON.stringify(exception));
1677}
1678```
1679
1680### resize<sup>9+</sup>
1681
1682resize(width: number, height: number): Promise&lt;void&gt;
1683
1684Changes the size of this window. This API uses a promise to return the result.
1685
1686The main window and subwindow have the following size limits: [320, 2560] in width and [240, 2560] in height, both in units of vp.
1687
1688The system window has the following size limits: [0, 2560] in width and [0, 2560] in height, both in units of vp.
1689
1690The new width and height you set must meet the limits.
1691
1692This operation is not supported in a window in full-screen mode.
1693
1694**System capability**: SystemCapability.WindowManager.WindowManager.Core
1695
1696**Parameters**
1697
1698| Name| Type| Mandatory| Description|
1699| ------ | ------ | -- | ------------------------ |
1700| width  | number | Yes| New width of the window, in px.|
1701| height | number | Yes| New height of the window, in px.|
1702
1703**Return value**
1704
1705| Type| Description|
1706| ------------------- | ------------------------ |
1707| Promise&lt;void&gt; | Promise that returns no value.|
1708
1709**Error codes**
1710
1711For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1712
1713| ID| Error Message|
1714| ------- | -------------------------------------------- |
1715| 1300002 | This window state is abnormal.               |
1716| 1300003 | This window manager service works abnormally. |
1717
1718**Example**
1719
1720```js
1721try {
1722    let promise = windowClass.resize(500, 1000);
1723    promise.then(()=> {
1724        console.info('Succeeded in changing the window size.');
1725    }).catch((err)=>{
1726        console.error('Failed to change the window size. Cause: ' + JSON.stringify(err));
1727    });
1728} catch (exception) {
1729    console.error('Failed to change the window size. Cause: ' + JSON.stringify(exception));
1730}
1731```
1732
1733### setWindowMode<sup>9+</sup>
1734
1735setWindowMode(mode: WindowMode, callback: AsyncCallback&lt;void&gt;): void
1736
1737Sets the mode of this window. This API uses an asynchronous callback to return the result.
1738
1739**System API**: This is a system API.
1740
1741**System capability**: SystemCapability.WindowManager.WindowManager.Core
1742
1743**Parameters**
1744
1745| Name| Type| Mandatory| Description|
1746| -------- | -------------------------- | -- | --------- |
1747| mode     | [WindowMode](#windowmode7) | Yes| Window mode to set.|
1748| callback | AsyncCallback&lt;void&gt;  | Yes| Callback used to return the result.|
1749
1750**Error codes**
1751
1752For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1753
1754| ID| Error Message|
1755| ------- | -------------------------------------------- |
1756| 1300002 | This window state is abnormal.               |
1757| 1300003 | This window manager service works abnormally. |
1758
1759**Example**
1760
1761```js
1762let mode = window.WindowMode.FULLSCREEN;
1763try {
1764    windowClass.setWindowMode(mode, (err) => {
1765    if (err.code) {
1766        console.error('Failed to set the window mode. Cause: ' + JSON.stringify(err));
1767        return;
1768    }
1769    console.info('Succeeded in setting the window mode.');
1770    });
1771} catch (exception) {
1772    console.error('Failed to set the window mode. Cause: ' + JSON.stringify(exception));
1773}
1774```
1775
1776### setWindowMode<sup>9+</sup>
1777
1778setWindowMode(mode: WindowMode): Promise&lt;void&gt;
1779
1780Sets the type of this window. This API uses a promise to return the result.
1781
1782**System API**: This is a system API.
1783
1784**System capability**: SystemCapability.WindowManager.WindowManager.Core
1785
1786**Parameters**
1787
1788| Name| Type| Mandatory| Description|
1789| -------- | -------------------------- | -- | --------- |
1790| mode     | [WindowMode](#windowmode7) | Yes| Window mode to set.|
1791
1792**Return value**
1793
1794| Type| Description|
1795| ------------------- | ----------------------- |
1796| Promise&lt;void&gt; | Promise that returns no value.|
1797
1798**Error codes**
1799
1800For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1801
1802| ID| Error Message|
1803| ------- | -------------------------------------------- |
1804| 1300002 | This window state is abnormal.               |
1805| 1300003 | This window manager service works abnormally. |
1806
1807**Example**
1808
1809```js
1810let mode = window.WindowMode.FULLSCREEN;
1811try {
1812    let promise = windowClass.setWindowMode(mode);
1813    promise.then(()=> {
1814        console.info('Succeeded in setting the window mode.');
1815    }).catch((err)=>{
1816        console.error('Failed to set the window mode. Cause: ' + JSON.stringify(err));
1817    });
1818} catch (exception) {
1819    console.error('Failed to set the window mode. Cause: ' + JSON.stringify(exception));
1820}
1821```
1822
1823### getWindowProperties<sup>9+</sup>
1824
1825getWindowProperties(): WindowProperties
1826
1827Obtains the properties of this window.
1828
1829**System capability**: SystemCapability.WindowManager.WindowManager.Core
1830
1831**Return value**
1832
1833| Type| Description|
1834| ------------------------------------- | ------------- |
1835| [WindowProperties](#windowproperties) | Window properties obtained.|
1836
1837**Error codes**
1838
1839For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1840
1841| ID| Error Message|
1842| ------- | ------------------------------ |
1843| 1300002 | This window state is abnormal. |
1844
1845**Example**
1846
1847```js
1848try {
1849    let properties = windowClass.getWindowProperties();
1850} catch (exception) {
1851    console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(exception));
1852}
1853```
1854
1855### getWindowAvoidArea<sup>9+</sup>
1856
1857getWindowAvoidArea(type: AvoidAreaType): AvoidArea
1858
1859Obtains the area where this window cannot be displayed, for example, the system bar area, notch, gesture area, and soft keyboard area.
1860
1861**System capability**: SystemCapability.WindowManager.WindowManager.Core
1862
1863**Parameters**
1864
1865| Name| Type| Mandatory| Description|
1866| ---- |----------------------------------| -- | ------------------------------------------------------------ |
1867| type | [AvoidAreaType](#avoidareatype7) | Yes| Type of the area.|
1868
1869**Return value**
1870
1871| Type| Description|
1872|--------------------------| ----------------- |
1873| [AvoidArea](#avoidarea7) | Area where the window cannot be displayed.|
1874
1875**Error codes**
1876
1877For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1878
1879| ID| Error Message|
1880| ------- | ------------------------------ |
1881| 1300002 | This window state is abnormal. |
1882
1883**Example**
1884
1885```js
1886let type = window.AvoidAreaType.TYPE_SYSTEM;
1887try {
1888    let avoidArea = windowClass.getWindowAvoidArea(type);
1889} catch (exception) {
1890    console.error('Failed to obtain the area. Cause:' + JSON.stringify(exception));
1891}
1892```
1893
1894### setWindowLayoutFullScreen<sup>9+</sup>
1895
1896setWindowLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback&lt;void&gt;): void
1897
1898Sets whether to enable the full-screen mode for the window layout. This API uses an asynchronous callback to return the result.
1899
1900**System capability**: SystemCapability.WindowManager.WindowManager.Core
1901
1902**Parameters**
1903
1904| Name| Type| Mandatory| Description|
1905| ------------------ | ------------------------- | -- | --------- |
1906| isLayoutFullScreen | boolean                   | Yes| Whether to enable the full-screen mode for the window layout, in which the status bar and navigation bar are displayed. The value **true** means to enable the full-screen mode for the window layout, and **false** means the opposite.|
1907| callback           | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
1908
1909**Error codes**
1910
1911For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1912
1913| ID| Error Message|
1914| ------- | -------------------------------------------- |
1915| 1300002 | This window state is abnormal.               |
1916| 1300003 | This window manager service works abnormally. |
1917
1918**Example**
1919
1920```js
1921let isLayoutFullScreen= true;
1922try {
1923    windowClass.setWindowLayoutFullScreen(isLayoutFullScreen, (err) => {
1924        if (err.code) {
1925            console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
1926            return;
1927        }
1928        console.info('Succeeded in setting the window layout to full-screen mode.');
1929    });
1930} catch (exception) {
1931    console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(exception));
1932}
1933```
1934
1935### setWindowLayoutFullScreen<sup>9+</sup>
1936
1937setWindowLayoutFullScreen(isLayoutFullScreen: boolean): Promise&lt;void&gt;
1938
1939Sets whether to enable the full-screen mode for the window layout. This API uses a promise to return the result.
1940
1941**System capability**: SystemCapability.WindowManager.WindowManager.Core
1942
1943**Parameters**
1944
1945| Name| Type| Mandatory| Description|
1946| ------------------ | ------- | -- | ------------------------------------------------------------------------------------------------ |
1947| isLayoutFullScreen | boolean | Yes| Whether to enable the full-screen mode for the window layout, in which the status bar and navigation bar are displayed. The value **true** means to enable the full-screen mode for the window layout, and **false** means the opposite.|
1948
1949**Return value**
1950
1951| Type| Description|
1952| ------------------- | ------------------------ |
1953| Promise&lt;void&gt; | Promise that returns no value.|
1954
1955**Error codes**
1956
1957For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1958
1959| ID| Error Message|
1960| ------- | -------------------------------------------- |
1961| 1300002 | This window state is abnormal.               |
1962| 1300003 | This window manager service works abnormally. |
1963
1964**Example**
1965
1966```js
1967let isLayoutFullScreen = true;
1968try {
1969    let promise = windowClass.setWindowLayoutFullScreen(isLayoutFullScreen);
1970    promise.then(()=> {
1971        console.info('Succeeded in setting the window layout to full-screen mode.');
1972    }).catch((err)=>{
1973        console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
1974    });
1975} catch (exception) {
1976    console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(exception));
1977}
1978```
1979
1980### setWindowSystemBarEnable<sup>9+</sup>
1981
1982setWindowSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallback&lt;void&gt;): void
1983
1984Sets whether to display the status bar and navigation bar in this window. This API uses an asynchronous callback to return the result.
1985
1986**System capability**: SystemCapability.WindowManager.WindowManager.Core
1987
1988**Parameters**
1989
1990| Name| Type| Mandatory| Description|
1991| -------- | ---------------------------- | -- | --------- |
1992| names    | Array<'status'\|'navigation'> | Yes| Whether to display the status bar and navigation bar.<br>For example, to display the status bar and navigation bar, set this parameter to **['status', 'navigation']**. By default, they are not displayed.|
1993| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
1994
1995**Error codes**
1996
1997For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
1998
1999| ID| Error Message|
2000| ------- | -------------------------------------------- |
2001| 1300002 | This window state is abnormal.               |
2002| 1300003 | This window manager service works abnormally. |
2003
2004**Example**
2005
2006```js
2007// In this example, the status bar and navigation bar are not displayed.
2008let names = [];
2009try {
2010    windowClass.setWindowSystemBarEnable(names, (err) => {
2011        if (err.code) {
2012            console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err));
2013            return;
2014        }
2015        console.info('Succeeded in setting the system bar to be invisible.');
2016    });
2017} catch (exception) {
2018    console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(exception));
2019}
2020```
2021
2022### setWindowSystemBarEnable<sup>9+</sup>
2023
2024setWindowSystemBarEnable(names: Array<'status' | 'navigation'>): Promise&lt;void&gt;
2025
2026Sets whether to display the status bar and navigation bar in this window. This API uses a promise to return the result.
2027
2028**System capability**: SystemCapability.WindowManager.WindowManager.Core
2029
2030**Parameters**
2031
2032| Name| Type | Mandatory| Description|
2033| ----- | ---------------------------- | -- | --------------------------------- |
2034| names | Array<'status'\|'navigation'> | Yes| Whether to display the status bar and navigation bar.<br>For example, to display the status bar and navigation bar, set this parameter to **['status', 'navigation']**. By default, they are not displayed.|
2035
2036**Return value**
2037
2038| Type| Description|
2039| ------------------- | ------------------------ |
2040| Promise&lt;void&gt; | Promise that returns no value.|
2041
2042**Error codes**
2043
2044For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2045
2046| ID| Error Message|
2047| ------- | -------------------------------------------- |
2048| 1300002 | This window state is abnormal.               |
2049| 1300003 | This window manager service works abnormally. |
2050
2051**Example**
2052
2053```js
2054// In this example, the status bar and navigation bar are not displayed.
2055let names = [];
2056try {
2057    let promise = windowClass.setWindowSystemBarEnable(names);
2058    promise.then(()=> {
2059        console.info('Succeeded in setting the system bar to be invisible.');
2060    }).catch((err)=>{
2061        console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err));
2062    });
2063} catch (exception) {
2064    console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(exception));
2065}
2066```
2067
2068### setWindowSystemBarProperties<sup>9+</sup>
2069
2070setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback&lt;void&gt;): void
2071
2072Sets the properties of the status bar and navigation bar in this window. This API uses an asynchronous callback to return the result.
2073
2074**System capability**: SystemCapability.WindowManager.WindowManager.Core
2075
2076**Parameters**
2077
2078| Name             | Type                                       | Mandatory| Description                  |
2079| ------------------- | ------------------------------------------- | ---- | ---------------------- |
2080| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes  | Properties of the status bar and navigation bar.|
2081| callback            | AsyncCallback&lt;void&gt;                   | Yes  | Callback used to return the result.            |
2082
2083**Error codes**
2084
2085For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2086
2087| ID| Error Message|
2088| ------- | -------------------------------------------- |
2089| 1300002 | This window state is abnormal.               |
2090| 1300003 | This window manager service works abnormally. |
2091
2092**Example**
2093
2094```js
2095let SystemBarProperties = {
2096    statusBarColor: '#ff00ff',
2097    navigationBarColor: '#00ff00',
2098    // The following properties are supported since API version 8.
2099    statusBarContentColor:'#ffffff',
2100    navigationBarContentColor:'#00ffff'
2101};
2102try {
2103    windowClass.setWindowSystemBarProperties(SystemBarProperties, (err) => {
2104        if (err.code) {
2105            console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err));
2106            return;
2107        }
2108        console.info('Succeeded in setting the system bar properties.');
2109    });
2110} catch (exception) {
2111    console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(exception));
2112}
2113```
2114
2115### setWindowSystemBarProperties<sup>9+</sup>
2116
2117setWindowSystemBarProperties(systemBarProperties: SystemBarProperties): Promise&lt;void&gt;
2118
2119Sets the properties of the status bar and navigation bar in this window. This API uses a promise to return the result.
2120
2121**System capability**: SystemCapability.WindowManager.WindowManager.Core
2122
2123**Parameters**
2124
2125| Name             | Type                                       | Mandatory| Description                  |
2126| ------------------- | ------------------------------------------- | ---- | ---------------------- |
2127| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes  | Properties of the status bar and navigation bar.|
2128
2129**Return value**
2130
2131| Type               | Description                     |
2132| ------------------- | ------------------------- |
2133| Promise&lt;void&gt; | Promise that returns no value.|
2134
2135**Error codes**
2136
2137For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2138
2139| ID| Error Message|
2140| ------- | -------------------------------------------- |
2141| 1300002 | This window state is abnormal.               |
2142| 1300003 | This window manager service works abnormally. |
2143
2144**Example**
2145
2146```js
2147let SystemBarProperties = {
2148    statusBarColor: '#ff00ff',
2149    navigationBarColor: '#00ff00',
2150    // The following properties are supported since API version 8.
2151    statusBarContentColor:'#ffffff',
2152    navigationBarContentColor:'#00ffff'
2153};
2154try {
2155    let promise = windowClass.setWindowSystemBarProperties(SystemBarProperties);
2156    promise.then(()=> {
2157        console.info('Succeeded in setting the system bar properties.');
2158    }).catch((err)=>{
2159        console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err));
2160    });
2161} catch (exception) {
2162    console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(exception));
2163}
2164```
2165
2166### setPreferredOrientation<sup>9+</sup>
2167
2168setPreferredOrientation(orientation: Orientation, callback: AsyncCallback&lt;void&gt;): void
2169
2170Sets the preferred orientation for this window. This API uses an asynchronous callback to return the result.
2171
2172**System capability**: SystemCapability.WindowManager.WindowManager.Core
2173
2174**Parameters**
2175
2176| Name             | Type                                       | Mandatory| Description                  |
2177| ------------------- | ------------------------------------------- | ---- | ---------------------- |
2178| Orientation         | [Orientation](#orientation9)                | Yes  | Orientation to set.        |
2179| callback            | AsyncCallback&lt;void&gt;                   | Yes  | Callback used to return the result.            |
2180
2181**Error codes**
2182
2183For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2184
2185| ID| Error Message|
2186| ------- | ------------------------------ |
2187| 1300002 | This window state is abnormal. |
2188
2189**Example**
2190
2191```js
2192let orientation = window.Orientation.AUTO_ROTATION;
2193try {
2194    windowClass.setPreferredOrientation(orientation, (err) => {
2195        if (err.code) {
2196            console.error('Failed to set window orientation. Cause: ' + JSON.stringify(err));
2197            return;
2198        }
2199        console.info('Succeeded in setting window orientation.');
2200    });
2201} catch (exception) {
2202    console.error('Failed to set window orientation. Cause: ' + JSON.stringify(exception));
2203}
2204```
2205
2206### setPreferredOrientation<sup>9+</sup>
2207
2208setPreferredOrientation(orientation: Orientation): Promise&lt;void&gt;
2209
2210Sets the preferred orientation for this window. This API uses a promise to return the result.
2211
2212**System capability**: SystemCapability.WindowManager.WindowManager.Core
2213
2214**Parameters**
2215
2216| Name             | Type                                       | Mandatory| Description                  |
2217| ------------------- | ------------------------------------------- | ---- | ---------------------- |
2218| Orientation         | [Orientation](#orientation9)                | Yes  | Orientation to set.      |
2219
2220**Return value**
2221
2222| Type               | Description                     |
2223| ------------------- | ------------------------- |
2224| Promise&lt;void&gt; | Promise that returns no value.|
2225
2226**Error codes**
2227
2228For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2229
2230| ID| Error Message|
2231| ------- | ------------------------------ |
2232| 1300002 | This window state is abnormal. |
2233
2234**Example**
2235
2236```js
2237let orientation = window.Orientation.AUTO_ROTATION;
2238try {
2239    let promise = windowClass.setPreferredOrientation(orientation);
2240    promise.then(()=> {
2241        console.info('Succeeded in setting the window orientation.');
2242    }).catch((err)=>{
2243        console.error('Failed to set the window orientation. Cause: ' + JSON.stringify(err));
2244    });
2245} catch (exception) {
2246    console.error('Failed to set window orientation. Cause: ' + JSON.stringify(exception));
2247}
2248```
2249
2250### setUIContent<sup>9+</sup>
2251
2252setUIContent(path: string, callback: AsyncCallback&lt;void&gt;): void
2253
2254Loads content from a page to this window. This API uses an asynchronous callback to return the result.
2255
2256**System capability**: SystemCapability.WindowManager.WindowManager.Core
2257
2258**Parameters**
2259
2260| Name| Type| Mandatory| Description|
2261| -------- | ------------------------- | -- | -------------------- |
2262| path     | string                    | Yes| Path of the page from which the content will be loaded.|
2263| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.         |
2264
2265**Error codes**
2266
2267For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2268
2269| ID| Error Message|
2270| ------- | -------------------------------------------- |
2271| 1300002 | This window state is abnormal.               |
2272| 1300003 | This window manager service works abnormally. |
2273
2274**Example**
2275
2276```js
2277try {
2278    windowClass.setUIContent('pages/page2/page2', (err) => {
2279    if (err.code) {
2280            console.error('Failed to load the content. Cause:' + JSON.stringify(err));
2281            return;
2282    }
2283    console.info('Succeeded in loading the content.');
2284    });
2285} catch (exception) {
2286    console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
2287}
2288```
2289
2290### setUIContent<sup>9+</sup>
2291
2292setUIContent(path: string): Promise&lt;void&gt;
2293
2294Loads content from a page to this window. This API uses a promise to return the result.
2295
2296**System capability**: SystemCapability.WindowManager.WindowManager.Core
2297
2298**Parameters**
2299
2300| Name| Type| Mandatory| Description|
2301| ---- | ------ | -- | ------------------ |
2302| path | string | Yes| Path of the page from which the content will be loaded.|
2303
2304**Return value**
2305
2306| Type| Description|
2307| ------------------- | ------------------------ |
2308| Promise&lt;void&gt; | Promise that returns no value.|
2309
2310**Error codes**
2311
2312For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2313
2314| ID| Error Message|
2315| ------- | -------------------------------------------- |
2316| 1300002 | This window state is abnormal.               |
2317| 1300003 | This window manager service works abnormally. |
2318
2319**Example**
2320
2321```js
2322try {
2323    let promise = windowClass.setUIContent('pages/page2/page2');
2324    promise.then(()=> {
2325        console.info('Succeeded in loading the content.');
2326    }).catch((err)=>{
2327        console.error('Failed to load the content. Cause: ' + JSON.stringify(err));
2328    });
2329} catch (exception) {
2330    console.error('Failed to load the content. Cause: ' + JSON.stringify(exception));
2331}
2332```
2333
2334### loadContent<sup>9+</sup>
2335
2336loadContent(path: string, storage: LocalStorage, callback: AsyncCallback&lt;void&gt;): void
2337
2338Loads content from a page associated with a local storage to this window. This API uses an asynchronous callback to return the result.
2339
2340**Model restriction**: This API can be used only in the stage model.
2341
2342**System capability**: SystemCapability.WindowManager.WindowManager.Core
2343
2344**Parameters**
2345
2346| Name  | Type                                           | Mandatory| Description                                                        |
2347| -------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
2348| path     | string                                          | Yes  | Path of the page from which the content will be loaded.                                        |
2349| storage  | [LocalStorage](../../quick-start/arkts-localstorage.md) | Yes  | A storage unit, which provides storage for variable state properties and non-variable state properties of an application.|
2350| callback | AsyncCallback&lt;void&gt;                       | Yes  | Callback used to return the result.                                                  |
2351
2352**Error codes**
2353
2354For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2355
2356| ID| Error Message|
2357| ------- | -------------------------------------------- |
2358| 1300002 | This window state is abnormal.               |
2359| 1300003 | This window manager service works abnormally. |
2360
2361**Example**
2362
2363```ts
2364let storage = new LocalStorage();
2365storage.setOrCreate('storageSimpleProp',121);
2366console.log('onWindowStageCreate');
2367try {
2368    windowClass.loadContent('pages/page2', storage, (err) => {
2369        if (err.code) {
2370            console.error('Failed to load the content. Cause:' + JSON.stringify(err));
2371            return;
2372        }
2373        console.info('Succeeded in loading the content.');
2374    });
2375} catch (exception) {
2376    console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
2377}
2378```
2379
2380### loadContent<sup>9+</sup>
2381
2382loadContent(path: string, storage: LocalStorage): Promise&lt;void&gt;
2383
2384Loads content from a page associated with a local storage to this window. This API uses a promise to return the result.
2385
2386**Model restriction**: This API can be used only in the stage model.
2387
2388**System capability**: SystemCapability.WindowManager.WindowManager.Core
2389
2390**Parameters**
2391
2392| Name | Type                                           | Mandatory| Description                                                        |
2393| ------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
2394| path    | string                                          | Yes  | Path of the page from which the content will be loaded.                                        |
2395| storage | [LocalStorage](../../quick-start/arkts-localstorage.md) | Yes  | A storage unit, which provides storage for variable state properties and non-variable state properties of an application.|
2396
2397**Return value**
2398
2399| Type               | Description                     |
2400| ------------------- | ------------------------- |
2401| Promise&lt;void&gt; | Promise that returns no value.|
2402
2403**Error codes**
2404
2405For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2406
2407| ID| Error Message|
2408| ------- | -------------------------------------------- |
2409| 1300002 | This window state is abnormal.               |
2410| 1300003 | This window manager service works abnormally. |
2411
2412**Example**
2413
2414```ts
2415let storage = new LocalStorage();
2416storage.setOrCreate('storageSimpleProp',121);
2417console.log('onWindowStageCreate');
2418try {
2419    let promise = windowClass.loadContent('pages/page2', storage);
2420    promise.then(() => {
2421        console.info('Succeeded in loading the content.');
2422    }).catch((err) => {
2423        console.error('Failed to load the content. Cause:' + JSON.stringify(err));
2424    });
2425} catch (exception) {
2426    console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
2427}
2428```
2429
2430### isWindowShowing<sup>9+</sup>
2431
2432isWindowShowing(): boolean
2433
2434Checks whether this window is displayed.
2435
2436**System capability**: SystemCapability.WindowManager.WindowManager.Core
2437
2438**Return value**
2439
2440| Type| Description|
2441| ------- | ------------------------------------------------------------------ |
2442| boolean | Whether the window is displayed. The value **true** means that the window is displayed, and **false** means the opposite.|
2443
2444**Error codes**
2445
2446For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2447
2448| ID| Error Message|
2449| ------- | ------------------------------ |
2450| 1300002 | This window state is abnormal. |
2451
2452**Example**
2453
2454```js
2455try {
2456    let data = windowClass.isWindowShowing();
2457    console.info('Succeeded in checking whether the window is showing. Data: ' + JSON.stringify(data));
2458} catch (exception) {
2459    console.error('Failed to check whether the window is showing. Cause: ' + JSON.stringify(exception));
2460}
2461```
2462
2463### on('windowSizeChange')<sup>7+</sup>
2464
2465on(type:  'windowSizeChange', callback: Callback&lt;Size&gt;): void
2466
2467Enables listening for window size changes.
2468
2469**System capability**: SystemCapability.WindowManager.WindowManager.Core
2470
2471**Parameters**
2472
2473| Name  | Type                          | Mandatory| Description                                                    |
2474| -------- | ------------------------------ | ---- | -------------------------------------------------------- |
2475| type     | string                         | Yes  | Event type. The value is fixed at **'windowSizeChange'**, indicating the window size change event.|
2476| callback | Callback&lt;[Size](#size7)&gt; | Yes  | Callback used to return the window size.                          |
2477
2478**Example**
2479
2480```js
2481try {
2482    windowClass.on('windowSizeChange', (data) => {
2483        console.info('Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data));
2484    });
2485} catch (exception) {
2486    console.error('Failed to enable the listener for window size changes. Cause: ' + JSON.stringify(exception));
2487}
2488```
2489
2490### off('windowSizeChange')<sup>7+</sup>
2491
2492off(type: 'windowSizeChange', callback?: Callback&lt;Size&gt;): void
2493
2494Disables listening for window size changes.
2495
2496**System capability**: SystemCapability.WindowManager.WindowManager.Core
2497
2498**Parameters**
2499
2500| Name  | Type                         | Mandatory| Description                                                    |
2501| -------- | ----------------------------- | ---- | -------------------------------------------------------- |
2502| type     | string                        | Yes  | Event type. The value is fixed at **'windowSizeChange'**, indicating the window size change event.|
2503| callback | Callback&lt;[Size](#size7)&gt; | No  | Callback used to return the window size.                          |
2504
2505**Example**
2506
2507```js
2508try {
2509    windowClass.off('windowSizeChange');
2510} catch (exception) {
2511    console.error('Failed to disable the listener for window size changes. Cause: ' + JSON.stringify(exception));
2512}
2513```
2514
2515### on('avoidAreaChange')<sup>9+</sup>
2516
2517on(type: 'avoidAreaChange', callback: Callback&lt;{AvoidAreaType, AvoidArea}&gt;): void
2518
2519Enables listening for changes to the area where the window cannot be displayed.
2520
2521**System capability**: SystemCapability.WindowManager.WindowManager.Core
2522
2523**Parameters**
2524
2525| Name  | Type                                                              | Mandatory| Description                                  |
2526| -------- |------------------------------------------------------------------| ---- |--------------------------------------|
2527| type     | string                                                           | Yes  | Event type. The value is fixed at **'avoidAreaChange'**, indicating the event of changes to the area where the window cannot be displayed.|
2528| callback | Callback&lt;{[AvoidAreaType](#avoidareatype7), [AvoidArea](#avoidarea7)}&gt; | Yes  | Callback used to return the area and area type.|
2529
2530**Example**
2531
2532```js
2533try {
2534    windowClass.on('avoidAreaChange', (data) => {
2535        console.info('Succeeded in enabling the listener for system avoid area changes. type:' +
2536            JSON.stringify(data.type) + ', area: ' + JSON.stringify(data.area));
2537    });
2538} catch (exception) {
2539    console.error('Failed to enable the listener for system avoid area changes. Cause: ' + JSON.stringify(exception));
2540}
2541```
2542
2543### off('avoidAreaChange')<sup>9+</sup>
2544
2545off(type: 'avoidAreaChange', callback?: Callback&lt;{AvoidAreaType, AvoidArea}&gt;): void
2546
2547Disables listening for changes to the area where the window cannot be displayed.
2548
2549**System capability**: SystemCapability.WindowManager.WindowManager.Core
2550
2551**Parameters**
2552
2553| Name  | Type                                                                         | Mandatory | Description                                |
2554| -------- |-----------------------------------------------------------------------------|-----|------------------------------------|
2555| type     | string                                                                      | Yes  | Event type. The value is fixed at **'avoidAreaChange'**, indicating the event of changes to the area where the window cannot be displayed.|
2556| callback | Callback&lt;{[AvoidAreaType](#avoidareatype7), [AvoidArea](#avoidarea7)}&gt; | No  | Callback used to return the area and area type.|
2557
2558**Example**
2559
2560```js
2561try {
2562    windowClass.off('avoidAreaChange');
2563} catch (exception) {
2564    console.error('Failed to disable the listener for system avoid area changes. Cause: ' + JSON.stringify(exception));
2565}
2566```
2567
2568### on('keyboardHeightChange')<sup>7+</sup>
2569
2570on(type: 'keyboardHeightChange', callback: Callback&lt;number&gt;): void
2571
2572Enables listening for keyboard height changes.
2573
2574**System capability**: SystemCapability.WindowManager.WindowManager.Core
2575
2576**Parameters**
2577
2578| Name  | Type               | Mandatory| Description                                                        |
2579| -------- | ------------------- | ---- | ------------------------------------------------------------ |
2580| type     | string              | Yes  | Event type. The value is fixed at **'keyboardHeightChange'**, indicating the keyboard height change event.|
2581| callback | Callback&lt;number&gt; | Yes  | Callback used to return the current keyboard height.                              |
2582
2583**Example**
2584
2585```js
2586try {
2587    windowClass.on('keyboardHeightChange', (data) => {
2588        console.info('Succeeded in enabling the listener for keyboard height changes. Data: ' + JSON.stringify(data));
2589    });
2590} catch (exception) {
2591    console.error('Failed to enable the listener for keyboard height changes. Cause: ' + JSON.stringify(exception));
2592}
2593```
2594
2595### off('keyboardHeightChange')<sup>7+</sup>
2596
2597off(type: 'keyboardHeightChange', callback?: Callback&lt;number&gt;): void
2598
2599Disables listening for keyboard height changes.
2600
2601**System capability**: SystemCapability.WindowManager.WindowManager.Core
2602
2603**Parameters**
2604
2605| Name  | Type                  | Mandatory| Description                                                        |
2606| -------- | ---------------------- | ---- | ------------------------------------------------------------ |
2607| type     | string                 | Yes  | Event type. The value is fixed at **'keyboardHeightChange'**, indicating the keyboard height change event.|
2608| callback | Callback&lt;number&gt; | No  | Callback used to return the current keyboard height.                              |
2609
2610**Example**
2611
2612```js
2613try {
2614    windowClass.off('keyboardHeightChange');
2615} catch (exception) {
2616    console.error('Failed to disable the listener for keyboard height changes. Cause: ' + JSON.stringify(exception));
2617}
2618```
2619
2620### on('touchOutside')<sup>9+</sup>
2621
2622on(type: 'touchOutside', callback: Callback&lt;void&gt;): void
2623
2624Enables listening for click events outside this window.
2625
2626**System API**: This is a system API.
2627
2628**System capability**: SystemCapability.WindowManager.WindowManager.Core
2629
2630**Parameters**
2631
2632| Name  | Type               | Mandatory| Description                                                        |
2633| -------- | ------------------- | ---- | ------------------------------------------------------------ |
2634| type     | string              | Yes  | Event type. The value is fixed at **'touchOutside'**, indicating the click event outside this window.|
2635| callback | Callback&lt;void&gt; | Yes  | Callback used to return the click event outside this window.                              |
2636
2637**Example**
2638
2639```js
2640try {
2641    windowClass.on('touchOutside', () => {
2642        console.info('touch outside');
2643    });
2644} catch (exception) {
2645    console.error('Failed to register callback. Cause: ' + JSON.stringify(exception));
2646}
2647```
2648
2649### off('touchOutside')<sup>9+</sup>
2650
2651off(type: 'touchOutside', callback?: Callback&lt;void&gt;): void
2652
2653Disables listening for click events outside this window.
2654
2655**System API**: This is a system API.
2656
2657**System capability**: SystemCapability.WindowManager.WindowManager.Core
2658
2659**Parameters**
2660
2661| Name  | Type                  | Mandatory| Description                                                        |
2662| -------- | ---------------------- | ---- | ------------------------------------------------------------ |
2663| type     | string                 | Yes  | Event type. The value is fixed at **'touchOutside'**, indicating the click event outside this window.|
2664| callback | Callback&lt;number&gt; | No  | Callback used to return the click event outside this window.                              |
2665
2666**Example**
2667
2668```js
2669try {
2670    windowClass.off('touchOutside');
2671} catch (exception) {
2672    console.error('Failed to unregister callback. Cause: ' + JSON.stringify(exception));
2673}
2674```
2675
2676### on('screenshot')<sup>9+</sup>
2677
2678on(type: 'screenshot', callback: Callback&lt;void&gt;): void
2679
2680Subscribes to screenshot events.
2681
2682**System capability**: SystemCapability.WindowManager.WindowManager.Core
2683
2684**Parameters**
2685
2686| Name  | Type               | Mandatory| Description                                                        |
2687| -------- | ------------------- | ---- | ------------------------------------------------------------ |
2688| type     | string              | Yes  | Event type. The value is fixed at **'screenshot'**, indicating the screenshot event.|
2689| callback | Callback&lt;void&gt; | Yes  | Callback invoked when a screenshot event occurs.                              |
2690
2691**Example**
2692
2693```js
2694try {
2695    windowClass.on('screenshot', () => {
2696        console.info('screenshot happened');
2697    });
2698} catch (exception) {
2699    console.error('Failed to register callback. Cause: ' + JSON.stringify(exception));
2700}
2701```
2702
2703### off('screenshot')<sup>9+</sup>
2704
2705off(type: 'screenshot', callback?: Callback&lt;void&gt;): void
2706
2707Unsubscribes from screenshot events.
2708
2709**System capability**: SystemCapability.WindowManager.WindowManager.Core
2710
2711**Parameters**
2712
2713| Name  | Type                  | Mandatory| Description                                                        |
2714| -------- | ---------------------- | ---- | ------------------------------------------------------------ |
2715| type     | string                 | Yes  | Event type. The value is fixed at **'screenshot'**, indicating the screenshot event.|
2716| callback | Callback&lt;void&gt; | No  | Callback invoked when a screenshot event occurs.|
2717
2718**Example**
2719
2720```js
2721let callback = () => {
2722    console.info('screenshot happened');
2723};
2724try {
2725    windowClass.on('screenshot', callback);
2726} catch (exception) {
2727    console.error('Failed to register callback. Cause: ' + JSON.stringify(exception));
2728}
2729try {
2730    windowClass.off('screenshot', callback);
2731    // If multiple callbacks are enabled in on(), they will all be disabled.
2732    windowClass.off('screenshot');
2733} catch (exception) {
2734    console.error('Failed to unregister callback. Cause: ' + JSON.stringify(exception));
2735}
2736```
2737
2738### bindDialogTarget<sup>9+</sup>
2739
2740bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback&lt;void&gt;, callback: AsyncCallback&lt;void&gt;): void
2741
2742Binds the modal window to the target window, and adds a callback to listen for modal window destruction events. This API uses an asynchronous callback to return the result.
2743
2744**System API**: This is a system API.
2745
2746**System capability**: SystemCapability.WindowManager.WindowManager.Core
2747
2748**Parameters**
2749
2750| Name      | Type                     | Mandatory| Description                 |
2751| ----------- | ------------------------- | ---- | -------------------- |
2752| token       | [rpc.RemoteObject](js-apis-rpc.md#remoteobject) | Yes  | Token of the target window.|
2753| deathCallback | Callback&lt;void&gt;        | Yes  | Callback used to listen for modal window destruction events.|
2754| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
2755
2756**Error codes**
2757
2758For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2759
2760| ID| Error Message|
2761| ------- | -------------------------------------------- |
2762| 1300002 | This window state is abnormal.               |
2763| 1300003 | This window manager service works abnormally. |
2764
2765**Example**
2766
2767```js
2768import rpc from '@ohos.rpc';
2769
2770class MyDeathRecipient {
2771    onRemoteDied() {
2772        console.log('server died');
2773    }
2774}
2775class TestRemoteObject extends rpc.RemoteObject {
2776    constructor(descriptor) {
2777        super(descriptor);
2778    }
2779    addDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
2780        return true;
2781    }
2782    removeDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
2783        return true;
2784    }
2785    isObjectDead(): boolean {
2786        return false;
2787    }
2788}
2789
2790let token = new TestRemoteObject('testObject');
2791try {
2792    windowClass.bindDialogTarget(token, () => {
2793        console.info('Dialog Window Need Destroy.');
2794    }, (err) => {
2795        if (err.code) {
2796            console.error('Failed to bind dialog target. Cause:' + JSON.stringify(err));
2797            return;
2798        }
2799        console.info('Succeeded in binding dialog target.');
2800    });
2801} catch (exception) {
2802    console.error('Failed to bind dialog target. Cause:' + JSON.stringify(exception));
2803}
2804```
2805
2806### bindDialogTarget<sup>9+</sup>
2807
2808bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback&lt;void&gt;): Promise&lt;void&gt;
2809
2810Binds the modal window to the target window, and adds a callback to listen for modal window destruction events. This API uses a promise to return the result.
2811
2812**System API**: This is a system API.
2813
2814**System capability**: SystemCapability.WindowManager.WindowManager.Core
2815
2816**Parameters**
2817
2818| Name      | Type                     | Mandatory| Description                 |
2819| ----------- | ------------------------- | ---- | -------------------- |
2820| token       | [rpc.RemoteObject](js-apis-rpc.md#remoteobject) | Yes  | Token of the target window.|
2821| deathCallback | Callback&lt;void&gt;        | Yes  | Callback used to listen for modal window destruction events.|
2822
2823**Return value**
2824
2825| Type               | Description                     |
2826| ------------------- | ------------------------- |
2827| Promise&lt;void&gt; | Promise that returns no value.|
2828
2829**Error codes**
2830
2831For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2832
2833| ID| Error Message|
2834| ------- | -------------------------------------------- |
2835| 1300002 | This window state is abnormal.               |
2836| 1300003 | This window manager service works abnormally. |
2837
2838**Example**
2839
2840```js
2841import rpc from '@ohos.rpc';
2842
2843class MyDeathRecipient {
2844    onRemoteDied() {
2845        console.log('server died');
2846    }
2847}
2848class TestRemoteObject extends rpc.RemoteObject {
2849    constructor(descriptor) {
2850        super(descriptor);
2851    }
2852    addDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
2853        return true;
2854    }
2855    removeDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
2856        return true;
2857    }
2858    isObjectDead(): boolean {
2859        return false;
2860    }
2861}
2862
2863let token = new TestRemoteObject('testObject');
2864try {
2865    let promise = windowClass.bindDialogTarget(token, () => {
2866        console.info('Dialog Window Need Destroy.');
2867    });
2868    promise.then(()=> {
2869        console.info('Succeeded in binding dialog target.');
2870    }).catch((err)=>{
2871            console.error('Failed to bind dialog target. Cause:' + JSON.stringify(err));
2872    });
2873} catch (exception) {
2874    console.error('Failed to bind dialog target. Cause:' + JSON.stringify(exception));
2875}
2876```
2877
2878### isWindowSupportWideGamut<sup>9+</sup>
2879
2880isWindowSupportWideGamut(callback: AsyncCallback&lt;boolean&gt;): void
2881
2882Checks whether this window supports the wide-gamut color space. This API uses an asynchronous callback to return the result.
2883
2884**System capability**: SystemCapability.WindowManager.WindowManager.Core
2885
2886**Parameters**
2887
2888| Name| Type| Mandatory| Description|
2889| -------- | ---------------------------- | -- | -------------------------------------------------------------------------------- |
2890| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. The value **true** means that the wide-gamut color space is supported, and **false** means the opposite.|
2891
2892**Error codes**
2893
2894For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2895
2896| ID| Error Message|
2897| ------- | ------------------------------ |
2898| 1300002 | This window state is abnormal. |
2899
2900**Example**
2901
2902```js
2903windowClass.isWindowSupportWideGamut((err, data) => {
2904    if (err.code) {
2905        console.error('Failed to check whether the window support WideGamut. Cause:' + JSON.stringify(err));
2906        return;
2907    }
2908    console.info('Succeeded in checking whether the window support WideGamut Data: ' + JSON.stringify(data));
2909});
2910```
2911
2912### isWindowSupportWideGamut<sup>9+</sup>
2913
2914isWindowSupportWideGamut(): Promise&lt;boolean&gt;
2915
2916Checks whether this window supports the wide-gamut color space. This API uses a promise to return the result.
2917
2918**System capability**: SystemCapability.WindowManager.WindowManager.Core
2919
2920**Return value**
2921
2922| Type| Description|
2923| ---------------------- | ------------------------------------------------------------------------------------ |
2924| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means that the wide-gamut color space is supported, and **false** means the opposite.|
2925
2926**Error codes**
2927
2928For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2929
2930| ID| Error Message|
2931| ------- | ------------------------------ |
2932| 1300002 | This window state is abnormal. |
2933
2934**Example**
2935
2936```js
2937let promise = windowClass.isWindowSupportWideGamut();
2938promise.then((data)=> {
2939    console.info('Succeeded in checking whether the window support WideGamut. Data: ' + JSON.stringify(data));
2940}).catch((err)=>{
2941    console.error('Failed to check whether the window support WideGamut. Cause: ' + JSON.stringify(err));
2942});
2943```
2944
2945### setWindowColorSpace<sup>9+</sup>
2946
2947setWindowColorSpace(colorSpace:ColorSpace, callback: AsyncCallback&lt;void&gt;): void
2948
2949Sets a color space for this window. This API uses an asynchronous callback to return the result.
2950
2951**System capability**: SystemCapability.WindowManager.WindowManager.Core
2952
2953**Parameters**
2954
2955| Name| Type| Mandatory| Description|
2956| ---------- | ------------------------- | -- | ----------- |
2957| colorSpace | [ColorSpace](#colorspace8) | Yes| Color space to set.|
2958| callback   | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.  |
2959
2960**Error codes**
2961
2962For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
2963
2964| ID| Error Message|
2965| ------- | ------------------------------ |
2966| 1300002 | This window state is abnormal. |
2967
2968**Example**
2969
2970```js
2971try {
2972    windowClass.setWindowColorSpace(window.ColorSpace.WIDE_GAMUT, (err) => {
2973        if (err.code) {
2974            console.error('Failed to set window colorspace. Cause:' + JSON.stringify(err));
2975            return;
2976        }
2977        console.info('Succeeded in setting window colorspace.');
2978    });
2979} catch (exception) {
2980    console.error('Failed to set window colorspace. Cause:' + JSON.stringify(exception));
2981}
2982```
2983
2984### setWindowColorSpace<sup>9+</sup>
2985
2986setWindowColorSpace(colorSpace:ColorSpace): Promise&lt;void&gt;
2987
2988Sets a color space for this window. This API uses a promise to return the result.
2989
2990**System capability**: SystemCapability.WindowManager.WindowManager.Core
2991
2992**Parameters**
2993
2994| Name| Type| Mandatory| Description|
2995| ---------- | ------------------------- | -- | ------------- |
2996| colorSpace | [ColorSpace](#colorspace8) | Yes| Color space to set.|
2997
2998**Return value**
2999
3000| Type| Description|
3001| ------------------- | ------------------------ |
3002| Promise&lt;void&gt; | Promise that returns no value.|
3003
3004**Error codes**
3005
3006For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3007
3008| ID| Error Message|
3009| ------- | ------------------------------ |
3010| 1300002 | This window state is abnormal. |
3011
3012**Example**
3013
3014```js
3015try {
3016    let promise = windowClass.setWindowColorSpace(window.ColorSpace.WIDE_GAMUT);
3017    promise.then(()=> {
3018        console.info('Succeeded in setting window colorspace.');
3019    }).catch((err)=>{
3020        console.error('Failed to set window colorspace. Cause: ' + JSON.stringify(err));
3021    });
3022} catch (exception) {
3023    console.error('Failed to set window colorspace. Cause:' + JSON.stringify(exception));
3024}
3025```
3026
3027### getWindowColorSpace<sup>9+</sup>
3028
3029getWindowColorSpace(): ColorSpace
3030
3031Obtains the color space of this window.
3032
3033**System capability**: SystemCapability.WindowManager.WindowManager.Core
3034
3035**Return value**
3036
3037| Type| Description|
3038| ------------------------- | ------------- |
3039| [ColorSpace](#colorspace8) | Color space obtained.|
3040
3041**Error codes**
3042
3043For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3044
3045| ID| Error Message|
3046| ------- | ------------------------------ |
3047| 1300002 | This window state is abnormal. |
3048
3049**Example**
3050
3051```js
3052let colorSpace = windowClass.getWindowColorSpace();
3053```
3054
3055### setWindowBackgroundColor<sup>9+</sup>
3056
3057setWindowBackgroundColor(color: string): void
3058
3059Sets the background color for this window. In the stage model, this API must be used after the call of [loadContent](#loadcontent9) or [setUIContent()](#setuicontent9) takes effect.
3060
3061**System capability**: SystemCapability.WindowManager.WindowManager.Core
3062
3063**Parameters**
3064
3065| Name| Type| Mandatory| Description|
3066| ----- | ------ | -- | ----------------------------------------------------------------------- |
3067| color | string | Yes| Background color to set. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
3068
3069**Error codes**
3070
3071For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3072
3073| ID| Error Message|
3074| ------- | ------------------------------ |
3075| 1300002 | This window state is abnormal. |
3076
3077**Example**
3078
3079```js
3080let color = '#00ff33';
3081try {
3082    windowClass.setWindowBackgroundColor(color);
3083} catch (exception) {
3084    console.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
3085}
3086```
3087
3088### setWindowBrightness<sup>9+</sup>
3089
3090setWindowBrightness(brightness: number, callback: AsyncCallback&lt;void&gt;): void
3091
3092Sets the screen brightness for this window. This API uses an asynchronous callback to return the result.
3093
3094When the screen brightness setting for the window takes effect, Control Panel cannot adjust the system screen brightness. It can do so only after the window screen brightness is restored to the default value.
3095
3096**System capability**: SystemCapability.WindowManager.WindowManager.Core
3097
3098**Parameters**
3099
3100| Name| Type| Mandatory| Description|
3101| ---------- | ------------------------- | -- | --------------------------------- |
3102| brightness | number                    | Yes| Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.|
3103| callback   | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                        |
3104
3105**Error codes**
3106
3107For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3108
3109| ID| Error Message|
3110| ------- | -------------------------------------------- |
3111| 1300002 | This window state is abnormal.               |
3112| 1300003 | This window manager service works abnormally. |
3113
3114**Example**
3115
3116```js
3117let brightness = 1;
3118try {
3119    windowClass.setWindowBrightness(brightness, (err) => {
3120        if (err.code) {
3121            console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
3122            return;
3123        }
3124        console.info('Succeeded in setting the brightness.');
3125    });
3126} catch (exception) {
3127    console.error('Failed to set the brightness. Cause: ' + JSON.stringify(exception));
3128}
3129```
3130
3131### setWindowBrightness<sup>9+</sup>
3132
3133setWindowBrightness(brightness: number): Promise&lt;void&gt;
3134
3135Sets the screen brightness for this window. This API uses a promise to return the result.
3136
3137When the screen brightness setting for the window takes effect, Control Panel cannot adjust the system screen brightness. It can do so only after the window screen brightness is restored to the default value.
3138
3139**System capability**: SystemCapability.WindowManager.WindowManager.Core
3140
3141**Parameters**
3142
3143| Name| Type| Mandatory| Description|
3144| ---------- | ------ | -- | --------------------------------- |
3145| brightness | number | Yes| Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.|
3146
3147**Return value**
3148
3149| Type| Description|
3150| ------------------- | ------------------------ |
3151| Promise&lt;void&gt; | Promise that returns no value.|
3152
3153**Error codes**
3154
3155For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3156
3157| ID| Error Message|
3158| ------- | -------------------------------------------- |
3159| 1300002 | This window state is abnormal.               |
3160| 1300003 | This window manager service works abnormally. |
3161
3162**Example**
3163
3164```js
3165let brightness = 1;
3166try {
3167    let promise = windowClass.setWindowBrightness(brightness);
3168    promise.then(()=> {
3169        console.info('Succeeded in setting the brightness.');
3170    }).catch((err)=>{
3171        console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
3172    });
3173} catch (exception) {
3174    console.error('Failed to set the brightness. Cause: ' + JSON.stringify(exception));
3175}
3176```
3177
3178### setWindowFocusable<sup>9+</sup>
3179
3180setWindowFocusable(isFocusable: boolean, callback: AsyncCallback&lt;void&gt;): void
3181
3182Sets whether this window can gain focus. This API uses an asynchronous callback to return the result.
3183
3184**System capability**: SystemCapability.WindowManager.WindowManager.Core
3185
3186**Parameters**
3187
3188| Name| Type| Mandatory| Description|
3189| ----------- | ------------------------- | -- | ------------------------------------------------------- |
3190| isFocusable | boolean                   | Yes| Whether the window can gain focus. The value **true** means that the window can gain focus, and **false** means the opposite.|
3191| callback    | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                                              |
3192
3193**Error codes**
3194
3195For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3196
3197| ID| Error Message|
3198| ------- | -------------------------------------------- |
3199| 1300002 | This window state is abnormal.               |
3200| 1300003 | This window manager service works abnormally. |
3201
3202**Example**
3203
3204```js
3205let isFocusable = true;
3206try {
3207    windowClass.setWindowFocusable(isFocusable, (err) => {
3208        if (err.code) {
3209            console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(err));
3210            return;
3211        }
3212        console.info('Succeeded in setting the window to be focusable.');
3213    });
3214} catch (exception) {
3215    console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(exception));
3216}
3217```
3218
3219### setWindowFocusable<sup>9+</sup>
3220
3221setWindowFocusable(isFocusable: boolean): Promise&lt;void&gt;
3222
3223Sets whether this window can gain focus. This API uses a promise to return the result.
3224
3225**System capability**: SystemCapability.WindowManager.WindowManager.Core
3226
3227**Parameters**
3228
3229| Name| Type| Mandatory| Description|
3230| ----------- | ------- | -- | -------------------------------------------------------- |
3231| isFocusable | boolean | Yes| Whether the window can gain focus. The value **true** means that the window can gain focus, and **false** means the opposite. |
3232
3233**Return value**
3234
3235| Type| Description|
3236| ------------------- | ------------------------ |
3237| Promise&lt;void&gt; | Promise that returns no value.|
3238
3239**Error codes**
3240
3241For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3242
3243| ID| Error Message|
3244| ------- | -------------------------------------------- |
3245| 1300002 | This window state is abnormal.               |
3246| 1300003 | This window manager service works abnormally. |
3247
3248**Example**
3249
3250```js
3251let isFocusable = true;
3252try {
3253    let promise = windowClass.setWindowFocusable(isFocusable);
3254    promise.then(()=> {
3255        console.info('Succeeded in setting the window to be focusable.');
3256    }).catch((err)=>{
3257        console.error('Failed to set the window to be focusable. Cause: ' + JSON.stringify(err));
3258    });
3259} catch (exception) {
3260    console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(exception));
3261}
3262```
3263
3264### setWindowKeepScreenOn<sup>9+</sup>
3265
3266setWindowKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback&lt;void&gt;): void
3267
3268Sets whether to keep the screen always on. This API uses an asynchronous callback to return the result.
3269
3270**System capability**: SystemCapability.WindowManager.WindowManager.Core
3271
3272**Parameters**
3273
3274| Name| Type| Mandatory| Description|
3275| -------------- | ------------------------- | -- | ---------------------------------------------------- |
3276| isKeepScreenOn | boolean                   | Yes| Whether to keep the screen always on. The value **true** means to keep the screen always on, and **false** means the opposite. |
3277| callback       | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                                           |
3278
3279**Error codes**
3280
3281For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3282
3283| ID| Error Message|
3284| ------- | -------------------------------------------- |
3285| 1300002 | This window state is abnormal.               |
3286| 1300003 | This window manager service works abnormally. |
3287
3288**Example**
3289
3290```js
3291let isKeepScreenOn = true;
3292try {
3293    windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err) => {
3294        if (err.code) {
3295            console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(err));
3296            return;
3297        }
3298        console.info('Succeeded in setting the screen to be always on.');
3299    });
3300} catch (exception) {
3301    console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(exception));
3302}
3303```
3304
3305### setWindowKeepScreenOn<sup>9+</sup>
3306
3307setWindowKeepScreenOn(isKeepScreenOn: boolean): Promise&lt;void&gt;
3308
3309Sets whether to keep the screen always on. This API uses a promise to return the result.
3310
3311**System capability**: SystemCapability.WindowManager.WindowManager.Core
3312
3313**Parameters**
3314
3315| Name| Type| Mandatory| Description|
3316| -------------- | ------- | -- | --------------------------------------------------- |
3317| isKeepScreenOn | boolean | Yes| Whether to keep the screen always on. The value **true** means to keep the screen always on, and **false** means the opposite.|
3318
3319**Return value**
3320
3321| Type| Description|
3322| ------------------- | ------------------------ |
3323| Promise&lt;void&gt; | Promise that returns no value.|
3324
3325**Error codes**
3326
3327For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3328
3329| ID| Error Message|
3330| ------- | -------------------------------------------- |
3331| 1300002 | This window state is abnormal.               |
3332| 1300003 | This window manager service works abnormally. |
3333
3334**Example**
3335
3336```js
3337let isKeepScreenOn = true;
3338try {
3339    let promise = windowClass.setWindowKeepScreenOn(isKeepScreenOn);
3340    promise.then(() => {
3341        console.info('Succeeded in setting the screen to be always on.');
3342    }).catch((err)=>{
3343        console.info('Failed to set the screen to be always on. Cause:  ' + JSON.stringify(err));
3344    });
3345} catch (exception) {
3346    console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(exception));
3347}
3348```
3349
3350### setWakeUpScreen()<sup>9+</sup>
3351
3352setWakeUpScreen(wakeUp: boolean): void
3353
3354Wakes up the screen.
3355
3356**System API**: This is a system API.
3357
3358**System capability**: SystemCapability.WindowManager.WindowManager.Core
3359
3360**Parameters**
3361
3362| Name          | Type   | Mandatory| Description                        |
3363| ---------------- | ------- | ---- | ---------------------------- |
3364| wakeUp           | boolean | Yes  | Whether to wake up the screen. The value **true** means to wake up the screen, and **false** means the opposite. |
3365
3366**Error codes**
3367
3368For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3369
3370| ID| Error Message|
3371| ------- | -------------------------------------------- |
3372| 1300002 | This window state is abnormal.               |
3373| 1300003 | This window manager service works abnormally. |
3374
3375**Example**
3376
3377```js
3378let wakeUp = true;
3379try {
3380    windowClass.setWakeUpScreen(wakeUp);
3381} catch (exception) {
3382    console.error('Failed to wake up the screen. Cause: ' + JSON.stringify(exception));
3383}
3384```
3385
3386### setWindowPrivacyMode<sup>9+</sup>
3387
3388setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback&lt;void&gt;): void
3389
3390Sets whether this window is in privacy mode. This API uses an asynchronous callback to return the result. When in privacy mode, the window content cannot be captured or recorded.
3391
3392**System capability**: SystemCapability.WindowManager.WindowManager.Core
3393
3394**Required permissions**: ohos.permission.PRIVACY_WINDOW
3395
3396**Parameters**
3397
3398| Name| Type| Mandatory| Description|
3399| ------------- | ------------------------- | -- | ------------------------------------------------------ |
3400| isPrivacyMode | boolean                   | Yes| Whether the window is in privacy mode. The value **true** means that the window is in privacy mode, and **false** means the opposite. |
3401| callback      | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                                             |
3402
3403**Error codes**
3404
3405For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3406
3407| ID| Error Message|
3408| ------- | ------------------------------ |
3409| 1300002 | This window state is abnormal. |
3410
3411**Example**
3412
3413```js
3414let isPrivacyMode = true;
3415try {
3416    windowClass.setWindowPrivacyMode(isPrivacyMode, (err) => {
3417        if (err.code) {
3418            console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(err));
3419            return;
3420        }
3421        console.info('Succeeded in setting the window to privacy mode.');
3422    });
3423} catch (exception) {
3424    console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(exception));
3425}
3426```
3427
3428### setWindowPrivacyMode<sup>9+</sup>
3429
3430setWindowPrivacyMode(isPrivacyMode: boolean): Promise&lt;void&gt;
3431
3432Sets whether this window is in privacy mode. This API uses a promise to return the result. When in privacy mode, the window content cannot be captured or recorded.
3433
3434**System capability**: SystemCapability.WindowManager.WindowManager.Core
3435
3436**Required permissions**: ohos.permission.PRIVACY_WINDOW
3437
3438**Parameters**
3439
3440| Name| Type| Mandatory| Description|
3441| ------------- | ------- | -- | ----------------------------------------------------- |
3442| isPrivacyMode | boolean | Yes| Whether the window is in privacy mode. The value **true** means that the window is in privacy mode, and **false** means the opposite.|
3443
3444**Return value**
3445
3446| Type| Description|
3447| ------------------- | ------------------------ |
3448| Promise&lt;void&gt; | Promise that returns no value.|
3449
3450**Error codes**
3451
3452For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3453
3454| ID| Error Message|
3455| ------- | ------------------------------ |
3456| 1300002 | This window state is abnormal. |
3457
3458**Example**
3459
3460```js
3461let isPrivacyMode = true;
3462try {
3463    let promise = windowClass.setWindowPrivacyMode(isPrivacyMode);
3464    promise.then(()=> {
3465        console.info('Succeeded in setting the window to privacy mode.');
3466    }).catch((err)=>{
3467        console.error('Failed to set the window to privacy mode. Cause: ' + JSON.stringify(err));
3468    });
3469} catch (exception) {
3470    console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(exception));
3471}
3472```
3473
3474### setSnapshotSkip<sup>9+</sup>
3475setSnapshotSkip(isSkip: boolean): void
3476
3477Sets whether to ignore this window during screen capturing or recording.
3478
3479**System API**: This is a system API.
3480
3481**System capability**: SystemCapability.WindowManager.WindowManager.Core
3482
3483**Parameters**
3484
3485| Name       | Type   | Mandatory| Description                |
3486| ------------- | ------- | ---- | -------------------- |
3487| isSkip | boolean | Yes  | Whether to ignore the window. The default value is **false**.<br>The value **true** means that the window is ignored, and **false** means the opposite.<br>|
3488
3489**Error codes**
3490
3491For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3492
3493| ID| Error Message|
3494| ------- | ------------------------------ |
3495| 1300002 | This window state is abnormal. |
3496
3497```js
3498let isSkip = true;
3499try {
3500    windowClass.setSnapshotSkip(isSkip);
3501} catch (exception) {
3502    console.error('Failed to Skip. Cause: ' + JSON.stringify(exception));
3503};
3504```
3505
3506### setWindowTouchable<sup>9+</sup>
3507
3508setWindowTouchable(isTouchable: boolean, callback: AsyncCallback&lt;void&gt;): void
3509
3510Sets whether this window is touchable. This API uses an asynchronous callback to return the result.
3511
3512**System capability**: SystemCapability.WindowManager.WindowManager.Core
3513
3514**Parameters**
3515
3516| Name| Type| Mandatory| Description|
3517| ----------- | ------------------------- | -- | ----------------------------------------------- |
3518| isTouchable | boolean                   | Yes| Whether the window is touchable. The value **true** means that the window is touchable, and **false** means the opposite.|
3519| callback    | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                                       |
3520
3521**Error codes**
3522
3523For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3524
3525| ID| Error Message|
3526| ------- | -------------------------------------------- |
3527| 1300002 | This window state is abnormal.               |
3528| 1300003 | This window manager service works abnormally. |
3529
3530**Example**
3531
3532```js
3533let isTouchable = true;
3534try {
3535    windowClass.setWindowTouchable(isTouchable, (err) => {
3536        if (err.code) {
3537            console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(err));
3538            return;
3539        }
3540        console.info('Succeeded in setting the window to be touchable.');
3541    });
3542} catch (exception) {
3543    console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(exception));
3544}
3545```
3546
3547### setWindowTouchable<sup>9+</sup>
3548
3549setWindowTouchable(isTouchable: boolean): Promise&lt;void&gt;
3550
3551Sets whether this window is touchable. This API uses a promise to return the result.
3552
3553**System capability**: SystemCapability.WindowManager.WindowManager.Core
3554
3555**Parameters**
3556
3557| Name| Type| Mandatory| Description|
3558| ----------- | ------- | -- | ----------------------------------------------- |
3559| isTouchable | boolean | Yes| Whether the window is touchable. The value **true** means that the window is touchable, and **false** means the opposite.|
3560
3561**Return value**
3562
3563| Type| Description|
3564| ------------------- | ------------------------- |
3565| Promise&lt;void&gt; | Promise that returns no value.|
3566
3567**Error codes**
3568
3569For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3570
3571| ID| Error Message|
3572| ------- | -------------------------------------------- |
3573| 1300002 | This window state is abnormal.               |
3574| 1300003 | This window manager service works abnormally. |
3575
3576**Example**
3577
3578```js
3579let isTouchable = true;
3580try {
3581    let promise = windowClass.setWindowTouchable(isTouchable);
3582    promise.then(()=> {
3583        console.info('Succeeded in setting the window to be touchable.');
3584    }).catch((err)=>{
3585        console.error('Failed to set the window to be touchable. Cause: ' + JSON.stringify(err));
3586    });
3587} catch (exception) {
3588    console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(exception));
3589}
3590```
3591
3592### setForbidSplitMove<sup>9+</sup>
3593
3594setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback&lt;void&gt;): void
3595
3596Sets whether this window is forbidden to move in split-screen mode. This API uses an asynchronous callback to return the result.
3597
3598**System API**: This is a system API.
3599
3600**System capability**: SystemCapability.WindowManager.WindowManager.Core
3601
3602**Parameters**
3603
3604| Name     | Type                     | Mandatory| Description                |
3605| ----------- | ------------------------- | ---- | -------------------- |
3606| isForbidSplitMove | boolean                   | Yes  | Whether the window is forbidden to move in split-screen mode. The value **true** means the window is forbidden to move in split-screen mode, and **false** means the opposite.|
3607| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
3608
3609**Error codes**
3610
3611For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3612
3613| ID| Error Message|
3614| ------- | -------------------------------------------- |
3615| 1300002 | This window state is abnormal.               |
3616| 1300003 | This window manager service works abnormally. |
3617
3618**Example**
3619
3620```js
3621let isForbidSplitMove = true;
3622try {
3623    windowClass.setForbidSplitMove(isForbidSplitMove, (err) => {
3624        if (err.code) {
3625            console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(err));
3626            return;
3627        }
3628        console.info('Succeeded in forbidding window moving in split screen mode.');
3629    });
3630} catch (exception) {
3631    console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(exception));
3632}
3633```
3634
3635### setForbidSplitMove<sup>9+</sup>
3636
3637setForbidSplitMove(isForbidSplitMove: boolean): Promise&lt;void&gt;
3638
3639Sets whether this window is forbidden to move in split-screen mode. This API uses a promise to return the result.
3640
3641**System API**: This is a system API.
3642
3643**System capability**: SystemCapability.WindowManager.WindowManager.Core
3644
3645**Parameters**
3646
3647| Name     | Type   | Mandatory| Description                |
3648| ----------- | ------- | ---- | -------------------- |
3649| isForbidSplitMove | boolean | Yes  | Whether the window is forbidden to move in split-screen mode. The value **true** means the window is forbidden to move in split-screen mode, and **false** means the opposite.|
3650
3651**Return value**
3652
3653| Type               | Description                     |
3654| ------------------- | ------------------------- |
3655| Promise&lt;void&gt; | Promise that returns no value.|
3656
3657**Error codes**
3658
3659For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3660
3661| ID| Error Message|
3662| ------- | -------------------------------------------- |
3663| 1300002 | This window state is abnormal.               |
3664| 1300003 | This window manager service works abnormally. |
3665
3666**Example**
3667
3668```js
3669let isForbidSplitMove = true;
3670try {
3671    let promise = windowClass.setForbidSplitMove(isForbidSplitMove);
3672    promise.then(()=> {
3673        console.info('Succeeded in forbidding window moving in split screen mode.');
3674    }).catch((err)=>{
3675        console.error('Failed to forbid window moving in split screen mode. Cause: ' + JSON.stringify(err));
3676    });
3677} catch (exception) {
3678    console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(exception));
3679}
3680```
3681
3682### snapshot<sup>9+</sup>
3683
3684snapshot(callback: AsyncCallback&lt;image.PixelMap&gt;): void
3685
3686Captures this window. This API uses an asynchronous callback to return the result.
3687
3688**System capability**: SystemCapability.WindowManager.WindowManager.Core
3689
3690**Parameters**
3691
3692| Name     | Type                     | Mandatory| Description                |
3693| ----------- | ------------------------- | ---- | -------------------- |
3694| callback    | AsyncCallback&lt;[image.PixelMap](js-apis-image.md#pixelmap7)&gt; | Yes  | Callback used to return the result. |
3695
3696**Error codes**
3697
3698For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3699
3700| ID| Error Message|
3701| ------- | ------------------------------ |
3702| 1300002 | This window state is abnormal. |
3703
3704**Example**
3705
3706```js
3707windowClass.snapshot((err, pixelMap) => {
3708    if (err.code) {
3709        console.error('Failed to snapshot window. Cause:' + JSON.stringify(err));
3710        return;
3711    }
3712    console.info('Succeeded in snapshotting window. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
3713    pixelMap.release(); // Release the memory in time after the PixelMap is used.
3714});
3715```
3716
3717### snapshot<sup>9+</sup>
3718
3719snapshot(): Promise&lt;image.PixelMap&gt;
3720
3721Captures this window. This API uses a promise to return the result.
3722
3723**System capability**: SystemCapability.WindowManager.WindowManager.Core
3724
3725**Return value**
3726
3727| Type               | Description                     |
3728| ------------------- | ------------------------- |
3729| Promise&lt;[image.PixelMap](js-apis-image.md#pixelmap7)&gt; | Promise used to return the window screenshot.|
3730
3731**Error codes**
3732
3733For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3734
3735| ID| Error Message|
3736| ------- | ------------------------------ |
3737| 1300002 | This window state is abnormal. |
3738
3739**Example**
3740
3741```js
3742let promise = windowClass.snapshot();
3743promise.then((pixelMap)=> {
3744    console.info('Succeeded in snapshotting window. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
3745    pixelMap.release(); // Release the memory in time after the PixelMap is used.
3746}).catch((err)=>{
3747    console.error('Failed to snapshot window. Cause:' + JSON.stringify(err));
3748});
3749```
3750
3751### opacity<sup>9+</sup>
3752
3753opacity(opacity: number): void
3754
3755Sets the opacity for this window. This API can be used only when you [customize an animation to be played during the display or hiding of a system window](../../windowmanager/system-window-stage.md#customizing-an-animation-to-be-played-during-the-display-or-hiding-of-a-system-window).
3756
3757**System API**: This is a system API.
3758
3759**System capability**: SystemCapability.WindowManager.WindowManager.Core
3760
3761**Parameters**
3762
3763| Name | Type  | Mandatory| Description                                                       |
3764| ------- | ------ | ---- | ----------------------------------------------------------- |
3765| opacity | number | Yes  | Opacity to set. The value ranges from 0.0 to 1.0. The value **0.0** means completely transparent, and **1.0** means completely opaque.|
3766
3767**Error codes**
3768
3769For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3770
3771| ID| Error Message|
3772| ------- | ------------------------------ |
3773| 1300002 | This window state is abnormal. |
3774| 1300004 | Unauthorized operation.  |
3775
3776**Example**
3777
3778```js
3779try {
3780    windowClass.opacity(0.5);
3781} catch (exception) {
3782    console.error('Failed to opacity. Cause: ' + JSON.stringify(exception));
3783}
3784```
3785
3786### scale<sup>9+</sup>
3787
3788scale(scaleOptions: ScaleOptions): void
3789
3790Sets the scale parameters for this window. This API can be used only when you [customize an animation to be played during the display or hiding of a system window](../../windowmanager/system-window-stage.md#customizing-an-animation-to-be-played-during-the-display-or-hiding-of-a-system-window).
3791
3792**System API**: This is a system API.
3793
3794**System capability**: SystemCapability.WindowManager.WindowManager.Core
3795
3796**Parameters**
3797
3798| Name      | Type                          | Mandatory| Description      |
3799| ------------ | ------------------------------ | ---- | ---------- |
3800| scaleOptions | [ScaleOptions](#scaleoptions9) | Yes  | Scale parameters to set.|
3801
3802**Error codes**
3803
3804For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3805
3806| ID| Error Message|
3807| ------- | ------------------------------ |
3808| 1300002 | This window state is abnormal. |
3809| 1300004 | Unauthorized operation.  |
3810
3811**Example**
3812
3813```js
3814let obj : window.ScaleOptions = {
3815  x : 2.0,
3816  y : 1.0,
3817  pivotX : 0.5,
3818  pivotY : 0.5
3819};
3820try {
3821    windowClass.scale(obj);
3822} catch (exception) {
3823    console.error('Failed to scale. Cause: ' + JSON.stringify(exception));
3824}
3825```
3826
3827### rotate<sup>9+</sup>
3828
3829rotate(rotateOptions: RotateOptions): void
3830
3831Sets the rotation parameters for this window. This API can be used only when you [customize an animation to be played during the display or hiding of a system window](../../windowmanager/system-window-stage.md#customizing-an-animation-to-be-played-during-the-display-or-hiding-of-a-system-window).
3832
3833**System API**: This is a system API.
3834
3835**System capability**: SystemCapability.WindowManager.WindowManager.Core
3836
3837**Parameters**
3838
3839| Name       | Type                            | Mandatory| Description      |
3840| ------------- | -------------------------------- | ---- | ---------- |
3841| rotateOptions | [RotateOptions](#rotateoptions9) | Yes  | Rotation parameters to set.|
3842
3843**Error codes**
3844
3845For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3846
3847| ID| Error Message|
3848| ------- | ------------------------------ |
3849| 1300002 | This window state is abnormal. |
3850| 1300004 | Unauthorized operation.  |
3851
3852**Example**
3853
3854```js
3855let obj : window.RotateOptions = {
3856  x : 1.0,
3857  y : 1.0,
3858  z : 45.0,
3859  pivotX : 0.5,
3860  pivotY : 0.5
3861};
3862try {
3863    windowClass.rotate(obj);
3864} catch (exception) {
3865    console.error('Failed to rotate. Cause: ' + JSON.stringify(exception));
3866}
3867```
3868
3869### translate<sup>9+</sup>
3870
3871translate(translateOptions: TranslateOptions): void
3872
3873Sets the translation parameters for this window. This API can be used only when you [customize an animation to be played during the display or hiding of a system window](../../windowmanager/system-window-stage.md#customizing-an-animation-to-be-played-during-the-display-or-hiding-of-a-system-window).
3874
3875**System API**: This is a system API.
3876
3877**System capability**: SystemCapability.WindowManager.WindowManager.Core
3878
3879**Parameters**
3880
3881| Name          | Type                                  | Mandatory| Description                |
3882| ---------------- | -------------------------------------- | ---- | -------------------- |
3883| translateOptions | [TranslateOptions](#translateoptions9) | Yes  | Translation parameters. The unit is pixels.|
3884
3885**Error codes**
3886
3887For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3888
3889| ID| Error Message|
3890| ------- | ------------------------------ |
3891| 1300002 | This window state is abnormal. |
3892| 1300004 | Unauthorized operation.  |
3893
3894**Example**
3895
3896```js
3897let obj : window.TranslateOptions = {
3898  x : 100.0,
3899  y : 0.0,
3900  z : 0.0
3901};
3902try {
3903    windowClass.translate(obj);
3904} catch (exception) {
3905    console.error('Failed to translate. Cause: ' + JSON.stringify(exception));
3906}
3907```
3908
3909###  getTransitionController<sup>9+</sup>
3910
3911 getTransitionController(): TransitionController
3912
3913Obtains the transition animation controller.
3914
3915**System API**: This is a system API.
3916
3917**System capability**: SystemCapability.WindowManager.WindowManager.Core
3918
3919**Return value**
3920
3921| Type                                          | Description            |
3922| ---------------------------------------------- | ---------------- |
3923| [TransitionController](#transitioncontroller9) | Transition animation controller.|
3924
3925**Error codes**
3926
3927For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3928
3929| ID| Error Message|
3930| ------- | ------------------------------ |
3931| 1300002 | This window state is abnormal. |
3932| 1300004 | Unauthorized operation.  |
3933
3934**Example**
3935
3936```js
3937let controller = windowClass.getTransitionController(); // Obtain the transition animation controller.
3938controller.animationForHidden = (context : window.TransitionContext) => {
3939	let toWindow = context.toWindow;
3940 	animateTo({
3941    	duration: 1000, // Animation duration.
3942        tempo: 0.5, // Playback speed.
3943        curve: Curve.EaseInOut, // Animation curve.
3944        delay: 0, // Animation delay.
3945        iterations: 1, // Number of playback times.
3946        playMode: PlayMode.Normal // Animation playback mode.
3947        onFinish: ()=> {
3948            context.completeTransition(true)
3949        }
3950      }, () => {
3951        let obj : window.TranslateOptions = {
3952          x : 100.0,
3953          y : 0.0,
3954          z : 0.0
3955        };
3956        toWindow.translate(obj); // Set the transition animation.
3957        console.info('toWindow translate end');
3958      }
3959    );
3960    console.info('complete transition end');
3961};
3962windowClass.hideWithAnimation((err, data) => {
3963    if (err.code) {
3964        console.error('Failed to show the window with animation. Cause: ' + JSON.stringify(err));
3965        return;
3966    }
3967    console.info('Succeeded in showing the window with animation. Data: ' + JSON.stringify(data));
3968});
3969```
3970
3971### setBlur<sup>9+</sup>
3972
3973setBlur(radius: number): void
3974
3975Blurs this window.
3976
3977**System API**: This is a system API.
3978
3979**System capability**: SystemCapability.WindowManager.WindowManager.Core
3980
3981**Parameters**
3982
3983| Name| Type  | Mandatory| Description                                                        |
3984| ------ | ------ | ---- | ------------------------------------------------------------ |
3985| radius | number | Yes  | Radius of the blur. The value is greater than or equal to 0. The value **0** means that the blur is disabled for the window.|
3986
3987**Error codes**
3988
3989For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3990
3991| ID| Error Message|
3992| ------- | ------------------------------ |
3993| 1300002 | This window state is abnormal. |
3994| 1300004 | Unauthorized operation.  |
3995
3996**Example**
3997
3998```js
3999try {
4000    windowClass.setBlur(4.0);
4001} catch (exception) {
4002    console.error('Failed to set blur. Cause: ' + JSON.stringify(exception));
4003}
4004```
4005
4006### setBackdropBlur<sup>9+</sup>
4007
4008setBackdropBlur(radius: number): void
4009
4010Blurs the background of this window.
4011
4012**System API**: This is a system API.
4013
4014**System capability**: SystemCapability.WindowManager.WindowManager.Core
4015
4016**Parameters**
4017
4018| Name| Type  | Mandatory| Description                                                        |
4019| ------ | ------ | ---- | ------------------------------------------------------------ |
4020| radius | number | Yes  | Radius of the blur. The value is greater than or equal to 0. The value **0** means that the blur is disabled for the background of the window.|
4021
4022**Error codes**
4023
4024For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
4025
4026| ID| Error Message|
4027| ------- | ------------------------------ |
4028| 1300002 | This window state is abnormal. |
4029| 1300004 | Unauthorized operation.  |
4030
4031**Example**
4032
4033```js
4034try {
4035    windowClass.setBackdropBlur(4.0);
4036} catch (exception) {
4037    console.error('Failed to set backdrop blur. Cause: ' + JSON.stringify(exception));
4038}
4039```
4040
4041### setBackdropBlurStyle<sup>9+</sup>
4042
4043setBackdropBlurStyle(blurStyle: BlurStyle): void
4044
4045Sets the blur style for the background of this window.
4046
4047**System API**: This is a system API.
4048
4049**System capability**: SystemCapability.WindowManager.WindowManager.Core
4050
4051**Parameters**
4052
4053| Name   | Type     | Mandatory| Description                  |
4054| --------- | --------- | ---- | ---------------------- |
4055| blurStyle | [BlurStyle](#blurstyle9) | Yes  | Blur style to set for the background of the window.|
4056
4057**Error codes**
4058
4059For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
4060
4061| ID| Error Message|
4062| ------- | ------------------------------ |
4063| 1300002 | This window state is abnormal. |
4064| 1300004 | Unauthorized operation.  |
4065
4066**Example**
4067
4068```js
4069try {
4070    windowClass.setBackdropBlurStyle(window.BlurStyle.THIN);
4071} catch (exception) {
4072    console.error('Failed to set backdrop blur style. Cause: ' + JSON.stringify(exception));
4073}
4074```
4075
4076### setShadow<sup>9+</sup>
4077
4078setShadow(radius: number, color?: string, offsetX?: number, offsetY?: number): void
4079
4080Sets the shadow for the window borders.
4081
4082**System API**: This is a system API.
4083
4084**System capability**: SystemCapability.WindowManager.WindowManager.Core
4085
4086**Parameters**
4087
4088| Name | Type  | Mandatory| Description                                                        |
4089| ------- | ------ | ---- | ------------------------------------------------------------ |
4090| radius  | number | Yes  | Radius of the shadow. The value is greater than or equal to 0. The value **0** means that the shadow is disabled for the window borders.|
4091| color   | string | No  | Color of the shadow. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
4092| offsetX | number | No  | Offset of the shadow along the x-axis, in pixels.                   |
4093| offsetY | number | No  | Offset of the shadow along the y-axis, in pixels.                   |
4094
4095**Error codes**
4096
4097For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
4098
4099| ID| Error Message|
4100| ------- | ------------------------------ |
4101| 1300002 | This window state is abnormal. |
4102| 1300004 | Unauthorized operation.  |
4103
4104**Example**
4105
4106```js
4107try {
4108    windowClass.setShadow(4.0, '#FF00FF00', 2, 3);
4109} catch (exception) {
4110    console.error('Failed to set shadow. Cause: ' + JSON.stringify(exception));
4111}
4112```
4113
4114### setCornerRadius<sup>9+</sup>
4115
4116setCornerRadius(cornerRadius: number): void
4117
4118Sets the radius of the rounded corners for this window.
4119
4120**System API**: This is a system API.
4121
4122**System capability**: SystemCapability.WindowManager.WindowManager.Core
4123
4124**Parameters**
4125
4126| Name     | Type   | Mandatory| Description                |
4127| ----------- | ------- | ---- | -------------------- |
4128| radius | number | Yes  | Radius of the rounded corners. The value is greater than or equal to 0. The value **0** means that the window does not use rounded corners.|
4129
4130**Error codes**
4131
4132For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
4133
4134| ID| Error Message|
4135| ------- | ------------------------------ |
4136| 1300002 | This window state is abnormal. |
4137| 1300004 | Unauthorized operation.  |
4138
4139**Example**
4140
4141```js
4142try {
4143    windowClass.setCornerRadius(4.0);
4144} catch (exception) {
4145    console.error('Failed to set corner radius. Cause: ' + JSON.stringify(exception));
4146}
4147```
4148
4149### show<sup>(deprecated)</sup>
4150
4151show(callback: AsyncCallback&lt;void&gt;): void
4152
4153Shows this window. This API uses an asynchronous callback to return the result.
4154
4155> **NOTE**
4156>
4157> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [showWindow()](#showwindow9) instead.
4158
4159**System capability**: SystemCapability.WindowManager.WindowManager.Core
4160
4161**Parameters**
4162
4163| Name  | Type                     | Mandatory| Description      |
4164| -------- | ------------------------- | ---- | ---------- |
4165| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
4166
4167**Example**
4168
4169```js
4170windowClass.show((err) => {
4171    if (err.code) {
4172        console.error('Failed to show the window. Cause: ' + JSON.stringify(err));
4173        return;
4174    }
4175    console.info('Succeeded in showing the window.');
4176});
4177```
4178
4179### show<sup>(deprecated)</sup>
4180
4181show(): Promise&lt;void&gt;
4182
4183Shows this window. This API uses a promise to return the result.
4184
4185> **NOTE**
4186>
4187> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [showWindow()](#showwindow9-1) instead.
4188
4189**System capability**: SystemCapability.WindowManager.WindowManager.Core
4190
4191**Return value**
4192
4193| Type               | Description                     |
4194| ------------------- | ------------------------- |
4195| Promise&lt;void&gt; | Promise that returns no value.|
4196
4197**Example**
4198
4199```js
4200let promise = windowClass.show();
4201promise.then(()=> {
4202    console.info('Succeeded in showing the window.');
4203}).catch((err)=>{
4204    console.error('Failed to show the window. Cause: ' + JSON.stringify(err));
4205});
4206```
4207
4208### destroy<sup>(deprecated)</sup>
4209
4210destroy(callback: AsyncCallback&lt;void&gt;): void
4211
4212Destroys this window. This API uses an asynchronous callback to return the result.
4213
4214> **NOTE**
4215>
4216> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [destroyWindow()](#destroywindow9) instead.
4217
4218**System capability**: SystemCapability.WindowManager.WindowManager.Core
4219
4220**Parameters**
4221
4222| Name  | Type                     | Mandatory| Description      |
4223| -------- | ------------------------- | ---- | ---------- |
4224| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
4225
4226**Example**
4227
4228```js
4229windowClass.destroy((err) => {
4230    if (err.code) {
4231        console.error('Failed to destroy the window. Cause:' + JSON.stringify(err));
4232        return;
4233    }
4234    console.info('Succeeded in destroying the window.');
4235});
4236```
4237
4238### destroy<sup>(deprecated)</sup>
4239
4240destroy(): Promise&lt;void&gt;
4241
4242Destroys this window. This API uses a promise to return the result.
4243
4244> **NOTE**
4245>
4246> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [destroyWindow()](#destroywindow9-1) instead.
4247
4248**System capability**: SystemCapability.WindowManager.WindowManager.Core
4249
4250**Return value**
4251
4252| Type               | Description                     |
4253| ------------------- | ------------------------- |
4254| Promise&lt;void&gt; | Promise that returns no value.|
4255
4256**Example**
4257
4258```js
4259let promise = windowClass.destroy();
4260promise.then(()=> {
4261    console.info('Succeeded in destroying the window.');
4262}).catch((err)=>{
4263    console.error('Failed to destroy the window. Cause: ' + JSON.stringify(err));
4264});
4265```
4266
4267### moveTo<sup>(deprecated)</sup>
4268
4269moveTo(x: number, y: number, callback: AsyncCallback&lt;void&gt;): void
4270
4271Moves this window. This API uses an asynchronous callback to return the result.
4272
4273This operation is not supported in a window in full-screen mode.
4274
4275> **NOTE**
4276>
4277> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [moveWindowTo()](#movewindowto9) instead.
4278
4279**System capability**: SystemCapability.WindowManager.WindowManager.Core
4280
4281**Parameters**
4282
4283| Name  | Type                     | Mandatory| Description                                             |
4284| -------- | ------------------------- | ---- | ------------------------------------------------- |
4285| x        | number                    | Yes  | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.|
4286| y        | number                    | Yes  | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.|
4287| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                                       |
4288
4289**Example**
4290
4291```js
4292windowClass.moveTo(300, 300, (err)=>{
4293    if (err.code) {
4294        console.error('Failed to move the window. Cause:' + JSON.stringify(err));
4295        return;
4296    }
4297    console.info('Succeeded in moving the window.');
4298});
4299```
4300
4301### moveTo<sup>(deprecated)</sup>
4302
4303moveTo(x: number, y: number): Promise&lt;void&gt;
4304
4305Moves this window. This API uses a promise to return the result.
4306
4307This operation is not supported in a window in full-screen mode.
4308
4309> **NOTE**
4310>
4311> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [moveWindowTo()](#movewindowto9-1) instead.
4312
4313**System capability**: SystemCapability.WindowManager.WindowManager.Core
4314
4315**Parameters**
4316
4317| Name| Type  | Mandatory| Description                                             |
4318| ------ | ------ | ---- | ------------------------------------------------- |
4319| x      | number | Yes  | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.|
4320| y      | number | Yes  | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.|
4321
4322**Return value**
4323
4324| Type               | Description                     |
4325| ------------------- | ------------------------- |
4326| Promise&lt;void&gt; | Promise that returns no value.|
4327
4328**Example**
4329
4330```js
4331let promise = windowClass.moveTo(300, 300);
4332promise.then(()=> {
4333    console.info('Succeeded in moving the window.');
4334}).catch((err)=>{
4335    console.error('Failed to move the window. Cause: ' + JSON.stringify(err));
4336});
4337```
4338
4339### resetSize<sup>(deprecated)</sup>
4340
4341resetSize(width: number, height: number, callback: AsyncCallback&lt;void&gt;): void
4342
4343Changes the size of this window. This API uses an asynchronous callback to return the result.
4344
4345The main window and subwindow have the following size limits: [320, 2560] in width and [240, 2560] in height, both in units of vp.
4346
4347The system window has the following size limits: [0, 2560] in width and [0, 2560] in height, both in units of vp.
4348
4349The new width and height you set must meet the limits.
4350
4351This operation is not supported in a window in full-screen mode.
4352
4353> **NOTE**
4354>
4355> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [resize()](#resize9) instead.
4356
4357**System capability**: SystemCapability.WindowManager.WindowManager.Core
4358
4359**Parameters**
4360
4361| Name  | Type                     | Mandatory| Description                      |
4362| -------- | ------------------------- | ---- | -------------------------- |
4363| width    | number                    | Yes  | New width of the window, in px.|
4364| height   | number                    | Yes  | New height of the window, in px.|
4365| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                |
4366
4367**Example**
4368
4369```js
4370windowClass.resetSize(500, 1000, (err) => {
4371    if (err.code) {
4372        console.error('Failed to change the window size. Cause:' + JSON.stringify(err));
4373        return;
4374    }
4375    console.info('Succeeded in changing the window size.');
4376});
4377```
4378
4379### resetSize<sup>(deprecated)</sup>
4380
4381resetSize(width: number, height: number): Promise&lt;void&gt;
4382
4383Changes the size of this window. This API uses a promise to return the result.
4384
4385The main window and subwindow have the following size limits: [320, 2560] in width and [240, 2560] in height, both in units of vp.
4386
4387The system window has the following size limits: [0, 2560] in width and [0, 2560] in height, both in units of vp.
4388
4389The new width and height you set must meet the limits.
4390
4391This operation is not supported in a window in full-screen mode.
4392
4393> **NOTE**
4394>
4395> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [resize()](#resize9-1) instead.
4396
4397**System capability**: SystemCapability.WindowManager.WindowManager.Core
4398
4399**Parameters**
4400
4401| Name| Type  | Mandatory| Description                      |
4402| ------ | ------ | ---- | -------------------------- |
4403| width  | number | Yes  | New width of the window, in px.|
4404| height | number | Yes  | New height of the window, in px.|
4405
4406**Return value**
4407
4408| Type               | Description                     |
4409| ------------------- | ------------------------- |
4410| Promise&lt;void&gt; | Promise that returns no value.|
4411
4412**Example**
4413
4414```js
4415let promise = windowClass.resetSize(500, 1000);
4416promise.then(()=> {
4417    console.info('Succeeded in changing the window size.');
4418}).catch((err)=>{
4419    console.error('Failed to change the window size. Cause: ' + JSON.stringify(err));
4420});
4421```
4422
4423### setWindowType<sup>(deprecated)</sup>
4424
4425setWindowType(type: WindowType, callback: AsyncCallback&lt;void&gt;): void
4426
4427Sets the type of this window. This API uses an asynchronous callback to return the result.
4428
4429**System API**: This is a system API.
4430
4431> **NOTE**
4432>
4433> This API is supported since API version 7 and deprecated since API version 9.
4434
4435**System capability**: SystemCapability.WindowManager.WindowManager.Core
4436
4437**Parameters**
4438
4439| Name  | Type                     | Mandatory| Description      |
4440| -------- | ------------------------- | ---- | ---------- |
4441| type     | [WindowType](#windowtype7) | Yes  | Window type.|
4442| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
4443
4444**Example**
4445
4446```js
4447let type = window.WindowType.TYPE_APP;
4448windowClass.setWindowType(type, (err) => {
4449  if (err.code) {
4450      console.error('Failed to set the window type. Cause: ' + JSON.stringify(err));
4451      return;
4452  }
4453  console.info('Succeeded in setting the window type.');
4454});
4455```
4456
4457### setWindowType<sup>(deprecated)</sup>
4458
4459setWindowType(type: WindowType): Promise&lt;void&gt;
4460
4461Sets the type of this window. This API uses a promise to return the result.
4462
4463**System API**: This is a system API.
4464
4465> **NOTE**
4466>
4467> This API is supported since API version 7 and deprecated since API version 9.
4468
4469**System capability**: SystemCapability.WindowManager.WindowManager.Core
4470
4471**Parameters**
4472
4473| Name| Type                     | Mandatory| Description      |
4474| ------ | ------------------------- | ---- | ---------- |
4475| type   | [WindowType](#windowtype7) | Yes  | Window type.|
4476
4477**Return value**
4478
4479| Type               | Description                     |
4480| ------------------- | ------------------------- |
4481| Promise&lt;void&gt; | Promise that returns no value.|
4482
4483**Example**
4484
4485```js
4486let type = window.WindowType.TYPE_APP;
4487let promise = windowClass.setWindowType(type);
4488promise.then(()=> {
4489    console.info('Succeeded in setting the window type.');
4490}).catch((err)=>{
4491    console.error('Failed to set the window type. Cause: ' + JSON.stringify(err));
4492});
4493```
4494
4495### getProperties<sup>(deprecated)</sup>
4496
4497getProperties(callback: AsyncCallback&lt;WindowProperties&gt;): void
4498
4499Obtains the properties of this window. This API uses an asynchronous callback to return the result.
4500
4501> **NOTE**
4502>
4503> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getWindowProperties()](#getwindowproperties9) instead.
4504
4505**System capability**: SystemCapability.WindowManager.WindowManager.Core
4506
4507**Parameters**
4508
4509| Name  | Type                                                      | Mandatory| Description                        |
4510| -------- | ---------------------------------------------------------- | ---- | ---------------------------- |
4511| callback | AsyncCallback&lt;[WindowProperties](#windowproperties)&gt; | Yes  | Callback used to return the window properties.|
4512
4513**Example**
4514
4515```js
4516windowClass.getProperties((err, data) => {
4517    if (err.code) {
4518        console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(err));
4519        return;
4520    }
4521    console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data));
4522});
4523```
4524
4525### getProperties<sup>(deprecated)</sup>
4526
4527getProperties(): Promise&lt;WindowProperties&gt;
4528
4529Obtains the properties of this window. This API uses a promise to return the result.
4530
4531> **NOTE**
4532>
4533> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getWindowProperties()](#getwindowproperties9) instead.
4534
4535**System capability**: SystemCapability.WindowManager.WindowManager.Core
4536
4537**Return value**
4538
4539| Type                                                | Description                           |
4540| ---------------------------------------------------- | ------------------------------- |
4541| Promise&lt;[WindowProperties](#windowproperties)&gt; | Promise used to return the window properties.|
4542
4543**Example**
4544
4545```js
4546let promise = windowClass.getProperties();
4547promise.then((data)=> {
4548    console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data));
4549}).catch((err)=>{
4550    console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(err));
4551});
4552```
4553
4554### getAvoidArea<sup>(deprecated)</sup>
4555
4556getAvoidArea(type: [AvoidAreaType](#avoidareatype7), callback: AsyncCallback&lt;[AvoidArea](#avoidarea7)&gt;): void
4557
4558Obtains the area where this window cannot be displayed, for example, the system bar area, notch, gesture area, and soft keyboard area. This API uses an asynchronous callback to return the result.
4559
4560> **NOTE**
4561>
4562> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getWindowAvoidArea()](#getwindowavoidarea9) instead.
4563
4564**System capability**: SystemCapability.WindowManager.WindowManager.Core
4565
4566**Parameters**
4567
4568| Name  | Type                                           | Mandatory| Description                                                        |
4569| -------- |-----------------------------------------------| ---- | ------------------------------------------------------------ |
4570| type     | [AvoidAreaType](#avoidareatype7)              | Yes  | Type of the area.|
4571| callback | AsyncCallback&lt;[AvoidArea](#avoidarea7)&gt; | Yes  | Callback used to return the area.                            |
4572
4573**Example**
4574
4575```js
4576let type = window.AvoidAreaType.TYPE_SYSTEM;
4577windowClass.getAvoidArea(type, (err, data) => {
4578    if (err.code) {
4579        console.error('Failed to obtain the area. Cause:' + JSON.stringify(err));
4580        return;
4581    }
4582    console.info('Succeeded in obtaining the area. Data:' + JSON.stringify(data));
4583});
4584```
4585
4586### getAvoidArea<sup>(deprecated)</sup>
4587
4588getAvoidArea(type: [AvoidAreaType](#avoidareatype7)): Promise&lt;[AvoidArea](#avoidarea7)&gt;
4589
4590Obtains the area where this window cannot be displayed, for example, the system bar area, notch, gesture area, and soft keyboard area. This API uses a promise to return the result.
4591
4592> **NOTE**
4593>
4594> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getWindowAvoidArea()](#getwindowavoidarea9) instead.
4595
4596**System capability**: SystemCapability.WindowManager.WindowManager.Core
4597
4598**Parameters**
4599
4600| Name| Type                              | Mandatory| Description                                                        |
4601| ------ |----------------------------------| ---- | ------------------------------------------------------------ |
4602| type   | [AvoidAreaType](#avoidareatype7) | Yes  | Type of the area.|
4603
4604**Return value**
4605
4606| Type                                     | Description                               |
4607|-----------------------------------------| ----------------------------------- |
4608| Promise&lt;[AvoidArea](#avoidarea7)&gt; | Promise used to return the area.|
4609
4610**Example**
4611
4612```js
4613let type = window.AvoidAreaType.TYPE_SYSTEM;
4614let promise = windowClass.getAvoidArea(type);
4615promise.then((data)=> {
4616    console.info('Succeeded in obtaining the area. Data:' + JSON.stringify(data));
4617}).catch((err)=>{
4618    console.error('Failed to obtain the area. Cause:' + JSON.stringify(err));
4619});
4620```
4621
4622### setFullScreen<sup>(deprecated)</sup>
4623
4624setFullScreen(isFullScreen: boolean, callback: AsyncCallback&lt;void&gt;): void
4625
4626Sets whether to enable the full-screen mode for this window. This API uses an asynchronous callback to return the result.
4627
4628> **NOTE**
4629>
4630> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowSystemBarEnable()](#setwindowsystembarenable9) instead.
4631
4632**System capability**: SystemCapability.WindowManager.WindowManager.Core
4633
4634**Parameters**
4635
4636| Name      | Type                     | Mandatory| Description                                          |
4637| ------------ | ------------------------- | ---- | ---------------------------------------------- |
4638| isFullScreen | boolean                   | Yes  | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden. The value **true** means to enable the full-screen mode, and **false** means the opposite.|
4639| callback     | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                                    |
4640
4641**Example**
4642
4643```js
4644let isFullScreen = true;
4645windowClass.setFullScreen(isFullScreen, (err) => {
4646    if (err.code) {
4647        console.error('Failed to enable the full-screen mode. Cause: ' + JSON.stringify(err));
4648        return;
4649    }
4650    console.info('Succeeded in enabling the full-screen mode.');
4651});
4652```
4653
4654### setFullScreen<sup>(deprecated)</sup>
4655
4656setFullScreen(isFullScreen: boolean): Promise&lt;void&gt;
4657
4658Sets whether to enable the full-screen mode for this window. This API uses a promise to return the result.
4659
4660> **NOTE**
4661>
4662> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowSystemBarEnable()](#setwindowsystembarenable9-1) instead.
4663
4664**System capability**: SystemCapability.WindowManager.WindowManager.Core
4665
4666**Parameters**
4667
4668| Name      | Type   | Mandatory| Description                                          |
4669| ------------ | ------- | ---- | ---------------------------------------------- |
4670| isFullScreen | boolean | Yes  | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden. The value **true** means to enable the full-screen mode, and **false** means the opposite.|
4671
4672**Return value**
4673
4674| Type               | Description                     |
4675| ------------------- | ------------------------- |
4676| Promise&lt;void&gt; | Promise that returns no value.|
4677
4678**Example**
4679
4680```js
4681let isFullScreen = true;
4682let promise = windowClass.setFullScreen(isFullScreen);
4683promise.then(()=> {
4684    console.info('Succeeded in enabling the full-screen mode.');
4685}).catch((err)=>{
4686    console.error('Failed to enable the full-screen mode. Cause: ' + JSON.stringify(err));
4687});
4688```
4689
4690### setLayoutFullScreen<sup>(deprecated)</sup>
4691
4692setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback&lt;void&gt;): void
4693
4694Sets whether to enable the full-screen mode for the window layout. This API uses an asynchronous callback to return the result.
4695
4696> **NOTE**
4697>
4698> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowLayoutFullScreen()](#setwindowlayoutfullscreen9) instead.
4699
4700**System capability**: SystemCapability.WindowManager.WindowManager.Core
4701
4702**Parameters**
4703
4704| Name            | Type                     | Mandatory| Description                                                        |
4705| ------------------ | ------------------------- | ---- | ------------------------------------------------------------ |
4706| isLayoutFullScreen | boolean                   | Yes  | Whether to enable the full-screen mode for the window layout, in which the status bar and navigation bar are displayed. The value **true** means to enable the full-screen mode for the window layout, and **false** means the opposite.|
4707| callback           | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                                                  |
4708
4709**Example**
4710
4711```js
4712let isLayoutFullScreen= true;
4713windowClass.setLayoutFullScreen(isLayoutFullScreen, (err) => {
4714    if (err.code) {
4715        console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
4716        return;
4717    }
4718    console.info('Succeeded in setting the window layout to full-screen mode.');
4719});
4720```
4721
4722### setLayoutFullScreen<sup>(deprecated)</sup>
4723
4724setLayoutFullScreen(isLayoutFullScreen: boolean): Promise&lt;void&gt;
4725
4726Sets whether to enable the full-screen mode for the window layout. This API uses a promise to return the result.
4727
4728> **NOTE**
4729>
4730> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowLayoutFullScreen()](#setwindowlayoutfullscreen9-1) instead.
4731
4732**System capability**: SystemCapability.WindowManager.WindowManager.Core
4733
4734**Parameters**
4735
4736| Name            | Type   | Mandatory| Description                                                        |
4737| ------------------ | ------- | ---- | ------------------------------------------------------------ |
4738| isLayoutFullScreen | boolean | Yes  | Whether to enable the full-screen mode for the window layout, in which the status bar and navigation bar are displayed. The value **true** means to enable the full-screen mode for the window layout, and **false** means the opposite.|
4739
4740**Return value**
4741
4742| Type               | Description                     |
4743| ------------------- | ------------------------- |
4744| Promise&lt;void&gt; | Promise that returns no value.|
4745
4746**Example**
4747
4748```js
4749let isLayoutFullScreen = true;
4750let promise = windowClass.setLayoutFullScreen(isLayoutFullScreen);
4751promise.then(()=> {
4752    console.info('Succeeded in setting the window layout to full-screen mode.');
4753}).catch((err)=>{
4754    console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
4755});
4756```
4757
4758### setSystemBarEnable<sup>(deprecated)</sup>
4759
4760setSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallback&lt;void&gt;): void
4761
4762Sets whether to display the status bar and navigation bar in this window. This API uses an asynchronous callback to return the result.
4763
4764> **NOTE**
4765>
4766> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowSystemBarEnable()](#setwindowsystembarenable9) instead.
4767
4768**System capability**: SystemCapability.WindowManager.WindowManager.Core
4769
4770**Parameters**
4771
4772| Name  | Type                     | Mandatory| Description                                                        |
4773| -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
4774| names    | Array<'status'\|'navigation'> | Yes  | Whether to display the status bar and navigation bar.<br>For example, to display the status bar and navigation bar, set this parameter to **['status', 'navigation']**. By default, they are not displayed.|
4775| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                                                  |
4776
4777**Example**
4778
4779```js
4780// In this example, the status bar and navigation bar are not displayed.
4781let names = [];
4782windowClass.setSystemBarEnable(names, (err) => {
4783    if (err.code) {
4784        console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err));
4785        return;
4786    }
4787    console.info('Succeeded in setting the system bar to be invisible.');
4788});
4789```
4790
4791### setSystemBarEnable<sup>(deprecated)</sup>
4792
4793setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise&lt;void&gt;
4794
4795Sets whether to display the status bar and navigation bar in this window. This API uses a promise to return the result.
4796
4797> **NOTE**
4798>
4799> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowSystemBarEnable()](#setwindowsystembarenable9-1) instead.
4800
4801**System capability**: SystemCapability.WindowManager.WindowManager.Core
4802
4803**Parameters**
4804
4805| Name| Type | Mandatory| Description                                                        |
4806| ------ | ---------------------------- | ---- | ------------------------ |
4807| names  | Array<'status'\|'navigation'> | Yes  | Whether to display the status bar and navigation bar.<br>For example, to display the status bar and navigation bar, set this parameter to **['status', 'navigation']**. By default, they are not displayed.|
4808
4809**Return value**
4810
4811| Type               | Description                     |
4812| ------------------- | ------------------------- |
4813| Promise&lt;void&gt; | Promise that returns no value.|
4814
4815**Example**
4816
4817```js
4818// In this example, the status bar and navigation bar are not displayed.
4819let names = [];
4820let promise = windowClass.setSystemBarEnable(names);
4821promise.then(()=> {
4822    console.info('Succeeded in setting the system bar to be invisible.');
4823}).catch((err)=>{
4824    console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err));
4825});
4826```
4827
4828### setSystemBarProperties<sup>(deprecated)</sup>
4829
4830setSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback&lt;void&gt;): void
4831
4832Sets the properties of the status bar and navigation bar in this window. This API uses an asynchronous callback to return the result.
4833
4834> **NOTE**
4835>
4836> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowSystemBarProperties()](#setwindowsystembarproperties9) instead.
4837
4838**System capability**: SystemCapability.WindowManager.WindowManager.Core
4839
4840**Parameters**
4841
4842| Name             | Type                                       | Mandatory| Description                  |
4843| ------------------- | ------------------------------------------- | ---- | ---------------------- |
4844| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes  | Properties of the status bar and navigation bar.|
4845| callback            | AsyncCallback&lt;void&gt;                   | Yes  | Callback used to return the result.            |
4846
4847**Example**
4848
4849```js
4850let SystemBarProperties={
4851    statusBarColor: '#ff00ff',
4852    navigationBarColor: '#00ff00',
4853    // The following properties are supported since API version 8.
4854    statusBarContentColor:'#ffffff',
4855    navigationBarContentColor:'#00ffff'
4856};
4857windowClass.setSystemBarProperties(SystemBarProperties, (err) => {
4858    if (err.code) {
4859        console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err));
4860        return;
4861    }
4862    console.info('Succeeded in setting the system bar properties.');
4863});
4864```
4865
4866### setSystemBarProperties<sup>(deprecated)</sup>
4867
4868setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise&lt;void&gt;
4869
4870Sets the properties of the status bar and navigation bar in this window. This API uses a promise to return the result.
4871
4872> **NOTE**
4873>
4874> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowSystemBarProperties()](#setwindowsystembarproperties9-1) instead.
4875
4876**System capability**: SystemCapability.WindowManager.WindowManager.Core
4877
4878**Parameters**
4879
4880| Name             | Type                                       | Mandatory| Description                  |
4881| ------------------- | ------------------------------------------- | ---- | ---------------------- |
4882| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes  | Properties of the status bar and navigation bar.|
4883
4884**Return value**
4885
4886| Type               | Description                     |
4887| ------------------- | ------------------------- |
4888| Promise&lt;void&gt; | Promise that returns no value.|
4889
4890**Example**
4891
4892```js
4893let SystemBarProperties={
4894    statusBarColor: '#ff00ff',
4895    navigationBarColor: '#00ff00',
4896    // The following properties are supported since API version 8.
4897    statusBarContentColor:'#ffffff',
4898    navigationBarContentColor:'#00ffff'
4899};
4900let promise = windowClass.setSystemBarProperties(SystemBarProperties);
4901promise.then(()=> {
4902    console.info('Succeeded in setting the system bar properties.');
4903}).catch((err)=>{
4904    console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err));
4905});
4906```
4907
4908### loadContent<sup>(deprecated)</sup>
4909
4910loadContent(path: string, callback: AsyncCallback&lt;void&gt;): void
4911
4912Loads content from a page to this window. This API uses an asynchronous callback to return the result.
4913
4914> **NOTE**
4915>
4916> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setUIContent()](#setuicontent9) instead.
4917
4918**System capability**: SystemCapability.WindowManager.WindowManager.Core
4919
4920**Parameters**
4921
4922| Name  | Type                     | Mandatory| Description                |
4923| -------- | ------------------------- | ---- | -------------------- |
4924| path     | string                    | Yes  | Path of the page from which the content will be loaded.|
4925| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
4926
4927**Example**
4928
4929```js
4930windowClass.loadContent('pages/page2/page2', (err) => {
4931   if (err.code) {
4932         console.error('Failed to load the content. Cause:' + JSON.stringify(err));
4933         return;
4934   }
4935  console.info('Succeeded in loading the content.');
4936});
4937```
4938
4939### loadContent<sup>(deprecated)</sup>
4940
4941loadContent(path: string): Promise&lt;void&gt;
4942
4943Loads content from a page to this window. This API uses a promise to return the result.
4944
4945> **NOTE**
4946>
4947> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setUIContent()](#setuicontent9-1) instead.
4948
4949**System capability**: SystemCapability.WindowManager.WindowManager.Core
4950
4951**Parameters**
4952
4953| Name| Type  | Mandatory| Description                |
4954| ------ | ------ | ---- | -------------------- |
4955| path   | string | Yes  | Path of the page from which the content will be loaded.|
4956
4957**Return value**
4958
4959| Type               | Description                     |
4960| ------------------- | ------------------------- |
4961| Promise&lt;void&gt; | Promise that returns no value.|
4962
4963**Example**
4964
4965```js
4966let promise = windowClass.loadContent('pages/page2/page2');
4967promise.then(()=> {
4968    console.info('Succeeded in loading the content.');
4969}).catch((err)=>{
4970    console.error('Failed to load the content. Cause: ' + JSON.stringify(err));
4971});
4972```
4973
4974### isShowing<sup>(deprecated)</sup>
4975
4976isShowing(callback: AsyncCallback&lt;boolean&gt;): void
4977
4978Checks whether this window is displayed. This API uses an asynchronous callback to return the result.
4979
4980> **NOTE**
4981>
4982> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isWindowShowing()](#iswindowshowing9) instead.
4983
4984**System capability**: SystemCapability.WindowManager.WindowManager.Core
4985
4986**Parameters**
4987
4988| Name  | Type                        | Mandatory| Description                                                        |
4989| -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
4990| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means that the window is displayed, and **false** means the opposite.|
4991
4992**Example**
4993
4994```js
4995windowClass.isShowing((err, data) => {
4996    if (err.code) {
4997        console.error('Failed to check whether the window is showing. Cause:' + JSON.stringify(err));
4998        return;
4999    }
5000    console.info('Succeeded in checking whether the window is showing. Data: ' + JSON.stringify(data));
5001});
5002```
5003
5004### isShowing<sup>(deprecated)</sup>
5005
5006isShowing(): Promise&lt;boolean&gt;
5007
5008Checks whether this window is displayed. This API uses a promise to return the result.
5009
5010> **NOTE**
5011>
5012> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isWindowShowing()](#iswindowshowing9) instead.
5013
5014**System capability**: SystemCapability.WindowManager.WindowManager.Core
5015
5016**Return value**
5017
5018| Type                  | Description                                                        |
5019| ---------------------- | ------------------------------------------------------------ |
5020| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means that the window is displayed, and **false** means the opposite.|
5021
5022**Example**
5023
5024```js
5025let promise = windowClass.isShowing();
5026promise.then((data)=> {
5027    console.info('Succeeded in checking whether the window is showing. Data: ' + JSON.stringify(data));
5028}).catch((err)=>{
5029    console.error('Failed to check whether the window is showing. Cause: ' + JSON.stringify(err));
5030});
5031```
5032
5033### on('systemAvoidAreaChange')<sup>(deprecated)</sup>
5034
5035on(type: 'systemAvoidAreaChange', callback: Callback&lt;AvoidArea&gt;): void
5036
5037Enables listening for changes to the area where the window cannot be displayed.
5038
5039> **NOTE**
5040>
5041> This API is supported since API version 7 and deprecated since API version 9. Use [on('avoidAreaChange')](#onavoidareachange9) instead.
5042
5043**System capability**: SystemCapability.WindowManager.WindowManager.Core
5044
5045**Parameters**
5046
5047| Name  | Type                                      | Mandatory| Description                                                   |
5048| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
5049| type     | string                                   | Yes  | Event type. The value is fixed at **'systemAvoidAreaChange'**, indicating the event of changes to the area where the window cannot be displayed.|
5050| callback | Callback&lt;[AvoidArea](#avoidarea7)&gt; | Yes  | Callback used to return the area.                            |
5051
5052**Example**
5053
5054```js
5055windowClass.on('systemAvoidAreaChange', (data) => {
5056    console.info('Succeeded in enabling the listener for system avoid area changes. Data: ' + JSON.stringify(data));
5057});
5058```
5059
5060### off('systemAvoidAreaChange')<sup>(deprecated)</sup>
5061
5062off(type: 'systemAvoidAreaChange', callback?: Callback&lt;AvoidArea&gt;): void
5063
5064Disables listening for changes to the area where the window cannot be displayed.
5065
5066> **NOTE**
5067>
5068> This API is supported since API version 7 and deprecated since API version 9. Use [off('avoidAreaChange')](#offavoidareachange9) instead.
5069
5070**System capability**: SystemCapability.WindowManager.WindowManager.Core
5071
5072**Parameters**
5073
5074| Name  | Type                                      | Mandatory| Description                                                   |
5075| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
5076| type     | string                                   | Yes  | Event type. The value is fixed at **'systemAvoidAreaChange'**, indicating the event of changes to the area where the window cannot be displayed.|
5077| callback | Callback&lt;[AvoidArea](#avoidarea7)&gt; | No  | Callback used to return the area.                           |
5078
5079**Example**
5080
5081```js
5082windowClass.off('systemAvoidAreaChange');
5083```
5084
5085### isSupportWideGamut<sup>(deprecated)</sup>
5086
5087isSupportWideGamut(callback: AsyncCallback&lt;boolean&gt;): void
5088
5089Checks whether this window supports the wide-gamut color space. This API uses an asynchronous callback to return the result.
5090
5091> **NOTE**
5092>
5093> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isWindowSupportWideGamut()](#iswindowsupportwidegamut9) instead.
5094
5095**System capability**: SystemCapability.WindowManager.WindowManager.Core
5096
5097**Parameters**
5098
5099| Name  | Type                        | Mandatory| Description                                                        |
5100| -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
5101| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means that the wide-gamut color space is supported, and **false** means the opposite.|
5102
5103**Example**
5104
5105```js
5106windowClass.isSupportWideGamut((err, data) => {
5107    if (err.code) {
5108        console.error('Failed to check whether the window support WideGamut. Cause:' + JSON.stringify(err));
5109        return;
5110    }
5111    console.info('Succeeded in checking whether the window support WideGamut Data: ' + JSON.stringify(data));
5112});
5113```
5114
5115### isSupportWideGamut<sup>(deprecated)</sup>
5116
5117isSupportWideGamut(): Promise&lt;boolean&gt;
5118
5119Checks whether this window supports the wide-gamut color space. This API uses a promise to return the result.
5120
5121> **NOTE**
5122>
5123> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isWindowSupportWideGamut()](#iswindowsupportwidegamut9-1) instead.
5124
5125**System capability**: SystemCapability.WindowManager.WindowManager.Core
5126
5127**Return value**
5128
5129| Type                  | Description                                                        |
5130| ---------------------- | ------------------------------------------------------------ |
5131| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means that the wide-gamut color space is supported, and **false** means the opposite.|
5132
5133**Example**
5134
5135```js
5136let promise = windowClass.isSupportWideGamut();
5137promise.then((data)=> {
5138    console.info('Succeeded in checking whether the window support WideGamut. Data: ' + JSON.stringify(data));
5139}).catch((err)=>{
5140    console.error('Failed to check whether the window support WideGamut. Cause: ' + JSON.stringify(err));
5141});
5142```
5143
5144### setColorSpace<sup>(deprecated)</sup>
5145
5146setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback&lt;void&gt;): void
5147
5148Sets a color space for this window. This API uses an asynchronous callback to return the result.
5149
5150> **NOTE**
5151>
5152> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [setWindowColorSpace()](#setwindowcolorspace9) instead.
5153
5154**System capability**: SystemCapability.WindowManager.WindowManager.Core
5155
5156**Parameters**
5157
5158| Name    | Type                     | Mandatory| Description        |
5159| ---------- | ------------------------- | ---- | ------------ |
5160| colorSpace | [ColorSpace](#colorspace8) | Yes  | Color space to set.|
5161| callback   | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.  |
5162
5163**Example**
5164
5165```js
5166windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err) => {
5167    if (err.code) {
5168        console.error('Failed to set window colorspace. Cause:' + JSON.stringify(err));
5169        return;
5170    }
5171    console.info('Succeeded in setting window colorspace.');
5172});
5173```
5174
5175### setColorSpace<sup>(deprecated)</sup>
5176
5177setColorSpace(colorSpace:ColorSpace): Promise&lt;void&gt;
5178
5179Sets a color space for this window. This API uses a promise to return the result.
5180
5181> **NOTE**
5182>
5183> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [setWindowColorSpace()](#setwindowcolorspace9-1) instead.
5184
5185**System capability**: SystemCapability.WindowManager.WindowManager.Core
5186
5187**Parameters**
5188
5189| Name    | Type                     | Mandatory| Description          |
5190| ---------- | ------------------------- | ---- | -------------- |
5191| colorSpace | [ColorSpace](#colorspace8) | Yes  | Color space to set.|
5192
5193**Return value**
5194
5195| Type               | Description                     |
5196| ------------------- | ------------------------- |
5197| Promise&lt;void&gt; | Promise that returns no value.|
5198
5199**Example**
5200
5201```js
5202let promise = windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT);
5203promise.then(()=> {
5204    console.info('Succeeded in setting window colorspace.');
5205}).catch((err)=>{
5206    console.error('Failed to set window colorspace. Cause: ' + JSON.stringify(err));
5207});
5208```
5209
5210### getColorSpace<sup>(deprecated)</sup>
5211
5212getColorSpace(callback: AsyncCallback&lt;ColorSpace&gt;): void
5213
5214Obtains the color space of this window. This API uses an asynchronous callback to return the result.
5215
5216> **NOTE**
5217>
5218> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getWindowColorSpace()](#getwindowcolorspace9) instead.
5219
5220**System capability**: SystemCapability.WindowManager.WindowManager.Core
5221
5222**Parameters**
5223
5224| Name  | Type                                          | Mandatory| Description                                                      |
5225| -------- | ---------------------------------------------- | ---- | ---------------------------------------------------------- |
5226| callback | AsyncCallback&lt;[ColorSpace](#colorspace8)&gt; | Yes  | Callback used to return the result. When the color space is obtained successfully, **err** is **undefined**, and **data** is the current color space.|
5227
5228**Example**
5229
5230```js
5231windowClass.getColorSpace((err, data) => {
5232    if (err.code) {
5233        console.error('Failed to get window colorspace. Cause:' + JSON.stringify(err));
5234        return;
5235    }
5236    console.info('Succeeded in getting window colorspace. Cause:' + JSON.stringify(data));
5237});
5238```
5239
5240### getColorSpace<sup>(deprecated)</sup>
5241
5242getColorSpace(): Promise&lt;ColorSpace&gt;
5243
5244Obtains the color space of this window. This API uses a promise to return the result.
5245
5246> **NOTE**
5247>
5248> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getWindowColorSpace()](#getwindowcolorspace9) instead.
5249
5250**System capability**: SystemCapability.WindowManager.WindowManager.Core
5251
5252**Return value**
5253
5254| Type                                    | Description                           |
5255| ---------------------------------------- | ------------------------------- |
5256| Promise&lt;[ColorSpace](#colorspace8)&gt; | Promise used to return the current color space.|
5257
5258**Example**
5259
5260```js
5261let promise = windowClass.getColorSpace();
5262promise.then((data)=> {
5263    console.info('Succeeded in getting window color space. Cause:' + JSON.stringify(data));
5264}).catch((err)=>{
5265    console.error('Failed to get window colorspace. Cause: ' + JSON.stringify(err));
5266});
5267```
5268
5269### setBackgroundColor<sup>(deprecated)</sup>
5270
5271setBackgroundColor(color: string, callback: AsyncCallback&lt;void&gt;): void
5272
5273Sets the background color for this window. This API uses an asynchronous callback to return the result. In the stage model, this API must be used after the call of [loadContent](#loadcontent9) or [setUIContent()](#setuicontent9) takes effect.
5274
5275> **NOTE**
5276>
5277> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowBackgroundColor()](#setwindowbackgroundcolor9) instead.
5278
5279**System capability**: SystemCapability.WindowManager.WindowManager.Core
5280
5281**Parameters**
5282
5283| Name  | Type                     | Mandatory| Description                                                        |
5284| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
5285| color    | string                    | Yes  | Background color to set. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
5286| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                                                  |
5287
5288**Example**
5289
5290```js
5291let color = '#00ff33';
5292windowClass.setBackgroundColor(color, (err) => {
5293    if (err.code) {
5294        console.error('Failed to set the background color. Cause: ' + JSON.stringify(err));
5295        return;
5296    }
5297    console.info('Succeeded in setting the background color.');
5298});
5299```
5300
5301### setBackgroundColor<sup>(deprecated)</sup>
5302
5303setBackgroundColor(color: string): Promise&lt;void&gt;
5304
5305Sets the background color for this window. This API uses a promise to return the result. In the stage model, this API must be used after the call of [loadContent](#loadcontent9) or [setUIContent()](#setuicontent9) takes effect.
5306
5307> **NOTE**
5308>
5309> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowBackgroundColor()](#setwindowbackgroundcolor9) instead.
5310
5311**System capability**: SystemCapability.WindowManager.WindowManager.Core
5312
5313**Parameters**
5314
5315| Name| Type  | Mandatory| Description                                                        |
5316| ------ | ------ | ---- | ------------------------------------------------------------ |
5317| color  | string | Yes  | Background color to set. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
5318
5319**Return value**
5320
5321| Type               | Description                     |
5322| ------------------- | ------------------------- |
5323| Promise&lt;void&gt; | Promise that returns no value.|
5324
5325**Example**
5326
5327```js
5328let color = '#00ff33';
5329let promise = windowClass.setBackgroundColor(color);
5330promise.then(()=> {
5331    console.info('Succeeded in setting the background color.');
5332}).catch((err)=>{
5333    console.error('Failed to set the background color. Cause: ' + JSON.stringify(err));
5334});
5335```
5336
5337### setBrightness<sup>(deprecated)</sup>
5338
5339setBrightness(brightness: number, callback: AsyncCallback&lt;void&gt;): void
5340
5341Sets the screen brightness for this window. This API uses an asynchronous callback to return the result.
5342
5343When the screen brightness setting for the window takes effect, Control Panel cannot adjust the system screen brightness. It can do so only after the window screen brightness is restored to the default value.
5344
5345> **NOTE**
5346>
5347> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowBrightness()](#setwindowbrightness9) instead.
5348
5349**System capability**: SystemCapability.WindowManager.WindowManager.Core
5350
5351**Parameters**
5352
5353| Name    | Type                     | Mandatory| Description                                |
5354| ---------- | ------------------------- | ---- | ------------------------------------ |
5355| brightness | number                    | Yes  | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.|
5356| callback   | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                          |
5357
5358**Example**
5359
5360```js
5361let brightness = 1;
5362windowClass.setBrightness(brightness, (err) => {
5363    if (err.code) {
5364        console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
5365        return;
5366    }
5367    console.info('Succeeded in setting the brightness.');
5368});
5369```
5370
5371### setBrightness<sup>(deprecated)</sup>
5372
5373setBrightness(brightness: number): Promise&lt;void&gt;
5374
5375Sets the screen brightness for this window. This API uses a promise to return the result.
5376
5377When the screen brightness setting for the window takes effect, Control Panel cannot adjust the system screen brightness. It can do so only after the window screen brightness is restored to the default value.
5378
5379> **NOTE**
5380>
5381> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowBrightness()](#setwindowbrightness9-1) instead.
5382
5383**System capability**: SystemCapability.WindowManager.WindowManager.Core
5384
5385**Parameters**
5386
5387| Name    | Type  | Mandatory| Description                                |
5388| ---------- | ------ | ---- | ------------------------------------ |
5389| brightness | number | Yes  | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.|
5390
5391**Return value**
5392
5393| Type               | Description                     |
5394| ------------------- | ------------------------- |
5395| Promise&lt;void&gt; | Promise that returns no value.|
5396
5397**Example**
5398
5399```js
5400let brightness = 1;
5401let promise = windowClass.setBrightness(brightness);
5402promise.then(()=> {
5403    console.info('Succeeded in setting the brightness.');
5404}).catch((err)=>{
5405    console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
5406});
5407```
5408
5409### setDimBehind<sup>(deprecated)</sup>
5410
5411setDimBehind(dimBehindValue: number, callback: AsyncCallback&lt;void&gt;): void
5412
5413Sets the dimness of the window that is not on top. This API uses an asynchronous callback to return the result.
5414
5415> **NOTE**
5416>
5417> This API cannot be used. This API is supported since API version 7 and deprecated since API version 9.
5418
5419**System capability**: SystemCapability.WindowManager.WindowManager.Core
5420
5421**Parameters**
5422
5423| Name        | Type                     | Mandatory| Description                                              |
5424| -------------- | ------------------------- | ---- | -------------------------------------------------- |
5425| dimBehindValue | number                    | Yes  | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.|
5426| callback       | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                                        |
5427
5428**Example**
5429
5430```js
5431windowClass.setDimBehind(0.5, (err) => {
5432    if (err.code) {
5433        console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
5434        return;
5435    }
5436    console.info('Succeeded in setting the dimness.');
5437});
5438```
5439
5440### setDimBehind<sup>(deprecated)</sup>
5441
5442setDimBehind(dimBehindValue: number): Promise&lt;void&gt;
5443
5444Sets the dimness of the window that is not on top. This API uses a promise to return the result.
5445
5446> **NOTE**
5447>
5448> This API cannot be used. This API is supported since API version 7 and deprecated since API version 9.
5449
5450**System capability**: SystemCapability.WindowManager.WindowManager.Core
5451
5452**Parameters**
5453
5454| Name        | Type  | Mandatory| Description                                              |
5455| -------------- | ------ | ---- | -------------------------------------------------- |
5456| dimBehindValue | number | Yes  | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.|
5457
5458**Return value**
5459
5460| Type               | Description                     |
5461| ------------------- | ------------------------- |
5462| Promise&lt;void&gt; | Promise that returns no value.|
5463
5464**Example**
5465
5466```js
5467let promise = windowClass.setDimBehind(0.5);
5468promise.then(()=> {
5469    console.info('Succeeded in setting the dimness.');
5470}).catch((err)=>{
5471    console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
5472});
5473```
5474
5475### setFocusable<sup>(deprecated)</sup>
5476
5477setFocusable(isFocusable: boolean, callback: AsyncCallback&lt;void&gt;): void
5478
5479Sets whether this window can gain focus. This API uses an asynchronous callback to return the result.
5480
5481> **NOTE**
5482>
5483> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowFocusable()](#setwindowfocusable9) instead.
5484
5485**System capability**: SystemCapability.WindowManager.WindowManager.Core
5486
5487**Parameters**
5488
5489| Name     | Type                     | Mandatory| Description                        |
5490| ----------- | ------------------------- | ---- | ---------------------------- |
5491| isFocusable | boolean                   | Yes  | Whether the window can gain focus. The value **true** means that the window can gain focus, and **false** means the opposite.|
5492| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                  |
5493
5494**Example**
5495
5496```js
5497let isFocusable= true;
5498windowClass.setFocusable(isFocusable, (err) => {
5499    if (err.code) {
5500        console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(err));
5501        return;
5502    }
5503    console.info('Succeeded in setting the window to be focusable.');
5504});
5505```
5506
5507### setFocusable<sup>(deprecated)</sup>
5508
5509setFocusable(isFocusable: boolean): Promise&lt;void&gt;
5510
5511Sets whether this window can gain focus. This API uses a promise to return the result.
5512
5513> **NOTE**
5514>
5515> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowFocusable()](#setwindowfocusable9-1) instead.
5516
5517**System capability**: SystemCapability.WindowManager.WindowManager.Core
5518
5519**Parameters**
5520
5521| Name     | Type   | Mandatory| Description                        |
5522| ----------- | ------- | ---- | ---------------------------- |
5523| isFocusable | boolean | Yes  | Whether the window can gain focus. The value **true** means that the window can gain focus, and **false** means the opposite.|
5524
5525**Return value**
5526
5527| Type               | Description                     |
5528| ------------------- | ------------------------- |
5529| Promise&lt;void&gt; | Promise that returns no value.|
5530
5531**Example**
5532
5533```js
5534let isFocusable= true;
5535let promise = windowClass.setFocusable(isFocusable);
5536promise.then(()=> {
5537    console.info('Succeeded in setting the window to be focusable.');
5538}).catch((err)=>{
5539    console.error('Failed to set the window to be focusable. Cause: ' + JSON.stringify(err));
5540});
5541```
5542
5543### setKeepScreenOn<sup>(deprecated)</sup>
5544
5545setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback&lt;void&gt;): void
5546
5547Sets whether to keep the screen always on. This API uses an asynchronous callback to return the result.
5548
5549> **NOTE**
5550>
5551> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowKeepScreenOn()](#setwindowkeepscreenon9) instead.
5552
5553**System capability**: SystemCapability.WindowManager.WindowManager.Core
5554
5555**Parameters**
5556
5557| Name        | Type                     | Mandatory| Description                    |
5558| -------------- | ------------------------- | ---- | ------------------------ |
5559| isKeepScreenOn | boolean                   | Yes  | Whether to keep the screen always on. The value **true** means to keep the screen always on, and **false** means the opposite.|
5560| callback       | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.              |
5561
5562**Example**
5563
5564```js
5565let isKeepScreenOn = true;
5566windowClass.setKeepScreenOn(isKeepScreenOn, (err) => {
5567    if (err.code) {
5568        console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(err));
5569        return;
5570    }
5571    console.info('Succeeded in setting the screen to be always on.');
5572});
5573```
5574
5575### setKeepScreenOn<sup>(deprecated)</sup>
5576
5577setKeepScreenOn(isKeepScreenOn: boolean): Promise&lt;void&gt;
5578
5579Sets whether to keep the screen always on. This API uses a promise to return the result.
5580
5581> **NOTE**
5582>
5583> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowKeepScreenOn()](#setwindowkeepscreenon9-1) instead.
5584
5585**System capability**: SystemCapability.WindowManager.WindowManager.Core
5586
5587**Parameters**
5588
5589| Name        | Type   | Mandatory| Description                    |
5590| -------------- | ------- | ---- | ------------------------ |
5591| isKeepScreenOn | boolean | Yes  | Whether to keep the screen always on. The value **true** means to keep the screen always on, and **false** means the opposite.|
5592
5593**Return value**
5594
5595| Type               | Description                     |
5596| ------------------- | ------------------------- |
5597| Promise&lt;void&gt; | Promise that returns no value.|
5598
5599**Example**
5600
5601```js
5602let isKeepScreenOn = true;
5603let promise = windowClass.setKeepScreenOn(isKeepScreenOn);
5604promise.then(() => {
5605    console.info('Succeeded in setting the screen to be always on.');
5606}).catch((err)=>{
5607    console.info('Failed to set the screen to be always on. Cause:  ' + JSON.stringify(err));
5608});
5609```
5610
5611### setOutsideTouchable<sup>(deprecated)</sup>
5612
5613setOutsideTouchable(touchable: boolean, callback: AsyncCallback&lt;void&gt;): void
5614
5615Sets whether the area outside the subwindow is touchable. This API uses an asynchronous callback to return the result.
5616
5617> **NOTE**
5618>
5619> This API cannot be used. This API is supported since API version 7 and deprecated since API version 9.
5620
5621**System capability**: SystemCapability.WindowManager.WindowManager.Core
5622
5623**Parameters**
5624
5625| Name   | Type                     | Mandatory| Description            |
5626| --------- | ------------------------- | ---- | ---------------- |
5627| touchable | boolean                   | Yes  | Whether the area outside the subwindow is touchable. The value **true** means the area outside the subwindow is touchable, and **false** means the opposite.|
5628| callback  | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.      |
5629
5630**Example**
5631
5632```js
5633windowClass.setOutsideTouchable(true, (err) => {
5634    if (err.code) {
5635        console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
5636        return;
5637    }
5638    console.info('Succeeded in setting the area to be touchable.');
5639});
5640```
5641
5642### setOutsideTouchable<sup>(deprecated)</sup>
5643
5644setOutsideTouchable(touchable: boolean): Promise&lt;void&gt;
5645
5646Sets whether the area outside the subwindow is touchable. This API uses a promise to return the result.
5647
5648> **NOTE**
5649>
5650> This API cannot be used. This API is supported since API version 7 and deprecated since API version 9.
5651
5652**System capability**: SystemCapability.WindowManager.WindowManager.Core
5653
5654**Parameters**
5655
5656| Name   | Type   | Mandatory| Description            |
5657| --------- | ------- | ---- | ---------------- |
5658| touchable | boolean | Yes  | Whether the area outside the subwindow is touchable. The value **true** means the area outside the subwindow is touchable, and **false** means the opposite.|
5659
5660**Return value**
5661
5662| Type               | Description                     |
5663| ------------------- | ------------------------- |
5664| Promise&lt;void&gt; | Promise that returns no value.|
5665
5666**Example**
5667
5668```js
5669let promise = windowClass.setOutsideTouchable(true);
5670promise.then(()=> {
5671    console.info('Succeeded in setting the area to be touchable.');
5672}).catch((err)=>{
5673    console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
5674});
5675```
5676
5677### setPrivacyMode<sup>(deprecated)</sup>
5678
5679setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback&lt;void&gt;): void
5680
5681Sets whether this window is in privacy mode. This API uses an asynchronous callback to return the result. When in privacy mode, the window content cannot be captured or recorded.
5682
5683> **NOTE**
5684>
5685> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowPrivacyMode()](#setwindowprivacymode9) instead.
5686
5687**System capability**: SystemCapability.WindowManager.WindowManager.Core
5688
5689**Parameters**
5690
5691| Name       | Type                     | Mandatory| Description                |
5692| ------------- | ------------------------- | ---- | -------------------- |
5693| isPrivacyMode | boolean                   | Yes  | Whether the window is in privacy mode. The value **true** means that the window is in privacy mode, and **false** means the opposite.|
5694| callback      | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
5695
5696**Example**
5697
5698```js
5699let isPrivacyMode = true;
5700windowClass.setPrivacyMode(isPrivacyMode, (err) => {
5701    if (err.code) {
5702        console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(err));
5703        return;
5704    }
5705    console.info('Succeeded in setting the window to privacy mode.');
5706});
5707```
5708
5709### setPrivacyMode<sup>(deprecated)</sup>
5710
5711setPrivacyMode(isPrivacyMode: boolean): Promise&lt;void&gt;
5712
5713Sets whether this window is in privacy mode. This API uses a promise to return the result. When in privacy mode, the window content cannot be captured or recorded.
5714
5715> **NOTE**
5716>
5717> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowPrivacyMode()](#setwindowprivacymode9-1) instead.
5718
5719**System capability**: SystemCapability.WindowManager.WindowManager.Core
5720
5721**Parameters**
5722
5723| Name       | Type   | Mandatory| Description                |
5724| ------------- | ------- | ---- | -------------------- |
5725| isPrivacyMode | boolean | Yes  | Whether the window is in privacy mode. The value **true** means that the window is in privacy mode, and **false** means the opposite.|
5726
5727**Return value**
5728
5729| Type               | Description                     |
5730| ------------------- | ------------------------- |
5731| Promise&lt;void&gt; | Promise that returns no value.|
5732
5733**Example**
5734
5735```js
5736let isPrivacyMode = true;
5737let promise = windowClass.setPrivacyMode(isPrivacyMode);
5738promise.then(()=> {
5739    console.info('Succeeded in setting the window to privacy mode.');
5740}).catch((err)=>{
5741    console.error('Failed to set the window to privacy mode. Cause: ' + JSON.stringify(err));
5742});
5743```
5744
5745### setTouchable<sup>(deprecated)</sup>
5746
5747setTouchable(isTouchable: boolean, callback: AsyncCallback&lt;void&gt;): void
5748
5749Sets whether this window is touchable. This API uses an asynchronous callback to return the result.
5750
5751> **NOTE**
5752>
5753> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowTouchable()](#setwindowtouchable9) instead.
5754
5755**System capability**: SystemCapability.WindowManager.WindowManager.Core
5756
5757**Parameters**
5758
5759| Name     | Type                     | Mandatory| Description                |
5760| ----------- | ------------------------- | ---- | -------------------- |
5761| isTouchable | boolean                   | Yes  | Whether the window is touchable. The value **true** means that the window is touchable, and **false** means the opposite.|
5762| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
5763
5764**Example**
5765
5766```js
5767let isTouchable = true;
5768windowClass.setTouchable(isTouchable, (err) => {
5769    if (err.code) {
5770        console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(err));
5771        return;
5772    }
5773    console.info('Succeeded in setting the window to be touchable.');
5774});
5775```
5776
5777### setTouchable<sup>(deprecated)</sup>
5778
5779setTouchable(isTouchable: boolean): Promise&lt;void&gt;
5780
5781Sets whether this window is touchable. This API uses a promise to return the result.
5782
5783> **NOTE**
5784>
5785> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowTouchable()](#setwindowtouchable9-1) instead.
5786
5787**System capability**: SystemCapability.WindowManager.WindowManager.Core
5788
5789**Parameters**
5790
5791| Name     | Type   | Mandatory| Description                |
5792| ----------- | ------- | ---- | -------------------- |
5793| isTouchable | boolean | Yes  | Whether the window is touchable. The value **true** means that the window is touchable, and **false** means the opposite.|
5794
5795**Return value**
5796
5797| Type               | Description                     |
5798| ------------------- | ------------------------- |
5799| Promise&lt;void&gt; | Promise that returns no value.|
5800
5801**Example**
5802
5803```js
5804let isTouchable = true;
5805let promise = windowClass.setTouchable(isTouchable);
5806promise.then(()=> {
5807    console.info('Succeeded in setting the window to be touchable.');
5808}).catch((err)=>{
5809    console.error('Failed to set the window to be touchable. Cause: ' + JSON.stringify(err));
5810});
5811```
5812
5813## WindowStageEventType<sup>9+</sup>
5814
5815Describes the lifecycle of a window stage.
5816
5817**Model restriction**: This API can be used only in the stage model.
5818
5819**System capability**: SystemCapability.WindowManager.WindowManager.Core
5820
5821| Name      | Value| Description      |
5822| ---------- | ------ | ---------- |
5823| SHOWN      | 1      | The window stage is running in the foreground.|
5824| ACTIVE     | 2      | The window stage gains focus.|
5825| INACTIVE   | 3      | The window stage loses focus.|
5826| HIDDEN     | 4      | The window stage is running in the background.|
5827
5828## WindowStage<sup>9+</sup>
5829
5830Implements a window manager, which manages each basic window unit, that is, [Window](#window) instance.
5831
5832Before calling any of the following APIs, you must use [onWindowStageCreate()](js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) to create a **WindowStage** instance.
5833
5834### getMainWindow<sup>9+</sup>
5835
5836getMainWindow(callback: AsyncCallback&lt;Window&gt;): void
5837
5838Obtains the main window of this window stage. This API uses an asynchronous callback to return the result.
5839
5840**Model restriction**: This API can be used only in the stage model.
5841
5842**System capability**: SystemCapability.WindowManager.WindowManager.Core
5843
5844**Parameters**
5845
5846| Name  | Type                                  | Mandatory| Description                                         |
5847| -------- | -------------------------------------- | ---- | --------------------------------------------- |
5848| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes  | Callback used to return the main window.|
5849
5850**Error codes**
5851
5852For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
5853
5854| ID| Error Message|
5855| ------- | ------------------------------ |
5856| 1300002 | This window state is abnormal. |
5857| 1300005 | This window stage is abnormal. |
5858
5859**Example**
5860
5861```ts
5862import UIAbility from '@ohos.app.ability.UIAbility';
5863
5864class myAbility extends UIAbility {
5865    onWindowStageCreate(windowStage) {
5866        console.log('onWindowStageCreate');
5867        let windowClass = null;
5868        windowStage.getMainWindow((err, data) => {
5869            if (err.code) {
5870                console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err));
5871                return;
5872            }
5873            windowClass = data;
5874            console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
5875        });
5876    }
5877};
5878```
5879
5880### getMainWindow<sup>9+</sup>
5881
5882getMainWindow(): Promise&lt;Window&gt;
5883
5884Obtains the main window of this window stage. This API uses a promise to return the result.
5885
5886**Model restriction**: This API can be used only in the stage model.
5887
5888**System capability**: SystemCapability.WindowManager.WindowManager.Core
5889
5890**Return value**
5891
5892| Type                            | Description                                            |
5893| -------------------------------- | ------------------------------------------------ |
5894| Promise&lt;[Window](#window)&gt; | Promise used to return the main window.|
5895
5896**Error codes**
5897
5898For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
5899
5900| ID| Error Message|
5901| ------- | ------------------------------ |
5902| 1300002 | This window state is abnormal. |
5903| 1300005 | This window stage is abnormal. |
5904
5905**Example**
5906
5907```ts
5908import UIAbility from '@ohos.app.ability.UIAbility';
5909
5910class myAbility extends UIAbility {
5911    onWindowStageCreate(windowStage) {
5912        console.log('onWindowStageCreate');
5913        let windowClass = null;
5914        let promise = windowStage.getMainWindow();
5915        promise.then((data) => {
5916        windowClass = data;
5917            console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
5918        }).catch((err) => {
5919            console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err));
5920        });
5921    }
5922};
5923```
5924
5925### getMainWindowSync<sup>9+</sup>
5926
5927getMainWindowSync(): Window
5928
5929Obtains the main window of this window stage.
5930
5931**Model restriction**: This API can be used only in the stage model.
5932
5933**System capability**: SystemCapability.WindowManager.WindowManager.Core
5934
5935**Return value**
5936
5937| Type| Description|
5938| ----------------- | --------------------------------- |
5939| [Window](#window) | return the main window.|
5940
5941**Error codes**
5942
5943For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
5944
5945| ID| Error Message|
5946| ------- | ------------------------------ |
5947| 1300002 | This window state is abnormal. |
5948| 1300005 | This window stage is abnormal. |
5949
5950**Example**
5951
5952```ts
5953import UIAbility from '@ohos.app.ability.UIAbility';
5954
5955class myAbility extends UIAbility {
5956    onWindowStageCreate(windowStage) {
5957        console.log('onWindowStageCreate');
5958        try {
5959            let windowClass = windowStage.getMainWindowSync();
5960        } catch (exception) {
5961            console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(exception));
5962        };
5963    }
5964};
5965```
5966
5967### createSubWindow<sup>9+</sup>
5968
5969createSubWindow(name: string, callback: AsyncCallback&lt;Window&gt;): void
5970
5971Creates a subwindow for this window stage. This API uses an asynchronous callback to return the result.
5972
5973**Model restriction**: This API can be used only in the stage model.
5974
5975**System capability**: SystemCapability.WindowManager.WindowManager.Core
5976
5977**Parameters**
5978
5979| Name  | Type                                  | Mandatory| Description                                         |
5980| -------- | -------------------------------------- | ---- | --------------------------------------------- |
5981| name     | string                                 | Yes  | Name of the subwindow.                               |
5982| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes  | Callback used to return the subwindow.|
5983
5984**Error codes**
5985
5986For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
5987
5988| ID| Error Message|
5989| ------- | ------------------------------ |
5990| 1300002 | This window state is abnormal. |
5991| 1300005 | This window stage is abnormal. |
5992
5993**Example**
5994
5995```ts
5996import UIAbility from '@ohos.app.ability.UIAbility';
5997
5998class myAbility extends UIAbility {
5999    onWindowStageCreate(windowStage) {
6000        console.log('onWindowStageCreate');
6001        let windowClass = null;
6002        try {
6003            windowStage.createSubWindow('mySubWindow', (err, data) => {
6004                if (err.code) {
6005                    console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(err));
6006                    return;
6007                }
6008                windowClass = data;
6009                console.info('Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
6010                windowClass.resetSize(500, 1000);
6011            });
6012        } catch (exception) {
6013            console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(exception));
6014        };
6015    }
6016};
6017```
6018### createSubWindow<sup>9+</sup>
6019
6020createSubWindow(name: string): Promise&lt;Window&gt;
6021
6022Creates a subwindow for this window stage. This API uses a promise to return the result.
6023
6024**Model restriction**: This API can be used only in the stage model.
6025
6026**System capability**: SystemCapability.WindowManager.WindowManager.Core
6027
6028**Parameters**
6029
6030| Name| Type  | Mandatory| Description          |
6031| ------ | ------ | ---- | -------------- |
6032| name   | string | Yes  | Name of the subwindow.|
6033
6034**Return value**
6035
6036| Type                            | Description                                            |
6037| -------------------------------- | ------------------------------------------------ |
6038| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow.|
6039
6040**Error codes**
6041
6042For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6043
6044| ID| Error Message|
6045| ------- | ------------------------------ |
6046| 1300002 | This window state is abnormal. |
6047| 1300005 | This window stage is abnormal. |
6048
6049**Example**
6050
6051```ts
6052import UIAbility from '@ohos.app.ability.UIAbility';
6053
6054class myAbility extends UIAbility {
6055    onWindowStageCreate(windowStage) {
6056        console.log('onWindowStageCreate');
6057        let windowClass = null;
6058        try {
6059            let promise = windowStage.createSubWindow('mySubWindow');
6060            promise.then((data) => {
6061                windowClass = data;
6062                console.info('Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
6063            }).catch((err) => {
6064                console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(err));
6065            });
6066        } catch (exception) {
6067            console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(exception));
6068        };
6069    }
6070};
6071```
6072
6073### getSubWindow<sup>9+</sup>
6074
6075getSubWindow(callback: AsyncCallback&lt;Array&lt;Window&gt;&gt;): void
6076
6077Obtains all the subwindows of this window stage. This API uses an asynchronous callback to return the result.
6078
6079**Model restriction**: This API can be used only in the stage model.
6080
6081**System capability**: SystemCapability.WindowManager.WindowManager.Core
6082
6083**Parameters**
6084
6085| Name  | Type                                               | Mandatory| Description                                             |
6086| -------- | --------------------------------------------------- | ---- | ------------------------------------------------- |
6087| callback | AsyncCallback&lt;Array&lt;[Window](#window)&gt;&gt; | Yes  | Callback used to return all the subwindows.|
6088
6089**Error codes**
6090
6091For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6092
6093| ID| Error Message|
6094| ------- | ------------------------------ |
6095| 1300005 | This window stage is abnormal. |
6096
6097**Example**
6098
6099```ts
6100import UIAbility from '@ohos.app.ability.UIAbility';
6101
6102class myAbility extends UIAbility {
6103    onWindowStageCreate(windowStage) {
6104        console.log('onWindowStageCreate');
6105        let windowClass = null;
6106        windowStage.getSubWindow((err, data) => {
6107            if (err.code) {
6108                console.error('Failed to obtain the subwindow. Cause: ' + JSON.stringify(err));
6109                return;
6110            }
6111            windowClass = data;
6112            console.info('Succeeded in obtaining the subwindow. Data: ' + JSON.stringify(data));
6113        });
6114    }
6115};
6116```
6117### getSubWindow<sup>9+</sup>
6118
6119getSubWindow(): Promise&lt;Array&lt;Window&gt;&gt;
6120
6121Obtains all the subwindows of this window stage. This API uses a promise to return the result.
6122
6123**Model restriction**: This API can be used only in the stage model.
6124
6125**System capability**: SystemCapability.WindowManager.WindowManager.Core
6126
6127**Return value**
6128
6129| Type                                         | Description                                                |
6130| --------------------------------------------- | ---------------------------------------------------- |
6131| Promise&lt;Array&lt;[Window](#window)&gt;&gt; | Promise used to return all the subwindows.|
6132
6133**Error codes**
6134
6135For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6136
6137| ID| Error Message|
6138| ------- | ------------------------------ |
6139| 1300005 | This window stage is abnormal. |
6140
6141**Example**
6142
6143```ts
6144import UIAbility from '@ohos.app.ability.UIAbility';
6145
6146class myAbility extends UIAbility {
6147    onWindowStageCreate(windowStage) {
6148        console.log('onWindowStageCreate');
6149        let windowClass = null;
6150        let promise = windowStage.getSubWindow();
6151        promise.then((data) => {
6152            windowClass = data;
6153            console.info('Succeeded in obtaining the subwindow. Data: ' + JSON.stringify(data));
6154        }).catch((err) => {
6155            console.error('Failed to obtain the subwindow. Cause: ' + JSON.stringify(err));
6156        })
6157    }
6158};
6159```
6160### loadContent<sup>9+</sup>
6161
6162loadContent(path: string, storage: LocalStorage, callback: AsyncCallback&lt;void&gt;): void
6163
6164Loads content from a page associated with a local storage to the main window in this window stage. This API uses an asynchronous callback to return the result.
6165
6166**Model restriction**: This API can be used only in the stage model.
6167
6168**System capability**: SystemCapability.WindowManager.WindowManager.Core
6169
6170**Parameters**
6171
6172| Name  | Type                                           | Mandatory| Description                                                        |
6173| -------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
6174| path     | string                                          | Yes  | Path of the page from which the content will be loaded.                                        |
6175| storage  | [LocalStorage](../../quick-start/arkts-localstorage.md) | Yes  | A storage unit, which provides storage for variable state properties and non-variable state properties of an application.|
6176| callback | AsyncCallback&lt;void&gt;                       | Yes  | Callback used to return the result.                                                  |
6177
6178**Error codes**
6179
6180For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6181
6182| ID| Error Message|
6183| ------- | ------------------------------ |
6184| 1300002 | This window state is abnormal. |
6185| 1300005 | This window stage is abnormal. |
6186
6187**Example**
6188
6189```ts
6190import UIAbility from '@ohos.app.ability.UIAbility';
6191
6192class myAbility extends UIAbility {
6193    storage : LocalStorage
6194    onWindowStageCreate(windowStage) {
6195        this.storage = new LocalStorage();
6196        this.storage.setOrCreate('storageSimpleProp',121);
6197        console.log('onWindowStageCreate');
6198        try {
6199            windowStage.loadContent('pages/page2',this.storage,(err) => {
6200                if (err.code) {
6201                    console.error('Failed to load the content. Cause:' + JSON.stringify(err));
6202                    return;
6203                }
6204                console.info('Succeeded in loading the content.');
6205            });
6206        } catch (exception) {
6207            console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
6208        };
6209    }
6210};
6211```
6212
6213### loadContent<sup>9+</sup>
6214
6215loadContent(path: string, storage?: LocalStorage): Promise&lt;void&gt;
6216
6217Loads content from a page associated with a local storage to the main window in this window stage. This API uses a promise to return the result.
6218
6219**Model restriction**: This API can be used only in the stage model.
6220
6221**System capability**: SystemCapability.WindowManager.WindowManager.Core
6222
6223**Parameters**
6224
6225| Name | Type                                           | Mandatory| Description                                                        |
6226| ------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
6227| path    | string                                          | Yes  | Path of the page from which the content will be loaded.                                        |
6228| storage | [LocalStorage](../../quick-start/arkts-localstorage.md) | No  | A storage unit, which provides storage for variable state properties and non-variable state properties of an application.|
6229
6230**Return value**
6231
6232| Type               | Description                     |
6233| ------------------- | ------------------------- |
6234| Promise&lt;void&gt; | Promise that returns no value.|
6235
6236**Error codes**
6237
6238For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6239
6240| ID| Error Message|
6241| ------- | ------------------------------ |
6242| 1300002 | This window state is abnormal. |
6243| 1300005 | This window stage is abnormal. |
6244
6245**Example**
6246
6247```ts
6248import UIAbility from '@ohos.app.ability.UIAbility';
6249
6250class myAbility extends UIAbility {
6251    storage : LocalStorage
6252    onWindowStageCreate(windowStage) {
6253        this.storage = new LocalStorage();
6254        this.storage.setOrCreate('storageSimpleProp',121);
6255        console.log('onWindowStageCreate');
6256        try {
6257            let promise = windowStage.loadContent('pages/page2',this.storage);
6258            promise.then(() => {
6259                console.info('Succeeded in loading the content.');
6260            }).catch((err) => {
6261                console.error('Failed to load the content. Cause:' + JSON.stringify(err));
6262            });
6263        } catch (exception) {
6264            console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
6265        };
6266    }
6267};
6268```
6269
6270### loadContent<sup>9+</sup>
6271
6272loadContent(path: string, callback: AsyncCallback&lt;void&gt;): void
6273
6274Loads content from a page to this window stage. This API uses an asynchronous callback to return the result.
6275
6276**Model restriction**: This API can be used only in the stage model.
6277
6278**System capability**: SystemCapability.WindowManager.WindowManager.Core
6279
6280**Parameters**
6281
6282| Name  | Type                     | Mandatory| Description                |
6283| -------- | ------------------------- | ---- | -------------------- |
6284| path     | string                    | Yes  | Path of the page from which the content will be loaded.|
6285| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
6286
6287**Error codes**
6288
6289For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6290
6291| ID| Error Message|
6292| ------- | ------------------------------ |
6293| 1300002 | This window state is abnormal. |
6294| 1300005 | This window stage is abnormal. |
6295
6296**Example**
6297
6298```ts
6299import UIAbility from '@ohos.app.ability.UIAbility';
6300
6301class myAbility extends UIAbility {
6302    onWindowStageCreate(windowStage) {
6303        console.log('onWindowStageCreate');
6304        try {
6305            windowStage.loadContent('pages/page2', (err) => {
6306                if (err.code) {
6307                    console.error('Failed to load the content. Cause:' + JSON.stringify(err));
6308                    return;
6309                }
6310                console.info('Succeeded in loading the content.');
6311            });
6312        } catch (exception) {
6313            console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
6314        };
6315    }
6316};
6317```
6318
6319### on('windowStageEvent')<sup>9+</sup>
6320
6321on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void
6322
6323Enables listening for window stage lifecycle changes.
6324
6325**Model restriction**: This API can be used only in the stage model.
6326
6327**System capability**: SystemCapability.WindowManager.WindowManager.Core
6328
6329**Parameters**
6330
6331| Name  | Type                                                        | Mandatory| Description                                                        |
6332| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
6333| type     | string                                                       | Yes  | Event type. The value is fixed at **'windowStageEvent'**, indicating the window stage lifecycle change event.|
6334| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | Yes  | Callback used to return the window stage lifecycle state.               |
6335
6336**Error codes**
6337
6338For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6339
6340| ID| Error Message|
6341| ------- | ------------------------------ |
6342| 1300002 | This window state is abnormal. |
6343| 1300005 | This window stage is abnormal. |
6344
6345**Example**
6346
6347```ts
6348import UIAbility from '@ohos.app.ability.UIAbility';
6349
6350class myAbility extends UIAbility {
6351    onWindowStageCreate(windowStage) {
6352        console.log('onWindowStageCreate');
6353        try {
6354            windowStage.on('windowStageEvent', (data) => {
6355                console.info('Succeeded in enabling the listener for window stage event changes. Data: ' +
6356                    JSON.stringify(data));
6357            });
6358        } catch (exception) {
6359            console.error('Failed to enable the listener for window stage event changes. Cause:' +
6360                JSON.stringify(exception));
6361        };
6362    }
6363};
6364```
6365
6366### off('windowStageEvent')<sup>9+</sup>
6367
6368off(eventType: 'windowStageEvent', callback?: Callback&lt;WindowStageEventType&gt;): void
6369
6370Disables listening for window stage lifecycle changes.
6371
6372**Model restriction**: This API can be used only in the stage model.
6373
6374**System capability**: SystemCapability.WindowManager.WindowManager.Core
6375
6376**Parameters**
6377
6378| Name  | Type                                                        | Mandatory| Description                                                        |
6379| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
6380| type     | string                                                       | Yes  | Event type. The value is fixed at **'windowStageEvent'**, indicating the window stage lifecycle change event.|
6381| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | No  | Callback used to return the window stage lifecycle state.               |
6382
6383**Error codes**
6384
6385For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6386
6387| ID| Error Message|
6388| ------- | ------------------------------ |
6389| 1300002 | This window state is abnormal. |
6390| 1300005 | This window stage is abnormal. |
6391
6392**Example**
6393
6394```ts
6395import UIAbility from '@ohos.app.ability.UIAbility';
6396
6397class myAbility extends UIAbility {
6398    onWindowStageCreate(windowStage) {
6399        console.log('onWindowStageCreate');
6400        try {
6401            windowStage.off('windowStageEvent');
6402        } catch (exception) {
6403            console.error('Failed to disable the listener for window stage event changes. Cause:' +
6404                JSON.stringify(exception));
6405        };
6406    }
6407};
6408```
6409
6410### disableWindowDecor()<sup>9+</sup>
6411
6412disableWindowDecor(): void
6413
6414Disables window decorators.
6415
6416**Model restriction**: This API can be used only in the stage model.
6417
6418**System API**: This is a system API.
6419
6420**System capability**: SystemCapability.WindowManager.WindowManager.Core
6421
6422**Error codes**
6423
6424For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6425
6426| ID| Error Message|
6427| ------- | ------------------------------ |
6428| 1300002 | This window state is abnormal. |
6429| 1300005 | This window stage is abnormal. |
6430
6431**Example**
6432
6433```ts
6434import UIAbility from '@ohos.app.ability.UIAbility';
6435
6436class myAbility extends UIAbility {
6437    onWindowStageCreate(windowStage) {
6438        console.log('disableWindowDecor');
6439        windowStage.disableWindowDecor();
6440    }
6441};
6442```
6443
6444### setShowOnLockScreen()<sup>9+</sup>
6445
6446setShowOnLockScreen(showOnLockScreen: boolean): void
6447
6448Sets whether to display the window of the application on the lock screen.
6449
6450**System API**: This is a system API.
6451
6452**Model restriction**: This API can be used only in the stage model.
6453
6454**System capability**: SystemCapability.WindowManager.WindowManager.Core
6455
6456**Parameters**
6457
6458| Name          | Type   | Mandatory| Description                        |
6459| ---------------- | ------- | ---- | ---------------------------- |
6460| showOnLockScreen | boolean | Yes  | Whether to display the window on the lock screen. The value **true** means to display the window on the lock screen, and **false** means the opposite.|
6461
6462**Error codes**
6463
6464For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6465
6466| ID| Error Message|
6467| ------- | ------------------------------ |
6468| 1300002 | This window state is abnormal. |
6469| 1300005 | This window stage is abnormal. |
6470
6471**Example**
6472
6473```ts
6474import UIAbility from '@ohos.app.ability.UIAbility';
6475
6476class myAbility extends UIAbility {
6477    onWindowStageCreate(windowStage) {
6478        console.log('onWindowStageCreate');
6479        try {
6480            windowStage.setShowOnLockScreen(true);
6481        } catch (exception) {
6482            console.error('Failed to show on lockscreen. Cause:' + JSON.stringify(exception));
6483        };
6484    }
6485};
6486```
6487## TransitionContext<sup>9+</sup>
6488
6489Provides the context for the transition animation.
6490
6491### Attributes
6492
6493**System API**: This is a system API.
6494
6495**System capability**: SystemCapability.WindowManager.WindowManager.Core
6496
6497| Name                 | Type         | Readable| Writable| Description            |
6498| --------------------- | ----------------- | ---- | ---- | ---------------- |
6499| toWindow<sup>9+</sup> | [Window](#window) | Yes  | Yes  | Target window to display the animation.|
6500
6501### completeTransition<sup>9+</sup>
6502
6503completeTransition(isCompleted: boolean): void
6504
6505Completes the transition. This API can be called only after [animateTo()](../arkui-ts/ts-explicit-animation.md) is executed.
6506
6507**System API**: This is a system API.
6508
6509**System capability**: SystemCapability.WindowManager.WindowManager.Core
6510
6511**Parameters**
6512
6513| Name     | Type   | Mandatory| Description                                                        |
6514| ----------- | ------- | ---- | ------------------------------------------------------------ |
6515| isCompleted | boolean | Yes  | Whether the transition is complete. The value **true** means that the transition is complete, and **false** means the opposite.|
6516
6517**Example**
6518
6519```js
6520let controller = windowClass.getTransitionController();
6521controller.animationForShown = (context : window.TransitionContext) => {
6522	let toWindow = context.toWindow;
6523 	animateTo({
6524    	duration: 1000, // Animation duration.
6525        tempo: 0.5, // Playback speed.
6526        curve: Curve.EaseInOut, // Animation curve.
6527        delay: 0, // Animation delay.
6528        iterations: 1, // Number of playback times.
6529        playMode: PlayMode.Normal // Animation playback mode.
6530      }, () => {
6531        let obj : window.TranslateOptions = {
6532          x : 100.0,
6533          y : 0.0,
6534          z : 0.0
6535        };
6536        toWindow.translate(obj);
6537        console.info('toWindow translate end');
6538      }
6539    );
6540    try {
6541        context.completeTransition(true)
6542    } catch (exception) {
6543        console.info('toWindow translate fail. Cause: ' + JSON.stringify(exception));
6544    }
6545    console.info('complete transition end');
6546};
6547```
6548
6549## TransitionController<sup>9+</sup>
6550
6551Implements the transition animation controller.
6552
6553### animationForShown<sup>9+</sup>
6554
6555animationForShown(context: TransitionContext): void
6556
6557Customizes the animation for the scenario when the window is shown.
6558
6559**System API**: This is a system API.
6560
6561**System capability**: SystemCapability.WindowManager.WindowManager.Core
6562
6563**Parameters**
6564
6565| Name | Type                                    | Mandatory| Description                |
6566| ------- | ---------------------------------------- | ---- | -------------------- |
6567| context | [TransitionContext](#transitioncontext9) | Yes  | Context of the transition animation.|
6568
6569**Example**
6570
6571```js
6572let controller = windowClass.getTransitionController();
6573controller.animationForShown = (context : window.TransitionContext) => {
6574	let toWindow = context.toWindow;
6575 	animateTo({
6576    	duration: 1000, // Animation duration.
6577        tempo: 0.5, // Playback speed.
6578        curve: Curve.EaseInOut, // Animation curve.
6579        delay: 0, // Animation delay.
6580        iterations: 1, // Number of playback times.
6581        playMode: PlayMode.Normal // Animation playback mode.
6582        onFinish: ()=> {
6583            context.completeTransition(true)
6584        }
6585      }, () => {
6586        let obj : window.TranslateOptions = {
6587          x : 100.0,
6588          y : 0.0,
6589          z : 0.0
6590        };
6591        toWindow.translate(obj);
6592        console.info('toWindow translate end');
6593      }
6594    );
6595    console.info('complete transition end');
6596};
6597```
6598
6599### animationForHidden<sup>9+</sup>
6600
6601animationForHidden(context: TransitionContext): void
6602
6603Customizes the animation for the scenario when the window is hidden.
6604
6605**System API**: This is a system API.
6606
6607**System capability**: SystemCapability.WindowManager.WindowManager.Core
6608
6609**Parameters**
6610
6611| Name | Type                                    | Mandatory| Description                |
6612| ------- | ---------------------------------------- | ---- | -------------------- |
6613| context | [TransitionContext](#transitioncontext9) | Yes  | Context of the transition animation.|
6614
6615**Example**
6616
6617```js
6618let controller = windowClass.getTransitionController();
6619controller.animationForHidden = (context : window.TransitionContext) => {
6620	let toWindow = context.toWindow;
6621 	animateTo({
6622    	duration: 1000, // Animation duration.
6623        tempo: 0.5, // Playback speed.
6624        curve: Curve.EaseInOut, // Animation curve.
6625        delay: 0, // Animation delay.
6626        iterations: 1, // Number of playback times.
6627        playMode: PlayMode.Normal // Animation playback mode.
6628        onFinish: ()=> {
6629            context.completeTransition(true)
6630        }
6631      }, () => {
6632        let obj : window.TranslateOptions = {
6633          x : 100.0,
6634          y : 0.0,
6635          z : 0.0
6636        };
6637        toWindow.translate(obj);
6638        console.info('toWindow translate end');
6639      }
6640    )
6641    console.info('complete transition end');
6642};
6643```
6644