161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit BasicServicesKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport {AsyncCallback} from './@ohos.base'; 2261847f8eSopenharmony_ciimport image from './@ohos.multimedia.image'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * System wallpaper 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace wallpaper 2861847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 2961847f8eSopenharmony_ci * @since 7 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace wallpaper { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * RgbaColor definition 3461847f8eSopenharmony_ci * 3561847f8eSopenharmony_ci * @typedef RgbaColor 3661847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 3761847f8eSopenharmony_ci * @since 7 3861847f8eSopenharmony_ci * @deprecated since 9 3961847f8eSopenharmony_ci */ 4061847f8eSopenharmony_ci interface RgbaColor { 4161847f8eSopenharmony_ci /** 4261847f8eSopenharmony_ci * The range is 0 to 255. 4361847f8eSopenharmony_ci * 4461847f8eSopenharmony_ci * @type { number } 4561847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 4661847f8eSopenharmony_ci * @since 7 4761847f8eSopenharmony_ci * @deprecated since 9 4861847f8eSopenharmony_ci */ 4961847f8eSopenharmony_ci red: number; 5061847f8eSopenharmony_ci /** 5161847f8eSopenharmony_ci * The range is 0 to 255. 5261847f8eSopenharmony_ci * 5361847f8eSopenharmony_ci * @type { number } 5461847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 5561847f8eSopenharmony_ci * @since 7 5661847f8eSopenharmony_ci * @deprecated since 9 5761847f8eSopenharmony_ci */ 5861847f8eSopenharmony_ci green: number; 5961847f8eSopenharmony_ci /** 6061847f8eSopenharmony_ci * The range is 0 to 255. 6161847f8eSopenharmony_ci * 6261847f8eSopenharmony_ci * @type { number } 6361847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 6461847f8eSopenharmony_ci * @since 7 6561847f8eSopenharmony_ci * @deprecated since 9 6661847f8eSopenharmony_ci */ 6761847f8eSopenharmony_ci blue: number; 6861847f8eSopenharmony_ci /** 6961847f8eSopenharmony_ci * The range is 0 to 255. 7061847f8eSopenharmony_ci * 7161847f8eSopenharmony_ci * @type { number } 7261847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 7361847f8eSopenharmony_ci * @since 7 7461847f8eSopenharmony_ci * @deprecated since 9 7561847f8eSopenharmony_ci */ 7661847f8eSopenharmony_ci alpha: number; 7761847f8eSopenharmony_ci } 7861847f8eSopenharmony_ci 7961847f8eSopenharmony_ci /** 8061847f8eSopenharmony_ci * Indicates wallpaper type. 8161847f8eSopenharmony_ci * 8261847f8eSopenharmony_ci * @enum { number } WallpaperType 8361847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 8461847f8eSopenharmony_ci * @since 7 8561847f8eSopenharmony_ci */ 8661847f8eSopenharmony_ci enum WallpaperType { 8761847f8eSopenharmony_ci /** 8861847f8eSopenharmony_ci * Indicates the home screen wallpaper. 8961847f8eSopenharmony_ci * 9061847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 9161847f8eSopenharmony_ci * @since 7 9261847f8eSopenharmony_ci */ 9361847f8eSopenharmony_ci WALLPAPER_SYSTEM, 9461847f8eSopenharmony_ci /** 9561847f8eSopenharmony_ci * Indicates the lock screen wallpaper. 9661847f8eSopenharmony_ci * 9761847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 9861847f8eSopenharmony_ci * @since 7 9961847f8eSopenharmony_ci */ 10061847f8eSopenharmony_ci WALLPAPER_LOCKSCREEN 10161847f8eSopenharmony_ci } 10261847f8eSopenharmony_ci 10361847f8eSopenharmony_ci /** 10461847f8eSopenharmony_ci * Indicates the resource type of the wallpaper. 10561847f8eSopenharmony_ci * 10661847f8eSopenharmony_ci * @enum { number } WallpaperResourceType 10761847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 10861847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 10961847f8eSopenharmony_ci * @since 10 11061847f8eSopenharmony_ci */ 11161847f8eSopenharmony_ci enum WallpaperResourceType { 11261847f8eSopenharmony_ci /** 11361847f8eSopenharmony_ci * Indicates the default wallpaper resource. 11461847f8eSopenharmony_ci * 11561847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 11661847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 11761847f8eSopenharmony_ci * @since 10 11861847f8eSopenharmony_ci */ 11961847f8eSopenharmony_ci DEFAULT, 12061847f8eSopenharmony_ci /** 12161847f8eSopenharmony_ci * Indicates the picture wallpaper resource. 12261847f8eSopenharmony_ci * 12361847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 12461847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 12561847f8eSopenharmony_ci * @since 10 12661847f8eSopenharmony_ci */ 12761847f8eSopenharmony_ci PICTURE, 12861847f8eSopenharmony_ci /** 12961847f8eSopenharmony_ci * Indicates the video wallpaper resource. 13061847f8eSopenharmony_ci * 13161847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 13261847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 13361847f8eSopenharmony_ci * @since 10 13461847f8eSopenharmony_ci */ 13561847f8eSopenharmony_ci VIDEO, 13661847f8eSopenharmony_ci /** 13761847f8eSopenharmony_ci * Indicates the package wallpaper resource. 13861847f8eSopenharmony_ci * 13961847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 14061847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 14161847f8eSopenharmony_ci * @since 10 14261847f8eSopenharmony_ci */ 14361847f8eSopenharmony_ci PACKAGE 14461847f8eSopenharmony_ci } 14561847f8eSopenharmony_ci 14661847f8eSopenharmony_ci /** 14761847f8eSopenharmony_ci * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. 14861847f8eSopenharmony_ci * 14961847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 15061847f8eSopenharmony_ci * @param { AsyncCallback<Array<RgbaColor>> } callback - the callback of getColors. 15161847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 15261847f8eSopenharmony_ci * @since 7 15361847f8eSopenharmony_ci * @deprecated since 9 15461847f8eSopenharmony_ci */ 15561847f8eSopenharmony_ci function getColors(wallpaperType: WallpaperType, callback: AsyncCallback<Array<RgbaColor>>): void; 15661847f8eSopenharmony_ci 15761847f8eSopenharmony_ci /** 15861847f8eSopenharmony_ci * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. 15961847f8eSopenharmony_ci * 16061847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 16161847f8eSopenharmony_ci * @returns { Promise<Array<RgbaColor>> } the promise returned by the function. 16261847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 16361847f8eSopenharmony_ci * @since 7 16461847f8eSopenharmony_ci * @deprecated since 9 16561847f8eSopenharmony_ci */ 16661847f8eSopenharmony_ci function getColors(wallpaperType: WallpaperType): Promise<Array<RgbaColor>>; 16761847f8eSopenharmony_ci 16861847f8eSopenharmony_ci /** 16961847f8eSopenharmony_ci * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. 17061847f8eSopenharmony_ci * 17161847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 17261847f8eSopenharmony_ci * @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function. 17361847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 17461847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 17561847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 17661847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 17761847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 17861847f8eSopenharmony_ci * @since 9 17961847f8eSopenharmony_ci */ 18061847f8eSopenharmony_ci function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>; 18161847f8eSopenharmony_ci 18261847f8eSopenharmony_ci /** 18361847f8eSopenharmony_ci * Obtains the ID of the wallpaper of the specified type. Returns an integer greater than or equal to {@code 0} representing the wallpaper ID. 18461847f8eSopenharmony_ci * 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. 18561847f8eSopenharmony_ci * 18661847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 18761847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - the callback of getId. 18861847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 18961847f8eSopenharmony_ci * @since 7 19061847f8eSopenharmony_ci * @deprecated since 9 19161847f8eSopenharmony_ci */ 19261847f8eSopenharmony_ci function getId(wallpaperType: WallpaperType, callback: AsyncCallback<number>): void; 19361847f8eSopenharmony_ci 19461847f8eSopenharmony_ci /** 19561847f8eSopenharmony_ci * Obtains the ID of the wallpaper of the specified type. Returns an integer greater than or equal to {@code 0} representing the wallpaper ID. 19661847f8eSopenharmony_ci * 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. 19761847f8eSopenharmony_ci * 19861847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 19961847f8eSopenharmony_ci * @returns { Promise<number> } the promise returned by the function. 20061847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 20161847f8eSopenharmony_ci * @since 7 20261847f8eSopenharmony_ci * @deprecated since 9 20361847f8eSopenharmony_ci */ 20461847f8eSopenharmony_ci function getId(wallpaperType: WallpaperType): Promise<number>; 20561847f8eSopenharmony_ci 20661847f8eSopenharmony_ci /** 20761847f8eSopenharmony_ci * Obtains a file of the wallpaper of the specified type. Returns the file descriptor. 20861847f8eSopenharmony_ci * When usage is complete, the caller needs to close the file descriptor in time. 20961847f8eSopenharmony_ci * 21061847f8eSopenharmony_ci * @permission ohos.permission.GET_WALLPAPER 21161847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 21261847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - the callback of getFile. 21361847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 21461847f8eSopenharmony_ci * @since 8 21561847f8eSopenharmony_ci * @deprecated since 9 21661847f8eSopenharmony_ci */ 21761847f8eSopenharmony_ci function getFile(wallpaperType: WallpaperType, callback: AsyncCallback<number>): void; 21861847f8eSopenharmony_ci 21961847f8eSopenharmony_ci /** 22061847f8eSopenharmony_ci * Obtains a file of the wallpaper of the specified type. Returns the file descriptor. 22161847f8eSopenharmony_ci * When usage is complete, the caller needs to close the file descriptor in time. 22261847f8eSopenharmony_ci * 22361847f8eSopenharmony_ci * @permission ohos.permission.GET_WALLPAPER 22461847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 22561847f8eSopenharmony_ci * @returns { Promise<number> } the promise returned by the function. 22661847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 22761847f8eSopenharmony_ci * @since 8 22861847f8eSopenharmony_ci * @deprecated since 9 22961847f8eSopenharmony_ci */ 23061847f8eSopenharmony_ci function getFile(wallpaperType: WallpaperType): Promise<number>; 23161847f8eSopenharmony_ci 23261847f8eSopenharmony_ci /** 23361847f8eSopenharmony_ci * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 23461847f8eSopenharmony_ci * 23561847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - the callback of getMinHeight. 23661847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 23761847f8eSopenharmony_ci * @since 7 23861847f8eSopenharmony_ci * @deprecated since 9 23961847f8eSopenharmony_ci */ 24061847f8eSopenharmony_ci function getMinHeight(callback: AsyncCallback<number>): void; 24161847f8eSopenharmony_ci 24261847f8eSopenharmony_ci /** 24361847f8eSopenharmony_ci * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 24461847f8eSopenharmony_ci * 24561847f8eSopenharmony_ci * @returns { Promise<number> } the promise returned by the function. 24661847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 24761847f8eSopenharmony_ci * @since 7 24861847f8eSopenharmony_ci * @deprecated since 9 24961847f8eSopenharmony_ci */ 25061847f8eSopenharmony_ci function getMinHeight(): Promise<number>; 25161847f8eSopenharmony_ci 25261847f8eSopenharmony_ci /** 25361847f8eSopenharmony_ci * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 25461847f8eSopenharmony_ci * 25561847f8eSopenharmony_ci * @returns { number } the number returned by the function. 25661847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 25761847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 25861847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 25961847f8eSopenharmony_ci * @since 9 26061847f8eSopenharmony_ci */ 26161847f8eSopenharmony_ci function getMinHeightSync(): number; 26261847f8eSopenharmony_ci 26361847f8eSopenharmony_ci /** 26461847f8eSopenharmony_ci * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 26561847f8eSopenharmony_ci * 26661847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - the callback of getMinWidth. 26761847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 26861847f8eSopenharmony_ci * @since 7 26961847f8eSopenharmony_ci * @deprecated since 9 27061847f8eSopenharmony_ci */ 27161847f8eSopenharmony_ci function getMinWidth(callback: AsyncCallback<number>): void; 27261847f8eSopenharmony_ci 27361847f8eSopenharmony_ci /** 27461847f8eSopenharmony_ci * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 27561847f8eSopenharmony_ci * 27661847f8eSopenharmony_ci * @returns { Promise<number> } the promise returned by the function. 27761847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 27861847f8eSopenharmony_ci * @since 7 27961847f8eSopenharmony_ci * @deprecated since 9 28061847f8eSopenharmony_ci */ 28161847f8eSopenharmony_ci function getMinWidth(): Promise<number>; 28261847f8eSopenharmony_ci 28361847f8eSopenharmony_ci /** 28461847f8eSopenharmony_ci * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. 28561847f8eSopenharmony_ci * 28661847f8eSopenharmony_ci * @returns { number } the number returned by the function. 28761847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 28861847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 28961847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 29061847f8eSopenharmony_ci * @since 9 29161847f8eSopenharmony_ci */ 29261847f8eSopenharmony_ci function getMinWidthSync(): number; 29361847f8eSopenharmony_ci 29461847f8eSopenharmony_ci /** 29561847f8eSopenharmony_ci * Checks whether to allow the application to change the wallpaper for the current user. 29661847f8eSopenharmony_ci * Returns true if the application is allowed to set a wallpaper for the current user. returns false otherwise. 29761847f8eSopenharmony_ci * 29861847f8eSopenharmony_ci * @param { AsyncCallback<boolean> } callback - the callback of isChangePermitted. 29961847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 30061847f8eSopenharmony_ci * @since 7 30161847f8eSopenharmony_ci * @deprecated since 9 30261847f8eSopenharmony_ci */ 30361847f8eSopenharmony_ci function isChangePermitted(callback: AsyncCallback<boolean>): void; 30461847f8eSopenharmony_ci 30561847f8eSopenharmony_ci /** 30661847f8eSopenharmony_ci * Checks whether to allow the application to change the wallpaper for the current user. 30761847f8eSopenharmony_ci * Returns true if the application is allowed to set a wallpaper for the current user. returns false otherwise. 30861847f8eSopenharmony_ci * 30961847f8eSopenharmony_ci * @returns { Promise<boolean> } the promise returned by the function. 31061847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 31161847f8eSopenharmony_ci * @since 7 31261847f8eSopenharmony_ci * @deprecated since 9 31361847f8eSopenharmony_ci */ 31461847f8eSopenharmony_ci function isChangePermitted(): Promise<boolean>; 31561847f8eSopenharmony_ci 31661847f8eSopenharmony_ci /** 31761847f8eSopenharmony_ci * Checks whether a user is allowed to set wallpapers. 31861847f8eSopenharmony_ci * Returns true if a user is allowed to set wallpapers. returns false otherwise. 31961847f8eSopenharmony_ci * 32061847f8eSopenharmony_ci * @param { AsyncCallback<boolean> } callback - the callback of isOperationAllowed. 32161847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 32261847f8eSopenharmony_ci * @since 7 32361847f8eSopenharmony_ci * @deprecated since 9 32461847f8eSopenharmony_ci */ 32561847f8eSopenharmony_ci function isOperationAllowed(callback: AsyncCallback<boolean>): void; 32661847f8eSopenharmony_ci 32761847f8eSopenharmony_ci /** 32861847f8eSopenharmony_ci * Checks whether a user is allowed to set wallpapers. 32961847f8eSopenharmony_ci * Returns true if a user is allowed to set wallpapers. returns false otherwise. 33061847f8eSopenharmony_ci * 33161847f8eSopenharmony_ci * @returns { Promise<boolean> } the promise returned by the function. 33261847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 33361847f8eSopenharmony_ci * @since 7 33461847f8eSopenharmony_ci * @deprecated since 9 33561847f8eSopenharmony_ci */ 33661847f8eSopenharmony_ci function isOperationAllowed(): Promise<boolean>; 33761847f8eSopenharmony_ci 33861847f8eSopenharmony_ci /** 33961847f8eSopenharmony_ci * Removes a wallpaper of the specified type and restores the default one. 34061847f8eSopenharmony_ci * 34161847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 34261847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 34361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of reset. 34461847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 34561847f8eSopenharmony_ci * @since 7 34661847f8eSopenharmony_ci * @deprecated since 9 34761847f8eSopenharmony_ci */ 34861847f8eSopenharmony_ci function reset(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 34961847f8eSopenharmony_ci 35061847f8eSopenharmony_ci /** 35161847f8eSopenharmony_ci * Removes a wallpaper of the specified type and restores the default one. 35261847f8eSopenharmony_ci * 35361847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 35461847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 35561847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 35661847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 35761847f8eSopenharmony_ci * @since 7 35861847f8eSopenharmony_ci * @deprecated since 9 35961847f8eSopenharmony_ci */ 36061847f8eSopenharmony_ci function reset(wallpaperType: WallpaperType): Promise<void>; 36161847f8eSopenharmony_ci 36261847f8eSopenharmony_ci /** 36361847f8eSopenharmony_ci * Removes a wallpaper of the specified type and restores the default one. 36461847f8eSopenharmony_ci * 36561847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 36661847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 36761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of restore. 36861847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 36961847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 37061847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 37161847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 37261847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 37361847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 37461847f8eSopenharmony_ci * @since 9 37561847f8eSopenharmony_ci */ 37661847f8eSopenharmony_ci function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 37761847f8eSopenharmony_ci 37861847f8eSopenharmony_ci /** 37961847f8eSopenharmony_ci * Removes a wallpaper of the specified type and restores the default one. 38061847f8eSopenharmony_ci * 38161847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 38261847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 38361847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 38461847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 38561847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 38661847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 38761847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 38861847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 38961847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 39061847f8eSopenharmony_ci * @since 9 39161847f8eSopenharmony_ci */ 39261847f8eSopenharmony_ci function restore(wallpaperType: WallpaperType): Promise<void>; 39361847f8eSopenharmony_ci 39461847f8eSopenharmony_ci /** 39561847f8eSopenharmony_ci * 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. 39661847f8eSopenharmony_ci * 39761847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 39861847f8eSopenharmony_ci * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. 39961847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 40061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setWallpaper. 40161847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 40261847f8eSopenharmony_ci * @since 7 40361847f8eSopenharmony_ci * @deprecated since 9 40461847f8eSopenharmony_ci */ 40561847f8eSopenharmony_ci function setWallpaper( 40661847f8eSopenharmony_ci source: string | image.PixelMap, 40761847f8eSopenharmony_ci wallpaperType: WallpaperType, 40861847f8eSopenharmony_ci callback: AsyncCallback<void> 40961847f8eSopenharmony_ci ): void; 41061847f8eSopenharmony_ci 41161847f8eSopenharmony_ci /** 41261847f8eSopenharmony_ci * 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. 41361847f8eSopenharmony_ci * 41461847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 41561847f8eSopenharmony_ci * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. 41661847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 41761847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 41861847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 41961847f8eSopenharmony_ci * @since 7 42061847f8eSopenharmony_ci * @deprecated since 9 42161847f8eSopenharmony_ci */ 42261847f8eSopenharmony_ci function setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; 42361847f8eSopenharmony_ci 42461847f8eSopenharmony_ci /** 42561847f8eSopenharmony_ci * 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. 42661847f8eSopenharmony_ci * 42761847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 42861847f8eSopenharmony_ci * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. 42961847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 43061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setImage. 43161847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 43261847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 43361847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 43461847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 43561847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 43661847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 43761847f8eSopenharmony_ci * @since 9 43861847f8eSopenharmony_ci */ 43961847f8eSopenharmony_ci function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 44061847f8eSopenharmony_ci 44161847f8eSopenharmony_ci /** 44261847f8eSopenharmony_ci * 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. 44361847f8eSopenharmony_ci * 44461847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 44561847f8eSopenharmony_ci * @param { string | image.PixelMap } source - indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. 44661847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 44761847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 44861847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 44961847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 45061847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 45161847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 45261847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 45361847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 45461847f8eSopenharmony_ci * @since 9 45561847f8eSopenharmony_ci */ 45661847f8eSopenharmony_ci function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; 45761847f8eSopenharmony_ci 45861847f8eSopenharmony_ci /** 45961847f8eSopenharmony_ci * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map. 46061847f8eSopenharmony_ci * 46161847f8eSopenharmony_ci * @permission ohos.permission.GET_WALLPAPER 46261847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 46361847f8eSopenharmony_ci * @param { AsyncCallback<image.PixelMap> } callback - the callback of getPixelMap. 46461847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 46561847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 46661847f8eSopenharmony_ci * @since 7 46761847f8eSopenharmony_ci * @deprecated since 9 46861847f8eSopenharmony_ci */ 46961847f8eSopenharmony_ci function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void; 47061847f8eSopenharmony_ci 47161847f8eSopenharmony_ci /** 47261847f8eSopenharmony_ci * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map. 47361847f8eSopenharmony_ci * 47461847f8eSopenharmony_ci * @permission ohos.permission.GET_WALLPAPER 47561847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 47661847f8eSopenharmony_ci * @returns { Promise<image.PixelMap> } the promise returned by the function. 47761847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 47861847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 47961847f8eSopenharmony_ci * @since 7 48061847f8eSopenharmony_ci * @deprecated since 9 48161847f8eSopenharmony_ci */ 48261847f8eSopenharmony_ci function getPixelMap(wallpaperType: WallpaperType): Promise<image.PixelMap>; 48361847f8eSopenharmony_ci 48461847f8eSopenharmony_ci /** 48561847f8eSopenharmony_ci * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map. 48661847f8eSopenharmony_ci * Only the static wallpaper set by using setImage can be obtained. 48761847f8eSopenharmony_ci * @permission ohos.permission.GET_WALLPAPER 48861847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 48961847f8eSopenharmony_ci * @param { AsyncCallback<image.PixelMap> } callback - the callback of getImage. 49061847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 49161847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 49261847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 49361847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 49461847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 49561847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 49661847f8eSopenharmony_ci * @since 9 49761847f8eSopenharmony_ci */ 49861847f8eSopenharmony_ci function getImage(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void; 49961847f8eSopenharmony_ci 50061847f8eSopenharmony_ci /** 50161847f8eSopenharmony_ci * Obtains the default pixel map of a wallpaper of the specified type. Returns the default pixel map. 50261847f8eSopenharmony_ci * Only the static wallpaper set by using setImage can be obtained. 50361847f8eSopenharmony_ci * @permission ohos.permission.GET_WALLPAPER 50461847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 50561847f8eSopenharmony_ci * @returns { Promise<image.PixelMap> } the promise returned by the function. 50661847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 50761847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 50861847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 50961847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 51061847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 51161847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 51261847f8eSopenharmony_ci * @since 9 51361847f8eSopenharmony_ci */ 51461847f8eSopenharmony_ci function getImage(wallpaperType: WallpaperType): Promise<image.PixelMap>; 51561847f8eSopenharmony_ci 51661847f8eSopenharmony_ci /** 51761847f8eSopenharmony_ci * Sets live wallpaper of the specified type based on the uri path of the MP4 file. 51861847f8eSopenharmony_ci * 51961847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 52061847f8eSopenharmony_ci * @param { string } source - indicates the uri path of the MP4 file. 52161847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 52261847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setVideo. 52361847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 52461847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 52561847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 52661847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 52761847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 52861847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 52961847f8eSopenharmony_ci * @since 10 53061847f8eSopenharmony_ci */ 53161847f8eSopenharmony_ci function setVideo(source: string, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 53261847f8eSopenharmony_ci 53361847f8eSopenharmony_ci /** 53461847f8eSopenharmony_ci * Sets live wallpaper of the specified type based on the uri path of the MP4 file. 53561847f8eSopenharmony_ci * 53661847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 53761847f8eSopenharmony_ci * @param { string } source - indicates the uri path of the MP4 file. 53861847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 53961847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 54061847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 54161847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 54261847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 54361847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 54461847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 54561847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 54661847f8eSopenharmony_ci * @since 10 54761847f8eSopenharmony_ci */ 54861847f8eSopenharmony_ci function setVideo(source: string, wallpaperType: WallpaperType): Promise<void>; 54961847f8eSopenharmony_ci 55061847f8eSopenharmony_ci /** 55161847f8eSopenharmony_ci * Sets wallpaper of the specified type based on the uri path of the custom wallpaper. 55261847f8eSopenharmony_ci * 55361847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 55461847f8eSopenharmony_ci * @param { string } source - indicates the uri path of the custom wallpaper. 55561847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 55661847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setCustomWallpaper. 55761847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 55861847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 55961847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 56061847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 56161847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 56261847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 56361847f8eSopenharmony_ci * @since 10 56461847f8eSopenharmony_ci */ 56561847f8eSopenharmony_ci function setCustomWallpaper(source: string, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; 56661847f8eSopenharmony_ci 56761847f8eSopenharmony_ci /** 56861847f8eSopenharmony_ci * Sets wallpaper of the specified type based on the uri path of the custom wallpaper. 56961847f8eSopenharmony_ci * 57061847f8eSopenharmony_ci * @permission ohos.permission.SET_WALLPAPER 57161847f8eSopenharmony_ci * @param { string } source - indicates the uri path of the custom wallpaper. 57261847f8eSopenharmony_ci * @param { WallpaperType } wallpaperType - indicates the wallpaper type. 57361847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 57461847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 57561847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 57661847f8eSopenharmony_ci * @throws { BusinessError } 201 - permission denied. 57761847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 57861847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 57961847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 58061847f8eSopenharmony_ci * @since 10 58161847f8eSopenharmony_ci */ 58261847f8eSopenharmony_ci function setCustomWallpaper(source: string, wallpaperType: WallpaperType): Promise<void>; 58361847f8eSopenharmony_ci 58461847f8eSopenharmony_ci /** 58561847f8eSopenharmony_ci * Registers a listener for wallpaper color changes to receive notifications about the changes. 58661847f8eSopenharmony_ci * 58761847f8eSopenharmony_ci * @param { 'colorChange' } type - the incoming colorChange table open receiver pick a color change wallpaper wallpaper color changes. 58861847f8eSopenharmony_ci * @param { function } callback - provides dominant colors of the wallpaper. 58961847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 59061847f8eSopenharmony_ci * @since 7 59161847f8eSopenharmony_ci * @deprecated since 9 59261847f8eSopenharmony_ci */ 59361847f8eSopenharmony_ci function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; 59461847f8eSopenharmony_ci 59561847f8eSopenharmony_ci /** 59661847f8eSopenharmony_ci * Registers a listener for wallpaper changes to receive notifications about the changes. 59761847f8eSopenharmony_ci * 59861847f8eSopenharmony_ci * @param { 'wallpaperChange' } type - the incoming wallpaperChange table open receiver when the user modifies the wallpaper settings. 59961847f8eSopenharmony_ci * @param { function } callback - wallpaperType indicates the wallpaper type. 60061847f8eSopenharmony_ci * resourceType indicates the resource type of the wallpaper. 60161847f8eSopenharmony_ci * uri indicates the wallpaper resource address. 60261847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 60361847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 60461847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 60561847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 60661847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 60761847f8eSopenharmony_ci * @since 10 60861847f8eSopenharmony_ci */ 60961847f8eSopenharmony_ci function on( 61061847f8eSopenharmony_ci type: 'wallpaperChange', 61161847f8eSopenharmony_ci callback: (wallpaperType: WallpaperType, resourceType: WallpaperResourceType, uri?: string) => void 61261847f8eSopenharmony_ci ): void; 61361847f8eSopenharmony_ci 61461847f8eSopenharmony_ci /** 61561847f8eSopenharmony_ci * Unregisters a listener for wallpaper color changes. 61661847f8eSopenharmony_ci * 61761847f8eSopenharmony_ci * @param { 'colorChange' } type - incoming colorChange table delete receiver to pick up a color change wallpaper wallpaper color changes 61861847f8eSopenharmony_ci * @param { function } callback - provides dominant colors of the wallpaper. 61961847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 62061847f8eSopenharmony_ci * @since 7 62161847f8eSopenharmony_ci * @deprecated since 9 62261847f8eSopenharmony_ci */ 62361847f8eSopenharmony_ci function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; 62461847f8eSopenharmony_ci 62561847f8eSopenharmony_ci /** 62661847f8eSopenharmony_ci * Unregisters a listener for wallpaper changes. 62761847f8eSopenharmony_ci * 62861847f8eSopenharmony_ci * @param { 'wallpaperChange' } type - the incoming wallpaperChange table delete receiver when the user modifies the wallpaper settings. 62961847f8eSopenharmony_ci * @param { function } callback - wallpaperType indicates the wallpaper type. 63061847f8eSopenharmony_ci * resourceType indicates the resource type of the wallpaper. 63161847f8eSopenharmony_ci * uri indicates the wallpaper resource address. 63261847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 63361847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 63461847f8eSopenharmony_ci * @throws { BusinessError } 202 - permission verification failed, application which is not a system application uses system API. 63561847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Wallpaper 63661847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 63761847f8eSopenharmony_ci * @since 10 63861847f8eSopenharmony_ci */ 63961847f8eSopenharmony_ci function off( 64061847f8eSopenharmony_ci type: 'wallpaperChange', 64161847f8eSopenharmony_ci callback?: (wallpaperType: WallpaperType, resourceType: WallpaperResourceType, uri?: string) => void 64261847f8eSopenharmony_ci ): void; 64361847f8eSopenharmony_ci} 64461847f8eSopenharmony_ci 64561847f8eSopenharmony_ciexport default wallpaper; 646