• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>9+</sup>      | 2      | Input method window.<br>**Model restriction**: This API can be used only in the stage model.<br>**System API**: This is a system API.<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### setResizeByDragEnabled<sup>10+</sup>
2962
2963setResizeByDragEnabled(enable: boolean): Promise&lt;void&gt;
2964
2965Sets whether to enable the main window to resize itself by dragging. This API uses a promise to return the result.
2966
2967**System API**: This is a system API.
2968
2969**System capability**: SystemCapability.Window.SessionManager
2970
2971**Parameters**
2972
2973| Name  | Type                     | Mandatory| Description      |
2974| -------- | ------------------------- | ---- | ---------- |
2975| 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.|
2976
2977**Return value**
2978
2979| Type               | Description                     |
2980| ------------------- | ------------------------- |
2981| Promise&lt;void&gt; | Promise that returns no value.|
2982
2983**Error codes**
2984
2985For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
2986
2987| ID| Error Message|
2988| ------- | ------------------------------ |
2989| 202     | Permission verification failed. A non-system application calls a system API. |
2990| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
2991| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
2992| 1300002 | This window state is abnormal. |
2993| 1300003 | This window manager service works abnormally. |
2994
2995**Example**
2996
2997```ts
2998// EntryAbility.ets
2999import { UIAbility } from '@kit.AbilityKit';
3000import { BusinessError } from '@kit.BasicServicesKit';
3001
3002export default class EntryAbility extends UIAbility {
3003    onWindowStageCreate(windowStage) {
3004        // Load content for the main window.
3005        windowStage.loadContent("pages/page2", (err) => {
3006            if (err.code) {
3007                console.error(`Failed to load the content. Cause code: ${err.code}, message: ${err.message}`);
3008                return;
3009            }
3010            console.info('Succeeded in loading the content.');
3011        });
3012        // Obtain the main window.
3013        let mainWindow: window.Window | undefined = undefined;
3014
3015        windowStage.getMainWindow((err, data) => {
3016            if (err.code) {
3017                console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
3018                return;
3019            }
3020            mainWindow = data;
3021            console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
3022
3023            let enabled = false;
3024            // Promise object of the setResizeByDragEnabled API.
3025            let promise = mainWindow.setResizeByDragEnabled(enabled);
3026            promise.then(()=> {
3027                console.info('Succeeded in setting the function of disabling the resize by dragg window.');
3028            }).catch((err: BusinessError)=>{
3029                console.error(`Failed to set the function of disabling the resize by dragg window. Cause code: ${err.code}, message: ${err.message}`);
3030            });
3031        });
3032    }
3033};
3034```
3035
3036### hideNonSystemFloatingWindows<sup>11+</sup>
3037
3038hideNonSystemFloatingWindows(shouldHide: boolean, callback: AsyncCallback&lt;void&gt;): void
3039
3040Sets whether to hide non-system floating windows. This API uses an asynchronous callback to return the result.
3041
3042A 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.
3043
3044**System API**: This is a system API.
3045
3046**System capability**: SystemCapability.Window.SessionManager
3047
3048**Parameters**
3049
3050| Name     | Type                     | Mandatory| Description      |
3051| ----------- | ------------------------- | ---- | ---------- |
3052| shouldHide  | boolean                   | Yes  | Whether to hide non-system floating windows. The value **true** means to hide the floating windows, and **false** means the opposite.|
3053| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
3054
3055**Error codes**
3056
3057For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3058
3059| ID| Error Message|
3060| ------- | ------------------------------ |
3061| 202     | Permission verification failed. A non-system application calls a system API. |
3062| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3063| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3064| 1300002 | This window state is abnormal. |
3065| 1300003 | This window manager service works abnormally. |
3066| 1300004 | Unauthorized operation. |
3067
3068**Example**
3069
3070```ts
3071// EntryAbility.ets
3072import { UIAbility, Want } from '@kit.AbilityKit';
3073
3074export default class EntryAbility extends UIAbility {
3075  onWindowStageCreate(windowStage: window.WindowStage) {
3076    // Load the page corresponding to the main window.
3077    windowStage.loadContent('pages/Index', (err) => {
3078      if (err.code) {
3079        console.error(`Failed to load the content. Cause code: ${err.code}, message: ${err.message}`);
3080        return;
3081      }
3082      console.info('Succeeded in loading the content.');
3083    });
3084
3085    // Obtain the main window.
3086    let mainWindow: window.Window | undefined = undefined;
3087    windowStage.getMainWindow((err, data) => {
3088      if (err.code) {
3089        console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
3090        return;
3091      }
3092      mainWindow = data;
3093      console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
3094
3095      let shouldHide = true;
3096      // Call hideNonSystemFloatingWindows with the callback parameter.
3097      mainWindow.hideNonSystemFloatingWindows(shouldHide, (err) => {
3098        if (err.code) {
3099          console.error(`Failed to hide the non-system floating windows. Cause code: ${err.code}, message: ${err.message}`);
3100          return;
3101        }
3102        console.info('Succeeded in hiding the non-system floating windows.');
3103      });
3104    });
3105  }
3106}
3107```
3108
3109### hideNonSystemFloatingWindows<sup>11+</sup>
3110
3111hideNonSystemFloatingWindows(shouldHide: boolean): Promise&lt;void&gt;
3112
3113Sets whether to hide non-system floating windows. This API uses an asynchronous callback to return the result.
3114
3115A 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.
3116
3117**System API**: This is a system API.
3118
3119**System capability**: SystemCapability.Window.SessionManager
3120
3121**Parameters**
3122
3123| Name     | Type                     | Mandatory| Description      |
3124| ----------- | ------------------------- | ---- | ---------- |
3125| shouldHide  | boolean                   | Yes  | Whether to hide non-system floating windows. The value **true** means to hide the floating windows, and **false** means the opposite.|
3126
3127**Return value**
3128
3129| Type               | Description                     |
3130| ------------------- | ------------------------- |
3131| Promise&lt;void&gt; | Promise that returns no value.|
3132
3133**Error codes**
3134
3135For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3136
3137| ID| Error Message|
3138| ------- | ------------------------------ |
3139| 202     | Permission verification failed. A non-system application calls a system API. |
3140| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3141| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3142| 1300002 | This window state is abnormal. |
3143| 1300003 | This window manager service works abnormally. |
3144| 1300004 | Unauthorized operation. |
3145
3146**Example**
3147
3148```ts
3149// EntryAbility.ets
3150import { UIAbility, Want } from '@kit.AbilityKit';
3151import { BusinessError } from '@kit.BasicServicesKit';
3152
3153export default class EntryAbility extends UIAbility {
3154  onWindowStageCreate(windowStage: window.WindowStage) {
3155    // Load the page corresponding to the main window.
3156    windowStage.loadContent('pages/Index', (err) => {
3157      if (err.code) {
3158        console.error(`Failed to load the content. Cause code: ${err.code}, message: ${err.message}`);
3159        return;
3160      }
3161      console.info('Succeeded in loading the content.');
3162    });
3163
3164    // Obtain the main window.
3165    let mainWindow: window.Window | undefined = undefined;
3166    windowStage.getMainWindow((err, data) => {
3167      if (err.code) {
3168        console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
3169        return;
3170      }
3171      mainWindow = data;
3172      console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
3173
3174      let shouldHide = true;
3175      // Call hideNonSystemFloatingWindows to obtain a promise object.
3176      let promise = mainWindow.hideNonSystemFloatingWindows(shouldHide);
3177      promise.then(()=> {
3178        console.info('Succeeded in hiding the non-system floating windows.');
3179      }).catch((err: BusinessError)=>{
3180        console.error(`Failed to hide the non-system floating windows. Cause code: ${err.code}, message: ${err.message}`);
3181      });
3182    });
3183  }
3184}
3185```
3186
3187### setTopmost<sup>12+</sup>
3188
3189setTopmost(isTopmost: boolean): Promise&lt;void&gt;
3190
3191Called by the main window to place the window above all the other windows. This API uses a promise to return the result.
3192
3193This parameter is valid only when the main window is a floating window in 2-in-1 devices.
3194
3195**System API**: This is a system API.
3196
3197**System capability**: SystemCapability.Window.SessionManager
3198
3199**Parameters**
3200
3201| Name  | Type                     | Mandatory| Description      |
3202| -------- | ------------------------- | ---- | ---------- |
3203| 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.|
3204
3205**Return value**
3206
3207| Type               | Description                     |
3208| ------------------- | ------------------------- |
3209| Promise&lt;void&gt; | Promise that returns no value.|
3210
3211**Error codes**
3212
3213For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3214
3215| ID| Error Message|
3216| ------- | ------------------------------ |
3217| 202     | Permission verification failed. A non-system application calls a system API. |
3218| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3219| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3220| 1300002 | This window state is abnormal.                |
3221| 1300003 | This window manager service works abnormally. |
3222| 1300004 | Unauthorized operation.                       |
3223
3224**Example**
3225
3226```ts
3227// EntryAbility.ets
3228import { UIAbility } from '@kit.AbilityKit';
3229import { BusinessError } from '@kit.BasicServicesKit';
3230
3231export default class EntryAbility extends UIAbility {
3232  // ...
3233  onWindowStageCreate(windowStage: window.WindowStage): void {
3234    // ...
3235    windowStage.getMainWindow().then((window) => {
3236      let isTopmost: boolean = true;
3237      let promise = window.setTopmost(isTopmost);
3238      promise.then(() => {
3239        console.info('Succeeded in setting the main window to be topmost.');
3240      }).catch((err: BusinessError) => {
3241        console.error(`Failed to set the main window to be topmost. Cause code: ${err.code}, message: ${err.message}`);
3242      });
3243    });
3244  }
3245}
3246```
3247
3248### setSingleFrameComposerEnabled<sup>11+</sup>
3249
3250setSingleFrameComposerEnabled(enable: boolean): Promise&lt;void&gt;
3251
3252Enables or disables the single-frame composer. This API uses a promise to return the result.
3253
3254The single-frame composer is mainly used in scenarios that requires extremely low interaction latency. It reduces the screen display latency of the rendering node.
3255
3256**System API**: This is a system API.
3257
3258**System capability**: SystemCapability.Window.SessionManager
3259
3260**Parameters**
3261
3262| Name  | Type                     | Mandatory| Description      |
3263| -------- | ------------------------- | ---- | ---------- |
3264| 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.|
3265
3266**Return value**
3267
3268| Type               | Description                     |
3269| ------------------- | ------------------------- |
3270| Promise&lt;void&gt; | Promise that returns no value.|
3271
3272**Error codes**
3273
3274For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3275
3276| ID| Error Message|
3277| ------- | ------------------------------ |
3278| 202     | Permission verification failed. A non-system application calls a system API. |
3279| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3280| 801     | Capability not supported. Failed to call the API due to limited device capabilities. |
3281| 1300002 | This window state is abnormal. |
3282
3283**Example**
3284
3285```ts
3286import { BusinessError } from '@kit.BasicServicesKit';
3287
3288let enable = true;
3289let promise = windowClass.setSingleFrameComposerEnabled(enable);
3290promise.then(()=> {
3291    console.info('Succeeded in enabling the single-frame-composer function.');
3292}).catch((err: BusinessError)=>{
3293    console.error(`Failed to enable the single-frame-composer function. code:${err.code}, message:${err.message}.`);
3294});
3295```
3296
3297### setTitleButtonVisible<sup>12+</sup>
3298
3299setTitleButtonVisible(isMaximizeVisible: boolean, isMinimizeVisible: boolean, isSplitVisible: boolean): void
3300
3301Shows or hides the maximize, minimize, and split-screen buttons on the title bar of the main window.
3302
3303This 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.
3304
3305**System API**: This is a system API.
3306
3307**System capability**: SystemCapability.Window.SessionManager
3308
3309**Parameters**
3310
3311| Name   | Type   | Mandatory| Description                                         |
3312| --------- | ------- | ---- | --------------------------------------------- |
3313| isMaximizeVisible | boolean | Yes  | Whether to show the maximize button. The value **true** means to show the button, and **false** means to hide it.|
3314| isMinimizeVisible | boolean | Yes  | Whether to show the minimize button. The value **true** means to show the button, and **false** means to hide it.|
3315| isSplitVisible | boolean | Yes  | Whether to show the split-screen button. The value **true** means to show the button, and **false** means to hide it.|
3316
3317**Error codes**
3318
3319For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3320
3321| ID| Error Message                      |
3322| -------- | ------------------------------ |
3323| 202      | Permission verification failed. A non-system application calls a system API. |
3324| 401      | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3325| 801      | Capability not supported. Failed to call the API due to limited device capabilities. |
3326| 1300002  | This window state is abnormal. |
3327| 1300004  | Unauthorized operation. |
3328
3329**Example**
3330
3331```ts
3332// EntryAbility.ets
3333import { UIAbility } from '@kit.AbilityKit';
3334import { BusinessError } from '@kit.BasicServicesKit';
3335
3336export default class EntryAbility extends UIAbility {
3337  onWindowStageCreate(windowStage: window.WindowStage): void {
3338    // Load the page corresponding to the main window.
3339    windowStage.loadContent('pages/Index', (err) => {
3340      let mainWindow: window.Window | undefined = undefined;
3341      // Obtain the main window.
3342      windowStage.getMainWindow().then(
3343        data => {
3344          mainWindow = data;
3345          console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
3346          // Call setTitleButtonVisible to hide the maximize, minimize, and split-screen buttons on the title bar of the main window.
3347          mainWindow.setTitleButtonVisible(false, false, false);
3348        }
3349      ).catch((err: BusinessError) => {
3350          if(err.code){
3351            console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
3352          }
3353      });
3354    });
3355  }
3356}
3357```
3358
3359### setWindowType<sup>(deprecated)</sup>
3360
3361setWindowType(type: WindowType, callback: AsyncCallback&lt;void&gt;): void
3362
3363Sets the type of this window. This API uses an asynchronous callback to return the result.
3364
3365**System API**: This is a system API.
3366
3367> **NOTE**
3368>
3369> This API is supported since API version 7 and deprecated since API version 9.
3370
3371**System capability**: SystemCapability.WindowManager.WindowManager.Core
3372
3373**Parameters**
3374
3375| Name  | Type                     | Mandatory| Description      |
3376| -------- | ------------------------- | ---- | ---------- |
3377| type     | [WindowType](#windowtype7) | Yes  | Window type.|
3378| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
3379
3380**Example**
3381
3382```ts
3383import { BusinessError } from '@kit.BasicServicesKit';
3384
3385let type = window.WindowType.TYPE_SYSTEM_ALERT;
3386windowClass.setWindowType(type, (err: BusinessError) => {
3387  const errCode: number = err.code;
3388  if (errCode) {
3389    console.error(`Failed to set the window type. Cause code: ${err.code}, message: ${err.message}`);
3390    return;
3391  }
3392  console.info('Succeeded in setting the window type.');
3393});
3394```
3395
3396### setWindowType<sup>(deprecated)</sup>
3397
3398setWindowType(type: WindowType): Promise&lt;void&gt;
3399
3400Sets the type of this window. This API uses a promise to return the result.
3401
3402**System API**: This is a system API.
3403
3404> **NOTE**
3405>
3406> This API is supported since API version 7 and deprecated since API version 9.
3407
3408**System capability**: SystemCapability.WindowManager.WindowManager.Core
3409
3410**Parameters**
3411
3412| Name| Type                     | Mandatory| Description      |
3413| ------ | ------------------------- | ---- | ---------- |
3414| type   | [WindowType](#windowtype7) | Yes  | Window type.|
3415
3416**Return value**
3417
3418| Type               | Description                     |
3419| ------------------- | ------------------------- |
3420| Promise&lt;void&gt; | Promise that returns no value.|
3421
3422**Example**
3423
3424```ts
3425import { BusinessError } from '@kit.BasicServicesKit';
3426
3427let type = window.WindowType.TYPE_SYSTEM_ALERT;
3428let promise = windowClass.setWindowType(type);
3429promise.then(() => {
3430  console.info('Succeeded in setting the window type.');
3431}).catch((err: BusinessError) => {
3432  console.error(`Failed to set the window type. Cause code: ${err.code}, message: ${err.message}`);
3433});
3434```
3435
3436## SubWindowOptions<sup>11+</sup>
3437
3438Describes the parameters used for creating a subwindow.
3439
3440**System capability**: SystemCapability.Window.SessionManager
3441
3442| Name     | Type | Read Only| Optional| Description        |
3443| ---------- | ---- | ---- | ---- | ----------- |
3444| 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**.      |
3445
3446## WindowStage<sup>9+</sup>
3447
3448Implements a window manager, which manages each basic window unit, that is, [Window](#window) instance.
3449
3450Before 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.
3451
3452### disableWindowDecor<sup>9+</sup>
3453
3454disableWindowDecor(): void
3455
3456Disables window decorators.
3457
3458**Model restriction**: This API can be used only in the stage model.
3459
3460**System API**: This is a system API.
3461
3462**System capability**: SystemCapability.WindowManager.WindowManager.Core
3463
3464**Error codes**
3465
3466For details about the error codes, see [Window Error Codes](errorcode-window.md).
3467
3468| ID| Error Message|
3469| ------- | ------------------------------ |
3470| 202     | Permission verification failed. A non-system application calls a system API. |
3471| 1300002 | This window state is abnormal. |
3472| 1300005 | This window stage is abnormal. |
3473
3474**Example**
3475
3476```ts
3477// EntryAbility.ets
3478import { UIAbility, Want } from '@kit.AbilityKit';
3479
3480export default class EntryAbility extends UIAbility {
3481  // ...
3482
3483  onWindowStageCreate(windowStage: window.WindowStage) {
3484    console.log('disableWindowDecor');
3485    windowStage.disableWindowDecor();
3486  }
3487};
3488```
3489
3490### setShowOnLockScreen<sup>9+</sup>
3491
3492setShowOnLockScreen(showOnLockScreen: boolean): void
3493
3494Sets whether to display the window of the application on the lock screen.
3495
3496**System API**: This is a system API.
3497
3498**Model restriction**: This API can be used only in the stage model.
3499
3500**System capability**: SystemCapability.WindowManager.WindowManager.Core
3501
3502**Parameters**
3503
3504| Name          | Type   | Mandatory| Description                        |
3505| ---------------- | ------- | ---- | ---------------------------- |
3506| 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.|
3507
3508**Error codes**
3509
3510For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Window Error Codes](errorcode-window.md).
3511
3512| ID| Error Message|
3513| ------- | ------------------------------ |
3514| 202     | Permission verification failed. A non-system application calls a system API. |
3515| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
3516| 1300002 | This window state is abnormal. |
3517| 1300005 | This window stage is abnormal. |
3518
3519**Example**
3520
3521```ts
3522// EntryAbility.ets
3523import { UIAbility } from '@kit.AbilityKit';
3524
3525export default class EntryAbility extends UIAbility {
3526  // ...
3527
3528  onWindowStageCreate(windowStage: window.WindowStage) {
3529    console.log('onWindowStageCreate');
3530    try {
3531      windowStage.setShowOnLockScreen(true);
3532    } catch (exception) {
3533      console.error(`Failed to show on lockscreen. Cause code: ${exception.code}, message: ${exception.message}`);
3534    }
3535  }
3536};
3537```
3538
3539## TransitionContext<sup>9+</sup>
3540
3541Provides the context for the transition animation.
3542
3543**System API**: This is a system API.
3544
3545### Attributes
3546
3547**System API**: This is a system API.
3548
3549**System capability**: SystemCapability.WindowManager.WindowManager.Core
3550
3551| Name                 | Type         | Readable| Writable| Description            |
3552| --------------------- | ----------------- | ---- | ---- | ---------------- |
3553| toWindow<sup>9+</sup> | [Window](#window) | Yes  | Yes  | Target window to display the animation.|
3554
3555### completeTransition<sup>9+</sup>
3556
3557completeTransition(isCompleted: boolean): void
3558
3559Completes the transition. This API can be called only after [animateTo()](arkui-ts/ts-explicit-animation.md) is executed.
3560
3561**System API**: This is a system API.
3562
3563**System capability**: SystemCapability.WindowManager.WindowManager.Core
3564
3565**Parameters**
3566
3567| Name     | Type   | Mandatory| Description                                                        |
3568| ----------- | ------- | ---- | ------------------------------------------------------------ |
3569| isCompleted | boolean | Yes  | Whether the transition is complete. The value **true** means that the transition is complete, and **false** means the opposite.|
3570
3571**Error codes**
3572
3573For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
3574
3575| ID| Error Message|
3576| ------- | -------------------------------- |
3577| 202     | Permission verification failed. A non-system application calls a system API. |
3578| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.               |
3579
3580**Example**
3581
3582```ts
3583(context: window.TransitionContext) => {
3584  let toWindow: window.Window = context.toWindow;
3585  animateTo({
3586    duration: 1000, // Animation duration.
3587    tempo: 0.5, // Playback speed.
3588    curve: Curve.EaseInOut, // Animation curve.
3589    delay: 0, // Animation delay.
3590    iterations: 1, // Number of playback times.
3591    playMode: PlayMode.Normal // Animation playback mode.
3592  }, () => {
3593    let obj: window.TranslateOptions = {
3594      x: 100.0,
3595      y: 0.0,
3596      z: 0.0
3597    };
3598    toWindow.translate(obj);
3599    console.info('toWindow translate end');
3600  }
3601  );
3602  try {
3603    context.completeTransition(true)
3604  } catch (exception) {
3605    console.error(`toWindow translate fail. Cause code: ${exception.code}, message: ${exception.message}`);
3606  }
3607  console.info('complete transition end');
3608};
3609```
3610
3611## TransitionController<sup>9+</sup>
3612
3613Implements the transition animation controller. Before calling any API, you must create a system window. For details, see the sample code.
3614
3615**System API**: This is a system API.
3616
3617**Example**
3618
3619```ts
3620import { BusinessError } from '@kit.BasicServicesKit';
3621
3622let windowClass: window.Window | undefined = undefined;
3623let config: window.Configuration = {
3624  name: "systemTypeWindow",
3625  windowType: window.WindowType.TYPE_PANEL, // Select a system window type as required.
3626  ctx: this.context
3627};
3628let promise = window.createWindow(config);
3629promise.then((data) => {
3630  windowClass = data;
3631  console.info('Succeeded in creating the window. Data:' + JSON.stringify(data));
3632}).catch((err: BusinessError) => {
3633  console.error(`Failed to create the Window. Cause code: ${err.code}, message: ${err.message}`);
3634});
3635```
3636
3637### animationForShown<sup>9+</sup>
3638
3639animationForShown(context: TransitionContext): void
3640
3641Customizes the animation for the scenario when the window is shown.
3642
3643**System API**: This is a system API.
3644
3645**System capability**: SystemCapability.WindowManager.WindowManager.Core
3646
3647**Parameters**
3648
3649| Name | Type                                    | Mandatory| Description                |
3650| ------- | ---------------------------------------- | ---- | -------------------- |
3651| context | [TransitionContext](#transitioncontext9) | Yes  | Context of the transition animation.|
3652
3653**Error codes**
3654
3655For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
3656
3657| ID| Error Message|
3658| ------- | -------------------------------- |
3659| 202     | Permission verification failed. A non-system application calls a system API. |
3660| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.               |
3661
3662**Example**
3663
3664```ts
3665// xxx.ts
3666export class AnimationConfig {
3667  private animationForShownCallFunc_: Function = undefined;
3668  ShowWindowWithCustomAnimation(windowClass: window.Window, callback) {
3669    if (!windowClass) {
3670      console.error('windowClass is undefined');
3671      return false;
3672    }
3673    this.animationForShownCallFunc_ = callback;
3674    let controller: window.TransitionController = windowClass.getTransitionController();
3675    controller.animationForShown = (context : window.TransitionContext)=> {
3676      this.animationForShownCallFunc_(context);
3677    };
3678    windowClass.showWithAnimation(()=>{
3679      console.info('Show with animation success');
3680    });
3681  }
3682}
3683```
3684
3685```ts
3686// xxx.ets
3687let animationConfig = new AnimationConfig();
3688let systemTypeWindow = window.findWindow("systemTypeWindow"); // Obtain a system window.
3689try {
3690  animationConfig?.ShowWindowWithCustomAnimation(systemTypeWindow, (context : window.TransitionContext)=>{
3691    console.info('complete transition end');
3692    let toWindow = context.toWindow;
3693    animateTo({
3694      duration: 1000, // Animation duration.
3695      tempo: 0.5, // Playback speed.
3696      curve: Curve.EaseInOut, // Animation curve.
3697      delay: 0, // Animation delay.
3698      iterations: 1, // Number of playback times.
3699      playMode: PlayMode.Normal // Animation playback mode.
3700      onFinish: () => {
3701        console.info('onFinish in animation');
3702        context.completeTransition(true)
3703      }
3704    }, () => {
3705      let obj : window.TranslateOptions = {
3706        x : 100.0,
3707        y : 0.0,
3708        z : 0.0
3709      };
3710      toWindow.translate(obj); // Set the transition animation.
3711      console.info('toWindow translate end in animation');
3712    });
3713    console.info('complete transition end');
3714  });
3715} catch (error) {
3716  console.error(`ShowWindowWithCustomAnimation error code: ${error.code}, message: ${error.message}`);
3717}
3718```
3719
3720### animationForHidden<sup>9+</sup>
3721
3722animationForHidden(context: TransitionContext): void
3723
3724Customizes the animation for the scenario when the window is hidden.
3725
3726**System API**: This is a system API.
3727
3728**System capability**: SystemCapability.WindowManager.WindowManager.Core
3729
3730**Parameters**
3731
3732| Name | Type                                    | Mandatory| Description                |
3733| ------- | ---------------------------------------- | ---- | -------------------- |
3734| context | [TransitionContext](#transitioncontext9) | Yes  | Context of the transition animation.|
3735
3736**Error codes**
3737
3738For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
3739
3740| ID| Error Message|
3741| ------- | -------------------------------- |
3742| 202     | Permission verification failed. A non-system application calls a system API. |
3743| 401     | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.               |
3744
3745**Example**
3746
3747```ts
3748// xxx.ts
3749export class AnimationConfig {
3750  private animationForHiddenCallFunc_: Function = undefined;
3751  HideWindowWithCustomAnimation(windowClass: window.Window, callback) {
3752    if (!windowClass) {
3753      console.error('windowClass is undefined');
3754      return false;
3755    }
3756    this.animationForHiddenCallFunc_ = callback;
3757    let controller: window.TransitionController = windowClass.getTransitionController();
3758    controller.animationForHidden = (context : window.TransitionContext)=> {
3759      this.animationForHiddenCallFunc_(context);
3760    };
3761    windowClass.hideWithAnimation(()=>{
3762      console.info('hide with animation success');
3763    });
3764  }
3765}
3766```
3767
3768```ts
3769// xxx.ets
3770let animationConfig = new AnimationConfig();
3771let systemTypeWindow = window.findWindow("systemTypeWindow"); // Obtain a system window.
3772try {
3773  animationConfig?.HideWindowWithCustomAnimation(systemTypeWindow, (context : window.TransitionContext)=>{
3774    console.info('complete transition end');
3775    let toWindow = context.toWindow;
3776    animateTo({
3777      duration: 1000, // Animation duration.
3778      tempo: 0.5, // Playback speed.
3779      curve: Curve.EaseInOut, // Animation curve.
3780      delay: 0, // Animation delay.
3781      iterations: 1, // Number of playback times.
3782      playMode: PlayMode.Normal // Animation playback mode.
3783      onFinish: () => {
3784        console.info('onFinish in animation');
3785        context.completeTransition(true)
3786      }
3787    }, () => {
3788      let obj : window.TranslateOptions = {
3789        x : 100.0,
3790        y : 0.0,
3791        z : 0.0
3792      };
3793      toWindow.translate(obj); // Set the transition animation.
3794      console.info('toWindow translate end in animation');
3795    });
3796    console.info('complete transition end');
3797  });
3798} catch (error) {
3799  console.error(`HideWindowWithCustomAnimation error code: ${error.code}, message: ${error.message}` );
3800}
3801```
3802
3803## ExtensionWindowAttribute<sup>12+</sup>
3804
3805Enumerates the attributes of a window for a UI ServiceExtensionAbility.
3806
3807**Model restriction**: This API can be used only in the stage model.
3808
3809**System API**: This is a system API.
3810
3811**System capability**: SystemCapability.Window.SessionManager
3812
3813| Name     | Value| Description        |
3814| ---------- | ----- | ----------- |
3815| SYSTEM_WINDOW  | 0 | System window|
3816| SUB_WINDOW  | 1 | Subwindow.|
3817
3818## SystemWindowOptions<sup>12+</sup>
3819
3820Describes the parameters for creating a system window.
3821
3822**Model restriction**: This API can be used only in the stage model.
3823
3824**System API**: This is a system API.
3825
3826**System capability**: SystemCapability.Window.SessionManager
3827
3828| Name| Type                     | Read Only |Optional| Description      |
3829| ------ | ------------------------- | ---- | ---- |---------- |
3830| windowType   | [WindowType](#windowtype7) | No  | No  | Window type. There is no default value. If null is passed in, the window fails to be created.|
3831
3832## ExtensionWindowConfig<sup>12+</sup>
3833
3834Describes the parameters for creating a window for a UI ServiceExtensionAbility.
3835
3836**Model restriction**: This API can be used only in the stage model.
3837
3838**System API**: This is a system API.
3839
3840**System capability**: SystemCapability.Window.SessionManager
3841
3842| Name| Type                     | Read Only |Optional| Description      |
3843| ------ | ------------------------- | ---- | ---- |---------- |
3844| windowName   | string | No| No | Window name.|
3845| 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.|
3846| windowRect   | [Rect](js-apis-window.md#rect7) | No| No  | Rectangular area of the window.|
3847| 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.|
3848| 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.|
3849