1/* 2 * Copyright (c) 2022 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 BasicServicesKit 19 */ 20 21import {AsyncCallback} from './@ohos.base'; 22import image from './@ohos.multimedia.image'; 23 24/** 25 * System wallpaper 26 * 27 * @namespace wallpaper 28 * @syscap SystemCapability.MiscServices.Wallpaper 29 * @since 7 30 */ 31declare namespace wallpaper { 32 /** 33 * RgbaColor definition 34 * 35 * @typedef RgbaColor 36 * @syscap SystemCapability.MiscServices.Wallpaper 37 * @since 7 38 * @deprecated since 9 39 */ 40 interface RgbaColor { 41 /** 42 * The range is 0 to 255. 43 * 44 * @type { number } 45 * @syscap SystemCapability.MiscServices.Wallpaper 46 * @since 7 47 * @deprecated since 9 48 */ 49 red: number; 50 /** 51 * The range is 0 to 255. 52 * 53 * @type { number } 54 * @syscap SystemCapability.MiscServices.Wallpaper 55 * @since 7 56 * @deprecated since 9 57 */ 58 green: number; 59 /** 60 * The range is 0 to 255. 61 * 62 * @type { number } 63 * @syscap SystemCapability.MiscServices.Wallpaper 64 * @since 7 65 * @deprecated since 9 66 */ 67 blue: number; 68 /** 69 * The range is 0 to 255. 70 * 71 * @type { number } 72 * @syscap SystemCapability.MiscServices.Wallpaper 73 * @since 7 74 * @deprecated since 9 75 */ 76 alpha: number; 77 } 78 79 /** 80 * Indicates wallpaper type. 81 * 82 * @enum { number } WallpaperType 83 * @syscap SystemCapability.MiscServices.Wallpaper 84 * @since 7 85 */ 86 enum WallpaperType { 87 /** 88 * Indicates the home screen wallpaper. 89 * 90 * @syscap SystemCapability.MiscServices.Wallpaper 91 * @since 7 92 */ 93 WALLPAPER_SYSTEM, 94 /** 95 * Indicates the lock screen wallpaper. 96 * 97 * @syscap SystemCapability.MiscServices.Wallpaper 98 * @since 7 99 */ 100 WALLPAPER_LOCKSCREEN 101 } 102 103 /** 104 * Indicates the resource type of the wallpaper. 105 * 106 * @enum { number } WallpaperResourceType 107 * @syscap SystemCapability.MiscServices.Wallpaper 108 * @systemapi Hide this for inner system use. 109 * @since 10 110 */ 111 enum WallpaperResourceType { 112 /** 113 * Indicates the default wallpaper resource. 114 * 115 * @syscap SystemCapability.MiscServices.Wallpaper 116 * @systemapi Hide this for inner system use. 117 * @since 10 118 */ 119 DEFAULT, 120 /** 121 * Indicates the picture wallpaper resource. 122 * 123 * @syscap SystemCapability.MiscServices.Wallpaper 124 * @systemapi Hide this for inner system use. 125 * @since 10 126 */ 127 PICTURE, 128 /** 129 * Indicates the video wallpaper resource. 130 * 131 * @syscap SystemCapability.MiscServices.Wallpaper 132 * @systemapi Hide this for inner system use. 133 * @since 10 134 */ 135 VIDEO, 136 /** 137 * Indicates the package wallpaper resource. 138 * 139 * @syscap SystemCapability.MiscServices.Wallpaper 140 * @systemapi Hide this for inner system use. 141 * @since 10 142 */ 143 PACKAGE 144 } 145 146 /** 147 * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. 148 * 149 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 150 * @param { AsyncCallback<Array<RgbaColor>> } callback - the callback of getColors. 151 * @syscap SystemCapability.MiscServices.Wallpaper 152 * @since 7 153 * @deprecated since 9 154 */ 155 function getColors(wallpaperType: WallpaperType, callback: AsyncCallback<Array<RgbaColor>>): void; 156 157 /** 158 * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. 159 * 160 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 161 * @returns { Promise<Array<RgbaColor>> } the promise returned by the function. 162 * @syscap SystemCapability.MiscServices.Wallpaper 163 * @since 7 164 * @deprecated since 9 165 */ 166 function getColors(wallpaperType: WallpaperType): Promise<Array<RgbaColor>>; 167 168 /** 169 * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. 170 * 171 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 172 * @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function. 173 * @throws { BusinessError } 401 - parameter error. Possible causes: 174 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 175 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 176 * @syscap SystemCapability.MiscServices.Wallpaper 177 * @systemapi Hide this for inner system use. 178 * @since 9 179 */ 180 function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>; 181 182 /** 183 * Obtains the ID of the wallpaper of the specified type. Returns an integer greater than or equal to {@code 0} representing the wallpaper ID. 184 * if the specified type of wallpaper has been set; returns {@code -1} otherwise. The return value is an integer ranging from -1 to 2^31 - 1. 185 * 186 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 187 * @param { AsyncCallback<number> } callback - the callback of getId. 188 * @syscap SystemCapability.MiscServices.Wallpaper 189 * @since 7 190 * @deprecated since 9 191 */ 192 function getId(wallpaperType: WallpaperType, callback: AsyncCallback<number>): void; 193 194 /** 195 * Obtains the ID of the wallpaper of the specified type. Returns an integer greater than or equal to {@code 0} representing the wallpaper ID. 196 * if the specified type of wallpaper has been set; returns {@code -1} otherwise. The return value is an integer ranging from -1 to 2^31 - 1. 197 * 198 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 199 * @returns { Promise<number> } the promise returned by the function. 200 * @syscap SystemCapability.MiscServices.Wallpaper 201 * @since 7 202 * @deprecated since 9 203 */ 204 function getId(wallpaperType: WallpaperType): Promise<number>; 205 206 /** 207 * Obtains a file of the wallpaper of the specified type. Returns the file descriptor. 208 * When usage is complete, the caller needs to close the file descriptor in time. 209 * 210 * @permission ohos.permission.GET_WALLPAPER 211 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 212 * @param { AsyncCallback<number> } callback - the callback of getFile. 213 * @syscap SystemCapability.MiscServices.Wallpaper 214 * @since 8 215 * @deprecated since 9 216 */ 217 function getFile(wallpaperType: WallpaperType, callback: AsyncCallback<number>): void; 218 219 /** 220 * Obtains a file of the wallpaper of the specified type. Returns the file descriptor. 221 * When usage is complete, the caller needs to close the file descriptor in time. 222 * 223 * @permission ohos.permission.GET_WALLPAPER 224 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 225 * @returns { Promise<number> } the promise returned by the function. 226 * @syscap SystemCapability.MiscServices.Wallpaper 227 * @since 8 228 * @deprecated since 9 229 */ 230 function getFile(wallpaperType: WallpaperType): Promise<number>; 231 232 /** 233 * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 234 * 235 * @param { AsyncCallback<number> } callback - the callback of getMinHeight. 236 * @syscap SystemCapability.MiscServices.Wallpaper 237 * @since 7 238 * @deprecated since 9 239 */ 240 function getMinHeight(callback: AsyncCallback<number>): void; 241 242 /** 243 * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 244 * 245 * @returns { Promise<number> } the promise returned by the function. 246 * @syscap SystemCapability.MiscServices.Wallpaper 247 * @since 7 248 * @deprecated since 9 249 */ 250 function getMinHeight(): Promise<number>; 251 252 /** 253 * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 254 * 255 * @returns { number } the number returned by the function. 256 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 257 * @syscap SystemCapability.MiscServices.Wallpaper 258 * @systemapi Hide this for inner system use. 259 * @since 9 260 */ 261 function getMinHeightSync(): number; 262 263 /** 264 * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 265 * 266 * @param { AsyncCallback<number> } callback - the callback of getMinWidth. 267 * @syscap SystemCapability.MiscServices.Wallpaper 268 * @since 7 269 * @deprecated since 9 270 */ 271 function getMinWidth(callback: AsyncCallback<number>): void; 272 273 /** 274 * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 275 * 276 * @returns { Promise<number> } the promise returned by the function. 277 * @syscap SystemCapability.MiscServices.Wallpaper 278 * @since 7 279 * @deprecated since 9 280 */ 281 function getMinWidth(): Promise<number>; 282 283 /** 284 * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 285 * 286 * @returns { number } the number returned by the function. 287 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 288 * @syscap SystemCapability.MiscServices.Wallpaper 289 * @systemapi Hide this for inner system use. 290 * @since 9 291 */ 292 function getMinWidthSync(): number; 293 294 /** 295 * Checks whether to allow the application to change the wallpaper for the current user. 296 * Returns true if the application is allowed to set a wallpaper for the current user. returns false otherwise. 297 * 298 * @param { AsyncCallback<boolean> } callback - the callback of isChangePermitted. 299 * @syscap SystemCapability.MiscServices.Wallpaper 300 * @since 7 301 * @deprecated since 9 302 */ 303 function isChangePermitted(callback: AsyncCallback<boolean>): void; 304 305 /** 306 * Checks whether to allow the application to change the wallpaper for the current user. 307 * Returns true if the application is allowed to set a wallpaper for the current user. returns false otherwise. 308 * 309 * @returns { Promise<boolean> } the promise returned by the function. 310 * @syscap SystemCapability.MiscServices.Wallpaper 311 * @since 7 312 * @deprecated since 9 313 */ 314 function isChangePermitted(): Promise<boolean>; 315 316 /** 317 * Checks whether a user is allowed to set wallpapers. 318 * Returns true if a user is allowed to set wallpapers. returns false otherwise. 319 * 320 * @param { AsyncCallback<boolean> } callback - the callback of isOperationAllowed. 321 * @syscap SystemCapability.MiscServices.Wallpaper 322 * @since 7 323 * @deprecated since 9 324 */ 325 function isOperationAllowed(callback: AsyncCallback<boolean>): void; 326 327 /** 328 * Checks whether a user is allowed to set wallpapers. 329 * Returns true if a user is allowed to set wallpapers. returns false otherwise. 330 * 331 * @returns { Promise<boolean> } the promise returned by the function. 332 * @syscap SystemCapability.MiscServices.Wallpaper 333 * @since 7 334 * @deprecated since 9 335 */ 336 function isOperationAllowed(): Promise<boolean>; 337 338 /** 339 * Removes a wallpaper of the specified type and restores the default one. 340 * 341 * @permission ohos.permission.SET_WALLPAPER 342 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 343 * @param { AsyncCallback<void> } callback - the callback of reset. 344 * @syscap SystemCapability.MiscServices.Wallpaper 345 * @since 7 346 * @deprecated since 9 347 */ 348 function reset(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 349 350 /** 351 * Removes a wallpaper of the specified type and restores the default one. 352 * 353 * @permission ohos.permission.SET_WALLPAPER 354 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 355 * @returns { Promise<void> } the promise returned by the function. 356 * @syscap SystemCapability.MiscServices.Wallpaper 357 * @since 7 358 * @deprecated since 9 359 */ 360 function reset(wallpaperType: WallpaperType): Promise<void>; 361 362 /** 363 * Removes a wallpaper of the specified type and restores the default one. 364 * 365 * @permission ohos.permission.SET_WALLPAPER 366 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 367 * @param { AsyncCallback<void> } callback - the callback of restore. 368 * @throws { BusinessError } 401 - parameter error. Possible causes: 369 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 370 * @throws { BusinessError } 201 - permission denied. 371 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 372 * @syscap SystemCapability.MiscServices.Wallpaper 373 * @systemapi Hide this for inner system use. 374 * @since 9 375 */ 376 function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 377 378 /** 379 * Removes a wallpaper of the specified type and restores the default one. 380 * 381 * @permission ohos.permission.SET_WALLPAPER 382 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 383 * @returns { Promise<void> } the promise returned by the function. 384 * @throws { BusinessError } 401 - parameter error. Possible causes: 385 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 386 * @throws { BusinessError } 201 - permission denied. 387 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 388 * @syscap SystemCapability.MiscServices.Wallpaper 389 * @systemapi Hide this for inner system use. 390 * @since 9 391 */ 392 function restore(wallpaperType: WallpaperType): Promise<void>; 393 394 /** 395 * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. 396 * 397 * @permission ohos.permission.SET_WALLPAPER 398 * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. 399 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 400 * @param { AsyncCallback<void> } callback - the callback of setWallpaper. 401 * @syscap SystemCapability.MiscServices.Wallpaper 402 * @since 7 403 * @deprecated since 9 404 */ 405 function setWallpaper( 406 source: string | image.PixelMap, 407 wallpaperType: WallpaperType, 408 callback: AsyncCallback<void> 409 ): void; 410 411 /** 412 * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. 413 * 414 * @permission ohos.permission.SET_WALLPAPER 415 * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. 416 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 417 * @returns { Promise<void> } the promise returned by the function. 418 * @syscap SystemCapability.MiscServices.Wallpaper 419 * @since 7 420 * @deprecated since 9 421 */ 422 function setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; 423 424 /** 425 * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. 426 * 427 * @permission ohos.permission.SET_WALLPAPER 428 * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. 429 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 430 * @param { AsyncCallback<void> } callback - the callback of setImage. 431 * @throws { BusinessError } 401 - parameter error. Possible causes: 432 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 433 * @throws { BusinessError } 201 - permission denied. 434 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 435 * @syscap SystemCapability.MiscServices.Wallpaper 436 * @systemapi Hide this for inner system use. 437 * @since 9 438 */ 439 function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 440 441 /** 442 * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. 443 * 444 * @permission ohos.permission.SET_WALLPAPER 445 * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. 446 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 447 * @returns { Promise<void> } the promise returned by the function. 448 * @throws { BusinessError } 401 - parameter error. Possible causes: 449 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 450 * @throws { BusinessError } 201 - permission denied. 451 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 452 * @syscap SystemCapability.MiscServices.Wallpaper 453 * @systemapi Hide this for inner system use. 454 * @since 9 455 */ 456 function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; 457 458 /** 459 * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map. 460 * 461 * @permission ohos.permission.GET_WALLPAPER 462 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 463 * @param { AsyncCallback<image.PixelMap> } callback - the callback of getPixelMap. 464 * @syscap SystemCapability.MiscServices.Wallpaper 465 * @systemapi Hide this for inner system use. 466 * @since 7 467 * @deprecated since 9 468 */ 469 function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void; 470 471 /** 472 * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map. 473 * 474 * @permission ohos.permission.GET_WALLPAPER 475 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 476 * @returns { Promise<image.PixelMap> } the promise returned by the function. 477 * @syscap SystemCapability.MiscServices.Wallpaper 478 * @systemapi Hide this for inner system use. 479 * @since 7 480 * @deprecated since 9 481 */ 482 function getPixelMap(wallpaperType: WallpaperType): Promise<image.PixelMap>; 483 484 /** 485 * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map. 486 * Only the static wallpaper set by using setImage can be obtained. 487 * @permission ohos.permission.GET_WALLPAPER 488 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 489 * @param { AsyncCallback<image.PixelMap> } callback - the callback of getImage. 490 * @throws { BusinessError } 401 - parameter error. Possible causes: 491 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 492 * @throws { BusinessError } 201 - permission denied. 493 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 494 * @syscap SystemCapability.MiscServices.Wallpaper 495 * @systemapi Hide this for inner system use. 496 * @since 9 497 */ 498 function getImage(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void; 499 500 /** 501 * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map. 502 * Only the static wallpaper set by using setImage can be obtained. 503 * @permission ohos.permission.GET_WALLPAPER 504 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 505 * @returns { Promise<image.PixelMap> } the promise returned by the function. 506 * @throws { BusinessError } 401 - parameter error. Possible causes: 507 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 508 * @throws { BusinessError } 201 - permission denied. 509 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 510 * @syscap SystemCapability.MiscServices.Wallpaper 511 * @systemapi Hide this for inner system use. 512 * @since 9 513 */ 514 function getImage(wallpaperType: WallpaperType): Promise<image.PixelMap>; 515 516 /** 517 * Sets live wallpaper of the specified type based on the uri path of the MP4 file. 518 * 519 * @permission ohos.permission.SET_WALLPAPER 520 * @param { string } source - indicates the uri path of the MP4 file. 521 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 522 * @param { AsyncCallback<void> } callback - the callback of setVideo. 523 * @throws { BusinessError } 401 - parameter error. Possible causes: 524 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 525 * @throws { BusinessError } 201 - permission denied. 526 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 527 * @syscap SystemCapability.MiscServices.Wallpaper 528 * @systemapi Hide this for inner system use. 529 * @since 10 530 */ 531 function setVideo(source: string, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 532 533 /** 534 * Sets live wallpaper of the specified type based on the uri path of the MP4 file. 535 * 536 * @permission ohos.permission.SET_WALLPAPER 537 * @param { string } source - indicates the uri path of the MP4 file. 538 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 539 * @returns { Promise<void> } the promise returned by the function. 540 * @throws { BusinessError } 401 - parameter error. Possible causes: 541 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 542 * @throws { BusinessError } 201 - permission denied. 543 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 544 * @syscap SystemCapability.MiscServices.Wallpaper 545 * @systemapi Hide this for inner system use. 546 * @since 10 547 */ 548 function setVideo(source: string, wallpaperType: WallpaperType): Promise<void>; 549 550 /** 551 * Sets wallpaper of the specified type based on the uri path of the custom wallpaper. 552 * 553 * @permission ohos.permission.SET_WALLPAPER 554 * @param { string } source - indicates the uri path of the custom wallpaper. 555 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 556 * @param { AsyncCallback<void> } callback - the callback of setCustomWallpaper. 557 * @throws { BusinessError } 401 - parameter error. Possible causes: 558 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 559 * @throws { BusinessError } 201 - permission denied. 560 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 561 * @syscap SystemCapability.MiscServices.Wallpaper 562 * @systemapi Hide this for inner system use. 563 * @since 10 564 */ 565 function setCustomWallpaper(source: string, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 566 567 /** 568 * Sets wallpaper of the specified type based on the uri path of the custom wallpaper. 569 * 570 * @permission ohos.permission.SET_WALLPAPER 571 * @param { string } source - indicates the uri path of the custom wallpaper. 572 * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 573 * @returns { Promise<void> } the promise returned by the function. 574 * @throws { BusinessError } 401 - parameter error. Possible causes: 575 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 576 * @throws { BusinessError } 201 - permission denied. 577 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 578 * @syscap SystemCapability.MiscServices.Wallpaper 579 * @systemapi Hide this for inner system use. 580 * @since 10 581 */ 582 function setCustomWallpaper(source: string, wallpaperType: WallpaperType): Promise<void>; 583 584 /** 585 * Registers a listener for wallpaper color changes to receive notifications about the changes. 586 * 587 * @param { 'colorChange' } type - the incoming colorChange table open receiver pick a color change wallpaper wallpaper color changes. 588 * @param { function } callback - provides dominant colors of the wallpaper. 589 * @syscap SystemCapability.MiscServices.Wallpaper 590 * @since 7 591 * @deprecated since 9 592 */ 593 function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; 594 595 /** 596 * Registers a listener for wallpaper changes to receive notifications about the changes. 597 * 598 * @param { 'wallpaperChange' } type - the incoming wallpaperChange table open receiver when the user modifies the wallpaper settings. 599 * @param { function } callback - wallpaperType indicates the wallpaper type. 600 * resourceType indicates the resource type of the wallpaper. 601 * uri indicates the wallpaper resource address. 602 * @throws { BusinessError } 401 - parameter error. Possible causes: 603 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 604 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 605 * @syscap SystemCapability.MiscServices.Wallpaper 606 * @systemapi Hide this for inner system use. 607 * @since 10 608 */ 609 function on( 610 type: 'wallpaperChange', 611 callback: (wallpaperType: WallpaperType, resourceType: WallpaperResourceType, uri?: string) => void 612 ): void; 613 614 /** 615 * Unregisters a listener for wallpaper color changes. 616 * 617 * @param { 'colorChange' } type - incoming colorChange table delete receiver to pick up a color change wallpaper wallpaper color changes 618 * @param { function } callback - provides dominant colors of the wallpaper. 619 * @syscap SystemCapability.MiscServices.Wallpaper 620 * @since 7 621 * @deprecated since 9 622 */ 623 function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; 624 625 /** 626 * Unregisters a listener for wallpaper changes. 627 * 628 * @param { 'wallpaperChange' } type - the incoming wallpaperChange table delete receiver when the user modifies the wallpaper settings. 629 * @param { function } callback - wallpaperType indicates the wallpaper type. 630 * resourceType indicates the resource type of the wallpaper. 631 * uri indicates the wallpaper resource address. 632 * @throws { BusinessError } 401 - parameter error. Possible causes: 633 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 634 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 635 * @syscap SystemCapability.MiscServices.Wallpaper 636 * @systemapi Hide this for inner system use. 637 * @since 10 638 */ 639 function off( 640 type: 'wallpaperChange', 641 callback?: (wallpaperType: WallpaperType, resourceType: WallpaperResourceType, uri?: string) => void 642 ): void; 643} 644 645export default wallpaper; 646