提交 9902201d 编写于 作者: J jiangminsen

Merge remote-tracking branch 'upstream/master'

......@@ -397,7 +397,7 @@ zh-cn/application-dev/reference/apis/js-apis-notification.md @jayleehw @RayShih
zh-cn/application-dev/reference/apis/js-apis-observer.md @zhang-hai-feng @zengyawen @jyh926 @gaoxi785
zh-cn/application-dev/reference/apis/js-apis-osAccount.md @nianCode @zengyawen @JiDong-CS @murphy1984
zh-cn/application-dev/reference/apis/js-apis-particleAbility.md @littlejerry1 @RayShih @gwang2008 @chengxingzhen
zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @feng-aiwen @ge-yafang @gong-a-shi @logic42
zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @han-zhengshi @ge-yafang @logic42
zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md @littlejerry1 @RayShih @gwang2008 @chengxingzhen
zh-cn/application-dev/reference/apis/js-apis-plainarray.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-pointer.md @yuanxinying @ningningW @cococoler @alien0208
......
......@@ -18,7 +18,7 @@
- master:最新开发版本。
- OpenHarmony 3.2 Beta5版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.2-beta5.md)了解版本详情。
- OpenHarmony 3.2 Release版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.2-release.md)了解版本详情。
- OpenHarmony 3.1 Release版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.1-release.md)了解版本详情。
......
......@@ -228,7 +228,7 @@
- [@ohos.data.dataShareResultSet (DataShare Result Set)](js-apis-data-DataShareResultSet.md)
- [@ohos.data.distributedDataObject (Distributed Data Object)](js-apis-data-distributedobject.md)
- [@ohos.data.distributedKVStore (Distributed KV Store)](js-apis-distributedKVStore.md)
- [@ohos.data.preferences (Preferences)](js-apis-data-preferences.md)
- [@ohos.data.preferences (User Preferences)](js-apis-data-preferences.md)
- [@ohos.data.relationalStore (RDB Store)](js-apis-data-relationalStore.md)
- [@ohos.data.ValuesBucket (Value Bucket)](js-apis-data-valuesBucket.md)
......@@ -239,7 +239,7 @@
- [@ohos.file.fileUri (File URI)](js-apis-file-fileUri.md)
- [@ohos.file.fs (File Management)](js-apis-file-fs.md)
- [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md)
- [@ohos.file.picker (Picker)](js-apis-file-picker.md)
- [@ohos.file.picker (File Picker)](js-apis-file-picker.md)
- [@ohos.file.securityLabel (Data Label)](js-apis-file-securityLabel.md)
- [@ohos.file.statvfs (File System Space Statistics)](js-apis-file-statvfs.md)
- [@ohos.file.storageStatistics (Application Storage Statistics)](js-apis-file-storage-statistics.md)
......@@ -267,7 +267,7 @@
- [@ohos.request (Upload and Download)](js-apis-request.md)
- Connectivity
- [@ohos.bluetooth (Bluetooth) (To Be Deprecated Soon)](js-apis-bluetooth.md)
- [@ohos.bluetooth (Bluetooth)(To Be Deprecated Soon)](js-apis-bluetooth.md)
- [@ohos.bluetoothManager (Bluetooth)(js-apis-bluetoothManager.md)
- [@ohos.connectedTag (Active Tags)](js-apis-connectedTag.md)
- [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](js-apis-cardEmulation.md)
......@@ -276,8 +276,8 @@
- [@ohos.rpc (RPC)](js-apis-rpc.md)
- [@ohos.wifiManager (WLAN)](js-apis-wifiManager.md)
- [@ohos.wifiManagerExt (WLAN Extension)](js-apis-wifiManagerExt.md)
- [@ohos.wifi (To Be Deprecated Soon)](js-apis-wifi.md)
- [@ohos.wifiext (To Be Deprecated Soon)](js-apis-wifiext.md)
- [@ohos.wifi (WLAN)(To Be Deprecated Soon)](js-apis-wifi.md)
- [@ohos.wifiext (WLAN Extension)(To Be Deprecated Soon)](js-apis-wifiext.md)
- tag
- [nfctech (Standard NFC Technologies)](js-apis-nfctech.md)
- [tagSession (Standard NFC Tag Session)](js-apis-tagSession.md)
......
......@@ -547,7 +547,7 @@ startBluetoothDiscovery(): void
Starts Bluetooth scan to discover remote devices.
**Rquired permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Core
......@@ -652,6 +652,98 @@ try {
```
## bluetoothManager.setDevicePinCode<sup>10+</sup><a name="setDevicePinCode"></a>
setDevicePinCode(device: string, code: string, callback: AsyncCallback&lt;void&gt;): void
Sets the PIN for the device when [PinType](#pintype10) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**.
**Required permissions**: ohos.permission.MANAGE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------- | ---- | -------------------------------- |
| device | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
| code | string | Yes | PIN to set. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900099 | Operation failed. |
**Example**
```js
//callback
try {
bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345', (err, data) => {
console.info('setDevicePinCode,device name err:' + JSON.stringify(err) + ',device name:' + JSON.stringify(data));
});
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
## bluetoothManager.setDevicePinCode<sup>10+</sup><a name="setDevicePinCode"></a>
setDevicePinCode(device: string, code: string): Promise&lt;void&gt;
Sets the PIN for the device when [PinType](#pintype10) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------- | ---- | -------------------------------- |
| device | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
| code | string | Yes | PIN to set. |
**Return value**
| Type | Description |
| ------------------- | ------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900099 | Operation failed. |
**Example**
```js
//promise
try {
bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345').then(() => {
console.info('setDevicePinCode');
}, error => {
console.info('setDevicePinCode: errCode:' + error.code + ',errMessage' + error.message);
})
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
## bluetoothManager.on('bluetoothDeviceFind')
on(type: "bluetoothDeviceFind", callback: Callback&lt;Array&lt;string&gt;&gt;): void
......@@ -1385,7 +1477,7 @@ Creates a **GattServer** instance.
| Type | Description |
| ------------------------- | ------------------------------------ |
| [GattServer](#gattserver) | **GattServer** instance created. Before using an API of the server, you must create a **GattSever** instance.|
| [GattServer](#gattserver) | **GattServer** instance created. Before using an API of this class, you must create a **GattSever** instance.|
**Example**
......@@ -2333,17 +2425,6 @@ Obtains the network sharing status.
| --------------------- | --------------------------------- |
| boolean | Returns **true** if tethering is available over a Bluetooth PAN; return **false** otherwise.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
......@@ -3258,7 +3339,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2901000 | Read forbidden. |
|2901000 | Read forbidden. |
|2900099 | Operation failed. |
**Example**
......@@ -3327,7 +3408,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2901000 | Read forbidden. |
|2901000 | Read forbidden. |
|2900099 | Operation failed. |
**Example**
......@@ -3382,7 +3463,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2901000 | Read forbidden. |
|2901000 | Read forbidden. |
|2900099 | Operation failed. |
**Example**
......@@ -3444,7 +3525,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2901000 | Read forbidden. |
|2901000 | Read forbidden. |
|2900099 | Operation failed. |
**Example**
......@@ -3491,7 +3572,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2901001 | Write forbidden. |
|2901001 | Write forbidden. |
|2900099 | Operation failed. |
**Example**
......@@ -3545,7 +3626,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2901001 | Write forbidden. |
|2901001 | Write forbidden. |
|2900099 | Operation failed. |
**Example**
......@@ -4016,17 +4097,18 @@ Defines the characteristic API parameters.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
| Name | Type | Readable | Writable | Description |
| ------------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.|
| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. |
| descriptors | Array&lt;[BLEDescriptor](#bledescriptor)&gt; | Yes | Yes | List of descriptors of the characteristic. |
| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. |
| descriptors | Array&lt;[BLEDescriptor](#bledescriptor)&gt; | Yes | Yes | List of descriptors of the characteristic. |
| properties<sup>10+</sup> | [GattProperties](#gattproperties10) | Yes | Yes | Properties of the characteristic. |
## BLEDescriptor
Defines the descriptor API parameters.
Defines the BLE descriptor.
**System capability**: SystemCapability.Communication.Bluetooth.Core
......@@ -4229,6 +4311,7 @@ Defines the scan result.
| deviceId | string | Yes | No | Address of the scanned device, for example, XX:XX:XX:XX:XX:XX.|
| rssi | number | Yes | No | RSSI of the device. |
| data | ArrayBuffer | Yes | No | Advertisement packets sent by the device. |
| deviceName<sup>10+</sup> | string | Yes | No | Name of the device detected. |
## BluetoothState
......@@ -4308,6 +4391,7 @@ Defines the pairing request parameters.
| -------- | ------ | ---- | ---- | ----------- |
| deviceId | string | Yes | No | ID of the device to pair.|
| pinCode | string | Yes | No | Key for the device pairing. |
| pinType<sup>10+</sup> | [PinType](#pintype10) | Yes | No | Type of the device to pair. |
## BondStateParam<a name="BondStateParam"></a>
......@@ -4334,6 +4418,21 @@ Defines the profile state change parameters.
| state | [ProfileConnectionState](#profileconnectionstate) | Yes | No | Profile connection state of the device.|
## GattProperties<sup>10+</sup><a name="GattProperties"></a>
Defines the properties of a GATT characteristic.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Read-only | Mandatory | Description |
| -------- | ------ | ---- | ---- | ----------- |
| write<sup>10+</sup> | boolean | Yes | Yes | Permits writes of the characteristic value (with a response).|
| writeNoResponse<sup>10+</sup> | boolean | Yes | Yes | Permits writes of the characteristic value (without a response).|
| read<sup>10+</sup> | boolean | Yes | Yes | Permits reads of the characteristic value.|
| notify<sup>10+</sup> | boolean | Yes | Yes | Permits notifications of the characteristic value.|
| indicate<sup>10+</sup> | boolean | Yes | Yes | Permits notifications of the characteristic value without acknowledgement.|
## DeviceClass<a name="DeviceClass"></a>
Defines the class of a Bluetooth device.
......@@ -4347,7 +4446,6 @@ Defines the class of a Bluetooth device.
| classOfDevice | number | Yes | No | Class of the device. |
## MajorClass<a name="MajorClass"></a>
Enumerates the major classes of Bluetooth devices.
......@@ -4489,3 +4587,21 @@ Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOS
| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | HFP profile. |
| PROFILE_HID_HOST | 6 | Human Interface Device (HID) profile. |
| PROFILE_PAN_NETWORK | 7 | PAN profile. |
## PinType<sup>10+</sup><a name="PinType"></a>
Enumerates the Bluetooth pairing types.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
| -------------------------------- | ------ | --------------- |
| PIN_TYPE_ENTER_PIN_CODE<sup>10+</sup> | 0 | The user needs to enter the PIN displayed on the peer device.|
| PIN_TYPE_ENTER_PASSKEY<sup>10+</sup> | 1 | The user needs to enter the PASSKEY displayed on the peer device. |
| PIN_TYPE_CONFIRM_PASSKEY<sup>10+</sup> | 2 | The user needs to confirm the PASSKEY displayed on the local device. |
| PIN_TYPE_NO_PASSKEY_CONSENT<sup>10+</sup> | 3 | There is no PASSKEY, and the user needs to accept or reject the pairing request. |
| PIN_TYPE_NOTIFY_PASSKEY<sup>10+</sup> | 4 | The user needs to enter the PASSKEY displayed on the local device on the peer device. |
| PIN_TYPE_DISPLAY_PIN_CODE<sup>10+</sup> | 5 | The user needs to enter the PIN displayed on the peer device for Bluetooth 2.0 devices. |
| PIN_TYPE_OOB_CONSENT<sup>10+</sup> | 6 | The user needs to accept or reject the out of band (OOB) pairing request. |
| PIN_TYPE_PIN_16_DIGITS<sup>10+</sup> | 7 | The user needs to enter the 16-digit PIN displayed on the peer device. |
# @ohos.data.preferences (Preferences)
# @ohos.data.preferences (User Preferences)
The **Preferences** module provides APIs for processing data in the form of key-value (KV) pairs and supports persistence of the KV pairs when required.
The **user preferences** module provides APIs for processing data in the form of key-value (KV) pairs and supports persistence of the KV pairs when required.
The key is of the string type, and the value can be a number, a string, a Boolean value, or an array of numbers, strings, or Boolean values.
......@@ -176,12 +176,12 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | ---------------------------------------------------- |
| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). |
| name | string | Yes | Name of the **Preferences** instance to delete. |
| name | string | Yes | Name of the **Preferences** instance to delete. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error code.|
**Error codes**
For details about the following error codes, see [Preference Error Codes](../errorcodes/errorcode-preferences.md).
For details about the error codes, see [User Preference Error Codes](../errorcodes/errorcode-preferences.md).
| ID| Error Message |
| -------- | ------------------------------|
......@@ -213,6 +213,7 @@ Stage model:
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
......@@ -257,7 +258,7 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi
**Error codes**
For details about the following error codes, see [Preference Error Codes](../errorcodes/errorcode-preferences.md).
For details about the error codes, see [User Preference Error Codes](../errorcodes/errorcode-preferences.md).
| ID| Error Message |
| -------- | ------------------------------|
......@@ -288,6 +289,7 @@ Stage model:
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try{
......@@ -348,6 +350,7 @@ Stage model:
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
......@@ -500,7 +503,7 @@ try {
promise.then((data) => {
console.info("Got the value of 'startup'. Data: " + data);
}).catch((err) => {
console.info("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message);
console.info("Failed to obtain the value of 'startup'. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
console.info("Failed to obtain the value of 'startup'. code =" + err.code + ", message =" + err.message);
......
......@@ -43,7 +43,7 @@
- [DataShare Error Codes](errorcode-datashare.md)
- [Distributed Data Object Error Codes](errorcode-distributed-dataObject.md)
- [Distributed KV Store Error Codes](errorcode-distributedKVStore.md)
- [Preferences Error Codes](errorcode-preferences.md)
- [User Preference Error Codes](errorcode-preferences.md)
- File Management
- [File Management Error Codes](errorcode-filemanagement.md)
- Telephony Service
......
# Preferences Error Codes
# User Preference Error Codes
> **NOTE**
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 15500010 Failed to Delete Preferences
## 15500010 Failed to Delete the User Preference Persistence File
**Error Message**
Failed to delete preferences.
**Description**
Failed to delete the preference.
The operation of deleting the user preference persistence file failed.
**Possible Causes**
......
# User Authentication Error Codes
# User Authentication Error Codes
> **NOTE**
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 201 Permission Verification Failed
For details, see [Universal Error Codes](./errorcode-universal.md).
## 202 Invoker Is Not a System Application
For details, see [Universal Error Codes](./errorcode-universal.md).
## 401 Parameter Check Failed.
For details, see [Universal Error Codes](./errorcode-universal.md).
## 12500001 Authentication Failed
**Error Message**
......
......@@ -397,7 +397,7 @@
import Ability from '@ohos.app.ability.UIAbility';
```
2. 获取Caller通信接口。
Ability的context属性实现了startAbilityByCall方法,用于获取指定通用组件的Caller通信接口。如下示例通过this.context获取Ability实例的context属性,使用startAbilityByCall拉起Callee被调用端并获取Caller通信接口,注册Caller的onRelease监听。应用开发者根据实际业务需要做相应处理。
Ability的context属性实现了startAbilityByCall方法,用于获取指定通用组件的Caller通信接口。如下示例通过this.context获取Ability实例的context属性,使用startAbilityByCall拉起Callee被调用端并获取Caller通信接口,注册Caller的onRelease和onRemoteStateChange监听。应用开发者根据实际业务需要做相应处理。
```ts
......@@ -418,6 +418,14 @@
console.info(`remote caller onRelease is called ${msg}`);
})
console.info('remote caller register OnRelease succeed');
// 注册caller的协同场景下跨设备组件状态变化监听通知
try {
caller.onRemoteStateChange((str) => {
console.log('Remote state changed ' + str);
});
} catch (error) {
console.log('Caller.onRemoteStateChange catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
}
}
}).catch((error) => {
console.error(`get remote caller failed with ${error}`);
......
......@@ -41,8 +41,17 @@ AVPlayer主要工作是将Audio/Video媒体资源转码为可供渲染的图像
## 兼容性说明
视频播放支持的视频格式分必选规格和可选规格。必选规格为所有厂商均支持的视频格式。对于可选规格,厂商将基于实际情况决定是否实现。建议开发者做兼容处理,保证全平台兼容。
推荐使用主流的播放格式和主流分辨率,不建议开发者自制非常或者异常码流,以免产生无法播放、卡住、花屏等兼容性问题。若发生此类问题不会影响系统,退出码流播放即可。
| 视频格式 | 是否必选规格 |
|:--------:|:-----:|
| H264 | 是 |
| MPEG2 | 否 |
| MPEG4 | 否 |
| H263 | 否 |
| VP8 | 否 |
主流的播放格式和主流分辨率如下:
| 视频容器规格 | 规格描述 | 分辨率 |
......
......@@ -77,7 +77,7 @@ export class AVRecorderDemo {
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 2000000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoCodec : media.CodecMimeType.VIDEO_AVC,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
......@@ -369,7 +369,7 @@ export class VideoRecorderDemo {
let videoProfile = {
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 2000000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoCodec : media.CodecMimeType.VIDEO_AVC,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
......@@ -487,4 +487,4 @@ export class VideoRecorderDemo {
音视频录制APP案例包含:创建实例、设置录制参数、获取输入surface、开始录制、暂停录制、恢复录制、停止录制、释放资源等流程。
详细代码可参考:[AVRecorderDemo]([multimedia_player_framework: Implementation of media playback and recording | 媒体播放和录制功能实现 - Gitee.com](https://gitee.com/openharmony/multimedia_player_framework/tree/master/test/appdemo/AVRecorderDemo))
\ No newline at end of file
详细代码可参考:[AVRecorderDemo]([multimedia_player_framework: Implementation of media playback and recording | 媒体播放和录制功能实现 - Gitee.com](https://gitee.com/openharmony/multimedia_player_framework/tree/master/test/sample/AVRecorder))
\ No newline at end of file
......@@ -25,8 +25,16 @@
3. 媒体服务把帧数据flush给surface buffer。
## 兼容性说明
推荐使用视频软件主流的播放格式和主流分辨率,不建议开发者自制非常或者异常码流,以免产生无法播放、卡住、花屏等兼容性问题。若发生此类问题不会影响系统,退出码流播放即可。
视频播放支持的视频格式分必选规格和可选规格。必选规格为所有厂商均支持的视频格式。对于可选规格,厂商将基于实际情况决定是否实现。建议开发者做兼容处理,保证全平台兼容。
推荐使用主流的播放格式和主流分辨率,不建议开发者自制非常或者异常码流,以免产生无法播放、卡住、花屏等兼容性问题。若发生此类问题不会影响系统,退出码流播放即可。
| 视频格式 | 是否必选规格 |
|:--------:|:-----:|
| H264 | 是 |
| MPEG2 | 否 |
| MPEG4 | 否 |
| H263 | 否 |
| VP8 | 否 |
主流的播放格式和主流分辨率如下:
......
......@@ -84,7 +84,7 @@ export class VideoRecorderDemo {
audioSampleRate : 48000,
fileFormat : 'mp4',
videoBitrate : 2000000,
videoCodec : 'video/mp4v-es',
videoCodec : 'video/avc',
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
......
......@@ -793,6 +793,11 @@ Wi-Fi P2P群组信息已更改。
- 值:usual.event.HTTP_PROXY_CHANGE
- 订阅者所需权限:无
## COMMON_EVENT_DOMAIN_ACCOUNT_STATUS_CHANGED<sup>10+<sup>
表示域账号状态发生变化。
- 值:usual.event.DOMAIN_ACCOUNT_STATUS_CHANGED
- 订阅者所需权限:无
## COMMON_EVENT_SIM_STATE_CHANGED<sup>10+<sup>
提示SIM卡状态更新。
- 值:usual.event.SIM_STATE_CHANGED
......
......@@ -574,6 +574,49 @@ release(): void;
}
```
## Caller.onRemoteStateChange
onRemoteStateChange(callback: OnRemoteStateChangeCallback): void;
注册协同场景下跨设备组件状态变化监听通知。
**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | [OnRemoteStateChangeCallback](#onremotestatechangecallback) | 是 | 返回onRemoteStateChange回调结果。 |
**示例:**
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
let caller;
let dstDeviceId: string;
export default class MainAbility extends UIAbility {
onWindowStageCreate(windowStage: Window.WindowStage) {
this.context.startAbilityByCall({
bundleName: 'com.example.myservice',
abilityName: 'MainUIAbility',
deviceId: dstDeviceId
}).then((obj) => {
caller = obj;
try {
caller.onRemoteStateChange((str) => {
console.log('Remote state changed ' + str);
});
} catch (error) {
console.log('Caller.onRemoteStateChange catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
}
}).catch((err) => {
console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}');
})
}
}
```
## Caller.on
on(type: 'release', callback: OnReleaseCallback): void;
......@@ -841,6 +884,16 @@ off(method: string): void;
| -------- | -------- | -------- | -------- | -------- |
| (msg: string) | 是 | 否 | function | 调用者注册的侦听器函数接口的原型。 |
## OnRemoteStateChangeCallback
(msg: string): void;
**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
| 名称 | 可读 | 可写 | 类型 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| (msg: string) | 是 | 否 | function | 调用者注册的协同场景下组件状态变化监听函数接口的原型。 |
## CalleeCallback
(indata: rpc.MessageSequence): rpc.Parcelable;
......
......@@ -101,3 +101,181 @@ dateTimeManager.setDateTime(wantTemp, 1526003846000).then(() => {
console.log("error code:" + error.code + " error message:" + error.message);
})
```
## dateTimeManager.disallowModifyDateTime<sup>10+</sup>
disallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback\<void>): void
禁止修改系统时间。使用callback异步回调。
**需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| disallow | boolean | 是 | true 表示禁止修改系统时间,false表示允许修改系统时间。 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当禁止修改系统时间设置成功err为null,否则为错误对象。 |
**错误码**
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.disallowModifyDateTime(wantTemp, true, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
})
```
## dateTimeManager.disallowModifyDateTime<sup>10+</sup>
disallowModifyDateTime(admin: Want, disallow: boolean): Promise\<void>
禁止修改系统时间。使用Promise异步回调。
**需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| disallow | boolean | 是 | true 表示禁止修改系统时间,false表示允许修改系统时间。 |
**返回值:**
| 类型 | 说明 |
| ----- | ----------------------------------- |
| Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**错误码**
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.disallowModifyDateTime(wantTemp, true).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
})
```
## dateTimeManager.isModifyDateTimeDisallowed<sup>10+</sup>
isModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback\<boolean>): void
查询是否允许修改系统时间。使用callback异步回调。
**需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| callback | AsyncCallback\<boolean> | 是 | 回调函数。callbac方式返回是否禁止修改系统时间策略。true表示禁止修改系统时间,否则表示允许修改系统时间。 |
**错误码**
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.isModifyDateTimeDisallowed(wantTemp, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
})
```
## dateTimeManager.isModifyDateTimeDisallowed<sup>10+</sup>
isModifyDateTimeDisallowed(admin: Want): Promise\<boolean>
查询是否允许修改系统时间。使用Promise异步回调。
**需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
**返回值:**
| 类型 | 说明 |
| ----- | ----------------------------------- |
| Promise\<boolean> | Promise对象。promise方式返回是否禁止修改系统时间策略。true表示禁止修改系统时间,否则表示允许修改系统时间。 |
**错误码**
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.disallowModifyDateTime(wantTemp).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
})
```
\ No newline at end of file
......@@ -102,3 +102,247 @@ wifiManager.isWifiActive(wantTemp).then((result) => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## wifiManager.setWifiProfile
setWifiProfile(admin: Want, profile: WifiProfile, callback: AsyncCallback&lt;void&gt;): void
配置wifi连接到指定网络,使用callback异步回调。
**需要权限:** ohos.permission.ENTERPRISE_SET_WIFI
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 |
| profile | [WifiProfile](#wifiprofile) | 是 | WLAN配置信息 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当接口调用成功err为null,否则为错误对象。 |
**错误码**
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let profile : WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.setWifiProfile(wantTemp, profile, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("set wifi success");
});
```
## wifiManager.setWifiProfile
setWifiProfile(admin: Want, profile: WifiProfile): Promise&lt;void&gt;
配置wifi连接到指定网络,使用promise异步回调。
**需要权限:** ohos.permission.ENTERPRISE_SET_WIFI
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 |
| profile | [WifiProfile](#wifiprofile) | 是 | WLAN配置信息 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**错误码**
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let profile : WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.isWifiActive(wantTemp, profile).then(() => {
console.log("set wifi success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## WifiProfile
WLAN配置信息
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | --------| ---- | ----- | ------------------------------- |
| ssid | string | 是 | 否 | 热点的SSID,编码格式为UTF-8。 |
| bssid | string | 是 | 否 | 热点的BSSID。 |
| preSharedKey | string | 是 | 否 | 热点的密钥。 |
| isHiddenSsid | boolean | 是 | 否 | 是否是隐藏网络。 |
| securityType | [WifiSecurityType](#wifisecuritytype) | 是 | 否 | 加密类型。 |
| creatorUid | number | 是 | 否 | 创建用户的ID。 |
| disableReason | number | 是 | 否 | 禁用原因。 |
| netId | number | 是 | 否 | 分配的网络ID。 |
| randomMacType | number | 是 | 否 | 随机MAC类型 |
| randomMacAddr | string | 是 | 否 | 随机MAC地址 |
| ipType | [IpType](#iptype) | 是 | 否 | IP地址类型 |
| staticIp | [IpProfile](#ipprofile) | 是 | 否 | 静态IP配置信息。 |
| eapProfile | [WifiEapProfile](#wifieapprofile) | 是 | 否 | 可扩展身份验证协议配置。 |
## WifiSecurityType
表示加密类型的枚举。
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| WIFI_SEC_TYPE_INVALID | 0 | 无效加密类型。 |
| WIFI_SEC_TYPE_OPEN | 1 | 开放加密类型。 |
| WIFI_SEC_TYPE_WEP | 2 | Wired&nbsp;Equivalent&nbsp;Privacy&nbsp;(WEP)加密类型。 |
| WIFI_SEC_TYPE_PSK | 3 | Pre-shared&nbsp;key&nbsp;(PSK)加密类型。 |
| WIFI_SEC_TYPE_SAE | 4 | Simultaneous&nbsp;Authentication&nbsp;of&nbsp;Equals&nbsp;(SAE)加密类型。 |
| WIFI_SEC_TYPE_EAP | 5 | EAP加密类型。 |
| WIFI_SEC_TYPE_EAP_SUITE_B | 6 | Suite-B 192位加密类型。 |
| WIFI_SEC_TYPE_OWE | 7 | 机会性无线加密类型。 |
| WIFI_SEC_TYPE_WAPI_CERT | 8 | WAPI-Cert加密类型。 |
| WIFI_SEC_TYPE_WAPI_PSK | 9 | WAPI-PSK加密类型。 |
## IpType
表示IP类型的枚举。
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| STATIC | 0 | 静态IP。 |
| DHCP | 1 | 通过DHCP获取。 |
| UNKNOWN | 2 | 未指定。 |
## IpProfile
IP配置信息。
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ipAddress | number | 是 | 否 | IP地址。 |
| gateway | number | 是 | 否 | 网关。 |
| prefixLength | number | 是 | 否 | 掩码。 |
| dnsServers | number[] | 是 | 否 | DNS服务器。 |
| domains | Array&lt;string&gt; | 是 | 否 | 域信息。 |
## WifiEapProfile
可扩展身份验证协议配置信息。
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
| **名称** | **类型** | **可读** | **可写** | **说明** |
| -------- | -------- | -------- | -------- | -------- |
| eapMethod | [EapMethod](#eapmethod) | 是 | 否 | EAP认证方式。 |
| phase2Method | [Phase2Method](#phase2method) | 是 | 否 | 第二阶段认证方式。 |
| identity | string | 是 | 否 | 身份信息。 |
| anonymousIdentity | string | 是 | 否 | 匿名身份。 |
| password | string | 是 | 否 | 密码。 |
| caCertAliases | string | 是 | 否 | CA 证书别名。 |
| caPath | string | 是 | 否 | CA 证书路径。 |
| clientCertAliases | string | 是 | 否 | 客户端证书别名。 |
| certEntry | Uint8Array | 是 | 是 | CA 证书内容。 |
| certPassword | string | 是 | 是 | CA证书密码。 |
| altSubjectMatch | string | 是 | 否 | 替代主题匹配。 |
| domainSuffixMatch | string | 是 | 否 | 域后缀匹配。 |
| realm | string | 是 | 否 | 通行证凭证的领域。 |
| plmn | string | 是 | 否 | 公共陆地移动网的直通凭证提供商。 |
| eapSubId | number | 是 | 否 | SIM卡的子ID。 |
## EapMethod
表示EAP认证方式的枚举。
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| EAP_NONE | 0 | 不指定。 |
| EAP_PEAP | 1 | PEAP类型。 |
| EAP_TLS | 2 | TLS类型。 |
| EAP_TTLS | 3 | TTLS类型。 |
| EAP_PWD | 4 | PWD类型。 |
| EAP_SIM | 5 | SIM类型。 |
| EAP_AKA | 6 | AKA类型。 |
| EAP_AKA_PRIME | 7 | AKA Prime类型。 |
| EAP_UNAUTH_TLS | 8 | UNAUTH TLS类型。 |
## Phase2Method
表示第二阶段认证方式的枚举。
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| PHASE2_NONE | 0 | 不指定。 |
| PHASE2_PAP | 1 | PAP类型。 |
| PHASE2_MSCHAP | 2 | MSCHAP类型。 |
| PHASE2_MSCHAPV2 | 3 | MSCHAPV2类型。 |
| PHASE2_GTC | 4 | GTC类型。 |
| PHASE2_SIM | 5 | SIM类型。 |
| PHASE2_AKA | 6 | AKA类型。 |
| PHASE2_AKA_PRIME | 7 | AKA Prime类型。 |
......@@ -121,7 +121,7 @@ try {
generateKeyItem(keyAlias: string, options: HuksOptions) : Promise\<void>
生成密钥,使用Promise方式异步返回结果,基于密钥不出TEE原则,通过promise不会返回密钥材料内容,只用于表示此次调用是否成功。
生成密钥,使用Promise方式异步返回结果基于密钥不出TEE原则,通过promise不会返回密钥材料内容,只用于表示此次调用是否成功。
**系统能力**:SystemCapability.Security.Huks
......@@ -1084,7 +1084,7 @@ isKeyItemExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<
| -------- | --------------------------- | ---- | --------------------------------------- |
| keyAlias | string | 是 | 所需查找的密钥的别名。 |
| options | [HuksOptions](#huksoptions) | 是 | 空对象(此处传空即可)。 |
| callback | AsyncCallback\<boolean> | 是 | 回调函数。若密钥存在,data为true,若密钥不存在,则error中会输出不存在的error code |
| callback | AsyncCallback\<boolean> | 是 | 回调函数。若密钥存在,data为true,若密钥不存在,则error中会输出密钥不存在的error code。 |
**示例:**
......@@ -1128,7 +1128,7 @@ isKeyItemExist(keyAlias: string, options: HuksOptions) : Promise\<boolean>
| 类型 | 说明 |
| ----------------- | --------------------------------------- |
| Promise\<boolean> | Promise对象。密钥存在时,可通过then 进行密钥存在后的相关处理,若不存在,可通过error 处理密钥不存在后的相关业务操作 |
| Promise\<boolean> | Promise对象。密钥存在时,可通过then进行密钥存在后的相关处理,若不存在,可通过error处理密钥不存在后的相关业务操作。 |
**示例:**
......@@ -1920,16 +1920,16 @@ async function huksAbort() {
| HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | 表示派生密钥的大小。 |
| HUKS_TAG_IMPORT_KEY_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | 表示导入的密钥类型。 |
| HUKS_TAG_UNWRAP_ALGORITHM_SUITE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | 表示导入加密密钥的套件。 |
| HUKS_TAG_ACTIVE_DATETIME<sup>deprecated</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 |
| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME<sup>deprecated</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 |
| HUKS_TAG_USAGE_EXPIRE_DATETIME<sup>deprecated</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 |
| HUKS_TAG_CREATION_DATETIME<sup>deprecated</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 |
| HUKS_TAG_ACTIVE_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 |
| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 |
| HUKS_TAG_USAGE_EXPIRE_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 |
| HUKS_TAG_CREATION_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 |
| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | 预留 |
| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | 表示当前密钥属于哪个userID |
| HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | 预留。 |
| HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | 表示用户认证类型。从[HuksUserAuthType](#huksuserauthtype9)中选择,需要与安全访问控制类型同时设置。支持同时指定两种用户认证类型,如:安全访问控制类型指定为HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL时,密钥访问认证类型可以指定以下三种: HKS_USER_AUTH_TYPE_FACE 、HKS_USER_AUTH_TYPE_FINGERPRINT、HKS_USER_AUTH_TYPE_FACE \| HKS_USER_AUTH_TYPE_FINGERPRINT |
| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | 表示authtoken 单次有效期。 |
| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | 用于传入authToken 的字段 |
| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | 表示authtoken单次有效期。 |
| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | 用于传入authToken的字段 |
| HUKS_TAG_KEY_AUTH_ACCESS_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | 表示安全访问控制类型。从[HuksAuthAccessType](#huksauthaccesstype9)中选择,需要和用户认证类型同时设置。 |
| HUKS_TAG_KEY_SECURE_SIGN_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | 表示生成或导入密钥时,指定该密钥的签名类型。 |
| HUKS_TAG_CHALLENGE_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | 表示密钥使用时生成的challenge类型。从[HuksChallengeType](#hukschallengetype9)中选择 |
......@@ -1968,7 +1968,7 @@ async function huksAbort() {
| HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | 预留。 |
| HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | 表示密钥版本的Tag。 |
| HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | 预留。 |
| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | 用于传入GCM模式中的AEAD 数据的字段。 |
| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | 用于传入GCM模式中的AEAD数据的字段。 |
| HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | 预留。 |
| HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | 表示操作系统版本的Tag。 |
| HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | 表示操作系统补丁级别的Tag。 |
......
......@@ -1138,7 +1138,7 @@ setBitrate(bitrate: number): void
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------------------------------------------------------ |
| bitrate | number | 是 | 指定比特率,可以通过[availableBitrates](#availableBitrates_on)事件获得当前HLS协议流可用的比特率,如果用户指定的比特率不在此列表中,则播放器将从可用比特率列表中选择最小和最接近的比特率。 |
| bitrate | number | 是 | 指定比特率,可以通过[availableBitrates](#availableBitrates_on)事件获得当前HLS协议流可用的比特率,如果用户指定的比特率不在此列表中,则播放器将从可用比特率列表中选择最小和最接近的比特率。如果通过availableBitrates时间获得的比特率列表长度为0,则不支持指定比特率,也不会产生bitrateDone回调。 |
**示例:**
......@@ -1203,7 +1203,7 @@ on(type: 'availableBitrates', callback: (bitrates: Array\<number>) => void): voi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | HLS协议可用比特率上报事件回调类型,支持的事件:'availableBitrates',只会在prepared之后上报一次。 |
| callback | function | 是 | HLS协议可用比特率上报事件回调方法,使用数组存放支持的比特率。 |
| callback | function | 是 | HLS协议可用比特率上报事件回调方法,使用数组存放支持的比特率。如果数组长度为0,则不支持指定比特率。 |
**示例:**
......@@ -1762,7 +1762,7 @@ let AVRecorderProfile = {
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 2000000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoCodec : media.CodecMimeType.VIDEO_AVC,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
......@@ -1833,7 +1833,7 @@ let AVRecorderProfile = {
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 2000000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoCodec : media.CodecMimeType.VIDEO_AVC,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
......@@ -2535,7 +2535,7 @@ avRecorder.off('error');
| audioSampleRate | number | 否 | 音频采样率,选择音频录制时必填。 |
| fileFormat | [ContainerFormatType](#containerformattype8) | 是 | 文件的容器格式,必要参数。 |
| videoBitrate | number | 否 | 视频编码比特率,选择视频录制时必填。 |
| videoCodec | [CodecMimeType](#codecmimetype8) | 否 | 视频编码格式,选择视频录制时必填。当前仅支持VIDEO_AVC和VIDEO_MPEG4。 |
| videoCodec | [CodecMimeType](#codecmimetype8) | 否 | 视频编码格式,选择视频录制时必填。需要查询设备支持的编码能力(包括编码格式,分辨率大小等)。 |
| videoFrameWidth | number | 否 | 视频帧的宽,选择视频录制时必填。 |
| videoFrameHeight | number | 否 | 视频帧的高,选择视频录制时必填。 |
| videoFrameRate | number | 否 | 视频帧率,选择视频录制时必填。 |
......@@ -2644,7 +2644,7 @@ let videoProfile = {
audioSampleRate : 48000,
fileFormat : 'mp4',
videoBitrate : 2000000,
videoCodec : 'video/mp4v-es',
videoCodec : 'video/avc',
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
......@@ -2715,7 +2715,7 @@ let videoProfile = {
audioSampleRate : 48000,
fileFormat : 'mp4',
videoBitrate : 2000000,
videoCodec : 'video/mp4v-es',
videoCodec : 'video/avc',
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
......
......@@ -399,7 +399,7 @@ discoveryService.stopSearchingMDNS();
### on('discoveryStart')
on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MDNS_ERR}>): void
on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void
订阅开启监听mDNS服务的通知。
......@@ -410,7 +410,7 @@ on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, er
| 参数名 | 类型 | 必填 | 说明 |
|-------------|--------------|-----------|-----------------------------------------------------|
| type | string | 是 |订阅事件,固定为'discoveryStart'。<br>discoveryStart:开始搜索局域网内的mDNS服务事件。 |
| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MDNS_ERR](#mdns_err)}> | 是 | mDNS服务的信息和事件错误信息。 |
| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MdnsError](#mdnserror)}> | 是 | mDNS服务的信息和事件错误信息。 |
**示例:**
......@@ -428,7 +428,7 @@ discoveryService.stopSearchingMDNS();
### on('discoveryStop')
on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MDNS_ERR}>): void
on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void
订阅停止监听mDNS服务的通知。
......@@ -439,7 +439,7 @@ on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, err
| 参数名 | 类型 | 必填 | 说明 |
|-------------|--------------|-----------|-----------------------------------------------------|
| type | string | 是 |订阅事件,固定为'discoveryStop'。<br>discoveryStop:停止搜索局域网内的mDNS服务事件。 |
| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MDNS_ERR](#mdns_err)}> | 是 | mDNS服务的信息和事件错误信息。 |
| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MdnsError](#mdnserror)}> | 是 | mDNS服务的信息和事件错误信息。 |
**示例:**
......@@ -538,7 +538,7 @@ mDNS服务属性信息
| key | string | 是 | mDNS服务属性键值,键值长度应该小于9个字符。 |
| value | Array\<number> | 是 | mDNS服务属性值。 |
## MDNS_ERR
## MdnsError
mDNS错误信息。
......
......@@ -376,11 +376,11 @@ let record = pasteboard.createUriRecord('dataability:///com.example.myapplicatio
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- |--------------------------------------------------------------------------------------------|
| additions<sup>7+</sup> | {[key:string]:object} | 是 | 是 | 设置的其他附加属性数据, 暂不支持。 |
| additions<sup>7+</sup> | {[key:string]:object} | 是 | 是 | 设置其他附加属性数据。 |
| mimeTypes<sup>7+</sup> | Array&lt;string&gt; | 是 | 否 | 剪贴板内容条目的数据类型,非重复的类型列表。 |
| tag<sup>7+</sup> | string | 是 | 是 | 用户自定义标签, 暂不支持。 |
| tag<sup>7+</sup> | string | 是 | 是 | 用户自定义标签。 |
| timestamp<sup>7+</sup> | number | 是 | 否 | 剪贴板数据的写入时间戳(单位:ms)。 |
| localOnly<sup>7+</sup> | boolean | 是 | 是 | 配置剪贴板内容是否为“仅在本地”, 默认值为true。暂不支持, 推荐使用shareOption属性。<br/>- 配置为true时,表示内容仅在本地,不会在设备之间传递。<br/>- 配置为false时,表示内容将在设备间传递。 |
| localOnly<sup>7+</sup> | boolean | 是 | 是 | 配置剪贴板内容是否为“仅在本地”,默认值为false。暂不支持,推荐使用shareOption属性。<br/>- 配置为true时,表示内容仅在本地,不会在设备之间传递。<br/>- 配置为false时,表示内容将在设备间传递。 |
| shareOption<sup>9+</sup> | [ShareOption](#shareoption9) | 是 | 是 | 指示剪贴板数据可以粘贴到的范围,如果未设置或设置不正确,则默认值为CROSSDEVICE。 |
## PasteDataRecord<sup>7+</sup>
......
......@@ -1543,7 +1543,7 @@ closeRawFd(path: string, callback: AsyncCallback&lt;void&gt;): void
```
### closeRawFd<sup>8+</sup>
### closeRawFd<sup>9+</sup>
closeRawFd(path: string): Promise&lt;void&gt;
......
......@@ -25,7 +25,7 @@ zipFile(inFile: string, outFile: string, options: Options): Promise&lt;void&gt;
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-application-context.md)。 |
| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-inner-application-context.md)。 |
| outFile | string | 是 | 指定压缩结果的文件路径(文件的扩展名zip)。 |
| options | [Options](#options) | 是 | 压缩的可选参数。 |
......@@ -50,9 +50,9 @@ let options = {
};
zlib.zipFile(inFile, outFile, options).then((data) => {
console.log('zipFile result is ' + JSON.Stringify(data));
console.log('zipFile result is ' + JSON.stringify(data));
}).catch((err) => {
console.log('error is ' + JSON.Stringify(err));
console.log('error is ' + JSON.stringify(err));
});
```
......@@ -71,9 +71,9 @@ let options = {
};
zlib.zipFile(inFile , outFile, options).then((data) => {
console.log('zipFile result is ' + JSON.Stringify(data));
console.log('zipFile result is ' + JSON.stringify(data));
}).catch((err)=>{
console.log('error is ' + JSON.Stringify(err));
console.log('error is ' + JSON.stringify(err));
});
```
......@@ -91,7 +91,7 @@ unzipFile(inFile:string, outFile:string, options: Options): Promise&lt;void&gt;
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-application-context.md)。 |
| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-inner-application-context.md)。 |
| outFile | string | 是 | 指定的解压文件路径。 |
| options | [Options](#options) | 是 | 解压的可选参数。 |
......@@ -116,9 +116,9 @@ let options = {
strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY
};
zlib.unzipFile(inFile, outFile, options).then((data) => {
console.log('unzipFile result is ' + JSON.Stringify(data));
console.log('unzipFile result is ' + JSON.stringify(data));
}).catch((err)=>{
console.log('error is ' + JSON.Stringify(err));
console.log('error is ' + JSON.stringify(err));
})
```
......@@ -134,7 +134,7 @@ compressFile(inFile: string, outFile: string, options: Options, callback: AsyncC
| 参数名 | 类型 | 必填 | 说明 |
| ----------------------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-application-context.md)。 |
| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-inner-application-context.md)。 |
| outFile | string | 是 | 指定的解压文件路径。 |
| options | [Options](#options) | 是 | 压缩的配置参数。 |
| AsyncCallback<**void**> | callback | 否 | 压缩时的回调函数。 |
......@@ -182,7 +182,7 @@ compressFile(inFile: string, outFile: string, options: Options): Promise\<void>;
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-application-context.md)。 |
| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-inner-application-context.md)。 |
| outFile | string | 是 | 指定的解压文件路径。 |
| options | [Options](#options) | 是 | 压缩的配置参数。 |
......@@ -232,7 +232,7 @@ decompressFile(inFile: string, outFile: string, options: Options, callback: Asyn
| 参数名 | 类型 | 必填 | 说明 |
| ----------------------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-application-context.md)。 |
| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-inner-application-context.md)。 |
| outFile | string | 是 | 指定的解压后的目录路径。 |
| options | [Options](#options) | 是 | 解压的配置参数。 |
| AsyncCallback<**void**> | callback | 否 | 解压是的回调函数。 |
......@@ -281,7 +281,7 @@ decompressFile(inFile: string, outFile: string, options: Options): Promise\<void
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-application-context.md)。 |
| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md)[Stage模型](js-apis-inner-application-context.md)。 |
| outFile | string | 是 | 指定的解压后的目录路径。 |
| options | [Options](#options) | 是 | 解压时的配置参数。 |
......
......@@ -89,7 +89,13 @@ struct ButtonExample {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Text('Normal button').fontSize(9).fontColor(0xCCCCCC)
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Button('OK', { type: ButtonType.Normal, stateEffect: true }).borderRadius(8).backgroundColor(0x317aff).width(90)
Button('OK', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(8)
.backgroundColor(0x317aff)
.width(90)
.onClick(() => {
console.log('ButtonType.Normal')
})
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() {
LoadingProgress().width(20).height(20).margin({ left: 12 }).color(0xFFFFFF)
......
......@@ -195,7 +195,7 @@ struct NavigationExample {
.width(336)
.height(40)
.backgroundColor('#FFFFFF')
.margin({ top: 8, left: 12 })
.margin({ top: 8 })
List({ space: 12, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
......@@ -212,8 +212,8 @@ struct NavigationExample {
}, item => item)
}
.height(324)
.width('100%')
.margin({ top: 12, left: 12 })
.width(336)
.margin({ top: 12 })
}
.title(this.NavigationTitle)
.menus(this.NavigationMenus)
......
......@@ -77,7 +77,7 @@ struct FillStyleExample {
.backgroundColor('#ffff00')
.onReady(() =>{
this.context.fillStyle = '#0000ff'
this.context.fillRect(20, 160, 150, 100)
this.context.fillRect(20, 20, 150, 100)
})
}
.width('100%')
......@@ -1653,35 +1653,35 @@ clip(path: Path2D, fillRule?: CanvasFillRule): void
```ts
// xxx.ets
@Entry
@Component
struct Clip {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
let region = new Path2D()
region.moveTo(30, 90)
region.lineTo(110, 20)
region.lineTo(240, 130)
region.lineTo(60, 130)
region.lineTo(190, 20)
region.lineTo(270, 90)
region.closePath()
this.context.clip(region,"evenodd")
this.context.fillStyle = "rgb(0,255,0)"
this.context.fillRect(0, 0, this.context.width, this.context.height)
})
@Entry
@Component
struct Clip {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
let region = new Path2D()
region.moveTo(30, 90)
region.lineTo(110, 20)
region.lineTo(240, 130)
region.lineTo(60, 130)
region.lineTo(190, 20)
region.lineTo(270, 90)
region.closePath()
this.context.clip(region,"evenodd")
this.context.fillStyle = "rgb(0,255,0)"
this.context.fillRect(0, 0, this.context.width, this.context.height)
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
![zh-cn_image_000000127777779](figures/zh-cn_image_000000127777779.png)
......@@ -2104,29 +2104,29 @@ getImageData(sx: number, sy: number, sw: number, sh: number): ImageData
```ts
// xxx.ets
@Entry
@Component
struct GetImageData {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private img:ImageBitmap = new ImageBitmap("/common/images/1234.png")
@Entry
@Component
struct GetImageData {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private img:ImageBitmap = new ImageBitmap("/common/images/1234.png")
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.context.drawImage(this.img,0,0,130,130)
var imagedata = this.context.getImageData(50,50,130,130)
this.context.putImageData(imagedata,150,150)
})
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.context.drawImage(this.img,0,0,130,130)
var imagedata = this.context.getImageData(50,50,130,130)
this.context.putImageData(imagedata,150,150)
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
![zh-cn_image_000000127777780](figures/zh-cn_image_000000127777780.png)
......@@ -2248,40 +2248,40 @@ getLineDash(): number[]
```ts
// xxx.ets
@Entry
@Component
struct CanvasGetLineDash {
@State message: string = 'Hello World'
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
@Entry
@Component
struct CanvasGetLineDash {
@State message: string = 'Hello World'
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(()=>{
console.error('before getlinedash clicked')
let res = this.context.getLineDash()
console.error(JSON.stringify(res))
})
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() => {
this.context.arc(100, 75, 50, 0, 6.28)
this.context.setLineDash([10,20])
this.context.stroke()
let res = this.context.getLineDash()
})
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(()=>{
console.error('before getlinedash clicked')
let res = this.context.getLineDash()
console.error(JSON.stringify(res))
})
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() => {
this.context.arc(100, 75, 50, 0, 6.28)
this.context.setLineDash([10,20])
this.context.stroke()
let res = this.context.getLineDash()
})
}
.width('100%')
}
.width('100%')
.height('100%')
}
.height('100%')
}
}
```
![zh-cn_image_000000127777778](figures/zh-cn_image_000000127777778.png)
......@@ -2376,26 +2376,26 @@ toDataURL(type?: string, quality?: number): string
```ts
// xxx.ets
@Entry
@Component
struct ToDataURL {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
@Entry
@Component
struct ToDataURL {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
var dataURL = this.context.toDataURL()
})
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
var dataURL = this.context.toDataURL()
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
......@@ -2512,7 +2512,7 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void
grad.addColorStop(0.5, '#ffffff')
grad.addColorStop(1.0, '#00ff00')
this.context.fillStyle = grad
this.context.fillRect(0, 0, 500, 500)
this.context.fillRect(0, 0, 400, 400)
})
}
.width('100%')
......@@ -2563,7 +2563,7 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
grad.addColorStop(0.5, '#ffffff')
grad.addColorStop(1.0, '#00ff00')
this.context.fillStyle = grad
this.context.fillRect(0, 0, 500, 500)
this.context.fillRect(0, 0, 440, 440)
})
}
.width('100%')
......
......@@ -47,7 +47,7 @@ struct Page45 {
grad.addColorStop(0.5, '#ffffff')
grad.addColorStop(1.0, '#00ff00')
this.context.fillStyle = grad
this.context.fillRect(0, 0, 500, 500)
this.context.fillRect(0, 0, 400, 400)
})
}
.width('100%')
......
......@@ -24,29 +24,29 @@ ImageData对象可以存储canvas渲染的像素数据。
```ts
// xxx.ets
@Entry
@Component
struct Translate {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private img:ImageBitmap = new ImageBitmap("/common/images/1234.png")
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.context.drawImage(this.img,0,0,130,130)
var imagedata = this.context.getImageData(50,50,130,130)
this.context.putImageData(imagedata,150,150)
})
@Entry
@Component
struct Translate {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private img:ImageBitmap = new ImageBitmap("common/images/1234.png")
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.context.drawImage(this.img,0,0,130,130)
var imagedata = this.context.getImageData(50,50,130,130)
this.context.putImageData(imagedata,150,150)
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
![zh-cn_image_000000127777780](figures/zh-cn_image_000000127777780.png)
......
# Path2D对象
路径对象,支持通过对象的接口进行路径的描述,并通过Canvas的stroke接口进行绘制。
路径对象,支持通过对象的接口进行路径的描述,并通过Canvas的stroke接口或者fill接口进行绘制。
> **说明:**
>
......
......@@ -29,7 +29,7 @@ Flex(value?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: Fle
| direction | [FlexDirection](ts-appendix-enums.md#flexdirection) | 否 | FlexDirection.Row | 子组件在Flex容器上排列的方向,即主轴的方向。 |
| wrap | [FlexWrap](ts-appendix-enums.md#flexwrap) | 否 | FlexWrap.NoWrap | Flex容器是单行/列还是多行/列排列。<br/>**说明:** <br/>在多行布局时,通过交叉轴方向,确认新行堆叠方向。 |
| justifyContent | [FlexAlign](ts-appendix-enums.md#flexalign) | 否 | FlexAlign.Start | 所有子组件在Flex容器主轴上的对齐格式。 |
| alignItems | [ItemAlign](ts-appendix-enums.md#itemalign) | 否 | ItemAlign.Start | 所以子组件在Flex容器交叉轴上的对齐格式。 |
| alignItems | [ItemAlign](ts-appendix-enums.md#itemalign) | 否 | ItemAlign.Start | 所有子组件在Flex容器交叉轴上的对齐格式。 |
| alignContent | [FlexAlign](ts-appendix-enums.md#flexalign) | 否 | FlexAlign.Start | 交叉轴中有额外的空间时,多行内容的对齐方式。仅在wrap为Wrap或WrapReverse下生效。 |
......
......@@ -48,7 +48,7 @@ Grid(scroller?: Scroller)
| rowsTemplate | string | 设置当前网格布局行的数量,不设置时默认1行。<br/>例如,&nbsp;'1fr&nbsp;1fr&nbsp;2fr'是将父组件分三行,将父组件允许的高分为4等份,第一行占1份,第二行占一份,第三行占2份。<br/>**说明:** <br/>设置为'0fr',则这一行的行宽为0,这一行GridItem不显示。设置为其他非法值,按固定1行处理。 |
| columnsGap | [Length](ts-types.md#length) | 设置列与列的间距。<br/>默认值:0<br/>**说明:** <br/>设置为小于0的值时,按默认值显示。 |
| rowsGap | [Length](ts-types.md#length) | 设置行与行的间距。<br/>默认值:0<br/>**说明:** <br/>设置为小于0的值时,按默认值显示。 |
| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。<br/>默认值:BarState.Off |
| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。<br/>默认值:BarState.Off<br/>**说明:** <br/>API version 9及以下版本默认值为BarState.Off,API version 10的默认值为BarState.Auto。 |
| scrollBarColor | string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;[Color](ts-appendix-enums.md#color) | 设置滚动条的颜色。 |
| scrollBarWidth | string \| number | 设置滚动条的宽度。宽度设置后,滚动条正常状态和按压状态宽度均为滚动条的宽度值。<br/>默认值:4<br/>单位:vp |
| cachedCount | number | 设置预加载的GridItem的数量,只在[LazyForEach](../../quick-start/arkts-rendering-control.md#数据懒加载)中生效。具体使用可参考[减少应用白块说明](../../ui/ui-ts-performance-improvement-recommendation.md#减少应用滑动白块)<br/>默认值:1<br/>**说明:** <br>设置缓存后会在Grid显示区域上下各缓存cachedCount*列数个GridItem。<br/>[LazyForEach](../../quick-start/arkts-rendering-control.md#数据懒加载)超出显示和缓存范围的GridItem会被释放。<br/>设置为小于0的值时,按默认值显示。 |
......
......@@ -53,7 +53,7 @@ List(value?:{space?: number&nbsp;|&nbsp;string, initialIndex?: number, scroller?
| -------- | -------- | -------- |
| listDirection | [Axis](ts-appendix-enums.md#axis) | 设置List组件排列方向。<br/>默认值:Axis.Vertical<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。 |
| divider | {<br/>strokeWidth:&nbsp;[Length](ts-types.md#length),<br/>color?:[ResourceColor](ts-types.md#resourcecolor),<br/>startMargin?:&nbsp;Length,<br/>endMargin?:&nbsp;Length<br/>}&nbsp;\|&nbsp;null | 设置ListItem分割线样式,不支持设置百分比,默认无分割线。<br/>- strokeWidth:&nbsp;分割线的线宽。<br/>- color:&nbsp;分割线的颜色。<br/>- startMargin:&nbsp;分割线与列表侧边起始端的距离。<br/>- endMargin:&nbsp;分割线与列表侧边结束端的距离。<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。<br/>endMargin +startMargin 不能超过列宽度。 <br/>startMargin和endMargin不支持设置百分比。<br/>List的分割线画在主轴方向两个子组件之间,第一个子组件上方和最后一个子组件下方不会绘制分割线。<br/>多列模式下,ListItem与ListItem之间的分割线起始边距从每一列的交叉轴方向起始边开始计算,其他情况从List交叉轴方向起始边开始计算。 |
| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。<br/>默认值:BarState.Off<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。 |
| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。<br/>默认值:BarState.Off<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。<br/>**说明:** <br/>API version 9及以下版本默认值为BarState.Off,API version 10的默认值为BarState.Auto。 |
| cachedCount | number | 设置列表中ListItem/ListItemGroup的预加载数量,只在[LazyForEach](../../quick-start/arkts-rendering-control.md#数据懒加载)中生效,其中ListItemGroup将作为一个整体进行计算,ListItemGroup中的所有ListItem会一次性全部加载出来。具体使用可参考[减少应用白块说明](../../ui/ui-ts-performance-improvement-recommendation.md#减少应用滑动白块)<br/>默认值:1<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。<br/>**说明:** <br/>单列模式下,会在List显示的ListItem前后各缓存cachedCount个ListItem。<br/>多列模式下, 会在List显示的ListItem前后各缓存cachedCount*列数个ListItem。 |
| editMode<sup>(deprecated)</sup> | boolean | 声明当前List组件是否处于可编辑模式。<br/>从API version9开始废弃。<br/>默认值:false |
| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 设置组件的滑动效果,支持弹簧效果和阴影效果。<br/>默认值:EdgeEffect.Spring<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。 |
......@@ -218,69 +218,3 @@ struct ListLanesExample {
```
![list](figures/list1.gif)
```ts
// xxx.ets
@Entry
@Component
struct ListDividerTest {
private arr: number[] = [0, 1, 2, 3]
@Builder header() {
Text('header')
.width('100%')
.height(50)
.fontSize(16)
.textAlign(TextAlign.Center)
.backgroundColor(0xFFEECC)
}
@Builder footer() {
Text('footer')
.width('100%')
.height(40)
.fontSize(16)
.textAlign(TextAlign.Center)
.backgroundColor(0xFFEECC)
}
@Builder item(index: number) {
Text('item' + index)
.width('100%').height(80)
.fontSize(16)
.textAlign(TextAlign.Center)
}
build() {
Column() {
List() {
ForEach(this.arr, (item) => {
ListItem() {
this.item(item)
}
}, item => item)
ListItemGroup({ header: this.header, footer: this.footer }) {
ForEach(this.arr, (item) => {
ListItem() {
this.item(item)
}
}, item => item)
}
.divider({ strokeWidth: 2, color: Color.Red, startMargin: 20, endMargin: 10 })
ForEach(this.arr, (item) => {
ListItem() {
this.item(item)
}
}, item => item)
}
.lanes(2)
.divider({ strokeWidth: 2, color: Color.Red, startMargin: 20, endMargin: 10 })
.margin(10).borderWidth(1)
}.width("100%")
.height("100%")
}
}
```
![ListDivider](figures/ListDivider.png)
\ No newline at end of file
......@@ -43,7 +43,7 @@ Tabs(value?: {barPosition?: BarPosition, index?: number, controller?: [TabsContr
| barMode | BarMode | TabBar布局模式,具体描述见BarMode枚举说明。<br/>默认值:BarMode.Fixed |
| barWidth | number&nbsp;\|&nbsp;Length<sup>8+</sup> | TabBar的宽度值。<br/>**说明:** <br/>设置为小于0或大于Tabs宽度值时,按默认值显示。 |
| barHeight | number&nbsp;\|&nbsp;Length<sup>8+</sup> | TabBar的高度值。<br/>**说明:** <br/>设置为小于0或大于Tabs宽度值时,按默认值显示。 |
| animationDuration | number | TabContent滑动动画时长。不设置时,点击切换页签无动画,滑动切换有动画;设置时,点击切换和滑动切换都有动画。<br/>默认值:200 <br/>**说明:** <br/>设置为小于0或百分比时,按默认值显示。|
| animationDuration | number | TabContent滑动动画时长。不设置时,点击切换页签无动画,滑动切换有动画;设置时,点击切换和滑动切换都有动画。<br/>默认值:300 <br/>**说明:** <br/>设置为小于0或百分比时,按默认值显示。|
| divider<sup>10+</sup> | [DividerStyle](#dividerstyle10对象说明) \| null | 用于设置区分TabBar和TabContent的分割线样式设置分割线样式,默认不显示分割线。<br/> DividerStyle: 分割线的样式;<br/> null: 不显示分割线。 |
| FadingEdge<sup>10+</sup> | boolean | 设置页签超过容器宽度时是否渐隐消失<br />默认值:true |
......
......@@ -58,35 +58,41 @@ struct LineExample {
Column({ space: 10 }) {
// 线条绘制的起止点坐标均是相对于Line组件本身绘制区域的坐标
Line()
.width(200)
.height(150)
.startPoint([0, 0])
.endPoint([50, 100])
.stroke(Color.Black)
.backgroundColor('#F5F5F5')
Line()
.width(200)
.height(200)
.height(150)
.startPoint([50, 50])
.endPoint([150, 150])
.strokeWidth(5)
.stroke(Color.Orange)
.strokeOpacity(0.5)
.backgroundColor('#F5F5F5')
// 当坐标点设置的值超出Line组件的宽高范围时,线条会画出组件绘制区域
Line({ width: 50, height: 50 })
// strokeDashOffset用于定义关联虚线strokeDashArray数组渲染时的偏移
Line()
.width(200)
.height(150)
.startPoint([0, 0])
.endPoint([100, 100])
.stroke(Color.Black)
.strokeWidth(3)
.strokeDashArray([10, 3])
.strokeDashOffset(5)
.backgroundColor('#F5F5F5')
// strokeDashOffset用于定义关联虚线strokeDashArray数组渲染时的偏移
Line({ width: 50, height: 50 })
// 当坐标点设置的值超出Line组件的宽高范围时,线条会画出组件绘制区域
Line()
.width(50)
.height(50)
.startPoint([0, 0])
.endPoint([100, 100])
.stroke(Color.Black)
.strokeWidth(3)
.strokeDashArray([10, 3])
.strokeDashOffset(5)
.backgroundColor('#F5F5F5')
}
}
......@@ -151,12 +157,16 @@ struct LineExample {
build() {
Column() {
Line()
.width(300)
.height(30)
.startPoint([50, 30])
.endPoint([300, 30])
.stroke(Color.Black)
.strokeWidth(10)
// 设置strokeDashArray的数组间隔为 50
Line()
.width(300)
.height(30)
.startPoint([50, 20])
.endPoint([300, 20])
.stroke(Color.Black)
......@@ -164,6 +174,8 @@ struct LineExample {
.strokeDashArray([50])
// 设置strokeDashArray的数组间隔为 50, 10
Line()
.width(300)
.height(30)
.startPoint([50, 20])
.endPoint([300, 20])
.stroke(Color.Black)
......@@ -171,6 +183,8 @@ struct LineExample {
.strokeDashArray([50, 10])
// 设置strokeDashArray的数组间隔为 50, 10, 20
Line()
.width(300)
.height(30)
.startPoint([50, 20])
.endPoint([300, 20])
.stroke(Color.Black)
......@@ -178,6 +192,8 @@ struct LineExample {
.strokeDashArray([50, 10, 20])
// 设置strokeDashArray的数组间隔为 50, 10, 20, 30
Line()
.width(300)
.height(30)
.startPoint([50, 20])
.endPoint([300, 20])
.stroke(Color.Black)
......
......@@ -74,9 +74,10 @@ struct PathExample {
.fontSize(11)
.fontColor(0xCCCCCC)
.width('90%')
// 绘制一条长900px,宽3vp的直线
// 绘制一条长600px,宽3vp的直线
Path()
.height(10)
.width('600px')
.height('10px')
.commands('M0 0 L600 0')
.stroke(Color.Black)
.strokeWidth(3)
......@@ -88,16 +89,22 @@ struct PathExample {
// 绘制直线图形
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Path()
.width('210px')
.height('310px')
.commands('M100 0 L200 240 L0 240 Z')
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
Path()
.width('210px')
.height('310px')
.commands('M0 0 H200 V200 H0 Z')
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
Path()
.width('210px')
.height('310px')
.commands('M100 0 L0 100 L50 200 L150 200 L200 100 Z')
.fillOpacity(0)
.stroke(Color.Black)
......@@ -108,16 +115,22 @@ struct PathExample {
// 绘制弧线图形
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Path()
.width('250px')
.height('310px')
.commands("M0 300 S100 0 240 300 Z")
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
Path()
.width('210px')
.height('310px')
.commands('M0 150 C0 100 140 0 200 150 L100 300 Z')
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(3)
Path()
.width('210px')
.height('310px')
.commands('M0 100 A30 20 20 0 0 200 100 Z')
.fillOpacity(0)
.stroke(Color.Black)
......
......@@ -70,6 +70,8 @@ struct ShapeExample {
Ellipse().width(300).height(50).offset({ x: 0, y: 60 })
Path().width(300).height(10).commands('M0 0 L900 0').offset({ x: 0, y: 120 })
}
.width(350)
.height(140)
.viewPort({ x: -2, y: -2, width: 304, height: 130 })
.fill(0x317AF7)
.stroke(Color.Black)
......@@ -83,6 +85,8 @@ struct ShapeExample {
Shape() {
Rect().width(300).height(50)
}
.width(350)
.height(80)
.viewPort({ x: 0, y: 0, width: 320, height: 70 })
.fill(0x317AF7)
.stroke(Color.Black)
......@@ -91,6 +95,8 @@ struct ShapeExample {
Shape() {
Rect().width(300).height(50)
}
.width(350)
.height(80)
.viewPort({ x: -5, y: -5, width: 320, height: 70 })
.fill(0x317AF7)
.stroke(Color.Black)
......@@ -101,6 +107,8 @@ struct ShapeExample {
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}
.width(350)
.height(20)
.viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443)
.strokeWidth(10)
......@@ -109,6 +117,8 @@ struct ShapeExample {
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}
.width(350)
.height(20)
.viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443)
.strokeWidth(10)
......@@ -118,6 +128,8 @@ struct ShapeExample {
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}
.width(350)
.height(20)
.viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443)
.strokeWidth(10)
......@@ -126,6 +138,8 @@ struct ShapeExample {
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}
.width(350)
.height(20)
.viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443)
.strokeWidth(10)
......@@ -135,7 +149,9 @@ struct ShapeExample {
Shape() {
Path().width(200).height(60).commands('M0 0 L400 0 L400 150 Z')
}
.viewPort({ x: -80, y: -5, width: 310, height: 90 })
.width(300)
.height(200)
.viewPort({ x: -20, y: -5, width: 310, height: 90 })
.fill(0x317AF7)
.stroke(0xEE8443)
.strokeWidth(10)
......@@ -147,3 +163,4 @@ struct ShapeExample {
```
![zh-cn_image_0000001184628104](figures/zh-cn_image_0000001184628104.png)
\ No newline at end of file
......@@ -66,7 +66,7 @@ struct FillStyleExample {
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.fillStyle = '#0000ff'
this.offContext.fillRect(20, 160, 150, 100)
this.offContext.fillRect(20, 20, 150, 100)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
......@@ -1752,39 +1752,39 @@ clip(path:Path2D, fillRule?: CanvasFillRule): void
```ts
// xxx.ets
@Entry
@Component
struct Clip {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
@Entry
@Component
struct Clip {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
let region = new Path2D()
region.moveTo(30, 90)
region.lineTo(110, 20)
region.lineTo(240, 130)
region.lineTo(60, 130)
region.lineTo(190, 20)
region.lineTo(270, 90)
region.closePath()
this.offContext.clip(region,"evenodd")
this.offContext.fillStyle = "rgb(0,255,0)"
this.offContext.fillRect(0, 0, 600, 600)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
let region = new Path2D()
region.moveTo(30, 90)
region.lineTo(110, 20)
region.lineTo(240, 130)
region.lineTo(60, 130)
region.lineTo(190, 20)
region.lineTo(270, 90)
region.closePath()
this.offContext.clip(region,"evenodd")
this.offContext.fillStyle = "rgb(0,255,0)"
this.offContext.fillRect(0, 0, 600, 600)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
![zh-cn_image_000000127777779](figures/zh-cn_image_000000127777779.png)
......@@ -2189,6 +2189,27 @@ getPixelMap(sx: number, sy: number, sw: number, sh: number): PixelMap
| ---------------------------------------- | ------------ |
| [PixelMap](../apis/js-apis-image.md#pixelmap7) | 新的PixelMap对象 |
### setPixelMap
setPixelMap(value?: PixelMap): void
将当前传入[PixelMap](../apis/js-apis-image.md#pixelmap7)对象绘制在画布上。
**参数:**
| 参数 | 类型 | 必填 | 默认值 | 描述 |
| ---- | ------ | ---- | ---- | --------------- |
| sx | number | 是 | 0 | 需要输出的区域的左上角x坐标。 |
| sy | number | 是 | 0 | 需要输出的区域的左上角y坐标。 |
| sw | number | 是 | 0 | 需要输出的区域的宽度。 |
| sh | number | 是 | 0 | 需要输出的区域的高度。 |
**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ------------ |
| [PixelMap](../apis/js-apis-image.md#pixelmap7) | 新的PixelMap对象 |
### getImageData
......@@ -2216,32 +2237,32 @@ getImageData(sx: number, sy: number, sw: number, sh: number): ImageData
```ts
// xxx.ets
@Entry
@Component
struct GetImageData {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
private img:ImageBitmap = new ImageBitmap("/common/images/1234.png")
@Entry
@Component
struct GetImageData {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
private img:ImageBitmap = new ImageBitmap("/common/images/1234.png")
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.drawImage(this.img,0,0,130,130)
var imagedata = this.offContext.getImageData(50,50,130,130)
this.offContext.putImageData(imagedata,150,150)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.drawImage(this.img,0,0,130,130)
var imagedata = this.offContext.getImageData(50,50,130,130)
this.offContext.putImageData(imagedata,150,150)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
![zh-cn_image_000000127777780](figures/zh-cn_image_000000127777780.png)
......@@ -2319,31 +2340,31 @@ setLineDash(segments: number[]): void
**示例:**
```ts
@Entry
@Component
struct SetLineDash {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.arc(100, 75, 50, 0, 6.28)
this.offContext.setLineDash([10,20])
this.offContext.stroke()
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
@Entry
@Component
struct SetLineDash {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.arc(100, 75, 50, 0, 6.28)
this.offContext.setLineDash([10,20])
this.offContext.stroke()
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
![zh-cn_image_000000127777772](figures/zh-cn_image_000000127777772.png)
......@@ -2364,42 +2385,42 @@ getLineDash(): number[]
```ts
// xxx.ets
@Entry
@Component
struct OffscreenCanvasGetLineDash {
@State message: string = 'Hello World'
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(()=>{
console.error('before getlinedash clicked')
let res = this.offContext.getLineDash()
console.error(JSON.stringify(res))
})
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() => {
this.offContext.arc(100, 75, 50, 0, 6.28)
this.offContext.setLineDash([10,20])
this.offContext.stroke()
let res = this.offContext.getLineDash()
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
@Entry
@Component
struct OffscreenCanvasGetLineDash {
@State message: string = 'Hello World'
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(()=>{
console.error('before getlinedash clicked')
let res = this.offContext.getLineDash()
console.error(JSON.stringify(res))
})
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() => {
this.offContext.arc(100, 75, 50, 0, 6.28)
this.offContext.setLineDash([10,20])
this.offContext.stroke()
let res = this.offContext.getLineDash()
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
}
.width('100%')
}
.width('100%')
.height('100%')
}
.height('100%')
}
}
```
![zh-cn_image_000000127777778](figures/zh-cn_image_000000127777778.png)
......@@ -2429,28 +2450,28 @@ toDataURL(type?: string, quality?: number): string
**示例:**
```ts
// xxx.ets
@Entry
@Component
struct ToDataURL {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
// xxx.ets
@Entry
@Component
struct ToDataURL {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
var dataURL = this.offContext.toDataURL()
})
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
var dataURL = this.offContext.toDataURL()
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
......@@ -2527,33 +2548,33 @@ restore(): void
```ts
// xxx.ets
@Entry
@Component
struct CanvasExample {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.save() // save the default state
this.offContext.fillStyle = "#00ff00"
this.offContext.fillRect(20, 20, 100, 100)
this.offContext.restore() // restore to the default state
this.offContext.fillRect(150, 75, 100, 100)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
@Entry
@Component
struct CanvasExample {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.save() // save the default state
this.offContext.fillStyle = "#00ff00"
this.offContext.fillRect(20, 20, 100, 100)
this.offContext.restore() // restore to the default state
this.offContext.fillRect(150, 75, 100, 100)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
![zh-cn_image_000000127777781](figures/zh-cn_image_000000127777781.png)
......@@ -2568,33 +2589,33 @@ save(): void
```ts
// xxx.ets
@Entry
@Component
struct CanvasExample {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.save() // save the default state
this.offContext.fillStyle = "#00ff00"
this.offContext.fillRect(20, 20, 100, 100)
this.offContext.restore() // restore to the default state
this.offContext.fillRect(150, 75, 100, 100)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
@Entry
@Component
struct CanvasExample {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
this.offContext.save() // save the default state
this.offContext.fillStyle = "#00ff00"
this.offContext.fillRect(20, 20, 100, 100)
this.offContext.restore() // restore to the default state
this.offContext.fillRect(150, 75, 100, 100)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
}
```
![zh-cn_image_000000127777781](figures/zh-cn_image_000000127777781.png)
......@@ -2637,7 +2658,7 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void
grad.addColorStop(0.5, '#ffffff')
grad.addColorStop(1.0, '#00ff00')
this.offContext.fillStyle = grad
this.offContext.fillRect(0, 0, 500, 500)
this.offContext.fillRect(0, 0, 400, 400)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
......@@ -2691,7 +2712,7 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
grad.addColorStop(0.5, '#ffffff')
grad.addColorStop(1.0, '#00ff00')
this.offContext.fillStyle = grad
this.offContext.fillRect(0, 0, 500, 500)
this.offContext.fillRect(0, 0, 440, 440)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
......
......@@ -3,7 +3,7 @@
## 概述
AudioDecoder模块提供用于音频解码功能的函数。
AudioDecoder模块提供用于音频解码功能的函数。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。
@syscap SystemCapability.Multimedia.Media.AudioDecoder
......
......@@ -3,7 +3,7 @@
## 概述
AudioEncoder模块提供用于音频编码功能的函数。
AudioEncoder模块提供用于音频编码功能的函数。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。
@syscap SystemCapability.Multimedia.Media.AudioEncoder
......
......@@ -3,7 +3,7 @@
## 概述
CodecBase模块提供运行音视频编解码通用的结构体、字符常量、枚举。
CodecBase模块提供运行音视频编解码通用的结构体、字符常量、枚举。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。
@syscap SystemCapability.Multimedia.Media.CodecBase
......
......@@ -3,7 +3,7 @@
## 概述
VideoDecoder模块提供用于视频解码功能的函数。
VideoDecoder模块提供用于视频解码功能的函数。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。
@syscap SystemCapability.Multimedia.Media.VideoDecoder
......
......@@ -3,7 +3,7 @@
## 概述
VideoEncoder模块提供用于视频编码功能的函数和枚举。
VideoEncoder模块提供用于视频编码功能的函数和枚举。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。
@syscap SystemCapability.Multimedia.Media.VideoEncoder
......
......@@ -195,6 +195,16 @@ WorkSchedulerExtensionAbility类拥有如下API接口,具体的API介绍详见
}
```
## 限制
为了降低WorkSchedulerExtensionAbility能力被三方应用滥用的风险,在WorkSchedulerExtensionAbility中限制以下接口的调用
- @ohos.backgroundTaskManager.d.ts
- @ohos.resourceschedule.backgroundTaskManager.d.ts
- @ohos.multimedia.camera.d.ts
- @ohos.multimedia.audio.d.ts
- @ohos.multimedia.media.d.ts
## 相关实例
针对WorkSchedulerExtensionAbility开发,有以下相关示例可供参考:
......
......@@ -92,12 +92,12 @@ listener.on('change', onPortrait)
| 类型 | 说明 |
| ----------------- | ------------------------------------------------------------ |
| height | 应用页面显示区域的高度。 |
| min-height | 应用页面显示区域的最小高度。 |
| max-height | 应用页面显示区域的最大高度。 |
| width | 应用页面显示区域的宽度。 |
| min-width | 应用页面显示区域的最小宽度。 |
| max-width | 应用页面显示区域的最大宽度。 |
| height | 应用页面可绘制区域的高度。 |
| min-height | 应用页面可绘制区域的最小高度。 |
| max-height | 应用页面可绘制区域的最大高度。 |
| width | 应用页面可绘制区域的宽度。 |
| min-width | 应用页面可绘制区域的最小宽度。 |
| max-width | 应用页面可绘制区域的最大宽度。 |
| resolution | 设备的分辨率,支持dpi,dppx和dpcm单位。其中:<br/>-&nbsp; dpi表示每英寸中物理像素个数,1dpi≈0.39dpcm;<br/>-&nbsp; dpcm表示每厘米上的物理像素个数,1dpcm&nbsp;&nbsp; 2.54dpi;<br/>-&nbsp; dppx表示每个px中的物理像素数(此单位按96px=1英寸为基准,与页面中的px单位计算方式不同),1dppx&nbsp; =&nbsp; 96dpi。 |
| min-resolution | 设备的最小分辨率。 |
| max-resolution | 设备的最大分辨率。 |
......
......@@ -28,3 +28,8 @@ typedef enum {
### 按序加载(默认加载策略)
配置文件中的priority(取值范围为整数0到200)是用来表示host(驱动容器)和驱动的优先级。不同的host内的驱动,host的priority值越小,驱动加载优先级越高;同一个host内驱动的priority值越小,加载优先级越高。
### 异常恢复(用户态驱动)
当驱动服务异常退出时,恢复策略如下:
- preload字段配置为0(DEVICE_PRELOAD_ENABLE)或1(DEVICE_PRELOAD_ENABLE_STEP2)的驱动服务,由启动模块拉起host并重新加载服务。
- preload字段配置为2(DEVICE_PRELOAD_DISABLE)的驱动服务,需业务模块注册HDF的服务状态监听器,当收到服务退出消息时,业务模块调用LoadDevice重新加载服务。
......@@ -198,12 +198,12 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及
| Hi3516解决方案-Linux(二进制) | 3.0 | [站点](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz.sha256) | 418.1 MB |
| RELEASE-NOTES | 3.0 | [站点](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.0-LTS/zh-cn/release-notes/OpenHarmony-v3.0-LTS.md) | - | - |
| **最新发布版本源码** | **版本信息** | **下载站点** | **SHA256校验码** | **软件包容量** |
| 全量代码Beta版本(标准、轻量和小型系统) | 3.2 Beta5 | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/code-v3.2-Beta5.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/code-v3.2-Beta5.tar.gz.sha256) | 21.3 GB |
| Hi3861解决方案(二进制) | 3.2 Beta5 | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/hispark_pegasus.tar.gz.sha256) | 22.9 MB |
| Hi3516解决方案-LiteOS(二进制) | 3.2 Beta5 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Beta5/hispark_taurus_LiteOS.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Beta5/hispark_taurus_LiteOS.tar.gz.sha256) | 293.6 MB |
| Hi3516解决方案-Linux(二进制) | 3.2 Beta5 | [站点](hispark_taurus_Linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Beta5/hispark_taurus_Linux.tar.gz.sha256) | 174.3 MB |
| RK3568标准系统解决方案(二进制) | 3.2 Beta5 | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/dayu200_standard_arm32_20230201.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/dayu200_standard_arm32_20230201.tar.gz.sha256) | 3.9 GB |
| RELEASE-NOTES | 3.2 Beta5 | [站点](../../release-notes/OpenHarmony-v3.2-beta5.md) | - | - |
| 全量代码Beta版本(标准、轻量和小型系统) | 3.2 Release | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz.sha256) | 21.8 GB |
| Hi3861解决方案(二进制) | 3.2 Release| [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz.sha256) | 22.9 MB |
| Hi3516解决方案-LiteOS(二进制) | 3.2 Release| [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256) | 294.3 MB |
| Hi3516解决方案-Linux(二进制) | 3.2 Release| [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256) | 174.3 MB |
| RK3568标准系统解决方案(二进制) | 3.2 Release| [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz.sha256) | 3.9 GB |
| RELEASE-NOTES | 3.2 Release| [站点](../../release-notes/OpenHarmony-v3.2-release.md) | - | - |
| **编译工具链** | **版本信息** | **下载站点** | **SHA256校验码** | **软件包容量** |
| 编译工具链获取清单 | - | [站点](https://repo.huaweicloud.com/openharmony/os/2.0/tool_chain/) | - | - |
......
# OpenHarmony 3.2 Release
## 版本概述
OpenHarmony 3.2版本标准系统能力进一步完善,支持采用ArkTS语言+Stage应用模型进行大型应用、原子化服务开发。[ArkCompiler](#arkcompiler)的优化、Taskpool机制提升应用运行性能;ArkUI组件能力增强,强化图形渲染能力和系统安全能力,丰富分布式业务开发;OpenHarmony 3.2 Release版本提供API Level 9稳定接口,在OpenHarmony 3.1 Release版本的基础上,进一步提升系统的整体性能、稳定性和安全性。
OpenHarmony 3.2版本完整里程碑如下图所示,阅读本文档了解更多关键特性及能力。
**图1** OpenHarmony 3.2社区版本里程碑  
![release](figures/release.png)
## 特性更新
### ArkUI
**组件能力增强**
- 支持XComponent控件,可用于EGL/OpenGL ES和媒体数据写入,并在XComponent组件显示;通过XComponent组件,配合NDK能力,构建C++/ArkTS混合开发能力,支持游戏、媒体应用开发
- 支持AbilityComponent控件,支持嵌入其他应用作为控件(Component)显示。
- 增加基础的ArkTS卡片开发能力:支持卡片交互、能动态更新内容;统一卡片和页面的开发范式,页面的布局可以直接复用到卡片布局中,提升卡片开发体验和开发效率。
- 系统默认支持纯文本、纯图片复制、粘贴、拖拽,无需开发者处理复制、粘贴、拖拽事件。
- 支持多级菜单和分组菜单。
- 支持切换深色模式/浅色模式,仅系统应用支持。
**UI界面开发支持一次开发适配多屏幕规格**
- 交互归一能力增强,交互归一事件对接TP、鼠标、键盘、触摸板、手写笔,ArkUI原生组件支持归一化的操作方式。
- 响应式布局能力优化,增强了媒体查询能力,栅格系统重构且对接自由窗口。
- 走焦能力增强,支持Tab键和方向键走焦,支持配置组件是否可获焦。
- 支持增强分栏与侧边栏组件能力,支持拖拽自动隐藏等能力。
详细内容请参考[ArkUI指南](../application-dev/ui/arkui-overview.md)
### 应用框架
- Stage模型,OpenHarmony API 9新增模型,提供了应用程序必备的组件和运行机制。开发者可以基于该模型进行复杂应用开发,使应用开发更简单、高效。
- 以类形式提供组件开发,方便开发者基于类扩展。
- 进程内共享虚拟机实例,减少应用内存占用。
- 支持在进程内共享数据对象,方便开发者在多模块间共享状态。
- Ability生命周期和窗口显示/焦点事件分离,统一了多设备形态下组件的生命周期,有利于多设备应用开发。
- Ability与UI职责分离且具备RPC调用能力,原生支持组件级的跨设备迁移与协同,有利于分布式应用开发。
- 提供Extension机制,借助Extension,应用在与其他应用或系统进行交互时向他们提供自定义功能和内容,例如:应用可以作为卡片显示在系统桌面或者系统闲时执行后台任务等。当前支持的常用Extenson有:FormExtensionAbility、WorkSchedulerExtensionAbility、InputMethodExtensionAbility、AccessibilityExtensionAbility等。
- 原子化服务支持分包预加载,提升服务首次加载性能。
- 支持HSP(Harmony Shared Package)动态共享包,支持应用内代码和资源的共享。
详细内容请参考[应用模型指南](../application-dev/application-models/application-model-composition.md)
### 应用包管理
- 支持选择默认应用,例如用户使用应用程序打开文件或url地址时选择了默认程序,后续将自动打开该应用程序操作文件。
- 支持对部分预置应用如Launcher、SystemUI、Settings等,系统事先授予权限(如定位、电话联系人等权限)、简化设备开箱后的授权过程,提升用户体验。详细请参考[user_grant权限预授权](../application-dev/security/accesstoken-guidelines.md)
- 支持预置应用配置是否可常驻、是否可以多进程,是否允许使用Service类型的ExtensionAbility等能力,加强对预置应用的权限管控。详细请参考[应用特权配置指南](../device-dev/subsystems/subsys-app-privilege-config-guide.md)
- 支持动态修改和更新应用程序的代码,提供快速修复程序包便于应用快速响应需求和修复问题(此能力依赖设备厂商构建应用市场并提供分发能力)。详细请参考[快速修复介绍](../application-dev/quick-start/quickfix-principles.md)
- 支持so基于hap包的隔离,方便开发者在不同的模块中部署so文件,避免了不同模块so重名的问题。
### 系统应用
**Launcher应用增强**
提供长按应用图标添加服务卡片的能力(当前支持相机、图库应用)。
**SystemUI应用增强**
- 支持控制中心打开和退出。
- 支持通知中心打开和退出;通知显示、删除、组展开与收起;横幅通知的显示与隐藏。
**Settings应用增强**
- 提供在隐私设置菜单设置权限的能力。
- 开发者选项增加布局边界调试、过渡动画调试、过渡绘制调试开关。
**Photos应用增强**
- 新增PhotoPicker能力。PhotoPicker是系统向用户提供图片和视频文件选择的统一入口,避免用户向应用授权文件权限,图片文件使用权限最小化控制提升应用安全。
- 支持相册服务卡片,提供相册浏览能力。
- 支持图片编辑能力,如自由裁剪图片、旋转图片等操作。
详细请参考[Application Photos](https://gitee.com/openharmony/applications_photos)
**FilePicker**
新增FilePicker能力。FilePicker是系统向用户提供文件(媒体文件除外)选择的统一入口,避免用户向应用授权文件权限,确保文件使用权限最小化控制提升应用安全。
**浏览器**
当前版本未内置浏览器应用。可手动安装[浏览器应用示例](https://gitee.com/openharmony/applications_app_samples/tree/samples_3.2_Release/code/BasicFeature/Web/Browser)后进行网络内容浏览等场景的体验。
### 分布式技术
支持元服务和卡片跨设备流转,包括:跨设备查询、添加、刷新、删除等。
#### 分布式软总线
- 提供基于蓝牙链路的文件传输能力,蓝牙数据传输通道相比OpenHarmony 3.1版本性能提升约10%。
- 通过为每个进程分别建立Message和Byte高低优先级队列,确保在Message和Byte并发的情况下,优先保障消息队列的数据发送,同时也能保障Byte得到有效传输,解决了在字节数据拥塞的情况下,消息数据不能及时传输的问题。
- 在支持RAW流的基础上,新增COMMON流传输能力,将未加密音视频流交由软总线进行加解密,调用者只需要把原始的音视频流数据传递给软总线,软总线保障数据的安全传输。
- 支持传输链路(WLAN/WiFi P2P/蓝牙BR)动态选择。根据双端设备支持的传输链路以及业务调用软总线传输接口(SendFile、SendSteam、SendMessage、SendBytes)进行链路选择。例如当需要传输流数据时,优先选择WLAN(5G频段)进行传输,如果WLAN不可用,则选择其它链路(例如WiFi P2P)进行传输。
#### 分布式硬件
- 分布式相机拍照支持设置拍摄地理位置信息和照片质量级别(影响照片的压缩比和画质清晰度)。
- 分布式相机支持录像功能。
- 设备管理支持将帐号认证信息导入到设备安全认证系统中,相同帐号的设备可以自动完成设备认证和组网。
#### 分布式数据管理
**跨应用数据访问**
- 通过代理方式实现同设备内跨应用数据访问,避免频繁拉起数据源应用。
- 支持同设备内关系型数据库、键值型数据库的跨应用数据访问。
**本地数据库**
- 支持键值型数据库和关系型数据库。
- 支持对数据库文件的加密保存。
- 支持数据库的异常损坏检测以及异常重建。
- 支持应用通过客户端进行备份和恢复数据库。
- 支持自动备份键值型数据库。
- 支持同应用跨设备对关系型数据库远程查询。
- 支持元数据库异常损坏检测和自动重建。
- 键值型数据库从统一的系统沙箱切换到各应用沙箱,缩小应用数据的访问权限,提升了应用数据的安全性。
**数据同步**
- 支持按条件(时间段、时间排序、同步时长)同步键值型数据,实现高能效、精准数据同步。
- 设备上线优先同步系统数据,缩短设备唤醒时间。
- 支持多用户场景下的跨设备数据同步。
**分布式对象:** 支持对象数据持久化。
**沙箱应用:** 支持键值型数据库、关系型数据库、分布式对象的持久化。
#### 分布式调度
增强Ability流转能力,通过支持数据结构自动序列化降低应用程序适配复杂度;支持使用分布式对象传输流转的业务数据;在流转过程中可自动免安装原子化服务。
### 文件管理
- 增强文件加密特性,支持用户级文件加密。
- 新增按应用空间统计接口,支持获取应用各级目录空间大小。
- 增强应用文件共享能力,提供跨应用文件打开能力。
- 支持应用文件备份恢复能力。
- 支持文件系统外置存储挂载卸载、格式化等能力,支持外置存储读写访问能力。
- 增强文件管理IO接口能力:新增list file接口提供目录遍历能力、新增RamdomAccess接口提供大文件快速随机访问能力。
### 图形显示 &amp; 窗口
- 提升多窗口场景的显示帧率。
- 增强属性动画,支持动画自定义属性。
- 增强Native层图形开发能力,SurfaceImage接口支持buffer管理、内容更新、变换矩阵等接口能力;Vsync支持请求下一帧、回调等接口能力;Hardwarebuffer接口支持申请、释放、获取、访问等接口能力 ,NativeWindow接口支持设置缩放模式。
- 构建EGL层,增强南向GPU适配能力。
- 提供窗口阴影、模糊、圆角等视觉效果的能力。
- 提供一镜到底、输入法切换、应用切换、转屏等转场动效能力。
- 支持窗口属性设置,窗口隐私图层避免截屏、录屏时泄露用户隐私。
### 媒体
**音频**
- 提供选择蓝牙设备进行音频播放和通话的能力。
- 支持生成DTMF拨号音并进行播放。
- 支持OpenSL ES基础录音接口。
- 支持应用查询当前可用的音频设备列表,并携带具体设备信息,比如设备采样率、通道数、通道掩码。
- 支持查询系统中已建立的播放流和录音流信息。
**播放**
- 媒体播放支持fd格式输入的本地播放、支持HTTPS、HLS协议网络点播功能。媒体播放支持基于HDI的H264硬解播放能力。
- 提供音视频编解码能力,基于HDI codec接口的视频硬编码/硬解码能力。
**相机**
- 支持相机拍照配置:格式、分辨率、质量(影响照片的压缩比和画质清晰度)、地理位置等。支持录像和录像中抓拍。
- 支持相机精准隐私保护策略,仅允许前台使用(包含相机悬浮窗场景);支持系统服务后台使用相机,不允许第三方APP后台静默使用相机。提供系统接口,供相机全局开关开启、禁用调用。
**图片** :增加支持raw、Webp图片格式。
### 事件通知
- 支持应用设置显示在桌面上的角标数量。
- 支持系统应用移除粘性事件,某个粘性事件移除后,新的订阅者将不再收到对应的事件。
- 支持系统应用使能/去使能静态订阅,静态订阅事件去使能后,StaticSubscriberExtensionAbility不再被关联拉起。
- 补齐静态订阅Extension上下文的能力,StaticSubscriberExtensionAbility运行时可以通过上下文获取安装包的静态信息(如包路径、包名等)。
### Web
- 支持配置Web组件,包括网络加载拦截配置、字体管理配置、滚动条配置、fetch自定义拦截配置。
- 支持网页操作,包括获取历史记录和前进后退列表、获取源URL、支持滚动、判断页面中是否有图片。
- 支持网页事件处理,支持页面加载各类事件上报、支持原始输入事件上报。
- 支持处理网页与应用的互通,消息互通支持ArrayBuffer类型。
- 增强Web性能,支持渲染进程的只读数据段共享节省内存、支持预读动态库加速网页加载。
### 通信与连接
- 支持NFC卡读写能力。
- 支持蓝牙音频通话和蓝牙视频播放。
- 提供网络管理多网并发、网络协议栈http/https增强及TLSSocket ArkTS API能力。
- 多网并发:
- 支持基于socket的路由绑定。
- 支持基于网卡的路由绑定。
- http/https:
- 支持http2.0。
- 支持http缓存。
- 支持http并发框架。
- 支持gzip压缩、指定数据返回格式。
- TLSSocket:
- 支持客户端指定证书、密钥、CA等安全传输选项,向服务器发起连接,建立TLSSocket连接。
- 支持TLSv1.2和TLSv1.3。
- WebSocket。
- 以太网连接、网络热点。
- 蜂窝通信框架能力(如需提供完整蜂窝通信能力需芯片厂商适配支持HDI接口):
- 支持双卡管理,双卡通话、短信、搜网等基础能力接口和框架。
- 支持VoLTE语音通话接口和框架。(需要芯片厂商实现IMS服务(含HDI))
- 支持IMS短信收发接口和框架。(需要芯片厂商实现IMS服务(含HDI))
- 支持蜂窝数据漫游,蜂窝数据自愈接口和框架。
- 支持双卡数据切换接口和框架。
### 设备管理
位置服务支持模糊位置、后台定位显性化等隐私增强特性。
**DeviceProfile**
开放基础系统服务的KV数据的保存、查询、端端同步的能力。
**电源**
- 支持从系统参数中读取系统的最大、最小和默认亮度值。
- 支持进入挂起状态和从挂起状态唤醒的系统接口。
- 支持电池的电量等级接口。
- 支持预估充电剩余时间、瞬时电流、剩余电量和总电量的系统接口。
- 支持相机、音频、通话和短距等软硬件特性的耗电统计。
- 支持设备发热时,对CPU频率、音量和系统亮度的管控动作。
### 安全
- 提供系统级的证书管理能力,支撑OpenHarmony生态应用和系统应用,实现证书管理全生命周期(生成,存储,使用,销毁)的管理和安全使用。
- 提供加解密算法库框架,实现对openssl加解密库对应能力的封装,提供统一的加解密算法库相关的ArkTS接口。
- HUKS支持国密SM2/SM3/SM4的部分算法。
- 提供基于帐号管理的分布式设备互信认证能力。
### 程序访问控制
- 实现应用和系统进程的权限管理框架,提供如下应用权限的操作接口:
- 提供权限的校验、权限的授予、权限的撤销功能。
- 提供权限的授权变化监听功能。
- 提供拉起权限弹窗的接口,应用可以通过该接口拉起弹窗,向用户申请授权。
- 提供权限弹窗应用以及Setting应用的隐私权限管理功能。
- 提供隐私报告功能,支持添加/查询权限访问记录、监听权限使用状态变化接口。
- 提供隐私保护增强特性,提升用户的隐私保护体验,包括:
- 相机使用提醒,在相机使用时,通知systemUI在右上角显示小圆点,提示用户。
- 一键开关功能,提供用户一键开关,管控设备麦克风/相机敏感资源的使用。
- 提供SELinux功能的permissive模式。
### ArkCompiler
**语言特性增强:** 支持严格模式的Ecma2021规范。
**编译器运行时功能**
- 提供es2abc编译器,优化字节码编译性能、缩短编译时间。
- 提供汇编解释器提升应用高级语言运行性能。
- 提供基于PGO配置文件的Host AOT优化编译器,提升应用高级语言高负载性能。
- 支持模块化能力,更好、更规范的支持复杂应用工程开发。
- 支持热补丁机制,提供应用热修复运行时技术底座。
- 调试增强,支持多实例调试、热重载调试,提升开发者开发效率。
- 支持基于CDP协议的CPU Profiler/Heap Profiler调优能力,提供应用性能调优和内存调优能力。
**语言基础库**
- utils功能增强,支持uuid提供通用统一标识符功能,支持Buffer提供缓冲区读写比较查找功能。
- Concurrent并发库增加并发API TaskPool基础版,提供并发任务接口。任务池(Taskpool)作用是为应用程序提供一个多线程的运行环境,降低整体资源的消耗、提高系统的整体性能。
**C/C++工具链**
- 工具链升级:LLVM升级到12.0.0,支持MIPS架构、RISC-V架构。
- 功能增强:支持stack pageguard保护,地址随机化,namespace隔离,CFI功能,Fortify功能,时区数据更新等,提升C/C++库安全。
- 性能优化:实现高频函数性能优化提升c库基础性能,实现linker优化提升库加载性能。
- 支持locale提供时区设置刷新功能。
### 内核
- 支持ASLR内核地址随机化、KASAN地址检测能力、CFI等,减少系统攻击面,提升内核安全性。
- 提升musl内存分配器安全,提高堆内存安全性,有效避免堆溢出、double-free、UAF等危险。
- 支持内存管理精细化管控,OnMemoryLevel特性针对不同内存压力进行通知,应用根据不同压力场景进行相应回调处理;同时对系统资源进行系统化、集中化管理,对应用资源占用及时监控与管理。
- 本地存储增强,F2FS特性优化末端性能,通过存储空闲时自动碎片回收、分级SSR等手段降低系统碎片,恢复系统性能。
### 驱动
**HDF驱动框架能力**
- 支持内核态驱动动态加载、外接设备即插即用事件上报、驱动安全策略配置,为开发者提供更稳定、安全的驱动平台底座。
- HDI接口支持IPC调用和直通调用两种通路模式,开发者可根据实际业务灵活使用,提升业务性能。
- 支持HDI服务化代码自动生成能力、模板化驱动代码生成能力、HCS宏式解析及配置可视化编辑等能力,降低驱动开发门槛,提高开发效率。
- Platform平台驱动支持用户态中断、新增CAN总线HDF驱动框架、MMC驱动实现优化等。
**外设驱动模型能力**
- Camera驱动模型支持自拍镜像、镜头控制、JPEG位置信息添加、Sensor捕获角查询、人脸识别Meta流支持,简化相机驱动开发难度。
- Audio的ADM模型增加耳机接入、听筒和喇叭切换控制、通话音量设置、通话静音等关键控制能力,支撑音频硬件生态拓展。
- Display驱动模型支持多屏管理、软件Vsync机制、兼容FrameBuffer架构,支持不同显示架构高效接入。
- 支持标准系统的Codec硬件编解码驱动模型、提供Codec HDI 2.0接口及参考实现,支持更完备的硬件编解码能力。
- 支持马达驱动模型,包括马达振动启停、基础马达效果控制,为用户提供丰富的振感体验。
- 支持手势驱动模型,包括状态事件、设备状态事件上报;支持手势启停、功能状态配置。
- USB驱动模型支持设备模式和主机模式,新增支持设备模式下RNDIS网络驱动等DDK能力。
- 支持WLAN驱动能力抗干扰能力,提供最优P2P信道选择能力,持续提升WLAN信号质量。
### 工具提升
**DevEco Studio代码开发**
- 支持应用/服务开发环境的诊断功能,能够检测开发环境是否完备,确保开发者拥有良好的开发体验。若检查结果中存在不满足的检查项,建议您根据修复建议进行调整。
- 提供基础模板和卡片模板,支持Stage工程下创建ArkTS服务卡片,帮助开发者快速开发应用和服务。
- 支持OpenHarmony工程添加Extension Ability模板,具体请参考在模块中添加Ability。
- 支持按照ArkUI新语法和新规范,检查代码提示错误;新增Code Linter代码检查功能,支持配置检查规则,修复检查结果。
- 支持C++代码Quick Fix基础能力,具体请参考代码Quick Fix快速修复。
- 提供全新的OHPM CLI(OpenHarmony Package Manager Command-line Interface) 生态三方库包管理工具,支持OpenHarmony共享包发布、安装和依赖管理。支持API 9的历史工程迁移为OHPM工程,详细参考历史工程手动迁移。
- 支持构建闭源HAR,并支持配置HAR的混淆能力。
- 支持AOT编译模式,提供高负载TS性能选择和构建能力,提升应用运行性能,具体请参考开启AOT编译模式。
- API 9的Stage工程默认开启模块化编译,可有效缩短增量编译时间、减小编译后的包体积。
- 支持并发编译提升编译速度。
**DevEco Studio应用调试调优**
- 支持ArkTS/JS与C/C++跨语言调试特性,在C/C++工程中,采用ArkTS/JS与C/C++进行混合开发,能够在ArkTS或JS调用C/C++方法处,直接进入C/C++代码中进行调试,方便开发者快速发现并解决跨语言调用相关代码问题。具体请参考ArkTS/JS与C/C++工程跨语言调试。
- 支持Hot Reload热重载,支持保存代码后在真机上使用最新的代码而无需重启应用。
- 支持OpenHarmony多包推送和多实例调试功能。
- 支持OpenHarmony API 9 C/C++工程的内存错误检测。
- OpenHarmony日志功能支持打印FaultLog,便于应用开发者快速查询、定位、导出应用故障信息。
- 测试框架能力增强,针对JS/ArkTS API Version 8和9的工程,测试框架的执行效率显著提升;同时优化了测试框架模板,提升模板代码的可读性。
详细内容请参考[DevEco Studio版本说明](https://developer.harmonyos.com/cn/docs/documentation/doc-releases/release_notes-0000001057597449)[使用指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_versions_overview-0000001356521213)
**调试工具**
- hdc文件传输支持目录接收发送、权限同步、同网段CS文件发送,提升调试调优、自动化测试效率。
### 测试能力
- 新增测试用例筛选执行能力,支持在用例中配置指定字段如用例类型、级别等参数,通过命令执行筛选后的用例,帮助开发者提升测试执行效率,详细请参考[指导](https://gitee.com/openharmony/testfwk_arkxtest#%E5%9F%BA%E7%A1%80%E6%B5%81%E7%A8%8B)
- 新增测试用例驱动执行能力,可将相似测试逻辑的不同输入输出数据配置到辅助文件中使用,帮助开发者减少测试代码量,详细请参考[指导](https://gitee.com/openharmony/testfwk_arkxtest#%E6%95%B0%E6%8D%AE%E9%A9%B1%E5%8A%A8)
- 新增多窗口、双指捏合、抛滑等UI场景模拟操作能力,提升UI自动化支持范围,详细请参考[API说明](../application-dev/reference/apis/js-apis-uitest.md)
- 新增OpenHarmony应用质量要求兼容性测试规范,涵盖UX、性能、功耗、稳定性、兼容性和安全六大方面,规范OpenHarmony应用基础质量要求,详细请参考[官网说明](https://www.openharmony.cn/certification/moreStandard)
- [SmartPerf-Host](https://gitee.com/openharmony-sig/smartperf/tree/master)性能功耗调试调优工具,为开发者提供一套性能调优平台,支持GUI(图形用户界面)操作进行详细数据分析。3.2版本新增:
- 支持功耗分析能力,展示应用各子类别功耗占比信息、资源申请使用记录、功耗异常事件、功耗与系统状态关联信息,详细请参考HiSystemEvent[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_hisystemevent.md)
- 支持Web端抓取trace,详细请参考[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_web_record.md)
- 支持SQL查询和Metrics说明,详细请参考[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_sql_metrics.md)
- 支持内核内存事件分析,详细请参考[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_page_fault.md)
- [wukong](https://gitee.com/openharmony/ostest_wukong)软件稳定性工具能力增强:
- 支持注入滑动、鼠标、字符、系统按键、控件事件,模拟用户多样化随机操作,覆盖真实用户操作场景,挖掘更多稳定性问题。
- 支持设置运行总时长、应用黑白名单,实现个性化测试。
- 支持控件顺序遍历测试,测试过程中支持界面截图;支持休眠唤醒测试。
## 配套关系
**表1** 版本软件和工具配套关系
| 软件 | 版本 | 备注 |
| -------- | -------- | -------- |
| OpenHarmony | 3.2 Release | NA |
| Public SDK | Ohos_sdk_public 3.2.11.9 (API Version 9 Release) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。通过DevEco Studio默认获取的SDK为Public SDK。 |
| HUAWEI DevEco Studio(可选) | 3.1 Beta2 | OpenHarmony应用开发推荐使用。获取方式:<br /> [Windows(64-bit)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/f3/v3/uJyuq3syQ2ak4hE1QZmAug/devecostudio-windows-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013335Z&HW-CC-Expire=315360000&HW-CC-Sign=96262721EDC9B34E6F62E66884AB7AE2A94C2A7B8C28D6F7FC891F46EB211A70) <br />[Mac(X86)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/b7/v3/4z3mLQPCQR-g5KlC56SC1w/devecostudio-mac-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013430Z&HW-CC-Expire=315360000&HW-CC-Sign=93E83FD1F1CE504EF8F098E08955A938FDA4E4926A2555CF1E02DC8D57210D76) <br />[Mac(ARM)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/2e/v3/Fl9IY6PiQxqc3tnI2cftiw/devecostudio-mac-arm-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013540Z&HW-CC-Expire=315360000&HW-CC-Sign=0906243123734033AAD34A7A005ED7671F00CAA693B6E674F81A094A0159ECCE) |
| HUAWEI DevEco Device Tool(可选) | 3.1 Release | OpenHarmony智能设备集成开发环境推荐使用。<br />[点击此处获取](https://device.harmonyos.com/cn/develop/ide/) |
## 源码获取
### 前提条件
1. 注册码云gitee帐号。
2. 注册码云SSH公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191)
3. 安装[git客户端](https://gitee.com/link?target=https%3A%2F%2Fgit-scm.com%2Fbook%2Fzh%2Fv2%2F%25E8%25B5%25B7%25E6%25AD%25A5-%25E5%25AE%2589%25E8%25A3%2585-Git)[git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading)并配置用户信息。
```
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
```
4. 安装码云repo工具,可以执行如下命令。
```
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo #如果没有权限,可下载至其他目录,并将其配置到环境变量中chmod a+x /usr/local/bin/repo
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
```
### 通过repo获取
**方式一(推荐)**
通过repo + ssh 下载(需注册公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191))。
- 从版本分支获取源码。可获取该版本分支的最新源码,包括版本发布后在该分支的合入。
```
repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.2-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
- 从版本发布Tag节点获取源码。可获取与版本发布时完全一致的源码。
```
repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v3.2-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
**方式二**
通过repo + https 下载。
- 从版本分支获取源码。可获取该版本分支的最新源码,包括版本发布后在该分支的合入。
```
repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony-3.2-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
- 从版本发布Tag节点获取源码。可获取与版本发布时完全一致的源码。
```
repo init -u https://gitee.com/openharmony/manifest -b refs/tags/OpenHarmony-v3.2-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
### 从镜像站点获取
**表2** 获取源码路径
| 版本源码 | **版本信息** | **下载站点** | **SHA256校验码** | **软件包容量** |
| --------------------------------------- | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -------- |
| 全量代码(标准、轻量和小型系统) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/code-v3.2-Release.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/code-v3.2-Release.tar.gz.sha256) | 21.8 GB |
| Hi3861解决方案(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_pegasus.tar.gz.sha256) | 22.9 MB |
| Hi3516解决方案-LiteOS(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256) | 294.3 MB |
| Hi3516解决方案-Linux(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256) | 174.3 MB |
| RK3568标准系统解决方案(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/dayu200_standard_arm32.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/dayu200_standard_arm32.tar.gz.sha256) | 3.9 GB |
| 标准系统Public SDK包(Mac) | 3.2.11.9 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/ohos-sdk-mac-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/ohos-sdk-mac-public.tar.gz.sha256) | 712.7 MB |
| 标准系统Public SDK包(Mac-M1) | 3.2.11.9 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/L2-SDK-MAC-M1-PUBLIC.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/L2-SDK-MAC-M1-PUBLIC.tar.gz.sha256) | 671.1 MB |
| 标准系统Public SDK包(Windows/Linux) | 3.2.11.9 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/ohos-sdk-windows_linux-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/ohos-sdk-windows_linux-public.tar.gz.sha256) | 1.6 GB |
## 更新说明
本版本在OpenHarmony 3.2 Beta5的基础上有如下变更:
### API
API变更请参考:
- [*OpenHarmony 3.2 Release相比3.2 Beta5的API差异报告*](api-diff/Beta5%20to%20v3.2-Release)
- [*OpenHarmony 3.2 Release相比3.1 Release的API差异报告*](api-diff/v3.2-Release)
### 芯片及开发板适配
芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。
### Samples
**表3** 新增Samples
| 子系统 | 名称 | 简介 | 开发语言 |
| -------- | -------- | -------- | -------- |
| 无障碍 | [AccessibilityExtensionAbility示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/AccessibilityExtAbility) | 本示例展示了AccessibilityExtensionAbility的简单应用,使用多个辅助功能接口实现了一些快捷的交互方式。 | ArkTS |
| 企业管理 | [企业设备管理ExtensionAbility](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility) | 企业设备管理扩展能力,是MDM应用必备组件。当开发者为企业开发MDM(Mobile Device Management)应用时,需继承EnterpriseAdminExtensionAbility,在EnterpriseAdminExtensionAbility实例中实现MDM业务逻辑,EnterpriseAdminExtensionAbility实现了系统管理状态变化通知功能,并定义了管理应用激活、去激活、应用安装、卸载事件等回调接口。 | ArkTS |
| 任务管理 | [任务延时调度](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/WorkScheduler) | 本示例使用\@ohos.WorkSchedulerExtensionAbility 、\@ohos.net.http 、\@ohos.notification 、\@ohos.bundle 、\@ohos.fileio 等接口,实现了设置后台任务、下载更新包 、保存更新包、发送通知 、安装更新包实现升级的功能。 | ArkTS |
| 网络 | [上传](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Connectivity/Upload) | 本示例主要展示Request服务向三方应用提供系统上传服务能力,通过\@ohos.request,\@ohos.multimedia.mediaLibrary等接口去实现图片的选取与上传。 | ArkTS |
| 任务管理 | [短时任务](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/TransientTask) | 本示例主要展示后台任务中的短时任务。通过\@ohos.resourceschedule.backgroundTaskManager,\@ohos.app.ability.quickFixManager等接口实现应用热更新的方式去展现短时任务机制。 | ArkTS |
| 任务管理 | [长时任务](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/ContinuousTask) | 本示例展示后台任务的长时任务。通过使用\@ohos.resourceschedule.backgroundTaskManager实现后台播放音乐时避免进入挂起(Suspend)状态。 | ArkTS |
| 元能力 | [ArkTS卡片计算器](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ArkTSFormCalc) | 本示例展示了使用ArkTS卡片开发的计算器模型。 | ArkTS |
| 元能力 | [ArkTS卡片Canvas小游戏](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ArkTSCard/CanvasGame) | 本示例展示了如何通过ArkTS卡片的Canvas自定义绘制能力实现一个简单的五子棋游戏卡片。<br/>- 使用Canvas绘制棋盘和黑白棋子的落子。<br/>- 通过卡片支持的点击事件进行交互,让用户在棋盘上进行黑白棋子的对局。<br/>- 通过TS的逻辑代码实现五子棋输赢判定、回退等逻辑计算,整个游戏过程无需拉起FormExtensionAbility。 | ArkTS |
| 元能力 | [ArkTs音乐卡片](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ArkTSCard/ArkTSCardMusicSample) | 本示例展示了如何通过ArkTs卡片实现一个简单的音乐卡片。 | ArkTS |
请访问[Samples](https://gitee.com/openharmony/applications_app_samples)仓了解更多信息。
## 修复缺陷列表
**表4** 修复缺陷ISSUE列表
| ISSUE单 | 问题描述 |
| -------- | -------- |
| I6ATXO | 【RK3568】XTS执行测试,OpenGL测试套执行结果存在失败项 |
| I6BJ9Z<br/>I6BJ82 | alloc_file_pseudo 内存泄漏问题跟踪 |
| I6BRTS | 调用rdb::executeSql接口会引起内存泄漏风险 |
| I6AZ4T | 带textinput输入框组件的应用存在内存泄漏风险 |
## 遗留缺陷列表
**表5** 遗留缺陷列表
| ISSUE | 问题描述 | 影响 | 计划解决日期 |
| -------- | -------- | -------- | -------- |
| I6AB3T | 首次启动联系人应用的用时超出预期基线。 | 设备启动后,联系人进程为非常驻进程,启动联系人应用时需要拉启联系人数据库进程导致有时延偏长。 | 遗留挂起 |
| I6SMQA | 浏览器加载微博,滑动过程中出现抖动。 | 通过浏览器加载微博web网页后,快速滑动时,内容会闪现未加载,然后很快能加载出来,影响滑动体验。 | 2023年5月15日 |
| I6TRE6 | 进程com.ohos.contacts下的com.ohos.contacts线程导致libdatashare_consumer.z.so低概率出现crash。 | 联系人应用快速启动和退出场景,发现在启动后600ms内退出,联系人进程低概率出现crash,出现crash后联系人进程会被重新拉起,影响可控。 | 2023年4月30日 |
| I6SXBI | wukong的ohos.samples.distributedcalc进程下的libdistributeddata.z.so低概率出现cppcrash。 | 计算器应用快速启动和退出场景,启动后1秒内退出,计算器应用低概率出现cppcrash,出现crash后计算器进程会被重新拉起,影响可控。 | 2023年4月30日 |
| I6U00Q | RK3568使用3.5mm耳机播放音频文件,存在pop音。 | 影响设备使用体验,影响可控。 | 2023年5月30日 |
| I6TNY9 | 通话记录处于充满记录的状态时,向上滑动时拨号键盘无法隐藏。 | 影响拨号键盘的隐藏体验。 | 2023年4月30日 |
| I6TOTV | tabs组件中tabs_animation在反复切换过程中,两种颜色同时显示在界面。 | tabs_animation在反复切换场景下,影响tabs组件的颜色显示。 | 2023年4月30日 |
| I6TOV2 <br/>I6TOYV <br/>I6TOQO <br/>I6TOK5 | WiFi或BLE组网引导P2P循环发送100次linktype为stream的通路,会概率性失败。 | WiFi组网引导P2P压测100次,成功率大于80%。而在低概率P2P组网失败后,重新触发组网时高概率能成功,影响可控。 | 2023年5月30日 |
| I6TMP3 | 长按应用进入图片预览,向后滑动150张卡片左右,点击添加卡片,桌面不显示卡片。 | 图片较多的场景下,进入图形预览,添加卡片,桌面概率不显示卡片,影响使用体验,影响可控。 | 2023年4月30日 |
| I6B4U3 | 压力测试出现进程com.ohos.launcher出现appfreeze。 | 安装应用较多(测试场景安装超过40个应用),且内存较小的设备场景下,低概率出现appfreeze,但桌面功能正常,不影响整体功能和使用。 | 2023年5月30日 |
| I64726 <br/>I641A2 | 蓝牙功能接口bluetooth.pairDevice在与其他设备配对时无配对提示,与其他设备静默配对后通过蓝牙键盘、鼠标完全可控制设备。 | 无配对弹窗提示,但能配对成功,不影响软总线的配对组网功能,已在新版本规划需求完成对此功能的支持。 | 2023年6月30日日 |
| I6U1H9 | GridCol的属性 gridColOffset 在预览器未包含。 | 影响预览inspector的属性显示,不影响预览器整体效果。 | 2023年4月30日 |
# OpenHarmony Release Notes
## OpenHarmony 3.x Releases
- [OpenHarmony v3.2 Release (2023-04-09)](OpenHarmony-v3.2-release.md)
- [OpenHarmony v3.2 Beta5 (2023-01-31)](OpenHarmony-v3.2-beta5.md)
- [OpenHarmony v3.2 Beta4 (2022-11-30)](OpenHarmony-v3.2-beta4.md)
- [OpenHarmony v3.2 Beta3 (2022-09-30)](OpenHarmony-v3.2-beta3.md)
......
# HUKS子系统ChangeLog
OpenHarmony 4.0.6.1 版本相较于OpenHarmony 之前的版本,HUKS的API使用权限变更如下。
## cl.huks.1 attestKeyItem接口使用权限变更
attestKeyItem是基于设备证书链封装业务公钥对用户指定的密钥进行证明,如果设备证书随意导出涉及用户隐私风险,所以此接口需要增加系统权限管控。
**变更影响**
对于不具备system权限或者ohos.permission.ACCESS_IDS权限的应用,无法正常使用attestKeyItem接口。
**关键的接口/组件变更**
- 涉及接口
attestKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksReturnResult\>): void;
attestKeyItem(keyAlias: string, options: HuksOptions): Promise\<HuksReturnResult\>;
- 变更前:
只针对传入ATTESTATION_ID相关TAG的应用校验AccessToken权限,其它情况无接口权限的限制。
- 变更后:
只有具备system权限的系统应用或者申请了ohos.permission.ACCESS_IDS权限的普通应用才能正常使用attestKeyItem接口。
**适配指导**
已经具备system权限的应用则可以正常使用attestKeyItem接口,其余普通应用需申请ohos.permission.ACCESS_IDS权限即可,申请方法参考[ACL权限配置说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E8%AE%BF%E9%97%AE%E6%8E%A7%E5%88%B6%E5%88%97%E8%A1%A8acl%E8%AF%B4%E6%98%8E)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册