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