1# @ohos.window (Window) (System API)
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): 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> - This topic describes only system APIs provided by the module. For details about its public APIs, see [@ohos.window (Window)](js-apis-window.md).
15
16## Modules to Import
17
18```ts
19import { window } from '@kit.ArkUI';
20```
21
22## WindowType<sup>7+</sup>
23
24
25Enumerates the window types.
26
27
28| Name                                 | Value| Description                                                                                    |
29|-------------------------------------| ------ |----------------------------------------------------------------------------------------|
30| TYPE_INPUT_METHOD<sup>(deprecated)</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.<br>**NOTE**: This API is supported since API version 9 and deprecated since API version 13. There is no alternative window type. To control the input method, call [Input method framework APIs](../../inputmethod/inputmethod_application_guide.md).<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
36| 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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
37| 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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
38| 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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
39| 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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
40| 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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
41| 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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
42| 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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
43| 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.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
44| TYPE_SYSTEM_TOAST<sup>11+</sup>     | 18      | Toast displayed at the top.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
45| TYPE_DIVIDER<sup>11+</sup>          | 19      | Divider.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
46| TYPE_GLOBAL_SEARCH<sup>11+</sup>    | 20      | Window used for global search.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.<br>**System capability**: SystemCapability.WindowManager.WindowManager.Core|
47| TYPE_HANDWRITE<sup>12+</sup>        | 21      | Stylus window.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.<br>**System capability**: SystemCapability.Window.SessionManager|
48
49## WindowMode<sup>7+</sup>
50
51Enumerates the window modes.
52
53**System API**: This is a system API.
54
55**System capability**: SystemCapability.WindowManager.WindowManager.Core
56
57| Name      | Value  | Description                         |
58| ---------- | ---- | ----------------------------- |
59| UNDEFINED  | 1    | The window mode is not defined by the application.      |
60| FULLSCREEN | 2    | The application is displayed in full screen.            |
61| PRIMARY    | 3    | The application is displayed in the primary window in split-screen mode.  |
62| SECONDARY  | 4    | The application is displayed in the secondary window in split-screen mode.  |
63| FLOATING   | 5    | The application is displayed in a floating window.|
64
65## WindowLayoutMode<sup>9+</sup>
66
67Enumerates the window layout modes.
68
69**System API**: This is a system API.
70
71**System capability**: SystemCapability.WindowManager.WindowManager.Core
72
73| Name      | Value  | Description                         |
74| ---------- | ---- | ----------------------------- |
75| WINDOW_LAYOUT_MODE_CASCADE  | 0    | Cascade mode.      |
76| WINDOW_LAYOUT_MODE_TILE | 1    | Tile mode.            |
77
78
79## BlurStyle<sup>9+</sup>
80
81Enumerates the window blur styles.
82
83**System API**: This is a system API.
84
85**System capability**: SystemCapability.WindowManager.WindowManager.Core
86
87| Name   | Value  | Description                |
88| ------- | ---- | -------------------- |
89| OFF     | 0    | Blur disabled.      |
90| THIN    | 1    | Thin blur.|
91| REGULAR | 2    | Regular blur.|
92| THICK   | 3    | Thick blur.|
93
94## SystemBarRegionTint<sup>8+</sup>
95
96Describes the callback for a single system bar.
97
98**System API**: This is a system API.
99
100**System capability**: SystemCapability.WindowManager.WindowManager.Core
101
102| Name           | Type                 | Readable| Writable| Description                                                        |
103| --------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ |
104| type            | [WindowType](#windowtype7) | Yes  | No  | Type of the system bar whose properties are changed. Only the status bar and navigation bar are supported.|
105| 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.|
106| region          | [Rect](js-apis-window.md#rect7)             | Yes  | No  | Current position and size of the system bar.                                    |
107| backgroundColor | string                    | Yes  | No  | Background color of the system bar. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
108| contentColor    | string                    | Yes  | No  | Color of the text on the system bar.                                            |
109
110## SystemBarTintState<sup>8+</sup>
111
112Describes the callback for the current system bar.
113
114**System API**: This is a system API.
115
116**System capability**: SystemCapability.WindowManager.WindowManager.Core
117
118| Name      | Type                                           | Readable| Writable| Description                        |
119| ---------- | --------------------------------------------------- | ---- | ---- | ---------------------------- |
120| displayId  | number                                              | Yes  | No  | ID of the current physical screen. The value must be an integer.            |
121| regionTint | Array<[SystemBarRegionTint](#systembarregiontint8)> | Yes  | No  | All system bar information that has been changed.|
122
123## ScaleOptions<sup>9+</sup>
124
125Describes the scale parameters.
126
127**System API**: This is a system API.
128
129**System capability**: SystemCapability.WindowManager.WindowManager.Core
130
131| Name  | Type| Read Only| Mandatory| Description                                        |
132| ------ | -------- | ---- | ---- | --------------------------------------------|
133| x      | number   | No  | No  | Scale factor along the x-axis. The value is a floating point number, and the default value is **1.0**.                  |
134| y      | number   | No  | No  | Scale factor along the y-axis. The value is a floating point number, and the default value is **1.0**.                  |
135| pivotX | number   | No  | No  | X coordinate of the scale center. The value is a floating point number in the range [0.0, 1.0], and the default value is **0.5**.|
136| pivotY | number   | No  | No  | Y coordinate of the scale center. The value is a floating point number in the range [0.0, 1.0], and the default value is **0.5**.|
137
138## RotateOptions<sup>9+</sup>
139
140Describes the rotation parameters.
141
142**System API**: This is a system API.
143
144**System capability**: SystemCapability.WindowManager.WindowManager.Core
145
146| Name  | Type| Read Only| Mandatory| Description                                         |
147| ------ | -------- | ---- |---- |---------------------------------------------|
148| x      | number   | No  | No | Rotation angle around the x-axis. The value is a floating point number, and the default value is **0.0**.                  |
149| y      | number   | No  | No | Rotation angle around the y-axis. The value is a floating point number, and the default value is **0.0**.                  |
150| z      | number   | No  | No | Rotation angle around the z-axis. The value is a floating point number, and the default value is **0.0**.                  |
151| pivotX | number   | No  | No | X coordinate of the rotation center. The value is a floating point number in the range [0.0, 1.0], and the default value is **0.5**.|
152| pivotY | number   | No  | No | Y coordinate of the rotation center. The value is a floating point number in the range [0.0, 1.0], and the default value is **0.5**. |
153
154## TranslateOptions<sup>9+</sup>
155
156Describes the translation parameters.
157
158**System API**: This is a system API.
159
160**System capability**: SystemCapability.WindowManager.WindowManager.Core
161
162| Name| Type| Read Only| Mandatory| Description                        |
163| ---- | -------- | ---- | ---- | ---------------------------- |
164| x    | number   | No  | No | Distance to translate along the x-axis. The value is a floating point number, the default value is 0.0, and the unit is px.|
165| y    | number   | No  | No | Distance to translate along the y-axis. The value is a floating point number, the default value is 0.0, and the unit is px.|
166| z    | number   | No  | No | Distance to translate along the z-axis. The value is a floating point number, the default value is 0.0, and the unit is px.|
167
168## WindowInfo<sup>12+</sup>
169
170Describes the window information.
171
172**System API**: This is a system API.
173
174**System capability**: SystemCapability.Window.SessionManager
175
176| Name  | Type  | Read Only| Optional| Description                                      |
177| ------ | ------ | ---- | ---- | ------------------------------------------ |
178| rect  | [Rect](js-apis-window.md#rect7)   | Yes  | No  | Size of the rectangle that can be drawn in the window. The upper boundary and left boundary are calculated relative to the window.|
179| bundleName  | string   | Yes  | No  | Bundle name.         |
180| abilityName | string   | Yes  | No  | Ability name.              |
181| windowId | number | Yes  | No  | Window ID.  |
182| windowStatusType | [WindowStatusType](js-apis-window.md#windowstatustype11) | Yes  | No  | Window mode.  |
183
184## window.minimizeAll<sup>9+</sup>
185minimizeAll(id: number, callback: AsyncCallback&lt;void&gt;): void
186
187Minimizes all windows on a display. This API uses an asynchronous callback to return the result.
188
189**System API**: This is a system API.
190
191**System capability**: SystemCapability.WindowManager.WindowManager.Core
192
193**Parameters**
194
195| Name  | Type                     | Mandatory| Description          |
196| -------- | ------------------------- | ---- | -------------- |
197| id       | number                    | Yes  | ID of the [display](js-apis-display.md#display). The value must be an integer.|
198| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.    |
199
200**Error codes**
201
202For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
203
204| ID| Error Message|
205| ------- | -------------------------------------------- |
206| 202     | Permission verification failed. A non-system application calls a system API. |
207| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
208| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
209| 1300003 | This window manager service works abnormally. |
210
211**Example**
212
213```ts
214import { display } from '@kit.ArkUI';
215import { BusinessError } from '@kit.BasicServicesKit';
216
217let displayClass: display.Display | null = null;
218displayClass = display.getDefaultDisplaySync();
219
220try {
221  window.minimizeAll(displayClass.id, (err: BusinessError) => {
222    const errCode: number = err.code;
223    if (errCode) {
224      console.error(`Failed to minimize all windows. Cause code: ${err.code}, message: ${err.message}`);
225      return;
226    }
227    console.info('Succeeded in minimizing all windows.');
228  });
229} catch (exception) {
230  console.error(`Failed to minimize all windows. Cause code: ${exception.code}, message: ${exception.message}`);
231}
232```
233
234## window.minimizeAll<sup>9+</sup>
235minimizeAll(id: number): Promise&lt;void&gt;
236
237Minimizes all windows on a display. This API uses a promise to return the result.
238
239**System API**: This is a system API.
240
241**System capability**: SystemCapability.WindowManager.WindowManager.Core
242
243**Parameters**
244
245| Name  | Type                     | Mandatory| Description          |
246| -------- | ------------------------- | ---- | -------------- |
247| id       | number                    | Yes  | ID of the [display](js-apis-display.md#display). The value must be an integer.|
248
249**Return value**
250
251| Type               | Description                     |
252| ------------------- | ------------------------- |
253| Promise&lt;void&gt; | Promise that returns no value.|
254
255**Error codes**
256
257For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
258
259| ID| Error Message|
260| ------- | -------------------------------------------- |
261| 202     | Permission verification failed. A non-system application calls a system API. |
262| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
263| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
264| 1300003 | This window manager service works abnormally. |
265
266**Example**
267
268```ts
269import { display } from '@kit.ArkUI';
270import { BusinessError } from '@kit.BasicServicesKit';
271
272let displayClass: display.Display | null = null;
273displayClass = display.getDefaultDisplaySync();
274
275try {
276  let promise = window.minimizeAll(displayClass.id);
277  promise.then(() => {
278    console.info('Succeeded in minimizing all windows.');
279  }).catch((err: BusinessError) => {
280    console.error(`Failed to minimize all windows. Cause code: ${err.code}, message: ${err.message}`);
281  });
282} catch (exception) {
283  console.error(`Failed to minimize all windows. Cause code: ${exception.code}, message: ${exception.message}`);
284}
285```
286
287## window.toggleShownStateForAllAppWindows<sup>9+</sup>
288toggleShownStateForAllAppWindows(callback: AsyncCallback&lt;void&gt;): void
289
290Hides or restores the application's windows during quick multi-window switching. This API uses an asynchronous callback to return the result.
291
292**System API**: This is a system API.
293
294**System capability**: SystemCapability.WindowManager.WindowManager.Core
295
296**Parameters**
297
298| Name  | Type                     | Mandatory| Description          |
299| -------- | ------------------------- | ---- | -------------- |
300| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.    |
301
302**Error codes**
303
304For details about the error codes, see [Window Error Codes](errorcode-window.md).
305
306| ID| Error Message|
307| ------- | -------------------------------------------- |
308| 202     | Permission verification failed. A non-system application calls a system API. |
309| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
310| 1300003 | This window manager service works abnormally. |
311
312**Example**
313
314```ts
315import { BusinessError } from '@kit.BasicServicesKit';
316
317window.toggleShownStateForAllAppWindows((err: BusinessError) => {
318  const errCode: number = err.code;
319  if (errCode) {
320    console.error(`Failed to toggle shown state for all app windows. Cause code: ${err.code}, message: ${err.message}`);
321    return;
322  }
323  console.info('Succeeded in toggling shown state for all app windows.');
324});
325```
326
327## window.toggleShownStateForAllAppWindows<sup>9+</sup>
328toggleShownStateForAllAppWindows(): Promise&lt;void&gt;
329
330Hides or restores the application's windows during quick multi-window switching. This API uses a promise to return the result.
331
332**System API**: This is a system API.
333
334**System capability**: SystemCapability.WindowManager.WindowManager.Core
335
336**Return value**
337
338| Type               | Description                     |
339| ------------------- | ------------------------- |
340| Promise&lt;void&gt; | Promise that returns no value.|
341
342**Error codes**
343
344For details about the error codes, see [Window Error Codes](errorcode-window.md).
345
346| ID| Error Message|
347| ------- | -------------------------------------------- |
348| 202     | Permission verification failed. A non-system application calls a system API. |
349| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
350| 1300003 | This window manager service works abnormally. |
351
352**Example**
353
354```ts
355import { BusinessError } from '@kit.BasicServicesKit';
356
357let promise = window.toggleShownStateForAllAppWindows();
358promise.then(() => {
359  console.info('Succeeded in toggling shown state for all app windows.');
360}).catch((err: BusinessError) => {
361  console.error(`Failed to toggle shown state for all app windows. Cause code: ${err.code}, message: ${err.message}`);
362});
363```
364
365## window.setWindowLayoutMode<sup>9+</sup>
366setWindowLayoutMode(mode: WindowLayoutMode, callback: AsyncCallback&lt;void&gt;): void
367
368Sets the window layout mode. This API uses an asynchronous callback to return the result.
369
370**System API**: This is a system API.
371
372**System capability**: SystemCapability.WindowManager.WindowManager.Core
373
374**Parameters**
375
376| Name  | Type                     | Mandatory| Description          |
377| -------- | ------------------------- | ---- | -------------- |
378| mode       | [WindowLayoutMode](#windowlayoutmode9)                  | Yes  | Window layout mode to set.|
379| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.    |
380
381**Error codes**
382
383For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
384
385| ID| Error Message|
386| ------- | -------------------------------------------- |
387| 202     | Permission verification failed. A non-system application calls a system API. |
388| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
389| 1300003 | This window manager service works abnormally. |
390
391**Example**
392
393```ts
394import { BusinessError } from '@kit.BasicServicesKit';
395
396try {
397  window.setWindowLayoutMode(window.WindowLayoutMode.WINDOW_LAYOUT_MODE_CASCADE, (err: BusinessError) => {
398    const errCode: number = err.code;
399    if (errCode) {
400      console.error(`Failed to set window layout mode. Cause code: ${err.code}, message: ${err.message}`);
401      return;
402    }
403    console.info('Succeeded in setting window layout mode.');
404  });
405} catch (exception) {
406  console.error(`Failed to set window layout mode. Cause code: ${exception.code}, message: ${exception.message}`);
407}
408```
409
410## window.setWindowLayoutMode<sup>9+</sup>
411setWindowLayoutMode(mode: WindowLayoutMode): Promise&lt;void&gt;
412
413Sets the window layout mode. This API uses a promise to return the result.
414
415**System API**: This is a system API.
416
417**System capability**: SystemCapability.WindowManager.WindowManager.Core
418
419**Parameters**
420
421| Name  | Type                     | Mandatory| Description          |
422| -------- | ------------------------- | ---- | -------------- |
423| mode       | [WindowLayoutMode](#windowlayoutmode9)                    | Yes  | Window layout mode to set.|
424
425**Return value**
426
427| Type               | Description                     |
428| ------------------- | ------------------------- |
429| Promise&lt;void&gt; | Promise that returns no value.|
430
431**Error codes**
432
433For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
434
435| ID| Error Message|
436| ------- | -------------------------------------------- |
437| 202     | Permission verification failed. A non-system application calls a system API. |
438| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
439| 1300003 | This window manager service works abnormally. |
440
441**Example**
442
443```ts
444import { BusinessError } from '@kit.BasicServicesKit';
445
446try {
447  let promise = window.setWindowLayoutMode(window.WindowLayoutMode.WINDOW_LAYOUT_MODE_CASCADE);
448  promise.then(() => {
449    console.info('Succeeded in setting window layout mode.');
450  }).catch((err: BusinessError) => {
451    console.error(`Failed to set window layout mode. Cause code: ${err.code}, message: ${err.message}`);
452  });
453} catch (exception) {
454  console.error(`Failed to set window layout mode. Cause code: ${exception.code}, message: ${exception.message}`);
455}
456```
457
458## window.on('systemBarTintChange')<sup>8+</sup>
459
460on(type: 'systemBarTintChange', callback: Callback&lt;SystemBarTintState&gt;): void
461
462Subscribes to the property change event of the status bar and navigation bar.
463
464**System API**: This is a system API.
465
466**System capability**: SystemCapability.WindowManager.WindowManager.Core
467
468**Parameters**
469
470| Name  | Type                                                      | Mandatory| Description                                                        |
471| -------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
472| type     | string                                                     | Yes  | Event type. The value is fixed at **'systemBarTintChange'**, indicating the property change event of the status bar and navigation bar.|
473| callback | Callback&lt;[SystemBarTintState](#systembartintstate8)&gt; | Yes  | Callback used to return the properties of the status bar and navigation bar.                |
474
475**Error codes**
476
477For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
478
479| ID| Error Message|
480| ------- | -------------------------------- |
481| 202     | Permission verification failed. A non-system application calls a system API. |
482| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.               |
483
484**Example**
485
486```ts
487try {
488  window.on('systemBarTintChange', (data) => {
489    console.info('Succeeded in enabling the listener for systemBarTint changes. Data: ' + JSON.stringify(data));
490  });
491} catch (exception) {
492  console.error(`Failed to enable the listener for systemBarTint changes. Cause code: ${exception.code}, message: ${exception.message}`);
493}
494```
495
496## window.off('systemBarTintChange')<sup>8+</sup>
497
498off(type: 'systemBarTintChange', callback?: Callback&lt;SystemBarTintState &gt;): void
499
500Unsubscribes from the property change event of the status bar and navigation bar.
501
502**System API**: This is a system API.
503
504**System capability**: SystemCapability.WindowManager.WindowManager.Core
505
506**Parameters**
507
508| Name  | Type                                                      | Mandatory| Description                                                        |
509| -------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
510| type     | string                                                     | Yes  | Event type. The value is fixed at **'systemBarTintChange'**, indicating the property change event of the status bar and navigation bar.|
511| callback | Callback&lt;[SystemBarTintState](#systembartintstate8)&gt; | No  | Callback used to return the properties of the status bar and navigation bar. If a value is passed in, the corresponding subscription is canceled. If no value is passed in, all subscriptions to the specified event are canceled.               |
512
513**Error codes**
514
515For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
516
517| ID| Error Message|
518| ------- | -------------------------------- |
519| 202     | Permission verification failed. A non-system application calls a system API. |
520| 401     | Parameter error. Possible cause: 1. Incorrect parameter types; 2. Parameter verification failed.              |
521
522**Example**
523
524```ts
525const callback = (systemBarTintState: window.SystemBarTintState) => {
526  // ...
527}
528try {
529  window.on('systemBarTintChange', callback);
530
531  window.off('systemBarTintChange', callback);
532  // Unregister all the callbacks that have been registered through on().
533  window.off('systemBarTintChange');
534} catch (exception) {
535  console.error(`Failed to enable or disable the listener for systemBarTint changes. Cause code: ${exception.code}, message: ${exception.message}`);
536}
537```
538
539## window.on('gestureNavigationEnabledChange')<sup>10+</sup>
540
541on(type: 'gestureNavigationEnabledChange', callback: Callback&lt;boolean&gt;): void
542
543Subscribes to the gesture navigation status change event.
544
545**System API**: This is a system API.
546
547**System capability**: SystemCapability.WindowManager.WindowManager.Core
548
549**Parameters**
550
551| Name  | Type                    | Mandatory| Description                                                                         |
552| -------- | ----------------------- | ---- | ----------------------------------------------------------------------------- |
553| type     | string                  | Yes  | Event type. The value is fixed at **'gestureNavigationEnabledChange'**, indicating the gesture navigation status change event.   |
554| callback | Callback&lt;boolean&gt; | Yes  | Callback used to return the gesture navigation status. The value **true** means that the gesture navigation status is changed to enabled, and **false** means that the gesture navigation status is changed to disabled.|
555
556**Error codes**
557
558For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
559
560| ID| Error Message|
561| ------- | -------------------------------------------- |
562| 202     | Permission verification failed. A non-system application calls a system API. |
563| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.               |
564| 1300002 | This window state is abnormal. |
565| 1300003 | This window manager service works abnormally. |
566
567**Example**
568
569```ts
570try {
571  window.on('gestureNavigationEnabledChange', (data) => {
572    console.info('Succeeded in enabling the listener for gesture navigation status changes. Data: ' + JSON.stringify(data));
573  });
574} catch (exception) {
575  console.error(`Failed to enable the listener for gesture navigation status changes. Cause code: ${exception.code}, message: ${exception.message}`);
576}
577```
578
579## window.off('gestureNavigationEnabledChange')<sup>10+</sup>
580
581off(type: 'gestureNavigationEnabledChange', callback?: Callback&lt;boolean&gt;): void
582
583Unsubscribes from the gesture navigation status change event.
584
585**System API**: This is a system API.
586
587**System capability**: SystemCapability.WindowManager.WindowManager.Core
588
589**Parameters**
590
591| Name  | Type                    | Mandatory| Description                                                       |
592| -------- | ----------------------- | -- | ------------------------------------------------------------ |
593| type     | string                  | Yes| Event type. The value is fixed at **'gestureNavigationEnabledChange'**, indicating the gesture navigation status change event.|
594| callback | Callback&lt;boolean&gt; | No| Callback function that has been used for the subscription. If a value is passed in, the corresponding subscription is canceled. If no value is passed in, all subscriptions to the specified event are canceled.|
595
596**Error codes**
597
598For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
599
600| ID| Error Message|
601| ------- | -------------------------------------------- |
602| 202     | Permission verification failed. A non-system application calls a system API. |
603| 401     | Parameter error. Possible cause: 1. Incorrect parameter types; 2. Parameter verification failed.               |
604| 1300002 | This window state is abnormal. |
605| 1300003 | This window manager service works abnormally. |
606
607**Example**
608
609```ts
610const callback = (bool: boolean) => {
611  // ...
612}
613try {
614  window.on('gestureNavigationEnabledChange', callback);
615  window.off('gestureNavigationEnabledChange', callback);
616  // If multiple callbacks are enabled in on(), they will all be disabled.
617  window.off('gestureNavigationEnabledChange');
618} catch (exception) {
619  console.error(`Failed to enable or disable the listener for gesture navigation status changes. Cause code: ${exception.code}, message: ${exception.message}`);
620}
621```
622
623## window.on('waterMarkFlagChange')<sup>10+</sup>
624
625on(type: 'waterMarkFlagChange', callback: Callback&lt;boolean&gt;): void
626
627Subscribes to the watermark status change event.
628
629**System API**: This is a system API.
630
631**System capability**: SystemCapability.WindowManager.WindowManager.Core
632
633**Parameters**
634
635| Name  | Type                    | Mandatory| Description                                                                         |
636| -------- | ----------------------- | ---- | ----------------------------------------------------------------------------- |
637| type     | string                  | Yes  | Event type. The value is fixed at **'waterMarkFlagChange'**, indicating the watermark status change event.   |
638| callback | Callback&lt;boolean&gt; | Yes  | Callback used to return the watermark status. The value **true** means that the watermark feature is enabled, and **false** means the opposite.|
639
640**Error codes**
641
642For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
643
644| ID| Error Message|
645| ------- | -------------------------------------------- |
646| 202     | Permission verification failed. A non-system application calls a system API. |
647| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed.               |
648| 1300003 | This window manager service works abnormally. |
649
650**Example**
651
652```ts
653try {
654  window.on('waterMarkFlagChange', (data) => {
655    console.info('Succeeded in enabling the listener for watermark flag changes. Data: ' + JSON.stringify(data));
656  });
657} catch (exception) {
658  console.error(`Failed to enable the listener for watermark flag changes. Cause code: ${exception.code}, message: ${exception.message}`);
659}
660```
661
662## window.off('waterMarkFlagChange')<sup>10+</sup>
663
664off(type: 'waterMarkFlagChange', callback?: Callback&lt;boolean&gt;): void
665
666Unsubscribes from the watermark status change event.
667
668**System API**: This is a system API.
669
670**System capability**: SystemCapability.WindowManager.WindowManager.Core
671
672**Parameters**
673
674| Name  | Type                    | Mandatory| Description                                                       |
675| -------- | ----------------------- | -- | ------------------------------------------------------------ |
676| type     | string                  | Yes| Event type. The value is fixed at **'waterMarkFlagChange'**, indicating the watermark status change event.|
677| callback | Callback&lt;boolean&gt; | No| Callback function that has been used for the subscription. If a value is passed in, the corresponding subscription is canceled. If no value is passed in, all subscriptions to the specified event are canceled.|
678
679**Error codes**
680
681For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
682
683| ID| Error Message|
684| ------- | -------------------------------------------- |
685| 202     | Permission verification failed. A non-system application calls a system API. |
686| 401     | Parameter error. Possible cause: 1. Incorrect parameter types; 2. Parameter verification failed.               |
687| 1300003 | This window manager service works abnormally. |
688
689**Example**
690
691```ts
692const callback = (bool: boolean) => {
693  // ...
694}
695try {
696  window.on('waterMarkFlagChange', callback);
697  window.off('waterMarkFlagChange', callback);
698  // Unregister all the callbacks that have been registered through on().
699  window.off('waterMarkFlagChange');
700} catch (exception) {
701  console.error(`Failed to enable or disable the listener for watermark flag changes. Cause code: ${exception.code}, message: ${exception.message}`);
702}
703```
704
705## window.setGestureNavigationEnabled<sup>10+</sup>
706setGestureNavigationEnabled(enable: boolean, callback: AsyncCallback&lt;void&gt;): void
707
708Enables or disables gesture navigation. This API uses an asynchronous callback to return the result.
709
710For security purposes, the system does not interfere with the disabling and enabling of gesture navigation. If an application exits abnormally after it disables gesture navigation and wants to restore gesture navigation, it must implement automatic launch and call this API again to enable gesture navigation.
711
712**System API**: This is a system API.
713
714**System capability**: SystemCapability.WindowManager.WindowManager.Core
715
716**Parameters**
717
718| Name  | Type                     | Mandatory| Description          |
719| -------- | ------------------------- | ---- | -------------- |
720| enable   | boolean                  | Yes  | Whether to enable gesture navigation. The value **true** means to enable gesture navigation, and **false** means the opposite.|
721| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
722
723**Error codes**
724
725For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
726
727| ID| Error Message|
728| ------- | --------------------------------------------- |
729| 202     | Permission verification failed. A non-system application calls a system API. |
730| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
731| 1300002 | This window state is abnormal.                |
732| 1300003 | This window manager service works abnormally. |
733
734**Example**
735
736```ts
737import { BusinessError } from '@kit.BasicServicesKit';
738
739try {
740  window.setGestureNavigationEnabled(true, (err: BusinessError) => {
741    const errCode: number = err.code;
742    if (errCode) {
743      console.error(`Failed to set gesture navigation enabled. Cause code: ${err.code}, message: ${err.message}`);
744      return;
745    }
746    console.info('Succeeded in setting gesture navigation enabled.');
747  });
748} catch (exception) {
749  console.error(`Failed to set gesture navigation enabled. Cause code: ${exception.code}, message: ${exception.message}`);
750}
751```
752
753## window.setGestureNavigationEnabled<sup>10+</sup>
754setGestureNavigationEnabled(enable: boolean): Promise&lt;void&gt;
755
756Enables or disables gesture navigation. This API uses a promise to return the result.
757
758For security purposes, the system does not interfere with the disabling and enabling of gesture navigation. If an application exits abnormally after it disables gesture navigation and wants to restore gesture navigation, it must implement automatic launch and call this API again to enable gesture navigation.
759
760**System API**: This is a system API.
761
762**System capability**: SystemCapability.WindowManager.WindowManager.Core
763
764**Parameters**
765
766| Name| Type    | Mandatory | Description                |
767| ------ | ------- | ---- | -------------------- |
768| enable | boolean | Yes  | Whether to enable gesture navigation. The value **true** means to enable gesture navigation, and **false** means the opposite.|
769
770**Return value**
771
772| Type               | Description                     |
773| ------------------- | ------------------------- |
774| Promise&lt;void&gt; | Promise that returns no value.|
775
776**Error codes**
777
778For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
779
780| ID| Error Message|
781| ------- | -------------------------------------------- |
782| 202     | Permission verification failed. A non-system application calls a system API. |
783| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
784| 1300002 | This window state is abnormal.                |
785| 1300003 | This window manager service works abnormally. |
786
787**Example**
788
789```ts
790import { BusinessError } from '@kit.BasicServicesKit';
791
792try {
793  let promise = window.setGestureNavigationEnabled(true);
794  promise.then(() => {
795    console.info('Succeeded in setting gesture navigation enabled.');
796  }).catch((err: BusinessError) => {
797    console.error(`Failed to set gesture navigation enabled. Cause code: ${err.code}, message: ${err.message}`);
798  });
799} catch (exception) {
800  console.error(`Failed to set gesture navigation enabled. Cause code: ${exception.code}, message: ${exception.message}`);
801}
802```
803
804## window.setWaterMarkImage<sup>10+</sup>
805setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean, callback: AsyncCallback&lt;void&gt;): void
806
807Sets the watermark image display status. This API uses an asynchronous callback to return the result.
808
809**System API**: This is a system API.
810
811**System capability**: SystemCapability.WindowManager.WindowManager.Core
812
813**Parameters**
814
815| Name  | Type                     | Mandatory| Description          |
816| -------- | ------------------------- | ---- | -------------- |
817| pixelMap | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) | Yes| Watermark image.|
818| enable   | boolean                  | Yes  | Whether to display the watermark image. The value **true** means to display the watermark image, and **false** means the opposite.|
819| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
820
821**Error codes**
822
823For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
824
825| ID| Error Message|
826| ------- | --------------------------------------------- |
827| 202     | Permission verification failed. A non-system application calls a system API. |
828| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
829| 1300003 | This window manager service works abnormally. |
830
831**Example**
832
833```ts
834import { image } from '@kit.ImageKit';
835import { BusinessError } from '@kit.BasicServicesKit';
836
837let enable: boolean = true;
838let color: ArrayBuffer = new ArrayBuffer(0);
839let initializationOptions: image.InitializationOptions = {
840  size: {
841    height: 100,
842    width: 100
843  }
844};
845image.createPixelMap(color, initializationOptions).then((pixelMap: image.PixelMap) => {
846  console.info('Succeeded in creating pixelmap.');
847  try {
848    window.setWaterMarkImage(pixelMap, enable, (err: BusinessError) => {
849      const errCode: number = err.code;
850      if (errCode) {
851        console.error(`Failed to show watermark image. Cause code: ${err.code}, message: ${err.message}`);
852        return;
853      }
854      console.info('Succeeded in showing watermark image.');
855    });
856  } catch (exception) {
857    console.error(`Failed to show watermark image. Cause code: ${exception.code}, message: ${exception.message}`);
858  }
859}).catch((err: BusinessError) => {
860  console.error(`Failed to create PixelMap. Cause code: ${err.code}, message: ${err.message}`);
861});
862```
863
864## window.setWaterMarkImage<sup>10+</sup>
865setWaterMarkImage(pixelMap: image.PixelMap, enable: boolean): Promise&lt;void&gt;
866
867Sets the watermark image display status. This API uses a promise to return the result.
868
869**System API**: This is a system API.
870
871**System capability**: SystemCapability.WindowManager.WindowManager.Core
872
873**Parameters**
874
875| Name| Type                       | Mandatory | Description                |
876| ------ | --------------------------- | ---- | -------------------- |
877| pixelMap | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) | Yes| Watermark image.|
878| enable   | boolean                  | Yes  | Whether to display the watermark image. The value **true** means to display the watermark image, and **false** means the opposite.|
879
880**Return value**
881
882| Type               | Description                     |
883| ------------------- | ------------------------- |
884| Promise&lt;void&gt; | Promise that returns no value.|
885
886**Error codes**
887
888For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
889
890| ID| Error Message|
891| ------- | -------------------------------------------- |
892| 202     | Permission verification failed. A non-system application calls a system API. |
893| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
894| 1300003 | This window manager service works abnormally. |
895
896**Example**
897
898```ts
899import { image } from '@kit.ImageKit';
900import { BusinessError } from '@kit.BasicServicesKit';
901
902let enable: boolean = true;
903let color: ArrayBuffer = new ArrayBuffer(0);
904let initializationOptions: image.InitializationOptions = {
905  size: {
906    height: 100,
907    width: 100
908  }
909};
910image.createPixelMap(color, initializationOptions).then((pixelMap: image.PixelMap) => {
911  console.info('Succeeded in creating pixelmap.');
912  try {
913    let promise = window.setWaterMarkImage(pixelMap, enable);
914    promise.then(() => {
915      console.info('Succeeded in showing watermark image.');
916    }).catch((err: BusinessError) => {
917      console.error(`Failed to show watermark image. Cause code: ${err.code}, message: ${err.message}`);
918    });
919  } catch (exception) {
920    console.error(`Failed to show watermark image. Cause code: ${exception.code}, message: ${exception.message}`);
921  }
922}).catch((err: BusinessError) => {
923  console.error(`Failed to create PixelMap. Cause code: ${err.code}, message: ${err.message}`);
924});
925```
926
927## window.getSnapshot<sup>12+</sup>
928
929getSnapshot(windowId: number): Promise<image.PixelMap>
930
931Captures a window. This API uses a promise to return the result.
932
933**System API**: This is a system API.
934
935**System capability**: SystemCapability.WindowManager.WindowManager.Core
936
937**Parameters**
938| Name  | Type  | Mandatory | Description        |
939| -------- | ------ | ----- | ------------ |
940| windowId | number | Yes   | Window ID. You can call [getWindowProperties](js-apis-window.md#getwindowproperties9) to obtain the window properties, in which **id** is the window ID.|
941
942**Return value**
943| Type                   | Description                           |
944| ----------------------- | ------------------------------- |
945| Promise<[image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)> | Promise used to return the window screenshot.|
946
947**Error codes**
948For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
949
950| ID| Error Message                                    |
951| -------- | -------------------------------------------- |
952| 202     | Permission verification failed. A non-system application calls a system API. |
953| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
954| 1300002  | This window state is abnormal.                |
955| 1300003  | This window manager service works abnormally. |
956| 1300004  | This operation is not accessible.             |
957
958**Example**
959```ts
960import { BusinessError } from '@kit.BasicServicesKit';
961import { image } from '@kit.ImageKit';
962
963try {
964  // This is only an example. Use getWindowProperties to obtain the window ID.
965  let windowId: number = 40;
966  let promise = window.getSnapshot(windowId);
967  promise.then((pixelMap: image.PixelMap) => {
968    console.info('Succeeded in getting snapshot window. Pixel bytes number:' + pixelMap.getPixelBytesNumber());
969    pixelMap.release();
970  }).catch((err: BusinessError) =>{
971    console.error(`Failed to get snapshot. Cause code: ${err.code}, message: ${err.message}`);
972  });
973} catch (exception) {
974  console.error(`Failed to get snapshot. Cause code: ${exception.code}, message: ${exception.message}`);
975}
976```
977
978## window.getVisibleWindowInfo<sup>12+</sup>
979
980getVisibleWindowInfo(): Promise&lt;Array&lt;WindowInfo&gt;&gt;
981
982Obtains information about visible windows on the current screen. Visible windows are windows that are not returned to the background.
983
984**System API**: This is a system API.
985
986**System capability**: SystemCapability.Window.SessionManager
987
988
989**Return value**
990
991| Type| Description|
992| ------------------- | ----------------------- |
993| Promise&lt;[WindowInfo](#windowinfo12)&gt; | Promise used to return the information about visible windows.|
994
995**Error codes**
996
997For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
998
999| ID| Error Message|
1000| ------- | ------------------------------ |
1001| 202     | Permission verification failed, non-system application uses system API. |
1002| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
1003| 1300003 | This window manager service works abnormally. |
1004
1005**Example**
1006
1007```ts
1008import { window } from '@kit.ArkUI';
1009import { BusinessError } from '@kit.BasicServicesKit';
1010
1011let promise = window.getVisibleWindowInfo();
1012promise.then((data) => {
1013  data.forEach(windowInfo=>{
1014    console.info(`left:${windowInfo.rect.left}`);
1015    console.info(`top:${windowInfo.rect.top}`);
1016    console.info(`width:${windowInfo.rect.width}`);
1017    console.info(`height:${windowInfo.rect.height}`);
1018    console.info(`windowId:${windowInfo.windowId}`);
1019    console.info(`windowStatusType:${windowInfo.windowStatusType}`);
1020    console.info(`abilityName:${windowInfo.abilityName}`);
1021    console.info(`bundleName:${windowInfo.bundleName}`);
1022  })
1023}).catch((err: BusinessError) => {
1024  console.error('Failed to getWindowInfo. Cause: ' + JSON.stringify(err));
1025});
1026```
1027
1028## Window
1029
1030Represents a window instance, which is the basic unit managed by the window manager.
1031
1032In the following API examples, you must use [getLastWindow()](js-apis-window.md#windowgetlastwindow9), [createWindow()](js-apis-window.md#windowcreatewindow9), or [findWindow()](js-apis-window.md#windowfindwindow9) to obtain a **Window** instance (named windowClass in this example) and then call a method in this instance.
1033
1034### hide<sup>7+</sup>
1035
1036hide (callback: AsyncCallback&lt;void&gt;): void
1037
1038Hides this window. This API uses an asynchronous callback to return the result. This API takes effect only for a system window or an application subwindow.
1039
1040**System API**: This is a system API.
1041
1042**System capability**: SystemCapability.WindowManager.WindowManager.Core
1043
1044**Parameters**
1045
1046| Name  | Type                     | Mandatory| Description      |
1047| -------- | ------------------------- | ---- | ---------- |
1048| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
1049
1050**Error codes**
1051
1052For details about the error codes, see [Window Error Codes](errorcode-window.md).
1053
1054| ID| Error Message|
1055| ------- | ------------------------------ |
1056| 202     | Permission verification failed. A non-system application calls a system API. |
1057| 1300002 | This window state is abnormal. |
1058
1059**Example**
1060
1061```ts
1062import { BusinessError } from '@kit.BasicServicesKit';
1063
1064windowClass.hide((err: BusinessError) => {
1065  const errCode: number = err.code;
1066  if (errCode) {
1067    console.error(`Failed to hide the window. Cause code: ${err.code}, message: ${err.message}`);
1068    return;
1069  }
1070  console.info('Succeeded in hiding the window.');
1071});
1072```
1073
1074### hide<sup>7+</sup>
1075
1076hide(): Promise&lt;void&gt;
1077
1078Hides this window. This API uses a promise to return the result. This API takes effect only for a system window or an application subwindow.
1079
1080**System API**: This is a system API.
1081
1082**System capability**: SystemCapability.WindowManager.WindowManager.Core
1083
1084**Return value**
1085
1086| Type               | Description                     |
1087| ------------------- | ------------------------- |
1088| Promise&lt;void&gt; | Promise that returns no value.|
1089
1090**Error codes**
1091
1092For details about the error codes, see [Window Error Codes](errorcode-window.md).
1093
1094| ID| Error Message|
1095| ------- | ------------------------------ |
1096| 202     | Permission verification failed. A non-system application calls a system API. |
1097| 1300002 | This window state is abnormal. |
1098
1099**Example**
1100
1101```ts
1102import { BusinessError } from '@kit.BasicServicesKit';
1103
1104let promise = windowClass.hide();
1105promise.then(() => {
1106  console.info('Succeeded in hiding the window.');
1107}).catch((err: BusinessError) => {
1108  console.error(`Failed to hide the window. Cause code: ${err.code}, message: ${err.message}`);
1109});
1110```
1111
1112### hideWithAnimation<sup>9+</sup>
1113
1114hideWithAnimation(callback: AsyncCallback&lt;void&gt;): void
1115
1116Hides this window and plays an animation during the process. This API uses an asynchronous callback to return the result. This API takes effect only for a system window.
1117
1118**System API**: This is a system API.
1119
1120**System capability**: SystemCapability.WindowManager.WindowManager.Core
1121
1122**Parameters**
1123
1124| Name  | Type                     | Mandatory| Description      |
1125| -------- | ------------------------- | ---- | ---------- |
1126| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
1127
1128**Error codes**
1129
1130For details about the error codes, see [Window Error Codes](errorcode-window.md).
1131
1132| ID| Error Message|
1133| ------- | -------------------------------------------- |
1134| 202     | Permission verification failed. A non-system application calls a system API. |
1135| 1300002 | This window state is abnormal.               |
1136| 1300003 | This window manager service works abnormally. |
1137| 1300004 | Unauthorized operation.                |
1138
1139**Example**
1140
1141```ts
1142import { BusinessError } from '@kit.BasicServicesKit';
1143
1144windowClass.hideWithAnimation((err: BusinessError) => {
1145  const errCode: number = err.code;
1146  if (errCode) {
1147    console.error(`Failed to hide the window with animation. Cause code: ${err.code}, message: ${err.message}`);
1148    return;
1149  }
1150  console.info('Succeeded in hiding the window with animation.');
1151});
1152```
1153
1154### hideWithAnimation<sup>9+</sup>
1155
1156hideWithAnimation(): Promise&lt;void&gt;
1157
1158Hides this window and plays an animation during the process. This API uses a promise to return the result. This API takes effect only for a system window.
1159
1160**System API**: This is a system API.
1161
1162**System capability**: SystemCapability.WindowManager.WindowManager.Core
1163
1164**Return value**
1165
1166| Type               | Description                     |
1167| ------------------- | ------------------------- |
1168| Promise&lt;void&gt; | Promise that returns no value.|
1169
1170**Error codes**
1171
1172For details about the error codes, see [Window Error Codes](errorcode-window.md).
1173
1174| ID| Error Message|
1175| ------- | -------------------------------------------- |
1176| 202     | Permission verification failed. A non-system application calls a system API. |
1177| 1300002 | This window state is abnormal.               |
1178| 1300003 | This window manager service works abnormally. |
1179| 1300004 | Unauthorized operation.                |
1180
1181**Example**
1182
1183```ts
1184import { BusinessError } from '@kit.BasicServicesKit';
1185
1186let promise = windowClass.hideWithAnimation();
1187promise.then(() => {
1188  console.info('Succeeded in hiding the window with animation.');
1189}).catch((err: BusinessError) => {
1190  console.error(`Failed to hide the window with animation. Cause code: ${err.code}, message: ${err.message}`);
1191});
1192```
1193
1194### showWithAnimation<sup>9+</sup>
1195
1196showWithAnimation(callback: AsyncCallback&lt;void&gt;): void
1197
1198Shows this window and plays an animation during the process. This API uses an asynchronous callback to return the result. This API takes effect only for a system window.
1199
1200**System API**: This is a system API.
1201
1202**System capability**: SystemCapability.WindowManager.WindowManager.Core
1203
1204**Parameters**
1205
1206| Name  | Type                     | Mandatory| Description      |
1207| -------- | ------------------------- | ---- | ---------- |
1208| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
1209
1210**Error codes**
1211
1212For details about the error codes, see [Window Error Codes](errorcode-window.md).
1213
1214| ID| Error Message|
1215| ------- | -------------------------------------------- |
1216| 202     | Permission verification failed. A non-system application calls a system API. |
1217| 1300002 | This window state is abnormal.               |
1218| 1300003 | This window manager service works abnormally. |
1219| 1300004 | Unauthorized operation.                |
1220
1221**Example**
1222
1223```ts
1224import { BusinessError } from '@kit.BasicServicesKit';
1225
1226windowClass.showWithAnimation((err: BusinessError) => {
1227  const errCode: number = err.code;
1228  if (errCode) {
1229    console.error(`Failed to show the window with animation. Cause code: ${err.code}, message: ${err.message}`);
1230    return;
1231  }
1232  console.info('Succeeded in showing the window with animation.');
1233});
1234```
1235
1236### showWithAnimation<sup>9+</sup>
1237
1238showWithAnimation(): Promise&lt;void&gt;
1239
1240Shows this window and plays an animation during the process. This API uses a promise to return the result. This API takes effect only for a system window.
1241
1242**System API**: This is a system API.
1243
1244**System capability**: SystemCapability.WindowManager.WindowManager.Core
1245
1246**Return value**
1247
1248| Type               | Description                     |
1249| ------------------- | ------------------------- |
1250| Promise&lt;void&gt; | Promise that returns no value.|
1251
1252**Error codes**
1253
1254For details about the error codes, see [Window Error Codes](errorcode-window.md).
1255
1256| ID| Error Message|
1257| ------- | -------------------------------------------- |
1258| 202     | Permission verification failed. A non-system application calls a system API. |
1259| 1300002 | This window state is abnormal.               |
1260| 1300003 | This window manager service works abnormally. |
1261| 1300004 | Unauthorized operation.                |
1262
1263**Example**
1264
1265```ts
1266import { BusinessError } from '@kit.BasicServicesKit';
1267
1268let promise = windowClass.showWithAnimation();
1269promise.then(() => {
1270  console.info('Succeeded in showing the window with animation.');
1271}).catch((err: BusinessError) => {
1272  console.error(`Failed to show the window with animation. Cause code: ${err.code}, message: ${err.message}`);
1273});
1274```
1275
1276### setWindowMode<sup>9+</sup>
1277
1278setWindowMode(mode: WindowMode, callback: AsyncCallback&lt;void&gt;): void
1279
1280Sets the mode of the main window. This API uses an asynchronous callback to return the result.
1281
1282**System API**: This is a system API.
1283
1284**System capability**: SystemCapability.WindowManager.WindowManager.Core
1285
1286**Parameters**
1287
1288| Name| Type| Mandatory| Description|
1289| -------- | -------------------------- | -- | --------- |
1290| mode     | [WindowMode](#windowmode7) | Yes| Window mode to set.|
1291| callback | AsyncCallback&lt;void&gt;  | Yes| Callback used to return the result.|
1292
1293**Error codes**
1294
1295For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1296
1297| ID| Error Message|
1298| ------- | -------------------------------------------- |
1299| 202     | Permission verification failed. A non-system application calls a system API. |
1300| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1301| 1300002 | This window state is abnormal.               |
1302| 1300003 | This window manager service works abnormally. |
1303
1304**Example**
1305
1306```ts
1307// EntryAbility.ets
1308import { UIAbility } from '@kit.AbilityKit';
1309import { BusinessError } from '@kit.BasicServicesKit';
1310
1311export default class EntryAbility extends UIAbility {
1312  // ...
1313  onWindowStageCreate(windowStage: window.WindowStage): void {
1314    console.info('onWindowStageCreate');
1315    let windowClass: window.Window | undefined = undefined;
1316    windowStage.getMainWindow((err: BusinessError, data) => {
1317      const errCode: number = err.code;
1318      if (errCode) {
1319        console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
1320        return;
1321      }
1322      windowClass = data;
1323      let mode = window.WindowMode.FULLSCREEN;
1324      try {
1325        windowClass.setWindowMode(mode, (err: BusinessError) => {
1326          const errCode: number = err.code;
1327          if (errCode) {
1328            console.error(`Failed to set the window mode. Cause code: ${err.code}, message: ${err.message}`);
1329            return;
1330          }
1331          console.info('Succeeded in setting the window mode.');
1332        });
1333      } catch (exception) {
1334        console.error(`Failed to set the window mode. Cause code: ${exception.code}, message: ${exception.message}`);
1335      }
1336    });
1337  }
1338}
1339```
1340
1341### setWindowMode<sup>9+</sup>
1342
1343setWindowMode(mode: WindowMode): Promise&lt;void&gt;
1344
1345Sets the mode of the main window. This API uses a promise to return the result.
1346
1347**System API**: This is a system API.
1348
1349**System capability**: SystemCapability.WindowManager.WindowManager.Core
1350
1351**Parameters**
1352
1353| Name| Type| Mandatory| Description|
1354| -------- | -------------------------- | -- | --------- |
1355| mode     | [WindowMode](#windowmode7) | Yes| Window mode to set.|
1356
1357**Return value**
1358
1359| Type| Description|
1360| ------------------- | ----------------------- |
1361| Promise&lt;void&gt; | Promise that returns no value.|
1362
1363**Error codes**
1364
1365For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1366
1367| ID| Error Message|
1368| ------- | -------------------------------------------- |
1369| 202     | Permission verification failed. A non-system application calls a system API. |
1370| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1371| 1300002 | This window state is abnormal.               |
1372| 1300003 | This window manager service works abnormally. |
1373
1374**Example**
1375
1376```ts
1377// EntryAbility.ets
1378import { UIAbility } from '@kit.AbilityKit';
1379import { BusinessError } from '@kit.BasicServicesKit';
1380
1381export default class EntryAbility extends UIAbility {
1382  // ...
1383  onWindowStageCreate(windowStage: window.WindowStage): void {
1384    console.info('onWindowStageCreate');
1385    let windowClass: window.Window | undefined = undefined;
1386    windowStage.getMainWindow((err: BusinessError, data) => {
1387      const errCode: number = err.code;
1388      if (errCode) {
1389        console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
1390        return;
1391      }
1392      windowClass = data;
1393      let mode = window.WindowMode.FULLSCREEN;
1394      try {
1395        let promise = windowClass.setWindowMode(mode);
1396        promise.then(() => {
1397          console.info('Succeeded in setting the window mode.');
1398        }).catch((err: BusinessError) => {
1399          console.error(`Failed to set the window mode. Cause code: ${err.code}, message: ${err.message}`);
1400        });
1401      } catch (exception) {
1402        console.error(`Failed to set the window mode. Cause code: ${exception.code}, message: ${exception.message}`);
1403      }
1404    });
1405  }
1406}
1407```
1408
1409### bindDialogTarget<sup>9+</sup>
1410
1411bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback&lt;void&gt;, callback: AsyncCallback&lt;void&gt;): void
1412
1413Binds 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.
1414
1415**System API**: This is a system API.
1416
1417**System capability**: SystemCapability.WindowManager.WindowManager.Core
1418
1419**Parameters**
1420
1421| Name      | Type                     | Mandatory| Description                 |
1422| ----------- | ------------------------- | ---- | -------------------- |
1423| token       | [rpc.RemoteObject](../apis-ipc-kit/js-apis-rpc.md#remoteobject) | Yes  | Token of the target window.|
1424| deathCallback | Callback&lt;void&gt;        | Yes  | Callback used to listen for modal window destruction events.|
1425| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
1426
1427**Error codes**
1428
1429For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1430
1431| ID| Error Message|
1432| ------- | -------------------------------------------- |
1433| 202     | Permission verification failed. A non-system application calls a system API. |
1434| 401     | Parameter error. Possible cause: Incorrect parameter types. |
1435| 1300002 | This window state is abnormal.               |
1436| 1300003 | This window manager service works abnormally. |
1437
1438**Example**
1439
1440```ts
1441import { rpc } from '@kit.IPCKit';
1442import { BusinessError } from '@kit.BasicServicesKit';
1443
1444class MyDeathRecipient {
1445  onRemoteDied() {
1446    console.log('server died');
1447  }
1448}
1449
1450class TestRemoteObject extends rpc.RemoteObject {
1451  constructor(descriptor: string) {
1452    super(descriptor);
1453  }
1454
1455  addDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
1456    return true;
1457  }
1458
1459  removeDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
1460    return true;
1461  }
1462
1463  isObjectDead(): boolean {
1464    return false;
1465  }
1466}
1467
1468let token: TestRemoteObject = new TestRemoteObject('testObject');
1469let windowClass: window.Window | undefined = undefined;
1470let config: window.Configuration = { name: "test", windowType: window.WindowType.TYPE_DIALOG, ctx: this.context };
1471try {
1472  window.createWindow(config, (err: BusinessError, data) => {
1473    let errCode: number = err.code;
1474    if (errCode) {
1475      console.error(`Failed to create the window. Cause code: ${err.code}, message: ${err.message}`);
1476      return;
1477    }
1478    windowClass = data;
1479  });
1480  windowClass.bindDialogTarget(token, () => {
1481    console.info('Dialog Window Need Destroy.');
1482  }, (err: BusinessError) => {
1483    let errCode: number = err.code;
1484    if (errCode) {
1485      console.error(`Failed to bind dialog target. Cause code: ${err.code}, message: ${err.message}`);
1486      return;
1487    }
1488    console.info('Succeeded in binding dialog target.');
1489  });
1490} catch (exception) {
1491  console.error(`Failed to bind dialog target. Cause code: ${exception.code}, message: ${exception.message}`);
1492}
1493```
1494
1495### bindDialogTarget<sup>9+</sup>
1496
1497bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback&lt;void&gt;): Promise&lt;void&gt;
1498
1499Binds 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.
1500
1501**System API**: This is a system API.
1502
1503**System capability**: SystemCapability.WindowManager.WindowManager.Core
1504
1505**Parameters**
1506
1507| Name      | Type                     | Mandatory| Description                 |
1508| ----------- | ------------------------- | ---- | -------------------- |
1509| token       | [rpc.RemoteObject](../apis-ipc-kit/js-apis-rpc.md#remoteobject) | Yes  | Token of the target window.|
1510| deathCallback | Callback&lt;void&gt;        | Yes  | Callback used to listen for modal window destruction events.|
1511
1512**Return value**
1513
1514| Type               | Description                     |
1515| ------------------- | ------------------------- |
1516| Promise&lt;void&gt; | Promise that returns no value.|
1517
1518**Error codes**
1519
1520For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1521
1522| ID| Error Message|
1523| ------- | -------------------------------------------- |
1524| 202     | Permission verification failed. A non-system application calls a system API. |
1525| 401     | Parameter error. Possible cause: Incorrect parameter types. |
1526| 1300002 | This window state is abnormal.               |
1527| 1300003 | This window manager service works abnormally. |
1528
1529**Example**
1530
1531```ts
1532import { rpc } from '@kit.IPCKit';
1533import { BusinessError } from '@kit.BasicServicesKit';
1534
1535class MyDeathRecipient {
1536  onRemoteDied() {
1537    console.log('server died');
1538  }
1539}
1540
1541class TestRemoteObject extends rpc.RemoteObject {
1542  constructor(descriptor: string) {
1543    super(descriptor);
1544  }
1545
1546  addDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
1547    return true;
1548  }
1549
1550  removeDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
1551    return true;
1552  }
1553
1554  isObjectDead(): boolean {
1555    return false;
1556  }
1557}
1558
1559let token: TestRemoteObject = new TestRemoteObject('testObject');
1560let windowClass: window.Window | undefined = undefined;
1561let config: window.Configuration = {
1562  name: "test",
1563  windowType: window.WindowType.TYPE_DIALOG,
1564  ctx: this.context
1565};
1566try {
1567  window.createWindow(config, (err: BusinessError, data) => {
1568    const errCode: number = err.code;
1569    if (errCode) {
1570      console.error(`Failed to create the window. Cause code: ${err.code}, message: ${err.message}`);
1571      return;
1572    }
1573    windowClass = data;
1574  });
1575  let promise = windowClass.bindDialogTarget(token, () => {
1576    console.info('Dialog Window Need Destroy.');
1577  });
1578  promise.then(() => {
1579    console.info('Succeeded in binding dialog target.');
1580  }).catch((err: BusinessError) => {
1581    console.error(`Failed to bind dialog target. Cause code: ${err.code}, message: ${err.message}`);
1582  });
1583} catch (exception) {
1584  console.error(`Failed to bind dialog target. Cause code: ${exception.code}, message: ${exception.message}`);
1585}
1586```
1587
1588### bindDialogTarget<sup>9+</sup>
1589
1590bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback&lt;void&gt;, callback: AsyncCallback&lt;void&gt;): void
1591
1592Binds 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.
1593
1594**System API**: This is a system API.
1595
1596**System capability**: SystemCapability.WindowManager.WindowManager.Core
1597
1598**Parameters**
1599
1600| Name      | Type                     | Mandatory| Description                 |
1601| ----------- | ------------------------- | ---- | -------------------- |
1602| requestInfo | [dialogRequest.RequestInfo](../apis-ability-kit/js-apis-app-ability-dialogRequest.md#requestinfo) | Yes  | **RequestInfo** of the target window.|
1603| deathCallback | Callback&lt;void&gt;    | Yes  | Callback used to listen for modal window destruction events.|
1604| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
1605
1606**Error codes**
1607
1608For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1609
1610| ID| Error Message|
1611| ------- | -------------------------------------------- |
1612| 202     | Permission verification failed. A non-system application calls a system API. |
1613| 401     | Parameter error. Possible cause: Incorrect parameter types. |
1614| 1300002 | This window state is abnormal.               |
1615| 1300003 | This window manager service works abnormally. |
1616
1617**Example**
1618
1619```ts
1620import { dialogRequest, Want, ServiceExtensionAbility } from '@kit.AbilityKit';
1621import { BusinessError } from '@kit.BasicServicesKit';
1622
1623export default class ServiceExtAbility extends ServiceExtensionAbility {
1624  onRequest(want: Want, startId: number) {
1625    console.info('onRequest');
1626    let windowClass: window.Window | undefined = undefined;
1627    let config: window.Configuration = {
1628      name: "test", windowType: window.WindowType.TYPE_DIALOG, ctx: this.context
1629    };
1630    try {
1631      window.createWindow(config, (err: BusinessError, data) => {
1632        let errCode: number = err.code;
1633        if (errCode) {
1634          console.error(`Failed to create the window. Cause code: ${err.code}, message: ${err.message}`);
1635          return;
1636        }
1637        windowClass = data;
1638      });
1639      let requestInfo = dialogRequest.getRequestInfo(want)
1640      windowClass.bindDialogTarget(requestInfo, () => {
1641        console.info('Dialog Window Need Destroy.');
1642      }, (err: BusinessError) => {
1643        let errCode: number = err.code;
1644        if (errCode) {
1645          console.error(`Failed to bind dialog target. Cause code: ${err.code}, message: ${err.message}`);
1646          return;
1647        }
1648        console.info('Succeeded in binding dialog target.');
1649      });
1650    } catch (err) {
1651      console.error(`Failed to bind dialog target. Cause code: ${err.code}, message: ${err.message}`)
1652    }
1653  }
1654}
1655```
1656
1657### bindDialogTarget<sup>9+</sup>
1658
1659bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback&lt;void&gt;): Promise&lt;void&gt;
1660
1661Binds 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.
1662
1663**System API**: This is a system API.
1664
1665**System capability**: SystemCapability.WindowManager.WindowManager.Core
1666
1667**Parameters**
1668
1669| Name      | Type                     | Mandatory| Description                 |
1670| ----------- | ------------------------- | ---- | -------------------- |
1671| requestInfo | [dialogRequest.RequestInfo](../apis-ability-kit/js-apis-app-ability-dialogRequest.md#requestinfo) | Yes  | **RequestInfo** of the target window.|
1672| deathCallback | Callback&lt;void&gt;    | Yes  | Callback used to listen for modal window destruction events.|
1673
1674**Return value**
1675
1676| Type               | Description                     |
1677| ------------------- | ------------------------- |
1678| Promise&lt;void&gt; | Promise that returns no value.|
1679
1680**Error codes**
1681
1682For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1683
1684| ID| Error Message|
1685| ------- | -------------------------------------------- |
1686| 202     | Permission verification failed. A non-system application calls a system API. |
1687| 401     | Parameter error. Possible cause: Incorrect parameter types. |
1688| 1300002 | This window state is abnormal.               |
1689| 1300003 | This window manager service works abnormally. |
1690
1691**Example**
1692
1693```ts
1694import { dialogRequest, Want, ServiceExtensionAbility } from '@kit.AbilityKit';
1695import { BusinessError } from '@kit.BasicServicesKit';
1696
1697export default class ServiceExtAbility extends ServiceExtensionAbility {
1698  onRequest(want: Want, startId: number) {
1699    console.info('onRequest');
1700    let windowClass: window.Window | undefined = undefined;
1701    let config: window.Configuration = {
1702      name: "test", windowType: window.WindowType.TYPE_DIALOG, ctx: this.context
1703    };
1704    try {
1705      window.createWindow(config, (err: BusinessError, data) => {
1706        const errCode: number = err.code;
1707        if (errCode) {
1708          console.error(`Failed to create the window. Cause code: ${err.code}, message: ${err.message}`);
1709          return;
1710        }
1711        windowClass = data;
1712      });
1713      let requestInfo = dialogRequest.getRequestInfo(want)
1714      let promise = windowClass.bindDialogTarget(requestInfo, () => {
1715        console.info('Dialog Window Need Destroy.');
1716      });
1717      promise.then(() => {
1718        console.info('Succeeded in binding dialog target.');
1719      }).catch((err: BusinessError) => {
1720        console.error(`Failed to bind dialog target. Cause code: ${err.code}, message: ${err.message}`);
1721      });
1722    } catch (err) {
1723      console.error(`Failed to bind dialog target. Cause code: ${err.code}, message: ${err.message}`)
1724    }
1725  }
1726}
1727```
1728
1729### setWakeUpScreen<sup>9+</sup>
1730
1731setWakeUpScreen(wakeUp: boolean): void
1732
1733Wakes up the screen.
1734
1735**System API**: This is a system API.
1736
1737**System capability**: SystemCapability.WindowManager.WindowManager.Core
1738
1739**Parameters**
1740
1741| Name          | Type   | Mandatory| Description                        |
1742| ---------------- | ------- | ---- | ---------------------------- |
1743| wakeUp           | boolean | Yes  | Whether to wake up the screen. The value **true** means to wake up the screen, and **false** means the opposite. |
1744
1745**Error codes**
1746
1747For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1748
1749| ID| Error Message|
1750| ------- | -------------------------------------------- |
1751| 202     | Permission verification failed. A non-system application calls a system API. |
1752| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
1753| 1300002 | This window state is abnormal.               |
1754| 1300003 | This window manager service works abnormally. |
1755
1756**Example**
1757
1758```ts
1759let wakeUp: boolean = true;
1760try {
1761  windowClass.setWakeUpScreen(wakeUp);
1762} catch (exception) {
1763  console.error(`Failed to wake up the screen. Cause code: ${exception.code}, message: ${exception.message}`);
1764}
1765```
1766
1767### setSnapshotSkip<sup>9+</sup>
1768setSnapshotSkip(isSkip: boolean): void
1769
1770Sets whether to ignore this window during screen capturing or recording. This API is generally used in scenarios where screen capture or recording is disabled.
1771
1772**System API**: This is a system API.
1773
1774**System capability**: SystemCapability.WindowManager.WindowManager.Core
1775
1776**Parameters**
1777
1778| Name       | Type   | Mandatory| Description                |
1779| ------------- | ------- | ---- | -------------------- |
1780| 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>|
1781
1782**Error codes**
1783
1784For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1785
1786| ID| Error Message|
1787| ------- | ------------------------------ |
1788| 202     | Permission verification failed. A non-system application calls a system API. |
1789| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
1790| 1300002 | This window state is abnormal. |
1791
1792```ts
1793let isSkip: boolean = true;
1794try {
1795  windowClass.setSnapshotSkip(isSkip);
1796} catch (exception) {
1797  console.error(`Failed to Skip. Cause code: ${exception.code}, message: ${exception.message}`);
1798}
1799```
1800
1801### setForbidSplitMove<sup>9+</sup>
1802
1803setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback&lt;void&gt;): void
1804
1805Sets whether the main window is forbidden to move in split-screen mode. This API uses an asynchronous callback to return the result.
1806
1807**System API**: This is a system API.
1808
1809**System capability**: SystemCapability.WindowManager.WindowManager.Core
1810
1811**Parameters**
1812
1813| Name     | Type                     | Mandatory| Description                |
1814| ----------- | ------------------------- | ---- | -------------------- |
1815| 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.|
1816| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
1817
1818**Error codes**
1819
1820For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1821
1822| ID| Error Message|
1823| ------- | -------------------------------------------- |
1824| 202     | Permission verification failed. A non-system application calls a system API. |
1825| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
1826| 1300002 | This window state is abnormal.               |
1827| 1300003 | This window manager service works abnormally. |
1828
1829**Example**
1830
1831```ts
1832// EntryAbility.ets
1833import { UIAbility } from '@kit.AbilityKit';
1834import { BusinessError } from '@kit.BasicServicesKit';
1835
1836export default class EntryAbility extends UIAbility {
1837  // ...
1838  onWindowStageCreate(windowStage: window.WindowStage): void {
1839    console.info('onWindowStageCreate');
1840    let windowClass: window.Window | undefined = undefined;
1841    windowStage.getMainWindow((err: BusinessError, data) => {
1842      const errCode: number = err.code;
1843      if (errCode) {
1844        console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
1845        return;
1846      }
1847      windowClass = data;
1848      let isForbidSplitMove: boolean = true;
1849      try {
1850        windowClass.setForbidSplitMove(isForbidSplitMove, (err: BusinessError) => {
1851          const errCode: number = err.code;
1852          if (errCode) {
1853            console.error(`Failed to forbid window moving in split screen mode. Cause code: ${err.code}, message: ${err.message}`);
1854            return;
1855          }
1856          console.info('Succeeded in forbidding window moving in split screen mode.');
1857        });
1858      } catch (exception) {
1859        console.error(`Failed to forbid window moving in split screen mode. Cause code: ${exception.code}, message: ${exception.message}`);
1860      }
1861    });
1862  }
1863}
1864```
1865
1866### setForbidSplitMove<sup>9+</sup>
1867
1868setForbidSplitMove(isForbidSplitMove: boolean): Promise&lt;void&gt;
1869
1870Sets whether the main window is forbidden to move in split-screen mode. This API uses a promise to return the result.
1871
1872**System API**: This is a system API.
1873
1874**System capability**: SystemCapability.WindowManager.WindowManager.Core
1875
1876**Parameters**
1877
1878| Name     | Type   | Mandatory| Description                |
1879| ----------- | ------- | ---- | -------------------- |
1880| 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.|
1881
1882**Return value**
1883
1884| Type               | Description                     |
1885| ------------------- | ------------------------- |
1886| Promise&lt;void&gt; | Promise that returns no value.|
1887
1888**Error codes**
1889
1890For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1891
1892| ID| Error Message|
1893| ------- | -------------------------------------------- |
1894| 202     | Permission verification failed. A non-system application calls a system API. |
1895| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
1896| 1300002 | This window state is abnormal.               |
1897| 1300003 | This window manager service works abnormally. |
1898
1899**Example**
1900
1901```ts
1902// EntryAbility.ets
1903import { UIAbility } from '@kit.AbilityKit';
1904import { BusinessError } from '@kit.BasicServicesKit';
1905
1906export default class EntryAbility extends UIAbility {
1907  // ...
1908  onWindowStageCreate(windowStage: window.WindowStage): void {
1909    console.info('onWindowStageCreate');
1910    let windowClass: window.Window | undefined = undefined;
1911    windowStage.getMainWindow((err: BusinessError, data) => {
1912      const errCode: number = err.code;
1913      if (errCode) {
1914        console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
1915        return;
1916      }
1917      windowClass = data;
1918      let isForbidSplitMove: boolean = true;
1919      try {
1920        let promise = windowClass.setForbidSplitMove(isForbidSplitMove);
1921        promise.then(() => {
1922          console.info('Succeeded in forbidding window moving in split screen mode.');
1923        }).catch((err: BusinessError) => {
1924          console.error(`Failed to forbid window moving in split screen mode. Cause code: ${err.code}, message: ${err.message}`);
1925        });
1926      } catch (exception) {
1927        console.error(`Failed to forbid window moving in split screen mode. Cause code: ${exception.code}, message: ${exception.message}`);
1928      }
1929    });
1930  }
1931}
1932```
1933
1934### opacity<sup>9+</sup>
1935
1936opacity(opacity: number): void
1937
1938Sets the opacity for this window. This API can be used only when you [customize an animation to be played during the display or hiding of a system window](../../windowmanager/system-window-stage.md#customizing-an-animation-to-be-played-during-the-display-or-hiding-of-a-system-window).
1939
1940**System API**: This is a system API.
1941
1942**System capability**: SystemCapability.WindowManager.WindowManager.Core
1943
1944**Parameters**
1945
1946| Name | Type  | Mandatory| Description                                                |
1947| ------- | ------ | ---- |----------------------------------------------------|
1948| opacity | number | Yes  | Opacity. The value is a floating point number in the range [0.0, 1.0]. The value **0.0** means completely transparent, and **1.0** means completely opaque.|
1949
1950**Error codes**
1951
1952For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1953
1954| ID| Error Message|
1955| ------- | ------------------------------ |
1956| 202     | Permission verification failed. A non-system application calls a system API. |
1957| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1958| 1300002 | This window state is abnormal. |
1959| 1300004 | Unauthorized operation.  |
1960
1961**Example**
1962
1963```ts
1964try {
1965  windowClass.opacity(0.5);
1966} catch (exception) {
1967  console.error(`Failed to opacity. Cause code: ${exception.code}, message: ${exception.message}`);
1968}
1969```
1970
1971### scale<sup>9+</sup>
1972
1973scale(scaleOptions: ScaleOptions): void
1974
1975Sets the scale parameters for this window. This API can be used only when you [customize an animation to be played during the display or hiding of a system window](../../windowmanager/system-window-stage.md#customizing-an-animation-to-be-played-during-the-display-or-hiding-of-a-system-window).
1976
1977**System API**: This is a system API.
1978
1979**System capability**: SystemCapability.WindowManager.WindowManager.Core
1980
1981**Parameters**
1982
1983| Name      | Type                          | Mandatory| Description      |
1984| ------------ | ------------------------------ | ---- | ---------- |
1985| scaleOptions | [ScaleOptions](#scaleoptions9) | Yes  | Scale parameters to set.|
1986
1987**Error codes**
1988
1989For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
1990
1991| ID| Error Message|
1992| ------- | ------------------------------ |
1993| 202     | Permission verification failed. A non-system application calls a system API. |
1994| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1995| 1300002 | This window state is abnormal. |
1996| 1300004 | Unauthorized operation.  |
1997
1998**Example**
1999
2000```ts
2001let obj: window.ScaleOptions = {
2002  x: 2.0,
2003  y: 1.0,
2004  pivotX: 0.5,
2005  pivotY: 0.5
2006};
2007try {
2008  windowClass.scale(obj);
2009} catch (exception) {
2010  console.error(`Failed to scale. Cause code: ${exception.code}, message: ${exception.message}`);
2011}
2012```
2013
2014### rotate<sup>9+</sup>
2015
2016rotate(rotateOptions: RotateOptions): void
2017
2018Sets the rotation parameters for this window. This API can be used only when you [customize an animation to be played during the display or hiding of a system window](../../windowmanager/system-window-stage.md#customizing-an-animation-to-be-played-during-the-display-or-hiding-of-a-system-window).
2019
2020**System API**: This is a system API.
2021
2022**System capability**: SystemCapability.WindowManager.WindowManager.Core
2023
2024**Parameters**
2025
2026| Name       | Type                            | Mandatory| Description      |
2027| ------------- | -------------------------------- | ---- | ---------- |
2028| rotateOptions | [RotateOptions](#rotateoptions9) | Yes  | Rotation parameters to set.|
2029
2030**Error codes**
2031
2032For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2033
2034| ID| Error Message|
2035| ------- | ------------------------------ |
2036| 202     | Permission verification failed. A non-system application calls a system API. |
2037| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2038| 1300002 | This window state is abnormal. |
2039| 1300004 | Unauthorized operation.  |
2040
2041**Example**
2042
2043```ts
2044let obj: window.RotateOptions = {
2045  x: 1.0,
2046  y: 1.0,
2047  z: 45.0,
2048  pivotX: 0.5,
2049  pivotY: 0.5
2050};
2051try {
2052  windowClass.rotate(obj);
2053} catch (exception) {
2054  console.error(`Failed to rotate. Cause code: ${exception.code}, message: ${exception.message}`);
2055}
2056```
2057
2058### translate<sup>9+</sup>
2059
2060translate(translateOptions: TranslateOptions): void
2061
2062Sets the translation parameters for this window. This API can be used only when you [customize an animation to be played during the display or hiding of a system window](../../windowmanager/system-window-stage.md#customizing-an-animation-to-be-played-during-the-display-or-hiding-of-a-system-window).
2063
2064**System API**: This is a system API.
2065
2066**System capability**: SystemCapability.WindowManager.WindowManager.Core
2067
2068**Parameters**
2069
2070| Name          | Type                                  | Mandatory| Description                |
2071| ---------------- | -------------------------------------- | ---- | -------------------- |
2072| translateOptions | [TranslateOptions](#translateoptions9) | Yes  | Translation parameters. The unit is px.|
2073
2074**Error codes**
2075
2076For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2077
2078| ID| Error Message|
2079| ------- | ------------------------------ |
2080| 202     | Permission verification failed. A non-system application calls a system API. |
2081| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2082| 1300002 | This window state is abnormal. |
2083| 1300004 | Unauthorized operation.  |
2084
2085**Example**
2086
2087```ts
2088let obj: window.TranslateOptions = {
2089  x: 100.0,
2090  y: 0.0,
2091  z: 0.0
2092};
2093try {
2094  windowClass.translate(obj);
2095} catch (exception) {
2096  console.error(`Failed to translate. Cause code: ${exception.code}, message: ${exception.message}`);
2097}
2098```
2099
2100### getTransitionController<sup>9+</sup>
2101
2102 getTransitionController(): TransitionController
2103
2104Obtains the transition animation controller.
2105
2106**System API**: This is a system API.
2107
2108**System capability**: SystemCapability.WindowManager.WindowManager.Core
2109
2110**Return value**
2111
2112| Type                                          | Description            |
2113| ---------------------------------------------- | ---------------- |
2114| [TransitionController](#transitioncontroller9) | Transition animation controller.|
2115
2116**Error codes**
2117
2118For details about the error codes, see [Window Error Codes](errorcode-window.md).
2119
2120| ID| Error Message|
2121| ------- | ------------------------------ |
2122| 202     | Permission verification failed. A non-system application calls a system API. |
2123| 1300002 | This window state is abnormal. |
2124| 1300004 | Unauthorized operation.  |
2125
2126**Example**
2127
2128```ts
2129let controller = windowClass.getTransitionController(); // Obtain the transition animation controller.
2130```
2131
2132### setBlur<sup>9+</sup>
2133
2134setBlur(radius: number): void
2135
2136Blurs this window.
2137
2138**System API**: This is a system API.
2139
2140**System capability**: SystemCapability.WindowManager.WindowManager.Core
2141
2142**Parameters**
2143
2144| Name| Type  | Mandatory| Description                                              |
2145| ------ | ------ | ---- |--------------------------------------------------|
2146| radius | number | Yes  | Radius of the blur. The value is a floating point number greater than or equal to 0.0, in px. The value **0.0** means that the blur is disabled for the window.|
2147
2148**Error codes**
2149
2150For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2151
2152| ID| Error Message|
2153| ------- | ------------------------------ |
2154| 202     | Permission verification failed. A non-system application calls a system API. |
2155| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2156| 1300002 | This window state is abnormal. |
2157| 1300004 | Unauthorized operation.  |
2158
2159**Example**
2160
2161```ts
2162try {
2163  windowClass.setBlur(4.0);
2164} catch (exception) {
2165  console.error(`Failed to set blur. Cause code: ${exception.code}, message: ${exception.message}`);
2166}
2167```
2168
2169### setBackdropBlur<sup>9+</sup>
2170
2171setBackdropBlur(radius: number): void
2172
2173Blurs the background of this window.
2174
2175The window background refers to the lower-layer area covered by the window, which is the same as the window size.
2176
2177To make the blur effect visible, you must set the window background transparent by calling [setWindowBackgroundColor](js-apis-window.md#setwindowbackgroundcolor9).
2178
2179**System API**: This is a system API.
2180
2181**System capability**: SystemCapability.WindowManager.WindowManager.Core
2182
2183**Parameters**
2184
2185| Name| Type  | Mandatory| Description                                                   |
2186| ------ | ------ | ---- |-------------------------------------------------------|
2187| radius | number | Yes  | Radius of the blur. The value is a floating point number greater than or equal to 0.0, in px. The value **0.0** means that the blur is disabled for the background of the window.|
2188
2189**Error codes**
2190
2191For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2192
2193| ID| Error Message|
2194| ------- | ------------------------------ |
2195| 202     | Permission verification failed. A non-system application calls a system API. |
2196| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2197| 1300002 | This window state is abnormal. |
2198| 1300004 | Unauthorized operation.  |
2199
2200**Example**
2201
2202```ts
2203try {
2204  windowClass.setWindowBackgroundColor('#00FFFFFF');
2205  windowClass.setBackdropBlur(4.0);
2206} catch (exception) {
2207  console.error(`Failed to set backdrop blur. Cause code: ${exception.code}, message: ${exception.message}`);
2208}
2209```
2210
2211### setBackdropBlurStyle<sup>9+</sup>
2212
2213setBackdropBlurStyle(blurStyle: BlurStyle): void
2214
2215Sets the blur style for the background of this window.
2216
2217**System API**: This is a system API.
2218
2219**System capability**: SystemCapability.WindowManager.WindowManager.Core
2220
2221**Parameters**
2222
2223| Name   | Type     | Mandatory| Description                  |
2224| --------- | --------- | ---- | ---------------------- |
2225| blurStyle | [BlurStyle](#blurstyle9) | Yes  | Blur style to set for the background of the window.|
2226
2227**Error codes**
2228
2229For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2230
2231| ID| Error Message|
2232| ------- | ------------------------------ |
2233| 202     | Permission verification failed. A non-system application calls a system API. |
2234| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2235| 1300002 | This window state is abnormal. |
2236| 1300004 | Unauthorized operation.  |
2237
2238**Example**
2239
2240```ts
2241try {
2242  windowClass.setBackdropBlurStyle(window.BlurStyle.THIN);
2243} catch (exception) {
2244  console.error(`Failed to set backdrop blur style. Cause code: ${exception.code}, message: ${exception.message}`);
2245}
2246```
2247
2248### setShadow<sup>9+</sup>
2249
2250setShadow(radius: number, color?: string, offsetX?: number, offsetY?: number): void
2251
2252Sets the shadow for the window borders.
2253
2254**System API**: This is a system API.
2255
2256**System capability**: SystemCapability.WindowManager.WindowManager.Core
2257
2258**Parameters**
2259
2260| Name | Type  | Mandatory| Description                                                         |
2261| ------- | ------ | ---- |-------------------------------------------------------------|
2262| radius  | number | Yes  | Radius of the shadow. The value is a floating point number greater than or equal to 0.0, in px. The value **0.0** means that the shadow is disabled for the window borders.    |
2263| color   | string | No  | Color of the shadow. The value is a hexadecimal RGB or ARGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
2264| offsetX | number | No  | Offset of the shadow along the x-axis, in px. The value is a floating point number.                             |
2265| offsetY | number | No  | Offset of the shadow along the y-axis, in px. The value is a floating point number.                             |
2266
2267**Error codes**
2268
2269For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2270
2271| ID| Error Message|
2272| ------- | ------------------------------ |
2273| 202     | Permission verification failed. A non-system application calls a system API. |
2274| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2275| 1300002 | This window state is abnormal. |
2276| 1300004 | Unauthorized operation.  |
2277
2278**Example**
2279
2280```ts
2281try {
2282  windowClass.setShadow(4.0, '#FF00FF00', 2, 3);
2283} catch (exception) {
2284  console.error(`Failed to set shadow. Cause code: ${exception.code}, message: ${exception.message}`);
2285}
2286```
2287
2288### setCornerRadius<sup>9+</sup>
2289
2290setCornerRadius(cornerRadius: number): void
2291
2292Sets the radius of the rounded corners for this window.
2293
2294**System API**: This is a system API.
2295
2296**System capability**: SystemCapability.WindowManager.WindowManager.Core
2297
2298**Parameters**
2299
2300| Name     | Type   | Mandatory| Description                                                |
2301| ----------- | ------- | ---- |----------------------------------------------------|
2302| cornerRadius | number | Yes  | Radius of the rounded corners. The value is a floating point number greater than or equal to 0.0, in px. The value **0.0** means that the window does not use rounded corners.|
2303
2304**Error codes**
2305
2306For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2307
2308| ID| Error Message|
2309| ------- | ------------------------------ |
2310| 202     | Permission verification failed. A non-system application calls a system API. |
2311| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
2312| 1300002 | This window state is abnormal. |
2313| 1300004 | Unauthorized operation.  |
2314
2315**Example**
2316
2317```ts
2318try {
2319  windowClass.setCornerRadius(4.0);
2320} catch (exception) {
2321  console.error(`Failed to set corner radius. Cause code: ${exception.code}, message: ${exception.message}`);
2322}
2323```
2324
2325### setTouchableAreas<sup>12+</sup>
2326
2327setTouchableAreas(rects: Array&lt;Rect&gt;): void
2328
2329Sets the touchable areas for this window. By default, the entire window is touchable. If a touchable area is set, touch events outside this area are transparently transmitted. The setting becomes invalid after the window rectangle changes.
2330
2331**System API**: This is a system API.
2332
2333**System capability**: SystemCapability.Window.SessionManager
2334
2335**Parameters**
2336
2337| Name  | Type                     | Mandatory| Description      |
2338| -------- | ------------------------- | ---- | ---------- |
2339| rects | Array<[Rect](js-apis-window.md#rect7)> | Yes  | Touchable areas. The maximum number of touchable areas cannot exceed 10, and each touchable area cannot exceed the window area.|
2340
2341**Error codes**
2342
2343For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2344
2345| ID| Error Message|
2346| ------- | ------------------------------ |
2347| 202     | Permission verification failed. A non-system application calls a system API. |
2348| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
2349| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
2350| 1300002 | This window state is abnormal.                |
2351| 1300003 | This window manager service works abnormally. |                       |
2352
2353**Example**
2354
2355```ts
2356try {
2357  windowClass.setTouchableAreas([{left: 100, top: 100, width: 200, height:200},
2358    {left: 400, top: 100, width: 200, height:200}]);
2359} catch (exception) {
2360  console.error(`Failed to set touchable areas. Cause code: ${exception.code}, message: ${exception.message}`);
2361}
2362```
2363
2364### raiseToAppTop<sup>10+</sup>
2365
2366raiseToAppTop(callback: AsyncCallback&lt;void&gt;): void
2367
2368Raises the application subwindow to the top layer of the application. This API uses an asynchronous callback to return the result.
2369
2370**System API**: This is a system API.
2371
2372**System capability**: SystemCapability.WindowManager.WindowManager.Core
2373
2374**Parameters**
2375
2376| Name  | Type                     | Mandatory| Description      |
2377| -------- | ------------------------- | ---- | ---------- |
2378| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
2379
2380**Error codes**
2381
2382For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2383
2384| ID| Error Message|
2385| ------- | ------------------------------ |
2386| 202     | Permission verification failed. A non-system application calls a system API. |
2387| 1300002 | This window state is abnormal. |
2388| 1300003 | This window manager service works abnormally. |
2389| 1300004 | Unauthorized operation. |
2390| 1300009 | The parent window is invalid. |
2391
2392**Example**
2393
2394```ts
2395import { BusinessError } from '@kit.BasicServicesKit';
2396
2397windowClass.raiseToAppTop((err: BusinessError) => {
2398  const errCode: number = err.code;
2399  if (errCode) {
2400    console.error(`Failed to raise the window to app top. Cause code: ${err.code}, message: ${err.message}`);
2401    return;
2402  }
2403  console.info('Succeeded in raising the window to app top.');
2404});
2405```
2406
2407### raiseToAppTop<sup>10+</sup>
2408
2409raiseToAppTop(): Promise&lt;void&gt;
2410
2411Raises the application subwindow to the top layer of the application. This API uses a promise to return the result.
2412
2413**System API**: This is a system API.
2414
2415**System capability**: SystemCapability.WindowManager.WindowManager.Core
2416
2417**Return value**
2418
2419| Type               | Description                     |
2420| ------------------- | ------------------------- |
2421| Promise&lt;void&gt; | Promise that returns no value.|
2422
2423**Error codes**
2424
2425For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2426
2427| ID| Error Message|
2428| ------- | ------------------------------ |
2429| 202     | Permission verification failed. A non-system application calls a system API. |
2430| 1300002 | This window state is abnormal. |
2431| 1300003 | This window manager service works abnormally. |
2432| 1300004 | Unauthorized operation. |
2433| 1300009 | The parent window is invalid. |
2434
2435**Example**
2436
2437```ts
2438import { BusinessError } from '@kit.BasicServicesKit';
2439
2440let promise = windowClass.raiseToAppTop();
2441promise.then(() => {
2442  console.info('Succeeded in raising the window to app top.');
2443}).catch((err: BusinessError) => {
2444  console.error(`Failed to raise the window to app top. Cause code: ${err.code}, message: ${err.message}`);
2445});
2446```
2447
2448### setWaterMarkFlag<sup>10+</sup>
2449
2450setWaterMarkFlag(enable: boolean): Promise&lt;void&gt;
2451
2452Adds or deletes the watermark flag for this window. This API uses a promise to return the result.
2453
2454**System API**: This is a system API.
2455
2456**System capability**: SystemCapability.WindowManager.WindowManager.Core
2457
2458**Parameters**
2459
2460| Name| Type    | Mandatory| Description                                           |
2461| ------ | ------- | --- | ------------------------------------------------ |
2462| enable | boolean | Yes  | Whether to add or delete the flag. The value **true** means to add the flag and **false** means to delete the flag.|
2463
2464**Return value**
2465
2466| Type               | Description                     |
2467| ------------------- | ------------------------- |
2468| Promise&lt;void&gt; | Promise that returns no value.|
2469
2470**Error codes**
2471
2472For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2473
2474| ID| Error Message|
2475| ------- | ---------------------------------------------- |
2476| 202     | Permission verification failed. A non-system application calls a system API. |
2477| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
2478| 1300002 | This window state is abnormal.                 |
2479| 1300003 | This window manager service works abnormally.  |
2480| 1300008 | The display device is abnormal.           |
2481
2482**Example**
2483
2484```ts
2485import { BusinessError } from '@kit.BasicServicesKit';
2486
2487try {
2488  let enable = true;
2489  let promise = windowClass.setWaterMarkFlag(enable);
2490  promise.then(() => {
2491    console.info('Succeeded in setting water mark flag of window.');
2492  }).catch((err: BusinessError) => {
2493    console.error(`Failed to set water mark flag of window. Cause code: ${err.code}, message: ${err.message}`);
2494  });
2495} catch (exception) {
2496  console.error(`Failed to set water mark flag of window. Cause code: ${exception.code}, message: ${exception.message}`);
2497}
2498```
2499
2500### setWaterMarkFlag<sup>10+</sup>
2501
2502setWaterMarkFlag(enable: boolean, callback: AsyncCallback&lt;void&gt;): void
2503
2504Adds or deletes the watermark flag for this window. This API uses an asynchronous callback to return the result.
2505
2506**System API**: This is a system API.
2507
2508**System capability**: SystemCapability.WindowManager.WindowManager.Core
2509
2510**Parameters**
2511
2512| Name  | Type                      | Mandatory| Description                                             |
2513| -------- | ------------------------- | ---  | ----------------------------------------------- |
2514| enable   | boolean                   | Yes  | Whether to add or delete the flag. The value **true** means to add the flag and **false** means to delete the flag.|
2515| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
2516
2517**Error codes**
2518
2519For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2520
2521| ID| Error Message|
2522| ------- | ---------------------------------------------- |
2523| 202     | Permission verification failed. A non-system application calls a system API. |
2524| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
2525| 1300002 | This window state is abnormal.                 |
2526| 1300003 | This window manager service works abnormally.  |
2527| 1300008 | The display device is abnormal.           |
2528
2529**Example**
2530
2531```ts
2532import { BusinessError } from '@kit.BasicServicesKit';
2533
2534try {
2535  let enable: boolean = true;
2536  windowClass.setWaterMarkFlag(enable, (err: BusinessError) => {
2537    const errCode: number = err.code;
2538    if (errCode) {
2539      console.error(`Failed to set water mark flag of window. Cause code: ${err.code}, message: ${err.message}`);
2540      return;
2541    }
2542    console.info('Succeeded in setting water mark flag of window.');
2543  });
2544} catch (exception) {
2545  console.error(`Failed to set water mark flag of window. Cause code: ${exception.code}, message: ${exception.message}`);
2546}
2547```
2548
2549### setHandwritingFlag<sup>12+</sup>
2550
2551setHandwritingFlag(enable: boolean): Promise&lt;void&gt;
2552
2553Adds or deletes the handwriting flag for this window. After this flag is added, the window responds to stylus events but not touch events. This API uses a promise to return the result.
2554
2555**System API**: This is a system API.
2556
2557**System capability**: SystemCapability.Window.SessionManager
2558
2559**Parameters**
2560
2561| Name| Type    | Mandatory| Description                                           |
2562| ------ | ------- | --- | ------------------------------------------------ |
2563| enable | boolean | Yes  | Whether to add or delete the flag. The value **true** means to add the flag and **false** means to delete the flag.|
2564
2565**Return value**
2566
2567| Type               | Description                     |
2568| ------------------- | ------------------------- |
2569| Promise&lt;void&gt; | Promise that returns no value.|
2570
2571**Error codes**
2572
2573For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2574
2575| ID| Error Message|
2576| ------- | -------------------------------------------- |
2577| 202     | Permission verification failed. A non-system application calls a system API. |
2578| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
2579| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
2580| 1300002 | This window state is abnormal.                 |
2581| 1300003 | This window manager service works abnormally.  |
2582
2583**Example**
2584
2585```ts
2586import { BusinessError } from '@kit.BasicServicesKit';
2587
2588try {
2589  let enable = true;
2590  let promise = windowClass.setHandwritingFlag(enable);
2591  promise.then(() => {
2592    console.info('Succeeded in setting handwriting flag of window.');
2593  }).catch((err: BusinessError) => {
2594    console.error(`Failed to set handwriting flag of window. Cause code: ${err.code}, message: ${err.message}`);
2595  });
2596} catch (exception) {
2597  console.error(`Failed to set handwriting flag of window. Cause code: ${exception.code}, message: ${exception.message}`);
2598}
2599```
2600
2601### raiseAboveTarget<sup>10+</sup>
2602
2603raiseAboveTarget(windowId: number, callback: AsyncCallback&lt;void&gt;): void
2604
2605Raises a subwindow above a target subwindow. This API uses an asynchronous callback to return the result.
2606
2607**System API**: This is a system API.
2608
2609**System capability**: SystemCapability.Window.SessionManager
2610
2611**Parameters**
2612
2613| Name  | Type                     | Mandatory| Description      |
2614| -------- | ------------------------- | ---- | ---------- |
2615| windowId | number                    | Yes  | ID of the target subwindow, which is the value of **properties.id** in [properties](js-apis-window.md#windowproperties) obtained through [getWindowProperties](js-apis-window.md#getwindowproperties9).|
2616| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
2617
2618**Error codes**
2619
2620For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2621
2622| ID| Error Message|
2623| ------- | ---------------------------------------------- |
2624| 202     | Permission verification failed. A non-system application calls a system API. |
2625| 401     | Parameter error. Possible cause: Mandatory parameters are left unspecified. |
2626| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
2627| 1300002 | This window state is abnormal. |
2628| 1300003 | This window manager service works abnormally. |
2629| 1300004 | Unauthorized operation. |
2630| 1300009 | The parent window is invalid. |
2631
2632**Example**
2633
2634```ts
2635// EntryAbility.ets
2636import { UIAbility } from '@kit.AbilityKit';
2637import { BusinessError } from '@kit.BasicServicesKit';
2638
2639export default class EntryAbility extends UIAbility {
2640  // ...
2641  onWindowStageCreate(windowStage: window.WindowStage): void {
2642    console.info('onWindowStageCreate');
2643    let windowClass: window.Window | undefined = undefined;
2644    // Create a subwindow.
2645    try {
2646      let subWindow = windowStage.createSubWindow("testSubWindow");
2647      subWindow.then((data) => {
2648        if (data == null) {
2649          console.error("Failed to create the subWindow. Cause: The data is empty");
2650          return;
2651        }
2652        windowClass = data;
2653        // The windowClass must be obtained above the targetWindow.
2654        let targetWindow: window.Window = windowClass;
2655        let properties = targetWindow.getWindowProperties();
2656        let targetId = properties.id;
2657        windowClass.raiseAboveTarget(targetId, (err) => {
2658          if (err.code) {
2659            console.error(`Failed to raise the subWindow to target subWindow top. Cause code: ${err.code}, message: ${err.message}`);
2660            return;
2661          }
2662          console.info('Succeeded in raising the subWindow to target subWindow top.');
2663        });
2664      });
2665    } catch (exception) {
2666      console.error(`Failed to create the subWindow. Cause code: ${exception.code}, message: ${exception.message}`);
2667    }
2668  }
2669}
2670```
2671
2672### raiseAboveTarget<sup>10+</sup>
2673
2674raiseAboveTarget(windowId: number): Promise&lt;void&gt;
2675
2676Raises a subwindow above a target subwindow. This API uses a promise to return the result.
2677
2678**System API**: This is a system API.
2679
2680**System capability**: SystemCapability.Window.SessionManager
2681
2682**Parameters**
2683
2684| Name  | Type                     | Mandatory| Description      |
2685| -------- | ------------------------- | ---- | ---------- |
2686| windowId | number                    | Yes  | ID of the target subwindow, which is the value of **properties.id** in [properties](js-apis-window.md#windowproperties) obtained through [getWindowProperties](js-apis-window.md#getwindowproperties9).|
2687
2688**Return value**
2689
2690| Type               | Description                     |
2691| ------------------- | ------------------------- |
2692| Promise&lt;void&gt; | Promise that returns no value.|
2693
2694**Error codes**
2695
2696For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2697
2698| ID| Error Message|
2699| ------- | ------------------------------ |
2700| 202     | Permission verification failed. A non-system application calls a system API. |
2701| 401     | Parameter error. Possible cause: Mandatory parameters are left unspecified. |
2702| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
2703| 1300002 | This window state is abnormal. |
2704| 1300003 | This window manager service works abnormally. |
2705| 1300004 | Unauthorized operation. |
2706| 1300009 | The parent window is invalid. |
2707
2708**Example**
2709
2710```ts
2711// EntryAbility.ets
2712import { UIAbility } from '@kit.AbilityKit';
2713import { BusinessError } from '@kit.BasicServicesKit';
2714
2715export default class EntryAbility extends UIAbility {
2716  // ...
2717  onWindowStageCreate(windowStage: window.WindowStage): void {
2718    console.info('onWindowStageCreate');
2719    let windowClass: window.Window | undefined = undefined;
2720    // Create a subwindow.
2721    try {
2722      let subWindow = windowStage.createSubWindow("testSubWindow");
2723      subWindow.then((data) => {
2724        if (data == null) {
2725          console.error("Failed to create the subWindow. Cause: The data is empty");
2726          return;
2727        }
2728        windowClass = data;
2729        // The windowClass must be obtained above the targetWindow.
2730        let targetWindow: window.Window = windowClass;
2731        let properties = targetWindow.getWindowProperties();
2732        let targetId = properties.id;
2733        let promise = windowClass.raiseAboveTarget(targetId);
2734        promise.then(()=> {
2735          console.info('Succeeded in raising the subWindow to target subWindow top.');
2736        }).catch((err: BusinessError)=>{
2737          console.error(`Failed to raise the subWindow to target subWindow top. Cause code: ${err.code}, message: ${err.message}`);
2738        });
2739      });
2740    } catch (exception) {
2741      console.error(`Failed to create the subWindow. Cause code: ${exception.code}, message: ${exception.message}`);
2742    }
2743  }
2744}
2745```
2746
2747### setRaiseByClickEnabled<sup>10+</sup>
2748
2749setRaiseByClickEnabled(enable: boolean, callback: AsyncCallback&lt;void&gt;): void
2750
2751Sets whether to enable a subwindow to raise itself by click. This API uses an asynchronous callback to return the result.
2752
2753Generally, when a user clicks a subwindow, the subwindow is displayed on the top. If the **enable** parameter is set to **false**, the subwindow is not displayed on the top when being clicked.
2754
2755**System API**: This is a system API.
2756
2757**System capability**: SystemCapability.Window.SessionManager
2758
2759**Parameters**
2760
2761| Name  | Type                     | Mandatory| Description      |
2762| -------- | ------------------------- | ---- | ---------- |
2763| enable   | boolean                   | Yes  | Whether to enable a subwindow to raise itself by click. The value **true** means to enable the subwindow to raise itself by click, and **false** means the opposite.|
2764| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
2765
2766**Error codes**
2767
2768For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2769
2770| ID| Error Message|
2771| ------- | ------------------------------ |
2772| 202     | Permission verification failed. A non-system application calls a system API. |
2773| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
2774| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
2775| 1300002 | This window state is abnormal. |
2776| 1300003 | This window manager service works abnormally. |
2777| 1300004 | Unauthorized operation. |
2778| 1300009 | The parent window is invalid. |
2779
2780**Example**
2781
2782```ts
2783// EntryAbility.ets
2784import { UIAbility } from '@kit.AbilityKit';
2785import { BusinessError } from '@kit.BasicServicesKit';
2786
2787export default class EntryAbility extends UIAbility {
2788  // ...
2789  onWindowStageCreate(windowStage: window.WindowStage): void {
2790    console.info('onWindowStageCreate');
2791    let windowClass: window.Window | undefined = undefined;
2792    // Create a subwindow.
2793    try {
2794      let subWindow = windowStage.createSubWindow("testSubWindow");
2795      subWindow.then((data) => {
2796        if (data == null) {
2797          console.error("Failed to create the subWindow. Cause: The data is empty");
2798          return;
2799        }
2800        windowClass = data;
2801        let enabled = false;
2802        windowClass.setRaiseByClickEnabled(enabled, (err) => {
2803          if (err.code) {
2804            console.error(`Failed to disable the raise-by-click function. Cause code: ${err.code}, message: ${err.message}`);
2805            return;
2806          }
2807          console.info('Succeeded in disabling the raise-by-click function.');
2808        });
2809      });
2810    } catch (exception) {
2811      console.error(`Failed to create the subWindow. Cause code: ${exception.code}, message: ${exception.message}`);
2812    }
2813  }
2814}
2815```
2816
2817### setRaiseByClickEnabled<sup>10+</sup>
2818
2819setRaiseByClickEnabled(enable: boolean): Promise&lt;void&gt;
2820
2821Sets whether to enable a subwindow to raise itself by click. This API uses a promise to return the result.
2822
2823Generally, when a user clicks a subwindow, the subwindow is displayed on the top. If the **enable** parameter is set to **false**, the subwindow is not displayed on the top when being clicked.
2824
2825**System API**: This is a system API.
2826
2827**System capability**: SystemCapability.Window.SessionManager
2828
2829**Parameters**
2830
2831| Name  | Type                     | Mandatory| Description      |
2832| -------- | ------------------------- | ---- | ---------- |
2833| enable   | boolean                   | Yes  | Whether to enable a subwindow to raise itself by click. The value **true** means to enable the subwindow to raise itself by click, and **false** means the opposite.|
2834
2835**Return value**
2836
2837| Type               | Description                     |
2838| ------------------- | ------------------------- |
2839| Promise&lt;void&gt; | Promise that returns no value.|
2840
2841**Error codes**
2842
2843For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2844
2845| ID| Error Message|
2846| ------- | ------------------------------ |
2847| 202     | Permission verification failed. A non-system application calls a system API. |
2848| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
2849| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
2850| 1300002 | This window state is abnormal. |
2851| 1300003 | This window manager service works abnormally. |
2852| 1300004 | Unauthorized operation. |
2853| 1300009 | The parent window is invalid. |
2854
2855**Example**
2856
2857```ts
2858// EntryAbility.ets
2859import { UIAbility } from '@kit.AbilityKit';
2860import { BusinessError } from '@kit.BasicServicesKit';
2861
2862export default class EntryAbility extends UIAbility {
2863  // ...
2864  onWindowStageCreate(windowStage: window.WindowStage): void {
2865    console.info('onWindowStageCreate');
2866    let windowClass: window.Window | undefined = undefined;
2867    // Create a subwindow.
2868    try {
2869      let subWindow = windowStage.createSubWindow("testSubWindow");
2870      subWindow.then((data) => {
2871        if (data == null) {
2872          console.error("Failed to create the subWindow. Cause: The data is empty");
2873          return;
2874        }
2875        windowClass = data;
2876        let enabled = false;
2877        let promise = windowClass.setRaiseByClickEnabled(enabled);
2878        promise.then(()=> {
2879          console.info('Succeeded in disabling the raise-by-click function.');
2880        }).catch((err: BusinessError)=>{
2881          console.error(`Failed to disable the raise-by-click function. Cause code: ${err.code}, message: ${err.message}`);
2882        });
2883      });
2884    } catch (exception) {
2885      console.error(`Failed to create the subWindow. Cause code: ${exception.code}, message: ${exception.message}`);
2886    }
2887  }
2888}
2889```
2890
2891### setResizeByDragEnabled<sup>10+</sup>
2892
2893setResizeByDragEnabled(enable: boolean, callback: AsyncCallback&lt;void&gt;): void
2894
2895Sets whether to enable the main window to resize itself by dragging. This API uses an asynchronous callback to return the result.
2896
2897**System API**: This is a system API.
2898
2899**System capability**: SystemCapability.Window.SessionManager
2900
2901**Parameters**
2902
2903| Name  | Type                     | Mandatory| Description      |
2904| -------- | ------------------------- | ---- | ---------- |
2905| enable   | boolean                   | Yes  | Whether to enable the main window to resize itself by dragging. The value **true** means to enable the main window to resize itself by dragging, and **false** means the opposite.|
2906| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
2907
2908**Error codes**
2909
2910For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2911
2912| ID| Error Message|
2913| ------- | ------------------------------ |
2914| 202     | Permission verification failed. A non-system application calls a system API. |
2915| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
2916| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
2917| 1300002 | This window state is abnormal. |
2918| 1300003 | This window manager service works abnormally. |
2919
2920**Example**
2921
2922```ts
2923// EntryAbility.ets
2924import { UIAbility } from '@kit.AbilityKit';
2925
2926export default class EntryAbility extends UIAbility {
2927    onWindowStageCreate(windowStage) {
2928        // Load content for the main window.
2929        windowStage.loadContent("pages/page2", (err) => {
2930            if (err.code) {
2931                console.error(`Failed to load the content. Cause code: ${err.code}, message: ${err.message}`);
2932                return;
2933            }
2934            console.info('Succeeded in loading the content.');
2935        });
2936        // Obtain the main window.
2937        let mainWindow: window.Window | undefined = undefined;
2938
2939        windowStage.getMainWindow((err, data) => {
2940            if (err.code) {
2941                console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
2942                return;
2943            }
2944            mainWindow = data;
2945            console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
2946
2947            let enabled = false;
2948            // Call setResizeByDragEnabled.
2949            mainWindow.setResizeByDragEnabled(enabled, (err) => {
2950                if (err.code) {
2951                    console.error(`Failed to set the function of disabling the resize by dragg window. Cause code: ${err.code}, message: ${err.message}`);
2952                    return;
2953                }
2954                console.info('Succeeded in setting the function of disabling the resize by dragg window.');
2955            });
2956        });
2957    }
2958};
2959```
2960
2961### startMoving<sup>13+</sup>
2962
2963startMoving(): Promise&lt;void&gt;
2964
2965Starts moving this window. This API uses a promise to return the result.
2966
2967The window moves with the mouse only when this API is called in the callback function of the [onTouch](./arkui-ts/ts-universal-events-touch.md#touchevent) event, the type of which must be **TouchType.Down**.
2968
2969This API takes effect only for the system window on 2-in-1 devices. If this API is called for other device types, an error is reported.
2970
2971**System capability**: SystemCapability.Window.SessionManager
2972
2973**System API**: This is a system API.
2974
2975**Return value**
2976
2977| Type               | Description                     |
2978| ------------------- | ------------------------- |
2979| Promise&lt;void&gt; | Promise that returns no value.|
2980
2981**Error codes**
2982
2983For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2984
2985| ID| Error Message|
2986| -------- | -------------------------------------------- |
2987| 202     | Permission verification failed. A non-system application calls a system API.   |
2988| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
2989| 1300001 | Repeated operation. |
2990| 1300002 | This window state is abnormal.                |
2991| 1300003 | This window manager service works abnormally. |
2992| 1300004 | Unauthorized operation.                       |
2993
2994**Example**
2995
2996```ts
2997// ets/pages/Index.ets
2998import { BusinessError } from '@kit.BasicServicesKit';
2999
3000@Entry
3001@Component
3002struct Index {
3003  @State message: string = 'Hello World';
3004  build() {
3005    row() {
3006      Column() {
3007        // Set the minimum width to 160.
3008        Blank('160').onTouch((event: TouchEvent) => {
3009          if (event.type === TouchType.Down) {
3010            try {
3011              windowClass.startMoving().then(() => {
3012                console.info('Succeeded in starting moving window.')
3013              }).catch((err: BusinessError) => {
3014                console.error(`Failed to start moving. Cause code: ${err.code}, message: ${err.message}`);
3015              });
3016            } catch (exception) {
3017              console.error(`Failed to start moving window. Cause code: ${exception.code}, message: ${exception.message}`);
3018            }
3019          }
3020        }
3021      }
3022    }
3023  }
3024}
3025```
3026
3027### enableDrag<sup>13+</sup>
3028
3029enableDrag(enable: boolean): Promise&lt;void&gt;
3030
3031Enables or disables window dragging. This API uses a promise to return the result.
3032
3033After window dragging is enabled, the window can be resized using the mouse.
3034
3035This API takes effect only for the system window on 2-in-1 devices. If this API is called for other device types, an error is reported.
3036
3037**System capability**: SystemCapability.Window.SessionManager
3038
3039**System API**: This is a system API.
3040
3041**Parameters**
3042
3043| Name| Type| Mandatory| Description|
3044| -------- | ---------------------------- | -- | --------- |
3045| enable| boolean | Yes| Whether to enable dragging.<br>The value **true** means to enable dragging, and **false** means the opposite.<br>|
3046
3047**Return value**
3048
3049| Type               | Description                     |
3050| ------------------- | ------------------------- |
3051| Promise&lt;void&gt; | Promise that returns no value. |
3052
3053**Error codes**
3054
3055For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3056
3057| ID| Error Message|
3058| -------- | -------------------------------------------- |
3059| 202     | Permission verification failed. A non-system application calls a system API.   |
3060| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3061| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3062| 1300002 | This window state is abnormal.                |
3063| 1300003 | This window manager service works abnormally. |
3064| 1300004 | Unauthorized operation.                       |
3065
3066**Example**
3067
3068```ts
3069import { BusinessError } from '@kit.BasicServicesKit';
3070
3071try {
3072  windowClass.enableDrag(true).then(() => { 
3073    console.info('succeeded in setting window draggable');
3074  }).catch((err: BusinessError) => {
3075    console.error(`Failed to set window draggable. Cause code: ${err.code}, message: ${err.message}`);
3076  });
3077} catch (exception) {
3078  console.error(`Failed to set window draggable. Cause code: ${exception.code}, message: ${exception.message}`);
3079}
3080```
3081
3082### setResizeByDragEnabled<sup>10+</sup>
3083
3084setResizeByDragEnabled(enable: boolean): Promise&lt;void&gt;
3085
3086Sets whether to enable the main window to resize itself by dragging. This API uses a promise to return the result.
3087
3088**System API**: This is a system API.
3089
3090**System capability**: SystemCapability.Window.SessionManager
3091
3092**Parameters**
3093
3094| Name  | Type                     | Mandatory| Description      |
3095| -------- | ------------------------- | ---- | ---------- |
3096| enable   | boolean                   | Yes  | Whether to enable the main window to resize itself by dragging. The value **true** means to enable the main window to resize itself by dragging, and **false** means the opposite.|
3097
3098**Return value**
3099
3100| Type               | Description                     |
3101| ------------------- | ------------------------- |
3102| Promise&lt;void&gt; | Promise that returns no value.|
3103
3104**Error codes**
3105
3106For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3107
3108| ID| Error Message|
3109| ------- | ------------------------------ |
3110| 202     | Permission verification failed. A non-system application calls a system API. |
3111| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3112| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3113| 1300002 | This window state is abnormal. |
3114| 1300003 | This window manager service works abnormally. |
3115
3116**Example**
3117
3118```ts
3119// EntryAbility.ets
3120import { UIAbility } from '@kit.AbilityKit';
3121import { BusinessError } from '@kit.BasicServicesKit';
3122
3123export default class EntryAbility extends UIAbility {
3124    onWindowStageCreate(windowStage) {
3125        // Load content for the main window.
3126        windowStage.loadContent("pages/page2", (err) => {
3127            if (err.code) {
3128                console.error(`Failed to load the content. Cause code: ${err.code}, message: ${err.message}`);
3129                return;
3130            }
3131            console.info('Succeeded in loading the content.');
3132        });
3133        // Obtain the main window.
3134        let mainWindow: window.Window | undefined = undefined;
3135
3136        windowStage.getMainWindow((err, data) => {
3137            if (err.code) {
3138                console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
3139                return;
3140            }
3141            mainWindow = data;
3142            console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
3143
3144            let enabled = false;
3145            // Promise object of the setResizeByDragEnabled API.
3146            let promise = mainWindow.setResizeByDragEnabled(enabled);
3147            promise.then(()=> {
3148                console.info('Succeeded in setting the function of disabling the resize by dragg window.');
3149            }).catch((err: BusinessError)=>{
3150                console.error(`Failed to set the function of disabling the resize by dragg window. Cause code: ${err.code}, message: ${err.message}`);
3151            });
3152        });
3153    }
3154};
3155```
3156
3157### hideNonSystemFloatingWindows<sup>11+</sup>
3158
3159hideNonSystemFloatingWindows(shouldHide: boolean, callback: AsyncCallback&lt;void&gt;): void
3160
3161Sets whether to hide non-system floating windows. This API uses an asynchronous callback to return the result.
3162
3163A non-system floating window is a floating window created by a non-system application. By default, the main window of a system application can be displayed together with a non-system floating window. This means that the main window may be blocked by an upper-layer non-system floating window. If the **shouldHide** parameter is set to **true**, all non-system floating windows are hidden, so that the main window will never be blocked by a non-system floating window.
3164
3165**System API**: This is a system API.
3166
3167**System capability**: SystemCapability.Window.SessionManager
3168
3169**Parameters**
3170
3171| Name     | Type                     | Mandatory| Description      |
3172| ----------- | ------------------------- | ---- | ---------- |
3173| shouldHide  | boolean                   | Yes  | Whether to hide non-system floating windows. The value **true** means to hide the floating windows, and **false** means the opposite.|
3174| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
3175
3176**Error codes**
3177
3178For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3179
3180| ID| Error Message|
3181| ------- | ------------------------------ |
3182| 202     | Permission verification failed. A non-system application calls a system API. |
3183| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3184| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3185| 1300002 | This window state is abnormal. |
3186| 1300003 | This window manager service works abnormally. |
3187| 1300004 | Unauthorized operation. |
3188
3189**Example**
3190
3191```ts
3192// EntryAbility.ets
3193import { UIAbility, Want } from '@kit.AbilityKit';
3194
3195export default class EntryAbility extends UIAbility {
3196  onWindowStageCreate(windowStage: window.WindowStage) {
3197    // Load the page corresponding to the main window.
3198    windowStage.loadContent('pages/Index', (err) => {
3199      if (err.code) {
3200        console.error(`Failed to load the content. Cause code: ${err.code}, message: ${err.message}`);
3201        return;
3202      }
3203      console.info('Succeeded in loading the content.');
3204    });
3205
3206    // Obtain the main window.
3207    let mainWindow: window.Window | undefined = undefined;
3208    windowStage.getMainWindow((err, data) => {
3209      if (err.code) {
3210        console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
3211        return;
3212      }
3213      mainWindow = data;
3214      console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
3215
3216      let shouldHide = true;
3217      // Call hideNonSystemFloatingWindows with the callback parameter.
3218      mainWindow.hideNonSystemFloatingWindows(shouldHide, (err) => {
3219        if (err.code) {
3220          console.error(`Failed to hide the non-system floating windows. Cause code: ${err.code}, message: ${err.message}`);
3221          return;
3222        }
3223        console.info('Succeeded in hiding the non-system floating windows.');
3224      });
3225    });
3226  }
3227}
3228```
3229
3230### hideNonSystemFloatingWindows<sup>11+</sup>
3231
3232hideNonSystemFloatingWindows(shouldHide: boolean): Promise&lt;void&gt;
3233
3234Sets whether to hide non-system floating windows. This API uses an asynchronous callback to return the result.
3235
3236A non-system floating window is a floating window created by a non-system application. By default, the main window of a system application can be displayed together with a non-system floating window. This means that the main window may be blocked by an upper-layer non-system floating window. If the **shouldHide** parameter is set to **true**, all non-system floating windows are hidden, so that the main window will never be blocked by a non-system floating window.
3237
3238**System API**: This is a system API.
3239
3240**System capability**: SystemCapability.Window.SessionManager
3241
3242**Parameters**
3243
3244| Name     | Type                     | Mandatory| Description      |
3245| ----------- | ------------------------- | ---- | ---------- |
3246| shouldHide  | boolean                   | Yes  | Whether to hide non-system floating windows. The value **true** means to hide the floating windows, and **false** means the opposite.|
3247
3248**Return value**
3249
3250| Type               | Description                     |
3251| ------------------- | ------------------------- |
3252| Promise&lt;void&gt; | Promise that returns no value.|
3253
3254**Error codes**
3255
3256For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3257
3258| ID| Error Message|
3259| ------- | ------------------------------ |
3260| 202     | Permission verification failed. A non-system application calls a system API. |
3261| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3262| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3263| 1300002 | This window state is abnormal. |
3264| 1300003 | This window manager service works abnormally. |
3265| 1300004 | Unauthorized operation. |
3266
3267**Example**
3268
3269```ts
3270// EntryAbility.ets
3271import { UIAbility, Want } from '@kit.AbilityKit';
3272import { BusinessError } from '@kit.BasicServicesKit';
3273
3274export default class EntryAbility extends UIAbility {
3275  onWindowStageCreate(windowStage: window.WindowStage) {
3276    // Load the page corresponding to the main window.
3277    windowStage.loadContent('pages/Index', (err) => {
3278      if (err.code) {
3279        console.error(`Failed to load the content. Cause code: ${err.code}, message: ${err.message}`);
3280        return;
3281      }
3282      console.info('Succeeded in loading the content.');
3283    });
3284
3285    // Obtain the main window.
3286    let mainWindow: window.Window | undefined = undefined;
3287    windowStage.getMainWindow((err, data) => {
3288      if (err.code) {
3289        console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
3290        return;
3291      }
3292      mainWindow = data;
3293      console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
3294
3295      let shouldHide = true;
3296      // Call hideNonSystemFloatingWindows to obtain a promise object.
3297      let promise = mainWindow.hideNonSystemFloatingWindows(shouldHide);
3298      promise.then(()=> {
3299        console.info('Succeeded in hiding the non-system floating windows.');
3300      }).catch((err: BusinessError)=>{
3301        console.error(`Failed to hide the non-system floating windows. Cause code: ${err.code}, message: ${err.message}`);
3302      });
3303    });
3304  }
3305}
3306```
3307
3308### setTopmost<sup>12+</sup>
3309
3310setTopmost(isTopmost: boolean): Promise&lt;void&gt;
3311
3312Called by the main window to place the window above all the other windows. This API uses a promise to return the result.
3313
3314This parameter is valid only when the main window is a floating window in 2-in-1 devices.
3315
3316**System API**: This is a system API.
3317
3318**System capability**: SystemCapability.Window.SessionManager
3319
3320**Parameters**
3321
3322| Name  | Type                     | Mandatory| Description      |
3323| -------- | ------------------------- | ---- | ---------- |
3324| isTopmost | boolean | Yes  | Whether to pin the main window on top. The value **true** means to pin the main window on top, and **false** means the opposite.|
3325
3326**Return value**
3327
3328| Type               | Description                     |
3329| ------------------- | ------------------------- |
3330| Promise&lt;void&gt; | Promise that returns no value.|
3331
3332**Error codes**
3333
3334For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3335
3336| ID| Error Message|
3337| ------- | ------------------------------ |
3338| 202     | Permission verification failed. A non-system application calls a system API. |
3339| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3340| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3341| 1300002 | This window state is abnormal.                |
3342| 1300003 | This window manager service works abnormally. |
3343| 1300004 | Unauthorized operation.                       |
3344
3345**Example**
3346
3347```ts
3348// EntryAbility.ets
3349import { UIAbility } from '@kit.AbilityKit';
3350import { BusinessError } from '@kit.BasicServicesKit';
3351
3352export default class EntryAbility extends UIAbility {
3353  // ...
3354  onWindowStageCreate(windowStage: window.WindowStage): void {
3355    // ...
3356    windowStage.getMainWindow().then((window) => {
3357      let isTopmost: boolean = true;
3358      let promise = window.setTopmost(isTopmost);
3359      promise.then(() => {
3360        console.info('Succeeded in setting the main window to be topmost.');
3361      }).catch((err: BusinessError) => {
3362        console.error(`Failed to set the main window to be topmost. Cause code: ${err.code}, message: ${err.message}`);
3363      });
3364    });
3365  }
3366}
3367```
3368
3369### setSingleFrameComposerEnabled<sup>11+</sup>
3370
3371setSingleFrameComposerEnabled(enable: boolean): Promise&lt;void&gt;
3372
3373Enables or disables the single-frame composer. This API uses a promise to return the result.
3374
3375The single-frame composer is mainly used in scenarios that requires extremely low interaction latency. It reduces the screen display latency of the rendering node.  
3376
3377**System API**: This is a system API.
3378
3379**System capability**: SystemCapability.Window.SessionManager
3380
3381**Parameters**
3382
3383| Name  | Type                     | Mandatory| Description      |
3384| -------- | ------------------------- | ---- | ---------- |
3385| enable   | boolean                   | Yes  | Whether to enable the single-frame composer. The value **true** means to enable the single-frame composer, and false means to disable it.|
3386
3387**Return value**
3388
3389| Type               | Description                     |
3390| ------------------- | ------------------------- |
3391| Promise&lt;void&gt; | Promise that returns no value.|
3392
3393**Error codes**
3394
3395For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3396
3397| ID| Error Message|
3398| ------- | ------------------------------ |
3399| 202     | Permission verification failed. A non-system application calls a system API. |
3400| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3401| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3402| 1300002 | This window state is abnormal. |
3403
3404**Example**
3405
3406```ts
3407import { BusinessError } from '@kit.BasicServicesKit';
3408
3409let enable = true;
3410let promise = windowClass.setSingleFrameComposerEnabled(enable);
3411promise.then(()=> {
3412    console.info('Succeeded in enabling the single-frame-composer function.');
3413}).catch((err: BusinessError)=>{
3414    console.error(`Failed to enable the single-frame-composer function. code:${err.code}, message:${err.message}.`);
3415});
3416```
3417
3418### setTitleButtonVisible<sup>12+</sup>
3419
3420setTitleButtonVisible(isMaximizeVisible: boolean, isMinimizeVisible: boolean, isSplitVisible: boolean): void
3421
3422Shows or hides the maximize, minimize, and split-screen buttons on the title bar of the main window.
3423
3424This API is valid only for 2-in-1 devices and takes effect only for the title bar buttons (maximize, minimize, and split-screen) that are available in the current scenario.
3425
3426**System API**: This is a system API.
3427
3428**System capability**: SystemCapability.Window.SessionManager
3429
3430**Parameters**
3431
3432| Name   | Type   | Mandatory| Description                                         |
3433| --------- | ------- | ---- | --------------------------------------------- |
3434| isMaximizeVisible | boolean | Yes  | Whether to show the maximize button. The value **true** means to show the button, and **false** means to hide it.|
3435| isMinimizeVisible | boolean | Yes  | Whether to show the minimize button. The value **true** means to show the button, and **false** means to hide it.|
3436| isSplitVisible | boolean | Yes  | Whether to show the split-screen button. The value **true** means to show the button, and **false** means to hide it.|
3437
3438**Error codes**
3439
3440For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3441
3442| ID| Error Message                      |
3443| -------- | ------------------------------ |
3444| 202      | Permission verification failed. A non-system application calls a system API. |
3445| 401      | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3446| 801      | Capability not supported. Failed to call the API due to limited device capabilities. |
3447| 1300002  | This window state is abnormal. |
3448| 1300004  | Unauthorized operation. |
3449
3450**Example**
3451
3452```ts
3453// EntryAbility.ets
3454import { UIAbility } from '@kit.AbilityKit';
3455import { BusinessError } from '@kit.BasicServicesKit';
3456
3457export default class EntryAbility extends UIAbility {
3458  onWindowStageCreate(windowStage: window.WindowStage): void {
3459    // Load the page corresponding to the main window.
3460    windowStage.loadContent('pages/Index', (err) => {
3461      let mainWindow: window.Window | undefined = undefined;
3462      // Obtain the main window.
3463      windowStage.getMainWindow().then(
3464        data => {
3465          mainWindow = data;
3466          console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
3467          // Call setTitleButtonVisible to hide the maximize, minimize, and split-screen buttons on the title bar of the main window.
3468          mainWindow.setTitleButtonVisible(false, false, false);
3469        }
3470      ).catch((err: BusinessError) => {
3471          if(err.code){
3472            console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
3473          }
3474      });
3475    });
3476  }
3477}
3478```
3479
3480### setWindowType<sup>(deprecated)</sup>
3481
3482setWindowType(type: WindowType, callback: AsyncCallback&lt;void&gt;): void
3483
3484Sets the type of this window. This API uses an asynchronous callback to return the result.
3485
3486**System API**: This is a system API.
3487
3488> **NOTE**
3489>
3490> This API is supported since API version 7 and deprecated since API version 9.
3491
3492**System capability**: SystemCapability.WindowManager.WindowManager.Core
3493
3494**Parameters**
3495
3496| Name  | Type                     | Mandatory| Description      |
3497| -------- | ------------------------- | ---- | ---------- |
3498| type     | [WindowType](#windowtype7) | Yes  | Window type.|
3499| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
3500
3501**Example**
3502
3503```ts
3504import { BusinessError } from '@kit.BasicServicesKit';
3505
3506let type = window.WindowType.TYPE_SYSTEM_ALERT;
3507windowClass.setWindowType(type, (err: BusinessError) => {
3508  const errCode: number = err.code;
3509  if (errCode) {
3510    console.error(`Failed to set the window type. Cause code: ${err.code}, message: ${err.message}`);
3511    return;
3512  }
3513  console.info('Succeeded in setting the window type.');
3514});
3515```
3516
3517### setWindowType<sup>(deprecated)</sup>
3518
3519setWindowType(type: WindowType): Promise&lt;void&gt;
3520
3521Sets the type of this window. This API uses a promise to return the result.
3522
3523**System API**: This is a system API.
3524
3525> **NOTE**
3526>
3527> This API is supported since API version 7 and deprecated since API version 9.
3528
3529**System capability**: SystemCapability.WindowManager.WindowManager.Core
3530
3531**Parameters**
3532
3533| Name| Type                     | Mandatory| Description      |
3534| ------ | ------------------------- | ---- | ---------- |
3535| type   | [WindowType](#windowtype7) | Yes  | Window type.|
3536
3537**Return value**
3538
3539| Type               | Description                     |
3540| ------------------- | ------------------------- |
3541| Promise&lt;void&gt; | Promise that returns no value.|
3542
3543**Example**
3544
3545```ts
3546import { BusinessError } from '@kit.BasicServicesKit';
3547
3548let type = window.WindowType.TYPE_SYSTEM_ALERT;
3549let promise = windowClass.setWindowType(type);
3550promise.then(() => {
3551  console.info('Succeeded in setting the window type.');
3552}).catch((err: BusinessError) => {
3553  console.error(`Failed to set the window type. Cause code: ${err.code}, message: ${err.message}`);
3554});
3555```
3556
3557## SubWindowOptions<sup>11+</sup>
3558
3559Describes the parameters used for creating a subwindow.
3560
3561**System capability**: SystemCapability.Window.SessionManager
3562
3563| Name     | Type | Read Only| Optional| Description        |
3564| ---------- | ---- | ---- | ---- | ----------- |
3565| isTopmost<sup>12+</sup>  | boolean | No| Yes| Whether the subwindow is topmost. The value **true** means that the subwindow is topmost, and **false** means the opposite. The default value is **false**.      |
3566
3567## WindowStage<sup>9+</sup>
3568
3569Implements a window manager, which manages each basic window unit, that is, [Window](#window) instance.
3570
3571Before calling any of the following APIs, you must use [onWindowStageCreate()](../apis-ability-kit/js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) to create a **WindowStage** instance.
3572
3573### disableWindowDecor<sup>9+</sup>
3574
3575disableWindowDecor(): void
3576
3577Disables window decorators.
3578
3579**Model restriction**: This API can be used only in the stage model.
3580
3581**System API**: This is a system API.
3582
3583**System capability**: SystemCapability.WindowManager.WindowManager.Core
3584
3585**Error codes**
3586
3587For details about the error codes, see [Window Error Codes](errorcode-window.md).
3588
3589| ID| Error Message|
3590| ------- | ------------------------------ |
3591| 202     | Permission verification failed. A non-system application calls a system API. |
3592| 1300002 | This window state is abnormal. |
3593| 1300005 | This window stage is abnormal. |
3594
3595**Example**
3596
3597```ts
3598// EntryAbility.ets
3599import { UIAbility, Want } from '@kit.AbilityKit';
3600
3601export default class EntryAbility extends UIAbility {
3602  // ...
3603
3604  onWindowStageCreate(windowStage: window.WindowStage) {
3605    console.log('disableWindowDecor');
3606    windowStage.disableWindowDecor();
3607  }
3608};
3609```
3610
3611### setShowOnLockScreen<sup>9+</sup>
3612
3613setShowOnLockScreen(showOnLockScreen: boolean): void
3614
3615Sets whether to display the window of the application on the lock screen.
3616
3617**System API**: This is a system API.
3618
3619**Model restriction**: This API can be used only in the stage model.
3620
3621**System capability**: SystemCapability.WindowManager.WindowManager.Core
3622
3623**Parameters**
3624
3625| Name          | Type   | Mandatory| Description                        |
3626| ---------------- | ------- | ---- | ---------------------------- |
3627| 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.|
3628
3629**Error codes**
3630
3631For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3632
3633| ID| Error Message|
3634| ------- | ------------------------------ |
3635| 202     | Permission verification failed. A non-system application calls a system API. |
3636| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3637| 1300002 | This window state is abnormal. |
3638| 1300005 | This window stage is abnormal. |
3639
3640**Example**
3641
3642```ts
3643// EntryAbility.ets
3644import { UIAbility } from '@kit.AbilityKit';
3645
3646export default class EntryAbility extends UIAbility {
3647  // ...
3648
3649  onWindowStageCreate(windowStage: window.WindowStage) {
3650    console.log('onWindowStageCreate');
3651    try {
3652      windowStage.setShowOnLockScreen(true);
3653    } catch (exception) {
3654      console.error(`Failed to show on lockscreen. Cause code: ${exception.code}, message: ${exception.message}`);
3655    }
3656  }
3657};
3658```
3659
3660## TransitionContext<sup>9+</sup>
3661
3662Provides the context for the transition animation.
3663
3664**System API**: This is a system API.
3665
3666### Attributes
3667
3668**System API**: This is a system API.
3669
3670**System capability**: SystemCapability.WindowManager.WindowManager.Core
3671
3672| Name                 | Type         | Readable| Writable| Description            |
3673| --------------------- | ----------------- | ---- | ---- | ---------------- |
3674| toWindow<sup>9+</sup> | [Window](#window) | Yes  | Yes  | Target window to display the animation.|
3675
3676### completeTransition<sup>9+</sup>
3677
3678completeTransition(isCompleted: boolean): void
3679
3680Completes the transition. This API can be called only after [animateTo()](arkui-ts/ts-explicit-animation.md) is executed.
3681
3682**System API**: This is a system API.
3683
3684**System capability**: SystemCapability.WindowManager.WindowManager.Core
3685
3686**Parameters**
3687
3688| Name     | Type   | Mandatory| Description                                                        |
3689| ----------- | ------- | ---- | ------------------------------------------------------------ |
3690| isCompleted | boolean | Yes  | Whether the transition is complete. The value **true** means that the transition is complete, and **false** means the opposite.|
3691
3692**Error codes**
3693
3694For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
3695
3696| ID| Error Message|
3697| ------- | -------------------------------- |
3698| 202     | Permission verification failed. A non-system application calls a system API. |
3699| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.               |
3700
3701**Example**
3702
3703```ts
3704(context: window.TransitionContext) => {
3705  let toWindow: window.Window = context.toWindow;
3706  animateTo({
3707    duration: 1000, // Animation duration.
3708    tempo: 0.5, // Playback speed.
3709    curve: Curve.EaseInOut, // Animation curve.
3710    delay: 0, // Animation delay.
3711    iterations: 1, // Number of playback times.
3712    playMode: PlayMode.Normal // Animation playback mode.
3713  }, () => {
3714    let obj: window.TranslateOptions = {
3715      x: 100.0,
3716      y: 0.0,
3717      z: 0.0
3718    };
3719    toWindow.translate(obj);
3720    console.info('toWindow translate end');
3721  }
3722  );
3723  try {
3724    context.completeTransition(true)
3725  } catch (exception) {
3726    console.error(`toWindow translate fail. Cause code: ${exception.code}, message: ${exception.message}`);
3727  }
3728  console.info('complete transition end');
3729};
3730```
3731
3732## TransitionController<sup>9+</sup>
3733
3734Implements the transition animation controller. Before calling any API, you must create a system window. For details, see the sample code.
3735
3736**System API**: This is a system API.
3737
3738**Example**
3739
3740```ts
3741import { BusinessError } from '@kit.BasicServicesKit';
3742
3743let windowClass: window.Window | undefined = undefined;
3744let config: window.Configuration = {
3745  name: "systemTypeWindow",
3746  windowType: window.WindowType.TYPE_PANEL, // Select a system window type as required.
3747  ctx: this.context
3748};
3749let promise = window.createWindow(config);
3750promise.then((data) => {
3751  windowClass = data;
3752  console.info('Succeeded in creating the window. Data:' + JSON.stringify(data));
3753}).catch((err: BusinessError) => {
3754  console.error(`Failed to create the Window. Cause code: ${err.code}, message: ${err.message}`);
3755});
3756```
3757
3758### animationForShown<sup>9+</sup>
3759
3760animationForShown(context: TransitionContext): void
3761
3762Customizes the animation for the scenario when the window is shown.
3763
3764**System API**: This is a system API.
3765
3766**System capability**: SystemCapability.WindowManager.WindowManager.Core
3767
3768**Parameters**
3769
3770| Name | Type                                    | Mandatory| Description                |
3771| ------- | ---------------------------------------- | ---- | -------------------- |
3772| context | [TransitionContext](#transitioncontext9) | Yes  | Context of the transition animation.|
3773
3774**Error codes**
3775
3776For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
3777
3778| ID| Error Message|
3779| ------- | -------------------------------- |
3780| 202     | Permission verification failed. A non-system application calls a system API. |
3781| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.               |
3782
3783**Example**
3784
3785```ts
3786// xxx.ts
3787export class AnimationConfig {
3788  private animationForShownCallFunc_: Function = undefined;
3789  ShowWindowWithCustomAnimation(windowClass: window.Window, callback) {
3790    if (!windowClass) {
3791      console.error('windowClass is undefined');
3792      return false;
3793    }
3794    this.animationForShownCallFunc_ = callback;
3795    let controller: window.TransitionController = windowClass.getTransitionController();
3796    controller.animationForShown = (context : window.TransitionContext)=> {
3797      this.animationForShownCallFunc_(context);
3798    };
3799    windowClass.showWithAnimation(()=>{
3800      console.info('Show with animation success');
3801    });
3802  }
3803}
3804```
3805
3806```ts
3807// xxx.ets
3808let animationConfig = new AnimationConfig();
3809let systemTypeWindow = window.findWindow("systemTypeWindow"); // Obtain a system window.
3810try {
3811  animationConfig?.ShowWindowWithCustomAnimation(systemTypeWindow, (context : window.TransitionContext)=>{
3812    console.info('complete transition end');
3813    let toWindow = context.toWindow;
3814    animateTo({
3815      duration: 1000, // Animation duration.
3816      tempo: 0.5, // Playback speed.
3817      curve: Curve.EaseInOut, // Animation curve.
3818      delay: 0, // Animation delay.
3819      iterations: 1, // Number of playback times.
3820      playMode: PlayMode.Normal // Animation playback mode.
3821      onFinish: () => {
3822        console.info('onFinish in animation');
3823        context.completeTransition(true)
3824      }
3825    }, () => {
3826      let obj : window.TranslateOptions = {
3827        x : 100.0,
3828        y : 0.0,
3829        z : 0.0
3830      };
3831      toWindow.translate(obj); // Set the transition animation.
3832      console.info('toWindow translate end in animation');
3833    });
3834    console.info('complete transition end');
3835  });
3836} catch (error) {
3837  console.error(`ShowWindowWithCustomAnimation error code: ${error.code}, message: ${error.message}`);
3838}
3839```
3840
3841### animationForHidden<sup>9+</sup>
3842
3843animationForHidden(context: TransitionContext): void
3844
3845Customizes the animation for the scenario when the window is hidden.
3846
3847**System API**: This is a system API.
3848
3849**System capability**: SystemCapability.WindowManager.WindowManager.Core
3850
3851**Parameters**
3852
3853| Name | Type                                    | Mandatory| Description                |
3854| ------- | ---------------------------------------- | ---- | -------------------- |
3855| context | [TransitionContext](#transitioncontext9) | Yes  | Context of the transition animation.|
3856
3857**Error codes**
3858
3859For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
3860
3861| ID| Error Message|
3862| ------- | -------------------------------- |
3863| 202     | Permission verification failed. A non-system application calls a system API. |
3864| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.               |
3865
3866**Example**
3867
3868```ts
3869// xxx.ts
3870export class AnimationConfig {
3871  private animationForHiddenCallFunc_: Function = undefined;
3872  HideWindowWithCustomAnimation(windowClass: window.Window, callback) {
3873    if (!windowClass) {
3874      console.error('windowClass is undefined');
3875      return false;
3876    }
3877    this.animationForHiddenCallFunc_ = callback;
3878    let controller: window.TransitionController = windowClass.getTransitionController();
3879    controller.animationForHidden = (context : window.TransitionContext)=> {
3880      this.animationForHiddenCallFunc_(context);
3881    };
3882    windowClass.hideWithAnimation(()=>{
3883      console.info('hide with animation success');
3884    });
3885  }
3886}
3887```
3888
3889```ts
3890// xxx.ets
3891let animationConfig = new AnimationConfig();
3892let systemTypeWindow = window.findWindow("systemTypeWindow"); // Obtain a system window.
3893try {
3894  animationConfig?.HideWindowWithCustomAnimation(systemTypeWindow, (context : window.TransitionContext)=>{
3895    console.info('complete transition end');
3896    let toWindow = context.toWindow;
3897    animateTo({
3898      duration: 1000, // Animation duration.
3899      tempo: 0.5, // Playback speed.
3900      curve: Curve.EaseInOut, // Animation curve.
3901      delay: 0, // Animation delay.
3902      iterations: 1, // Number of playback times.
3903      playMode: PlayMode.Normal // Animation playback mode.
3904      onFinish: () => {
3905        console.info('onFinish in animation');
3906        context.completeTransition(true)
3907      }
3908    }, () => {
3909      let obj : window.TranslateOptions = {
3910        x : 100.0,
3911        y : 0.0,
3912        z : 0.0
3913      };
3914      toWindow.translate(obj); // Set the transition animation.
3915      console.info('toWindow translate end in animation');
3916    });
3917    console.info('complete transition end');
3918  });
3919} catch (error) {
3920  console.error(`HideWindowWithCustomAnimation error code: ${error.code}, message: ${error.message}` );
3921}
3922```
3923
3924## ExtensionWindowAttribute<sup>12+</sup>
3925
3926Enumerates the attributes of a window for a UI ServiceExtensionAbility.
3927
3928**Model restriction**: This API can be used only in the stage model.
3929
3930**System API**: This is a system API.
3931
3932**System capability**: SystemCapability.Window.SessionManager
3933
3934| Name     | Value| Description        |
3935| ---------- | ----- | ----------- |
3936| SYSTEM_WINDOW  | 0 | System window|
3937| SUB_WINDOW  | 1 | Subwindow.|
3938
3939## SystemWindowOptions<sup>12+</sup>
3940
3941Describes the parameters for creating a system window.
3942
3943**Model restriction**: This API can be used only in the stage model.
3944
3945**System API**: This is a system API.
3946
3947**System capability**: SystemCapability.Window.SessionManager
3948
3949| Name| Type                     | Read Only |Optional| Description      |
3950| ------ | ------------------------- | ---- | ---- |---------- |
3951| windowType   | [WindowType](#windowtype7) | No  | No  | Window type. There is no default value. If null is passed in, the window fails to be created.|
3952
3953## ExtensionWindowConfig<sup>12+</sup>
3954
3955Describes the parameters for creating a window for a UI ServiceExtensionAbility.
3956
3957**Model restriction**: This API can be used only in the stage model.
3958
3959**System API**: This is a system API.
3960
3961**System capability**: SystemCapability.Window.SessionManager
3962
3963| Name| Type                     | Read Only |Optional| Description      |
3964| ------ | ------------------------- | ---- | ---- |---------- |
3965| windowName   | string | No| No | Window name.|
3966| windowAttribute   | [ExtensionWindowAttribute](#extensionwindowattribute12) | No| No  | Window attribute. It specifies whether the created window is a subwindow or a system window. When **windowAttribute** is set to **SUB_WINDOW**, **subWindowOptions** is mandatory. When **windowAttribute** is set to **SYSTEM_WINDOW**, **systemWindowOptions** is mandatory. Otherwise, the window fails to be created.|
3967| windowRect   | [Rect](js-apis-window.md#rect7) | No| No  | Rectangular area of the window.|
3968| subWindowOptions   | [SubWindowOptions](js-apis-window.md#subwindowoptions11) | No| Yes| Parameters used for creating a subwindow. There is no default value. This parameter is mandatory when **windowAttribute** is set to **SUB_WINDOW**. Otherwise, the window fails to be created.|
3969| systemWindowOptions   | [SystemWindowOptions](#systemwindowoptions12) | No| Yes| Parameters for creating a system window. There is no default value. This parameter is mandatory when **windowAttribute** is set to **SYSTEM_WINDOW**. Otherwise, the window fails to be created.|
3970