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 * @throws { BusinessError } 202 - Permission verification failed, non-system application uses system API. 373 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 374 * 2. Incorrect parameter types. 375 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 376 * @syscap SystemCapability.WindowManager.WindowManager.Core 377 * @systemapi Hide this for inner system use. 378 * @since 13 379 */ 380 function setMultiScreenMode(primaryScreenId: number, secondaryScreenId: number, 381 secondaryScreenMode: MultiScreenMode): Promise<void>; 382 383 /** 384 * Set multi screen relative position. 385 * 386 * @param { MultiScreenPositionOptions } mainScreenOptions - main screen position. 387 * @param { MultiScreenPositionOptions } secondaryScreenOptions - secondary screen position. 388 * @throws { BusinessError } 202 - Permission verification failed, non-system application uses system API. 389 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 390 * 2. Incorrect parameter types. 391 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 392 * @syscap SystemCapability.WindowManager.WindowManager.Core 393 * @systemapi Hide this for inner system use. 394 * @since 13 395 */ 396 function setMultiScreenRelativePosition(mainScreenOptions: MultiScreenPositionOptions, 397 secondaryScreenOptions: MultiScreenPositionOptions): Promise<void>; 398 399 /** 400 * Indicate the screen mode 401 * 402 * @enum { number } 403 * @syscap SystemCapability.WindowManager.WindowManager.Core 404 * @systemapi Hide this for inner system use. 405 * @since 13 406 */ 407 enum MultiScreenMode { 408 409 /** 410 * Indicate that the screen is in mirror mode. 411 * 412 * @syscap SystemCapability.WindowManager.WindowManager.Core 413 * @systemapi Hide this for inner system use. 414 * @since 13 415 */ 416 SCREEN_MIRROR = 0, 417 418 /** 419 * Indicate that the screen is in extend mode. 420 * 421 * @syscap SystemCapability.WindowManager.WindowManager.Core 422 * @systemapi Hide this for inner system use. 423 * @since 13 424 */ 425 SCREEN_EXTEND = 1 426 } 427 428 /** 429 * The parameter of making extend screen 430 * 431 * @interface MultiScreenPositionOptions 432 * @syscap SystemCapability.WindowManager.WindowManager.Core 433 * @systemapi Hide this for inner system use. 434 * @since 13 435 */ 436 interface MultiScreenPositionOptions { 437 /** 438 * Screen id 439 * 440 * @type { number } 441 * @syscap SystemCapability.WindowManager.WindowManager.Core 442 * @systemapi Hide this for inner system use. 443 * @since 13 444 */ 445 id: number; 446 447 /** 448 * The start coordinate X of the screen origin 449 * 450 * @type { number } 451 * @syscap SystemCapability.WindowManager.WindowManager.Core 452 * @systemapi Hide this for inner system use. 453 * @since 13 454 */ 455 startX: number; 456 457 /** 458 * The start coordinate Y of the screen origin 459 * 460 * @type { number } 461 * @syscap SystemCapability.WindowManager.WindowManager.Core 462 * @systemapi Hide this for inner system use. 463 * @since 13 464 */ 465 startY: number; 466 } 467 468 /** 469 * The parameter of making expand screen 470 * 471 * @interface ExpandOption 472 * @syscap SystemCapability.WindowManager.WindowManager.Core 473 * @systemapi Hide this for inner system use. 474 * @since 9 475 */ 476 interface ExpandOption { 477 /** 478 * Screen id 479 * 480 * @type { number } 481 * @syscap SystemCapability.WindowManager.WindowManager.Core 482 * @systemapi Hide this for inner system use. 483 * @since 9 484 */ 485 screenId: number; 486 487 /** 488 * The start coordinate X of the screen origin 489 * 490 * @type { number } 491 * @syscap SystemCapability.WindowManager.WindowManager.Core 492 * @systemapi Hide this for inner system use. 493 * @since 9 494 */ 495 startX: number; 496 497 /** 498 * The start coordinate Y of the screen origin 499 * 500 * @type { number } 501 * @syscap SystemCapability.WindowManager.WindowManager.Core 502 * @systemapi Hide this for inner system use. 503 * @since 9 504 */ 505 startY: number; 506 } 507 508 /** 509 * The parameter for creating virtual screen. 510 * 511 * @interface VirtualScreenOption 512 * @syscap SystemCapability.WindowManager.WindowManager.Core 513 * @systemapi Hide this for inner system use. 514 * @since 9 515 */ 516 interface VirtualScreenOption { 517 /** 518 * Indicates the name of the virtual screen. 519 * 520 * @type { string } 521 * @syscap SystemCapability.WindowManager.WindowManager.Core 522 * @systemapi Hide this for inner system use. 523 * @since 9 524 */ 525 name: string; 526 527 /** 528 * Indicates the width of the virtual screen. 529 * 530 * @type { number } 531 * @syscap SystemCapability.WindowManager.WindowManager.Core 532 * @systemapi Hide this for inner system use. 533 * @since 9 534 */ 535 width: number; 536 537 /** 538 * Indicates the height of the virtual screen. 539 * 540 * @type { number } 541 * @syscap SystemCapability.WindowManager.WindowManager.Core 542 * @systemapi Hide this for inner system use. 543 * @since 9 544 */ 545 height: number; 546 547 /** 548 * Indicates the density of the virtual screen. 549 * 550 * @type { number } 551 * @syscap SystemCapability.WindowManager.WindowManager.Core 552 * @systemapi Hide this for inner system use. 553 * @since 9 554 */ 555 density: number; 556 557 /** 558 * Indicates the surface id of the virtual screen. 559 * 560 * @type { string } 561 * @syscap SystemCapability.WindowManager.WindowManager.Core 562 * @systemapi Hide this for inner system use. 563 * @since 9 564 */ 565 surfaceId: string; 566 } 567 568 /** 569 * Indicate the source mode of the screen 570 * 571 * @enum { number } 572 * @syscap SystemCapability.WindowManager.WindowManager.Core 573 * @systemapi Hide this for inner system use. 574 * @since 10 575 */ 576 enum ScreenSourceMode { 577 /** 578 * Indicate that the screen is the default screen. 579 * 580 * @syscap SystemCapability.WindowManager.WindowManager.Core 581 * @systemapi Hide this for inner system use. 582 * @since 10 583 */ 584 SCREEN_MAIN = 0, 585 586 /** 587 * Indicate that the screen is in mirror mode. 588 * 589 * @syscap SystemCapability.WindowManager.WindowManager.Core 590 * @systemapi Hide this for inner system use. 591 * @since 10 592 */ 593 SCREEN_MIRROR = 1, 594 595 /** 596 * Indicate that the screen is in extend mode. 597 * 598 * @syscap SystemCapability.WindowManager.WindowManager.Core 599 * @systemapi Hide this for inner system use. 600 * @since 10 601 */ 602 SCREEN_EXTEND = 2, 603 604 /** 605 * Indicate that the screen stands alone. 606 * 607 * @syscap SystemCapability.WindowManager.WindowManager.Core 608 * @systemapi Hide this for inner system use. 609 * @since 10 610 */ 611 SCREEN_ALONE = 3 612 } 613 614 /** 615 * Interface for screen 616 * 617 * @interface Screen 618 * @syscap SystemCapability.WindowManager.WindowManager.Core 619 * @systemapi Hide this for inner system use. 620 * @since 9 621 */ 622 interface Screen { 623 /** 624 * Screen id 625 * 626 * @type { number } 627 * @syscap SystemCapability.WindowManager.WindowManager.Core 628 * @systemapi Hide this for inner system use. 629 * @since 9 630 */ 631 readonly id: number; 632 633 /** 634 * Group id 635 * 636 * @type { number } 637 * @syscap SystemCapability.WindowManager.WindowManager.Core 638 * @systemapi Hide this for inner system use. 639 * @since 9 640 */ 641 readonly parent: number; 642 643 /** 644 * Mode supported by the screen 645 * 646 * @type { Array<ScreenModeInfo> } 647 * @syscap SystemCapability.WindowManager.WindowManager.Core 648 * @systemapi Hide this for inner system use. 649 * @since 9 650 */ 651 readonly supportedModeInfo: Array<ScreenModeInfo>; 652 653 /** 654 * Currently active mode 655 * 656 * @type { number } 657 * @syscap SystemCapability.WindowManager.WindowManager.Core 658 * @systemapi Hide this for inner system use. 659 * @since 9 660 */ 661 readonly activeModeIndex: number; 662 663 /** 664 * Orientation of the screen 665 * 666 * @type { Orientation } 667 * @syscap SystemCapability.WindowManager.WindowManager.Core 668 * @systemapi Hide this for inner system use. 669 * @since 9 670 */ 671 readonly orientation: Orientation; 672 673 /** 674 * Source mode of the screen 675 * 676 * @type { ScreenSourceMode } 677 * @syscap SystemCapability.WindowManager.WindowManager.Core 678 * @systemapi Hide this for inner system use. 679 * @since 10 680 */ 681 readonly sourceMode: ScreenSourceMode; 682 683 /** 684 * Set the orientation of the screen 685 * 686 * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation. 687 * @param { AsyncCallback<void> } callback Callback used to return the result. 688 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 689 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 690 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 691 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 692 * @syscap SystemCapability.WindowManager.WindowManager.Core 693 * @systemapi Hide this for inner system use. 694 * @since 9 695 */ 696 setOrientation(orientation: Orientation, callback: AsyncCallback<void>): void; 697 698 /** 699 * Set the orientation of the screen 700 * 701 * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation. 702 * @returns { Promise<void> } Promise that returns no value. 703 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 704 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 705 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 706 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 707 * @syscap SystemCapability.WindowManager.WindowManager.Core 708 * @systemapi Hide this for inner system use. 709 * @since 9 710 */ 711 setOrientation(orientation: Orientation): Promise<void>; 712 713 /** 714 * Active the mode 715 * 716 * @param { number } modeIndex Index of the mode to set. 717 * @param { AsyncCallback<void> } callback Callback used to return the result. 718 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 719 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 720 * <br>2. Incorrect parameter types. 721 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 722 * @syscap SystemCapability.WindowManager.WindowManager.Core 723 * @systemapi Hide this for inner system use. 724 * @since 9 725 */ 726 setScreenActiveMode(modeIndex: number, callback: AsyncCallback<void>): void; 727 728 /** 729 * Active the mode 730 * 731 * @param { number } modeIndex Index of the mode to set. 732 * @returns { Promise<void> } Promise that returns no value. 733 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 734 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 735 * <br>2. Incorrect parameter types. 736 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 737 * @syscap SystemCapability.WindowManager.WindowManager.Core 738 * @systemapi Hide this for inner system use. 739 * @since 9 740 */ 741 setScreenActiveMode(modeIndex: number): Promise<void>; 742 743 /** 744 * Set display density of the screen 745 * 746 * @param { number } densityDpi Pixel density. The value ranges from 80 to 640. 747 * @param { AsyncCallback<void> } callback Callback used to return the result. 748 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 749 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 750 * <br>2. Incorrect parameter types. 751 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 752 * @syscap SystemCapability.WindowManager.WindowManager.Core 753 * @systemapi Hide this for inner system use. 754 * @since 9 755 */ 756 setDensityDpi(densityDpi: number, callback: AsyncCallback<void>): void; 757 758 /** 759 * Set display density of the screen 760 * 761 * @param { number } densityDpi Pixel density. The value ranges from 80 to 640. 762 * @returns { Promise<void> } Promise that returns no value. 763 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 764 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 765 * <br>2. Incorrect parameter types. 766 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 767 * @syscap SystemCapability.WindowManager.WindowManager.Core 768 * @systemapi Hide this for inner system use. 769 * @since 9 770 */ 771 setDensityDpi(densityDpi: number): Promise<void>; 772 } 773 774 /** 775 * Screen orientation 776 * 777 * @enum { number } 778 * @syscap SystemCapability.WindowManager.WindowManager.Core 779 * @systemapi Hide this for inner system use. 780 * @since 9 781 */ 782 enum Orientation { 783 /** 784 * Indicates that the orientation of the screen is unspecified. 785 * 786 * @syscap SystemCapability.WindowManager.WindowManager.Core 787 * @systemapi Hide this for inner system use. 788 * @since 9 789 */ 790 UNSPECIFIED = 0, 791 792 /** 793 * Indicates that the orientation of the screen is vertical. 794 * 795 * @syscap SystemCapability.WindowManager.WindowManager.Core 796 * @systemapi Hide this for inner system use. 797 * @since 9 798 */ 799 VERTICAL = 1, 800 801 /** 802 * Indicates that the orientation of the screen is horizontal. 803 * 804 * @syscap SystemCapability.WindowManager.WindowManager.Core 805 * @systemapi Hide this for inner system use. 806 * @since 9 807 */ 808 HORIZONTAL = 2, 809 810 /** 811 * Indicates that the orientation of the screen is reverse_vertical. 812 * 813 * @syscap SystemCapability.WindowManager.WindowManager.Core 814 * @systemapi Hide this for inner system use. 815 * @since 9 816 */ 817 REVERSE_VERTICAL = 3, 818 819 /** 820 * Indicates that the orientation of the screen is reverse_horizontal. 821 * 822 * @syscap SystemCapability.WindowManager.WindowManager.Core 823 * @systemapi Hide this for inner system use. 824 * @since 9 825 */ 826 REVERSE_HORIZONTAL = 4 827 } 828 829 /** 830 * The information of the screen 831 * 832 * @interface ScreenModeInfo 833 * @syscap SystemCapability.WindowManager.WindowManager.Core 834 * @systemapi Hide this for inner system use. 835 * @since 9 836 */ 837 interface ScreenModeInfo { 838 /** 839 * Screen id 840 * 841 * @type { number } 842 * @syscap SystemCapability.WindowManager.WindowManager.Core 843 * @systemapi Hide this for inner system use. 844 * @since 9 845 */ 846 id: number; 847 848 /** 849 * Indicates the width of the screen 850 * 851 * @type { number } 852 * @syscap SystemCapability.WindowManager.WindowManager.Core 853 * @systemapi Hide this for inner system use. 854 * @since 9 855 */ 856 width: number; 857 858 /** 859 * Indicates the height of the screen 860 * 861 * @type { number } 862 * @syscap SystemCapability.WindowManager.WindowManager.Core 863 * @systemapi Hide this for inner system use. 864 * @since 9 865 */ 866 height: number; 867 868 /** 869 * Indicates the refreshRate of the screen 870 * 871 * @type { number } 872 * @syscap SystemCapability.WindowManager.WindowManager.Core 873 * @systemapi Hide this for inner system use. 874 * @since 9 875 */ 876 refreshRate: number; 877 } 878} 879 880export default screen; 881