• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   * WallpaperInfo definition including folding status, rotation status, and resource path.
105   *
106   * @typedef WallpaperInfo
107   * @syscap SystemCapability.MiscServices.Wallpaper
108   * @systemapi Hide this for inner system use.
109   * @since 14
110   */
111  interface WallpaperInfo {
112    /**
113     * Indicates the folding status for wallpaper.
114     *
115     * @type { FoldState }
116     * @syscap SystemCapability.MiscServices.Wallpaper
117     * @systemapi Hide this for inner system use.
118     * @since 14
119     */
120    foldState: FoldState;
121    /**
122     * Indicates the rotation status for wallpaper.
123     *
124     * @type { RotateState }
125     * @syscap SystemCapability.MiscServices.Wallpaper
126     * @systemapi Hide this for inner system use.
127     * @since 14
128     */
129    rotateState: RotateState;
130    /**
131     * Indicates the resource path for wallpaper.
132     *
133     * @type { string }
134     * @syscap SystemCapability.MiscServices.Wallpaper
135     * @systemapi Hide this for inner system use.
136     * @since 14
137     */
138    source: string;
139  }
140
141  /**
142   * Define the folding state of wallpaper
143   *
144   * @enum { number } FoldState
145   * @syscap SystemCapability.MiscServices.Wallpaper
146   * @systemapi Hide this for inner system use.
147   * @since 14
148   */
149  enum FoldState {
150    /**
151     * Indicates the device type is normal device.
152     *
153     * @syscap SystemCapability.MiscServices.Wallpaper
154     * @systemapi Hide this for inner system use.
155     * @since 14
156     */
157    NORMAL = 0,
158    /**
159     * Indicates the once unfold state.
160     *
161     * @syscap SystemCapability.MiscServices.Wallpaper
162     * @systemapi Hide this for inner system use.
163     * @since 14
164     */
165    UNFOLD_ONCE_STATE = 1,
166    /**
167     * Indicates the secondary unfold state.
168     *
169     * @syscap SystemCapability.MiscServices.Wallpaper
170     * @systemapi Hide this for inner system use.
171     * @since 14
172     */
173    UNFOLD_TWICE_STATE = 2
174  }
175
176  /**
177   * Define the rotation state of wallpaper
178   *
179   * @enum { number } RotateState
180   * @syscap SystemCapability.MiscServices.Wallpaper
181   * @systemapi Hide this for inner system use.
182   * @since 14
183   */
184  enum RotateState {
185    /**
186     * Indicates the screen type is vertical screen.
187     *
188     * @syscap SystemCapability.MiscServices.Wallpaper
189     * @systemapi Hide this for inner system use.
190     * @since 14
191     */
192    PORTRAIT = 0,
193    /**
194     * Indicates the screen type is horizontal screen.
195     *
196     * @syscap SystemCapability.MiscServices.Wallpaper
197     * @systemapi Hide this for inner system use.
198     * @since 14
199     */
200    LANDSCAPE = 1
201  }
202
203  /**
204   * Indicates the resource type of the wallpaper.
205   *
206   * @enum { number } WallpaperResourceType
207   * @syscap SystemCapability.MiscServices.Wallpaper
208   * @systemapi Hide this for inner system use.
209   * @since 10
210   */
211  enum WallpaperResourceType {
212    /**
213     * Indicates the default wallpaper resource.
214     *
215     * @syscap SystemCapability.MiscServices.Wallpaper
216     * @systemapi Hide this for inner system use.
217     * @since 10
218     */
219    DEFAULT,
220    /**
221     * Indicates the picture wallpaper resource.
222     *
223     * @syscap SystemCapability.MiscServices.Wallpaper
224     * @systemapi Hide this for inner system use.
225     * @since 10
226     */
227    PICTURE,
228    /**
229     * Indicates the video wallpaper resource.
230     *
231     * @syscap SystemCapability.MiscServices.Wallpaper
232     * @systemapi Hide this for inner system use.
233     * @since 10
234     */
235    VIDEO,
236    /**
237     * Indicates the package wallpaper resource.
238     *
239     * @syscap SystemCapability.MiscServices.Wallpaper
240     * @systemapi Hide this for inner system use.
241     * @since 10
242     */
243    PACKAGE
244  }
245
246  /**
247   * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function.
248   *
249   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
250   * @param { AsyncCallback<Array<RgbaColor>> } callback - the callback of getColors.
251   * @syscap SystemCapability.MiscServices.Wallpaper
252   * @since 7
253   * @deprecated since 9
254   */
255  function getColors(wallpaperType: WallpaperType, callback: AsyncCallback<Array<RgbaColor>>): void;
256
257  /**
258   * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function.
259   *
260   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
261   * @returns { Promise<Array<RgbaColor>> } the promise returned by the function.
262   * @syscap SystemCapability.MiscServices.Wallpaper
263   * @since 7
264   * @deprecated since 9
265   */
266  function getColors(wallpaperType: WallpaperType): Promise<Array<RgbaColor>>;
267
268  /**
269   * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function.
270   *
271   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
272   * @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function.
273   * @throws { BusinessError } 401 - parameter error. Possible causes:
274   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
275   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
276   * @syscap SystemCapability.MiscServices.Wallpaper
277   * @systemapi Hide this for inner system use.
278   * @since 9
279   */
280  function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
281
282  /**
283   * Obtains the ID of the wallpaper of the specified type. Returns an integer greater than or equal to {@code 0} representing the wallpaper ID.
284   * 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.
285   *
286   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
287   * @param { AsyncCallback<number> } callback - the callback of getId.
288   * @syscap SystemCapability.MiscServices.Wallpaper
289   * @since 7
290   * @deprecated since 9
291   */
292  function getId(wallpaperType: WallpaperType, callback: AsyncCallback<number>): void;
293
294  /**
295   * Obtains the ID of the wallpaper of the specified type. Returns an integer greater than or equal to {@code 0} representing the wallpaper ID.
296   * 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.
297   *
298   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
299   * @returns { Promise<number> } the promise returned by the function.
300   * @syscap SystemCapability.MiscServices.Wallpaper
301   * @since 7
302   * @deprecated since 9
303   */
304  function getId(wallpaperType: WallpaperType): Promise<number>;
305
306  /**
307   * Obtains a file of the wallpaper of the specified type. Returns the file descriptor.
308   * When usage is complete, the caller needs to close the file descriptor in time.
309   *
310   * @permission ohos.permission.GET_WALLPAPER
311   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
312   * @param { AsyncCallback<number> } callback - the callback of getFile.
313   * @syscap SystemCapability.MiscServices.Wallpaper
314   * @since 8
315   * @deprecated since 9
316   */
317  function getFile(wallpaperType: WallpaperType, callback: AsyncCallback<number>): void;
318
319  /**
320   * Obtains a file of the wallpaper of the specified type. Returns the file descriptor.
321   * When usage is complete, the caller needs to close the file descriptor in time.
322   *
323   * @permission ohos.permission.GET_WALLPAPER
324   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
325   * @returns { Promise<number> } the promise returned by the function.
326   * @syscap SystemCapability.MiscServices.Wallpaper
327   * @since 8
328   * @deprecated since 9
329   */
330  function getFile(wallpaperType: WallpaperType): Promise<number>;
331
332  /**
333   * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
334   *
335   * @param { AsyncCallback<number> } callback - the callback of getMinHeight.
336   * @syscap SystemCapability.MiscServices.Wallpaper
337   * @since 7
338   * @deprecated since 9
339   */
340  function getMinHeight(callback: AsyncCallback<number>): void;
341
342  /**
343   * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
344   *
345   * @returns { Promise<number> } the promise returned by the function.
346   * @syscap SystemCapability.MiscServices.Wallpaper
347   * @since 7
348   * @deprecated since 9
349   */
350  function getMinHeight(): Promise<number>;
351
352  /**
353   * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
354   *
355   * @returns { number } the number returned by the function.
356   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
357   * @syscap SystemCapability.MiscServices.Wallpaper
358   * @systemapi Hide this for inner system use.
359   * @since 9
360   */
361  function getMinHeightSync(): number;
362
363  /**
364   * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
365   *
366   * @param { AsyncCallback<number> } callback - the callback of getMinWidth.
367   * @syscap SystemCapability.MiscServices.Wallpaper
368   * @since 7
369   * @deprecated since 9
370   */
371  function getMinWidth(callback: AsyncCallback<number>): void;
372
373  /**
374   * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
375   *
376   * @returns { Promise<number> } the promise returned by the function.
377   * @syscap SystemCapability.MiscServices.Wallpaper
378   * @since 7
379   * @deprecated since 9
380   */
381  function getMinWidth(): Promise<number>;
382
383  /**
384   * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
385   *
386   * @returns { number } the number returned by the function.
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 getMinWidthSync(): number;
393
394  /**
395   * Checks whether to allow the application to change the wallpaper for the current user.
396   * Returns true if the application is allowed to set a wallpaper for the current user. returns false otherwise.
397   *
398   * @param { AsyncCallback<boolean> } callback - the callback of isChangePermitted.
399   * @syscap SystemCapability.MiscServices.Wallpaper
400   * @since 7
401   * @deprecated since 9
402   */
403  function isChangePermitted(callback: AsyncCallback<boolean>): void;
404
405  /**
406   * Checks whether to allow the application to change the wallpaper for the current user.
407   * Returns true if the application is allowed to set a wallpaper for the current user. returns false otherwise.
408   *
409   * @returns { Promise<boolean> } the promise returned by the function.
410   * @syscap SystemCapability.MiscServices.Wallpaper
411   * @since 7
412   * @deprecated since 9
413   */
414  function isChangePermitted(): Promise<boolean>;
415
416  /**
417   * Checks whether a user is allowed to set wallpapers.
418   * Returns true if a user is allowed to set wallpapers. returns false otherwise.
419   *
420   * @param { AsyncCallback<boolean> } callback - the callback of isOperationAllowed.
421   * @syscap SystemCapability.MiscServices.Wallpaper
422   * @since 7
423   * @deprecated since 9
424   */
425  function isOperationAllowed(callback: AsyncCallback<boolean>): void;
426
427  /**
428   * Checks whether a user is allowed to set wallpapers.
429   * Returns true if a user is allowed to set wallpapers. returns false otherwise.
430   *
431   * @returns { Promise<boolean> } the promise returned by the function.
432   * @syscap SystemCapability.MiscServices.Wallpaper
433   * @since 7
434   * @deprecated since 9
435   */
436  function isOperationAllowed(): Promise<boolean>;
437
438  /**
439   * Removes a wallpaper of the specified type and restores the default one.
440   *
441   * @permission ohos.permission.SET_WALLPAPER
442   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
443   * @param { AsyncCallback<void> } callback - the callback of reset.
444   * @syscap SystemCapability.MiscServices.Wallpaper
445   * @since 7
446   * @deprecated since 9
447   */
448  function reset(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
449
450  /**
451   * Removes a wallpaper of the specified type and restores the default one.
452   *
453   * @permission ohos.permission.SET_WALLPAPER
454   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
455   * @returns { Promise<void> } the promise returned by the function.
456   * @syscap SystemCapability.MiscServices.Wallpaper
457   * @since 7
458   * @deprecated since 9
459   */
460  function reset(wallpaperType: WallpaperType): Promise<void>;
461
462  /**
463   * Removes a wallpaper of the specified type and restores the default one.
464   *
465   * @permission ohos.permission.SET_WALLPAPER
466   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
467   * @param { AsyncCallback<void> } callback - the callback of restore.
468   * @throws { BusinessError } 401 - parameter error. Possible causes:
469   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
470   * @throws { BusinessError } 201 - permission denied.
471   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
472   * @syscap SystemCapability.MiscServices.Wallpaper
473   * @systemapi Hide this for inner system use.
474   * @since 9
475   */
476  function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
477
478  /**
479   * Removes a wallpaper of the specified type and restores the default one.
480   *
481   * @permission ohos.permission.SET_WALLPAPER
482   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
483   * @returns { Promise<void> } the promise returned by the function.
484   * @throws { BusinessError } 401 - parameter error. Possible causes:
485   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
486   * @throws { BusinessError } 201 - permission denied.
487   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
488   * @syscap SystemCapability.MiscServices.Wallpaper
489   * @systemapi Hide this for inner system use.
490   * @since 9
491   */
492  function restore(wallpaperType: WallpaperType): Promise<void>;
493
494  /**
495   * 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.
496   *
497   * @permission ohos.permission.SET_WALLPAPER
498   * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
499   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
500   * @param { AsyncCallback<void> } callback - the callback of setWallpaper.
501   * @syscap SystemCapability.MiscServices.Wallpaper
502   * @since 7
503   * @deprecated since 9
504   */
505  function setWallpaper(
506    source: string | image.PixelMap,
507    wallpaperType: WallpaperType,
508    callback: AsyncCallback<void>
509  ): void;
510
511  /**
512   * 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.
513   *
514   * @permission ohos.permission.SET_WALLPAPER
515   * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
516   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
517   * @returns { Promise<void> } the promise returned by the function.
518   * @syscap SystemCapability.MiscServices.Wallpaper
519   * @since 7
520   * @deprecated since 9
521   */
522  function setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
523
524  /**
525   * 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.
526   *
527   * @permission ohos.permission.SET_WALLPAPER
528   * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
529   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
530   * @param { AsyncCallback<void> } callback - the callback of setImage.
531   * @throws { BusinessError } 401 - parameter error. Possible causes:
532   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
533   * @throws { BusinessError } 201 - permission denied.
534   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
535   * @syscap SystemCapability.MiscServices.Wallpaper
536   * @systemapi Hide this for inner system use.
537   * @since 9
538   */
539  function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
540
541  /**
542   * 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.
543   *
544   * @permission ohos.permission.SET_WALLPAPER
545   * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
546   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
547   * @returns { Promise<void> } the promise returned by the function.
548   * @throws { BusinessError } 401 - parameter error. Possible causes:
549   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
550   * @throws { BusinessError } 201 - permission denied.
551   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
552   * @syscap SystemCapability.MiscServices.Wallpaper
553   * @systemapi Hide this for inner system use.
554   * @since 9
555   */
556  function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
557
558  /**
559   * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map.
560   *
561   * @permission ohos.permission.GET_WALLPAPER
562   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
563   * @param { AsyncCallback<image.PixelMap> } callback - the callback of getPixelMap.
564   * @syscap SystemCapability.MiscServices.Wallpaper
565   * @systemapi Hide this for inner system use.
566   * @since 7
567   * @deprecated since 9
568   */
569  function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void;
570
571  /**
572   * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map.
573   *
574   * @permission ohos.permission.GET_WALLPAPER
575   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
576   * @returns { Promise<image.PixelMap> } the promise returned by the function.
577   * @syscap SystemCapability.MiscServices.Wallpaper
578   * @systemapi Hide this for inner system use.
579   * @since 7
580   * @deprecated since 9
581   */
582  function getPixelMap(wallpaperType: WallpaperType): Promise<image.PixelMap>;
583
584  /**
585   * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map.
586   * Only the static wallpaper set by using setImage can be obtained.
587   * @permission ohos.permission.GET_WALLPAPER
588   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
589   * @param { AsyncCallback<image.PixelMap> } callback - the callback of getImage.
590   * @throws { BusinessError } 401 - parameter error. Possible causes:
591   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
592   * @throws { BusinessError } 201 - permission denied.
593   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
594   * @syscap SystemCapability.MiscServices.Wallpaper
595   * @systemapi Hide this for inner system use.
596   * @since 9
597   */
598  function getImage(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void;
599
600  /**
601   * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map.
602   * Only the static wallpaper set by using setImage can be obtained.
603   * @permission ohos.permission.GET_WALLPAPER
604   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
605   * @returns { Promise<image.PixelMap> } the promise returned by the function.
606   * @throws { BusinessError } 401 - parameter error. Possible causes:
607   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
608   * @throws { BusinessError } 201 - permission denied.
609   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
610   * @syscap SystemCapability.MiscServices.Wallpaper
611   * @systemapi Hide this for inner system use.
612   * @since 9
613   */
614  function getImage(wallpaperType: WallpaperType): Promise<image.PixelMap>;
615
616  /**
617   * Sets live wallpaper of the specified type based on the uri path of the MP4 file.
618   *
619   * @permission ohos.permission.SET_WALLPAPER
620   * @param { string } source - indicates the uri path of the MP4 file.
621   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
622   * @param { AsyncCallback<void> } callback - the callback of setVideo.
623   * @throws { BusinessError } 401 - parameter error. Possible causes:
624   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
625   * @throws { BusinessError } 201 - permission denied.
626   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
627   * @syscap SystemCapability.MiscServices.Wallpaper
628   * @systemapi Hide this for inner system use.
629   * @since 10
630   */
631  function setVideo(source: string, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
632
633  /**
634   * Sets live wallpaper of the specified type based on the uri path of the MP4 file.
635   *
636   * @permission ohos.permission.SET_WALLPAPER
637   * @param { string } source - indicates the uri path of the MP4 file.
638   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
639   * @returns { Promise<void> } the promise returned by the function.
640   * @throws { BusinessError } 401 - parameter error. Possible causes:
641   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
642   * @throws { BusinessError } 201 - permission denied.
643   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
644   * @syscap SystemCapability.MiscServices.Wallpaper
645   * @systemapi Hide this for inner system use.
646   * @since 10
647   */
648  function setVideo(source: string, wallpaperType: WallpaperType): Promise<void>;
649
650  /**
651   * Sets wallpaper of the specified type based on the uri path of the custom wallpaper.
652   *
653   * @permission ohos.permission.SET_WALLPAPER
654   * @param { string } source - indicates the uri path of the custom wallpaper.
655   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
656   * @param { AsyncCallback<void> } callback - the callback of setCustomWallpaper.
657   * @throws { BusinessError } 401 - parameter error. Possible causes:
658   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
659   * @throws { BusinessError } 201 - permission denied.
660   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
661   * @syscap SystemCapability.MiscServices.Wallpaper
662   * @systemapi Hide this for inner system use.
663   * @since 10
664   */
665  function setCustomWallpaper(source: string, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
666
667  /**
668   * Sets wallpaper of the specified type based on the uri path of the custom wallpaper.
669   *
670   * @permission ohos.permission.SET_WALLPAPER
671   * @param { string } source - indicates the uri path of the custom wallpaper.
672   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
673   * @returns { Promise<void> } the promise returned by the function.
674   * @throws { BusinessError } 401 - parameter error. Possible causes:
675   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
676   * @throws { BusinessError } 201 - permission denied.
677   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
678   * @syscap SystemCapability.MiscServices.Wallpaper
679   * @systemapi Hide this for inner system use.
680   * @since 10
681   */
682  function setCustomWallpaper(source: string, wallpaperType: WallpaperType): Promise<void>;
683
684  /**
685   * Registers a listener for wallpaper color changes to receive notifications about the changes.
686   *
687   * @param { 'colorChange' } type - the incoming colorChange table open receiver pick a color change wallpaper wallpaper color changes.
688   * @param { function } callback - provides dominant colors of the wallpaper.
689   * @syscap SystemCapability.MiscServices.Wallpaper
690   * @since 7
691   * @deprecated since 9
692   */
693  function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
694
695  /**
696   * Registers a listener for wallpaper changes to receive notifications about the changes.
697   *
698   * @param { 'wallpaperChange' } type - the incoming wallpaperChange table open receiver when the user modifies the wallpaper settings.
699   * @param { function } callback - wallpaperType indicates the wallpaper type.
700   * resourceType indicates the resource type of the wallpaper.
701   * uri indicates the wallpaper resource address.
702   * @throws { BusinessError } 401 - parameter error. Possible causes:
703   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
704   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
705   * @syscap SystemCapability.MiscServices.Wallpaper
706   * @systemapi Hide this for inner system use.
707   * @since 10
708   */
709  function on(
710    type: 'wallpaperChange',
711    callback: (wallpaperType: WallpaperType, resourceType: WallpaperResourceType, uri?: string) => void
712  ): void;
713
714  /**
715   * Unregisters a listener for wallpaper color changes.
716   *
717   * @param { 'colorChange' } type - incoming colorChange table delete receiver to pick up a color change wallpaper wallpaper color changes
718   * @param { function } callback - provides dominant colors of the wallpaper.
719   * @syscap SystemCapability.MiscServices.Wallpaper
720   * @since 7
721   * @deprecated since 9
722   */
723  function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
724
725  /**
726   * Unregisters a listener for wallpaper changes.
727   *
728   * @param { 'wallpaperChange' } type - the incoming wallpaperChange table delete receiver when the user modifies the wallpaper settings.
729   * @param { function } callback - wallpaperType indicates the wallpaper type.
730   * resourceType indicates the resource type of the wallpaper.
731   * uri indicates the wallpaper resource address.
732   * @throws { BusinessError } 401 - parameter error. Possible causes:
733   *         1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
734   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
735   * @syscap SystemCapability.MiscServices.Wallpaper
736   * @systemapi Hide this for inner system use.
737   * @since 10
738   */
739  function off(
740    type: 'wallpaperChange',
741    callback?: (wallpaperType: WallpaperType, resourceType: WallpaperResourceType, uri?: string) => void
742  ): void;
743
744  /**
745 * Set wallpapers for all forms of devices.
746 *
747 * @permission ohos.permission.SET_WALLPAPER
748 * @param { Array<WallpaperInfo> } wallpaperInfos - indicates the current device wallpaper type object.
749 * among them, NORMAL and PORTRAIT are mandatory.
750 * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
751 * @returns { Promise<void> } the promise returned by the function.
752 * @throws { BusinessError } 401 - parameter error. Possible causes:
753 *         1.Mandatory parameters are left unspecified.
754 *         2.The first parameter type must be Array<WallpaperInfo>. The second type must be WallpaperType.
755 *         3.The first parameter type must be Array<WallpaperInfo>, must include wallpaper with FoldState NORMAL and RotateState PORTRAIT.
756 * @throws { BusinessError } 201 - permission denied.
757 * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
758 * @syscap SystemCapability.MiscServices.Wallpaper
759 * @systemapi Hide this for inner system use.
760 * @since 14
761 */
762  function setAllWallpapers(wallpaperInfos: Array<WallpaperInfo>, wallpaperType: WallpaperType): Promise<void>;
763
764  /**
765   * Obtains the default pixel map of a wallpaper of the specified  device type. Returns the default pixel map.
766   * Only the static wallpaper set by using setAllWallpapers can be obtained.
767   * @permission ohos.permission.GET_WALLPAPER
768   * @param { WallpaperType } wallpaperType - indicates the wallpaper type.
769   * @param { FoldState } foldState - indicates the folding status for wallpaper.
770   * @param { RotateState } rotateState - indicates the rotation status for wallpaper.
771   * @returns { Promise<image.PixelMap> } the promise returned by the function.
772   * @throws { BusinessError } 401 - parameter error. Possible causes:
773   *         1.Mandatory parameters are left unspecified.
774   *         2.The type must be WallpaperType, parameter range must be WALLPAPER_LOCKSCREEN or WALLPAPER_SYSTEM.
775   *         3.The type must be FoldState, parameter range must be NORMAL or UNFOLD_ONCE_STATE or UNFOLD_TWICE_STATE.
776   *         4.The type must be RotateState, parameter range must be PORTRAIT or LANDSCAPE.
777   * @throws { BusinessError } 201 - permission denied.
778   * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API.
779   * @syscap SystemCapability.MiscServices.Wallpaper
780   * @systemapi Hide this for inner system use.
781   * @since 14
782   */
783  function getWallpaperByState(wallpaperType: WallpaperType, foldState: FoldState, rotateState: RotateState): Promise<image.PixelMap>;
784}
785
786export default wallpaper;
787