• 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, navigation bar, and Dock 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 value 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 value 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 value 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.                 |
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-state-mgmt-application-level.md#localstorage) | 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-state-mgmt-application-level.md#localstorage) | 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 [loadContent](#loadcontent9).
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 value 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
3094**System capability**: SystemCapability.WindowManager.WindowManager.Core
3095
3096**Parameters**
3097
3098| Name| Type| Mandatory| Description|
3099| ---------- | ------------------------- | -- | --------------------------------- |
3100| brightness | number                    | Yes| Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.|
3101| callback   | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                        |
3102
3103**Error codes**
3104
3105For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3106
3107| ID| Error Message|
3108| ------- | -------------------------------------------- |
3109| 1300002 | This window state is abnormal.               |
3110| 1300003 | This window manager service works abnormally. |
3111
3112**Example**
3113
3114```js
3115let brightness = 1;
3116try {
3117    windowClass.setWindowBrightness(brightness, (err) => {
3118        if (err.code) {
3119            console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
3120            return;
3121        }
3122        console.info('Succeeded in setting the brightness.');
3123    });
3124} catch (exception) {
3125    console.error('Failed to set the brightness. Cause: ' + JSON.stringify(exception));
3126}
3127```
3128
3129### setWindowBrightness<sup>9+</sup>
3130
3131setWindowBrightness(brightness: number): Promise&lt;void&gt;
3132
3133Sets the screen brightness for this window. This API uses a promise to return the result.
3134
3135**System capability**: SystemCapability.WindowManager.WindowManager.Core
3136
3137**Parameters**
3138
3139| Name| Type| Mandatory| Description|
3140| ---------- | ------ | -- | --------------------------------- |
3141| brightness | number | Yes| Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.|
3142
3143**Return value**
3144
3145| Type| Description|
3146| ------------------- | ------------------------ |
3147| Promise&lt;void&gt; | Promise that returns no value.|
3148
3149**Error codes**
3150
3151For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3152
3153| ID| Error Message|
3154| ------- | -------------------------------------------- |
3155| 1300002 | This window state is abnormal.               |
3156| 1300003 | This window manager service works abnormally. |
3157
3158**Example**
3159
3160```js
3161let brightness = 1;
3162try {
3163    let promise = windowClass.setWindowBrightness(brightness);
3164    promise.then(()=> {
3165        console.info('Succeeded in setting the brightness.');
3166    }).catch((err)=>{
3167        console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
3168    });
3169} catch (exception) {
3170    console.error('Failed to set the brightness. Cause: ' + JSON.stringify(exception));
3171}
3172```
3173
3174### setWindowFocusable<sup>9+</sup>
3175
3176setWindowFocusable(isFocusable: boolean, callback: AsyncCallback&lt;void&gt;): void
3177
3178Sets whether this window can gain focus. This API uses an asynchronous callback to return the result.
3179
3180**System capability**: SystemCapability.WindowManager.WindowManager.Core
3181
3182**Parameters**
3183
3184| Name| Type| Mandatory| Description|
3185| ----------- | ------------------------- | -- | ------------------------------------------------------- |
3186| isFocusable | boolean                   | Yes| Whether the window can gain focus. The value **true** means that the window can gain focus, and **false** means the opposite.|
3187| callback    | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                                              |
3188
3189**Error codes**
3190
3191For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3192
3193| ID| Error Message|
3194| ------- | -------------------------------------------- |
3195| 1300002 | This window state is abnormal.               |
3196| 1300003 | This window manager service works abnormally. |
3197
3198**Example**
3199
3200```js
3201let isFocusable = true;
3202try {
3203    windowClass.setWindowFocusable(isFocusable, (err) => {
3204        if (err.code) {
3205            console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(err));
3206            return;
3207        }
3208        console.info('Succeeded in setting the window to be focusable.');
3209    });
3210} catch (exception) {
3211    console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(exception));
3212}
3213```
3214
3215### setWindowFocusable<sup>9+</sup>
3216
3217setWindowFocusable(isFocusable: boolean): Promise&lt;void&gt;
3218
3219Sets whether this window can gain focus. This API uses a promise to return the result.
3220
3221**System capability**: SystemCapability.WindowManager.WindowManager.Core
3222
3223**Parameters**
3224
3225| Name| Type| Mandatory| Description|
3226| ----------- | ------- | -- | -------------------------------------------------------- |
3227| isFocusable | boolean | Yes| Whether the window can gain focus. The value **true** means that the window can gain focus, and **false** means the opposite. |
3228
3229**Return value**
3230
3231| Type| Description|
3232| ------------------- | ------------------------ |
3233| Promise&lt;void&gt; | Promise that returns no value.|
3234
3235**Error codes**
3236
3237For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3238
3239| ID| Error Message|
3240| ------- | -------------------------------------------- |
3241| 1300002 | This window state is abnormal.               |
3242| 1300003 | This window manager service works abnormally. |
3243
3244**Example**
3245
3246```js
3247let isFocusable = true;
3248try {
3249    let promise = windowClass.setWindowFocusable(isFocusable);
3250    promise.then(()=> {
3251        console.info('Succeeded in setting the window to be focusable.');
3252    }).catch((err)=>{
3253        console.error('Failed to set the window to be focusable. Cause: ' + JSON.stringify(err));
3254    });
3255} catch (exception) {
3256    console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(exception));
3257}
3258```
3259
3260### setWindowKeepScreenOn<sup>9+</sup>
3261
3262setWindowKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback&lt;void&gt;): void
3263
3264Sets whether to keep the screen always on. This API uses an asynchronous callback to return the result.
3265
3266**System capability**: SystemCapability.WindowManager.WindowManager.Core
3267
3268**Parameters**
3269
3270| Name| Type| Mandatory| Description|
3271| -------------- | ------------------------- | -- | ---------------------------------------------------- |
3272| 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. |
3273| callback       | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                                           |
3274
3275**Error codes**
3276
3277For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3278
3279| ID| Error Message|
3280| ------- | -------------------------------------------- |
3281| 1300002 | This window state is abnormal.               |
3282| 1300003 | This window manager service works abnormally. |
3283
3284**Example**
3285
3286```js
3287let isKeepScreenOn = true;
3288try {
3289    windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err) => {
3290        if (err.code) {
3291            console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(err));
3292            return;
3293        }
3294        console.info('Succeeded in setting the screen to be always on.');
3295    });
3296} catch (exception) {
3297    console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(exception));
3298}
3299```
3300
3301### setWindowKeepScreenOn<sup>9+</sup>
3302
3303setWindowKeepScreenOn(isKeepScreenOn: boolean): Promise&lt;void&gt;
3304
3305Sets whether to keep the screen always on. This API uses a promise to return the result.
3306
3307**System capability**: SystemCapability.WindowManager.WindowManager.Core
3308
3309**Parameters**
3310
3311| Name| Type| Mandatory| Description|
3312| -------------- | ------- | -- | --------------------------------------------------- |
3313| 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.|
3314
3315**Return value**
3316
3317| Type| Description|
3318| ------------------- | ------------------------ |
3319| Promise&lt;void&gt; | Promise that returns no value.|
3320
3321**Error codes**
3322
3323For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3324
3325| ID| Error Message|
3326| ------- | -------------------------------------------- |
3327| 1300002 | This window state is abnormal.               |
3328| 1300003 | This window manager service works abnormally. |
3329
3330**Example**
3331
3332```js
3333let isKeepScreenOn = true;
3334try {
3335    let promise = windowClass.setWindowKeepScreenOn(isKeepScreenOn);
3336    promise.then(() => {
3337        console.info('Succeeded in setting the screen to be always on.');
3338    }).catch((err)=>{
3339        console.info('Failed to set the screen to be always on. Cause:  ' + JSON.stringify(err));
3340    });
3341} catch (exception) {
3342    console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(exception));
3343}
3344```
3345
3346### setWakeUpScreen()<sup>9+</sup>
3347
3348setWakeUpScreen(wakeUp: boolean): void
3349
3350Wakes up the screen.
3351
3352**System API**: This is a system API.
3353
3354**System capability**: SystemCapability.WindowManager.WindowManager.Core
3355
3356**Parameters**
3357
3358| Name          | Type   | Mandatory| Description                        |
3359| ---------------- | ------- | ---- | ---------------------------- |
3360| wakeUp           | boolean | Yes  | Whether to wake up the screen. The value **true** means to wake up the screen, and **false** means the opposite. |
3361
3362**Error codes**
3363
3364For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3365
3366| ID| Error Message|
3367| ------- | -------------------------------------------- |
3368| 1300002 | This window state is abnormal.               |
3369| 1300003 | This window manager service works abnormally. |
3370
3371**Example**
3372
3373```js
3374let wakeUp = true;
3375try {
3376    windowClass.setWakeUpScreen(wakeUp);
3377} catch (exception) {
3378    console.error('Failed to wake up the screen. Cause: ' + JSON.stringify(exception));
3379}
3380```
3381
3382### setWindowPrivacyMode<sup>9+</sup>
3383
3384setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback&lt;void&gt;): void
3385
3386Sets 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.
3387
3388**System capability**: SystemCapability.WindowManager.WindowManager.Core
3389
3390**Required permissions**: ohos.permission.PRIVACY_WINDOW
3391
3392**Parameters**
3393
3394| Name| Type| Mandatory| Description|
3395| ------------- | ------------------------- | -- | ------------------------------------------------------ |
3396| 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. |
3397| callback      | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                                             |
3398
3399**Error codes**
3400
3401For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3402
3403| ID| Error Message|
3404| ------- | ------------------------------ |
3405| 1300002 | This window state is abnormal. |
3406
3407**Example**
3408
3409```js
3410let isPrivacyMode = true;
3411try {
3412    windowClass.setWindowPrivacyMode(isPrivacyMode, (err) => {
3413        if (err.code) {
3414            console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(err));
3415            return;
3416        }
3417        console.info('Succeeded in setting the window to privacy mode.');
3418    });
3419} catch (exception) {
3420    console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(exception));
3421}
3422```
3423
3424### setWindowPrivacyMode<sup>9+</sup>
3425
3426setWindowPrivacyMode(isPrivacyMode: boolean): Promise&lt;void&gt;
3427
3428Sets 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.
3429
3430**System capability**: SystemCapability.WindowManager.WindowManager.Core
3431
3432**Required permissions**: ohos.permission.PRIVACY_WINDOW
3433
3434**Parameters**
3435
3436| Name| Type| Mandatory| Description|
3437| ------------- | ------- | -- | ----------------------------------------------------- |
3438| 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.|
3439
3440**Return value**
3441
3442| Type| Description|
3443| ------------------- | ------------------------ |
3444| Promise&lt;void&gt; | Promise that returns no value.|
3445
3446**Error codes**
3447
3448For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3449
3450| ID| Error Message|
3451| ------- | ------------------------------ |
3452| 1300002 | This window state is abnormal. |
3453
3454**Example**
3455
3456```js
3457let isPrivacyMode = true;
3458try {
3459    let promise = windowClass.setWindowPrivacyMode(isPrivacyMode);
3460    promise.then(()=> {
3461        console.info('Succeeded in setting the window to privacy mode.');
3462    }).catch((err)=>{
3463        console.error('Failed to set the window to privacy mode. Cause: ' + JSON.stringify(err));
3464    });
3465} catch (exception) {
3466    console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(exception));
3467}
3468```
3469
3470### setSnapshotSkip<sup>9+</sup>
3471setSnapshotSkip(isSkip: boolean): void
3472
3473Sets whether to ignore this window during screen capturing or recording.
3474
3475**System API**: This is a system API.
3476
3477**System capability**: SystemCapability.WindowManager.WindowManager.Core
3478
3479**Parameters**
3480
3481| Name       | Type   | Mandatory| Description                |
3482| ------------- | ------- | ---- | -------------------- |
3483| 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>|
3484
3485**Error codes**
3486
3487For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3488
3489| ID| Error Message|
3490| ------- | ------------------------------ |
3491| 1300002 | This window state is abnormal. |
3492
3493```js
3494let isSkip = true;
3495try {
3496    windowClass.setSnapshotSkip(isSkip);
3497} catch (exception) {
3498    console.error('Failed to Skip. Cause: ' + JSON.stringify(exception));
3499};
3500```
3501
3502### setWindowTouchable<sup>9+</sup>
3503
3504setWindowTouchable(isTouchable: boolean, callback: AsyncCallback&lt;void&gt;): void
3505
3506Sets whether this window is touchable. This API uses an asynchronous callback to return the result.
3507
3508**System capability**: SystemCapability.WindowManager.WindowManager.Core
3509
3510**Parameters**
3511
3512| Name| Type| Mandatory| Description|
3513| ----------- | ------------------------- | -- | ----------------------------------------------- |
3514| isTouchable | boolean                   | Yes| Whether the window is touchable. The value **true** means that the window is touchable, and **false** means the opposite.|
3515| callback    | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.                                       |
3516
3517**Error codes**
3518
3519For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3520
3521| ID| Error Message|
3522| ------- | -------------------------------------------- |
3523| 1300002 | This window state is abnormal.               |
3524| 1300003 | This window manager service works abnormally. |
3525
3526**Example**
3527
3528```js
3529let isTouchable = true;
3530try {
3531    windowClass.setWindowTouchable(isTouchable, (err) => {
3532        if (err.code) {
3533            console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(err));
3534            return;
3535        }
3536        console.info('Succeeded in setting the window to be touchable.');
3537    });
3538} catch (exception) {
3539    console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(exception));
3540}
3541```
3542
3543### setWindowTouchable<sup>9+</sup>
3544
3545setWindowTouchable(isTouchable: boolean): Promise&lt;void&gt;
3546
3547Sets whether this window is touchable. This API uses a promise to return the result.
3548
3549**System capability**: SystemCapability.WindowManager.WindowManager.Core
3550
3551**Parameters**
3552
3553| Name| Type| Mandatory| Description|
3554| ----------- | ------- | -- | ----------------------------------------------- |
3555| isTouchable | boolean | Yes| Whether the window is touchable. The value **true** means that the window is touchable, and **false** means the opposite.|
3556
3557**Return value**
3558
3559| Type| Description|
3560| ------------------- | ------------------------- |
3561| Promise&lt;void&gt; | Promise that returns no value.|
3562
3563**Error codes**
3564
3565For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3566
3567| ID| Error Message|
3568| ------- | -------------------------------------------- |
3569| 1300002 | This window state is abnormal.               |
3570| 1300003 | This window manager service works abnormally. |
3571
3572**Example**
3573
3574```js
3575let isTouchable = true;
3576try {
3577    let promise = windowClass.setWindowTouchable(isTouchable);
3578    promise.then(()=> {
3579        console.info('Succeeded in setting the window to be touchable.');
3580    }).catch((err)=>{
3581        console.error('Failed to set the window to be touchable. Cause: ' + JSON.stringify(err));
3582    });
3583} catch (exception) {
3584    console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(exception));
3585}
3586```
3587
3588### setForbidSplitMove<sup>9+</sup>
3589
3590setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback&lt;void&gt;): void
3591
3592Sets whether this window is forbidden to move in split-screen mode. This API uses an asynchronous callback to return the result.
3593
3594**System API**: This is a system API.
3595
3596**System capability**: SystemCapability.WindowManager.WindowManager.Core
3597
3598**Parameters**
3599
3600| Name     | Type                     | Mandatory| Description                |
3601| ----------- | ------------------------- | ---- | -------------------- |
3602| 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.|
3603| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
3604
3605**Error codes**
3606
3607For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3608
3609| ID| Error Message|
3610| ------- | -------------------------------------------- |
3611| 1300002 | This window state is abnormal.               |
3612| 1300003 | This window manager service works abnormally. |
3613
3614**Example**
3615
3616```js
3617let isForbidSplitMove = true;
3618try {
3619    windowClass.setForbidSplitMove(isForbidSplitMove, (err) => {
3620        if (err.code) {
3621            console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(err));
3622            return;
3623        }
3624        console.info('Succeeded in forbidding window moving in split screen mode.');
3625    });
3626} catch (exception) {
3627    console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(exception));
3628}
3629```
3630
3631### setForbidSplitMove<sup>9+</sup>
3632
3633setForbidSplitMove(isForbidSplitMove: boolean): Promise&lt;void&gt;
3634
3635Sets whether this window is forbidden to move in split-screen mode. This API uses a promise to return the result.
3636
3637**System API**: This is a system API.
3638
3639**System capability**: SystemCapability.WindowManager.WindowManager.Core
3640
3641**Parameters**
3642
3643| Name     | Type   | Mandatory| Description                |
3644| ----------- | ------- | ---- | -------------------- |
3645| 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.|
3646
3647**Return value**
3648
3649| Type               | Description                     |
3650| ------------------- | ------------------------- |
3651| Promise&lt;void&gt; | Promise that returns no value.|
3652
3653**Error codes**
3654
3655For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3656
3657| ID| Error Message|
3658| ------- | -------------------------------------------- |
3659| 1300002 | This window state is abnormal.               |
3660| 1300003 | This window manager service works abnormally. |
3661
3662**Example**
3663
3664```js
3665let isForbidSplitMove = true;
3666try {
3667    let promise = windowClass.setForbidSplitMove(isForbidSplitMove);
3668    promise.then(()=> {
3669        console.info('Succeeded in forbidding window moving in split screen mode.');
3670    }).catch((err)=>{
3671        console.error('Failed to forbid window moving in split screen mode. Cause: ' + JSON.stringify(err));
3672    });
3673} catch (exception) {
3674    console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(exception));
3675}
3676```
3677
3678### snapshot<sup>9+</sup>
3679
3680snapshot(callback: AsyncCallback&lt;image.PixelMap&gt;): void
3681
3682Captures this window. This API uses an asynchronous callback to return the result.
3683
3684**System capability**: SystemCapability.WindowManager.WindowManager.Core
3685
3686**Parameters**
3687
3688| Name     | Type                                                         | Mandatory | Description                         |
3689| -------- | ------------------------------------------------------------ | --------- | ----------------------------------- |
3690| callback | AsyncCallback&lt;[image.PixelMap](js-apis-image.md#pixelmap7)&gt; | Yes       | Callback used to return the result. |
3691
3692**Error codes**
3693
3694For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3695
3696| ID      | Error Message                  |
3697| ------- | ------------------------------ |
3698| 1300002 | This window state is abnormal. |
3699
3700**Example**
3701
3702```js
3703windowClass.snapshot((err, pixelMap) => {
3704    if (err.code) {
3705        console.error('Failed to snapshot window. Cause:' + JSON.stringify(err));
3706        return;
3707    }
3708    console.info('Succeeded in snapshotting window. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
3709    pixelMap.release(); // Release the memory in time after the PixelMap is used.
3710});
3711```
3712
3713### snapshot<sup>9+</sup>
3714
3715snapshot(): Promise&lt;image.PixelMap&gt;
3716
3717Captures this window. This API uses a promise to return the result.
3718
3719**System capability**: SystemCapability.WindowManager.WindowManager.Core
3720
3721**Return value**
3722
3723| Type                                                        | Description                                   |
3724| ----------------------------------------------------------- | --------------------------------------------- |
3725| Promise&lt;[image.PixelMap](js-apis-image.md#pixelmap7)&gt; | Promise used to return the window screenshot. |
3726
3727**Error codes**
3728
3729For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3730
3731| ID      | Error Message                  |
3732| ------- | ------------------------------ |
3733| 1300002 | This window state is abnormal. |
3734
3735**Example**
3736
3737```js
3738let promise = windowClass.snapshot();
3739promise.then((pixelMap)=> {
3740    console.info('Succeeded in snapshotting window. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
3741    pixelMap.release(); // Release the memory in time after the PixelMap is used.
3742}).catch((err)=>{
3743    console.error('Failed to snapshot window. Cause:' + JSON.stringify(err));
3744});
3745```
3746
3747### opacity<sup>9+</sup>
3748
3749opacity(opacity: number): void
3750
3751Sets the opacity for this window.
3752
3753**System API**: This is a system API.
3754
3755**System capability**: SystemCapability.WindowManager.WindowManager.Core
3756
3757**Parameters**
3758
3759| Name    | Type   | Mandatory | Description                                       |
3760| ------- | ------ | --------- | ------------------------------------------------- |
3761| opacity | number | Yes       | Opacity to set. The value ranges from 0.0 to 1.0. |
3762
3763**Error codes**
3764
3765For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3766
3767| ID      | Error Message                  |
3768| ------- | ------------------------------ |
3769| 1300002 | This window state is abnormal. |
3770| 1300004 | Unauthorized operation.        |
3771
3772**Example**
3773
3774```js
3775try {
3776    windowClass.opacity(0.5);
3777} catch (exception) {
3778    console.error('Failed to opacity. Cause: ' + JSON.stringify(exception));
3779}
3780```
3781
3782### scale<sup>9+</sup>
3783
3784scale(scaleOptions: ScaleOptions): void
3785
3786Sets the scale parameters for this window.
3787
3788**System API**: This is a system API.
3789
3790**System capability**: SystemCapability.WindowManager.WindowManager.Core
3791
3792**Parameters**
3793
3794| Name         | Type                           | Mandatory | Description              |
3795| ------------ | ------------------------------ | --------- | ------------------------ |
3796| scaleOptions | [ScaleOptions](#scaleoptions9) | Yes       | Scale parameters to set. |
3797
3798**Error codes**
3799
3800For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3801
3802| ID      | Error Message                  |
3803| ------- | ------------------------------ |
3804| 1300002 | This window state is abnormal. |
3805| 1300004 | Unauthorized operation.        |
3806
3807**Example**
3808
3809```js
3810let obj : window.ScaleOptions = {
3811  x : 2.0,
3812  y : 1.0,
3813  pivotX : 0.5,
3814  pivotY : 0.5
3815};
3816try {
3817    windowClass.scale(obj);
3818} catch (exception) {
3819    console.error('Failed to scale. Cause: ' + JSON.stringify(exception));
3820}
3821```
3822
3823### rotate<sup>9+</sup>
3824
3825rotate(rotateOptions: RotateOptions): void
3826
3827Sets the rotation parameters for this window.
3828
3829**System API**: This is a system API.
3830
3831**System capability**: SystemCapability.WindowManager.WindowManager.Core
3832
3833**Parameters**
3834
3835| Name          | Type                             | Mandatory | Description                 |
3836| ------------- | -------------------------------- | --------- | --------------------------- |
3837| rotateOptions | [RotateOptions](#rotateoptions9) | Yes       | Rotation parameters to set. |
3838
3839**Error codes**
3840
3841For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3842
3843| ID      | Error Message                  |
3844| ------- | ------------------------------ |
3845| 1300002 | This window state is abnormal. |
3846| 1300004 | Unauthorized operation.        |
3847
3848**Example**
3849
3850```js
3851let obj : window.RotateOptions = {
3852  x : 1.0,
3853  y : 1.0,
3854  z : 45.0,
3855  pivotX : 0.5,
3856  pivotY : 0.5
3857};
3858try {
3859    windowClass.rotate(obj);
3860} catch (exception) {
3861    console.error('Failed to rotate. Cause: ' + JSON.stringify(exception));
3862}
3863```
3864
3865### translate<sup>9+</sup>
3866
3867translate(translateOptions: TranslateOptions): void
3868
3869Sets the translation parameters for this window.
3870
3871**System API**: This is a system API.
3872
3873**System capability**: SystemCapability.WindowManager.WindowManager.Core
3874
3875**Parameters**
3876
3877| Name             | Type                                   | Mandatory | Description                    |
3878| ---------------- | -------------------------------------- | --------- | ------------------------------ |
3879| translateOptions | [TranslateOptions](#translateoptions9) | Yes       | Translation parameters to set. |
3880
3881**Error codes**
3882
3883For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3884
3885| ID      | Error Message                  |
3886| ------- | ------------------------------ |
3887| 1300002 | This window state is abnormal. |
3888| 1300004 | Unauthorized operation.        |
3889
3890**Example**
3891
3892```js
3893let obj : window.TranslateOptions = {
3894  x : 100.0,
3895  y : 0.0,
3896  z : 0.0
3897};
3898try {
3899    windowClass.translate(obj);
3900} catch (exception) {
3901    console.error('Failed to translate. Cause: ' + JSON.stringify(exception));
3902}
3903```
3904
3905###  getTransitionController<sup>9+</sup>
3906
3907 getTransitionController(): TransitionController
3908
3909Obtains the transition animation controller.
3910
3911**System API**: This is a system API.
3912
3913**System capability**: SystemCapability.WindowManager.WindowManager.Core
3914
3915**Return value**
3916
3917| Type                                           | Description                      |
3918| ---------------------------------------------- | -------------------------------- |
3919| [TransitionController](#transitioncontroller9) | Transition animation controller. |
3920
3921**Error codes**
3922
3923For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3924
3925| ID      | Error Message                  |
3926| ------- | ------------------------------ |
3927| 1300002 | This window state is abnormal. |
3928| 1300004 | Unauthorized operation.        |
3929
3930**Example**
3931
3932```js
3933let controller = windowClass.getTransitionController(); // Obtain the transition animation controller.
3934controller.animationForHidden = (context : window.TransitionContext) => {
3935	let toWindow = context.toWindow;
3936 	animateTo({
3937    	duration: 1000, // Animation duration.
3938        tempo: 0.5, // Playback speed.
3939        curve: Curve.EaseInOut, // Animation curve.
3940        delay: 0, // Animation delay.
3941        iterations: 1, // Number of playback times.
3942        playMode: PlayMode.Normal // Animation playback mode.
3943        onFinish: ()=> {
3944            context.completeTransition(true)
3945        }
3946      }, () => {
3947        let obj : window.TranslateOptions = {
3948          x : 100.0,
3949          y : 0.0,
3950          z : 0.0
3951        };
3952        toWindow.translate(obj); // Set the transition animation.
3953        console.info('toWindow translate end');
3954      }
3955    );
3956    console.info('complete transition end');
3957};
3958windowClass.hideWithAnimation((err, data) => {
3959    if (err.code) {
3960        console.error('Failed to show the window with animation. Cause: ' + JSON.stringify(err));
3961        return;
3962    }
3963    console.info('Succeeded in showing the window with animation. Data: ' + JSON.stringify(data));
3964});
3965```
3966
3967### setBlur<sup>9+</sup>
3968
3969setBlur(radius: number): void
3970
3971Blurs this window.
3972
3973**System API**: This is a system API.
3974
3975**System capability**: SystemCapability.WindowManager.WindowManager.Core
3976
3977**Parameters**
3978
3979| Name   | Type   | Mandatory | Description                                                  |
3980| ------ | ------ | --------- | ------------------------------------------------------------ |
3981| 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. |
3982
3983**Error codes**
3984
3985For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
3986
3987| ID      | Error Message                  |
3988| ------- | ------------------------------ |
3989| 1300002 | This window state is abnormal. |
3990| 1300004 | Unauthorized operation.        |
3991
3992**Example**
3993
3994```js
3995try {
3996    windowClass.setBlur(4.0);
3997} catch (exception) {
3998    console.error('Failed to set blur. Cause: ' + JSON.stringify(exception));
3999}
4000```
4001
4002### setBackdropBlur<sup>9+</sup>
4003
4004setBackdropBlur(radius: number): void
4005
4006Blurs the background of this window.
4007
4008**System API**: This is a system API.
4009
4010**System capability**: SystemCapability.WindowManager.WindowManager.Core
4011
4012**Parameters**
4013
4014| Name   | Type   | Mandatory | Description                                                  |
4015| ------ | ------ | --------- | ------------------------------------------------------------ |
4016| 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. |
4017
4018**Error codes**
4019
4020For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
4021
4022| ID      | Error Message                  |
4023| ------- | ------------------------------ |
4024| 1300002 | This window state is abnormal. |
4025| 1300004 | Unauthorized operation.        |
4026
4027**Example**
4028
4029```js
4030try {
4031    windowClass.setBackdropBlur(4.0);
4032} catch (exception) {
4033    console.error('Failed to set backdrop blur. Cause: ' + JSON.stringify(exception));
4034}
4035```
4036
4037### setBackdropBlurStyle<sup>9+</sup>
4038
4039setBackdropBlurStyle(blurStyle: BlurStyle): void
4040
4041Sets the blur style for the background of this window.
4042
4043**System API**: This is a system API.
4044
4045**System capability**: SystemCapability.WindowManager.WindowManager.Core
4046
4047**Parameters**
4048
4049| Name      | Type                     | Mandatory | Description                                         |
4050| --------- | ------------------------ | --------- | --------------------------------------------------- |
4051| blurStyle | [BlurStyle](#blurstyle9) | Yes       | Blur style to set for the background of the window. |
4052
4053**Error codes**
4054
4055For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
4056
4057| ID      | Error Message                  |
4058| ------- | ------------------------------ |
4059| 1300002 | This window state is abnormal. |
4060| 1300004 | Unauthorized operation.        |
4061
4062**Example**
4063
4064```js
4065try {
4066    windowClass.setBackdropBlurStyle(window.BlurStyle.THIN);
4067} catch (exception) {
4068    console.error('Failed to set backdrop blur style. Cause: ' + JSON.stringify(exception));
4069}
4070```
4071
4072### setShadow<sup>9+</sup>
4073
4074setShadow(radius: number, color?: string, offsetX?: number, offsetY?: number): void
4075
4076Sets the shadow for the window borders.
4077
4078**System API**: This is a system API.
4079
4080**System capability**: SystemCapability.WindowManager.WindowManager.Core
4081
4082**Parameters**
4083
4084| Name    | Type   | Mandatory | Description                                                  |
4085| ------- | ------ | --------- | ------------------------------------------------------------ |
4086| 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. |
4087| color   | string | No        | Color of the shadow. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. |
4088| offsetX | number | No        | Offset of the shadow along the x-axis, in pixels.            |
4089| offsetY | number | No        | Offset of the shadow along the y-axis, in pixels.            |
4090
4091**Error codes**
4092
4093For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
4094
4095| ID      | Error Message                  |
4096| ------- | ------------------------------ |
4097| 1300002 | This window state is abnormal. |
4098| 1300004 | Unauthorized operation.        |
4099
4100**Example**
4101
4102```js
4103try {
4104    windowClass.setShadow(4.0, '#FF00FF00', 2, 3);
4105} catch (exception) {
4106    console.error('Failed to set shadow. Cause: ' + JSON.stringify(exception));
4107}
4108```
4109
4110### setCornerRadius<sup>9+</sup>
4111
4112setCornerRadius(cornerRadius: number): void
4113
4114Sets the radius of the rounded corners for this window.
4115
4116**System API**: This is a system API.
4117
4118**System capability**: SystemCapability.WindowManager.WindowManager.Core
4119
4120**Parameters**
4121
4122| Name   | Type   | Mandatory | Description                                                  |
4123| ------ | ------ | --------- | ------------------------------------------------------------ |
4124| 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. |
4125
4126**Error codes**
4127
4128For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
4129
4130| ID      | Error Message                  |
4131| ------- | ------------------------------ |
4132| 1300002 | This window state is abnormal. |
4133| 1300004 | Unauthorized operation.        |
4134
4135**Example**
4136
4137```js
4138try {
4139    windowClass.setCornerRadius(4.0);
4140} catch (exception) {
4141    console.error('Failed to set corner radius. Cause: ' + JSON.stringify(exception));
4142}
4143```
4144
4145### show<sup>(deprecated)</sup>
4146
4147show(callback: AsyncCallback&lt;void&gt;): void
4148
4149Shows this window. This API uses an asynchronous callback to return the result.
4150
4151> **NOTE**
4152>
4153> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [showWindow()](#showwindow9) instead.
4154
4155**System capability**: SystemCapability.WindowManager.WindowManager.Core
4156
4157**Parameters**
4158
4159| Name     | Type                      | Mandatory | Description                         |
4160| -------- | ------------------------- | --------- | ----------------------------------- |
4161| callback | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result. |
4162
4163**Example**
4164
4165```js
4166windowClass.show((err) => {
4167    if (err.code) {
4168        console.error('Failed to show the window. Cause: ' + JSON.stringify(err));
4169        return;
4170    }
4171    console.info('Succeeded in showing the window.');
4172});
4173```
4174
4175### show<sup>(deprecated)</sup>
4176
4177show(): Promise&lt;void&gt;
4178
4179Shows this window. This API uses a promise to return the result.
4180
4181> **NOTE**
4182>
4183> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [showWindow()](#showwindow9-1) instead.
4184
4185**System capability**: SystemCapability.WindowManager.WindowManager.Core
4186
4187**Return value**
4188
4189| Type                | Description                    |
4190| ------------------- | ------------------------------ |
4191| Promise&lt;void&gt; | Promise that returns no value. |
4192
4193**Example**
4194
4195```js
4196let promise = windowClass.show();
4197promise.then(()=> {
4198    console.info('Succeeded in showing the window.');
4199}).catch((err)=>{
4200    console.error('Failed to show the window. Cause: ' + JSON.stringify(err));
4201});
4202```
4203
4204### destroy<sup>(deprecated)</sup>
4205
4206destroy(callback: AsyncCallback&lt;void&gt;): void
4207
4208Destroys this window. This API uses an asynchronous callback to return the result.
4209
4210> **NOTE**
4211>
4212> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [destroyWindow()](#destroywindow9) instead.
4213
4214**System capability**: SystemCapability.WindowManager.WindowManager.Core
4215
4216**Parameters**
4217
4218| Name     | Type                      | Mandatory | Description                         |
4219| -------- | ------------------------- | --------- | ----------------------------------- |
4220| callback | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result. |
4221
4222**Example**
4223
4224```js
4225windowClass.destroy((err) => {
4226    if (err.code) {
4227        console.error('Failed to destroy the window. Cause:' + JSON.stringify(err));
4228        return;
4229    }
4230    console.info('Succeeded in destroying the window.');
4231});
4232```
4233
4234### destroy<sup>(deprecated)</sup>
4235
4236destroy(): Promise&lt;void&gt;
4237
4238Destroys this window. This API uses a promise to return the result.
4239
4240> **NOTE**
4241>
4242> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [destroyWindow()](#destroywindow9-1) instead.
4243
4244**System capability**: SystemCapability.WindowManager.WindowManager.Core
4245
4246**Return value**
4247
4248| Type                | Description                    |
4249| ------------------- | ------------------------------ |
4250| Promise&lt;void&gt; | Promise that returns no value. |
4251
4252**Example**
4253
4254```js
4255let promise = windowClass.destroy();
4256promise.then(()=> {
4257    console.info('Succeeded in destroying the window.');
4258}).catch((err)=>{
4259    console.error('Failed to destroy the window. Cause: ' + JSON.stringify(err));
4260});
4261```
4262
4263### moveTo<sup>(deprecated)</sup>
4264
4265moveTo(x: number, y: number, callback: AsyncCallback&lt;void&gt;): void
4266
4267Moves this window. This API uses an asynchronous callback to return the result.
4268
4269This operation is not supported in a window in full-screen mode.
4270
4271> **NOTE**
4272>
4273> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [moveWindowTo()](#movewindowto9) instead.
4274
4275**System capability**: SystemCapability.WindowManager.WindowManager.Core
4276
4277**Parameters**
4278
4279| Name     | Type                      | Mandatory | Description                                                  |
4280| -------- | ------------------------- | --------- | ------------------------------------------------------------ |
4281| 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. |
4282| y        | number                    | Yes       | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards. |
4283| callback | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
4284
4285**Example**
4286
4287```js
4288windowClass.moveTo(300, 300, (err)=>{
4289    if (err.code) {
4290        console.error('Failed to move the window. Cause:' + JSON.stringify(err));
4291        return;
4292    }
4293    console.info('Succeeded in moving the window.');
4294});
4295```
4296
4297### moveTo<sup>(deprecated)</sup>
4298
4299moveTo(x: number, y: number): Promise&lt;void&gt;
4300
4301Moves this window. This API uses a promise to return the result.
4302
4303This operation is not supported in a window in full-screen mode.
4304
4305> **NOTE**
4306>
4307> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [moveWindowTo()](#movewindowto9-1) instead.
4308
4309**System capability**: SystemCapability.WindowManager.WindowManager.Core
4310
4311**Parameters**
4312
4313| Name | Type   | Mandatory | Description                                                  |
4314| ---- | ------ | --------- | ------------------------------------------------------------ |
4315| 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. |
4316| y    | number | Yes       | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards. |
4317
4318**Return value**
4319
4320| Type                | Description                    |
4321| ------------------- | ------------------------------ |
4322| Promise&lt;void&gt; | Promise that returns no value. |
4323
4324**Example**
4325
4326```js
4327let promise = windowClass.moveTo(300, 300);
4328promise.then(()=> {
4329    console.info('Succeeded in moving the window.');
4330}).catch((err)=>{
4331    console.error('Failed to move the window. Cause: ' + JSON.stringify(err));
4332});
4333```
4334
4335### resetSize<sup>(deprecated)</sup>
4336
4337resetSize(width: number, height: number, callback: AsyncCallback&lt;void&gt;): void
4338
4339Changes the size of this window. This API uses an asynchronous callback to return the result.
4340
4341The main window and subwindow have the following size limits: [320, 2560] in width and [240, 2560] in height, both in units of vp.
4342
4343The system window has the following size limits: [0, 2560] in width and [0, 2560] in height, both in units of vp.
4344
4345The new width and height you set must meet the limits.
4346
4347This operation is not supported in a window in full-screen mode.
4348
4349> **NOTE**
4350>
4351> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [resize()](#resize9) instead.
4352
4353**System capability**: SystemCapability.WindowManager.WindowManager.Core
4354
4355**Parameters**
4356
4357| Name     | Type                      | Mandatory | Description                         |
4358| -------- | ------------------------- | --------- | ----------------------------------- |
4359| width    | number                    | Yes       | New width of the window, in px.     |
4360| height   | number                    | Yes       | New height of the window, in px.    |
4361| callback | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result. |
4362
4363**Example**
4364
4365```js
4366windowClass.resetSize(500, 1000, (err) => {
4367    if (err.code) {
4368        console.error('Failed to change the window size. Cause:' + JSON.stringify(err));
4369        return;
4370    }
4371    console.info('Succeeded in changing the window size.');
4372});
4373```
4374
4375### resetSize<sup>(deprecated)</sup>
4376
4377resetSize(width: number, height: number): Promise&lt;void&gt;
4378
4379Changes the size of this window. This API uses a promise to return the result.
4380
4381The main window and subwindow have the following size limits: [320, 2560] in width and [240, 2560] in height, both in units of vp.
4382
4383The system window has the following size limits: [0, 2560] in width and [0, 2560] in height, both in units of vp.
4384
4385The new width and height you set must meet the limits.
4386
4387This operation is not supported in a window in full-screen mode.
4388
4389> **NOTE**
4390>
4391> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [resize()](#resize9-1) instead.
4392
4393**System capability**: SystemCapability.WindowManager.WindowManager.Core
4394
4395**Parameters**
4396
4397| Name   | Type   | Mandatory | Description                      |
4398| ------ | ------ | --------- | -------------------------------- |
4399| width  | number | Yes       | New width of the window, in px.  |
4400| height | number | Yes       | New height of the window, in px. |
4401
4402**Return value**
4403
4404| Type                | Description                    |
4405| ------------------- | ------------------------------ |
4406| Promise&lt;void&gt; | Promise that returns no value. |
4407
4408**Example**
4409
4410```js
4411let promise = windowClass.resetSize(500, 1000);
4412promise.then(()=> {
4413    console.info('Succeeded in changing the window size.');
4414}).catch((err)=>{
4415    console.error('Failed to change the window size. Cause: ' + JSON.stringify(err));
4416});
4417```
4418
4419### setWindowType<sup>(deprecated)</sup>
4420
4421setWindowType(type: WindowType, callback: AsyncCallback&lt;void&gt;): void
4422
4423Sets the type of this window. This API uses an asynchronous callback to return the result.
4424
4425**System API**: This is a system API.
4426
4427> **NOTE**
4428>
4429> This API is supported since API version 7 and deprecated since API version 9.
4430
4431**System capability**: SystemCapability.WindowManager.WindowManager.Core
4432
4433**Parameters**
4434
4435| Name     | Type                       | Mandatory | Description                         |
4436| -------- | -------------------------- | --------- | ----------------------------------- |
4437| type     | [WindowType](#windowtype7) | Yes       | Window type.                        |
4438| callback | AsyncCallback&lt;void&gt;  | Yes       | Callback used to return the result. |
4439
4440**Example**
4441
4442```js
4443let type = window.WindowType.TYPE_APP;
4444windowClass.setWindowType(type, (err) => {
4445  if (err.code) {
4446      console.error('Failed to set the window type. Cause: ' + JSON.stringify(err));
4447      return;
4448  }
4449  console.info('Succeeded in setting the window type.');
4450});
4451```
4452
4453### setWindowType<sup>(deprecated)</sup>
4454
4455setWindowType(type: WindowType): Promise&lt;void&gt;
4456
4457Sets the type of this window. This API uses a promise to return the result.
4458
4459**System API**: This is a system API.
4460
4461> **NOTE**
4462>
4463> This API is supported since API version 7 and deprecated since API version 9.
4464
4465**System capability**: SystemCapability.WindowManager.WindowManager.Core
4466
4467**Parameters**
4468
4469| Name | Type                       | Mandatory | Description  |
4470| ---- | -------------------------- | --------- | ------------ |
4471| type | [WindowType](#windowtype7) | Yes       | Window type. |
4472
4473**Return value**
4474
4475| Type                | Description                    |
4476| ------------------- | ------------------------------ |
4477| Promise&lt;void&gt; | Promise that returns no value. |
4478
4479**Example**
4480
4481```js
4482let type = window.WindowType.TYPE_APP;
4483let promise = windowClass.setWindowType(type);
4484promise.then(()=> {
4485    console.info('Succeeded in setting the window type.');
4486}).catch((err)=>{
4487    console.error('Failed to set the window type. Cause: ' + JSON.stringify(err));
4488});
4489```
4490
4491### getProperties<sup>(deprecated)</sup>
4492
4493getProperties(callback: AsyncCallback&lt;WindowProperties&gt;): void
4494
4495Obtains the properties of this window. This API uses an asynchronous callback to return the result.
4496
4497> **NOTE**
4498>
4499> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getWindowProperties()](#getwindowproperties9) instead.
4500
4501**System capability**: SystemCapability.WindowManager.WindowManager.Core
4502
4503**Parameters**
4504
4505| Name     | Type                                                       | Mandatory | Description                                    |
4506| -------- | ---------------------------------------------------------- | --------- | ---------------------------------------------- |
4507| callback | AsyncCallback&lt;[WindowProperties](#windowproperties)&gt; | Yes       | Callback used to return the window properties. |
4508
4509**Example**
4510
4511```js
4512windowClass.getProperties((err, data) => {
4513    if (err.code) {
4514        console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(err));
4515        return;
4516    }
4517    console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data));
4518});
4519```
4520
4521### getProperties<sup>(deprecated)</sup>
4522
4523getProperties(): Promise&lt;WindowProperties&gt;
4524
4525Obtains the properties of this window. This API uses a promise to return the result.
4526
4527> **NOTE**
4528>
4529> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [getWindowProperties()](#getwindowproperties9) instead.
4530
4531**System capability**: SystemCapability.WindowManager.WindowManager.Core
4532
4533**Return value**
4534
4535| Type                                                 | Description                                   |
4536| ---------------------------------------------------- | --------------------------------------------- |
4537| Promise&lt;[WindowProperties](#windowproperties)&gt; | Promise used to return the window properties. |
4538
4539**Example**
4540
4541```js
4542let promise = windowClass.getProperties();
4543promise.then((data)=> {
4544    console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data));
4545}).catch((err)=>{
4546    console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(err));
4547});
4548```
4549
4550### getAvoidArea<sup>(deprecated)</sup>
4551
4552getAvoidArea(type: [AvoidAreaType](#avoidareatype7), callback: AsyncCallback&lt;[AvoidArea](#avoidarea7)&gt;): void
4553
4554Obtains 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.
4555
4556> **NOTE**
4557>
4558> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getWindowAvoidArea()](#getwindowavoidarea9) instead.
4559
4560**System capability**: SystemCapability.WindowManager.WindowManager.Core
4561
4562**Parameters**
4563
4564| Name     | Type                                          | Mandatory | Description                       |
4565| -------- | --------------------------------------------- | --------- | --------------------------------- |
4566| type     | [AvoidAreaType](#avoidareatype7)              | Yes       | Type of the area.                 |
4567| callback | AsyncCallback&lt;[AvoidArea](#avoidarea7)&gt; | Yes       | Callback used to return the area. |
4568
4569**Example**
4570
4571```js
4572let type = window.AvoidAreaType.TYPE_SYSTEM;
4573windowClass.getAvoidArea(type, (err, data) => {
4574    if (err.code) {
4575        console.error('Failed to obtain the area. Cause:' + JSON.stringify(err));
4576        return;
4577    }
4578    console.info('Succeeded in obtaining the area. Data:' + JSON.stringify(data));
4579});
4580```
4581
4582### getAvoidArea<sup>(deprecated)</sup>
4583
4584getAvoidArea(type: [AvoidAreaType](#avoidareatype7)): Promise&lt;[AvoidArea](#avoidarea7)&gt;
4585
4586Obtains 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.
4587
4588> **NOTE**
4589>
4590> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getWindowAvoidArea()](#getwindowavoidarea9) instead.
4591
4592**System capability**: SystemCapability.WindowManager.WindowManager.Core
4593
4594**Parameters**
4595
4596| Name | Type                             | Mandatory | Description       |
4597| ---- | -------------------------------- | --------- | ----------------- |
4598| type | [AvoidAreaType](#avoidareatype7) | Yes       | Type of the area. |
4599
4600**Return value**
4601
4602| Type                                    | Description                      |
4603| --------------------------------------- | -------------------------------- |
4604| Promise&lt;[AvoidArea](#avoidarea7)&gt; | Promise used to return the area. |
4605
4606**Example**
4607
4608```js
4609let type = window.AvoidAreaType.TYPE_SYSTEM;
4610let promise = windowClass.getAvoidArea(type);
4611promise.then((data)=> {
4612    console.info('Succeeded in obtaining the area. Data:' + JSON.stringify(data));
4613}).catch((err)=>{
4614    console.error('Failed to obtain the area. Cause:' + JSON.stringify(err));
4615});
4616```
4617
4618### setFullScreen<sup>(deprecated)</sup>
4619
4620setFullScreen(isFullScreen: boolean, callback: AsyncCallback&lt;void&gt;): void
4621
4622Sets whether to enable the full-screen mode for this window. This API uses an asynchronous callback to return the result.
4623
4624> **NOTE**
4625>
4626> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowSystemBarEnable()](#setwindowsystembarenable9) instead.
4627
4628**System capability**: SystemCapability.WindowManager.WindowManager.Core
4629
4630**Parameters**
4631
4632| Name         | Type                      | Mandatory | Description                                                  |
4633| ------------ | ------------------------- | --------- | ------------------------------------------------------------ |
4634| 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. |
4635| callback     | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
4636
4637**Example**
4638
4639```js
4640let isFullScreen = true;
4641windowClass.setFullScreen(isFullScreen, (err) => {
4642    if (err.code) {
4643        console.error('Failed to enable the full-screen mode. Cause: ' + JSON.stringify(err));
4644        return;
4645    }
4646    console.info('Succeeded in enabling the full-screen mode.');
4647});
4648```
4649
4650### setFullScreen<sup>(deprecated)</sup>
4651
4652setFullScreen(isFullScreen: boolean): Promise&lt;void&gt;
4653
4654Sets whether to enable the full-screen mode for this window. This API uses a promise to return the result.
4655
4656> **NOTE**
4657>
4658> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowSystemBarEnable()](#setwindowsystembarenable9-1) instead.
4659
4660**System capability**: SystemCapability.WindowManager.WindowManager.Core
4661
4662**Parameters**
4663
4664| Name         | Type    | Mandatory | Description                                                  |
4665| ------------ | ------- | --------- | ------------------------------------------------------------ |
4666| 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. |
4667
4668**Return value**
4669
4670| Type                | Description                    |
4671| ------------------- | ------------------------------ |
4672| Promise&lt;void&gt; | Promise that returns no value. |
4673
4674**Example**
4675
4676```js
4677let isFullScreen = true;
4678let promise = windowClass.setFullScreen(isFullScreen);
4679promise.then(()=> {
4680    console.info('Succeeded in enabling the full-screen mode.');
4681}).catch((err)=>{
4682    console.error('Failed to enable the full-screen mode. Cause: ' + JSON.stringify(err));
4683});
4684```
4685
4686### setLayoutFullScreen<sup>(deprecated)</sup>
4687
4688setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback&lt;void&gt;): void
4689
4690Sets whether to enable the full-screen mode for the window layout. This API uses an asynchronous callback to return the result.
4691
4692> **NOTE**
4693>
4694> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowLayoutFullScreen()](#setwindowlayoutfullscreen9) instead.
4695
4696**System capability**: SystemCapability.WindowManager.WindowManager.Core
4697
4698**Parameters**
4699
4700| Name               | Type                      | Mandatory | Description                                                  |
4701| ------------------ | ------------------------- | --------- | ------------------------------------------------------------ |
4702| 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. |
4703| callback           | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
4704
4705**Example**
4706
4707```js
4708let isLayoutFullScreen= true;
4709windowClass.setLayoutFullScreen(isLayoutFullScreen, (err) => {
4710    if (err.code) {
4711        console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
4712        return;
4713    }
4714    console.info('Succeeded in setting the window layout to full-screen mode.');
4715});
4716```
4717
4718### setLayoutFullScreen<sup>(deprecated)</sup>
4719
4720setLayoutFullScreen(isLayoutFullScreen: boolean): Promise&lt;void&gt;
4721
4722Sets whether to enable the full-screen mode for the window layout. This API uses a promise to return the result.
4723
4724> **NOTE**
4725>
4726> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowLayoutFullScreen()](#setwindowlayoutfullscreen9-1) instead.
4727
4728**System capability**: SystemCapability.WindowManager.WindowManager.Core
4729
4730**Parameters**
4731
4732| Name               | Type    | Mandatory | Description                                                  |
4733| ------------------ | ------- | --------- | ------------------------------------------------------------ |
4734| 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. |
4735
4736**Return value**
4737
4738| Type                | Description                    |
4739| ------------------- | ------------------------------ |
4740| Promise&lt;void&gt; | Promise that returns no value. |
4741
4742**Example**
4743
4744```js
4745let isLayoutFullScreen = true;
4746let promise = windowClass.setLayoutFullScreen(isLayoutFullScreen);
4747promise.then(()=> {
4748    console.info('Succeeded in setting the window layout to full-screen mode.');
4749}).catch((err)=>{
4750    console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
4751});
4752```
4753
4754### setSystemBarEnable<sup>(deprecated)</sup>
4755
4756setSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallback&lt;void&gt;): void
4757
4758Sets whether to display the status bar and navigation bar in this window. This API uses an asynchronous callback to return the result.
4759
4760> **NOTE**
4761>
4762> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowSystemBarEnable()](#setwindowsystembarenable9) instead.
4763
4764**System capability**: SystemCapability.WindowManager.WindowManager.Core
4765
4766**Parameters**
4767
4768| Name     | Type                          | Mandatory | Description                                                  |
4769| -------- | ----------------------------- | --------- | ------------------------------------------------------------ |
4770| 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. |
4771| callback | AsyncCallback&lt;void&gt;     | Yes       | Callback used to return the result.                          |
4772
4773**Example**
4774
4775```js
4776// In this example, the status bar and navigation bar are not displayed.
4777let names = [];
4778windowClass.setSystemBarEnable(names, (err) => {
4779    if (err.code) {
4780        console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err));
4781        return;
4782    }
4783    console.info('Succeeded in setting the system bar to be invisible.');
4784});
4785```
4786
4787### setSystemBarEnable<sup>(deprecated)</sup>
4788
4789setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise&lt;void&gt;
4790
4791Sets whether to display the status bar and navigation bar in this window. This API uses a promise to return the result.
4792
4793> **NOTE**
4794>
4795> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowSystemBarEnable()](#setwindowsystembarenable9-1) instead.
4796
4797**System capability**: SystemCapability.WindowManager.WindowManager.Core
4798
4799**Parameters**
4800
4801| Name  | Type                          | Mandatory | Description                                                  |
4802| ----- | ----------------------------- | --------- | ------------------------------------------------------------ |
4803| 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. |
4804
4805**Return value**
4806
4807| Type                | Description                    |
4808| ------------------- | ------------------------------ |
4809| Promise&lt;void&gt; | Promise that returns no value. |
4810
4811**Example**
4812
4813```js
4814// In this example, the status bar and navigation bar are not displayed.
4815let names = [];
4816let promise = windowClass.setSystemBarEnable(names);
4817promise.then(()=> {
4818    console.info('Succeeded in setting the system bar to be invisible.');
4819}).catch((err)=>{
4820    console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err));
4821});
4822```
4823
4824### setSystemBarProperties<sup>(deprecated)</sup>
4825
4826setSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback&lt;void&gt;): void
4827
4828Sets the properties of the status bar and navigation bar in this window. This API uses an asynchronous callback to return the result.
4829
4830> **NOTE**
4831>
4832> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowSystemBarProperties()](#setwindowsystembarproperties9) instead.
4833
4834**System capability**: SystemCapability.WindowManager.WindowManager.Core
4835
4836**Parameters**
4837
4838| Name                | Type                                        | Mandatory | Description                                      |
4839| ------------------- | ------------------------------------------- | --------- | ------------------------------------------------ |
4840| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes       | Properties of the status bar and navigation bar. |
4841| callback            | AsyncCallback&lt;void&gt;                   | Yes       | Callback used to return the result.              |
4842
4843**Example**
4844
4845```js
4846let SystemBarProperties={
4847    statusBarColor: '#ff00ff',
4848    navigationBarColor: '#00ff00',
4849    // The following properties are supported since API version 8.
4850    statusBarContentColor:'#ffffff',
4851    navigationBarContentColor:'#00ffff'
4852};
4853windowClass.setSystemBarProperties(SystemBarProperties, (err) => {
4854    if (err.code) {
4855        console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err));
4856        return;
4857    }
4858    console.info('Succeeded in setting the system bar properties.');
4859});
4860```
4861
4862### setSystemBarProperties<sup>(deprecated)</sup>
4863
4864setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise&lt;void&gt;
4865
4866Sets the properties of the status bar and navigation bar in this window. This API uses a promise to return the result.
4867
4868> **NOTE**
4869>
4870> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowSystemBarProperties()](#setwindowsystembarproperties9-1) instead.
4871
4872**System capability**: SystemCapability.WindowManager.WindowManager.Core
4873
4874**Parameters**
4875
4876| Name                | Type                                        | Mandatory | Description                                      |
4877| ------------------- | ------------------------------------------- | --------- | ------------------------------------------------ |
4878| SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes       | Properties of the status bar and navigation bar. |
4879
4880**Return value**
4881
4882| Type                | Description                    |
4883| ------------------- | ------------------------------ |
4884| Promise&lt;void&gt; | Promise that returns no value. |
4885
4886**Example**
4887
4888```js
4889let SystemBarProperties={
4890    statusBarColor: '#ff00ff',
4891    navigationBarColor: '#00ff00',
4892    // The following properties are supported since API version 8.
4893    statusBarContentColor:'#ffffff',
4894    navigationBarContentColor:'#00ffff'
4895};
4896let promise = windowClass.setSystemBarProperties(SystemBarProperties);
4897promise.then(()=> {
4898    console.info('Succeeded in setting the system bar properties.');
4899}).catch((err)=>{
4900    console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err));
4901});
4902```
4903
4904### loadContent<sup>(deprecated)</sup>
4905
4906loadContent(path: string, callback: AsyncCallback&lt;void&gt;): void
4907
4908Loads content from a page to this window. This API uses an asynchronous callback to return the result.
4909
4910> **NOTE**
4911>
4912> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setUIContent()](#setuicontent9) instead.
4913
4914**System capability**: SystemCapability.WindowManager.WindowManager.Core
4915
4916**Parameters**
4917
4918| Name     | Type                      | Mandatory | Description                                             |
4919| -------- | ------------------------- | --------- | ------------------------------------------------------- |
4920| path     | string                    | Yes       | Path of the page from which the content will be loaded. |
4921| callback | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                     |
4922
4923**Example**
4924
4925```js
4926windowClass.loadContent('pages/page2/page2', (err) => {
4927   if (err.code) {
4928         console.error('Failed to load the content. Cause:' + JSON.stringify(err));
4929         return;
4930   }
4931  console.info('Succeeded in loading the content.');
4932});
4933```
4934
4935### loadContent<sup>(deprecated)</sup>
4936
4937loadContent(path: string): Promise&lt;void&gt;
4938
4939Loads content from a page to this window. This API uses a promise to return the result.
4940
4941> **NOTE**
4942>
4943> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setUIContent()](#setuicontent9-1) instead.
4944
4945**System capability**: SystemCapability.WindowManager.WindowManager.Core
4946
4947**Parameters**
4948
4949| Name | Type   | Mandatory | Description                                             |
4950| ---- | ------ | --------- | ------------------------------------------------------- |
4951| path | string | Yes       | Path of the page from which the content will be loaded. |
4952
4953**Return value**
4954
4955| Type                | Description                    |
4956| ------------------- | ------------------------------ |
4957| Promise&lt;void&gt; | Promise that returns no value. |
4958
4959**Example**
4960
4961```js
4962let promise = windowClass.loadContent('pages/page2/page2');
4963promise.then(()=> {
4964    console.info('Succeeded in loading the content.');
4965}).catch((err)=>{
4966    console.error('Failed to load the content. Cause: ' + JSON.stringify(err));
4967});
4968```
4969
4970### isShowing<sup>(deprecated)</sup>
4971
4972isShowing(callback: AsyncCallback&lt;boolean&gt;): void
4973
4974Checks whether this window is displayed. This API uses an asynchronous callback to return the result.
4975
4976> **NOTE**
4977>
4978> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isWindowShowing()](#iswindowshowing9) instead.
4979
4980**System capability**: SystemCapability.WindowManager.WindowManager.Core
4981
4982**Parameters**
4983
4984| Name     | Type                         | Mandatory | Description                                                  |
4985| -------- | ---------------------------- | --------- | ------------------------------------------------------------ |
4986| 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. |
4987
4988**Example**
4989
4990```js
4991windowClass.isShowing((err, data) => {
4992    if (err.code) {
4993        console.error('Failed to check whether the window is showing. Cause:' + JSON.stringify(err));
4994        return;
4995    }
4996    console.info('Succeeded in checking whether the window is showing. Data: ' + JSON.stringify(data));
4997});
4998```
4999
5000### isShowing<sup>(deprecated)</sup>
5001
5002isShowing(): Promise&lt;boolean&gt;
5003
5004Checks whether this window is displayed. This API uses a promise to return the result.
5005
5006> **NOTE**
5007>
5008> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isWindowShowing()](#iswindowshowing9) instead.
5009
5010**System capability**: SystemCapability.WindowManager.WindowManager.Core
5011
5012**Return value**
5013
5014| Type                   | Description                                                  |
5015| ---------------------- | ------------------------------------------------------------ |
5016| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means that the window is displayed, and **false** means the opposite. |
5017
5018**Example**
5019
5020```js
5021let promise = windowClass.isShowing();
5022promise.then((data)=> {
5023    console.info('Succeeded in checking whether the window is showing. Data: ' + JSON.stringify(data));
5024}).catch((err)=>{
5025    console.error('Failed to check whether the window is showing. Cause: ' + JSON.stringify(err));
5026});
5027```
5028
5029### on('systemAvoidAreaChange')<sup>(deprecated)</sup>
5030
5031on(type: 'systemAvoidAreaChange', callback: Callback&lt;AvoidArea&gt;): void
5032
5033Enables listening for changes to the area where the window cannot be displayed.
5034
5035> **NOTE**
5036>
5037> This API is supported since API version 7 and deprecated since API version 9. Use [on('avoidAreaChange')](#onavoidareachange9) instead.
5038
5039**System capability**: SystemCapability.WindowManager.WindowManager.Core
5040
5041**Parameters**
5042
5043| Name     | Type                                     | Mandatory | Description                                                  |
5044| -------- | ---------------------------------------- | --------- | ------------------------------------------------------------ |
5045| 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. |
5046| callback | Callback&lt;[AvoidArea](#avoidarea7)&gt; | Yes       | Callback used to return the area.                            |
5047
5048**Example**
5049
5050```js
5051windowClass.on('systemAvoidAreaChange', (data) => {
5052    console.info('Succeeded in enabling the listener for system avoid area changes. Data: ' + JSON.stringify(data));
5053});
5054```
5055
5056### off('systemAvoidAreaChange')<sup>(deprecated)</sup>
5057
5058off(type: 'systemAvoidAreaChange', callback?: Callback&lt;AvoidArea&gt;): void
5059
5060Disables listening for changes to the area where the window cannot be displayed.
5061
5062> **NOTE**
5063>
5064> This API is supported since API version 7 and deprecated since API version 9. Use [off('avoidAreaChange')](#offavoidareachange9) instead.
5065
5066**System capability**: SystemCapability.WindowManager.WindowManager.Core
5067
5068**Parameters**
5069
5070| Name     | Type                                     | Mandatory | Description                                                  |
5071| -------- | ---------------------------------------- | --------- | ------------------------------------------------------------ |
5072| 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. |
5073| callback | Callback&lt;[AvoidArea](#avoidarea7)&gt; | No        | Callback used to return the area.                            |
5074
5075**Example**
5076
5077```js
5078windowClass.off('systemAvoidAreaChange');
5079```
5080
5081### isSupportWideGamut<sup>(deprecated)</sup>
5082
5083isSupportWideGamut(callback: AsyncCallback&lt;boolean&gt;): void
5084
5085Checks whether this window supports the wide-gamut color space. This API uses an asynchronous callback to return the result.
5086
5087> **NOTE**
5088>
5089> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isWindowSupportWideGamut()](#iswindowsupportwidegamut9) instead.
5090
5091**System capability**: SystemCapability.WindowManager.WindowManager.Core
5092
5093**Parameters**
5094
5095| Name     | Type                         | Mandatory | Description                                                  |
5096| -------- | ---------------------------- | --------- | ------------------------------------------------------------ |
5097| 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. |
5098
5099**Example**
5100
5101```js
5102windowClass.isSupportWideGamut((err, data) => {
5103    if (err.code) {
5104        console.error('Failed to check whether the window support WideGamut. Cause:' + JSON.stringify(err));
5105        return;
5106    }
5107    console.info('Succeeded in checking whether the window support WideGamut Data: ' + JSON.stringify(data));
5108});
5109```
5110
5111### isSupportWideGamut<sup>(deprecated)</sup>
5112
5113isSupportWideGamut(): Promise&lt;boolean&gt;
5114
5115Checks whether this window supports the wide-gamut color space. This API uses a promise to return the result.
5116
5117> **NOTE**
5118>
5119> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isWindowSupportWideGamut()](#iswindowsupportwidegamut9-1) instead.
5120
5121**System capability**: SystemCapability.WindowManager.WindowManager.Core
5122
5123**Return value**
5124
5125| Type                   | Description                                                  |
5126| ---------------------- | ------------------------------------------------------------ |
5127| 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. |
5128
5129**Example**
5130
5131```js
5132let promise = windowClass.isSupportWideGamut();
5133promise.then((data)=> {
5134    console.info('Succeeded in checking whether the window support WideGamut. Data: ' + JSON.stringify(data));
5135}).catch((err)=>{
5136    console.error('Failed to check whether the window support WideGamut. Cause: ' + JSON.stringify(err));
5137});
5138```
5139
5140### setColorSpace<sup>(deprecated)</sup>
5141
5142setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback&lt;void&gt;): void
5143
5144Sets a color space for this window. This API uses an asynchronous callback to return the result.
5145
5146> **NOTE**
5147>
5148> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [setWindowColorSpace()](#setwindowcolorspace9) instead.
5149
5150**System capability**: SystemCapability.WindowManager.WindowManager.Core
5151
5152**Parameters**
5153
5154| Name       | Type                       | Mandatory | Description                         |
5155| ---------- | -------------------------- | --------- | ----------------------------------- |
5156| colorSpace | [ColorSpace](#colorspace8) | Yes       | Color space to set.                 |
5157| callback   | AsyncCallback&lt;void&gt;  | Yes       | Callback used to return the result. |
5158
5159**Example**
5160
5161```js
5162windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err) => {
5163    if (err.code) {
5164        console.error('Failed to set window colorspace. Cause:' + JSON.stringify(err));
5165        return;
5166    }
5167    console.info('Succeeded in setting window colorspace.');
5168});
5169```
5170
5171### setColorSpace<sup>(deprecated)</sup>
5172
5173setColorSpace(colorSpace:ColorSpace): Promise&lt;void&gt;
5174
5175Sets a color space for this window. This API uses a promise to return the result.
5176
5177> **NOTE**
5178>
5179> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [setWindowColorSpace()](#setwindowcolorspace9-1) instead.
5180
5181**System capability**: SystemCapability.WindowManager.WindowManager.Core
5182
5183**Parameters**
5184
5185| Name       | Type                       | Mandatory | Description         |
5186| ---------- | -------------------------- | --------- | ------------------- |
5187| colorSpace | [ColorSpace](#colorspace8) | Yes       | Color space to set. |
5188
5189**Return value**
5190
5191| Type                | Description                    |
5192| ------------------- | ------------------------------ |
5193| Promise&lt;void&gt; | Promise that returns no value. |
5194
5195**Example**
5196
5197```js
5198let promise = windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT);
5199promise.then(()=> {
5200    console.info('Succeeded in setting window colorspace.');
5201}).catch((err)=>{
5202    console.error('Failed to set window colorspace. Cause: ' + JSON.stringify(err));
5203});
5204```
5205
5206### getColorSpace<sup>(deprecated)</sup>
5207
5208getColorSpace(callback: AsyncCallback&lt;ColorSpace&gt;): void
5209
5210Obtains the color space of this window. This API uses an asynchronous callback to return the result.
5211
5212> **NOTE**
5213>
5214> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getWindowColorSpace()](#getwindowcolorspace9) instead.
5215
5216**System capability**: SystemCapability.WindowManager.WindowManager.Core
5217
5218**Parameters**
5219
5220| Name     | Type                                            | Mandatory | Description                                                  |
5221| -------- | ----------------------------------------------- | --------- | ------------------------------------------------------------ |
5222| 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. |
5223
5224**Example**
5225
5226```js
5227windowClass.getColorSpace((err, data) => {
5228    if (err.code) {
5229        console.error('Failed to get window colorspace. Cause:' + JSON.stringify(err));
5230        return;
5231    }
5232    console.info('Succeeded in getting window colorspace. Cause:' + JSON.stringify(data));
5233});
5234```
5235
5236### getColorSpace<sup>(deprecated)</sup>
5237
5238getColorSpace(): Promise&lt;ColorSpace&gt;
5239
5240Obtains the color space of this window. This API uses a promise to return the result.
5241
5242> **NOTE**
5243>
5244> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getWindowColorSpace()](#getwindowcolorspace9) instead.
5245
5246**System capability**: SystemCapability.WindowManager.WindowManager.Core
5247
5248**Return value**
5249
5250| Type                                      | Description                                     |
5251| ----------------------------------------- | ----------------------------------------------- |
5252| Promise&lt;[ColorSpace](#colorspace8)&gt; | Promise used to return the current color space. |
5253
5254**Example**
5255
5256```js
5257let promise = windowClass.getColorSpace();
5258promise.then((data)=> {
5259    console.info('Succeeded in getting window color space. Cause:' + JSON.stringify(data));
5260}).catch((err)=>{
5261    console.error('Failed to get window colorspace. Cause: ' + JSON.stringify(err));
5262});
5263```
5264
5265### setBackgroundColor<sup>(deprecated)</sup>
5266
5267setBackgroundColor(color: string, callback: AsyncCallback&lt;void&gt;): void
5268
5269Sets 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 [loadContent](#loadcontent9) or [setUIContent()](#setuicontent9).
5270
5271> **NOTE**
5272>
5273> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowBackgroundColor()](#setwindowbackgroundcolor9) instead.
5274
5275**System capability**: SystemCapability.WindowManager.WindowManager.Core
5276
5277**Parameters**
5278
5279| Name     | Type                      | Mandatory | Description                                                  |
5280| -------- | ------------------------- | --------- | ------------------------------------------------------------ |
5281| color    | string                    | Yes       | Background color to set. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. |
5282| callback | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
5283
5284**Example**
5285
5286```js
5287let color = '#00ff33';
5288windowClass.setBackgroundColor(color, (err) => {
5289    if (err.code) {
5290        console.error('Failed to set the background color. Cause: ' + JSON.stringify(err));
5291        return;
5292    }
5293    console.info('Succeeded in setting the background color.');
5294});
5295```
5296
5297### setBackgroundColor<sup>(deprecated)</sup>
5298
5299setBackgroundColor(color: string): Promise&lt;void&gt;
5300
5301Sets 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 [loadContent](#loadcontent9) or [setUIContent()](#setuicontent9).
5302
5303> **NOTE**
5304>
5305> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowBackgroundColor()](#setwindowbackgroundcolor9) instead.
5306
5307**System capability**: SystemCapability.WindowManager.WindowManager.Core
5308
5309**Parameters**
5310
5311| Name  | Type   | Mandatory | Description                                                  |
5312| ----- | ------ | --------- | ------------------------------------------------------------ |
5313| color | string | Yes       | Background color to set. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. |
5314
5315**Return value**
5316
5317| Type                | Description                    |
5318| ------------------- | ------------------------------ |
5319| Promise&lt;void&gt; | Promise that returns no value. |
5320
5321**Example**
5322
5323```js
5324let color = '#00ff33';
5325let promise = windowClass.setBackgroundColor(color);
5326promise.then(()=> {
5327    console.info('Succeeded in setting the background color.');
5328}).catch((err)=>{
5329    console.error('Failed to set the background color. Cause: ' + JSON.stringify(err));
5330});
5331```
5332
5333### setBrightness<sup>(deprecated)</sup>
5334
5335setBrightness(brightness: number, callback: AsyncCallback&lt;void&gt;): void
5336
5337Sets the screen brightness for this window. This API uses an asynchronous callback to return the result.
5338
5339> **NOTE**
5340>
5341> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowBrightness()](#setwindowbrightness9) instead.
5342
5343**System capability**: SystemCapability.WindowManager.WindowManager.Core
5344
5345**Parameters**
5346
5347| Name       | Type                      | Mandatory | Description                                                  |
5348| ---------- | ------------------------- | --------- | ------------------------------------------------------------ |
5349| brightness | number                    | Yes       | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest. |
5350| callback   | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
5351
5352**Example**
5353
5354```js
5355let brightness = 1;
5356windowClass.setBrightness(brightness, (err) => {
5357    if (err.code) {
5358        console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
5359        return;
5360    }
5361    console.info('Succeeded in setting the brightness.');
5362});
5363```
5364
5365### setBrightness<sup>(deprecated)</sup>
5366
5367setBrightness(brightness: number): Promise&lt;void&gt;
5368
5369Sets the screen brightness for this window. This API uses a promise to return the result.
5370
5371> **NOTE**
5372>
5373> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowBrightness()](#setwindowbrightness9-1) instead.
5374
5375**System capability**: SystemCapability.WindowManager.WindowManager.Core
5376
5377**Parameters**
5378
5379| Name       | Type   | Mandatory | Description                                                  |
5380| ---------- | ------ | --------- | ------------------------------------------------------------ |
5381| brightness | number | Yes       | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest. |
5382
5383**Return value**
5384
5385| Type                | Description                    |
5386| ------------------- | ------------------------------ |
5387| Promise&lt;void&gt; | Promise that returns no value. |
5388
5389**Example**
5390
5391```js
5392let brightness = 1;
5393let promise = windowClass.setBrightness(brightness);
5394promise.then(()=> {
5395    console.info('Succeeded in setting the brightness.');
5396}).catch((err)=>{
5397    console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
5398});
5399```
5400
5401### setDimBehind<sup>(deprecated)</sup>
5402
5403setDimBehind(dimBehindValue: number, callback: AsyncCallback&lt;void&gt;): void
5404
5405Sets the dimness of the window that is not on top. This API uses an asynchronous callback to return the result.
5406
5407> **NOTE**
5408>
5409> This API cannot be used. This API is supported since API version 7 and deprecated since API version 9.
5410
5411**System capability**: SystemCapability.WindowManager.WindowManager.Core
5412
5413**Parameters**
5414
5415| Name           | Type                      | Mandatory | Description                                                  |
5416| -------------- | ------------------------- | --------- | ------------------------------------------------------------ |
5417| dimBehindValue | number                    | Yes       | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest. |
5418| callback       | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
5419
5420**Example**
5421
5422```js
5423windowClass.setDimBehind(0.5, (err) => {
5424    if (err.code) {
5425        console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
5426        return;
5427    }
5428    console.info('Succeeded in setting the dimness.');
5429});
5430```
5431
5432### setDimBehind<sup>(deprecated)</sup>
5433
5434setDimBehind(dimBehindValue: number): Promise&lt;void&gt;
5435
5436Sets the dimness of the window that is not on top. This API uses a promise to return the result.
5437
5438> **NOTE**
5439>
5440> This API cannot be used. This API is supported since API version 7 and deprecated since API version 9.
5441
5442**System capability**: SystemCapability.WindowManager.WindowManager.Core
5443
5444**Parameters**
5445
5446| Name           | Type   | Mandatory | Description                                                  |
5447| -------------- | ------ | --------- | ------------------------------------------------------------ |
5448| dimBehindValue | number | Yes       | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest. |
5449
5450**Return value**
5451
5452| Type                | Description                    |
5453| ------------------- | ------------------------------ |
5454| Promise&lt;void&gt; | Promise that returns no value. |
5455
5456**Example**
5457
5458```js
5459let promise = windowClass.setDimBehind(0.5);
5460promise.then(()=> {
5461    console.info('Succeeded in setting the dimness.');
5462}).catch((err)=>{
5463    console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
5464});
5465```
5466
5467### setFocusable<sup>(deprecated)</sup>
5468
5469setFocusable(isFocusable: boolean, callback: AsyncCallback&lt;void&gt;): void
5470
5471Sets whether this window can gain focus. This API uses an asynchronous callback to return the result.
5472
5473> **NOTE**
5474>
5475> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowFocusable()](#setwindowfocusable9) instead.
5476
5477**System capability**: SystemCapability.WindowManager.WindowManager.Core
5478
5479**Parameters**
5480
5481| Name        | Type                      | Mandatory | Description                                                  |
5482| ----------- | ------------------------- | --------- | ------------------------------------------------------------ |
5483| isFocusable | boolean                   | Yes       | Whether the window can gain focus. The value **true** means that the window can gain focus, and **false** means the opposite. |
5484| callback    | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
5485
5486**Example**
5487
5488```js
5489let isFocusable= true;
5490windowClass.setFocusable(isFocusable, (err) => {
5491    if (err.code) {
5492        console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(err));
5493        return;
5494    }
5495    console.info('Succeeded in setting the window to be focusable.');
5496});
5497```
5498
5499### setFocusable<sup>(deprecated)</sup>
5500
5501setFocusable(isFocusable: boolean): Promise&lt;void&gt;
5502
5503Sets whether this window can gain focus. This API uses a promise to return the result.
5504
5505> **NOTE**
5506>
5507> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowFocusable()](#setwindowfocusable9-1) instead.
5508
5509**System capability**: SystemCapability.WindowManager.WindowManager.Core
5510
5511**Parameters**
5512
5513| Name        | Type    | Mandatory | Description                                                  |
5514| ----------- | ------- | --------- | ------------------------------------------------------------ |
5515| isFocusable | boolean | Yes       | Whether the window can gain focus. The value **true** means that the window can gain focus, and **false** means the opposite. |
5516
5517**Return value**
5518
5519| Type                | Description                    |
5520| ------------------- | ------------------------------ |
5521| Promise&lt;void&gt; | Promise that returns no value. |
5522
5523**Example**
5524
5525```js
5526let isFocusable= true;
5527let promise = windowClass.setFocusable(isFocusable);
5528promise.then(()=> {
5529    console.info('Succeeded in setting the window to be focusable.');
5530}).catch((err)=>{
5531    console.error('Failed to set the window to be focusable. Cause: ' + JSON.stringify(err));
5532});
5533```
5534
5535### setKeepScreenOn<sup>(deprecated)</sup>
5536
5537setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback&lt;void&gt;): void
5538
5539Sets whether to keep the screen always on. This API uses an asynchronous callback to return the result.
5540
5541> **NOTE**
5542>
5543> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowKeepScreenOn()](#setwindowkeepscreenon9) instead.
5544
5545**System capability**: SystemCapability.WindowManager.WindowManager.Core
5546
5547**Parameters**
5548
5549| Name           | Type                      | Mandatory | Description                                                  |
5550| -------------- | ------------------------- | --------- | ------------------------------------------------------------ |
5551| 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. |
5552| callback       | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
5553
5554**Example**
5555
5556```js
5557let isKeepScreenOn = true;
5558windowClass.setKeepScreenOn(isKeepScreenOn, (err) => {
5559    if (err.code) {
5560        console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(err));
5561        return;
5562    }
5563    console.info('Succeeded in setting the screen to be always on.');
5564});
5565```
5566
5567### setKeepScreenOn<sup>(deprecated)</sup>
5568
5569setKeepScreenOn(isKeepScreenOn: boolean): Promise&lt;void&gt;
5570
5571Sets whether to keep the screen always on. This API uses a promise to return the result.
5572
5573> **NOTE**
5574>
5575> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [setWindowKeepScreenOn()](#setwindowkeepscreenon9-1) instead.
5576
5577**System capability**: SystemCapability.WindowManager.WindowManager.Core
5578
5579**Parameters**
5580
5581| Name           | Type    | Mandatory | Description                                                  |
5582| -------------- | ------- | --------- | ------------------------------------------------------------ |
5583| 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. |
5584
5585**Return value**
5586
5587| Type                | Description                    |
5588| ------------------- | ------------------------------ |
5589| Promise&lt;void&gt; | Promise that returns no value. |
5590
5591**Example**
5592
5593```js
5594let isKeepScreenOn = true;
5595let promise = windowClass.setKeepScreenOn(isKeepScreenOn);
5596promise.then(() => {
5597    console.info('Succeeded in setting the screen to be always on.');
5598}).catch((err)=>{
5599    console.info('Failed to set the screen to be always on. Cause:  ' + JSON.stringify(err));
5600});
5601```
5602
5603### setOutsideTouchable<sup>(deprecated)</sup>
5604
5605setOutsideTouchable(touchable: boolean, callback: AsyncCallback&lt;void&gt;): void
5606
5607Sets whether the area outside the subwindow is touchable. This API uses an asynchronous callback to return the result.
5608
5609> **NOTE**
5610>
5611> This API cannot be used. This API is supported since API version 7 and deprecated since API version 9.
5612
5613**System capability**: SystemCapability.WindowManager.WindowManager.Core
5614
5615**Parameters**
5616
5617| Name      | Type                      | Mandatory | Description                                                  |
5618| --------- | ------------------------- | --------- | ------------------------------------------------------------ |
5619| 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. |
5620| callback  | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
5621
5622**Example**
5623
5624```js
5625windowClass.setOutsideTouchable(true, (err) => {
5626    if (err.code) {
5627        console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
5628        return;
5629    }
5630    console.info('Succeeded in setting the area to be touchable.');
5631});
5632```
5633
5634### setOutsideTouchable<sup>(deprecated)</sup>
5635
5636setOutsideTouchable(touchable: boolean): Promise&lt;void&gt;
5637
5638Sets whether the area outside the subwindow is touchable. This API uses a promise to return the result.
5639
5640> **NOTE**
5641>
5642> This API cannot be used. This API is supported since API version 7 and deprecated since API version 9.
5643
5644**System capability**: SystemCapability.WindowManager.WindowManager.Core
5645
5646**Parameters**
5647
5648| Name      | Type    | Mandatory | Description                                                  |
5649| --------- | ------- | --------- | ------------------------------------------------------------ |
5650| 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. |
5651
5652**Return value**
5653
5654| Type                | Description                    |
5655| ------------------- | ------------------------------ |
5656| Promise&lt;void&gt; | Promise that returns no value. |
5657
5658**Example**
5659
5660```js
5661let promise = windowClass.setOutsideTouchable(true);
5662promise.then(()=> {
5663    console.info('Succeeded in setting the area to be touchable.');
5664}).catch((err)=>{
5665    console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
5666});
5667```
5668
5669### setPrivacyMode<sup>(deprecated)</sup>
5670
5671setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback&lt;void&gt;): void
5672
5673Sets 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.
5674
5675> **NOTE**
5676>
5677> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowPrivacyMode()](#setwindowprivacymode9) instead.
5678
5679**System capability**: SystemCapability.WindowManager.WindowManager.Core
5680
5681**Parameters**
5682
5683| Name          | Type                      | Mandatory | Description                                                  |
5684| ------------- | ------------------------- | --------- | ------------------------------------------------------------ |
5685| 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. |
5686| callback      | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
5687
5688**Example**
5689
5690```js
5691let isPrivacyMode = true;
5692windowClass.setPrivacyMode(isPrivacyMode, (err) => {
5693    if (err.code) {
5694        console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(err));
5695        return;
5696    }
5697    console.info('Succeeded in setting the window to privacy mode.');
5698});
5699```
5700
5701### setPrivacyMode<sup>(deprecated)</sup>
5702
5703setPrivacyMode(isPrivacyMode: boolean): Promise&lt;void&gt;
5704
5705Sets 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.
5706
5707> **NOTE**
5708>
5709> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowPrivacyMode()](#setwindowprivacymode9-1) instead.
5710
5711**System capability**: SystemCapability.WindowManager.WindowManager.Core
5712
5713**Parameters**
5714
5715| Name          | Type    | Mandatory | Description                                                  |
5716| ------------- | ------- | --------- | ------------------------------------------------------------ |
5717| 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. |
5718
5719**Return value**
5720
5721| Type                | Description                    |
5722| ------------------- | ------------------------------ |
5723| Promise&lt;void&gt; | Promise that returns no value. |
5724
5725**Example**
5726
5727```js
5728let isPrivacyMode = true;
5729let promise = windowClass.setPrivacyMode(isPrivacyMode);
5730promise.then(()=> {
5731    console.info('Succeeded in setting the window to privacy mode.');
5732}).catch((err)=>{
5733    console.error('Failed to set the window to privacy mode. Cause: ' + JSON.stringify(err));
5734});
5735```
5736
5737### setTouchable<sup>(deprecated)</sup>
5738
5739setTouchable(isTouchable: boolean, callback: AsyncCallback&lt;void&gt;): void
5740
5741Sets whether this window is touchable. This API uses an asynchronous callback to return the result.
5742
5743> **NOTE**
5744>
5745> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowTouchable()](#setwindowtouchable9) instead.
5746
5747**System capability**: SystemCapability.WindowManager.WindowManager.Core
5748
5749**Parameters**
5750
5751| Name        | Type                      | Mandatory | Description                                                  |
5752| ----------- | ------------------------- | --------- | ------------------------------------------------------------ |
5753| isTouchable | boolean                   | Yes       | Whether the window is touchable. The value **true** means that the window is touchable, and **false** means the opposite. |
5754| callback    | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                          |
5755
5756**Example**
5757
5758```js
5759let isTouchable = true;
5760windowClass.setTouchable(isTouchable, (err) => {
5761    if (err.code) {
5762        console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(err));
5763        return;
5764    }
5765    console.info('Succeeded in setting the window to be touchable.');
5766});
5767```
5768
5769### setTouchable<sup>(deprecated)</sup>
5770
5771setTouchable(isTouchable: boolean): Promise&lt;void&gt;
5772
5773Sets whether this window is touchable. This API uses a promise to return the result.
5774
5775> **NOTE**
5776>
5777> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setWindowTouchable()](#setwindowtouchable9-1) instead.
5778
5779**System capability**: SystemCapability.WindowManager.WindowManager.Core
5780
5781**Parameters**
5782
5783| Name        | Type    | Mandatory | Description                                                  |
5784| ----------- | ------- | --------- | ------------------------------------------------------------ |
5785| isTouchable | boolean | Yes       | Whether the window is touchable. The value **true** means that the window is touchable, and **false** means the opposite. |
5786
5787**Return value**
5788
5789| Type                | Description                    |
5790| ------------------- | ------------------------------ |
5791| Promise&lt;void&gt; | Promise that returns no value. |
5792
5793**Example**
5794
5795```js
5796let isTouchable = true;
5797let promise = windowClass.setTouchable(isTouchable);
5798promise.then(()=> {
5799    console.info('Succeeded in setting the window to be touchable.');
5800}).catch((err)=>{
5801    console.error('Failed to set the window to be touchable. Cause: ' + JSON.stringify(err));
5802});
5803```
5804
5805## WindowStageEventType<sup>9+</sup>
5806
5807Describes the lifecycle of a window stage.
5808
5809**Model restriction**: This API can be used only in the stage model.
5810
5811**System capability**: SystemCapability.WindowManager.WindowManager.Core
5812
5813| Name     | Value | Description                                    |
5814| -------- | ----- | ---------------------------------------------- |
5815| SHOWN    | 1     | The window stage is running in the foreground. |
5816| ACTIVE   | 2     | The window stage gains focus.                  |
5817| INACTIVE | 3     | The window stage loses focus.                  |
5818| HIDDEN   | 4     | The window stage is running in the background. |
5819
5820## WindowStage<sup>9+</sup>
5821
5822Implements a window manager, which manages each basic window unit, that is, [Window](#window) instance.
5823
5824Before calling any of the following APIs, you must use [onWindowStageCreate()](js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) to create a **WindowStage** instance.
5825
5826### getMainWindow<sup>9+</sup>
5827
5828getMainWindow(callback: AsyncCallback&lt;Window&gt;): void
5829
5830Obtains the main window of this window stage. This API uses an asynchronous callback to return the result.
5831
5832**Model restriction**: This API can be used only in the stage model.
5833
5834**System capability**: SystemCapability.WindowManager.WindowManager.Core
5835
5836**Parameters**
5837
5838| Name     | Type                                   | Mandatory | Description                              |
5839| -------- | -------------------------------------- | --------- | ---------------------------------------- |
5840| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes       | Callback used to return the main window. |
5841
5842**Error codes**
5843
5844For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
5845
5846| ID      | Error Message                  |
5847| ------- | ------------------------------ |
5848| 1300002 | This window state is abnormal. |
5849| 1300005 | This window stage is abnormal. |
5850
5851**Example**
5852
5853```ts
5854import UIAbility from '@ohos.app.ability.UIAbility';
5855
5856class myAbility extends UIAbility {
5857    onWindowStageCreate(windowStage) {
5858        console.log('onWindowStageCreate');
5859        let windowClass = null;
5860        windowStage.getMainWindow((err, data) => {
5861            if (err.code) {
5862                console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err));
5863                return;
5864            }
5865            windowClass = data;
5866            console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
5867        });
5868    }
5869};
5870```
5871
5872### getMainWindow<sup>9+</sup>
5873
5874getMainWindow(): Promise&lt;Window&gt;
5875
5876Obtains the main window of this window stage. This API uses a promise to return the result.
5877
5878**Model restriction**: This API can be used only in the stage model.
5879
5880**System capability**: SystemCapability.WindowManager.WindowManager.Core
5881
5882**Return value**
5883
5884| Type                             | Description                             |
5885| -------------------------------- | --------------------------------------- |
5886| Promise&lt;[Window](#window)&gt; | Promise used to return the main window. |
5887
5888**Error codes**
5889
5890For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
5891
5892| ID      | Error Message                  |
5893| ------- | ------------------------------ |
5894| 1300002 | This window state is abnormal. |
5895| 1300005 | This window stage is abnormal. |
5896
5897**Example**
5898
5899```ts
5900import UIAbility from '@ohos.app.ability.UIAbility';
5901
5902class myAbility extends UIAbility {
5903    onWindowStageCreate(windowStage) {
5904        console.log('onWindowStageCreate');
5905        let windowClass = null;
5906        let promise = windowStage.getMainWindow();
5907        promise.then((data) => {
5908        windowClass = data;
5909            console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
5910        }).catch((err) => {
5911            console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err));
5912        });
5913    }
5914};
5915```
5916
5917### getMainWindowSync<sup>9+</sup>
5918
5919getMainWindowSync(): Window
5920
5921Obtains the main window of this window stage.
5922
5923**Model restriction**: This API can be used only in the stage model.
5924
5925**System capability**: SystemCapability.WindowManager.WindowManager.Core
5926
5927**Return value**
5928
5929| Type              | Description             |
5930| ----------------- | ----------------------- |
5931| [Window](#window) | return the main window. |
5932
5933**Error codes**
5934
5935For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
5936
5937| ID      | Error Message                  |
5938| ------- | ------------------------------ |
5939| 1300002 | This window state is abnormal. |
5940| 1300005 | This window stage is abnormal. |
5941
5942**Example**
5943
5944```ts
5945import UIAbility from '@ohos.app.ability.UIAbility';
5946
5947class myAbility extends UIAbility {
5948    onWindowStageCreate(windowStage) {
5949        console.log('onWindowStageCreate');
5950        try {
5951            let windowClass = windowStage.getMainWindowSync();
5952        } catch (exception) {
5953            console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(exception));
5954        };
5955    }
5956};
5957```
5958
5959### createSubWindow<sup>9+</sup>
5960
5961createSubWindow(name: string, callback: AsyncCallback&lt;Window&gt;): void
5962
5963Creates a subwindow for this window stage. This API uses an asynchronous callback to return the result.
5964
5965**Model restriction**: This API can be used only in the stage model.
5966
5967**System capability**: SystemCapability.WindowManager.WindowManager.Core
5968
5969**Parameters**
5970
5971| Name     | Type                                   | Mandatory | Description                            |
5972| -------- | -------------------------------------- | --------- | -------------------------------------- |
5973| name     | string                                 | Yes       | Name of the subwindow.                 |
5974| callback | AsyncCallback&lt;[Window](#window)&gt; | Yes       | Callback used to return the subwindow. |
5975
5976**Error codes**
5977
5978For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
5979
5980| ID      | Error Message                  |
5981| ------- | ------------------------------ |
5982| 1300002 | This window state is abnormal. |
5983| 1300005 | This window stage is abnormal. |
5984
5985**Example**
5986
5987```ts
5988import UIAbility from '@ohos.app.ability.UIAbility';
5989
5990class myAbility extends UIAbility {
5991    onWindowStageCreate(windowStage) {
5992        console.log('onWindowStageCreate');
5993        let windowClass = null;
5994        try {
5995            windowStage.createSubWindow('mySubWindow', (err, data) => {
5996                if (err.code) {
5997                    console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(err));
5998                    return;
5999                }
6000                windowClass = data;
6001                console.info('Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
6002                windowClass.resetSize(500, 1000);
6003            });
6004        } catch (exception) {
6005            console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(exception));
6006        };
6007    }
6008};
6009```
6010### createSubWindow<sup>9+</sup>
6011
6012createSubWindow(name: string): Promise&lt;Window&gt;
6013
6014Creates a subwindow for this window stage. This API uses a promise to return the result.
6015
6016**Model restriction**: This API can be used only in the stage model.
6017
6018**System capability**: SystemCapability.WindowManager.WindowManager.Core
6019
6020**Parameters**
6021
6022| Name | Type   | Mandatory | Description            |
6023| ---- | ------ | --------- | ---------------------- |
6024| name | string | Yes       | Name of the subwindow. |
6025
6026**Return value**
6027
6028| Type                             | Description                           |
6029| -------------------------------- | ------------------------------------- |
6030| Promise&lt;[Window](#window)&gt; | Promise used to return the subwindow. |
6031
6032**Error codes**
6033
6034For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6035
6036| ID      | Error Message                  |
6037| ------- | ------------------------------ |
6038| 1300002 | This window state is abnormal. |
6039| 1300005 | This window stage is abnormal. |
6040
6041**Example**
6042
6043```ts
6044import UIAbility from '@ohos.app.ability.UIAbility';
6045
6046class myAbility extends UIAbility {
6047    onWindowStageCreate(windowStage) {
6048        console.log('onWindowStageCreate');
6049        let windowClass = null;
6050        try {
6051            let promise = windowStage.createSubWindow('mySubWindow');
6052            promise.then((data) => {
6053                windowClass = data;
6054                console.info('Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
6055            }).catch((err) => {
6056                console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(err));
6057            });
6058        } catch (exception) {
6059            console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(exception));
6060        };
6061    }
6062};
6063```
6064
6065### getSubWindow<sup>9+</sup>
6066
6067getSubWindow(callback: AsyncCallback&lt;Array&lt;Window&gt;&gt;): void
6068
6069Obtains all the subwindows of this window stage. This API uses an asynchronous callback to return the result.
6070
6071**Model restriction**: This API can be used only in the stage model.
6072
6073**System capability**: SystemCapability.WindowManager.WindowManager.Core
6074
6075**Parameters**
6076
6077| Name     | Type                                                | Mandatory | Description                                 |
6078| -------- | --------------------------------------------------- | --------- | ------------------------------------------- |
6079| callback | AsyncCallback&lt;Array&lt;[Window](#window)&gt;&gt; | Yes       | Callback used to return all the subwindows. |
6080
6081**Error codes**
6082
6083For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6084
6085| ID      | Error Message                  |
6086| ------- | ------------------------------ |
6087| 1300005 | This window stage is abnormal. |
6088
6089**Example**
6090
6091```ts
6092import UIAbility from '@ohos.app.ability.UIAbility';
6093
6094class myAbility extends UIAbility {
6095    onWindowStageCreate(windowStage) {
6096        console.log('onWindowStageCreate');
6097        let windowClass = null;
6098        windowStage.getSubWindow((err, data) => {
6099            if (err.code) {
6100                console.error('Failed to obtain the subwindow. Cause: ' + JSON.stringify(err));
6101                return;
6102            }
6103            windowClass = data;
6104            console.info('Succeeded in obtaining the subwindow. Data: ' + JSON.stringify(data));
6105        });
6106    }
6107};
6108```
6109### getSubWindow<sup>9+</sup>
6110
6111getSubWindow(): Promise&lt;Array&lt;Window&gt;&gt;
6112
6113Obtains all the subwindows of this window stage. This API uses a promise to return the result.
6114
6115**Model restriction**: This API can be used only in the stage model.
6116
6117**System capability**: SystemCapability.WindowManager.WindowManager.Core
6118
6119**Return value**
6120
6121| Type                                          | Description                                |
6122| --------------------------------------------- | ------------------------------------------ |
6123| Promise&lt;Array&lt;[Window](#window)&gt;&gt; | Promise used to return all the subwindows. |
6124
6125**Error codes**
6126
6127For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6128
6129| ID      | Error Message                  |
6130| ------- | ------------------------------ |
6131| 1300005 | This window stage is abnormal. |
6132
6133**Example**
6134
6135```ts
6136import UIAbility from '@ohos.app.ability.UIAbility';
6137
6138class myAbility extends UIAbility {
6139    onWindowStageCreate(windowStage) {
6140        console.log('onWindowStageCreate');
6141        let windowClass = null;
6142        let promise = windowStage.getSubWindow();
6143        promise.then((data) => {
6144            windowClass = data;
6145            console.info('Succeeded in obtaining the subwindow. Data: ' + JSON.stringify(data));
6146        }).catch((err) => {
6147            console.error('Failed to obtain the subwindow. Cause: ' + JSON.stringify(err));
6148        })
6149    }
6150};
6151```
6152### loadContent<sup>9+</sup>
6153
6154loadContent(path: string, storage: LocalStorage, callback: AsyncCallback&lt;void&gt;): void
6155
6156Loads 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.
6157
6158**Model restriction**: This API can be used only in the stage model.
6159
6160**System capability**: SystemCapability.WindowManager.WindowManager.Core
6161
6162**Parameters**
6163
6164| Name     | Type                                                         | Mandatory | Description                                                  |
6165| -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ |
6166| path     | string                                                       | Yes       | Path of the page from which the content will be loaded.      |
6167| storage  | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | Yes       | A storage unit, which provides storage for variable state properties and non-variable state properties of an application. |
6168| callback | AsyncCallback&lt;void&gt;                                    | Yes       | Callback used to return the result.                          |
6169
6170**Error codes**
6171
6172For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6173
6174| ID      | Error Message                  |
6175| ------- | ------------------------------ |
6176| 1300002 | This window state is abnormal. |
6177| 1300005 | This window stage is abnormal. |
6178
6179**Example**
6180
6181```ts
6182import UIAbility from '@ohos.app.ability.UIAbility';
6183
6184class myAbility extends UIAbility {
6185    storage : LocalStorage
6186    onWindowStageCreate(windowStage) {
6187        this.storage = new LocalStorage();
6188        this.storage.setOrCreate('storageSimpleProp',121);
6189        console.log('onWindowStageCreate');
6190        try {
6191            windowStage.loadContent('pages/page2',this.storage,(err) => {
6192                if (err.code) {
6193                    console.error('Failed to load the content. Cause:' + JSON.stringify(err));
6194                    return;
6195                }
6196                console.info('Succeeded in loading the content.');
6197            });
6198        } catch (exception) {
6199            console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
6200        };
6201    }
6202};
6203```
6204
6205### loadContent<sup>9+</sup>
6206
6207loadContent(path: string, storage?: LocalStorage): Promise&lt;void&gt;
6208
6209Loads 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.
6210
6211**Model restriction**: This API can be used only in the stage model.
6212
6213**System capability**: SystemCapability.WindowManager.WindowManager.Core
6214
6215**Parameters**
6216
6217| Name    | Type                                                         | Mandatory | Description                                                  |
6218| ------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ |
6219| path    | string                                                       | Yes       | Path of the page from which the content will be loaded.      |
6220| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | No        | A storage unit, which provides storage for variable state properties and non-variable state properties of an application. |
6221
6222**Return value**
6223
6224| Type                | Description                    |
6225| ------------------- | ------------------------------ |
6226| Promise&lt;void&gt; | Promise that returns no value. |
6227
6228**Error codes**
6229
6230For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6231
6232| ID      | Error Message                  |
6233| ------- | ------------------------------ |
6234| 1300002 | This window state is abnormal. |
6235| 1300005 | This window stage is abnormal. |
6236
6237**Example**
6238
6239```ts
6240import UIAbility from '@ohos.app.ability.UIAbility';
6241
6242class myAbility extends UIAbility {
6243    storage : LocalStorage
6244    onWindowStageCreate(windowStage) {
6245        this.storage = new LocalStorage();
6246        this.storage.setOrCreate('storageSimpleProp',121);
6247        console.log('onWindowStageCreate');
6248        try {
6249            let promise = windowStage.loadContent('pages/page2',this.storage);
6250            promise.then(() => {
6251                console.info('Succeeded in loading the content.');
6252            }).catch((err) => {
6253                console.error('Failed to load the content. Cause:' + JSON.stringify(err));
6254            });
6255        } catch (exception) {
6256            console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
6257        };
6258    }
6259};
6260```
6261
6262### loadContent<sup>9+</sup>
6263
6264loadContent(path: string, callback: AsyncCallback&lt;void&gt;): void
6265
6266Loads content from a page to this window stage. This API uses an asynchronous callback to return the result.
6267
6268**Model restriction**: This API can be used only in the stage model.
6269
6270**System capability**: SystemCapability.WindowManager.WindowManager.Core
6271
6272**Parameters**
6273
6274| Name     | Type                      | Mandatory | Description                                             |
6275| -------- | ------------------------- | --------- | ------------------------------------------------------- |
6276| path     | string                    | Yes       | Path of the page from which the content will be loaded. |
6277| callback | AsyncCallback&lt;void&gt; | Yes       | Callback used to return the result.                     |
6278
6279**Error codes**
6280
6281For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6282
6283| ID      | Error Message                  |
6284| ------- | ------------------------------ |
6285| 1300002 | This window state is abnormal. |
6286| 1300005 | This window stage is abnormal. |
6287
6288**Example**
6289
6290```ts
6291import UIAbility from '@ohos.app.ability.UIAbility';
6292
6293class myAbility extends UIAbility {
6294    onWindowStageCreate(windowStage) {
6295        console.log('onWindowStageCreate');
6296        try {
6297            windowStage.loadContent('pages/page2', (err) => {
6298                if (err.code) {
6299                    console.error('Failed to load the content. Cause:' + JSON.stringify(err));
6300                    return;
6301                }
6302                console.info('Succeeded in loading the content.');
6303            });
6304        } catch (exception) {
6305            console.error('Failed to load the content. Cause:' + JSON.stringify(exception));
6306        };
6307    }
6308};
6309```
6310
6311### on('windowStageEvent')<sup>9+</sup>
6312
6313on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void
6314
6315Enables listening for window stage lifecycle changes.
6316
6317**Model restriction**: This API can be used only in the stage model.
6318
6319**System capability**: SystemCapability.WindowManager.WindowManager.Core
6320
6321**Parameters**
6322
6323| Name     | Type                                                         | Mandatory | Description                                                  |
6324| -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ |
6325| type     | string                                                       | Yes       | Event type. The value is fixed at **'windowStageEvent'**, indicating the window stage lifecycle change event. |
6326| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | Yes       | Callback used to return the window stage lifecycle state.    |
6327
6328**Error codes**
6329
6330For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6331
6332| ID      | Error Message                  |
6333| ------- | ------------------------------ |
6334| 1300002 | This window state is abnormal. |
6335| 1300005 | This window stage is abnormal. |
6336
6337**Example**
6338
6339```ts
6340import UIAbility from '@ohos.app.ability.UIAbility';
6341
6342class myAbility extends UIAbility {
6343    onWindowStageCreate(windowStage) {
6344        console.log('onWindowStageCreate');
6345        try {
6346            windowStage.on('windowStageEvent', (data) => {
6347                console.info('Succeeded in enabling the listener for window stage event changes. Data: ' +
6348                    JSON.stringify(data));
6349            });
6350        } catch (exception) {
6351            console.error('Failed to enable the listener for window stage event changes. Cause:' +
6352                JSON.stringify(exception));
6353        };
6354    }
6355};
6356```
6357
6358### off('windowStageEvent')<sup>9+</sup>
6359
6360off(eventType: 'windowStageEvent', callback?: Callback&lt;WindowStageEventType&gt;): void
6361
6362Disables listening for window stage lifecycle changes.
6363
6364**Model restriction**: This API can be used only in the stage model.
6365
6366**System capability**: SystemCapability.WindowManager.WindowManager.Core
6367
6368**Parameters**
6369
6370| Name     | Type                                                         | Mandatory | Description                                                  |
6371| -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ |
6372| type     | string                                                       | Yes       | Event type. The value is fixed at **'windowStageEvent'**, indicating the window stage lifecycle change event. |
6373| callback | Callback&lt;[WindowStageEventType](#windowstageeventtype9)&gt; | No        | Callback used to return the window stage lifecycle state.    |
6374
6375**Error codes**
6376
6377For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6378
6379| ID      | Error Message                  |
6380| ------- | ------------------------------ |
6381| 1300002 | This window state is abnormal. |
6382| 1300005 | This window stage is abnormal. |
6383
6384**Example**
6385
6386```ts
6387import UIAbility from '@ohos.app.ability.UIAbility';
6388
6389class myAbility extends UIAbility {
6390    onWindowStageCreate(windowStage) {
6391        console.log('onWindowStageCreate');
6392        try {
6393            windowStage.off('windowStageEvent');
6394        } catch (exception) {
6395            console.error('Failed to disable the listener for window stage event changes. Cause:' +
6396                JSON.stringify(exception));
6397        };
6398    }
6399};
6400```
6401
6402### disableWindowDecor()<sup>9+</sup>
6403
6404disableWindowDecor(): void
6405
6406Disables window decorators.
6407
6408**Model restriction**: This API can be used only in the stage model.
6409
6410**System API**: This is a system API.
6411
6412**System capability**: SystemCapability.WindowManager.WindowManager.Core
6413
6414**Error codes**
6415
6416For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6417
6418| ID      | Error Message                  |
6419| ------- | ------------------------------ |
6420| 1300002 | This window state is abnormal. |
6421| 1300005 | This window stage is abnormal. |
6422
6423**Example**
6424
6425```ts
6426import UIAbility from '@ohos.app.ability.UIAbility';
6427
6428class myAbility extends UIAbility {
6429    onWindowStageCreate(windowStage) {
6430        console.log('disableWindowDecor');
6431        windowStage.disableWindowDecor();
6432    }
6433};
6434```
6435
6436### setShowOnLockScreen()<sup>9+</sup>
6437
6438setShowOnLockScreen(showOnLockScreen: boolean): void
6439
6440Sets whether to display the window of the application on the lock screen.
6441
6442**System API**: This is a system API.
6443
6444**Model restriction**: This API can be used only in the stage model.
6445
6446**System capability**: SystemCapability.WindowManager.WindowManager.Core
6447
6448**Parameters**
6449
6450| Name             | Type    | Mandatory | Description                                                  |
6451| ---------------- | ------- | --------- | ------------------------------------------------------------ |
6452| 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. |
6453
6454**Error codes**
6455
6456For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md).
6457
6458| ID      | Error Message                  |
6459| ------- | ------------------------------ |
6460| 1300002 | This window state is abnormal. |
6461| 1300005 | This window stage is abnormal. |
6462
6463**Example**
6464
6465```ts
6466import UIAbility from '@ohos.app.ability.UIAbility';
6467
6468class myAbility extends UIAbility {
6469    onWindowStageCreate(windowStage) {
6470        console.log('onWindowStageCreate');
6471        try {
6472            windowStage.setShowOnLockScreen(true);
6473        } catch (exception) {
6474            console.error('Failed to show on lockscreen. Cause:' + JSON.stringify(exception));
6475        };
6476    }
6477};
6478```
6479## TransitionContext<sup>9+</sup>
6480
6481Provides the context for the transition animation.
6482
6483### Attributes
6484
6485**System API**: This is a system API.
6486
6487**System capability**: SystemCapability.WindowManager.WindowManager.Core
6488
6489| Name                  | Type              | Readable | Writable | Description                             |
6490| --------------------- | ----------------- | -------- | -------- | --------------------------------------- |
6491| toWindow<sup>9+</sup> | [Window](#window) | Yes      | Yes      | Target window to display the animation. |
6492
6493### completeTransition<sup>9+</sup>
6494
6495completeTransition(isCompleted: boolean): void
6496
6497Completes the transition. This API can be called only after [animateTo()](../arkui-ts/ts-explicit-animation.md) is executed.
6498
6499**System API**: This is a system API.
6500
6501**System capability**: SystemCapability.WindowManager.WindowManager.Core
6502
6503**Parameters**
6504
6505| Name        | Type    | Mandatory | Description                                                  |
6506| ----------- | ------- | --------- | ------------------------------------------------------------ |
6507| isCompleted | boolean | Yes       | Whether the transition is complete. The value **true** means that the transition is complete, and **false** means the opposite. |
6508
6509**Example**
6510
6511```js
6512let controller = windowClass.getTransitionController();
6513controller.animationForShown = (context : window.TransitionContext) => {
6514	let toWindow = context.toWindow;
6515 	animateTo({
6516    	duration: 1000, // Animation duration.
6517        tempo: 0.5, // Playback speed.
6518        curve: Curve.EaseInOut, // Animation curve.
6519        delay: 0, // Animation delay.
6520        iterations: 1, // Number of playback times.
6521        playMode: PlayMode.Normal // Animation playback mode.
6522      }, () => {
6523        let obj : window.TranslateOptions = {
6524          x : 100.0,
6525          y : 0.0,
6526          z : 0.0
6527        };
6528        toWindow.translate(obj);
6529        console.info('toWindow translate end');
6530      }
6531    );
6532    try {
6533        context.completeTransition(true)
6534    } catch (exception) {
6535        console.info('toWindow translate fail. Cause: ' + JSON.stringify(exception));
6536    }
6537    console.info('complete transition end');
6538};
6539```
6540
6541## TransitionController<sup>9+</sup>
6542
6543Implements the transition animation controller.
6544
6545### animationForShown<sup>9+</sup>
6546
6547animationForShown(context: TransitionContext): void
6548
6549Customizes the animation for the scenario when the window is shown.
6550
6551**System API**: This is a system API.
6552
6553**System capability**: SystemCapability.WindowManager.WindowManager.Core
6554
6555**Parameters**
6556
6557| Name    | Type                                     | Mandatory | Description                          |
6558| ------- | ---------------------------------------- | --------- | ------------------------------------ |
6559| context | [TransitionContext](#transitioncontext9) | Yes       | Context of the transition animation. |
6560
6561**Example**
6562
6563```js
6564let controller = windowClass.getTransitionController();
6565controller.animationForShown = (context : window.TransitionContext) => {
6566	let toWindow = context.toWindow;
6567 	animateTo({
6568    	duration: 1000, // Animation duration.
6569        tempo: 0.5, // Playback speed.
6570        curve: Curve.EaseInOut, // Animation curve.
6571        delay: 0, // Animation delay.
6572        iterations: 1, // Number of playback times.
6573        playMode: PlayMode.Normal // Animation playback mode.
6574        onFinish: ()=> {
6575            context.completeTransition(true)
6576        }
6577      }, () => {
6578        let obj : window.TranslateOptions = {
6579          x : 100.0,
6580          y : 0.0,
6581          z : 0.0
6582        };
6583        toWindow.translate(obj);
6584        console.info('toWindow translate end');
6585      }
6586    );
6587    console.info('complete transition end');
6588};
6589```
6590
6591### animationForHidden<sup>9+</sup>
6592
6593animationForHidden(context: TransitionContext): void
6594
6595Customizes the animation for the scenario when the window is hidden.
6596
6597**System API**: This is a system API.
6598
6599**System capability**: SystemCapability.WindowManager.WindowManager.Core
6600
6601**Parameters**
6602
6603| Name    | Type                                     | Mandatory | Description                          |
6604| ------- | ---------------------------------------- | --------- | ------------------------------------ |
6605| context | [TransitionContext](#transitioncontext9) | Yes       | Context of the transition animation. |
6606
6607**Example**
6608
6609```js
6610let controller = windowClass.getTransitionController();
6611controller.animationForHidden = (context : window.TransitionContext) => {
6612	let toWindow = context.toWindow;
6613 	animateTo({
6614    	duration: 1000, // Animation duration.
6615        tempo: 0.5, // Playback speed.
6616        curve: Curve.EaseInOut, // Animation curve.
6617        delay: 0, // Animation delay.
6618        iterations: 1, // Number of playback times.
6619        playMode: PlayMode.Normal // Animation playback mode.
6620        onFinish: ()=> {
6621            context.completeTransition(true)
6622        }
6623      }, () => {
6624        let obj : window.TranslateOptions = {
6625          x : 100.0,
6626          y : 0.0,
6627          z : 0.0
6628        };
6629        toWindow.translate(obj);
6630        console.info('toWindow translate end');
6631      }
6632    )
6633    console.info('complete transition end');
6634};
6635```