提交 03a1e644 编写于 作者: E ester.zhou

Update docs (16121)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 266f0426
......@@ -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.isSecure<sup>9+</sup>
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.unlock<sup>9+</sup>
unlock(callback: AsyncCallback&lt;boolean&gt;): 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.isLocked<sup>9+</sup>](#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.isLocked<sup>9+</sup>](#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.isSecure<sup>9+</sup>](#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.isSecure<sup>9+</sup>](#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.unlock<sup>9+</sup>](#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.unlock<sup>9+</sup>](#screenlockunlock9) instead.
> This API is supported since API version 7 and deprecated since API version 9.
**System capability**: SystemCapability.MiscServices.ScreenLock
......
......@@ -14,7 +14,7 @@ The **wallpaper** module is a system service module in OpenHarmony that provides
import wallpaper from '@ohos.wallpaper';
```
## WallpaperType
## WallpaperType<sup>7+</sup>
Enumerates the wallpaper types.
......@@ -26,12 +26,14 @@ Enumerates the wallpaper types.
| WALLPAPER_LOCKSCREEN | 1 |Lock screen wallpaper.|
## RgbaColor
## RgbaColor<sup>9+</sup>
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.getIdSync<sup>9+</sup>
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.getMinHeightSync<sup>9+</sup>
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.isChangeAllowed<sup>9+</sup>
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.isUserChangeAllowed<sup>9+</sup>
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.restore<sup>9+</sup>
restore(wallpaperType: WallpaperType, callback: AsyncCallback&lt;void&gt;): 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.getFileSync<sup>9+</sup>
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.getImage<sup>9+</sup>
getImage(wallpaperType: WallpaperType, callback: AsyncCallback&lt;image.PixelMap&gt;): void;
......@@ -449,12 +361,16 @@ wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
});
```
## wallpaper.on('colorChange')<sup>9+</sup>
## wallpaper.on('colorChange')<sup>(deprecated)</sup>
on(type: 'colorChange', callback: (colors: Array&lt;RgbaColor&gt;, wallpaperType: WallpaperType) =&gt; 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')<sup>9+</sup>
## wallpaper.off('colorChange')<sup>(deprecated)</sup>
off(type: 'colorChange', callback?: (colors: Array&lt;RgbaColor&gt;, wallpaperType: WallpaperType) =&gt; 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.getColorsSync<sup>9+</sup>](#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.getColorsSync<sup>9+</sup>](#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.getIdSync<sup>9+</sup>](#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.getIdSync<sup>9+</sup>](#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.getMinHeightSync<sup>9+</sup>](#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.getMinHeightSync<sup>9+</sup>](#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.getMinWidthSync<sup>9+</sup>](#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.getMinWidthSync<sup>9+</sup>](#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.isChangeAllowed<sup>9+</sup>](#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.isChangeAllowed<sup>9+</sup>](#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.isUserChangeAllowed<sup>9+</sup>](#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.isUserChangeAllowed<sup>9+</sup>](#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.restore<sup>9+</sup>](#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.restore<sup>9+</sup>](#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.setImage<sup>9+</sup>](#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.setImage<sup>9+</sup>](#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.getFileSync<sup>9+</sup>](#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.getFileSync<sup>9+</sup>](#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.getImage<sup>9+</sup>](#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.getImage<sup>9+</sup>](#wallpapergetimage9) instead.
> This API is supported since API version 7 and deprecated since API version 9.
**Required permissions**: ohos.permission.GET_WALLPAPER
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册