diff --git a/en/application-dev/reference/apis/js-apis-screen-lock.md b/en/application-dev/reference/apis/js-apis-screen-lock.md index 925d53a00a37e2e0c8a72308fd310ac0df597bbc..2ee3029a1f51022c1ce7bf39fddfe9288ec45e11 100644 --- a/en/application-dev/reference/apis/js-apis-screen-lock.md +++ b/en/application-dev/reference/apis/js-apis-screen-lock.md @@ -58,6 +58,8 @@ Checks whether the screen is locked. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API. + **Return value** | Type | Description | @@ -70,26 +72,6 @@ Checks whether the screen is locked. let isLocked = screenlock.isLocked(); ``` -## screenlock.isSecure9+ - -isSecure(): boolean - -Checks whether the device is in secure mode. When the device is in secure mode, its screen requires a password, unlock pattern, or other user credentials to unlock. - -**System capability**: SystemCapability.MiscServices.ScreenLock - -**Return value** - -| Type | Description | -| ------- | ------------------------------------------------------------ | -| boolean | Returns **true** if the device is in secure mode; returns **false** otherwise.| - -**Example** - -```js -let isSecure = screenlock.isSecure(); -``` - ## screenlock.unlock9+ unlock(callback: AsyncCallback<boolean>): void @@ -98,6 +80,8 @@ Unlocks the screen. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -132,6 +116,8 @@ Unlocks the screen. This API uses a promise to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API. + **Return value** | Type | Description | @@ -347,7 +333,7 @@ Checks whether the screen is locked. This API uses an asynchronous callback to r > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isLocked9+](#screenlockislocked9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -377,7 +363,7 @@ Checks whether the screen is locked. This API uses a promise to return the resul > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isLocked9+](#screenlockislocked9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -405,7 +391,7 @@ Checks whether the device is in secure mode. When the device is in secure mode, > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isSecure9+](#screenlockissecure9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -435,7 +421,7 @@ Checks whether the device is in secure mode. When the device is in secure mode, > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isSecure9+](#screenlockissecure9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -462,7 +448,7 @@ Unlocks the screen. This API uses an asynchronous callback to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.unlock9+](#screenlockunlock9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -492,7 +478,7 @@ Unlocks the screen. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.unlock9+](#screenlockunlock9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock diff --git a/en/application-dev/reference/apis/js-apis-wallpaper.md b/en/application-dev/reference/apis/js-apis-wallpaper.md index e8d51f5b1c24b57ecabb1de9341abdac99200e82..28866930fd3a2474f9c0799b9b0f00b9d12006ee 100644 --- a/en/application-dev/reference/apis/js-apis-wallpaper.md +++ b/en/application-dev/reference/apis/js-apis-wallpaper.md @@ -14,7 +14,7 @@ The **wallpaper** module is a system service module in OpenHarmony that provides import wallpaper from '@ohos.wallpaper'; ``` -## WallpaperType +## WallpaperType7+ Enumerates the wallpaper types. @@ -26,12 +26,14 @@ Enumerates the wallpaper types. | WALLPAPER_LOCKSCREEN | 1 |Lock screen wallpaper.| -## RgbaColor +## RgbaColor9+ Defines the RGBA color space for the wallpaper. **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | | red | number | Yes| Yes| Red color. The value ranges from 0 to 255.| @@ -48,6 +50,8 @@ Obtains the main color information of the wallpaper of the specified type. **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| @@ -71,37 +75,6 @@ try { } ``` -## wallpaper.getIdSync9+ - -getIdSync(wallpaperType: WallpaperType): number - -Obtains the ID of the wallpaper of the specified type. - -**System capability**: SystemCapability.MiscServices.Wallpaper - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | ID of the wallpaper. If this type of wallpaper is configured, a number greater than or equal to **0** is returned. Otherwise, **-1** is returned. The value ranges from -1 to (2^31-1).| - -**Example** - -```js -try { - let id = wallpaper.getIdSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); - console.log(`success to getIdSync: ${JSON.stringify(id)}`); -} catch (error) { - console.error(`failed to getIdSync because: ${JSON.stringify(error)}`); -} -``` - ## wallpaper.getMinHeightSync9+ getMinHeightSync(): number @@ -110,6 +83,8 @@ Obtains the minimum height of this wallpaper. **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Return value** | Type| Description| @@ -130,6 +105,8 @@ Obtains the minimum width of this wallpaper. **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Return value** | Type| Description| @@ -142,46 +119,6 @@ Obtains the minimum width of this wallpaper. let minWidth = wallpaper.getMinWidthSync(); ``` -## wallpaper.isChangeAllowed9+ - -isChangeAllowed(): boolean - -Checks whether to allow the application to change the wallpaper for the current user. - -**System capability**: SystemCapability.MiscServices.Wallpaper - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Whether to allow the application to change the wallpaper for the current user. The value **true** means that the operation is allowed, and **false** means the opposite.| - -**Example** - -```js -let isChangeAllowed = wallpaper.isChangeAllowed(); -``` - -## wallpaper.isUserChangeAllowed9+ - -isUserChangeAllowed(): boolean - -Checks whether the user is allowed to set wallpapers. - -**System capability**: SystemCapability.MiscServices.Wallpaper - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Whether the user is allowed to set wallpapers. The value **true** means that the operation is allowed, and **false** means the opposite.| - -**Example** - -```js -let isUserChangeAllowed = wallpaper.isUserChangeAllowed(); -``` - ## wallpaper.restore9+ restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void @@ -192,6 +129,8 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| @@ -221,6 +160,8 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| @@ -253,6 +194,8 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| @@ -306,6 +249,8 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| @@ -350,39 +295,6 @@ imageSource.createPixelMap(opts).then((pixelMap) => { }); ``` -## wallpaper.getFileSync9+ - -getFileSync(wallpaperType: WallpaperType): number; - -Obtains the wallpaper of the specified type. - -**Required permissions**: ohos.permission.GET_WALLPAPER - -**System capability**: SystemCapability.MiscServices.Wallpaper - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Promise used to return the result. If the operation is successful, the file descriptor ID to the wallpaper is returned. Otherwise, error information is returned.| - -**Example** - -```js -try { - let file = wallpaper.getFileSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); - console.log(`success to getFileSync: ${JSON.stringify(file)}`); -} catch (error) { - console.error(`failed to getFileSync because: ${JSON.stringify(error)}`); -} -``` - ## wallpaper.getImage9+ getImage(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void; @@ -449,12 +361,16 @@ wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => { }); ``` -## wallpaper.on('colorChange')9+ +## wallpaper.on('colorChange')(deprecated) on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void Subscribes to the wallpaper color change event. +> **NOTE** +> +> This API is supported since API version 7 and deprecated since API version 9. + **System capability**: SystemCapability.MiscServices.Wallpaper **Parameters** @@ -477,12 +393,16 @@ try { } ``` -## wallpaper.off('colorChange')9+ +## wallpaper.off('colorChange')(deprecated) off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void Unsubscribes from the wallpaper color change event. +> **NOTE** +> +> This API is supported since API version 7 and deprecated since API version 9. + **System capability**: SystemCapability.MiscServices.Wallpaper **Parameters** @@ -527,7 +447,7 @@ Obtains the main color information of the wallpaper of the specified type. This > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getColorsSync9+](#wallpapergetcolorssync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -558,7 +478,7 @@ Obtains the main color information of the wallpaper of the specified type. This > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getColorsSync9+](#wallpapergetcolorssync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -592,7 +512,7 @@ Obtains the ID of the wallpaper of the specified type. This API uses an asynchro > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getIdSync9+](#wallpapergetidsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -623,7 +543,7 @@ Obtains the ID of the wallpaper of the specified type. This API uses a promise t > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getIdSync9+](#wallpapergetidsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -657,7 +577,7 @@ Obtains the minimum height of this wallpaper. This API uses an asynchronous call > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinHeightSync9+](#wallpapergetminheightsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -687,7 +607,7 @@ Obtains the minimum height of this wallpaper. This API uses a promise to return > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinHeightSync9+](#wallpapergetminheightsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -715,7 +635,7 @@ Obtains the minimum width of this wallpaper. This API uses an asynchronous callb > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinWidthSync9+](#wallpapergetminwidthsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -745,7 +665,7 @@ Obtains the minimum width of this wallpaper. This API uses a promise to return t > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinWidthSync9+](#wallpapergetminwidthsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -773,7 +693,7 @@ Checks whether to allow the application to change the wallpaper for the current > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isChangeAllowed9+](#wallpaperischangeallowed9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -803,7 +723,7 @@ Checks whether to allow the application to change the wallpaper for the current > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isChangeAllowed9+](#wallpaperischangeallowed9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -831,7 +751,7 @@ Checks whether the user is allowed to set wallpapers. This API uses an asynchron > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isUserChangeAllowed9+](#wallpaperisuserchangeallowed9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -861,7 +781,7 @@ Checks whether the user is allowed to set wallpapers. This API uses a promise to > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isUserChangeAllowed9+](#wallpaperisuserchangeallowed9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -889,7 +809,7 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.restore9+](#wallpaperrestore9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.SET_WALLPAPER @@ -922,7 +842,7 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.restore9+](#wallpaperrestore9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.SET_WALLPAPER @@ -958,7 +878,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.setImage9+](#wallpapersetimage9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.SET_WALLPAPER @@ -1015,7 +935,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.setImage9+](#wallpapersetimage9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.SET_WALLPAPER @@ -1074,7 +994,7 @@ Obtains the wallpaper of the specified type. This API uses an asynchronous callb > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [wallpaper.getFileSync9+](#wallpapergetfilesync9) instead. +> This API is supported since API version 8 and deprecated since API version 9. **Required permissions**: ohos.permission.GET_WALLPAPER @@ -1107,7 +1027,7 @@ Obtains the wallpaper of the specified type. This API uses a promise to return t > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [wallpaper.getFileSync9+](#wallpapergetfilesync9) instead. +> This API is supported since API version 8 and deprecated since API version 9. **Required permissions**: ohos.permission.GET_WALLPAPER @@ -1143,7 +1063,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses an > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getImage9+](#wallpapergetimage9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.GET_WALLPAPER @@ -1178,7 +1098,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses a p > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getImage9+](#wallpapergetimage9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.GET_WALLPAPER