1/* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkUI 19 */ 20 21import { AsyncCallback, Callback } from './@ohos.base'; 22 23/** 24 * Interface of screen manager 25 * 26 * @namespace screen 27 * @syscap SystemCapability.WindowManager.WindowManager.Core 28 * @systemapi Hide this for inner system use. 29 * @since 9 30 */ 31declare namespace screen { 32 /** 33 * Get all screen instances, then can get or set detail information. 34 * 35 * @param { AsyncCallback<Array<Screen>> } callback the callback of all screens info 36 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 37 * @throws { BusinessError } 1400001 - Invalid display or screen. 38 * @syscap SystemCapability.WindowManager.WindowManager.Core 39 * @systemapi Hide this for inner system use. 40 * @since 9 41 */ 42 function getAllScreens(callback: AsyncCallback<Array<Screen>>): void; 43 44 /** 45 * Get all screen instances, then can get or set detail information. 46 * 47 * @returns { Promise<Array<Screen>> } the result of all screens info 48 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 49 * @throws { BusinessError } 1400001 - Invalid display or screen. 50 * @syscap SystemCapability.WindowManager.WindowManager.Core 51 * @systemapi Hide this for inner system use. 52 * @since 9 53 */ 54 function getAllScreens(): Promise<Array<Screen>>; 55 56 /** 57 * Register the callback for screen changes. 58 * 59 * @param { 'connect' | 'disconnect' | 'change' } eventType the event of screen changes. This parameter is of string 60 * type and cannot be empty. 61 * @param { Callback<number> } callback Callback used to return the screen ID. This parameter is callable. 62 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 63 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 64 * <br>2. Incorrect parameter types. 65 * @syscap SystemCapability.WindowManager.WindowManager.Core 66 * @systemapi Hide this for inner system use. 67 * @since 9 68 */ 69 function on(eventType: 'connect' | 'disconnect' | 'change', callback: Callback<number>): void; 70 71 /** 72 * Unregister the callback for screen changes. 73 * 74 * @param { 'connect' | 'disconnect' | 'change' } eventType the event of screen changes. This parameter is of string 75 * type and cannot be empty. 76 * @param { Callback<number> } callback Callback used to return the screen ID. If this parameter is specified, it must 77 * be a callback. 78 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 79 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 80 * <br>2. Incorrect parameter types. 81 * @syscap SystemCapability.WindowManager.WindowManager.Core 82 * @systemapi Hide this for inner system use. 83 * @since 9 84 */ 85 function off(eventType: 'connect' | 'disconnect' | 'change', callback?: Callback<number>): void; 86 87 /** 88 * Make screens as expand-screen 89 * 90 * @param { Array<ExpandOption> } options Parameters for expanding the screen. The options must be valid, and make 91 * sure it's type of Array<ExpandOption>. 92 * @param { AsyncCallback<number> } callback callback used to return the group ID of the expanded screens. It must 93 * be a callback. 94 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 95 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 96 * <br>2. Incorrect parameter types. 97 * @throws { BusinessError } 1400001 - Invalid display or screen. 98 * @syscap SystemCapability.WindowManager.WindowManager.Core 99 * @systemapi Hide this for inner system use. 100 * @since 9 101 */ 102 function makeExpand(options: Array<ExpandOption>, callback: AsyncCallback<number>): void; 103 104 /** 105 * Make screens as expand-screen 106 * 107 * @param { Array<ExpandOption> } options Parameters for expanding the screen. The options must be valid, and make 108 * sure it's type of Array<ExpandOption>. 109 * @returns { Promise<number> } used to return the group ID of the expanded screens 110 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 111 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 112 * <br>2. Incorrect parameter types. 113 * @throws { BusinessError } 1400001 - Invalid display or screen. 114 * @syscap SystemCapability.WindowManager.WindowManager.Core 115 * @systemapi Hide this for inner system use. 116 * @since 9 117 */ 118 function makeExpand(options: Array<ExpandOption>): Promise<number>; 119 120 /** 121 * Stop expand screens 122 * 123 * @param { Array<number> } expandScreen IDs of expand screens to stop. The size of the expandScreen Array should not 124 * exceed 1000. 125 * @param { AsyncCallback<void> } callback used to return the result 126 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 127 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 128 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 129 * @throws { BusinessError } 1400001 - Invalid display or screen. 130 * @syscap SystemCapability.WindowManager.WindowManager.Core 131 * @systemapi Hide this for inner system use. 132 * @since 10 133 */ 134 function stopExpand(expandScreen: Array<number>, callback: AsyncCallback<void>): void; 135 136 /** 137 * Stop expand screens 138 * 139 * @param { Array<number> } expandScreen IDs of expand screens to stop. The size of the expandScreen Array should not 140 * exceed 1000. 141 * @returns { Promise<void> } promise used to return the result 142 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 143 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 144 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 145 * @throws { BusinessError } 1400001 - Invalid display or screen. 146 * @syscap SystemCapability.WindowManager.WindowManager.Core 147 * @systemapi Hide this for inner system use. 148 * @since 10 149 */ 150 function stopExpand(expandScreen: Array<number>): Promise<void>; 151 152 /** 153 * Make screens as mirror-screen 154 * 155 * @param { number } mainScreen ID of the primary screen. It's type should be int. 156 * @param { Array<number> } mirrorScreen IDs of secondary screens 157 * @param { AsyncCallback<number> } callback Callback used to return the group ID of the secondary screens 158 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 159 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 160 * <br>2. Incorrect parameter types. 161 * @throws { BusinessError } 1400001 - Invalid display or screen. 162 * @syscap SystemCapability.WindowManager.WindowManager.Core 163 * @systemapi Hide this for inner system use. 164 * @since 9 165 */ 166 function makeMirror(mainScreen: number, mirrorScreen: Array<number>, callback: AsyncCallback<number>): void; 167 168 /** 169 * Make screens as mirror-screen 170 * 171 * @param { number } mainScreen ID of the primary screen. It's type should be int. 172 * @param { Array<number> } mirrorScreen IDs of secondary screens 173 * @returns { Promise<number> } Promise used to return the group ID of the secondary screens 174 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 175 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 176 * <br>2. Incorrect parameter types. 177 * @throws { BusinessError } 1400001 - Invalid display or screen. 178 * @syscap SystemCapability.WindowManager.WindowManager.Core 179 * @systemapi Hide this for inner system use. 180 * @since 9 181 */ 182 function makeMirror(mainScreen: number, mirrorScreen: Array<number>): Promise<number>; 183 184 /** 185 * Stop mirror screens 186 * 187 * @param { Array<number> } mirrorScreen IDs of mirror screens to stop. The size of the mirrorScreen Array should not 188 * exceed 1000. 189 * @param { AsyncCallback<void> } callback used to return the result 190 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 191 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 192 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 193 * @throws { BusinessError } 1400001 - Invalid display or screen. 194 * @syscap SystemCapability.WindowManager.WindowManager.Core 195 * @systemapi Hide this for inner system use. 196 * @since 10 197 */ 198 function stopMirror(mirrorScreen: Array<number>, callback: AsyncCallback<void>): void; 199 200 /** 201 * Stop mirror screens 202 * 203 * @param { Array<number> } mirrorScreen IDs of mirror screens to stop. The size of the mirrorScreen Array should not 204 * exceed 1000. 205 * @returns { Promise<void> } promise used to return the result 206 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 207 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 208 * 2. Incorrect parameter types. 3. Parameter verification failed. 209 * @throws { BusinessError } 1400001 - Invalid display or screen. 210 * @syscap SystemCapability.WindowManager.WindowManager.Core 211 * @systemapi Hide this for inner system use. 212 * @since 10 213 */ 214 function stopMirror(mirrorScreen: Array<number>): Promise<void>; 215 216 /** 217 * Create virtual screen. if surfaceId is valid, this permission is necessary. 218 * 219 * @permission ohos.permission.CAPTURE_SCREEN 220 * @param { VirtualScreenOption } options Indicates the options of the virtual screen. 221 * @param { AsyncCallback<Screen> } callback Callback used to return the created virtual screen 222 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 223 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 224 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 225 * <br>2. Incorrect parameter types. 226 * @throws { BusinessError } 1400001 - Invalid display or screen. 227 * @syscap SystemCapability.WindowManager.WindowManager.Core 228 * @systemapi Hide this for inner system use. 229 * @since 9 230 */ 231 function createVirtualScreen(options: VirtualScreenOption, callback: AsyncCallback<Screen>): void; 232 233 /** 234 * Create virtual screen. if surfaceId is valid, this permission is necessary. 235 * 236 * @permission ohos.permission.CAPTURE_SCREEN 237 * @param { VirtualScreenOption } options Indicates the options of the virtual screen. 238 * @returns { Promise<Screen> } Promise used to return the created virtual screen 239 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 240 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 241 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 242 * 2. Incorrect parameter types. 243 * @throws { BusinessError } 1400001 - Invalid display or screen. 244 * @syscap SystemCapability.WindowManager.WindowManager.Core 245 * @systemapi Hide this for inner system use. 246 * @since 9 247 */ 248 function createVirtualScreen(options: VirtualScreenOption): Promise<Screen>; 249 250 /** 251 * Destroy virtual screen. 252 * 253 * @param { number } screenId Indicates the screen id of the virtual screen. 254 * @param { AsyncCallback<void> } callback Callback used to return the result. 255 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 256 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 257 * <br>2. Incorrect parameter types. 258 * @throws { BusinessError } 1400002 - Unauthorized operation. 259 * @syscap SystemCapability.WindowManager.WindowManager.Core 260 * @systemapi Hide this for inner system use. 261 * @since 9 262 */ 263 function destroyVirtualScreen(screenId: number, callback: AsyncCallback<void>): void; 264 265 /** 266 * Destroy virtual screen. 267 * 268 * @param { number } screenId Indicates the screen id of the virtual screen. 269 * @returns { Promise<void> } Promise that returns no value. 270 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 271 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 272 * <br>2. Incorrect parameter types. 273 * @throws { BusinessError } 1400002 - Unauthorized operation. 274 * @syscap SystemCapability.WindowManager.WindowManager.Core 275 * @systemapi Hide this for inner system use. 276 * @since 9 277 */ 278 function destroyVirtualScreen(screenId: number): Promise<void>; 279 280 /** 281 * Set surface for the virtual screen. 282 * 283 * @permission ohos.permission.CAPTURE_SCREEN 284 * @param { number } screenId Indicates the screen id of the virtual screen. 285 * @param { string } surfaceId Indicates the surface id. 286 * @param { AsyncCallback<void> } callback Callback used to return the result 287 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 288 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 289 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 290 * <br>2. Incorrect parameter types. 291 * @throws { BusinessError } 1400001 - Invalid display or screen. 292 * @syscap SystemCapability.WindowManager.WindowManager.Core 293 * @systemapi Hide this for inner system use. 294 * @since 9 295 */ 296 function setVirtualScreenSurface(screenId: number, surfaceId: string, callback: AsyncCallback<void>): void; 297 298 /** 299 * Set surface for the virtual screen. 300 * 301 * @permission ohos.permission.CAPTURE_SCREEN 302 * @param { number } screenId Indicates the screen id of the virtual screen. 303 * @param { string } surfaceId Indicates the surface id. 304 * @returns { Promise<void> } Promise that returns no value 305 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 306 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 307 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 308 * <br>2. Incorrect parameter types. 309 * @throws { BusinessError } 1400001 - Invalid display or screen. 310 * @syscap SystemCapability.WindowManager.WindowManager.Core 311 * @systemapi Hide this for inner system use. 312 * @since 9 313 */ 314 function setVirtualScreenSurface(screenId: number, surfaceId: string): Promise<void>; 315 316 /** 317 * Get screen rotation lock status. 318 * 319 * @param { AsyncCallback<boolean> } callback If true, auto rotate is locked. If false, auto rotate is unlocked 320 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 321 * @syscap SystemCapability.WindowManager.WindowManager.Core 322 * @systemapi Hide this for inner system use. 323 * @since 9 324 */ 325 function isScreenRotationLocked(callback: AsyncCallback<boolean>): void; 326 327 /** 328 * Get screen rotation lock status. 329 * 330 * @returns { Promise<boolean> } If true, auto rotate is locked. If false, auto rotate is unlocked 331 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 332 * @syscap SystemCapability.WindowManager.WindowManager.Core 333 * @systemapi Hide this for inner system use. 334 * @since 9 335 */ 336 function isScreenRotationLocked(): Promise<boolean>; 337 338 /** 339 * Set screen rotation lock status. 340 * 341 * @param { boolean } isLocked Indicates whether the screen rotation switch is locked. 342 * @param { AsyncCallback<void> } callback Callback used to return the result. 343 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 344 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 345 * <br>2. Incorrect parameter types. 346 * @syscap SystemCapability.WindowManager.WindowManager.Core 347 * @systemapi Hide this for inner system use. 348 * @since 9 349 */ 350 function setScreenRotationLocked(isLocked: boolean, callback: AsyncCallback<void>): void; 351 352 /** 353 * Set screen rotation lock status. 354 * 355 * @param { boolean } isLocked Indicates whether the screen rotation switch is locked. 356 * @returns { Promise<void> } Promise that returns no value. 357 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 358 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 359 * <br>2. Incorrect parameter types. 360 * @syscap SystemCapability.WindowManager.WindowManager.Core 361 * @systemapi Hide this for inner system use. 362 * @since 9 363 */ 364 function setScreenRotationLocked(isLocked: boolean): Promise<void>; 365 366 /** 367 * Set multi screen mode(mirror/extend). 368 * 369 * @param { number } primaryScreenId - primary screen id. 370 * @param { number } secondaryScreenId - secondary screen id. 371 * @param { MultiScreenMode } secondaryScreenMode - secondary screen mode. 372 * @returns { Promise<void> } Promise that returns no value. 373 * @throws { BusinessError } 202 - Permission verification failed, non-system application uses system API. 374 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 375 * 2. Incorrect parameter types. 376 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 377 * @syscap SystemCapability.WindowManager.WindowManager.Core 378 * @systemapi Hide this for inner system use. 379 * @since 13 380 */ 381 function setMultiScreenMode(primaryScreenId: number, secondaryScreenId: number, 382 secondaryScreenMode: MultiScreenMode): Promise<void>; 383 384 /** 385 * Set multi screen relative position. 386 * 387 * @param { MultiScreenPositionOptions } mainScreenOptions - main screen position. 388 * @param { MultiScreenPositionOptions } secondaryScreenOptions - secondary screen position. 389 * @returns { Promise<void> } Promise that returns no value. 390 * @throws { BusinessError } 202 - Permission verification failed, non-system application uses system API. 391 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 392 * 2. Incorrect parameter types. 393 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 394 * @syscap SystemCapability.WindowManager.WindowManager.Core 395 * @systemapi Hide this for inner system use. 396 * @since 13 397 */ 398 function setMultiScreenRelativePosition(mainScreenOptions: MultiScreenPositionOptions, 399 secondaryScreenOptions: MultiScreenPositionOptions): Promise<void>; 400 401 /** 402 * Indicate the screen mode 403 * 404 * @enum { number } 405 * @syscap SystemCapability.WindowManager.WindowManager.Core 406 * @systemapi Hide this for inner system use. 407 * @since 13 408 */ 409 enum MultiScreenMode { 410 411 /** 412 * Indicate that the screen is in mirror mode. 413 * 414 * @syscap SystemCapability.WindowManager.WindowManager.Core 415 * @systemapi Hide this for inner system use. 416 * @since 13 417 */ 418 SCREEN_MIRROR = 0, 419 420 /** 421 * Indicate that the screen is in extend mode. 422 * 423 * @syscap SystemCapability.WindowManager.WindowManager.Core 424 * @systemapi Hide this for inner system use. 425 * @since 13 426 */ 427 SCREEN_EXTEND = 1 428 } 429 430 /** 431 * The parameter of making extend screen 432 * 433 * @interface MultiScreenPositionOptions 434 * @syscap SystemCapability.WindowManager.WindowManager.Core 435 * @systemapi Hide this for inner system use. 436 * @since 13 437 */ 438 interface MultiScreenPositionOptions { 439 /** 440 * Screen id 441 * 442 * @type { number } 443 * @syscap SystemCapability.WindowManager.WindowManager.Core 444 * @systemapi Hide this for inner system use. 445 * @since 13 446 */ 447 id: number; 448 449 /** 450 * The start coordinate X of the screen origin 451 * 452 * @type { number } 453 * @syscap SystemCapability.WindowManager.WindowManager.Core 454 * @systemapi Hide this for inner system use. 455 * @since 13 456 */ 457 startX: number; 458 459 /** 460 * The start coordinate Y of the screen origin 461 * 462 * @type { number } 463 * @syscap SystemCapability.WindowManager.WindowManager.Core 464 * @systemapi Hide this for inner system use. 465 * @since 13 466 */ 467 startY: number; 468 } 469 470 /** 471 * The parameter of making expand screen 472 * 473 * @interface ExpandOption 474 * @syscap SystemCapability.WindowManager.WindowManager.Core 475 * @systemapi Hide this for inner system use. 476 * @since 9 477 */ 478 interface ExpandOption { 479 /** 480 * Screen id 481 * 482 * @type { number } 483 * @syscap SystemCapability.WindowManager.WindowManager.Core 484 * @systemapi Hide this for inner system use. 485 * @since 9 486 */ 487 screenId: number; 488 489 /** 490 * The start coordinate X of the screen origin 491 * 492 * @type { number } 493 * @syscap SystemCapability.WindowManager.WindowManager.Core 494 * @systemapi Hide this for inner system use. 495 * @since 9 496 */ 497 startX: number; 498 499 /** 500 * The start coordinate Y of the screen origin 501 * 502 * @type { number } 503 * @syscap SystemCapability.WindowManager.WindowManager.Core 504 * @systemapi Hide this for inner system use. 505 * @since 9 506 */ 507 startY: number; 508 } 509 510 /** 511 * The parameter for creating virtual screen. 512 * 513 * @interface VirtualScreenOption 514 * @syscap SystemCapability.WindowManager.WindowManager.Core 515 * @systemapi Hide this for inner system use. 516 * @since 9 517 */ 518 interface VirtualScreenOption { 519 /** 520 * Indicates the name of the virtual screen. 521 * 522 * @type { string } 523 * @syscap SystemCapability.WindowManager.WindowManager.Core 524 * @systemapi Hide this for inner system use. 525 * @since 9 526 */ 527 name: string; 528 529 /** 530 * Indicates the width of the virtual screen. 531 * 532 * @type { number } 533 * @syscap SystemCapability.WindowManager.WindowManager.Core 534 * @systemapi Hide this for inner system use. 535 * @since 9 536 */ 537 width: number; 538 539 /** 540 * Indicates the height of the virtual screen. 541 * 542 * @type { number } 543 * @syscap SystemCapability.WindowManager.WindowManager.Core 544 * @systemapi Hide this for inner system use. 545 * @since 9 546 */ 547 height: number; 548 549 /** 550 * Indicates the density of the virtual screen. 551 * 552 * @type { number } 553 * @syscap SystemCapability.WindowManager.WindowManager.Core 554 * @systemapi Hide this for inner system use. 555 * @since 9 556 */ 557 density: number; 558 559 /** 560 * Indicates the surface id of the virtual screen. 561 * 562 * @type { string } 563 * @syscap SystemCapability.WindowManager.WindowManager.Core 564 * @systemapi Hide this for inner system use. 565 * @since 9 566 */ 567 surfaceId: string; 568 } 569 570 /** 571 * Indicate the source mode of the screen 572 * 573 * @enum { number } 574 * @syscap SystemCapability.WindowManager.WindowManager.Core 575 * @systemapi Hide this for inner system use. 576 * @since 10 577 */ 578 enum ScreenSourceMode { 579 /** 580 * Indicate that the screen is the default screen. 581 * 582 * @syscap SystemCapability.WindowManager.WindowManager.Core 583 * @systemapi Hide this for inner system use. 584 * @since 10 585 */ 586 SCREEN_MAIN = 0, 587 588 /** 589 * Indicate that the screen is in mirror mode. 590 * 591 * @syscap SystemCapability.WindowManager.WindowManager.Core 592 * @systemapi Hide this for inner system use. 593 * @since 10 594 */ 595 SCREEN_MIRROR = 1, 596 597 /** 598 * Indicate that the screen is in extend mode. 599 * 600 * @syscap SystemCapability.WindowManager.WindowManager.Core 601 * @systemapi Hide this for inner system use. 602 * @since 10 603 */ 604 SCREEN_EXTEND = 2, 605 606 /** 607 * Indicate that the screen stands alone. 608 * 609 * @syscap SystemCapability.WindowManager.WindowManager.Core 610 * @systemapi Hide this for inner system use. 611 * @since 10 612 */ 613 SCREEN_ALONE = 3 614 } 615 616 /** 617 * Interface for screen 618 * 619 * @interface Screen 620 * @syscap SystemCapability.WindowManager.WindowManager.Core 621 * @systemapi Hide this for inner system use. 622 * @since 9 623 */ 624 interface Screen { 625 /** 626 * Screen id 627 * 628 * @type { number } 629 * @readonly 630 * @syscap SystemCapability.WindowManager.WindowManager.Core 631 * @systemapi Hide this for inner system use. 632 * @since 9 633 */ 634 readonly id: number; 635 636 /** 637 * Group id 638 * 639 * @type { number } 640 * @readonly 641 * @syscap SystemCapability.WindowManager.WindowManager.Core 642 * @systemapi Hide this for inner system use. 643 * @since 9 644 */ 645 readonly parent: number; 646 647 /** 648 * Mode supported by the screen 649 * 650 * @type { Array<ScreenModeInfo> } 651 * @readonly 652 * @syscap SystemCapability.WindowManager.WindowManager.Core 653 * @systemapi Hide this for inner system use. 654 * @since 9 655 */ 656 readonly supportedModeInfo: Array<ScreenModeInfo>; 657 658 /** 659 * Currently active mode 660 * 661 * @type { number } 662 * @readonly 663 * @syscap SystemCapability.WindowManager.WindowManager.Core 664 * @systemapi Hide this for inner system use. 665 * @since 9 666 */ 667 readonly activeModeIndex: number; 668 669 /** 670 * Orientation of the screen 671 * 672 * @type { Orientation } 673 * @readonly 674 * @syscap SystemCapability.WindowManager.WindowManager.Core 675 * @systemapi Hide this for inner system use. 676 * @since 9 677 */ 678 readonly orientation: Orientation; 679 680 /** 681 * Source mode of the screen 682 * 683 * @type { ScreenSourceMode } 684 * @readonly 685 * @syscap SystemCapability.WindowManager.WindowManager.Core 686 * @systemapi Hide this for inner system use. 687 * @since 10 688 */ 689 readonly sourceMode: ScreenSourceMode; 690 691 /** 692 * Set the orientation of the screen 693 * 694 * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation. 695 * @param { AsyncCallback<void> } callback Callback used to return the result. 696 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 697 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 698 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 699 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 700 * @syscap SystemCapability.WindowManager.WindowManager.Core 701 * @systemapi Hide this for inner system use. 702 * @since 9 703 */ 704 setOrientation(orientation: Orientation, callback: AsyncCallback<void>): void; 705 706 /** 707 * Set the orientation of the screen 708 * 709 * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation. 710 * @returns { Promise<void> } Promise that returns no value. 711 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 712 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 713 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 714 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 715 * @syscap SystemCapability.WindowManager.WindowManager.Core 716 * @systemapi Hide this for inner system use. 717 * @since 9 718 */ 719 setOrientation(orientation: Orientation): Promise<void>; 720 721 /** 722 * Active the mode 723 * 724 * @param { number } modeIndex Index of the mode to set. 725 * @param { AsyncCallback<void> } callback Callback used to return the result. 726 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 727 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 728 * <br>2. Incorrect parameter types. 729 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 730 * @syscap SystemCapability.WindowManager.WindowManager.Core 731 * @systemapi Hide this for inner system use. 732 * @since 9 733 */ 734 setScreenActiveMode(modeIndex: number, callback: AsyncCallback<void>): void; 735 736 /** 737 * Active the mode 738 * 739 * @param { number } modeIndex Index of the mode to set. 740 * @returns { Promise<void> } Promise that returns no value. 741 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 742 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 743 * <br>2. Incorrect parameter types. 744 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 745 * @syscap SystemCapability.WindowManager.WindowManager.Core 746 * @systemapi Hide this for inner system use. 747 * @since 9 748 */ 749 setScreenActiveMode(modeIndex: number): Promise<void>; 750 751 /** 752 * Set display density of the screen 753 * 754 * @param { number } densityDpi Pixel density. The value ranges from 80 to 640. 755 * @param { AsyncCallback<void> } callback Callback used to return the result. 756 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 757 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 758 * <br>2. Incorrect parameter types. 759 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 760 * @syscap SystemCapability.WindowManager.WindowManager.Core 761 * @systemapi Hide this for inner system use. 762 * @since 9 763 */ 764 setDensityDpi(densityDpi: number, callback: AsyncCallback<void>): void; 765 766 /** 767 * Set display density of the screen 768 * 769 * @param { number } densityDpi Pixel density. The value ranges from 80 to 640. 770 * @returns { Promise<void> } Promise that returns no value. 771 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 772 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 773 * <br>2. Incorrect parameter types. 774 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 775 * @syscap SystemCapability.WindowManager.WindowManager.Core 776 * @systemapi Hide this for inner system use. 777 * @since 9 778 */ 779 setDensityDpi(densityDpi: number): Promise<void>; 780 } 781 782 /** 783 * Screen orientation 784 * 785 * @enum { number } 786 * @syscap SystemCapability.WindowManager.WindowManager.Core 787 * @systemapi Hide this for inner system use. 788 * @since 9 789 */ 790 enum Orientation { 791 /** 792 * Indicates that the orientation of the screen is unspecified. 793 * 794 * @syscap SystemCapability.WindowManager.WindowManager.Core 795 * @systemapi Hide this for inner system use. 796 * @since 9 797 */ 798 UNSPECIFIED = 0, 799 800 /** 801 * Indicates that the orientation of the screen is vertical. 802 * 803 * @syscap SystemCapability.WindowManager.WindowManager.Core 804 * @systemapi Hide this for inner system use. 805 * @since 9 806 */ 807 VERTICAL = 1, 808 809 /** 810 * Indicates that the orientation of the screen is horizontal. 811 * 812 * @syscap SystemCapability.WindowManager.WindowManager.Core 813 * @systemapi Hide this for inner system use. 814 * @since 9 815 */ 816 HORIZONTAL = 2, 817 818 /** 819 * Indicates that the orientation of the screen is reverse_vertical. 820 * 821 * @syscap SystemCapability.WindowManager.WindowManager.Core 822 * @systemapi Hide this for inner system use. 823 * @since 9 824 */ 825 REVERSE_VERTICAL = 3, 826 827 /** 828 * Indicates that the orientation of the screen is reverse_horizontal. 829 * 830 * @syscap SystemCapability.WindowManager.WindowManager.Core 831 * @systemapi Hide this for inner system use. 832 * @since 9 833 */ 834 REVERSE_HORIZONTAL = 4 835 } 836 837 /** 838 * The information of the screen 839 * 840 * @interface ScreenModeInfo 841 * @syscap SystemCapability.WindowManager.WindowManager.Core 842 * @systemapi Hide this for inner system use. 843 * @since 9 844 */ 845 interface ScreenModeInfo { 846 /** 847 * Screen id 848 * 849 * @type { number } 850 * @syscap SystemCapability.WindowManager.WindowManager.Core 851 * @systemapi Hide this for inner system use. 852 * @since 9 853 */ 854 id: number; 855 856 /** 857 * Indicates the width of the screen 858 * 859 * @type { number } 860 * @syscap SystemCapability.WindowManager.WindowManager.Core 861 * @systemapi Hide this for inner system use. 862 * @since 9 863 */ 864 width: number; 865 866 /** 867 * Indicates the height of the screen 868 * 869 * @type { number } 870 * @syscap SystemCapability.WindowManager.WindowManager.Core 871 * @systemapi Hide this for inner system use. 872 * @since 9 873 */ 874 height: number; 875 876 /** 877 * Indicates the refreshRate of the screen 878 * 879 * @type { number } 880 * @syscap SystemCapability.WindowManager.WindowManager.Core 881 * @systemapi Hide this for inner system use. 882 * @since 9 883 */ 884 refreshRate: number; 885 } 886} 887 888export default screen;