提交 20669418 编写于 作者: 徐杰

Merge remote-tracking branch 'origin/master' into tiaodan_yafei_0613

Change-Id: Ib9008036320ca609e42d0ce6735c7a22d4267184
......@@ -10,7 +10,7 @@ For details about the APIs, see [ohos.file.statvfs](../reference/apis/js-apis-fi
| Module| API| Description|
| -------- | -------- | -------- |
| \@ohos.file.storageStatistic | getCurrentBundleStats | Obtains the storage space of the current application, in bytes.|
| \@ohos.file.storageStatistics | getCurrentBundleStats | Obtains the storage space of the current application, in bytes.|
| \@ohos.file.statvfs | getFreeSize | Obtains the free space of a file system, in bytes.|
| \@ohos.file.statvfs | getTotalSize | Obtains the total space of a file system, in bytes.|
......
......@@ -12,6 +12,7 @@
- [Using TonePlayer for Audio Playback (for System Applications Only)](using-toneplayer-for-playback.md)
- [Audio Playback Concurrency Policy](audio-playback-concurrency.md)
- [Volume Management](volume-management.md)
- [Audio Effect Management](audio-effect-management.md)
- [Audio Playback Stream Management](audio-playback-stream-management.md)
- [Audio Output Device Management](audio-output-device-management.md)
- [Distributed Audio Playback (for System Applications Only)](distributed-audio-playback.md)
......@@ -54,7 +55,8 @@
- [Image Overview](image-overview.md)
- [Image Decoding](image-decoding.md)
- Image Processing
- [Image Transformation](image-transformation.md)
- [Image Transformation (ArkTS)](image-transformation.md)
- [Image Transformation (Native)](image-transformation-native.md)
- [Pixel Map Operation](image-pixelmap-operation.md)
- [Image Encoding](image-encoding.md)
- [Image Tool](image-tool.md)
# Audio Effect Management
You can manage the audio effect of a specific playback instance, for example, obtaining or setting the audio effect mode of the current audio playback stream. You can also obtain the global audio effect, that is, the audio effect mode corresponding to a specific audio content type (specified by **ContentType**) and audio stream usage (specified by **StreamUsage**).
## Managing the Audio Effect of a Playback Instance
You can obtain and set the audio effect mode, which can be disabled (**EFFECT_NONE**) or default (**EFFECT_DEFAULT**), of the current audio playback stream. In default audio effect mode, the audio effect of the corresponding scenario is automatically loaded based on **ContentType** and **StreamUsage** of the audio stream.
### Creating a Playback Instance
Before obtaining or setting the audio effect mode, you must call **createAudioRenderer(options: AudioRendererOptions)** to create an **AudioRenderer** instance.
1. Import the audio module.
```js
import audio from '@ohos.multimedia.audio';
```
2. Configure audio rendering parameters and create an **AudioRenderer** instance. For details about the audio rendering parameters, see [AudioRendererOptions](../reference/apis/js-apis-audio.md#audiorendereroptions8). For the **AudioRenderer** instance, the audio effect mode **EFFECT_DEFAULT** is used by default.
```js
let audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
};
let audioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 0
};
let audioRendererOptions = {
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
};
audio.createAudioRenderer(audioRendererOptions, (err, data) => {
if (err) {
console.error(`Invoke createAudioRenderer failed, code is ${err.code}, message is ${err.message}`);
return;
} else {
console.info('Invoke createAudioRenderer succeeded.');
let audioRenderer = data;
}
});
```
### Obtaining the Audio Effect Mode of the Playback Instance
```js
audioRenderer.getAudioEffectMode((err, effectmode) => {
if (err) {
console.error(`Failed to get params, code is ${err.code}, message is ${err.message}`);
return;
} else {
console.info(`getAudioEffectMode: ${effectmode}`);
}
});
```
### Setting an Audio Effect Mode for the Playback Instance
Disable the system audio effect.
```js
audioRenderer.setAudioEffectMode(audio.AudioEffectMode.EFFECT_NONE, (err) => {
if (err) {
console.error(`Failed to set params, code is ${err.code}, message is ${err.message}`);
return;
} else {
console.info('Callback invoked to indicate a successful audio effect mode setting.');
}
});
```
Enable the default system audio effect.
```js
audioRenderer.setAudioEffectMode(audio.AudioEffectMode.EFFECT_DEFAULT, (err) => {
if (err) {
console.error(`Failed to set params, code is ${err.code}, message is ${err.message}`);
return;
} else {
console.info('Callback invoked to indicate a successful audio effect mode setting.');
}
});
```
## Obtaining the Global Audio Effect Mode
You can obtain the global audio effect mode corresponding to a specific audio content type (specified by **ContentType**) and audio stream usage (specified by **StreamUsage**).
For an audio playback application, pay attention to the audio effect mode used by the audio stream of the application and perform corresponding operations. For example, for a music application, select the audio effect mode for the music scenario. Before obtaining the global audio effect mode, call **getStreamManager()** to create an **AudioStreamManager** instance.
### Creating an AudioStreamManager Instance
Create an **AudioStreamManager** instance. Before using **AudioStreamManager** APIs, you must use **getStreamManager()** to create an **AudioStreamManager** instance.
```js
import audio from '@ohos.multimedia.audio';
let audioManager = audio.getAudioManager();
let audioStreamManager = audioManager.getStreamManager();
```
### Querying the Audio Effect Mode of the Corresponding Scenario
```js
audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC, audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, audioEffectInfoArray) => {
if (err) {
console.error(`Failed to get effect info array`);
return;
} else {
console.info(`getAudioEffectInfoArray: ${audioEffectInfoArray}`);
}
});
```
......@@ -45,16 +45,14 @@ Set a listener to listen for changes of the device connection state. When a devi
```ts
// Listen for connection state changes of audio devices.
audioRoutingManager.on('deviceChange', audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (deviceChanged) => {
console.info('device change type: ' + deviceChanged.type); // Device connection state change. The value 0 means that the device is connected and 1 means that the device is disconnected.
console.info('device descriptor size : ' + deviceChanged.deviceDescriptors.length);
console.info('device change descriptor: ' + deviceChanged.deviceDescriptors[0].deviceRole); // Device role.
console.info('device change descriptor: ' + deviceChanged.deviceDescriptors[0].deviceType); // Device type.
console.info(`device change type : ${deviceChanged.type}`); // Device connection state change. The value 0 means that the device is connected and 1 means that the device is disconnected.
console.info(`device descriptor size : ${deviceChanged.deviceDescriptors.length}`);
console.info(`device change descriptor : ${deviceChanged.deviceDescriptors[0].deviceRole}`); // Device role.
console.info(`device change descriptor : ${deviceChanged.deviceDescriptors[0].deviceType}`); // Device type.
});
// Cancel the listener for the connection state changes of audio devices.
audioRoutingManager.off('deviceChange', (deviceChanged) => {
console.info('Should be no callback.');
});
audioRoutingManager.off('deviceChange');
```
## Selecting an Audio Output Device (for System Applications only)
......@@ -88,3 +86,46 @@ async function selectOutputDevice(){
});
}
```
## Obtaining Information About the Output Device with the Highest Priority
Call **getPreferOutputDeviceForRendererInfo()** to obtain the output device with the highest priority.
> **NOTE**
>
> The output device with the highest priority is the device that will output audio.
```ts
let rendererInfo = {
content : audio.ContentType.CONTENT_TYPE_MUSIC,
usage : audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags : 0,
}
async function getPreferOutputDeviceForRendererInfo() {
audioRoutingManager.getPreferOutputDeviceForRendererInfo(rendererInfo).then((desc) => {
console.info(`device descriptor: ${desc}`);
}).catch((err) => {
console.error(`Result ERROR: ${err}`);
})
}
```
## Listening for Changes of the Output Device with the Highest Priority
```ts
let rendererInfo = {
content : audio.ContentType.CONTENT_TYPE_MUSIC,
usage : audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags : 0,
}
// Listen for changes of the output device with the highest priority.
audioRoutingManager.on('preferOutputDeviceChangeForRendererInfo', rendererInfo, (desc) => {
console.info(`device change descriptor : ${desc.deviceDescriptors[0].deviceRole}`); // Device role.
console.info(`device change descriptor : ${desc.deviceDescriptors[0].deviceType}`); // Device type.
});
// Cancel the listening for changes of the output device with the highest priority.
audioRoutingManager.off('preferOutputDeviceChangeForRendererInfo');
```
# Image Transformation (Native)
You will learn how to use native image APIs to process images, including cropping, rotating, scaling, flipping, translating, and opacity setting.
## How to Develop
**Adding Dependencies**
Open the **src/main/cpp/CMakeLists.txt** file of the native project, add **libpixelmap_ndk.z.so** of the image and **libhilog_ndk.z.so** of the log to the **target_link_libraries** dependency.
```txt
target_link_libraries(entry PUBLIC libace_napi.z.so libhilog_ndk.z.so libpixelmap_ndk.z.so)
```
**Adding API Mappings**
Open the **src/main/cpp/hello.cpp** file and add the following API mappings to the **Init** function:
```c++
EXTERN_C_START
static napi_value Init(napi_env env, napi_value exports)
{
napi_property_descriptor desc[] = {
{ "createPixelMap", nullptr, CreatePixelMap, nullptr, nullptr, nullptr, napi_default, nullptr },
{ "createAlphaPixelMap", nullptr, CreateAlphaPixelMap, nullptr, nullptr, nullptr, napi_default, nullptr },
{ "transform", nullptr, Transform, nullptr, nullptr, nullptr, napi_default, nullptr }
};
napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
return exports;
}
EXTERN_C_END
```
**Calling the Native APIs**
For details about the APIs, see [Image API Reference](../reference/native-apis/image.md).
Obtain the JS resource object from the **hello.cpp** file and convert it to a native resource object. Then you can call native APIs. The sample code is as follows:
1. Create a **PixelMap** object based on a pixel array.
```c++
// Create a PixelMap object.
napi_value CreatePixelMap(napi_env env, napi_callback_info info)
{
napi_value udfVar = nullptr;
napi_value thisVar = nullptr;
napi_value argValue[2] = {0};
size_t argCount = 2;
void* buffer = nullptr;
size_t bufferSize = 0;
struct OhosPixelMapCreateOps createOps;
napi_value pixelmap = nullptr;
napi_get_undefined(env, &udfVar);
napi_get_cb_info(env, info, &argCount, argValue, &thisVar, nullptr);
if (napi_get_arraybuffer_info(env, argValue[0], &buffer, &bufferSize) != napi_ok ||
buffer == nullptr || bufferSize == 0) {
return udfVar;
}
createOps.width = 4;
createOps.height = 6;
createOps.pixelFormat = 4;
createOps.alphaType = 0;
int32_t res = OH_PixelMap_CreatePixelMap(env, createOps, (uint8_t *)buffer, bufferSize, &pixelmap);
if (res != OHOS_IMAGE_RESULT_SUCCESS || pixelmap == nullptr) {
return udfVar;
}
return pixelmap;
}
// Create a PixelMap object that contains only the alpha channel.
napi_value CreateAlphaPixelMap(napi_env env, napi_callback_info info)
{
napi_value udfVar = nullptr;
napi_value thisVar = nullptr;
napi_value argValue[1] = {0};
size_t argCount = 1;
napi_value alphaPixelmap = nullptr;
napi_get_undefined(env, &udfVar);
if (napi_get_cb_info(env, info, &argCount, argValue, &thisVar, nullptr) != napi_ok ||
argCount < 1 || argValue[0] == nullptr) {
return udfVar;
}
int32_t res = OH_PixelMap_CreateAlphaPixelMap(env, argValue[0], &alphaPixelmap);
if (res != OHOS_IMAGE_RESULT_SUCCESS || alphaPixelmap == nullptr) {
return udfVar;
}
return alphaPixelmap;
}
```
2. Perform image transformation. For details about the operation, read the comments in the sample code below.
```c++
napi_value Transform(napi_env env, napi_callback_info info)
{
napi_value thisVar = nullptr;
napi_value argValue[1] = {0};
size_t argCount = 1;
if (napi_get_cb_info(env, info, &argCount, argValue, &thisVar, nullptr) != napi_ok ||
argCount < 1 || argValue[0] == nullptr) {
return nullptr;
}
napi_value result = nullptr;
napi_get_undefined(env, &result);
NativePixelMap* native = OH_PixelMap_InitNativePixelMap(env, argValue[0]);
if (native == nullptr) {
return result;
}
// Obtain image information.
struct OhosPixelMapInfo pixelmapInfo;
OH_PixelMap_GetImageInfo(native, &pixelmapInfo);
// Obtain the number of bytes per row of the PixelMap object.
int32_t rowBytes;
OH_PixelMap_GetBytesNumberPerRow(native, &rowBytes);
// Check whether the PixelMap object is editable.
int32_t editable = 0;
OH_PixelMap_GetIsEditable(native, &editable);
// Check whether the PixelMap object supports alpha channels.
int32_t supportAlpha = 0;
OH_PixelMap_IsSupportAlpha(native, &supportAlpha);
// Set an alpha channel for the PixelMap object.
int32_t alphaAble = 0;
OH_PixelMap_SetAlphaAble(native, alphaAble);
// Obtain the pixel density of the PixelMap object.
int32_t densityG;
OH_PixelMap_GetDensity(native, &densityG);
// Set the pixel density for the PixelMap object.
int32_t densityS = 100;
OH_PixelMap_SetDensity(native, densityS);
// Set the opacity for the PixelMap object.
float opacity = 0.5;
OH_PixelMap_SetOpacity(native, opacity);
// Scale the image.
// scaleX: The width of the image after scaling is 0.5 of the original width.
// scaleY: The height of the image after scaling is 0.5 of the original height.
float scaleX = 0.5;
float scaleY = 0.5;
OH_PixelMap_Scale(native, scaleX, scaleY);
// Translate the image.
// translateX: Translate the image by 50 units downwards.
// translateY: Translate the image by 50 units rightwards.
float translateX = 50;
float translateY = 50;
OH_PixelMap_Translate(native, translateX, translateY);
// Rate the image clockwise by 90°.
float angle = 90;
OH_PixelMap_Rotate(native, angle);
// Flip the image.
// flipX: whether to flip the image horizontally. The value 1 means to flip the image and 0 means the opposite.
// flipY: whether to flip the image vertically. The value 1 means to flip the image and 0 means the opposite.
int32_t flipX = 0;
int32_t flipY = 1;
OH_PixelMap_Flip(native, flipX, flipY);
// Crop the image.
// cropX: x-axis coordinate of the start point for cropping (0).
// cropY: y-axis coordinate of the start point for cropping (0).
// cropH: height after cropping (10), cropping from top to bottom.
// cropW: width after cropping (10), cropping from left to right.
int32_t cropX = 1;
int32_t cropY = 1;
int32_t cropW = 10;
int32_t cropH = 10;
OH_PixelMap_Crop(native, cropX, cropY, cropW, cropH);
uint8_t* pixelAddr = nullptr;
// Obtain the memory address of the PixelMap object and lock the memory.
OH_PixelMap_AccessPixels(native, &pixelAddr);
// Unlock the memory of the PixelMap object.
OH_PixelMap_UnAccessPixels(native);
return result;
}
```
**Calling APIs on the JS Side**
1. Open **src\main\ets\pages\index.ets**, and import **libentry.so**.
2. Call the native APIs and pass in the JS resource object. The sample code is as follows:
```js
import testNapi from 'libentry.so'
import image from '@ohos.multimedia.image'
@Entry
@Component
struct Index {
@State _pixelMap: image.PixelMap = undefined;
build() {
Row() {
Column() {
Button("PixelMap")
.width(100)
.height(100)
.onClick(() => {
const color = new ArrayBuffer(96);
var bufferArr = new Uint8Array(color);
for (var i = 0; i < bufferArr.length; i++) {
bufferArr[i] = 0x80;
}
this._pixelMap = testNapi.createPixelMap(color);
testNapi.transform(this._pixelMap);
})
Image(this._pixelMap)
.width(500)
.height(500)
.objectFit(ImageFit.Cover)
}
.width('100%')
}
.height('100%')
}
}
```
# Image Transformation
# Image Transformation (ArkTS)
Image processing refers to a series of operations performed on the pixel map, such as obtaining image information, cropping, scaling, translating, rotating, flipping, setting opacity, and reading and writing pixel data. These operations can be classified into image transformation and [pixel map operation](image-pixelmap-operation.md). This topic describes the image transformation operations that you can perform.
......@@ -51,7 +51,7 @@ Read [Image](../reference/apis/js-apis-image.md#pixelmap7) for APIs related to i
```
// Translate the image by 100 units downwards.
// Translate the image by 100 units to the right.
// Translate the image by 100 units rightwards.
pixelMap.translate(100, 100);
```
......
......@@ -4,7 +4,7 @@
The multi-HAP mechanism is used to facilitate modular management for developers. There is no one-to-one mapping between the HAP and the running process of the application. The detailed running mechanism is as follows:
- By default, all UIAbility, ServiceExtensionAbility, and DataShareExtensionAbility components of an application (with the same bundle name) run in the same independent process, and other ExtensionAbility components of the same type run in separate processes.
- By default, all UIAbility, ServiceExtensionAbility, and DataShareExtensionAbility components of an application (with the same bundle name) run in the same independent process (known as the main process), and other ExtensionAbility components of the same type run in separate processes.
- The HAP file supports the process configuration through the **process** tag in the **module.json5** (stage model) or **config.json** (FA model) file. This feature is supported only by system applications. If **process** is configured for an HAP file, all components of the HAP file run in an independent process. Multiple HAP files can be configured with the same process, in which case the HAP files run in the same process. For details about the process configuration, see [module.json5 Configuration File](module-configuration-file.md).
......
# Shared Package Overview
OpenHarmony provides two types of shared packages: [Harmony Achive (HAR)](har-package.md) static shared package and Harmony Shared Package (HSP) dynamic shared package.
OpenHarmony provides two types of shared packages: [Harmony Archive (HAR)](har-package.md) static shared package and Harmony Shared Package (HSP) dynamic shared package.
Both the HAR and HSP are used to share code and resources and can contain code, C++ libraries, resources, and configuration files. The biggest differences between them are as follows: The code and resources in the HAR are compiled with the invoking module, and if there are multiple invoking modules, the build product contains multiple copies of the same code and resources; the code and resources in the HSP can be compiled independently, and the build product contains only one copy of the code and resources.
......
......@@ -486,8 +486,8 @@ Enumerates the audio channels.
| Name | Value | Description |
| --------- | -------- | -------- |
| CHANNEL_1 | 0x1 << 0 | Channel 1. |
| CHANNEL_2 | 0x1 << 1 | Channel 2. |
| CHANNEL_1 | 0x1 << 0 | Channel 1.|
| CHANNEL_2 | 0x1 << 1 | Channel 2.|
## AudioSamplingRate<sup>8+</sup>
......@@ -580,6 +580,17 @@ Enumerates the audio states.
| STATE_RELEASED | 4 | Released. |
| STATE_PAUSED | 5 | Paused. |
## AudioEffectMode<sup>10+</sup>
Enumerates the audio effect modes.
**System capability**: SystemCapability.Multimedia.Audio.Renderer
| Name | Value | Description |
| ------------------ | ------ | ---------- |
| EFFECT_NONE | 0 | The audio effect is disabled.|
| EFFECT_DEFAULT | 1 | The default audio effect is used.|
## AudioRendererRate<sup>8+</sup>
Enumerates the audio renderer rates.
......@@ -2023,7 +2034,7 @@ Currently, when multiple **AudioManager** instances are used in a single process
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when a system volume change is detected.|
| callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the system volume change event. |
| callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the result. |
**Example**
......@@ -2054,7 +2065,7 @@ Subscribes to ringer mode change events.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value **'ringerModeChange'** means the ringer mode change event, which is triggered when a ringer mode change is detected.|
| callback | Callback<[AudioRingMode](#audioringmode)> | Yes | Callback used to return the ringer mode change event. |
| callback | Callback<[AudioRingMode](#audioringmode)> | Yes | Callback used to return the result. |
**Example**
......@@ -2116,9 +2127,7 @@ Unsubscribes from device change events.
**Example**
```js
audioManager.off('deviceChange', (deviceChanged) => {
console.info('Should be no callback.');
});
audioManager.off('deviceChange');
```
### on('interrupt')
......@@ -2329,7 +2338,7 @@ Subscribes to system volume change events. This API uses an asynchronous callbac
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when the system volume changes.|
| callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the system volume change event. |
| callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the result. |
**Error codes**
......@@ -2839,7 +2848,7 @@ Subscribes to ringer mode change events.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The value **'ringerModeChange'** means the ringer mode change event, which is triggered when a ringer mode change is detected.|
| callback | Callback<[AudioRingMode](#audioringmode)> | Yes | Callback used to return the system volume change event. |
| callback | Callback<[AudioRingMode](#audioringmode)> | Yes | Callback used to return the result. |
**Error codes**
......@@ -3397,6 +3406,68 @@ audioStreamManager.isActive(audio.AudioVolumeType.MEDIA).then((value) => {
});
```
### getAudioEffectInfoArray<sup>10+</sup>
getAudioEffectInfoArray(content: ContentType, usage: StreamUsage, callback: AsyncCallback&lt;AudioEffectInfoArray&gt;): void
Obtains information about the sound effect mode in use. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Audio.Renderer
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | -------- | --------------------------- |
| content | [ContentType](#contenttype) | Yes | Audio content type. |
| usage | [StreamUsage](#streamusage) | Yes | Audio stream usage. |
| callback | AsyncCallback<[AudioEffectInfoArray](#audioeffectinfoarray10)> | Yes | Callback used to return the information obtained.|
**Example**
```js
audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC, audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, audioEffectInfoArray) => {
console.info('getAudioEffectInfoArray **** Get Callback Called ****');
if (err) {
console.error(`getAudioEffectInfoArray :ERROR: ${err}`);
return;
} else {
console.info(`The contentType of ${CONTENT_TYPE_MUSIC} and the streamUsage of ${STREAM_USAGE_MEDIA} 's effect modes are: ${audioEffectInfoArray}`);
}
});
```
### getAudioEffectInfoArray<sup>10+</sup>
getAudioEffectInfoArray(content: ContentType, usage: StreamUsage): Promise&lt;AudioEffectInfoArray&gt;
Obtains information about the sound effect mode in use. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Audio.Renderer
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | -------- | --------------------------- |
| content | [ContentType](#contenttype) | Yes | Audio content type. |
| usage | [StreamUsage](#streamusage) | Yes | Audio stream usage. |
**Return value**
| Type | Description |
| --------------------------------------------------------------------------| --------------------------------------- |
| Promise<[AudioEffectInfoArray](#audioeffectinfoarray10)> | Promise used to return the information obtained. |
**Example**
```js
audioStreamManager.getAudioEffectInfoArray().then((audioEffectInfoArray) => {
console.info(`getAudioEffectInfoArray ######### Get Promise is called ##########`);
console.info(`The contentType of ${CONTENT_TYPE_MUSIC} and the streamUsage of ${STREAM_USAGE_MEDIA} 's effect modes are: ${audioEffectInfoArray}`);
}).catch((err) => {
console.error(`getAudioEffectInfoArray :ERROR: ${err}`);
});
```
## AudioRoutingManager<sup>9+</sup>
Implements audio routing management. Before calling any API in **AudioRoutingManager**, you must use [getRoutingManager](#getroutingmanager9) to obtain an **AudioRoutingManager** instance.
......@@ -3517,9 +3588,7 @@ For details about the error codes, see [Audio Error Codes](../errorcodes/errorco
**Example**
```js
audioRoutingManager.off('deviceChange', (deviceChanged) => {
console.info('Should be no callback.');
});
audioRoutingManager.off('deviceChange');
```
### selectInputDevice<sup>9+</sup>
......@@ -4071,9 +4140,7 @@ For details about the error codes, see [Audio Error Codes](../errorcodes/errorco
**Example**
```js
audioRoutingManager.off('preferOutputDeviceChangeForRendererInfo', () => {
console.info('Should be no callback.');
});
audioRoutingManager.off('preferOutputDeviceChangeForRendererInfo');
```
## AudioRendererChangeInfoArray<sup>9+</sup>
......@@ -4191,6 +4258,10 @@ audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) =>
});
```
## AudioEffectInfoArray<sup>10+</sup>
Defines an array that contains the audio effect mode corresponding to a specific audio content type (specified by **ContentType**) and audio stream usage (specified by **StreamUsage**). The [AudioEffectMode](#audioeffectmode10) array is read-only.
## AudioDeviceDescriptors
Defines an [AudioDeviceDescriptor](#audiodevicedescriptor) array, which is read-only.
......@@ -4434,6 +4505,113 @@ audioRenderer.getAudioStreamId().then((streamid) => {
});
```
### setAudioEffectMode<sup>10+</sup>
setAudioEffectMode(mode: AudioEffectMode, callback: AsyncCallback\<void>): void
Sets an audio effect mode. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Audio.Renderer
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------- | ---- | ------------------------ |
| mode | [AudioEffectMode](#audioeffectmode10) | Yes | Audio effect mode to set. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. |
**Example**
```js
audioRenderer.setAudioEffectMode(audio.AudioEffectMode.EFFECT_DEFAULT, (err) => {
if (err) {
console.error('Failed to set params');
} else {
console.info('Callback invoked to indicate a successful audio effect mode setting.');
}
});
```
### setAudioEffectMode<sup>10+</sup>
setAudioEffectMode(mode: AudioEffectMode): Promise\<void>
Sets an audio effect mode. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Audio.Renderer
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ---------------------------------------- | ---- | ------------ |
| mode | [AudioEffectMode](#audioeffectmode10) | Yes | Audio effect mode to set.|
**Return value**
| Type | Description |
| -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result.|
**Example**
```js
audioRenderer.setAudioEffectMode(audio.AudioEffectMode.EFFECT_DEFAULT).then(() => {
console.info('setAudioEffectMode SUCCESS');
}).catch((err) => {
console.error(`ERROR: ${err}`);
});
```
### getAudioEffectMode<sup>10+</sup>
getAudioEffectMode(callback: AsyncCallback\<AudioEffectMode>): void
Obtains the audio effect mode in use. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Audio.Renderer
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------ |
| callback | AsyncCallback<[AudioEffectMode](#audioeffectmode10)> | Yes | Callback used to return the audio effect mode.|
**Example**
```js
audioRenderer.getAudioEffectMode((err, effectmode) => {
if (err) {
console.error('Failed to get params');
} else {
console.info(`getAudioEffectMode: ${effectmode}`);
}
});
```
### getAudioEffectMode<sup>10+</sup>
getAudioEffectMode(): Promise\<AudioEffectMode>
Obtains the audio effect mode in use. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Audio.Renderer
**Return value**
| Type | Description |
| ------------------------------------------------- | ------------------------- |
| Promise<[AudioEffectMode](#audioeffectmode10)> | Promise used to return the audio effect mode.|
**Example**
```js
audioRenderer.getAudioEffectMode().then((effectmode) => {
console.info(`getAudioEffectMode: ${effectmode}`);
}).catch((err) => {
console.error(`ERROR: ${err}`);
});
```
### start<sup>8+</sup>
start(callback: AsyncCallback<void\>): void
......
......@@ -259,6 +259,103 @@ try {
```
## bluetoothManager.pairCredibleDevice<sup>10+</sup>
pairCredibleDevice(deviceId: string, transport: BluetoothTransport, callback: AsyncCallback&lt;void&gt;): void
Pairs a trusted remote device whose address is obtained in a non-Bluetooth scan mode (such as using NFC).
**System API**: This is a system API.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ----------------------------------- |
| deviceId | string | Yes | Address of the remote device to pair, for example, XX:XX:XX:XX:XX:XX.|
| transport | [BluetoothTransport](#bluetoothtransport10) | Yes | Device type, for example, a classic Bluetooth device or a Bluetooth low energy (BLE) device.|
| 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
try {
bluetoothManager.pairCredibleDevice("68:13:24:79:4C:8C", 1, err => {
if (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
return;
}
console.info("pairCredibleDevice,err:" + JSON.stringify(err));
});
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
## bluetoothManager.pairCredibleDevice<sup>10+</sup>
pairCredibleDevice(deviceId: string, transport: BluetoothTransport): Promise&lt;void&gt;
Pairs a trusted remote device whose address is obtained in a non-Bluetooth scan mode (such as using NFC).
**System API**: This is a system API.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ----------------------------------- |
| deviceId | string | Yes | Address of the remote device to pair, for example, XX:XX:XX:XX:XX:XX.|
| transport | [BluetoothTransport](#bluetoothtransport10) | Yes | Device type, for example, a classic Bluetooth device or a BLE device.|
**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
try {
bluetoothManager.pairCredibleDevice("68:13:24:79:4C:8C", 0).then(() => {
console.info("PairCredibleDevice");
}, err => {
console.error("PairCredibleDevice:errCode" + err.code + ",errMessage:" + err.message);
});
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
## bluetoothManager.getProfileConnectionState<a name="getProfileConnectionState"></a>
getProfileConnectionState(profileId: ProfileId): ProfileConnectionState
......@@ -694,7 +791,7 @@ try {
```
## bluetoothManager.setDevicePinCode<sup>10+</sup><a name="setDevicePinCode"></a>
## bluetoothManager.setDevicePinCode<sup>10+</sup><a name="setDevicePinCode-1"></a>
setDevicePinCode(device: string, code: string): Promise&lt;void&gt;
......@@ -985,7 +1082,7 @@ try {
on(type: "stateChange", callback: Callback&lt;BluetoothState&gt;): void
Subscribes to the Bluetooth connection state change events.
Subscribes to Bluetooth state events.
**Required permissions**: ohos.permission.USE_BLUETOOTH
......@@ -1024,7 +1121,7 @@ try {
off(type: "stateChange", callback?: Callback&lt;BluetoothState&gt;): void
Unsubscribes from the Bluetooth connection state change events.
Unsubscribes from Bluetooth state events.
**Required permissions**: ohos.permission.USE_BLUETOOTH
......@@ -2167,7 +2264,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
```js
try {
let hidHostProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile;
let hidHostProfile = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile;
hidHostProfile.connect('XX:XX:XX:XX:XX:XX');
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
......@@ -2208,7 +2305,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
```js
try {
let hidHostProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile;
let hidHostProfile = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile;
hidHostProfile.disconnect('XX:XX:XX:XX:XX:XX');
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
......@@ -2237,7 +2334,7 @@ Subscribes to the HidHost connection state change events.
function onReceiveEvent(data) {
console.info('hidHost state = '+ JSON.stringify(data));
}
let hidHost = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile;
let hidHost = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile;
hidHost.on('connectionStateChange', onReceiveEvent);
```
......@@ -2263,7 +2360,7 @@ Unsubscribes from the HidHost connection state change events.
function onReceiveEvent(data) {
console.info('hidHost state = '+ JSON.stringify(data));
}
let hidHost = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile;
let hidHost = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile;
hidHost.on('connectionStateChange', onReceiveEvent);
hidHost.off('connectionStateChange', onReceiveEvent);
```
......@@ -2307,7 +2404,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
```js
try {
let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
let panProfile = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
panProfile.disconnect('XX:XX:XX:XX:XX:XX');
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
......@@ -2336,7 +2433,7 @@ Subscribes to the PAN connection state change events.
function onReceiveEvent(data) {
console.info('pan state = '+ JSON.stringify(data));
}
let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
let panProfile = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
panProfile.on('connectionStateChange', onReceiveEvent);
```
......@@ -2362,7 +2459,7 @@ Unsubscribes from the PAN connection state change events.
function onReceiveEvent(data) {
console.info('pan state = '+ JSON.stringify(data));
}
let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
let panProfile = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
panProfile.on('connectionStateChange', onReceiveEvent);
panProfile.off('connectionStateChange', onReceiveEvent);
```
......@@ -2401,7 +2498,7 @@ For details about the error codes, see [Bluetooth Error Codes](../errorcodes/err
```js
try {
let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
let panProfile = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
panProfile.setTethering(true);
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
......@@ -2429,7 +2526,7 @@ Obtains the network sharing status.
```js
try {
let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
let panProfile = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile;
let ret = panProfile.isTetheringOn();
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
......@@ -4355,6 +4452,7 @@ Defines the content of a BLE advertisement packet.
| serviceUuids | Array&lt;string&gt; | Yes | Yes | List of service UUIDs to broadcast.|
| manufactureData | Array&lt;[ManufactureData](#manufacturedata)&gt; | Yes | Yes | List of manufacturers to broadcast. |
| serviceData | Array&lt;[ServiceData](#servicedata)&gt; | Yes | Yes | List of service data to broadcast. |
| includeDeviceName<sup>10+</sup> | boolean | Yes | Yes | Whether the device name is contained. This parameter is optional. |
## ManufactureData
......@@ -4391,7 +4489,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. |
| pinType<sup>10+</sup> | [PinType](#pintype10) | Yes | No | Type of the device to pair.<br>This is a system API. |
## BondStateParam<a name="BondStateParam"></a>
......@@ -4424,13 +4522,13 @@ 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.|
| Name | Type | Mandatory | Description |
| -------- | ------ |---- | ----------- |
| write<sup>10+</sup> | boolean | Yes | Permits writes of the characteristic value (with a response).|
| writeNoResponse<sup>10+</sup> | boolean | Yes | Permits writes of the characteristic value (without a response).|
| read<sup>10+</sup> | boolean | Yes | Permits reads of the characteristic value.|
| notify<sup>10+</sup> | boolean | Yes | Permits notifications of the characteristic value.|
| indicate<sup>10+</sup> | boolean | Yes | Permits notifications of the characteristic value without acknowledgement.|
## DeviceClass<a name="DeviceClass"></a>
......@@ -4589,19 +4687,33 @@ Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOS
| PROFILE_PAN_NETWORK | 7 | PAN profile. |
## BluetoothTransport<sup>10+</sup><a name="BluetoothTransport"></a>
Enumerates the device types. The default device type is **TRANSPORT_BR_EDR**.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
| -------------------------------- | ------ | --------------- |
| TRANSPORT_BR_EDR<sup>10+</sup> | 0 | Classic Bluetooth (BR/EDR) device.|
| TRANSPORT_LE<sup>10+</sup> | 1 | BLE device. |
## PinType<sup>10+</sup><a name="PinType"></a>
Enumerates the Bluetooth pairing types.
**System API**: This is a system API.
**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. |
| PIN_TYPE_ENTER_PIN_CODE<sup>10+</sup> | 0 | The user needs to enter the PIN displayed on the peer device.<br>This is a system API.|
| PIN_TYPE_ENTER_PASSKEY<sup>10+</sup> | 1 | The user needs to enter the PASSKEY displayed on the peer device.<br>This is a system API. |
| PIN_TYPE_CONFIRM_PASSKEY<sup>10+</sup> | 2 | The user needs to confirm the PASSKEY displayed on the local device.<br>This is a system API. |
| PIN_TYPE_NO_PASSKEY_CONSENT<sup>10+</sup> | 3 | There is no PASSKEY, and the user needs to accept or reject the pairing request.<br>This is a system API. |
| PIN_TYPE_NOTIFY_PASSKEY<sup>10+</sup> | 4 | The user needs to enter the PASSKEY displayed on the local device on the peer device.<br>This is a system API. |
| 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.<br>This is a system API. |
| PIN_TYPE_OOB_CONSENT<sup>10+</sup> | 6 | The user needs to accept or reject the out of band (OOB) pairing request.<br>This is a system API. |
| PIN_TYPE_PIN_16_DIGITS<sup>10+</sup> | 7 | The user needs to enter the 16-digit PIN displayed on the peer device.<br>This is a system API. |
......@@ -4,7 +4,8 @@ The **accountManager** module provides APIs for account management of enterprise
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -48,7 +49,7 @@ let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
accountManager.disallowAddLocalAccount(admin, true, (error) => {
accountManager.disallowAddLocalAccount(wantTemp, true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
......
......@@ -31,7 +31,7 @@ Enables a device administrator application of the current user. This API uses an
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#admintype) | Yes | Type of the device administrator to enable. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -82,8 +82,8 @@ Enables a device administrator application of the user specified by **userId**.
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#admintype) | Yes | Type of the device administrator to enable. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
......@@ -119,7 +119,7 @@ adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_
enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise\<void>
Enables a device administrator application of the user specified by **userId** (if any) or the current user. This API uses a promise to return the result. The super administrator application can be enabled only by the administrator.
Enables a device administrator application of the specified user (if **userId** is passed in) or the current user (if **userId** is not passed in). This API uses a promise to return the result. The super administrator application can be enabled only by the administrator.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -134,7 +134,7 @@ Enables a device administrator application of the user specified by **userId** (
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#admintype) | Yes | Type of the device administrator to enable. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
......@@ -173,7 +173,7 @@ adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_
disableAdmin(admin: Want, callback: AsyncCallback\<void>): void
Disables a device common administrator application of the current user. This API uses an asynchronous callback to return the result.
Disables a device administrator application of the current user. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -185,8 +185,8 @@ Disables a device common administrator application of the current user. This API
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device common administrator application. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -216,7 +216,7 @@ adminManager.disableAdmin(wantTemp, error => {
disableAdmin(admin: Want, userId: number, callback: AsyncCallback\<void>): void
Disables a device common administrator application of the user specified by **userId**. This API uses an asynchronous callback to return the result.
Disables a device administrator application of the user specified by **userId**. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -228,9 +228,9 @@ Disables a device common administrator application of the user specified by **us
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device common administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
......@@ -260,7 +260,7 @@ adminManager.disableAdmin(wantTemp, 100, error => {
disableAdmin(admin: Want, userId?: number): Promise\<void>
Disables a device administrator application of the user specified by **userId** (if any) or the current user. This API uses a promise to return the result.
Disables a device administrator application of the specified user (if **userId** is passed in) or the current user (if **userId** is not passed in). This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -272,8 +272,8 @@ Disables a device administrator application of the user specified by **userId**
| Name | Type | Mandatory | Description |
| ------ | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device common administrator application. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
......@@ -305,7 +305,7 @@ adminManager.disableAdmin(wantTemp, 100).catch(error => {
disableSuperAdmin(bundleName: String, callback: AsyncCallback\<void>): void
Disables a device super administrator application based on the specified bundle name. This API uses an asynchronous callback to return the result.
Disables a super device administrator application based on the specified bundle name. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -317,8 +317,8 @@ Disables a device super administrator application based on the specified bundle
| Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | ------------------- |
| bundleName | String | Yes | Bundle name of the device super administrator application. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| bundleName | String | Yes | Bundle name of the super device administrator application. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -345,7 +345,7 @@ adminManager.disableSuperAdmin(bundleName, error => {
disableSuperAdmin(bundleName: String): Promise\<void>
Disables a device super administrator application based on the specified bundle name. This API uses a promise to return the result.
Disables a super device administrator application based on the specified bundle name. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -357,7 +357,7 @@ Disables a device super administrator application based on the specified bundle
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| bundleName | String | Yes | Bundle name of the device super administrator application.|
| bundleName | String | Yes | Bundle name of the super device administrator application.|
**Return value**
......@@ -397,7 +397,7 @@ Checks whether a device administrator application of the current user is enabled
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | -------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object.|
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object.|
**Example**
......@@ -430,8 +430,8 @@ Checks whether a device administrator application of the user specified by **use
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object. |
**Example**
......@@ -453,7 +453,7 @@ adminManager.isAdminEnabled(wantTemp, 100, (error, result) => {
isAdminEnabled(admin: Want, userId?: number): Promise\<boolean>
Checks whether a device administrator application of the user specified by **userId** (if any) or the current user is enabled. This API uses a promise to return the result.
Checks whether a device administrator application of the specified user (if **userId** is passed in) or the current user (if **userId** is not passed in) is enabled. This API uses a promise to return the result.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -464,7 +464,7 @@ Checks whether a device administrator application of the user specified by **use
| Name | Type | Mandatory | Description |
| ------ | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
......@@ -490,7 +490,7 @@ adminManager.isAdminEnabled(wantTemp, 100).then((result) => {
isSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): void
Checks whether a device super administrator application is enabled based on the specified bundle name. This API uses an asynchronous callback to return the result.
Checks whether a super device administrator application is enabled based on the specified bundle name. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -501,7 +501,7 @@ Checks whether a device super administrator application is enabled based on the
| Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | -------------------- |
| bundleName | String | Yes | Device administrator application. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object.|
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the super device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object.|
**Example**
......@@ -520,7 +520,7 @@ adminManager.isSuperAdmin(bundleName, (error, result) => {
isSuperAdmin(bundleName: String): Promise\<boolean>
Checks whether a device super administrator application is enabled based on the specified bundle name. This API uses a promise to return the result.
Checks whether a super device administrator application is enabled based on the specified bundle name. This API uses a promise to return the result.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -530,13 +530,13 @@ Checks whether a device super administrator application is enabled based on the
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | --------- |
| bundleName | String | Yes | Device super administrator application.|
| bundleName | String | Yes | Super device administrator application.|
**Return value**
| ID | Error Message |
| ----------------- | ------------------- |
| Promise\<boolean> | Promise used to return the result. If **true** is returned, the device super administrator application is enabled. If **false** is returned, the device super administrator application is not enabled.|
| Promise\<boolean> | Promise used to return the result. If **true** is returned, the super device administrator application is enabled. If **false** is returned, the super device administrator application is not enabled.|
**Example**
......@@ -567,7 +567,7 @@ Sets the enterprise information of a device administrator application. This API
| -------------- | ----------------------------------- | ---- | ---------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| callback | AsyncCallback\<void>; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| callback | AsyncCallback\<void>; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -661,7 +661,7 @@ Obtains the enterprise information of a device administrator application. This A
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------ |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the enterprise information of the device administrator application. If the operation fails, **err** is an error object.|
| callback | AsyncCallback&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the enterprise information of the device administrator application obtained. If the operation fails, **err** is an error object.|
**Error codes**
......@@ -708,7 +708,7 @@ Obtains the enterprise information of a device administrator application. This A
| Type | Description |
| ---------------------------------------- | ------------------------- |
| Promise&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Callback used to return the enterprise information of the device administrator application.|
| Promise&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Promise used to return the enterprise information of the specified device administrator application obtained.|
**Error codes**
......@@ -737,7 +737,7 @@ adminManager.getEnterpriseInfo(wantTemp).then((result) => {
subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callback: AsyncCallback\<void>): void
Configures a device administrator application to subscribe to system management events. This API uses an asynchronous callback to return the result.
Subscribes to system management events through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT
......@@ -751,7 +751,7 @@ Configures a device administrator application to subscribe to system management
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| managedEvents | Array\<[ManagedEvent](#managedevent)> | Yes| Array of events to subscribe to.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| callback | AsyncCallback\<void> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -781,7 +781,7 @@ adminManager.subscribeManagedEvent(wantTemp, events, (error) => {
subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promise\<void>
Configures a device administrator application to subscribe to system management events. This API uses a promise to return the result.
Subscribes to system management events through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT
......@@ -829,7 +829,7 @@ adminManager.subscribeManagedEvent(wantTemp, events).then(() => {
unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callback: AsyncCallback\<void>): void
Configures a device administrator application to unsubscribe from system management events. This API uses an asynchronous callback to return the result.
Unsubscribes from system management events through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT
......@@ -843,7 +843,7 @@ Configures a device administrator application to unsubscribe from system managem
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| managedEvents | Array\<[ManagedEvent](#managedevent)> | Yes| Array of events to unsubscribe from.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| callback | AsyncCallback\<void> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -873,7 +873,7 @@ adminManager.unsubscribeManagedEvent(wantTemp, events, (error) => {
unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promise\<void>
Configures a device administrator application to unsubscribe from system management events. This API uses a promise to return the result.
Unsubscribes from system management events through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT
......@@ -919,7 +919,7 @@ adminManager.unsubscribeManagedEvent(wantTemp, events).then(() => {
## EnterpriseInfo
Describes the enterprise information of a device administrator application.
Defines the enterprise information of a device administrator application.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -953,7 +953,7 @@ Enumerates the system management events that can be subscribed to.
| Name | Value | Description |
| -------------------------- | ---- | ------------- |
| MANAGED_EVENT_BUNDLE_ADDED | 0 | Bundle added.|
| MANAGED_EVENT_BUNDLE_REMOVED | 1 | Bundle removed.|
| MANAGED_EVENT_BUNDLE_ADDED | 0 | Application installed.|
| MANAGED_EVENT_BUNDLE_REMOVED | 1 | Application uninstalled.|
| MANAGED_EVENT_APP_START<sup>10+</sup> | 2 | Application started.|
| MANAGED_EVENT_APP_STOP<sup>10+</sup> | 3 | Application stopped.|
# @ohos.enterprise.applicationManager (Application Management)
The **applicationManager** module provides application management capabilities, including adding applications to or removing applications from an application blocklist, and obtaining the application blocklist. The application blocklist contains the applications that are forbidden to run. Only the enterprise device administrator applications can call the APIs provided by this module.
The **applicationManager** module provides application management capabilities, including adding, removing, and obtaining the applications that are forbidden to run. Only the enterprise device administrator applications can call the APIs provided by this module.
> **NOTE**
>
......@@ -17,7 +17,7 @@ import applicationManager from '@ohos.enterprise.applicationManager';
addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Adds applications to the application blocklist using the specified device administrator application. This API uses an asynchronous callback to return the result. The applications added to the blocklist cannot run under the administrator user.
Adds a list of applications that are forbidden to run by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -63,7 +63,7 @@ applicationManager.addDisallowedRunningBundles(wantTemp, appIds, (error) => {
addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Adds applications to the application list for a user using the specified device administrator application. This API uses an asynchronous callback to return the result. The applications added to the blocklist cannot run under the user specified by **userId**.
Adds a list of applications that are forbidden to run by a given user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -109,7 +109,7 @@ applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100, (error) =>
addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Adds applications to the application blocklist using the specified device administrator application. This API uses a promise to return the result. If **userId** is passed in when this API is called, the added applications cannot run under the specified user. If **userId** is not passed in, the added applications cannot run under the current user.
Adds a list of applications that are forbiddedn to run by the specified user (if **userId** is passed in) or current user (if **userId** is not passed in) through the specified device administrator application.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -160,7 +160,7 @@ applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100).then(() =>
removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Removes applications from the application blocklist using the specified device administrator application. This API uses an asynchronous callback to return the result. If an application blocklist exists, the applications in the blocklist cannot run under the current user.
Removes a list of applications that are forbiddedn to run by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -205,7 +205,7 @@ applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, (error) => {
removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Removes applications from the application blocklist of a user using the specified device administrator application. This API uses an asynchronous callback to return the result. If an application blocklist exists, the applications in the blocklist cannot run under the user specified by **userId**.
Removes a list of applications that are forbiddedn to run by the specified user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -251,7 +251,7 @@ applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100, (error)
removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Removes applications from the application blocklist using the specified device administrator application. This API uses a promise to return the result. If **userId** is passed in when this API is called to remove applications from the blocklist, the applications in the blocklist cannot run under the specified user. If **userId** is not passed in, the applications in the blocklist cannot run under the current user.
Removes a list of applications that are forbiddedn to run by the specified user (if **userId** is passed in) or current user (if **userId** is not passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -302,7 +302,7 @@ applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100).then(()
getDisallowedRunningBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the application blocklist of the administrator user using the specified device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of applications that are firbidded to run by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -345,7 +345,7 @@ applicationManager.getDisallowedRunningBundles(wantTemp, (error) => {
getDisallowedRunningBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the application blocklist of a user using the specified device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of applications that are firbidded to run by the specified user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -389,7 +389,7 @@ applicationManager.getDisallowedRunningBundles(wantTemp, 100, (error) => {
getDisallowedRunningBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;;
Obtains the application blocklist using the specified device administrator application. This API uses a promise to return the result. If **userId** is passed in when this API is called, the device administrator application obtains the application blocklist of the specified user. If **userId** is not passed in, the device administrator application obtains the application blocklist of the current user.
Obtains the list of applications that are firbidded to run by the specified user (if **userId** is passed in) or current user (if **userId** is not passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -408,7 +408,7 @@ Obtains the application blocklist using the specified device administrator appli
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the application blocklist of the administrator user.|
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the application blocklist of the current user.|
**Error codes**
......
......@@ -4,8 +4,8 @@ The **bundleManager** module provides APIs for bundle management, including addi
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -17,7 +17,7 @@ import bundleManager from '@ohos.enterprise.bundleManager';
addAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Adds a list of bundles that are allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -29,9 +29,9 @@ Adds a list of bundles that are allowed to be installed by the current administr
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the allowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -42,7 +42,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -62,7 +62,7 @@ bundleManager.addAllowedInstallBundles(wantTemp, appIds, (error) => {
addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Adds a list of bundles that are allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -74,10 +74,10 @@ Adds a list of bundles that are allowed to be installed by the given user (speci
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the allowed bundle list. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -88,7 +88,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -108,7 +108,7 @@ bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Adds a list of bundles that are allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Adds a list of bundles that are allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -120,9 +120,9 @@ Adds a list of bundles that are allowed to be installed by the current administr
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the allowed bundle list. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
......@@ -139,7 +139,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -159,7 +159,7 @@ bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are allowed to be installed by the current administrator for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
Removes a list of bundles that are allowed to be installed by the current user through the specified device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -171,9 +171,9 @@ Removes a list of bundles that are allowed to be installed by the current admini
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the allowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -184,7 +184,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -204,7 +204,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, (error) => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
Removes a list of bundles that are allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -216,10 +216,10 @@ Removes a list of bundles that are allowed to be installed by the given user (sp
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the allowed bundle list. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -230,7 +230,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -250,7 +250,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Removes a list of bundles that are allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses a promise to return the result.
Removes a list of bundles that are allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. The bundles removed from the list can no longer be installed. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -262,9 +262,9 @@ Removes a list of bundles that are allowed to be installed by the current admini
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed from the allowed bundle list. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed. |
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
......@@ -281,7 +281,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -301,7 +301,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
getAllowedInstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of bundles that are allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -313,8 +313,8 @@ Obtains the list of bundles that are allowed to be installed by the current admi
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
......@@ -325,7 +325,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -344,7 +344,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, (error) => {
getAllowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of bundles that are allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -356,9 +356,9 @@ Obtains the list of bundles that are allowed to be installed by the given user (
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
......@@ -369,7 +369,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -388,7 +388,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100, (error) => {
getAllowedInstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;;
Obtains the list of bundles that are allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Obtains the list of bundles that are allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -400,14 +400,14 @@ Obtains the list of bundles that are allowed to be installed by the current admi
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the allowed bundle list.|
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the list of the bundles obtained.|
**Error codes**
......@@ -418,7 +418,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -436,7 +436,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100).then(() => {
addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are not allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Adds a list of bundles that are not allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -448,9 +448,9 @@ Adds a list of bundles that are not allowed to be installed by the current admin
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the disallowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -461,7 +461,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -481,7 +481,7 @@ bundleManager.addDisallowedInstallBundles(wantTemp, appIds, (error) => {
addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are not allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Adds a list of bundles that are not allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -493,10 +493,10 @@ Adds a list of bundles that are not allowed to be installed by the given user (s
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the disallowed bundle list. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -507,7 +507,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -527,7 +527,7 @@ bundleManager.addDisallowedInstallBundles(wantTemp, appIds, 100, (error) => {
addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Adds a list of bundles that are not allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Adds a list of bundles that are not allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -539,9 +539,9 @@ Adds a list of bundles that are not allowed to be installed by the current admin
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the disallowed bundle list. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
......@@ -558,7 +558,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -578,7 +578,7 @@ bundleManager.addDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are not allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Removes a list of bundles that are not allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -590,9 +590,9 @@ Removes a list of bundles that are not allowed to be installed by the current ad
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the disallowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -603,7 +603,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -623,7 +623,7 @@ bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, (error) => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are not allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Removes a list of bundles that are not allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -635,10 +635,10 @@ Removes a list of bundles that are not allowed to be installed by the given user
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the disallowed bundle list. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -649,7 +649,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -669,7 +669,7 @@ bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100, (error) => {
removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Removes a list of bundles that are not allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Removes a list of bundles that are not allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -681,9 +681,9 @@ Removes a list of bundles that are not allowed to be installed by the current ad
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed from the disallowed bundle list. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed. |
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
......@@ -700,7 +700,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -720,7 +720,7 @@ bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
getDisallowedInstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are not allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of bundles that are not allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -732,8 +732,8 @@ Obtains the list of bundles that are not allowed to be installed by the current
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
......@@ -744,7 +744,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -763,7 +763,7 @@ bundleManager.getDisallowedInstallBundles(wantTemp, (error) => {
getDisallowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are not allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of bundles that are not allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -775,9 +775,9 @@ Obtains the list of bundles that are not allowed to be installed by the given us
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
......@@ -788,7 +788,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -807,7 +807,7 @@ bundleManager.getDisallowedInstallBundles(wantTemp, 100, (error) => {
getDisallowedInstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;;
Obtains the list of bundles that are not allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Obtains the list of bundles that are not allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -819,14 +819,14 @@ Obtains the list of bundles that are not allowed to be installed by the current
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the allowed bundle list.|
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the list of the bundles obtained.|
**Error codes**
......@@ -837,9 +837,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
......@@ -849,3 +848,427 @@ bundleManager.getDisallowedInstallBundles(wantTemp, 100).then(() => {
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
## bundleManager.addDisallowedUninstallBundles
addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void
Adds a list of bundles that are not allowed to be uninstalled by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.addDisallowedUninstallBundles
addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void
Adds a list of bundles that are not allowed to be uninstalled by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.addDisallowedUninstallBundles
addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;
Adds a list of bundles that are not allowed to be uninstalled by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. If the operation fails, an error object is thrown. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## bundleManager.removeDisallowedUninstallBundles
removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void
Removes a list of bundles that are not allowed to be uninstalled by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.removeDisallowedUninstallBundles
removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void
Removes a list of bundles that are not allowed to be uninstalled by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.removeDisallowedUninstallBundles
removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;
Removes a list of bundles that are not allowed to be uninstalled by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed. |
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. If the operation fails, an error object is thrown. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## bundleManager.getDisallowedUninstallBundles
getDisallowedUninstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
Obtains the list of bundles that are not allowed to be uninstalled by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedUninstallBundles(wantTemp, (error, data) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success: " + data);
}
});
```
## bundleManager.getDisallowedUninstallBundles
getDisallowedUninstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
Obtains the list of bundles that are not allowed to be uninstalled by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedUninstallBundles(wantTemp, 100, (error, data) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success: " + data);
}
});
```
## bundleManager.getDisallowedUninstallBundles
getDisallowedUninstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;
Obtains the list of bundles that are not allowed to be uninstalled by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the bundle list obtained.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedUninstallBundles(wantTemp, 100).then((data) => {
console.log("success: " + data);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
......@@ -4,7 +4,8 @@ The **dateTimeManager** module provides APIs for system time management. Only th
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -16,7 +17,7 @@ import dateTimeManager from '@ohos.enterprise.dateTimeManager'
setDateTime(admin: Want, time: number, callback: AsyncCallback\<void>): void
Configures a device administrator application to set the system time. This API uses an asynchronous callback to return the result.
Sets the system time through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -29,8 +30,8 @@ Configures a device administrator application to set the system time. This API u
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| time | number | Yes| Timestamp (ms).|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| time | number | Yes| Timestamp to set, in ms.|
| callback | AsyncCallback\<void> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -59,7 +60,7 @@ dateTimeManager.setDateTime(wantTemp, 1526003846000, (error) => {
setDateTime(admin: Want, time: number): Promise\<void>
Configures a device administrator application to set the system time. This API uses a promise to return the result.
Sets the system time through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -72,7 +73,7 @@ Configures a device administrator application to set the system time. This API u
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| time | number | Yes| Timestamp (ms).|
| time | number | Yes| Timestamp to set, in ms.|
**Return value**
......@@ -106,7 +107,7 @@ dateTimeManager.setDateTime(wantTemp, 1526003846000).then(() => {
disallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback\<void>): void
Configures a device administrator application to disable modification of the system time. This API uses an asynchronous callback to return the result.
Disallows modification of the system time through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -120,7 +121,7 @@ Configures a device administrator application to disable modification of the sys
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| disallow | boolean | Yes| Whether to disable modification of the system time. The value **true** means to disable modification of the system time, and **false** means the opposite.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| callback | AsyncCallback\<void> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -149,7 +150,7 @@ dateTimeManager.disallowModifyDateTime(wantTemp, true, (error) => {
disallowModifyDateTime(admin: Want, disallow: boolean): Promise\<void>
Configures a device administrator application to disable modification of the system time. This API uses a promise to return the result.
Disallows modification of the system time through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -168,7 +169,7 @@ Configures a device administrator application to disable modification of the sys
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<void> | that returns no value. If the operation fails, an error object is thrown.|
| Promise\<void> | Promise that returns no value. An error object is thrown if the operation fails.|
**Error codes**
......@@ -196,7 +197,7 @@ dateTimeManager.disallowModifyDateTime(wantTemp, true).then(() => {
isModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback\<boolean>): void
Configures a device administrator application to check whether modification of the system time is disabled. This API uses an asynchronous callback to return the result.
Checks whether the modification of the system time is disallowed through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -209,7 +210,7 @@ Configures a device administrator application to check whether modification of t
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| callback | AsyncCallback\<boolean> | Yes| Callback used to return the result. The value **true** means that modification of the system time is disabled, and **false** means the opposite.|
| callback | AsyncCallback\<boolean> | Yes| Callback invoked to return the result. The value **true** means that modification of the system time is disallowed, and **false** means the opposite.|
**Error codes**
......@@ -238,7 +239,7 @@ dateTimeManager.isModifyDateTimeDisallowed(wantTemp, (error) => {
isModifyDateTimeDisallowed(admin: Want): Promise\<boolean>
Configures a device administrator application to check whether modification of the system time is disabled. This API uses a promise to return the result.
Checks whether the modification of the system time is disallowed through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -256,7 +257,7 @@ Configures a device administrator application to check whether modification of t
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<boolean> | Promise used to return the result. The value **true** means that modification of the system time is disabled, and **false** means the opposite.|
| Promise\<boolean> | Promise used to return the result. The value **true** means that modification of the system time is disallowed, and **false** means the opposite.|
**Error codes**
......@@ -274,7 +275,7 @@ let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.disallowModifyDateTime(wantTemp).then(() => {
dateTimeManager.isModifyDateTimeDisallowed(wantTemp).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
})
......
# @ohos.enterprise.deviceControl (Device Control Management)
# @ohos.enterprise.deviceControl (Device Control)
The **deviceControl** module provides APIs for device control, which can only be called by device administrator applications.
The **deviceControl** module provides APIs for device control, which can be called only by device administrator applications.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -18,6 +19,7 @@ resetFactory(admin: Want, callback: AsyncCallback\<void>): void
Restores factory settings. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESET_DEVICE
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -28,8 +30,8 @@ Restores factory settings. This API uses an asynchronous callback to return the
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the setting is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application used to restore the factory settings.|
| callback | AsyncCallback\<void> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -40,7 +42,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -70,13 +72,13 @@ Restores factory settings. This API uses a promise to return the result.
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application used to restore the factory settings.|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<void> | Promise that returns no value.|
| Promise\<void> | Promise that returns no value. If the operation fails, an error object is thrown.|
**Error codes**
......@@ -87,7 +89,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......
# @ohos.enterprise.deviceInfo (Device Information Management)
The **deviceInfo** module provides APIs for enterprise device information management, including the API for obtaining device serial numbers. These APIs can only be called by device administrator applications.
The **deviceInfo** module provides APIs for enterprise device information management, including the API for obtaining device serial numbers. Only the enterprise device administrator applications can call the APIs provided by this module.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -16,7 +17,7 @@ import deviceInfo from '@ohos.enterprise.deviceInfo';
getDeviceSerial(admin: Want, callback: AsyncCallback&lt;string&gt;): void
Configures a device administrator application to obtain the device serial number. This API uses an asynchronous callback to return the result.
Obtains the device serial number through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -29,7 +30,7 @@ Configures a device administrator application to obtain the device serial number
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.<br> If the operation is successful, **err** is **null** and **data** is the device serial number obtained. If the operation fails, **err** is an error object. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the device serial number obtained. If the operation fails, **err** is an error object. |
**Error codes**
......@@ -60,7 +61,7 @@ deviceInfo.getDeviceSerial(wantTemp, (error, result) => {
getDeviceSerial(admin: Want): Promise&lt;string&gt;
Configures a device administrator application to obtain the device serial number. This API uses a promise to return the result.
Obtains the device serial number through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -107,7 +108,7 @@ deviceInfo.getDeviceSerial(wantTemp).then((result) => {
getDisplayVersion(admin: Want, callback: AsyncCallback&lt;string&gt;): void;
Configures a device administrator application to obtain the device version number. This API uses an asynchronous callback to return the result.
Obtains the device version number through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -120,7 +121,7 @@ Configures a device administrator application to obtain the device version numbe
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.<br> If the operation is successful, **err** is **null** and **data** is the device version number obtained. If the operation fails, **err** is an error object. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the device version number obtained. If the operation fails, **err** is an error object. |
**Error codes**
......@@ -151,7 +152,7 @@ deviceInfo.getDisplayVersion(wantTemp, (error, result) => {
getDisplayVersion(admin: Want): Promise&lt;string&gt;
Configures a device administrator application to obtain the device version number. This API uses a promise to return the result.
Obtains the device version number through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -198,7 +199,7 @@ deviceInfo.getDisplayVersion(wantTemp).then((result) => {
getDeviceName(admin: Want, callback: AsyncCallback&lt;string&gt;): void
Configures a device administrator application to obtain the device name. This API uses an asynchronous callback to return the result.
Obtains the device name through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -211,7 +212,7 @@ Configures a device administrator application to obtain the device name. This AP
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.<br> If the operation is successful, **err** is **null** and **data** is the device name obtained. If the operation fails, **err** is an error object. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the device name obtained. If the operation fails, **err** is an error object. |
**Error codes**
......@@ -242,7 +243,7 @@ deviceInfo.getDeviceName(wantTemp, (error, result) => {
getDeviceName(admin: Want): Promise&lt;string&gt;
Configures a device administrator application to obtain the device name. This API uses a promise to return the result.
Obtains the device name through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......
......@@ -4,7 +4,8 @@ The **networkManager** module provides APIs for network management of enterprise
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -16,9 +17,9 @@ import networkManager from '@ohos.enterprise.networkManager';
getAllNetworkInterfaces(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
Obtains all active network interfaces through a device administrator application. This API uses an asynchronous callback to return the result.
Obtains all active network interfaces through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -47,7 +48,7 @@ let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.getAllNetworkInterfaces(admin, (error, result) => {
networkManager.getAllNetworkInterfaces(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
......@@ -60,7 +61,7 @@ networkManager.getAllNetworkInterfaces(admin, (error, result) => {
getAllNetworkInterfaces(admin: Want): Promise&lt;Array&lt;string&gt;&gt;
Obtains all active network interfaces through a device administrator application. This API uses a promise to return the result.
Obtains all active network interfaces through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
......@@ -107,9 +108,9 @@ networkManager.getAllNetworkInterfaces(wantTemp).then((result) => {
getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the device IP address based on the given network interface through a device administrator application. This API uses an asynchronous callback to return the result.
Obtains the device IP address based on the given network interface through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -152,7 +153,7 @@ networkManager.getIpAddress(wantTemp, "eth0", (error, result) => {
getIpAddress(admin: Want, networkInterface: string): Promise&lt;string&gt;
Obtains the device IP address based on the given network interface through a device administrator application. This API uses a promise to return the result.
Obtains the device IP address based on the given network interface through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
......@@ -200,7 +201,7 @@ networkManager.getIpAddress(wantTemp, "eth0").then((result) => {
getMac(admin: Want, networkInterface: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the device MAC address based on the given network interface through a device administrator application. This API uses an asynchronous callback to return the result.
Obtains the device MAC address based on the given network interface through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
......@@ -245,7 +246,7 @@ networkManager.getMac(wantTemp, "eth0", (error, result) => {
getIpAddress(admin: Want, networkInterface: string): Promise&lt;string&gt;
Obtain the device MAC address based on the given network interface through a device administrator application. This API uses a promise to return the result.
Obtain the device MAC address based on the given network interface through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
......@@ -288,3 +289,191 @@ networkManager.getMac(wantTemp, "eth0").then((result) => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## networkManager.isNetworkInterfaceDisabled
isNetworkInterfaceDisabled(admin: Want, networkInterface: string, callback: AsyncCallback&lt;boolean&gt;): void
Checks whether a network interface is disabled through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that obtains the information. |
| networkInterface | string | Yes | Network interface. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**, and **data** indicates whether the network interface is disabled. The value **true** means the network interface is disabled; and **false** means the opposite. If the operation fails, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device.|
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.isNetworkInterfaceDisabled(wantTemp, "eth0", (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("result:" + result);
});
```
## networkManager.isNetworkInterfaceDisabled
isNetworkInterfaceDisabled(admin: Want, networkInterface: string): Promise&lt;boolean&gt;
Checks whether a network interface is disabled through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that obtains the information.|
| networkInterface | string | Yes | Network interface. |
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the network interface is disabled, and the value **false** means the opposite. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device.|
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.isNetworkInterfaceDisabled(wantTemp, "eth0").then((result) => {
console.log("result:" + result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## networkManager.setNetworkInterfaceDisabled
setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean, callback: AsyncCallback&lt;void&gt;): void
Sets a network interface through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_NETWORK
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that obtains the information. |
| networkInterface | string | Yes | Network interface. |
| isDisabled | boolean | Yes | Network interface status to set. The value **true** means to disable the network interface, and **false** means to enable the network interface. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device.|
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.setNetworkInterfaceDisabled(wantTemp, "eth0", true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("setNetworkInterfaceDisabled success!");
});
```
## networkManager.setNetworkInterfaceDisabled
setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean): Promise&lt;void&gt;
Sets a network interface through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_NETWORK
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that obtains the information.|
| networkInterface | string | Yes | Network interface. |
| isDisabled | boolean | Yes | Network interface status to set. The value **true** means to disable the network interface, and **false** means to enable the network interface. |
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. An error object is thrown if the network interface fails to be disabled. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device.|
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.setNetworkInterfaceDisabled(wantTemp, "eth0", true).then(() => {
console.log("setNetworkInterfaceDisabled success!");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
......@@ -4,7 +4,8 @@ The **wifiManager** module provides APIs for Wi-Fi management of enterprise devi
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -16,7 +17,7 @@ import wifiManager from '@ohos.enterprise.wifiManager';
isWifiActive(admin: Want, callback: AsyncCallback&lt;boolean&gt;): void
Checks whether Wi-Fi is active through a device administrator application. This API uses an asynchronous callback to return the result.
Checks whether Wi-Fi is active through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
......@@ -52,7 +53,7 @@ wifiManager.isWifiActive(wantTemp, (error, result) => {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
console.log("result:" + result);
});
```
......@@ -60,7 +61,7 @@ wifiManager.isWifiActive(wantTemp, (error, result) => {
isWifiActive(admin: Want): Promise&lt;boolean&gt;
Checks whether Wi-Fi is active through a device administrator application. This API uses a promise to return the result.
Checks whether Wi-Fi is active through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
......@@ -97,7 +98,7 @@ let wantTemp = {
abilityName: "EntryAbility",
};
wifiManager.isWifiActive(wantTemp).then((result) => {
console.log(result);
console.log("result:" + result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
......@@ -139,7 +140,7 @@ let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let profile : WifiProfile = {
let profile : wifiManager.WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
......@@ -194,12 +195,12 @@ let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let profile : WifiProfile = {
let profile : wifiManager.WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.isWifiActive(wantTemp, profile).then(() => {
wifiManager.setWifiProfile(wantTemp, profile).then(() => {
console.log("set wifi success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
......
# @ohos.font (Custom Font Registration)
The **font** module provides APIs for registering custom fonts.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import font from '@ohos.font'
```
## font.registerFont
registerFont(options: FontOptions): void
Registers a custom font with the font manager.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | --------------------------- | ---- | ----------- |
| options | [FontOptions](#fontoptions) | Yes | Information about the custom font to register.|
## FontOptions
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| familyName | string | Yes | Name of the custom font to register. |
| familySrc | string | Yes | Path of the custom font to register.|
## Example
```ts
// xxx.ets
import font from '@ohos.font';
@Entry
@Component
struct FontExample {
@State message: string =' Hello, World'
aboutToAppear() {
font.registerFont({
familyName: 'medium',
familySrc: '/font/medium.ttf'
})
}
build() {
Column() {
Text(this.message)
.align(Alignment.Center)
.fontSize(20)
.fontFamily('medium') // medium: name of the custom font to register.
.height('100%')
}.width('100%')
}
}
```
......@@ -128,7 +128,7 @@ Obtains the time elapsed since the Unix epoch. This API uses an asynchronous cal
| Name | Type | Mandatory| Description |
| -------- | ----------- | ---- | ---------------------------------- |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the time elapsed since the Unix epoch. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the time elapsed since the Unix epoch, in milliseconds. |
**Example**
......
......@@ -191,7 +191,7 @@ Obtains the time elapsed since the Unix epoch. This API uses a promise to return
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------- |
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds.<br>- **false**: in milliseconds.|
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds.<br>- **false**: in milliseconds.<br/>Default value: **false** |
**Return value**
......@@ -310,7 +310,7 @@ Obtains the time elapsed since system startup, excluding the deep sleep time. Th
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ----------------------------------- |
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds.<br>- **false**: in milliseconds.|
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds.<br>- **false**: in milliseconds.<br/>Default value: **false** |
**Return value**
......@@ -429,7 +429,7 @@ Obtains the time elapsed since system startup, including the deep sleep time. Th
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------- |
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds.<br>- **false**: in milliseconds.|
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds.<br>- **false**: in milliseconds.<br/>Default value: **false** |
**Return value**
......
......@@ -139,7 +139,7 @@ This version has the following updates to OpenHarmony 3.2 Beta4.
From this version on, only the public SDK is released. You can obtain the public SDK from the mirror or download it from DevEco Studio for your application development.
To use the full SDK that contains system APIs, you must download the full code, compile and build an SDK file, and switch to the full SDK on DevEco Studio. For details about how to compile the full SDK using the source code, see [Full SDK Compilation Guide](../application-dev/quick-start/full-sdk-compile-guide.md).
To use the full SDK that contains system APIs, you must download the full code, compile and build an SDK file, and switch to the full SDK on DevEco Studio. For details about how to compile the full SDK using the source code, see [Full SDK Compilation Guide](../application-dev/faqs/full-sdk-compile-guide.md).
### Feature Updates
......
# Readme
- [Ability Framework](changelogs-ability.md)
- [ArkUI](changelogs-arkui.md)
- [Bundle Manager Subsystem](changelogs-bundlemanager.md)
- [Input Method Framework](changelogs-imf.md)
- [Resource Scheduler Subsystem](changelogs-resourceschedule.md)
- [Theme Framework Subsystem - Screenlock](changelogs-screenlock.md)
- [Telephony Subsystem](changelogs-telephony.md)
- [Util Subsystem](changelogs-util.md)
- [Theme Framework Subsystem - Wallpaper](changelogs-wallpaper.md)
- [Web Subsystem](changelogs-web.md)
# Ability Framework Changelog
## cl.ability.1 AreaMode APIs Changed
Duplicate **AreaMode** APIs are deleted.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.app.ability.common.d.ts | common.AreaMode | | Deleted |
| application/Context.d.ts | AreaMode | | Deleted |
**Adaptation Guide**
Use **AreaMode** in **@ohos.app.ability.contextConstant.d.ts**.
```ts
import contextConstant from '@ohos.app.ability.contextConstant';
let area: contextConstant.AreaMode = contextConstant.AreaMode.EL1;
```
## cl.ability.2 killProcessesBySelf Renamed
The **killProcessesBySelf** API is renamed **killAllProcesses**.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| ------------------------------ | ------------------ | ----------------------------------------------------- | -------- |
| application/ApplicationContext | ApplicationContext | killProcessesBySelf(): Promise\<void\>; | Deleted |
| application/ApplicationContext | ApplicationContext | killProcessesBySelf(callback: AsyncCallback\<void\>); | Deleted |
| application/ApplicationContext | ApplicationContext | killAllProcesses(): Promise\<void\>; | Added |
| application/ApplicationContext | ApplicationContext | killAllProcesses(callback: AsyncCallback\<void\>); | Added |
**Adaptation Guide**
The following code snippet shows how to call **killProcessesBySelf** in an application.
Code before the change:
```ts
let context: common.UIAbilityContext = globalThis.abilityContext;
let appContext = context.getApplicationContext();
appContext.killProcessesBySelf()
```
Code after the change:
```ts
let context: common.UIAbilityContext = globalThis.abilityContext;
let appContext = context.getApplicationContext();
appContext.killAllProcesses()
```
## cl.ability.3 getProcessRunningInformation Renamed
The **getProcessRunningInformation** API is renamed **getRunningProcessInformation**.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| ----------------------------------- | ------------------ | ------------------------------------------------------------ | -------- |
| @ohos.app.ability.appManager.d.ts | appManager | function getProcessRunningInformation(): Promise\<Array\<ProcessRunningInformation\>\>; | Deleted |
| @ohos.app.ability.appManager.d.ts | appManager | function getProcessRunningInformation(callback: AsyncCallback\<Array\<ProcessRunningInformation\>\>): void; | Deleted |
| @ohos.app.ability.appManager.d.ts | appManager | function getRunningProcessInformation(): Promise\<Array\<ProcessInformation\>\>; | Added |
| @ohos.app.ability.appManager.d.ts | appManager | function getRunningProcessInformation(callback: AsyncCallback\<Array\<ProcessInformation\>\>): void; | Added |
| application/ApplicationContext.d.ts | ApplicationContext | getProcessRunningInformation(): Promise\<Array\<ProcessRunningInformation\>\>; | Deleted |
| application/ApplicationContext.d.ts | ApplicationContext | getProcessRunningInformation(callback: AsyncCallback\<Array\<ProcessRunningInformation\>\>): void; | Deleted |
| application/ApplicationContext.d.ts | ApplicationContext | getRunningProcessInformation(): Promise\<Array\<ProcessInformation\>\>; | Added |
| application/ApplicationContext.d.ts | ApplicationContext | getRunningProcessInformation(callback: AsyncCallback\<Array\<ProcessInformation\>\>): void; | Added |
**Adaptation Guide**
The following code snippet shows how to call **getProcessRunningInformation** in an application.
Code before the change:
```ts
let context: common.UIAbilityContext = globalThis.abilityContext;
let appContext = context.getApplicationContext();
appContext.getProcessRunningInformation()
```
Code after the change:
```ts
let context: common.UIAbilityContext = globalThis.abilityContext;
let appContext = context.getApplicationContext();
appContext.getRunningProcessInformation()
```
## cl.ability.4 WantConstant.Flags API Changed
**WantConstant.Flags** has multiple invalid flag definitions. These invalid flags are deleted.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORWARD_RESULT | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_NOT_OHOS_COMPONENT | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORM_ENABLED | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PERSISTABLE_URI_PERMISSION | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PREFIX_URI_PERMISSION | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITYSLICE_MULTI_DEVICE | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_START_FOREGROUND_ABILITY | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION_REVERSIBLE | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_INSTALL_WITH_BACKGROUND_MODE | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CLEAR_MISSION | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_NEW_MISSION | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_MISSION_TOP | Deleted |
## cl.ability.5 WantConstant.Action API Changed
**WantConstant.Action** has multiple invalid action definitions. These invalid actions are deleted.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_APP_ACCOUNT_AUTH | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_DOWNLOAD | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_CROWDTEST | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_SANDBOX | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_BUNDLE_NAME | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_MODULE_NAME | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_ABILITY_NAME | Deleted |
## cl.ability.6 Caller APIs Changed
Caller APIs use the **Parcelable** and **MessageSequence** objects provided by RPC in API version 9 to replace the deprecated **Sequenceable** and **MessageParcel** object.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| api/@ohos.app.ability.UIAbility.d.ts | CalleeCallback | (indata: rpc.MessageParcel): rpc.Sequenceable; | Changed to **(indata: rpc.MessageSequence): rpc.Parcelable;**. |
| api/@ohos.app.ability.UIAbility.d.ts | Caller | call(method: string, data: rpc.Sequenceable): Promise<void>; | Changed to **call(method: string, data: rpc.Parcelable): Promise<void>;**. |
| api/@ohos.app.ability.UIAbility.d.ts | Caller | callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>; | Changed to **callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence>;**. |
**Adaptation Guide**
The following illustrates how to call the caller APIs in your application.
Code before the change:
```ts
class MyMessageAble{
name:""
str:""
num: 1
constructor(name, str) {
this.name = name;
this.str = str;
}
marshalling(messageParcel) {
messageParcel.writeInt(this.num);
messageParcel.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
unmarshalling(messageParcel) {
this.num = messageParcel.readInt();
this.str = messageParcel.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
};
let method = 'call_Function';
function funcCallBack(pdata) {
console.log('Callee funcCallBack is called ' + pdata);
let msg = new MyMessageAble("test", "");
pdata.readSequenceable(msg);
return new MyMessageAble("test1", "Callee test");
}
export default class MainUIAbility extends UIAbility {
onCreate(want, launchParam) {
console.log('Callee onCreate is called');
try {
this.callee.on(method, funcCallBack);
} catch (error) {
console.log('Callee.on catch error, error.code: ' + error.code +
' error.message: ' + error.message);
}
}
}
```
Code after the change:
```ts
class MyMessageAble{
name:""
str:""
num: 1
constructor(name, str) {
this.name = name;
this.str = str;
}
marshalling(messageSequence) {
messageSequence.writeInt(this.num);
messageSequence.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
unmarshalling(messageSequence) {
this.num = messageSequence.readInt();
this.str = messageSequence.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
};
let method = 'call_Function';
function funcCallBack(pdata) {
console.log('Callee funcCallBack is called ' + pdata);
let msg = new MyMessageAble("test", "");
pdata.readParcelable(msg);
return new MyMessageAble("test1", "Callee test");
}
export default class MainUIAbility extends UIAbility {
onCreate(want, launchParam) {
console.log('Callee onCreate is called');
try {
this.callee.on(method, funcCallBack);
} catch (error) {
console.log('Callee.on catch error, error.code: ' + error.code +
' error.message: ' + error.message);
}
}
}
```
## cl.ability.7 WantConstant.Flags API Changed
The **wantConstant** API had two similar enums. Now the two enums are combined into one.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| ----------------------------------- | ---------------------- | ----------------------------------- | -------- |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Parameter | ABILITY_BACK_TO_OTHER_MISSION_STACK | Deleted |
| @ohos.app.ability.wantConstant.d.ts | wantConstant.Params | ABILITY_BACK_TO_OTHER_MISSION_STACK | Added |
**Adaptation Guide**
Use **ABILITY_BACK_TO_OTHER_MISSION_STACK** in **@ohos.app.ability.wantConstant.d.ts**.
```ts
import wantConstant from '@ohos.app.ability.wantConstant';
let backToOtherMissionStack: wantConstant.Params = wantParam.Params.ABILITY_BACK_TO_OTHER_MISSION_STACK;
```
# ArkUI Subsystem Changelog
## cl.arkui.1 Return Value Type Change of getInspectorTree
**Change Impact**
The code that uses the **getInspectorTree** API in versions earlier than OpenHarmony 3.2.10.7 must be adapted.
**Key API/Component Changes**
The return value of the **getInspectorTree** API is changed from the string type to the Object type.
**Adaptation Guide**
Adapt the code that takes the return value of **getInspectorTree** as a string.The sample code is as follows:
- Before change:
```typescript
console.info(getInspectorTree())
```
- After change:
```typescript
console.info(JSON.stringify(getInspectorTree()))
```
## cl.arkui.2 Deprecation the forceRebuild Attribute of \<GridItem>
**Change Impact**
None. The attribute has no effect.
**Key API/Component Changes**
Deprecate the **forceRebuild** attribute of the **\<GridItem>** component.
**Adaptation Guide**
Delete the code that uses the **forceRebuild** attribute. This will not affect the functionality of the **\<GridItem>** component.
## cl.arkui.3 Plugin Module API Changes
### 1. API Change in the **PluginComponentTemplate** Module
Renamed the **ability** parameter **bundleName** to more clearly indicate the intended meaning.
You need to adapt your application.
**Change Impact**
The application developed based on earlier versions must be adapted to the change. Otherwise, build errors will occur.
**Key API/Component Changes**
- Involved APIs:
interface PluginComponentTemplate {
source: string;
bundleName: string;
}
interface PluginComponentInterface {
(value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute;
}
- Before change:
```js
interface PluginComponentTemplate { source: string; ability: string; }
interface PluginComponentInterface {
(value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute;
}
```
- After change:
```js
interface PluginComponentTemplate { source: string; bundleName: string; }
interface PluginComponentInterface {
(value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute;
}
```
**Adaptation Guide**
Use the new API. The sample code is as follows:
- Before change:
```js
PluginComponent({
template: { source: 'plugincomponent1', ability: 'com.example.plugin' },
data: { 'countDownStartValue': 'new countDownStartValue' }
}).size({ width: 500, height: 100 })
```
- After change:
```js
PluginComponent({
template: { source: 'plugincomponent1', bundleName: 'com.example.plugin' },
data: { 'countDownStartValue': 'new countDownStartValue' }
}).size({ width: 500, height: 100 })
```
### 2. API Change in the **pluginComponentManager** Module
Renamed the **want** parameter **target** to more clearly indicate the intended meaning.
You need to adapt your application.
**Change Impact**
The application developed based on earlier versions must be adapted to the change. Otherwise, alarms will arise. Though the build may be successful, the API will not work as intended.
**Key API/Component Changes**
- Involved APIs:
interface PushParameterForStage {
owner: Want;
target: Want;
name: string;
data: KVObject;
extraData: KVObject;
jsonPath?: string;
}
function push(param: PushParameterForStage, callback: AsyncCallback\<void>): void;
interface RequestParameterForStage {
owner: Want;
target: Want;
name: string;
data: KVObject;
jsonPath?: string;
}
function request(param: RequestParameterForStage, callback: AsyncCallback\<RequestCallbackParameters>): void;
- Before change:
```js
interface PushParameterForStage {
owner: Want;
want: Want;
name: string;
data: KVObject;
extraData: KVObject;
jsonPath?: string;
}
function push(param: PushParameterForStage, callback: AsyncCallback<void>): void;
interface RequestParameterForStage {
owner: Want;
want: Want;
name: string;
data: KVObject;
jsonPath?: string;
}
function request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallbackParameters>): void;
```
- After change:
```js
interface PushParameterForStage {
owner: Want;
target: Want;
name: string;
data: KVObject;
extraData: KVObject;
jsonPath?: string;
}
function push(param: PushParameterForStage, callback: AsyncCallback<void>): void;
interface RequestParameterForStage {
owner: Want;
target: Want;
name: string;
data: KVObject;
jsonPath?: string;
}
function request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallbackParameters>): void;
```
**Adaptation Guide**
Use the new API. The sample code is as follows:
- Before change:
```js
import pluginComponentManager from '@ohos.pluginComponent'
pluginComponentManager.push({
owner:{
bundleName:"com.example.provider",
abilityName:"com.example.provider.MainAbility"
},
want: {
bundleName: "com.example.provider",
abilityName: "com.example.provider.MainAbility",
},
name: "ets/pages/plugin2.js",
data: {
"js": "ets/pages/plugin.js",
"key_1": 1111,
},
extraData: {
"extra_str": "this is push event"
},
jsonPath: "",
},
(err, data) => {
console.log("push_callback:err: " ,JSON.stringify(err));
console.log("push_callback:data: " , JSON.stringify(data));
console.log("push_callback: push ok!");
}
)
pluginComponentManager.request({
owner:{
bundleName:"com.example.provider",
abilityName:"com.example.provider.MainAbility"
},
want: {
bundleName: "com.example.provider",
abilityName: "ets/pages/plugin2.js",
},
name: "plugintemplate",
data: {
"key_1": " myapplication plugin component test",
"key_2": 123456
},
jsonPath: "",
},
(err, data) => {
console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability)
console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source)
}
)
```
- After change:
```js
import pluginComponentManager from '@ohos.pluginComponent'
pluginComponentManager.push({
owner:{
bundleName:"com.example.provider",
abilityName:"com.example.provider.MainAbility"
},
target: {
bundleName: "com.example.provider",
abilityName: "com.example.provider.MainAbility",
},
name: "ets/pages/plugin2.js",
data: {
"js": "ets/pages/plugin.js",
"key_1": 1111,
},
extraData: {
"extra_str": "this is push event"
},
jsonPath: "",
},
(err, data) => {
console.log("push_callback:err: " ,JSON.stringify(err));
console.log("push_callback:data: " , JSON.stringify(data));
console.log("push_callback: push ok!");
}
)
pluginComponentManager.request({
owner:{
bundleName:"com.example.provider",
abilityName:"com.example.provider.MainAbility"
},
target: {
bundleName: "com.example.provider",
abilityName: "ets/pages/plugin2.js",
},
name: "plugintemplate",
data: {
"key_1": " myapplication plugin component test",
"key_2": 123456
},
jsonPath: "",
},
(err, data) => {
console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability)
console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source)
}
)
```
# Bundle Manager Subsystem Changelog
## cl.bundlemanager.1 Deleted getAbilityIcon
The **getAbilityIcon** API in [@ohos.bundle.bundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleManager.d.ts) is deleted. The **getMediaContent** API in [@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts) can be used instead.
**Change Impact**<br>
The **getAbilityIcon** API does not take effect.
**Key API/Component Changes**<br>
The **getAbilityIcon** API is deleted from **@ohos.bundle.bundleManager.d.ts**.
**Adaptation Guide**<br>
If your application uses **getAbilityIcon** in **@ohos.bundle.bundleManager.d.ts**, replace it with **getMediaContent** in **@ohos.resourceManager.d.ts**. You need to obtain the icon ID in advance. For details, see [Usage Guide](../../../application-dev/reference/apis/js-apis-resource-manager.md#getmediacontent9).
## cl.bundlemanager.2 Bottom-Layer Capability Changed So That Only the System Resource HAP Supports Custom Permissions
Only the system resource HAP supports custom permissions. During HAP parsing, the bundle manager module parses the **definePermissions** field only in the configuration file of the resource HAP (bundle name: **ohos.global.systemres**), but not this field in other HAPs. This field is used to define permissions.
If an application requires custom permissions, add the permissions under the **definePermissions** field in the [configuration file](https://gitee.com/openharmony/utils_system_resources/blob/master/systemres/main/config.json) of the system resource HAP. For details about the permission format, see [Defining Permissions](../../../application-dev/quick-start/module-structure.md#internal-structure-of-the-definepermissions-attribute).
**Change Impact**<br>
After an upgrade to the new version image, the custom permission of the application does not take effect, and the authorization fails.
**Key API/Component Changes**<br>
The bottom-layer capability of the bundle manager module is changed. Only the system resource HAP supports custom permissions.
**Adaptation Guide**<br>
If an application requires custom permissions, add the permissions under the **definePermissions** field in the [configuration file](https://gitee.com/openharmony/utils_system_resources/blob/master/systemres/main/config.json) of the system resource HAP. For details about the permission format, see [Defining Permissions](../../../application-dev/quick-start/module-structure.md#internal-structure-of-the-definepermissions-attribute).
## cl.bundlemanager.3 Level-2 Module File Names Changed
The level-2 module file names of the bundle manager module are changed to their respective API names in the file, as listed below.
| Original File Name|New File Name|
|----|----|
| bundleManager/abilityInfo.d.ts | bundleManager/AbilityInfo.d.ts |
| bundleManager/applicationInfo.d.ts | bundleManager/ApplicationInfo.d.ts |
| bundleManager/bundleInfo.d.ts | bundleManager/BundleInfo.d.ts |
| bundleManager/dispatchInfo.d.ts | bundleManager/DispatchInfo.d.ts |
| bundleManager/elementName.d.ts | bundleManager/ElementName.d.ts |
| bundleManager/extensionAbilityInfo.d.ts | bundleManager/ExtensionAbilityInfo.d.ts |
| bundleManager/hapModuleInfo.d.ts | bundleManager/HapModuleInfo.d.ts |
| bundleManager/launcherAbilityInfo.d.ts | bundleManager/LauncherAbilityInfo.d.ts |
| bundleManager/metadata.d.ts | bundleManager/Metadata.d.ts |
| bundleManager/packInfo.d.ts | bundleManager/BundlePackInfo.d.ts |
| bundleManager/permissionDef.d.ts | bundleManager/PermissionDef.d.ts |
| bundleManager/remoteAbilityInfo.d.ts | bundleManager/RemoteAbilityInfo.d.ts |
| bundleManager/shortcutInfo.d.ts | bundleManager/ShortcutInfo.d.ts |
To sum up, except **packInfo**, which is changed to **BundlePackInfo**, the other file names are changed to start with uppercase letters.
**Change Impact**<br>
The change of the level-2 module file names does not affect the use of the level-1 module. If a level-2 module interface under **bundleManager** is directly imported to the .ts file and an error is reported during compilation on DevEco Studio, you must change the name of the imported file.
**Key API/Component Changes**<br>
The .d.ts file names in the **bundleManager** folder are changed to their respective API names in the file.
**Adaptation Guide**<br>
Generally, no adaptation is required. If a file in the **bundleManager** folder is directly imported to the application, you must change the imported file name as follows:
**Before change:**
```ts
import {AbilityInfo} from 'bundleManger/abilityInfo';
import {ExtensionAbilityInfo} from 'bundleManger/extensionAbilityInfo';
import {BundlePackInfo} from 'bundleManger/packInfo';
```
**After change:**
```ts
import {AbilityInfo} from 'bundleManger/AbilityInfo';
import {ExtensionAbilityInfo} from 'bundleManger/ExtensionAbilityInfo';
import {BundlePackInfo} from 'bundleManger/BundlePackInfo';
```
## cl.bundlemanager.4 LaunchType Enum Type Name Changed from STANDARD to MULTITON
The enum type name of [LaunchType](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleManager.d.ts) is changed from **STANDARD** to **MULTITON**. The enum value remains unchanged, indicating the multi-instance type.
**Change Impact**<br>
The **LaunchType.STANDARD** type does not take effect.
**Key API/Component Changes**<br>
The enum type name of **LaunchType** is changed from **STANDARD** to **MULTITON**.
**Adaptation Guide**<br>
Change **LaunchType.STANDARD** to **LaunchType.MULTITON** for your application.
## cl.bundlemanager.5 Changed the isVisible Field in the AbilityInfo Struct to exported
The **isVisible** field in the [AbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts) struct is changed to **exported**. The type remains unchanged, indicating whether the ability can be exported and used by other abilities.
**Change Impact**<br>
The **isVisible** field does not take effect.
**Key API/Component Changes**<br>
The **isVisible** field in the [AbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts) struct is changed to **exported**, and the type remains unchanged.
**Adaptation Guide**<br>
Change **isVisible** to **exported** for your application.
## cl.bundlemanager.6 Changed the isVisible Field in the ExtensionAbilityInfo Struct to exported
The **isVisible** field in the [ExtensionAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts) struct is changed to **exported**. The type remains unchanged, indicating whether the ability can be exported and used by other abilities.
**Change Impact**<br>
The **isVisible** field does not take effect.
**Key API/Component Changes**<br>
The **isVisible** field in the [ExtensionAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts) struct is changed to **exported**, and the type remains unchanged.
**Adaptation Guide**<br>
Change **isVisible** to **exported** for your application.
## cl.bundlemanager.7 Changed the visible Field in the ModuleAbilityInfo Struct to exported
The **visible** field in the [ModuleAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundlePackInfo.d.ts) struct is changed to **exported**. The type remains unchanged, indicating whether the ability can be exported and used by other abilities.
**Change Impact**<br>
The **visible** field does not take effect.
**Key API/Component Changes**<br>
The **visible** field in the [ModuleAbilityInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundlePackInfo.d.ts) struct is changed to **exported**, and the type remains unchanged.
**Adaptation Guide**<br>
Change **visible** to **exported** for your application.
## cl.bundlemanager.8 Deleted the distributedNotificationEnabled Tag from the app.json Configuration File
The [distributedNotificationEnabled](../../../application-dev/quick-start/app-configuration-file.md) tag is deleted from the **app.json** configuration file.
**Change Impact**<br>
If this tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Delete this tag from the configuration file.
## cl.bundlemanager.9 Deleted the entityType Tag from the app.json Configuration File
The [entityType](../../../application-dev/quick-start/app-configuration-file.md) tag is deleted from the **app.json** configuration file.
**Change Impact**<br>
If this tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Delete this tag from the configuration file.
## cl.bundlemanager.10 Deleted the keepAlive Tag from the app.json Configuration File
The [keepAlive](../../../application-dev/quick-start/app-configuration-file.md) tag is deleted from the **app.json** configuration file.
**Change Impact**<br>
If this tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Delete this tag from the configuration file.
## cl.bundlemanager.11 Deleted the removable Tag from the app.json Configuration File
The [removable](../../../application-dev/quick-start/app-configuration-file.md) tag is deleted from the **app.json** configuration file.
**Change Impact**<br>
If this tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Delete this tag from the configuration file.
## cl.bundlemanager.12 Deleted the singleton Tag from the app.json Configuration File
The [singleton](../../../application-dev/quick-start/app-configuration-file.md) tag is deleted from the **app.json** configuration file.
**Change Impact**<br>
If this tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Delete this tag from the configuration file.
## cl.bundlemanager.13 Deleted the userDataClearable Tag from the app.json Configuration File
The [userDataClearable](../../../application-dev/quick-start/app-configuration-file.md) tag is deleted from the **app.json** configuration file.
**Change Impact**<br>
If this tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Delete this tag from the configuration file.
## cl.bundlemanager.14 No Longer Chinese Characters for the name Tag under module in the module.json Configuration File
The value of [name](../../../application-dev/quick-start/module-configuration-file.md) under **module** in the **module.json** configuration file does not support Chinese characters.
**Change Impact**<br>
If the tag is set to Chinese, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Set this tag to English.
## cl.bundlemanager.15 No Longer Chinese Characters for the name Tag under ability in the module.json Configuration File
The value of [name](../../../application-dev/quick-start/module-configuration-file.md) under **ability** in the **module.json** configuration file does not support Chinese characters.
**Change Impact**<br>
If the tag is set to Chinese, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Set this tag to English.
## cl.bundlemanager.16 Deleted the uiSyntax Tag from the module.json Configuration File
The [uiSyntax](../../../application-dev/quick-start/module-configuration-file.md) tag is deleted from the **module.json** configuration file.
**Change Impact**<br>
If this tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Delete this tag from the configuration file.
## cl.bundlemanager.17 Changed srcEntrance to srcEntry in the module.json Configuration File
The [srcEntrance](../../../application-dev/quick-start/module-configuration-file.md) tag under **module** and **ability** in the **module.json** configuration file is changed to **srcEntry**.
**Change Impact**<br>
If the **srcEntrance** tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Replace the **srcEntrance** tag with **srcEntry** in the configuration file.
## cl.bundlemanager.18 Deleted the apiVersion Tag Under distroFilter from the module.json Configuration File
The **apiVersion** tag under [distroFilter](../../../application-dev/quick-start/module-configuration-file.md) is deleted from the **module.json** configuration file.
**Change Impact**<br>
If this tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Delete this tag from the configuration file.
## cl.bundlemanager.19 Changed distroFilter to distributionFilter in the module.json Configuration File
The [distroFilter](../../../application-dev/quick-start/module-configuration-file.md) tag in the **module.json** configuration file is changed to **distributionFilter**.
**Change Impact**<br>
If the **distroFilter** tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Replace **distroFilter** with **distributionFilter** in the configuration file.
## cl.bundlemanager.20 Changed standard of launchType to multiton in the module.json Configuration File
The **standard** mode of the [launchType](../../../application-dev/quick-start/module-configuration-file.md) tag in the **module.json** file is changed to **multiton**.
**Adaptation Guide**<br>
Replace **standard** of **launchType** to **multiton** in the configuration file.
## cl.bundlemanager.21 Deleted the atomicService Tag from the app.json File
The **atomicService** tag is deleted from the **app.json** file.
**Change Impact**<br>
If this tag is used, an error is reported during compilation on DevEco Studio.
**Adaptation Guide**<br>
Delete the **atomicService** tag from your code.
## cl.bundlemanager.22 Added the bundleType Tag to the app.json File
The **bundleType** tag is added to the **app.json** file.
**Change Impact**<br>
For an existing ability with [installationFree](../../../application-dev/quick-start/module-configuration-file.md) set to **true**, **bundleType** must be set to **atomicService** in the **app.json** file. Otherwise, the packaging fails.
**Adaptation Guide**<br>
Add the [bundleType](../../../application-dev/quick-start/app-configuration-file.md) tag. This tag can be left blank. The default value is **app**. The setting of this tag and the [installationFree](../../../application-dev/quick-start/module-configuration-file.md) field in the **module.json** file must meet the following rules:
- If **bundleType** is **app**, **installationFree** must be set to **false**.
- If **bundleType** is **atomicService**, **installationFree** must be set to **true**.
## cl.bundlemanager.23 Deleted the split Field from the ApplicationInfo Struct
The **split** field is deleted from the [ApplicationInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts) struct.
**Change Impact**<br>
If the **split** field is used in your code, the compilation fails.
**Key API/Component Changes**<br>
The **split** field is deleted from the [ApplicationInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts) struct.
**Adaptation Guide**<br>
Delete the **split** field from the **ApplicationInfo** struct of your code. The stage model always forcibly splits bundles.
## cl.bundlemanager.24 Deleted the atomicServiceModuleType Field from the HapModuleInfo Struct
The **atomicServiceModuleType** field is deleted from the [HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) struct.
**Change Impact**<br>
If the **atomicServiceModuleType** field is used in your code, the compilation fails.
**Key API/Component Changes**<br>
The **atomicServiceModuleType** field is deleted from the [HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) struct.
**Adaptation Guide**<br>
Record the setting of the **atomicServiceModuleType** field, delete it from the [HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) struct, and set the **moduleType** field in the [HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) struct to the recorded value.
## cl.bundlemanager.25 Deleted the AtomicServiceModuleType Enumerated Value
The **atomicServiceModuleType** field is deleted from the [HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) struct.
**Change Impact**<br>
If the **atomicServiceModuleType** field is used in your code, the compilation fails.
**Key API/Component Changes**<br>
The **atomicServiceModuleType** field is deleted from the [HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) struct.
**Adaptation Guide**<br>
Record the setting of the **atomicServiceModuleType** field, delete it from the [HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) struct, and set the **moduleType** field in the [HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) struct to the recorded value.
# Input Method Framework Subsystem – Input Method Framework Service Changelog
## @ohos.InputMethodSubtype Change of name, label, and id
Changed the **name**, **label**, and **id** attributes since API version 9.
**Change Impact**
Applications must be adapted to the following changes.
| Name| Before Change| After Change|
| -------- | -------- | -------- |
| label | (1) Value: ID of the input method subtype.| (1) Value: Label of the input method subtype.|
| name | (1) Description: Name of the input method subtype. (2) Value: Label of the input method subtype.| (1) Description: Bundle name of the input method; (2) Value: Bundle name of the input method.|
| id | (1) Value: Bundle name of the input method.| (1) Value: ID of the input method subtype.|
**Adaptation Guide**
Update the code to adapt to the preceding changes.
# Resource Scheduler Subsystem Changelog
## cl.resourceschedule.workScheduler
The data type of the **parameters** attribute value is changed. Specifically, the number, string, and boolean types are supported, but the any type is not.
**Change Impact**
For applications developed based on OpenHarmony3.2.10.7 and later SDK versions, the **parameters** attribute value can use the number, string, and boolean types only. If it uses the any type, a compilation error is reported.
**Key API/Component Changes**
The **parameters** attribute in @ohos.resourceschedule.workScheduler.d.ts is changed.
| Class| API Type| Statement Before the Change| Statement After the Change|
| -- | -- | -- | -- |
| workScheduler.WorkInfo | field | parameters?: {[key: string]: any} | parameters?: {[key: string]: number | string | boolean} |
**Adaptation Guide**
The **parameters** attribute uses the {[key: string]: number | string | boolean} data type.
# Theme Framework Subsystem – Screenlock Management Service Changelog
## cl.screenlock.1 Permission Change of isLocked and unlock
Changed the **isLocked** and **unlock** APIs to system APIs since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function isLocked(): boolean;
function unlock(callback: AsyncCallback<boolean>): void;
function unlock():Promise<boolean>;
```
- Before change:
```js
* Checks whether the screen is currently locked.
*
* @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise.
* @syscap SystemCapability.MiscServices.ScreenLock
* @since 9
*/
function isLocked(): boolean;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @systemapi Hide this for inner system use.
* @since 9
*/
function unlock(callback: AsyncCallback<boolean>): void;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @systemapi Hide this for inner system use.
* @since 9
*/
function unlock():Promise<boolean>;
```
- After change:
```js
* Checks whether the screen is currently locked.
*
* @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.ScreenLock
* @systemapi Hide this for inner system use.
* @since 9
*/
function isLocked(): boolean;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @since 9
*/
function unlock(callback: AsyncCallback<boolean>): void;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @since 9
*/
function unlock():Promise<boolean>;
```
**Adaptation Guide**
Make sure the APIs are only invoked by system applications.
The code snippet is as follows:
```js
try {
let ret = screenLock.isLocked();
console.error(`Obtain whether the screen is locked successfully , ret is: ${ret}`);
} catch (error) {
console.error(`Failed to obtain whether the screen is locked, error is : ${error.code}, ${error.message}`);
}
```
```js
screenlock.unlock((err, data) => {
if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`);
return;
}
console.info(`unlock the screen successfully. result: ${data}`);
});
```
```js
screenlock.unlock().then((data) => {
console.info(`unlock the screen successfully. result: ${data}`);
}).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`);
});
```
## cl.screenlock.2 Deprecation of isSecure
Deprecated the **isSecure** API since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The API can no longer be used after being deleted.
- Involved APIs:
```js
function isSecure(): boolean;
```
- Before change:
```js
function isSecure(): boolean;
```
- After change:
The API is deleted.
**Adaptation Guide**
Update the code so that the deprecated API is not used.
# Telephony Subsystem Changelog
## cl.telephony.1 Call Module reject API Change
Changed the `reject` API to the `rejectCall` API in the call module of the telephony subsystem since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The `reject` API is deprecated and cannot be used anymore. Use the `rejectCall` API instead. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function reject(callId: number, callback: AsyncCallback<void>): void;
function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void>): void;
function reject(callId?: number, options?: RejectMessageOptions): Promise<void>;
function reject(callback: AsyncCallback<void>): void;
function reject(options: RejectMessageOptions, callback: AsyncCallback<void>): void;
```
- Before change:
```js
function reject(callId: number, callback: AsyncCallback<void>): void;
function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void>): void;
function reject(callId?: number, options?: RejectMessageOptions): Promise<void>;
function reject(callback: AsyncCallback<void>): void;
function reject(options: RejectMessageOptions, callback: AsyncCallback<void>): void;
```
- After change:
```js
function rejectCall(callId: number, callback: AsyncCallback<void>): void;
function rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void>): void;
function rejectCall(callId?: number, options?: RejectMessageOptions): Promise<void>;
function rejectCall(callback: AsyncCallback<void>): void;
function rejectCall(options: RejectMessageOptions, callback: AsyncCallback<void>): void;
```
**Adaptation Guide**
The `reject` API is deprecated and cannot be used anymore. Use the `rejectCall` API instead.
Use the new API. The sample code is as follows:
```js
call.rejectCall("138xxxxxxxx", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
let promise = call.rejectCall(1, rejectMessageOptions);
promise.then(data => {
console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`);
});
```
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
let promise = call.rejectCall(1, rejectMessageOptions);
promise.then(data => {
console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`);
});
```
```js
call.rejectCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
call.rejectCall(rejectMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## cl.telephony.2 Call Module answer API Change
Changed the `answer` API to the `answerCall` API in the call module of the telephony subsystem since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The `answer` API is deprecated and cannot be used anymore. Use the `answerCall` API instead. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function answer(callId: number, callback: AsyncCallback<void>): void;
function answer(callId?: number): Promise<void>;
function answer(callback: AsyncCallback<void>): void;
```
- Before change:
```js
function answer(callId: number, callback: AsyncCallback<void>): void;
function answer(callId?: number): Promise<void>;
function answer(callback: AsyncCallback<void>): void;
```
- After change:
```js
function answerCall(callId: number, callback: AsyncCallback<void>): void;
function answerCall(callId?: number): Promise<void>;
function answerCall(callback: AsyncCallback<void>): void;
```
**Adaptation Guide**
The `answer` API is deprecated and cannot be used anymore. Use the `answerCall` API instead.
Use the new API. The sample code is as follows:
```js
call.answerCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
let promise = call.answerCall(1);
promise.then(data => {
console.log(`answerCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`);
});
```
```js
call.answerCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## cl.telephony.1 Call Module hangup API Change
Changed the `hangup` API to the `hangUpCall` API in the call module of the telephony subsystem since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The `hangup` API is deprecated and cannot be used anymore. Use the `hangUpCall` API instead. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function hangup(callId: number, callback: AsyncCallback<void>): void;
function hangup(callId?: number): Promise<void>;
function hangup(callback: AsyncCallback<void>): void;
```
- Before change:
```js
function hangup(callId: number, callback: AsyncCallback<void>): void;
function hangup(callId?: number): Promise<void>;
function hangup(callback: AsyncCallback<void>): void;
```
- After change:
```js
function hangUpCall(callId: number, callback: AsyncCallback<void>): void;
function hangUpCall(callId?: number): Promise<void>;
function hangUpCall(callback: AsyncCallback<void>): void;
```
**Adaptation Guide**
The `hangup` API is deprecated and cannot be used anymore. Use the `hangUpCall` API instead.
Use the new API. The sample code is as follows:
```js
call.hangUpCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
```js
let promise = call.hangUpCall(1);
promise.then(data => {
console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`);
});
```
```js
call.hangUpCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
# Util Subsystem Changelog
Compared with OpenHarmony 3.2 Beta4, OpenHarmony 3.2.10.7(MR) has the following API changes in the util subsystem.
## cl.util.1. randomUUID Name Changed
The **randomUUID** function name is changed to **generateRandomUUID**.
Before change: function randomUUID(entropyCache?: boolean): string <br>After change: function generateRandomUUID(entropyCache?: boolean): string
You need to adapt your application.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Method/Attribute/Enum/Constant | Change Type|
| :---------- | ------------------- | ------- |
| @ohos.util | function randomUUID(entropyCache?: boolean): string | Deleted |
| @ohos.util | function generateRandomUUID(entropyCache?: boolean): string| Added |
**Adaptation Guide**
Refer to the code snippet below to call **generateRandomUUID** in your application.
Example:
```ts
import util from '@ohos.util'
let uuid = util.generateRandomUUID(true);
console.log("RFC 4122 Version 4 UUID:" + uuid);
// Output:
// RFC 4122 Version 4 UUID:88368f2a-d5db-47d8-a05f-534fab0a0045
```
## cl.util.2 randomBinaryUUID Name Changed
The **randomBinaryUUID** function name is changed to **generateRandomBinaryUUID**.
Before change: function randomBinaryUUID(entropyCache?: boolean): Uint8Array<br>After change: function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array
You need to adapt your application.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Method/Attribute/Enum/Constant | Change Type|
| :---------- | ------------------- | ------- |
| @ohos.util | function randomBinaryUUID(entropyCache?: boolean): Uint8Array; | Deleted |
| @ohos.util | function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array| Added |
**Adaptation Guide**
Refer to the code snippet below to call **generateRandomBinaryUUID** in your application.
Example:
```ts
import util from '@ohos.util'
let uuid = util.generateRandomBinaryUUID(true);
console.log(JSON.stringify(uuid));
// Output:
// 138,188,43,243,62,254,70,119,130,20,235,222,199,164,140,150
```
## cl.util.3. contains Parameter Type in the LRUCache Class Changed
The **contains** parameter type in the LRUCache class is changed from **object** to **K**.
Before change: contains(key: object): boolean <br>After change: contains(key: K): boolean
You need to adapt your application.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| :-------- | ---------| -------------------------------- | -------- |
| @ohos.util | LRUCache | contains(key: object): boolean | Deleted |
| @ohos.util | LRUCache | contains(key: K): boolean | Added |
**Adaptation Guide**
Follow the code snippet to use the **contains** function in your application.
Example:
```ts
import util from '@ohos.util'
let pro = new util.LRUCache();
pro.put(2,10);
let obj = {1:"key"};
let result = pro.contains(obj);
```
# Theme Framework Subsystem – Wallpaper Management Service Changelog
## cl.wallpaper.1 Permission Change of getColorsSync, getMinHeightSync, getMinWidthSync, restore, and setImage
Changed the **getColorsSync**, **getMinHeightSync**, **getMinWidthSync**, restore, and **setImage** APIs to system APIs since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
function getMinHeightSync(): number;
function getMinWidthSync(): number;
function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
function restore(wallpaperType: WallpaperType): Promise<void>;
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
```
- Before change:
```js
/**
* Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function.
* @param wallpaperType Indicates the wallpaper type.
* @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
/**
* Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function getMinHeightSync(): number;
/**
* Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function getMinWidthSync(): number;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function restore(wallpaperType: WallpaperType): Promise<void>;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
```
- After change:
```js
/**
* Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function.
* @param wallpaperType Indicates the wallpaper type.
* @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function.
* @throws {BusinessError} 401 - parameter error.
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
/**
* Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function getMinHeightSync(): number;
/**
* Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function getMinWidthSync(): number;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function restore(wallpaperType: WallpaperType): Promise<void>;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
```
**Adaptation Guide**
Make sure the APIs are only invoked by system applications.
The code snippet is as follows:
```js
try {
let colors = wallpaper.getColorsSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM);
console.log(`success to getColorsSync: ${JSON.stringify(colors)}`);
} catch (error) {
console.error(`failed to getColorsSync because: ${JSON.stringify(error)}`);
}
```
```js
let minHeight = wallpaper.getMinHeightSync();
```
```js
let minWidth = wallpaper.getMinWidthSync();
```
```js
wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => {
if (error) {
console.error(`failed to restore because: ${JSON.stringify(error)}`);
return;
}
console.log(`success to restore.`);
});
```
```js
wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => {
console.log(`success to restore.`);
}).catch((error) => {
console.error(`failed to restore because: ${JSON.stringify(error)}`);
});
```
```js
// The source type is string.
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => {
if (error) {
console.error(`failed to setImage because: ${JSON.stringify(error)}`);
return;
}
console.log(`success to setImage.`);
});
```
```js
// The source type is string.
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => {
console.log(`success to setImage.`);
}).catch((error) => {
console.error(`failed to setImage because: ${JSON.stringify(error)}`);
});
```
## cl.wallpaper.2 Deprecation of getIdSync, getFileSync, isChangeAllowed, isUserChangeAllowed, on, off, and RgbaColor
Deprecated the **getIdSync**, **getFileSync**, **isChangeAllowed**, **isUserChangeAllowed**, **on**, **off**, and **RgbaColor** APIs since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The APIs can no longer be used after being deleted.
- Involved APIs:
```js
function getIdSync(wallpaperType: WallpaperType): number;
function getFileSync(wallpaperType: WallpaperType): number;
function isChangeAllowed(): boolean;
function isUserChangeAllowed(): boolean;
function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
interface RgbaColor {
red: number;
green: number;
blue: number;
alpha: number;
}
```
- Before change:
```js
function getIdSync(wallpaperType: WallpaperType): number;
function getFileSync(wallpaperType: WallpaperType): number;
function isChangeAllowed(): boolean;
function isUserChangeAllowed(): boolean;
function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
interface RgbaColor {
red: number;
green: number;
blue: number;
alpha: number;
}
```
- After change:
The APIs are deleted.
**Adaptation Guide**
Update the code so that the deprecated APIs are not used.
# Web Subsystem Changelog
Compared with earlier versions, OpenHarmony 3.2.10.7 has the following API changes in its web subsystem:
## cl.web.1 HitTestTypeV9 Name Change
Renamed the enum class **HitTestTypeV9** **WebHitTestType** to meet the naming conventions.
**Change Impact**
The enum class **HitTestTypeV9** and APIs that use **HitTestTypeV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
enum HitTestTypeV9
- Before change:
```ts
enum HitTestTypeV9
```
- After change:
```ts
enum WebHitTestType
```
**Adaptation Guide**
Replace **HitTestTypeV9** with **WebHitTestType**.
## cl.web.2 HeaderV9 Name Change
Renamed the struct **HeaderV9** **WebHeader** to meet the naming conventions.
**Change Impact**
The struct **HeaderV9** and APIs that use **HeaderV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HeaderV9
- Before change:
```ts
interface HeaderV9
```
- After change:
```ts
interface WebHeader
```
**Adaptation Guide**
Replace **HeaderV9** with **WebHeader**.
## cl.web.3 Member Change of HitTestValue
Rename the member variable **HitTestTypeV9** in the **HitTestValue** struct **WebHitTestType** to meet the naming conventions.
**Change Impact**
The struct **HitTestValue** and APIs that use **HitTestValue** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HitTestValue
- Before change:
```ts
interface HitTestValue {
/**
* Get the hit test type.
*
* @since 9
*/
type: HitTestTypeV9;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra: string;
}
```
- After change:
```ts
interface HitTestValue {
/**
* Get the hit test type.
*
* @since 9
*/
type: WebHitTestType;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra: string;
}
```
**Adaptation Guide**
Replace **HitTestTypeV9** with **WebHitTestType**.
## cl.web.4 Parameter Type Change of loadUrl
Changed the type of the **headers** parameter in **loadUrl** to **WebHeader** to meet the naming conventions.
**Change Impact**
The **loadUrl** API that uses the **headers** parameter cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
loadUrl(url: string | Resource, headers?: Array\<HeaderV9>): void
- Before change:
```ts
loadUrl(url: string | Resource, headers?: Array<HeaderV9>): void
```
- After change:
```ts
loadUrl(url: string | Resource, headers?: Array<WebHeader>): void
```
**Adaptation Guide**
Change the type of the **headers** parameter in **loadUrl** from **HeaderV9** to **WebHeader**.
## cl.web.5 Return Value Type Change of getHitTest
Changed the return value type of the **getHitTest** API to **WebHitTest** to meet the naming conventions.
**Change Impact**
The **getHitTest** API cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
getHitTest(): HitTestTypeV9
- Before change:
```ts
getHitTest(): HitTestTypeV9
```
- After change:
```ts
getHitTest(): WebHitTestType
```
**Adaptation Guide**
Change the return value type of the **getHitTest** API from **HitTestTypeV9** to **WebHitTestType**.
## cl.web.6 Moving of the WebMessagePort Class
Moved the **WebMessagePort** class to **@ohos.web.webview.d.ts** and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
**Key API/Component Changes**
- Involved APIs:
postMessageEvent(message: WebMessageEvent): void;
onMessageEvent(callback: (result: string) => void): void;
- Before change:
```ts
postMessageEvent(message: WebMessageEvent): void;
onMessageEvent(callback: (result: string) => void): void;
```
- After change:
```ts
postMessageEvent(message: WebMessage): void;
onMessageEvent(callback: (result: WebMessage) => void): void;
```
**Adaptation Guide**
Instead of importing APIs from the original **WebMessagePort** class, import APIs from **@ohos.web.webview** as follows:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.7 Moving of the HitTestValue Class
Moved the **HitTestValue** class to **@ohos.web.webview.d.ts**; changed **HitTestValue** from a class to an API; changed the **getType** and **getExtra** from APIs to attributes.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed.
**Key API/Component Changes**
- Involved APIs:
getType(): HitTestType;
getExtra(): string;
- Before change:
```ts
getType(): HitTestType;
getExtra(): string;
```
- After change:
```ts
type: WebHitTestType;
extra: string;
```
**Adaptation Guide**
Instead of importing APIs from the original **HitTestValue** class, import APIs from **@ohos.web.webview** as follows:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.8 Moving of API Version 9 APIs Under WebCookie
Moved APIs of API version 9 in the **WebCookie** class to **web.webview.webview.WebCookieManager**
and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
The APIs in the class are static.
**Key API/Component Changes**
- Involved APIs:
isCookieAllowed(): boolean;
isThirdPartyCookieAllowed(): boolean;
putAcceptCookieEnabled(accept: boolean): void;
putAcceptThirdPartyCookieEnabled(accept: boolean): void;
setCookie(url: string, value: string): boolean;
saveCookieSync(): boolean;
getCookie(url: string): string;
existCookie(): boolean;
deleteEntireCookie(): void;
deleteSessionCookie(): void;
- Before change:
```ts
isCookieAllowed(): boolean;
isThirdPartyCookieAllowed(): boolean;
putAcceptCookieEnabled(accept: boolean): void;
putAcceptThirdPartyCookieEnabled(accept: boolean): void;
setCookie(url: string, value: string): boolean;
saveCookieSync(): boolean;
getCookie(url: string): string;
existCookie(): boolean;
deleteEntireCookie(): void;
deleteSessionCookie(): void;
```
- After change:
```ts
static isCookieAllowed(): boolean;
static isThirdPartyCookieAllowed(): boolean;
static putAcceptCookieEnabled(accept: boolean): void;
static putAcceptThirdPartyCookieEnabled(accept: boolean): void;
static setCookie(url: string, value: string): void;
static saveCookieAsync(): Promise<void>;
static saveCookieAsync(callback: AsyncCallback<void>): void;
static getCookie(url: string): string;
static existCookie(): boolean;
static deleteEntireCookie(): void;
static deleteSessionCookie(): void;
```
**Adaptation Guide**
Instead of importing APIs from the original **WebCookie** class, import APIs from **@ohos.web.webview** as follows:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.9 Moving of API Version 9 APIs Under WebController
Moved APIs of API version 9 in the **WebController** class to **web.webview.webview.WebviewController** and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
The **getDefaultUserAgent** API is renamed **getUserAgent**.
**Key API/Component Changes**
- Involved APIs:
zoomIn(): boolean;
zoomOut(): boolean;
createWebMessagePorts(): Array\<WebMessagePort>;
postMessage(options: { message: WebMessageEvent, uri: string}): void;
getHitTestValue(): HitTestValue;
getWebId(): number;
getDefaultUserAgent(): string;
getTitle(): string;
getPageHeight(): number;
backOrForward(step: number): void;
searchAllAsync(searchString: string): void;
clearMatches(): void;
searchNext(forward: boolean): void;
clearSslCache(): void;
clearClientAuthenticationCache(): void;
getUrl(): string;
- Before change:
```ts
zoomIn(): boolean;
zoomOut(): boolean;
createWebMessagePorts(): Array<WebMessagePort>;
postMessage(options: { message: WebMessageEvent, uri: string}): void;
getHitTestValue(): HitTestValue;
getWebId(): number;
getDefaultUserAgent(): string;
getTitle(): string;
getPageHeight(): number;
backOrForward(step: number): void;
searchAllAsync(searchString: string): void;
clearMatches(): void;
searchNext(forward: boolean): void;
clearSslCache(): void;
clearClientAuthenticationCache(): void;
getUrl(): string;
```
- After change:
```ts
zoomIn(): void;
zoomOut(): void;
createWebMessagePorts(): Array<WebMessagePort>;
postMessage(name: string, ports: Array<WebMessagePort>, uri: string): void;
getHitTestValue(): HitTestValue;
getWebId(): number;
getUserAgent(): string;
getTitle(): string;
getPageHeight(): number;
backOrForward(step: number): void;
searchAllAsync(searchString: string): void;
clearMatches(): void;
searchNext(forward: boolean): void;
clearSslCache(): void;
clearClientAuthenticationCache(): void;
getUrl(): string;
```
**Adaptation Guide**
Instead of importing APIs from the original **WebController** class, import APIs from **@ohos.web.webview** as follows:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.10 Moving of the WebAsyncController Class
Moved the APIs in the **WebAsyncController** class to the **web.webview.webview.WebviewController** class and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, pay attention to error code processing.
**Key API/Component Changes**
- Involved APIs:
storeWebArchive(baseName: string, autoName: boolean): Promise\<string>;
storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback\<string>): void;
- Before change:
```ts
storeWebArchive(baseName: string, autoName: boolean): Promise<string>;
storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback<string>): void;
```
- After change:
```ts
storeWebArchive(baseName: string, autoName: boolean): Promise<string>;
storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback<string>): void;
```
**Adaptation Guide**
Example:
```ts
// xxx.ets
import web_webview from '@ohos.web.webview'
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController();
build() {
Column() {
Button('saveWebArchive')
.onClick(() => {
try {
this.controller.storeWebArchive("/data/storage/el2/base/", true, (error, filename) => {
if (error) {
console.info(`save web archive error: ` + JSON.stringify(error))
return;
}
if (filename != null) {
console.info(`save web archive success: ${filename}`)
}
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
})
Web({ src: 'www.example.com', controller: this.controller })
}
}
}
```
# Readme
- [Ability framework](changelogs-ability.md)
- [Account subsystem](changelogs-account_os_account.md)
- [ArkUI development framework](changelogs-arkui.md)
- [Multimedia subsystem - camera](changelogs-camera-sync.md)
- [Common library subsystem - container](changelogs-container.md)
- [Distributed data management](changelogs-distributeddatamgr.md)
- [File management subsystem](changelogs-filemanagement.md)
- [Input method framework](changelogs-inputmethod-framworks.md)
- [File management subsystem - MediaLibrary](changelogs-mediaLibrary.md)
- [Multimedia subsystem](changelogs-multimedia.md)
- [Communication subsystem - NFC](changelogs-nfc.md)
- [Common event and notification subsystem](changelogs-notification.md)
- Location subsystem
- [ohos.geoLocationManager](changelogs-ohos-geoLocationManager.md)
- [ohos.geoLocation](changelogs-ohos-geolocation.md)
- [system.geolocation](changelogs-system-geolocation.md)
- [Upload and download](changelogs-request.md)
- [Resource scheduler subsystem](changelogs-resourceschedule.md)
- [Security subsystem](changelogs-security.md)
- [Telephony subsystem](changelogs-telephony.md)
- [Time service](changelogs-time.md)
- [Common library subsystem - URL](changelogs-url.md)
- [User IAM subsystem](changelogs-useriam.md)
- [Window manager subsystem](changelogs-window.md)
# *Example* Subsystem Changelog
Changes that affect contract compatibility of the last version should be described in the changelog. The changes include but are not limited to those related to API names, parameters, return values, required permissions, call sequence, enumerated values, configuration parameters, and paths. The last version can be an LTS, release, beta, or monthly version, or the like. Contract compatibility, also called semantic compatibility, means that the original program behavior should remain consistent over versions.
## cl.subsystemname.x xxx Function Change (Example: DeviceType Attribute Change or Camera Permission Change. Use a short description.)
Add the number **cl.*subsystemname*.*x*** before each change title, where **cl** is the abbreviation of changelog, *subsystemname* is the standard English name of the subsystem, and *x* indicates the change sequence number (starting from 1 in ascending order).
Describe the changes in terms of functions. Example: *n* and *m* of the *a* function are changed. Developers need to adapt their applications based on the change description.
If there is a requirement or design document corresponding to the change, attach the requirement number or design document number in the description.
**Change Impact**
Describe whether released APIs (JS or native APIs) are affected or API behavior is changed.
Describe whether available applications are affected, that is, whether an adaptation is required for building the application code in the SDK environment of the new version.
**Key API/Component Changes**
List the API/component changes involved in the function change.
**Adaptation Guide**
Provide guidance for developers on how to adapt their application to the changes to be compatible with the new version.
Example:
Change parameter *n* to *m* in the *a* file.
```
sample code
```
# Ability Framework Changelog
## cl.ability.1 API Migration
The **requestPermissionsFromUser** API of **UIAbilityContext** is migrated from the ability subsystem to the security subsystem.
Previously, the permission popup was implemented based on **UIAbility**, which used the **startAbilityForResult** API of **UIAbilityContext** to return the permission authorization result to the caller. Therefore, **requestPermissionsFromUser** was temporarily placed in **UIAbilityContext**. The permission popup is now implemented based on **ServiceExtensionAbility**, which no longer requires **startAbilityForResult** of **UIAbilityContext**. Therefore, **requestPermissionsFromUser** is migrated to the security subsystem.
You need to adapt your application based on the following information.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| application/UIAbilityContext | UIAbilityContext | requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>): void; | Deleted |
| application/UIAbilityContext | UIAbilityContext | requestPermissionsFromUser(permissions: Array<string>): Promise<PermissionRequestResult>; | Deleted |
| @ohos.abilityAccessCtrl | AtManager | requestPermissionsFromUser(context: Context, permissions: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; | Added |
| @ohos.abilityAccessCtrl | AtManager | requestPermissionsFromUser(context: Context, permissions: Array<Permissions>) : Promise<PermissionRequestResult>; | Added |
**Adaptation Guide**
The following illustrates how **requestPermissionsFromUser** is called to show a permission popup.
Stage model:
```ts
import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts';
// onWindowStageCreate lifecycle of UIAbility.
onWindowStageCreate() {
let AtManager = abilityAccessCtrl.createAtManager();
// requestPermissionsFromUser determines whether to display a popup based on the permission authorization status.
AtManager.requestPermissionsFromUser(this.context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"]).then((data) => {
console.log("data type:" + typeof(data));
console.log("data:" + data);
console.log("data permissions:" + data.permissions);
console.log("data result:" + data.authResults);
}).catch((err) => {
console.error('Failed to start ability', err.code);
})
}
```
## cl.ability.2 Deletion of Deprecated APIs in API Version 9
In the **Ability Exception Rectification** document, some APIs in API version 9 have been marked as deprecated. According to API specifications of OpenHarmony, these APIs should be deleted.
**Change Impact**
The application developed based on earlier versions needs to use new APIs to replace the deleted ones. Otherwise, the application compilation will be affected.
**Key API/Component Changes**
API files are deleted.
| Deleted API | New API |
| ----------------------------------------------- | ----------------------------------------------- |
| @ohos.application.Ability.d.ts | @ohos.app.ability.UIAbility.d.ts |
| @ohos.application.AbilityConstant.d.ts | @ohos.app.ability.AbilityConstant.d.ts |
| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts |
| @ohos.application.AbilityStage.d.ts | @ohos.app.ability.AbilityStage.d.ts |
| @ohos.application.EnvironmentCallback.d.ts | @ohos.app.ability.EnvironmentCallback.d.ts |
| @ohos.application.ExtensionAbility.d.ts | @ohos.app.ability.ExtensionAbility.d.ts |
| @ohos.application.FormExtension.d.ts | @ohos.app.form.FormExtensionAbility.d.ts |
| @ohos.application.ServiceExtensionAbility.d.ts | @ohos.app.ability.ServiceExtensionAbility.d.ts |
| @ohos.application.StartOptions.d.ts | @ohos.app.ability.StartOptions.d.ts |
| @ohos.application.context.d.ts | @ohos.app.ability.common.d.ts |
| @ohos.application.errorManager.d.ts | @ohos.app.ability.errorManager.d.ts |
APIs or attributes are deleted:
- @ohos.application.Configuration.d.ts
- **direction**, **screenDensity**, **displayId**, and **hasPointerDevice** of **Configuration** are deleted. Use **Configuration** of **@ohos.app.ability.Configuration.d.ts**.
- @ohos.application.ConfigurationConstant.d.ts
- **Direction** and **ScreenDensity** are deleted. Use **Direction** and **ScreenDensity** of **@ohos.app.ability.ConfigurationConstant.d.ts**.
- @ohos.application.abilityManager.d.ts
- **getExtensionRunningInfos** and **getTopAbility** are deleted. Use the APIs with the same name in **@ohos.app.ability.abilityManager.d.ts**.
- @ohos.application.appManager.d.ts
- **ApplicationState** and **ProcessState** are deleted. Use **ApplicationState** and **ProcessState** of **@ohos.app.ability.appManager.d.ts**.
- **registerApplicationStateObserver** and **getProcessRunningInformation** are deleted. Use the APIs with the same name in **@ohos.app.ability.appManager.d.ts**.
- @ohos.application.formHost.d.ts
- **shareForm** and **notifyFormsPrivacyProtected** are deleted. Use the APIs with the same name in **@ohos.app.form.formHost.d.ts**.
- @ohos.application.formInfo.d.ts
- **eTS** of **FormType** is deleted. Use **eTS** of **FormType** in **@ohos.app.form.formInfo.d.ts**.
- **IDENTITY_KEY**, **BUNDLE_NAME_KEY**, **ABILITY_NAME_KEY**, and **DEVICE_ID_KEY** of **FormParam** are deleted. Use the enums with the same name in **@ohos.app.form.formInfo.d.ts**.
- **FormInfoFilter** is deleted. Use **FormInfoFilter** of **@ohos.app.form.formInfo.d.ts**.
- **FormDimension** is deleted. Use **FormDimension** of **@ohos.app.form.formInfo.d.ts**.
- **VisibilityType** is deleted. Use **VisibilityType** of **@ohos.app.form.formInfo.d.ts**.
- @ohos.wantAgent.d.ts
- **trigger** and **getOperationType** are deleted. Use the APIs with the same name in **@ohos.app.ability.wantAgent.d.ts**.
- application/ApplicationContext.d.ts
- **registerAbilityLifecycleCallback**, **unregisterAbilityLifecycleCallback**, **registerEnvironmentCallback**, and **unregisterEnvironmentCallback** are deleted. Use **on** and **off**.
- application/ServiceExtensionContext.d.ts
- **connectAbility**, **connectAbilityWithAccount**, and **disconnectAbility** are deleted. Use **connectServiceExtensionAbility**, **connectServiceExtensionAbilityWithAccount**, and **disconnectServiceExtensionAbility**.
- @ohos.application.FormExtension.d.ts
- **onCreate**, **onCastToNormal**, **onUpdate**, **onVisibilityChange**, **onEvent**, **onDestroy**, **onAcquireFormState**, and **onShare** are deleted. Use the following lifecycle methods of **@ohos.app.form.FormExtensionAbility.d.ts**: **onAddForm**, **onCastToNormalForm**, **onUpdateForm**, **onChangeFormVisibility**, **onFormEvent**, **onRemoveForm**, **onAcquireFormState**, and **onShareForm**.
- @ohos.application.abilityDelegatorRegistry.d.ts
- **AbilityDelegator**, **AbilityDelegatorArgs**, **AbilityMonitor**, and **ShellCmdResult** are deleted. Use the classes with the same name in **@ohos.app.ability.abilityDelegatorRegistry.d.ts**.
- @ohos.application.abilityManager.d.ts
- **AbilityRunningInfo** and **ExtensionRunningInfo** are deleted. Use the classes with the same name in **@ohos.app.ability.abilityManager.d.ts**.
- @ohos.application.appManager.d.ts
- **AbilityStateData**, **AppStateData**, **ApplicationStateObserver**, **ProcessRunningInfo**, and **ProcessRunningInformation** are deleted. Use the classes with the same name in **@ohos.app.ability.appManager.d.ts**.
- @ohos.application.missionManager.d.ts
- **MissionInfo**, **MissionListener**, and **MissionSnapshot** are deleted. Use the classes with the same name in **@ohos.app.ability.missionManager.d.ts**.
- @ohos.wantAgent.d.ts
- **TriggerInfo** and **WantAgentInfo** are deleted. Use the classes with the same name in **@ohos.app.ability.wantAgent.d.ts**.
**Adaptation Guide**
As mentioned above, only several APIs have their names changed in terms of, for example, the registration callbacks (**registerAbilityLifecycleCallback**, **unregisterAbilityLifecycleCallback**, **registerEnvironmentCallback**, and **unregisterEnvironmentCallback**) and connection and disconnection **ServiceExtensionAbility** (**connectAbility**, **connectAbilityWithAccount**, and **disconnectAbility**). For such APIs, replace their names with those of their corresponding new APIs in the lifecycle callbacks.
Most APIs are moved to the new namespace. Therefore, you can modify **import** for adaptation.
For example, the original API uses **@ohos.application.Ability**:
```js
import Ability from '@ohos.application.Ability';
```
You can directly modify **import** to switch to the new namespace:
```js
import Ability from '@ohos.app.ability.UIAbility';
```
In addition, exception handling is needed. For details, see the API reference for the new APIs.
## cl.ability.3 RestartFlag Attribute Names Changed and Unsupported Attribute Deleted in appRecovery
In the **appRecovery** API, the enum names of **RestartFlag** are changed from **NO_RESTART** upon a specific fault to **RESTART** upon a specific fault.
The **CPP_CRASH_NO_RESTART** enum is deleted.
**Change Impact**
If your application uses the **CPP_CRASH_NO_RESTART**, **JS_CRASH_NO_RESTART**, or **APP_FREEZE_NO_RESTART** attribute in versions earlier than 3.2.10.6, its behavior will change after an upgrade to 3.2.10.6.
**Key API/Component Changes**
**RestartFlag** <sup>9+</sup>
Before change
| Name | Value | Description |
| --------------------- | ------ | -------------------------------- |
| ALWAYS_RESTART | 0 | The application is restarted in all cases. |
| CPP_CRASH_NO_RESTART | 0x0001 | The application is **not restarted** in the case of CPP_CRASH. |
| JS_CRASH_NO_RESTART | 0x0002 | The application is **not restarted** in the case of JS_CRASH. |
| APP_FREEZE_NO_RESTART | 0x0004 | The application is **not restarted** in the case of APP_FREEZE.|
| NO_RESTART | 0xFFFF | The application is not restarted in any case. |
After change
| Name | Value | Description |
| ----------------------- | ------ | ------------------------------ |
| ALWAYS_RESTART | 0 | The application is restarted in all cases. |
| CPP_CRASH_NO_RESTART | NA | **Deleted.** The restart in this scenario is not supported.|
| RESTART_WHEN_JS_CRASH | 0x0001 | The application is **restarted** in the case of JS_CRASH. |
| RESTART_WHEN_APP_FREEZE | 0x0002 | The application is **restarted** in the case of APP_FREEZE.|
| NO_RESTART | 0xFFFF | The application is not restarted in any case. |
**Adaptation Guide**
Perform adaptation based on the new semantics.
# Account Subsystem Changelog
## cl.account_os_account.1 createOsAccountForDomain Error Code Change
Changed the error code returned when the domain account created by **createOsAccountForDomain()** already exists from **12300001** to **12300004**.
Changed the error information from "common system error" to "The account already exists".
**Change Impact**
The application developed based on earlier versions needs to adapt the new error code. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
- AccountManager
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;OsAccountInfo&gt;);
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise&lt;OsAccountInfo&gt;;
**Adaptation Guide**
The sample code is as follows:
```ts
import account_osAccount from "@ohos.account.osAccount"
let accountMgr = account_osAccount.getAccountManager();
let domainInfo = {
accountName: "zhangsan",
domain: "china.example.com"
};
try {
await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo);
await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo);
} catch (err) {
console.log("activateOsAccount err: " + JSON.stringify(err)); // error.code = 12300004;
}
```
## cl.account_os_account.2 Application Account getAllAccounts() Permission Change
Removed the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission that is originally required for an application to call **getAllAccounts()** to obtain accessible accounts.
**Change Impact**
From this version, applications do not need the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission when calling **getAllAccounts()**.
**Key API/Component Changes**
- AccountManager
- getAllAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void;
- getAllAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;;
**Adaptation Guide**
The following is the sample code for an application to obtain the accessible accounts without the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission:
```ts
import account_appAccount from "@ohos.account.appAccount"
let accountMgr = account_appAccount.createAppAccountManager();
try {
await accountMgr.addAccount("accessibleAccount_promise_nopermission");
var data = await accountMgr.getAllAccounts();
if (data[0].name == "accessibleAccount_promise_nopermission") {
console.log("getAllAccounts successfully");
}
} catch (err) {
console.log("getAllAccounts err: " + JSON.stringify(err));
}
```
## cl.account_os_account.3 Application Account getAccountsByOwner() Permission Change
Removed the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission that is originally required for an application to call **getAccountsByOwner()** to obtain the accessible accounts based on the account owner .
**Change Impact**
From this version, applications do not need the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission when calling **getAccountsByOwner()**.
**Key API/Component Changes**
- AccountManager
- getAccountsByOwner(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void;
- getAccountsByOwner(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;;
**Adaptation Guide**
The following is the sample code for an application to obtain the accessible accounts based on the account owner without the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission:
```ts
import account_appAccount from "@ohos.account.appAccount"
let accountMgr = account_appAccount.createAppAccountManager();
try {
var ownerName = "com.example.owner";
var data = await accountMgr.getAllAccounts(ownerName);
} catch (err) {
console.log("getAllAccounts err: " + JSON.stringify(err));
}
```
# ArkUI Subsystem ChangeLog
## cl.arkui.1 Restrictions on Data Type Declarations of State Variables
1. The data types of state variables decorated by state decorators must be explicitly declared. They cannot be declared as **any** or **Date**.
Example:
```ts
// xxx.ets
@Entry
@Component
struct DatePickerExample {
// Incorrect: @State isLunar: any = false
@State isLunar: boolean = false
// Incorrect: @State selectedDate: Date = new Date('2021-08-08')
private selectedDate: Date = new Date('2021-08-08')
build() {
Column() {
Button('Switch Calendar')
.margin({ top: 30 })
.onClick(() => {
this.isLunar = !this.isLunar
})
DatePicker({
start: new Date('1970-1-1'),
end: new Date('2100-1-1'),
selected: this.selectedDate
})
.lunar(this.isLunar)
.onChange((value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
console.info('select current date is: ' + JSON.stringify(value))
})
}.width('100%')
}
}
```
![datePicker](../../../application-dev/reference/arkui-ts/figures/datePicker.gif)
2. The data type declaration of the **@State**, **@Provide**, **@Link**, or **@Consume** decorated state variables can consist of only one of the primitive data types or reference data types.
The **Length**, **ResourceStr**, and **ResourceColor** types are combinations of primitive data types or reference data types. Therefore, they cannot be used by the aforementioned types of state variables.
For details about the definitions of **Length**, **ResourceStr**, and **ResourceColor**, see [Types](../../../application-dev/reference/arkui-ts/ts-types.md).
Example:
```ts
// xxx.ets
@Entry
@Component
struct IndexPage {
// Incorrect: @State message: string | Resource = 'Hello World'
@State message: string = 'Hello World'
// Incorrect: @State message: ResourceStr = $r('app.string.hello')
@State resourceStr: Resource = $r('app.string.hello')
build() {
Row() {
Column() {
Text(`${this.message}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
```
![hello](../../../application-dev/quick-start/figures/hello.PNG)
**Change Impacts**
1. If the data type of a state variable decorated by a state decorator is declared as **any**, a build error will occur.
```ts
// ArkTS:ERROR Please define an explicit type, not any.
@State isLunar: any = false
```
2. If the data type of a state variable decorated by a state decorator is declared as **Date**, a build error will occur.
```ts
// ArkTS:ERROR The @State property 'selectedDate' cannot be a 'Date' object.
@State selectedDate: Date = new Date('2021-08-08')
```
3. If the data type of a **@State**, **@Provide**, **@Link**, and or **@Consume** decorated state variable is Length, **ResourceStr**, or **ResourceColor**, a build error will occur.
```ts
/* ArkTS:ERROR The state variable type here is 'ResourceStr', it contains both a simple type and an object type,
which are not allowed to be defined for state variable of a struct.*/
@State message: ResourceStr = $r('app.string.hello')
```
**Key API/Component Changes**
N/A
**Adaptation Guide**
1. Explicitly declare the data type for state variables decorated by state decorators.
2. If a state variable decorated by a state decorator uses the **Date** object, change it to a regular variable – a variable not decorated by any decorator.
3. Adapt the **@State**, **@Provide**, **@Link**, and **@Consume** decorated variables based on the following code snippet so that they do not use the **Length(string|number|Resource)**, **ResourceStr(string|Resource)**, and **ResourceColor(string|number|Color|Resource)** types:
```ts
// Incorrect:
@State message: ResourceStr = $r('app.string.hello')
// Corrected:
@State resourceStr: Resource = $r('app.string.hello')
```
## cl.arkui.2 Initialization Rules and Restrictions of Custom Components' Member Variables
Comply with the following rules when using constructors to initialize member variables:
| **From the Variable in the Parent Component (Right) to the Variable in the Child Component (Below)**| **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** |
|---------------------------------|----------------------------|------------|-----------|-----------|--------------|--------------|------------------|
| **regular** | Supported | Supported | Supported | Supported | Not supported | Not supported | Supported |
| **@State** | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
| **@Link** | Not supported | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) |
| **@Prop** | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
| **@Provide** | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
| **@Consume** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
| **From the Variable in the Parent Component (Right) to the Variable in the Child Component (Below)**| **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** |
|------------------|------------------|------------------|-----------------------|------------------------|
| **regular** | Supported | Not supported | Not supported | Not supported |
| **@State** | Supported | Supported | Supported | Supported |
| **@Link** | Supported (1) | Supported (1) | Supported (1) | Supported (1) |
| **@Prop** | Supported | Supported | Supported | Supported |
| **@Provide** | Supported | Supported | Supported | Supported |
| **@Consume** | Not supported | Not supported | Not supported | Not supported |
| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported |
> **NOTE**
>
> **Supported (1)**: The dollar sign ($) must be used, for example, **this.$varA**.
>
> **regular**: refers to a regular variable that is not decorated by any decorator.
**@StorageLink**, **@StorageProp**, **@LocalStorageLink**, and **@LocalStorageProp** variables cannot be initialized from the parent component.
**Change Impacts**
1. Variables decorated by **@LocalStorageLink** and **@LocalStorageProp** cannot be initialized from the parent component.
```ts
@Entry
@Component
struct LocalStorageComponent {
build() {
Column() {
Child({
/* ArkTS:ERROR Property 'simpleVarName' in the custom component 'Child' cannot
initialize here (forbidden to specify). */
simpleVarName: 1,
/* ArkTS:ERROR Property 'objectName' in the custom component 'Child' cannot
initialize here (forbidden to specify). */
objectName: new ClassA("x")
})
}
}
}
@Component
struct Child {
@LocalStorageLink("storageSimpleProp") simpleVarName: number = 0;
@LocalStorageProp("storageObjectProp") objectName: ClassA = new ClassA("x");
build() {}
}
```
2. The **@ObjectLink** decorated variable cannot be directly initialized from a decorated variable in the parent component. The source of the parent component must be an array item or object attribute decorated by **@State**, **@Link**, **@Provide**, **@Consume**, or **@ObjectLink**.
```ts
let NextID : number = 0;
@Observed class ClassA {
public id : number;
public c: number;
constructor(c: number) {
this.id = NextID++;
this.c = c;
}
}
@Component
struct Child {
@ObjectLink varA : ClassA;
build() {
Row() {
Text('ViewA-' + this.varA.id)
}
}
}
@Component
struct Parent {
@Link linkValue: ClassA
build() {
Column() {
/* ArkTS:ERROR The @Link property 'linkValue' cannot be assigned to
the @ObjectLink property 'varA'.*/
Child({ varA: this.linkValue })
}
}
}
```
**Key API/Component Changes**
N/A
**Adaptation Guide**
1. When building a child component, do not perform the build on the variables decorated by **@LocalStorageLink** and **@LocalStorageProp** in the child component.
To change these variables from the parent component, use the API provided by the **LocalStorage** (such as the **set** API) to assign values to them.
2. For details about how to use **@ObjectLink**, see @ObjectLink.
## cl.LocalStorage.1 Return Type Change of the get API
Changed the return type from **get\<T>(propName: string): T** to **get\<T>(propName: string): T | undefined**.
**Change Impact**
None
## cl.arkui.LocalStorage.2 Mandatory/Optional Change of the newValue Parameter in setOrCreate
**Change Impact**
API declaration before change:
```js
setOrCreate<T>(propName: string, newValue?: T): boolean
```
API declaration after change:
```js
setOrCreate<T>(propName: string, newValue: T): boolean
```
The **newValue** parameter becomes mandatory.
If it is not specified when an application calls the API, the build will fail after the SDK is replaced.
**Adaptation Guide**
```js
let storage = new LocalStorage();
storage.setOrCreate('propA', 'hello');
```
## cl.arkui.LocalStorage.3 link Parameter and Return Type Changes
**Change Impact**
API declaration before change:
```js
link<T>(propName: string, linkUser?: T, subscribersName?: string): T
```
API declaration after change:
```js
link<T>(propName: string): SubscribedAbstractProperty<T>
```
1. The second and third parameters of the **link** API are reserved for internal use by the framework. Therefore, the API is changed to contain only one parameter.
2. The return type **T** is changed to **SubscribedAbstractProperty**.
**Adaptation Guide**
```js
let storage = new LocalStorage({"PropA": "47"});
let linA = storage.link("PropA");
linA.set(50);
```
## cl.arkui.LocalStorage.4 setAndLink Parameter and Return Type Changes
**Change Impact**
API declaration before change:
```js
setAndLink<T>(propName: string, defaultValue: T, linkUser?: T, subscribersName?: string): T
```
API declaration after change:
```js
setAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>
```
1. The third and fourth parameters of the **setAndLink** API are reserved for internal use by the framework. Therefore, the API is changed to contain two parameters.
2. The return type **T** is changed to **SubscribedAbstractProperty**.
**Adaptation Guide**
```js
let storage = new LocalStorage({"PropA": "47"});
let linA = storage.setAndLink("PropA", "48")
linA.set(50);
```
## cl.arkui.LocalStorage.5 prop Parameter and Return Type Changes
**Change Impact**
API declaration before change:
```js
prop<T>(propName: string, propUser?: T, subscribersName?: string): T
```
API declaration after change:
```js
prop<S>(propName: string): SubscribedAbstractProperty<S>
```
1. The second and third parameters of the **prop** API are reserved for internal use by the framework. Therefore, the API is changed to contain only one parameter.
2. The return type **T** is changed to **SubscribedAbstractProperty**.
**Adaptation Guide**
```js
let storage = new LocalStorage({"PropA": "47"});
let propA = storage.prop("PropA");
propA.set(51); // one-way sync
```
## cl.arkui.LocalStorage.6 setAndProp Parameter and Return Type Changes
**Change Impact**
API declaration before change:
```js
setAndProp<T>(propName: string, defaultValue: T, propUser?: T, subscribersName?: string): T
```
API declaration after change:
```js
setAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S>
```
1. The third and fourth parameters of the **setAndProp** API are reserved for internal use by the framework. Therefore, the API is changed to contain two parameters.
2. The return type **T** is changed to **SubscribedAbstractProperty**.
**Adaptation Guide**
```js
let storage = new LocalStorage({"PropA": "47"});
let propA = storage.setAndProp("PropA", "48");
propA.set(51); // one-way sync
```
\ No newline at end of file
# Multimedia Subsystem Changelog
## cl.subsystemname.1 Camera API Changed
1. All the APIs of the camera component are changed to system APIs in the API version 9.
2. Some functional APIs are added and some others are deprecated to:
Improve the usability of camera APIs.
Help you quickly understand camera APIs and use them for development.
Facilitate expansion of framework functions in later versions, and reduce coupling between framework modules.
You need to refer to the following change description to adapt your application.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Is System API| Change Type|
| ---------------------- | ----------------------- | ------------------------------------------------------------ | --------------- | -------- |
| ohos.multimedia.camera | camera | function getCameraManager(context: Context): CameraManager; | Yes | Added |
| ohos.multimedia.camera | camera | function getCameraManager(context: Context, callback: AsyncCallback<CameraManager>): void;<br>function getCameraManager(context: Context): Promise<CameraManager>; | Yes | Deprecated |
| ohos.multimedia.camera | CameraErrorCode | INVALID_ARGUMENT = 7400101,<br>OPERATION_NOT_ALLOWED = 7400102,<br>SESSION_NOT_CONFIG = 7400103,<br>SESSION_NOT_RUNNING = 7400104,<br>SESSION_CONFIG_LOCKED = 7400105,<br>DEVICE_SETTING_LOCKED = 7400106,<br>CONFILICT_CAMERA = 7400107,<br>DEVICE_DISABLED = 7400108,<br>SERVICE_FATAL_ERROR = 7400201 | Yes | Added |
| ohos.multimedia.camera | CameraManager | getSupportedCameras(): Array<CameraDevice>;<br>getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;<br>createCameraInput(camera: CameraDevice): CameraInput;<br>createCameraInput(position: CameraPosition, type: CameraType): CameraInput;<br>createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;<br>createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;<br>createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;<br>createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): MetadataOutput;<br>createCaptureSession(): CaptureSession; | Yes | Added |
| ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback<Array<CameraDevice>>): void;<br>getSupportedCameras(): Promise<Array<CameraDevice>>;<br>getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback<CameraOutputCapability>): void;<br>getSupportedOutputCapability(camera: CameraDevice): Promise<CameraOutputCapability>;<br>createCameraInput(camera: CameraDevice, callback: AsyncCallback<CameraInput>): void;<br>createCameraInput(camera: CameraDevice): Promise<CameraInput>;<br>createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback<CameraInput>): void;<br>createCameraInput(position: CameraPosition, type: CameraType): Promise<CameraInput>;<br>createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PreviewOutput>): void;<br>createPreviewOutput(profile: Profile, surfaceId: string): Promise<PreviewOutput>;<br>createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PhotoOutput>): void;<br>createPhotoOutput(profile: Profile, surfaceId: string): Promise<PhotoOutput>;<br>createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback<VideoOutput>): void;<br>createVideoOutput(profile: VideoProfile, surfaceId: string): Promise<VideoOutput>;<br>createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>, callback: AsyncCallback<MetadataOutput>): void;<br>createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): Promise<MetadataOutput>;<br>createCaptureSession(callback: AsyncCallback<CaptureSession>): void;<br>createCaptureSession(): Promise<CaptureSession>; | Yes | Deprecated |
| ohos.multimedia.camera | CameraType | CAMERA_TYPE_DEFAULT = 0 | Yes | Added |
| ohos.multimedia.camera | CameraType | CAMERA_TYPE_UNSPECIFIED = 0 | Yes | Deprecated |
| ohos.multimedia.camera | CameraInput | on(type: 'error', camera: CameraDevice, callback: ErrorCallback<BusinessError>): void; | Yes | Added |
| ohos.multimedia.camera | CameraInput | release(callback: AsyncCallback<void>): void;<br>release(): Promise<void>;<br>on(type: 'error', camera: CameraDevice, callback: ErrorCallback<CameraInputError>): void; | Yes | Deprecated |
| ohos.multimedia.camera | CameraInputErrorCode | ERROR_UNKNOWN = -1<br>ERROR_NO_PERMISSION = 0<br>ERROR_DEVICE_PREEMPTED = 1<br>ERROR_DEVICE_DISCONNECTED = 2<br>ERROR_DEVICE_IN_USE = 3<br>ERROR_DRIVER_ERROR = 4 | Yes | Deprecated |
| ohos.multimedia.camera | CameraInputError | code: CameraInputErrorCode | Yes | Deprecated |
| ohos.multimedia.camera | CaptureSession | beginConfig(): void;<br>addInput(cameraInput: CameraInput): void;<br>removeInput(cameraInput: CameraInput): void;<br>addOutput(cameraOutput: CameraOutput): void;<br>removeOutput(cameraOutput: CameraOutput): void;<br>hasFlash(): boolean;<br>isFlashModeSupported(flashMode: FlashMode): boolean;<br>getFlashMode(): FlashMode;<br>setFlashMode(flashMode: FlashMode): void;<br>isExposureModeSupported(aeMode: ExposureMode): boolean;<br>getExposureMode(): ExposureMode;<br>setExposureMode(aeMode: ExposureMode): void;<br>getMeteringPoint(): Point;<br>setMeteringPoint(point: Point): void;<br>getExposureBiasRange(): Array<number>;<br>setExposureBias(exposureBias: number): void;<br>getExposureValue(): number;<br>isFocusModeSupported(afMode: FocusMode): boolean;<br>getFocusMode(): FocusMode;<br>setFocusMode(afMode: FocusMode): void;<br>setFocusPoint(point: Point): void;<br>getFocusPoint(): Point;<br>getFocalLength(): number;<br>getZoomRatioRange(): Array<number>;<br>getZoomRatio(): number;<br>setZoomRatio(zoomRatio: number): void;<br>isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;<br>getActiveVideoStabilizationMode(): VideoStabilizationMode;<br>setVideoStabilizationMode(mode: VideoStabilizationMode): void;<br>on(type: 'error', callback: ErrorCallback<BusinessError>): void; | Yes | Added |
| ohos.multimedia.camera | CaptureSession | beginConfig(callback: AsyncCallback<void>): void;<br>beginConfig(): Promise<void>;<br>addInput(cameraInput: CameraInput, callback: AsyncCallback<void>): void;<br>addInput(cameraInput: CameraInput): Promise<void>;<br>removeInput(cameraInput: CameraInput, callback: AsyncCallback<void>): void;<br>removeInput(cameraInput: CameraInput): Promise<void>;<br>addOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void;<br>addOutput(cameraOutput: CameraOutput): Promise<void>;<br>removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void;<br>removeOutput(cameraOutput: CameraOutput): Promise<void>;<br>hasFlash(callback: AsyncCallback<boolean>): void;<br>hasFlash(): Promise<boolean>;<br>isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean>): void;<br>isFlashModeSupported(flashMode: FlashMode): Promise<boolean>;<br>getFlashMode(callback: AsyncCallback<FlashMode>): void;<br>getFlashMode(): Promise<FlashMode>;<br>setFlashMode(flashMode: FlashMode, callback: AsyncCallback<void>): void;<br>setFlashMode(flashMode: FlashMode): Promise<void>;<br>isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback<boolean>): void;<br>isExposureModeSupported(aeMode: ExposureMode): Promise<boolean>;<br>getExposureMode(callback: AsyncCallback<ExposureMode>): void;<br>getExposureMode(): Promise<ExposureMode>;<br>setExposureMode(aeMode: ExposureMode, callback: AsyncCallback<void>): void;<br>setExposureMode(aeMode: ExposureMode): Promise<void>;<br>getMeteringPoint(callback: AsyncCallback<Point>): void;<br>getMeteringPoint(): Promise<Point>;<br>setMeteringPoint(point: Point, callback: AsyncCallback<void>): void;<br>setMeteringPoint(point: Point): Promise<void>;<br>getExposureBiasRange(callback: AsyncCallback<Array<number>>): void;<br>getExposureBiasRange(): Promise<Array<number>>;<br>setExposureBias(exposureBias: number, callback: AsyncCallback<void>): void;<br>setExposureBias(exposureBias: number): Promise<void>;<br>getExposureValue(callback: AsyncCallback<number>): void;<br>getExposureValue(): Promise<number>;<br>isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean>): void;<br>isFocusModeSupported(afMode: FocusMode): Promise<boolean>;<br>getFocusMode(callback: AsyncCallback<FocusMode>): void;<br>getFocusMode(): Promise<FocusMode>;<br>setFocusMode(afMode: FocusMode, callback: AsyncCallback<void>): void;<br>setFocusMode(afMode: FocusMode): Promise<void>;<br>setFocusPoint(point: Point, callback: AsyncCallback<void>): void;<br>setFocusPoint(point: Point): Promise<void>;<br>getFocusPoint(callback: AsyncCallback<Point>): void;<br>getFocusPoint(): Promise<Point>;<br>getFocalLength(callback: AsyncCallback<number>): void;<br>getFocalLength(): Promise<number>;<br>getZoomRatioRange(callback: AsyncCallback<Array<number>>): void;<br>getZoomRatioRange(): Promise<Array<number>>;<br>getZoomRatio(callback: AsyncCallback<number>): void;<br>getZoomRatio(): Promise<number>;<br>setZoomRatio(zoomRatio: number, callback: AsyncCallback<void>): void;<br>setZoomRatio(zoomRatio: number): Promise<void>;<br>isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback<boolean>): void;<br>isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise<boolean>;<br>getActiveVideoStabilizationMode(callback: AsyncCallback<VideoStabilizationMode>): void;<br>getActiveVideoStabilizationMode(): Promise<VideoStabilizationMode>;<br>setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback<void>): void;<br>setVideoStabilizationMode(mode: VideoStabilizationMode): Promise<void>;<br>on(type: 'error', callback: ErrorCallback<CaptureSessionError>): void; | Yes | Deprecated |
| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_UNKNOWN = -1<br>ERROR_INSUFFICIENT_RESOURCES = 0<br>ERROR_TIMEOUT = 1 | Yes | Deprecated |
| ohos.multimedia.camera | CaptureSessionError | code: CaptureSessionErrorCode | Yes | Deprecated |
| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback<BusinessError>): void; | Yes | Added |
| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback<PreviewOutputError>): void; | Yes | Deprecated |
| ohos.multimedia.camera | PreviewOutputErrorCode | ERROR_UNKNOWN = -1 | Yes | Deprecated |
| ohos.multimedia.camera | PreviewOutputError | code: PreviewOutputErrorCode | Yes | Deprecated |
| ohos.multimedia.camera | PhotoOutput | capture(): Promise<void>;<br>isMirrorSupported(): boolean;<br>on(type: 'error', callback: ErrorCallback<BusinessError>): void; | Yes | Added |
| ohos.multimedia.camera | PhotoOutput | isMirrorSupported(callback: AsyncCallback<boolean>): void;<br>isMirrorSupported(): Promise<boolean>;<br>on(type: 'error', callback: ErrorCallback<PhotoOutputError>): void; | Yes | Deprecated |
| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_UNKNOWN = -1<br>ERROR_DRIVER_ERROR = 0<br>ERROR_INSUFFICIENT_RESOURCES = 1<br>ERROR_TIMEOUT = 2 | Yes | Deprecated |
| ohos.multimedia.camera | PhotoOutputError | code: PhotoOutputErrorCode | Yes | Deprecated |
| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback<BusinessError>): void; | Yes | Added |
| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback<VideoOutputError>): void; | Yes | Deprecated |
| ohos.multimedia.camera | VideoOutputErrorCode | ERROR_UNKNOWN = -1<br>ERROR_DRIVER_ERROR = 0 | Yes | Deprecated |
| ohos.multimedia.camera | VideoOutputError | code: VideoOutputErrorCode | Yes | Deprecated |
| ohos.multimedia.camera | MetadataObject | readonly type: MetadataObjectType;<br>readonly timestamp: number; | Yes | Added |
| ohos.multimedia.camera | MetadataObject | getType(callback: AsyncCallback<MetadataObjectType>): void;<br>getType(): Promise<MetadataObjectType>;<br>getTimestamp(callback: AsyncCallback<number>): void;<br>getTimestamp(): Promise<number>;<br>getBoundingBox(callback: AsyncCallback<Rect>): void;<br>getBoundingBox(): Promise<Rect>; | Yes | Deprecated |
| ohos.multimedia.camera | MetadataFaceObject | readonly boundingBox: Rect | Yes | Added |
| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback<BusinessError>): void; | Yes | Added |
| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback<BusinessError>): void; | Yes | Deprecated |
| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1<br>ERROR_INSUFFICIENT_RESOURCES = 0 | Yes | Deprecated |
| ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode | Yes | Deprecated |
**Adaptation Guide**
In addition to new APIs and deprecated APIs, you need to adapt your application to changed APIs.
In Beta4 and later versions, the following APIs are changed.
**New APIs**
1. **CameraErrorCode** enums
Enum: INVALID_ARGUMENT; value: 7400101
Enum: OPERATION_NOT_ALLOWED; value: 7400102
Enum: SESSION_NOT_CONFIG; value: 7400103
Enum: SESSION_NOT_RUNNING; value: 7400104
Enum: SESSION_CONFIG_LOCKED; value: 7400105
Enum: DEVICE_SETTING_LOCKED; value: 7400106
Enum: CONFILICT_CAMERA; value: 7400107
Enum: DEVICE_DISABLED; value: 7400108
Enum: SERVICE_FATAL_ERROR; value: 7400201
2. Added **capture(): Promise<void>** to the **PhotoOutput** API.
3. Added the readonly type **MetadataObjectType** to the **MetadataObject** API.
4. Added **readonly timestamp: number** to the **MetadataObject** API.
5. Added **readonly boundingBox: Rect** to the **MetadataObject** API.
**Deprecated APIs**
1. Deprecated the **release(callback: AsyncCallback<void>): void** and **release(): Promise<void>** APIs in **CameraInput**.
2. Deprecated the **CameraInputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_NO_PERMISSION** = **0**, **ERROR_DEVICE_PREEMPTED** = **1**, **ERROR_DEVICE_DISCONNECTED** = **2**, **ERROR_DEVICE_IN_USE** = **3**, **ERROR_DRIVER_ERROR** = **4**
3. Deprecated the **CameraInputError** API and its attribute **CameraInputErrorCode**.
4. Deprecated the **CaptureSessionErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_INSUFFICIENT_RESOURCES** = **0**, **ERROR_TIMEOUT** = **1**
5. Deprecated the **CaptureSessionError** API and its attribute **CaptureSessionErrorCode**.
6. Deprecated the **PreviewOutputErrorCode** enum and its value: **ERROR_UNKNOWN** = **-1**
7. Deprecated the **PreviewOutputError** API and its attribute **PreviewOutputErrorCode**.
8. Deprecated the **PhotoOutputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_DRIVER_ERROR** = **0**, **ERROR_INSUFFICIENT_RESOURCES** = **1**, **ERROR_TIMEOUT** = **2**
9. Deprecated the **PhotoOutputError** API and its attribute **PhotoOutputErrorCode**.
10. Deprecated the **VideoOutputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_DRIVER_ERROR** = **0**
11. Deprecated the **VideoOutputError** API and its attribute **VideoOutputErrorCode**.
12. Deprecated **getType(callback: AsyncCallback<MetadataObjectType>): void** in the **MetadataObject** API.
13. Deprecated **getType(): Promise<MetadataObjectType>** in the **MetadataObject** API.
14. Deprecated **getTimestamp(callback: AsyncCallback<number>): void** in the **MetadataObject** API.
15. Deprecated **getTimestamp(): Promise<number>** in the **MetadataObject** API.
16. Deprecated **getBoundingBox(callback: AsyncCallback<Rect>): void** in the **MetadataObject** API.
17. Deprecated **getBoundingBox(): Promise<Rect>** in the **MetadataObject** API.
18. Deprecated the **MetadataOutputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_INSUFFICIENT_RESOURCES** = **0**
19. Deprecated the **MetadataOutputError** API and its attribute **MetadataOutputErrorCode**.
**Changed APIs**
1. Changed the return modes of the **getCameraManager** API in the camera module from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getCameraManager(context: Context, callback: AsyncCallback<CameraManager>): void** and **getCameraManager(context: Context): Promise<CameraManager>** are changed to **getCameraManager(context: Context): CameraManager**.
The code snippet is as follows:
```
let cameraManager = camera.getCameraManager(context);
```
2. Changed the return modes of the **getSupportedCameras** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getSupportedCameras(callback: AsyncCallback<Array<CameraDevice>>): void** and **getSupportedCameras(): Promise<Array<CameraDevice>>** are changed to **getSupportedCameras(): Array<CameraDevice>**.
The code snippet is as follows:
```
let cameras = cameraManager.getSupportedCameras();
```
3. Changed the return modes of the **getSupportedOutputCapability** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback<CameraOutputCapability>): void** and **getSupportedOutputCapability(camera: CameraDevice): Promise<CameraOutputCapability>** are changed to **getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability**.
The code snippet is as follows:
```
let cameraDevice = cameras[0];
let CameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice);
```
4. Changed the return modes of the **createCameraInput(camera: CameraDevice)** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createCameraInput(camera: CameraDevice, callback: AsyncCallback<CameraInput>): void** and **createCameraInput(camera: CameraDevice): Promise<CameraInput>** are changed to **createCameraInput(camera: CameraDevice): CameraInput**.
The code snippet is as follows:
```
let cameraDevice = cameras[0];
let cameraInput = cameraManager.createCameraInput(cameraDevice);
```
5. Changed the return modes of the **createCameraInput(position: CameraPosition, type: CameraType)** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback<CameraInput>): void** and **createCameraInput(position: CameraPosition, type: CameraType): Promise<CameraInput>** are changed to **createCameraInput(position: CameraPosition, type: CameraType): CameraInput**.
The code snippet is as follows:
```
let cameraDevice = cameras[0];
let position = cameraDevice.cameraPosition;
let type = cameraDevice.cameraType;
let cameraInput = cameraManager.createCameraInput(position, type);
```
6. Changed the return modes of the **createPreviewOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PreviewOutput>): void** and **createPreviewOutput(profile: Profile, surfaceId: string): Promise<PreviewOutput>** are changed to **createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput**.
The code snippet is as follows:
```
let profile = cameraoutputcapability.previewProfiles[0];
let previewOutput = cameraManager.createPreviewOutput(profile, surfaceId);
```
7. Changed the return modes of the **createPhotoOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback<PhotoOutput>): void** and **createPhotoOutput(profile: Profile, surfaceId: string): Promise<PhotoOutput>** are changed to **createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput**.
The code snippet is as follows:
```
let profile = cameraoutputcapability.photoProfiles[0];
let photoOutput = cameraManager.createPhotoOutput(profile, surfaceId);
```
8. Changed the return modes of the **createVideoOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback<VideoOutput>): void** and **createVideoOutput(profile: VideoProfile, surfaceId: string): Promise<VideoOutput>** are changed to **createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput**.
The code snippet is as follows:
```
let profile = cameraoutputcapability.videoProfiles[0];
let videoOutput = cameraManager.createVideoOutput(profile, surfaceId);
```
9. Changed the return modes of the **createMetadataOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>, callback: AsyncCallback<MetadataOutput>): void** and **createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): Promise<MetadataOutput>** are changed to **createMetadataOutput(metadataObjectTypes: Array<MetadataObjectType>): MetadataOutput**.
The code snippet is as follows:
```
let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes;
let metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes);
```
10. Changed the return modes of the **createCaptureSession** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createCaptureSession(callback: AsyncCallback<CaptureSession>): void** and **createCaptureSession(): Promise<CaptureSession>** are changed to **createCaptureSession(): CaptureSession**.
The code snippet is as follows:
```
let captureSession = cameraManager.createCaptureSession();
```
11. Changed the enum **CAMERA_TYPE_UNSPECIFIED** of **CameraType** to **CAMERA_TYPE_DEFAULT**.
12. Changed the return value type of the **on** API in CameraInput from **CameraInputError** to **BusinessError**. Therefore, the original API **on(type: 'error', camera: CameraDevice, callback: ErrorCallback<CameraInputError>): void** is changed to **on(type: 'error', camera: CameraDevice, callback: ErrorCallback<BusinessError>): void**.
The code snippet is as follows:
```
let cameraDevice = cameras[0];
cameraInput.on('error', cameraDevice, (BusinessError) => {
})
```
13. Changed the return modes of the **beginConfig** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **beginConfig(callback: AsyncCallback<void>): void** and **beginConfig(): Promise<void>** are changed to **beginConfig(): void**.
The code snippet is as follows:
```
captureSession.beginConfig();
```
14. Changed the return modes of the **addInput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **addInput(cameraInput: CameraInput, callback: AsyncCallback<void>): void** and **addInput(cameraInput: CameraInput): Promise<void>** are changed to **addInput(cameraInput: CameraInput): void**.
The code snippet is as follows:
```
captureSession.addInput(cameraInput);
```
15. Changed the return modes of the **removeInput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **removeInput(cameraInput: CameraInput, callback: AsyncCallback<void>): void** and **removeInput(cameraInput: CameraInput): Promise<void>** are changed to **removeInput(cameraInput: CameraInput): void**.
The code snippet is as follows:
```
captureSession.removeInput(cameraInput);
```
16. Changed the return modes of the **addOutput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **addOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void** and **addOutput(cameraOutput: CameraOutput): Promise<void>** are changed to **addOutput(cameraOutput: CameraOutput): void**.
The code snippet is as follows:
```
captureSession.addOutput(previewOutput);
```
17. Changed the return modes of the **removeOutput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback<void>): void** and **removeOutput(cameraOutput: CameraOutput): Promise<void>** are changed to **removeOutput(cameraOutput: CameraOutput): void**.
The code snippet is as follows:
```
captureSession.removeOutput(previewOutput);
```
18. Changed the return modes of the **hasFlash** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **hasFlash(callback: AsyncCallback<boolean>): void** and **hasFlash(): Promise<boolean>** are changed to **hasFlash(): boolean**.
The code snippet is as follows:
```
let status = captureSession.hasFlash();
```
19. Changed the return modes of the **isFlashModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback<boolean>): void** and **isFlashModeSupported(flashMode: FlashMode): Promise<boolean>** are changed to **isFlashModeSupported(flashMode: FlashMode): boolean**.
The code snippet is as follows:
```
let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO);
```
20. Changed the return modes of the **getFlashMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFlashMode(callback: AsyncCallback<FlashMode>): void** and **getFlashMode(): Promise<FlashMode>** are changed to **getFlashMode(): FlashMode**.
The code snippet is as follows:
```
let flashMode = captureSession.getFlashMode();
```
21. Changed the return modes of the **isExposureModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback<boolean>): void** and **isExposureModeSupported(aeMode: ExposureMode): Promise<boolean>** are changed to **isExposureModeSupported(aeMode: ExposureMode): boolean**.
The code snippet is as follows:
```
let isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
```
22. Changed the return modes of the **getExposureMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getExposureMode(callback: AsyncCallback<ExposureMode>): void** and **getExposureMode(): Promise<ExposureMode>** are changed to **getExposureMode(): ExposureMode**.
The code snippet is as follows:
```
let exposureMode = captureSession.getExposureMode();
```
23. Changed the return modes of the **setExposureMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setExposureMode(aeMode: ExposureMode, callback: AsyncCallback<void>): void** and **setExposureMode(aeMode: ExposureMode): Promise<void>** are changed to **setExposureMode(aeMode: ExposureMode): void**.
The code snippet is as follows:
```
captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
```
24. Changed the return modes of the **getMeteringPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getMeteringPoint(callback: AsyncCallback<Point>): void** and **getMeteringPoint(): Promise<Point>** are changed to **getMeteringPoint(): Point**.
The code snippet is as follows:
```
let exposurePoint = captureSession.getMeteringPoint();
```
25. Changed the return modes of the **setMeteringPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setMeteringPoint(point: Point, callback: AsyncCallback<void>): void** and **setMeteringPoint(point: Point): Promise<void>** are changed to **setMeteringPoint(point: Point): void**.
The code snippet is as follows:
```
let Point2 = {x: 2, y: 2};
captureSession.setMeteringPoint(Point2);
```
26. Changed the return modes of the **getExposureBiasRange** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getExposureBiasRange(callback: AsyncCallback<Array<number>>): void** and **getExposureBiasRange(): Promise<Array<number>>** are changed to **getExposureBiasRange(): Array<number>**.
The code snippet is as follows:
```
let biasRangeArray = captureSession.getExposureBiasRange();
```
27. Changed the return modes of the **setExposureBias** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setExposureBias(exposureBias: number, callback: AsyncCallback<void>): void** and **setExposureBias(exposureBias: number): Promise<void>** are changed to **setExposureBias(exposureBias: number): void**.
The code snippet is as follows:
```
let exposureBias = biasRangeArray[0];
captureSession.setExposureBias(exposureBias);
```
28. Changed the return modes of the **getExposureValue** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getExposureValue(callback: AsyncCallback<number>): void** and **getExposureValue(): Promise<number>** are changed to **getExposureValue(): number**.
The code snippet is as follows:
```
let exposureValue = captureSession.getExposureValue();
```
29. Changed the return modes of the **isFocusModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback<boolean>): void** and **isFocusModeSupported(afMode: FocusMode): Promise<boolean>** are changed to **isFocusModeSupported(afMode: FocusMode): boolean**.
The code snippet is as follows:
```
let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO);
```
30. Changed the return modes of the **getFocusMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFocusMode(callback: AsyncCallback<FocusMode>): void** and **getFocusMode(): Promise<FocusMode>** are changed to **getFocusMode(): FocusMode**.
The code snippet is as follows:
```
let afMode = captureSession.getFocusMode();
```
31. Changed the return modes of the **setFocusMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setFocusMode(afMode: FocusMode, callback: AsyncCallback<void>): void** and **setFocusMode(afMode: FocusMode): Promise<void>** are changed to **setFocusMode(afMode: FocusMode): void**.
The code snippet is as follows:
```
captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO);
```
32. Changed the return modes of the **setFocusPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setFocusPoint(point: Point, callback: AsyncCallback<void>): void** and **setFocusPoint(point: Point): Promise<void>** are changed to **setFocusPoint(point: Point): void**.
The code snippet is as follows:
```
let Point2 = {x: 2, y: 2};
captureSession.setFocusPoint(Point2);
```
33. Changed the return modes of the **getFocusPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFocusPoint(callback: AsyncCallback<Point>): void** and **getFocusPoint(): Promise<Point>** are changed to **getFocusPoint(): Point**.
The code snippet is as follows:
```
let point = captureSession.getFocusPoint();
```
34. Changed the return modes of the **getFocalLength** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFocalLength(callback: AsyncCallback<number>): void** and **getFocalLength(): Promise<number>** are changed to **getFocalLength(): number**.
The code snippet is as follows:
```
let focalLength = captureSession.getFocalLength();
```
35. Changed the return modes of the **getZoomRatioRange** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getZoomRatioRange(callback: AsyncCallback<Array<number>>): void** and **getZoomRatioRange(): Promise<Array<number>>** are changed to **getZoomRatioRange(): Array<number>**.
The code snippet is as follows:
```
let zoomRatioRange = captureSession.getZoomRatioRange();
```
36. Changed the return modes of the **getZoomRatio** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getZoomRatio(callback: AsyncCallback<number>): void** and **getZoomRatio(): Promise<number>** are changed to **getZoomRatio(): number**.
The code snippet is as follows:
```
let zoomRatio = captureSession.getZoomRatio();
```
37. Changed the return modes of the **setZoomRatio** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setZoomRatio(zoomRatio: number, callback: AsyncCallback<void>): void** and **setZoomRatio(zoomRatio: number): Promise<void>** are changed to **setZoomRatio(zoomRatio: number): void**.
The code snippet is as follows:
```
let zoomRatio = zoomRatioRange[0];
captureSession.setZoomRatio(zoomRatio);
```
38. Changed the return modes of the **isVideoStabilizationModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback<boolean>): void** and **isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise<boolean>** are changed to **isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean**.
The code snippet is as follows:
```
let isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF);
```
39. Changed the return modes of the **getActiveVideoStabilizationMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getActiveVideoStabilizationMode(callback: AsyncCallback<VideoStabilizationMode>): void** and **getActiveVideoStabilizationMode(): Promise<VideoStabilizationMode>** are changed to **getActiveVideoStabilizationMode(): VideoStabilizationMode**.
The code snippet is as follows:
```
let vsMode = captureSession.getActiveVideoStabilizationMode();
```
40. Changed the return modes of the **setVideoStabilizationMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback<void>): void** and **setVideoStabilizationMode(mode: VideoStabilizationMode): Promise<void>** are changed to **setVideoStabilizationMode(mode: VideoStabilizationMode): void**.
The code snippet is as follows:
```
captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF);
```
41. Changed the **on(type:'error') callback** type in CaptureSession from **ErrorCallback<CaptureSessionError>** to **ErrorCallback<BusinessError>**. Therefore, the original API **on(type: 'error', callback: ErrorCallback<CaptureSessionError>): void** is changed to **on(type: 'error', callback: ErrorCallback<BusinessError>): void**.
The code snippet is as follows:
```
captureSession.on('error', (BusinessError) => {
})
```
42. Changed the **on(type:'error') callback** type in PreviewOutput, from **ErrorCallback<PreviewOutputError>** to **ErrorCallback<BusinessError>**. Therefore, the original API **on(type: 'error', callback: ErrorCallback<PreviewOutputError>): void** is changed to **on(type: 'error', callback: ErrorCallback<BusinessError>): void**.
The code snippet is as follows:
```
previewOutput.on('error', (BusinessError) => {
})
```
43. Changed the return modes of the **isMirrorSupported** API in PhotoOutput from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isMirrorSupported(callback: AsyncCallback<boolean>): void** and **isMirrorSupported(): Promise<boolean>** are changed to **isMirrorSupported(): boolean**.
The code snippet is as follows:
```
let isSupported = photoOutput.isMirrorSupported();
```
44. Changed the **on(type:'error') callback** type in PhotoOutput, from **ErrorCallback<PhotoOutputError>** to **ErrorCallback<BusinessError>**. Therefore, the original API **on(type: 'error', callback: ErrorCallback<PhotoOutputError>): void** is changed to **on(type: 'error', callback: ErrorCallback<BusinessError>): void**.
The code snippet is as follows:
```
PhotoOutput.on('error', (BusinessError) => {
})
```
45. Changed the **on(type:'error') callback** type in VideoOutput, from **ErrorCallback<VideoOutputError>** to **ErrorCallback<BusinessError>**. Therefore, the original API **on(type: 'error', callback: ErrorCallback<VideoOutputError>): void** is changed to **on(type: 'error', callback: ErrorCallback<BusinessError>): void**.
The code snippet is as follows:
```
VideoOutput.on('error', (BusinessError) => {
})
```
46. Changed the **on(type:'error') callback** type in MetadataOutput, from **ErrorCallback<MetadataOutputError>** to **ErrorCallback<BusinessError>**. Therefore, the original API **on(type: 'error', callback: ErrorCallback<MetadataOutputError>): void** is changed to **on(type: 'error', callback: ErrorCallback<BusinessError>): void**.
The code snippet is as follows:
```
MetadataOutput.on('error', (BusinessError) => {
})
```
\ No newline at end of file
# Common Library Subsystem Changelog
## cl.commonlibrary.1 Error Code and Information Change
The error codes and information returned by APIs of the **ArrayList**, **List**, **LinkedList**, **Stack**, **Queue**, **Deque**, **PlainArray**, **LightWeightMap**, **LightWeightSet**, **HashMap**, **HashSet**, **TreeMap**, and **TreeSet** classes are changed.
For details about the changed error codes, see [Utils Error Codes](../../../application-dev/reference/errorcodes/errorcode-utils.md).
No adaptation is required for applications developed using these APIs.
**Key API/Component Changes**
Error code information is redefined for APIs in these classes and marked using **'@throws'** in the *.d.ts file of the corresponding module.
The sample code is as follows:
**ArrayList** class before the change:
constructor();
**ArrayList** class after the change:
@throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked.
constructor();
**Change Impact**
No impact.
# Distributed Data Management Subsystem JS API Changelog
## cl.distributeddatamgr.1 API Change
Changed the APIs in **kv_store** of the distributed data management subsystem:
Changed the **createKVManager()** implementation from asynchronous mode to synchronous mode because the execution duration is fixed and short.
Before change:<br>**createKVManager(config: KVManagerConfig): Promise\<KVManager\>;**<br>**createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void;**<br>After change:<br>**createKVManager(config: KVManagerConfig): KVManager;**
You need to adapt your application.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): Promise\<KVManager\>; | Deleted |
| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): KVManager; | Changed |
**Adaptation Guide**
The following illustrates how to call **createKVManager** to create a **KVManager** object.
Stage model:
```ts
import AbilityStage from '@ohos.application.Ability'
let kvManager;
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate")
let context = this.context
const kvManagerConfig = {
context: context,
bundleName: 'com.example.datamanagertest',
}
try {
kvManager = distributedKVStore.createKVManager(kvManagerConfig);
} catch (e) {
console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`);
}
}
}
```
FA model:
```ts
import featureAbility from '@ohos.ability.featureAbility'
let kvManager;
let context = featureAbility.getContext()
const kvManagerConfig = {
context: context,
bundleName: 'com.example.datamanagertest',
}
try {
kvManager = distributedKVStore.createKVManager(kvManagerConfig);
} catch (e) {
console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`);
}
```
## cl.distributeddatamgr.2 Move of getRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
Moved **getRdbStoreV9()** from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts, and renamed it **getRdbStore()**.
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
APIs:
```ts
function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback<RdbStoreV9>): void;
function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise<RdbStoreV9>;
```
Moved the above APIs from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
```
function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<RdbStore>): void;
function getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore>;
```
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change the names of the **getRdbStore()** APIs.
## cl.distributeddatamgr.3 Move of deleteRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
Moved **deleteRdbStoreV9()** from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts, and renamed it **deleteRdbStore()**.
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
APIs:
```ts
function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void;
function deleteRdbStoreV9(context: Context, name: string): Promise<void>;
```
Moved the above APIs from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
```
function deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void;
function deleteRdbStore(context: Context, name: string): Promise<void>;
```
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change the names of the **deleteRdbStoreV9()** APIs.
## cl.distributeddatamgr.4 Move of StoreConfigV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved **StoreConfigV9** from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **StoreConfig**.
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change the **StoreConfigV9** in APIs.
## cl.distributeddatamgr.5 Move of enum SecurityLevel from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved **enum SecurityLevel** from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
**Adaptation Guide**
Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
## cl.distributeddatamgr.6 Mover of RdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved **RdbStoreV9** from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **RdbStore**.
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change **RdbStoreV9** in relevant APIs.
## cl.distributeddatamgr.7 Move of class RdbPredicatesV9 from ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved the class **RdbPredicatesV9** from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **RdbPredicates**.
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change **RdbPredicatesV9** in the relevant APIs.
## cl.distributeddatamgr.8 Move of ResultSetV9 from api/@ohos.data.relationalStore.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved **ResultSetV9** from **api/data/rdb/resultSet.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **ResultSet**.
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Obtain the **ResultSetV9** instance only by using **getRdbStoreV9**. After modifications are made according to cl.distributeddatamgr.2, the code can automatically adapt to **ResultSet**.
# File Management Subsystem Changelog
## cl.filemanagement.1 environment Module Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **environment** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **environment** module supports error code processing.
**Key API/Component Changes**
Before the change, **environment** was imported from **@ohos.environment**:
```js
import environment from '@ohos.environment';
```
Now, **environment** is imported from **@ohos.file.environment**:
```js
import environment from '@ohos.file.environment';
```
## cl.filemanagement.2 securityLabel Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **securityLabel** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **securityLabel** module supports error code processing.
**Key API/Component Changes**
Before the change, **securityLabel** was imported from **@ohos.securityLabel**:
```js
import securityLabel from '@ohos.securityLabel';
```
Now, **securityLabel** is imported from **@ohos.file.securityLabel**:
```js
import securityLabel from '@ohos.file.securityLabel';
```
## cl.filemanagement.3 fs Change
Changed the **ino** attribute type of **Stat** under **fs**.
**Change Impact**
The **ino** attribute type is changed from number to BigInt, to adapt to the **inode** range of all types of files in the file system.
**Key API/Component Changes**
The type of the **ino** attribute of **Stat** is changed from number to BigInt.
## cl.filemanagement.4 fileAccess Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **fileAccess** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **fileAccess** module supports error code processing.
**Key API/Component Changes**
Before the change, **fileAccess** was imported from **@ohos.data.fileAccess**:
```js
import fileAccess from '@ohos.data.fileAccess';
```
Now, **fileAccess** is imported from **@ohos.file.fileAccess**:
```js
import fileAccess from '@ohos.file.fileAccess';
```
## cl.filemanagement.5 fileExtensionInfo Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **fileExtensionInfo** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **fileExtensionInfo** module supports error code processing.
**Key API/Component Changes**
Before the change, **fileExtensionInfo** was imported from **@ohos.fileExtensionInfo**:
```js
import fileExtensionInfo from '@ohos.fileExtensionInfo';
```
Now, **fileExtensionInfo** is imported from **@ohos.file.fileExtensionInfo**:
```js
import fileExtensionInfo from '@ohos.file.fileExtensionInfo';
```
## cl.filemanagement.6 storageStatistics Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **fileExtensionInfo** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **storageStatistics** module supports error code processing.
**Key API/Component Changes**
Before the change, **storageStatistics** was imported from **@ohos.storageStatistics**:
```js
import storageStatistics from '@ohos.storageStatistics';
```
Now, **storageStatistics** is imported from **@ohos.file.storageStatistics**:
```js
import storageStatistics from '@ohos.file.storageStatistics';
```
## cl.filemanagement.7 volumeManager Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **fileExtensionInfo** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **volumeManager** module supports error code processing.
**Key API/Component Changes**
Before the change, **volumeManager** was imported from **@ohos.volumeManager**:
```js
import volumeManager from '@ohos.volumeManager';
```
Now, **volumeManager** is imported from **@ohos.file.volumeManager**:
```js
import volumeManager from '@ohos.file.volumeManager';
```
# Input Method Framework ChangeLog
## cl.inputmethod_frameworks.1 API Filename Change
The following modules do not comply with the OpenHarmony API file naming rules. Therefore, they are modified in API version 9 and later.
**Change Impacts**
The SDK after the change is incompatible with the earlier versions. Therefore, adaptation is required for applications developed in earlier versions so that they can be properly built with the SDK in the new version.
**Key API/Component Changes**
| Module| File Name Before Change| File Name After Change|
|------|--------------|--------------|
| Input method framework module| @ohos.inputmethod.d.ts |@ohos.inputMethod.d.ts |
| Input method service module|@ohos.inputmethodengine.d.ts | @ohos.inputMethodEngine.d.ts |
| Input method ExtentionAbility module| @ohos.inputmethodextensionability.d.ts | @ohos.InputMethodExtensionAbility.d.ts |
| Input method ExtentionContext module|@ohos.inputmethodextensioncontext.d.ts | @ohos.InputMethodExtensionContext.d.ts |
| Input method subtype module| @ohos.inputMethodSubtype.d.ts | @ohos.InputMethodSubtype.d.ts |
**Adaptation Guide**
In the application code, change the name of the d.ts file following **import** to the new file name, which complies with the UpperCamelCase or lowerCamelCase style.
Example:
```js
import inputMethodEngine from '@ohos.inputMethodEngine';
```
# File Management Subsystem Changelog
## cl.file.1 mediaLibrary APIs Changed
The **MediaLibrary** class of the multimedia component is replaced by the **FilePicker** class.
**Change Impact**
For applications developed based on earlier versions, pay attention to the changes of APIs. **FilePicker** is a system application preset in OpenHarmony. You can use it to select and save files.
**Key API/Component Changes**
The APIs of **MediaLibrary**, located in **@ohos.multimedia.medialibrary**, are deprecated. The **FilePicker** class, located in [@ohos.file.picker](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.file.picker.d.ts) is used.
| Module | Method/Attribute/Enum/Constant | Change Type|
| ------------------------- | ------------------------------------------------------------ | -------- |
| medialibrary | **function** getMediaLibrary(): MediaLibrary; | Deprecated |
| medialibrary | **function** getMediaLibrary(context: Context): MediaLibrary; | Deprecated |
| medialibrary | **function** getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult\>): void | Deprecated |
| medialibrary | **function** getFileAssets(options: MediaFetchOptions): Promise\<FetchFileResult\> | Deprecated |
| medialibrary | **function** on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void\>): void | Deprecated |
| medialibrary | **function** off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void\>): void | Deprecated |
| medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\<FileAsset\>): void | Deprecated |
| medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\<FileAsset\> | Deprecated |
| medialibrary | **function** deleteAsset(uri: string): Promise\<void\> | Deprecated |
| medialibrary | **function** deleteAsset(uri: string, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** getPublicDirectory(type: DirectoryType, callback: AsyncCallback\<string\>): void | Deprecated |
| medialibrary | **function** getPublicDirectory(type: DirectoryType): Promise\<string\> | Deprecated |
| medialibrary | **function** getAlbums(options: MediaFetchOptions, callback: AsyncCallback\<Array\<Album\>\>): void | Deprecated |
| medialibrary | **function** getAlbums(options: MediaFetchOptions): Promise\<Array\<Album\>\> | Deprecated |
| medialibrary | **function** release(callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** release(): Promise\<void\> | Deprecated |
| medialibrary | **function** storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback\<string\>): void | Deprecated |
| medialibrary | **function** storeMediaAsset(option: MediaAssetOption): Promise\<string\> | Deprecated |
| medialibrary | **function** startImagePreview(images: Array\<string\>, index: number, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** startImagePreview(images: Array\<string\>, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** startImagePreview(images: Array\<string\>, index?: number): Promise\<void\> | Deprecated |
| medialibrary | **function** startMediaSelect(option: MediaSelectOption, callback: AsyncCallback\<Array\<string\>\>): void | Deprecated |
| medialibrary | **function** startMediaSelect(option: MediaSelectOption): Promise\<Array\<string\>\> | Deprecated |
| medialibrary | **function** getActivePeers(): Promise\<Array\<PeerInfo\>\>; | Deprecated |
| medialibrary | **function** getActivePeers(callback: AsyncCallback\<Array\<PeerInfo\>\>): void; | Deprecated |
| medialibrary | **function** getAllPeers(): Promise\<Array\<PeerInfo\>\>; | Deprecated |
| medialibrary | **function** FileAsset.isDirectory(callback: AsyncCallback\<boolean\>): void | Deprecated |
| medialibrary | **function** FileAsset.isDirectory():Promise\<boolean\> | Deprecated |
| medialibrary | **function** FileAsset.commitModify(callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.commitModify(): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.open(mode: string, callback: AsyncCallback\<number\>): void | Deprecated |
| medialibrary | **function** FileAsset.open(mode: string): Promise\<number\> | Deprecated |
| medialibrary | **function** FileAsset.close(fd: number, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.close(fd: number): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.getThumbnail(callback: AsyncCallback\<image.PixelMap\>): void | Deprecated |
| medialibrary | **function** FileAsset.getThumbnail(size: Size, callback: AsyncCallback\<image.PixelMap\>): void | Deprecated |
| medialibrary | **function** FileAsset.getThumbnail(size?: Size): Promise\<image.PixelMap\> | Deprecated |
| medialibrary | **function** FileAsset.favorite(isFavorite: boolean, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.favorite(isFavorite: boolean): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.isFavorite(callback: AsyncCallback\<boolean\>): void | Deprecated |
| medialibrary | **function** FileAsset.isFavorite():Promise\<boolean\> | Deprecated |
| medialibrary | **function** FileAsset.trash(isTrash: boolean, callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** FileAsset.trash(isTrash: boolean): Promise\<void\> | Deprecated |
| medialibrary | **function** FileAsset.isTrash(callback: AsyncCallback\<boolean\>): void | Deprecated |
| medialibrary | **function** FileAsset.isTrash():Promise\<boolean\> | Deprecated |
| medialibrary | **function** FetchFileResult.getCount(): number | Deprecated |
| medialibrary | **function** FetchFileResult.isAfterLast(): boolean | Deprecated |
| medialibrary | **function** FetchFileResult.close(): void | Deprecated |
| medialibrary | **function** FetchFileResult.getFirstObject(callback: AsyncCallback\<FileAsset\>): void | Deprecated |
| medialibrary | **function** FetchFileResult.getFirstObject(): Promise\<FileAsset\> | Deprecated |
| medialibrary | **function** FetchFileResult.getNextObject(callback: AsyncCallback\<FileAsset\>): void | Deprecated |
| medialibrary | **function** FetchFileResult.getNextObject(): Promise\<FileAsset\> | Deprecated |
| medialibrary | **function** FetchFileResult.getLastObject(callback: AsyncCallback\<FileAsset\>): void | Deprecated |
| medialibrary | **function** FetchFileResult.getLastObject(): Promise\<FileAsset\> | Deprecated |
| medialibrary | **function** FetchFileResult.getPositionObject(index: number, callback: AsyncCallback\<FileAsset\>): void | Deprecated |
| medialibrary | **function** FetchFileResult.getPositionObject(index: number): Promise\<FileAsset\> | Deprecated |
| medialibrary | **function** FetchFileResult.getAllObject(callback: AsyncCallback\<Array\<FileAsset\>\>): void | Deprecated |
| medialibrary | **function** FetchFileResult.getAllObject(): Promise\<Array\<FileAsset\>\> | Deprecated |
| medialibrary | **function** Album.commitModify(callback: AsyncCallback\<void\>): void | Deprecated |
| medialibrary | **function** Album.commitModify(): Promise\<void\> | Deprecated |
| medialibrary | **function** Album.getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult\>): void | Deprecated |
| medialibrary | **function** Album.getFileAssets(options?: MediaFetchOptions): Promise\<FetchFileResult\> | Deprecated |
| medialibrary | **enum** DeviceType | Deprecated |
| medialibrary | **enum** FileKey | Deprecated |
| medialibrary | **enum** DirectoryType | Deprecated |
| medialibrary | **enum** MediaType | Deprecated |
| medialibrary | **interface** PeerInfo | Deprecated |
| medialibrary | **interface** Size | Deprecated |
| medialibrary | **interface** MediaFetchOptions | Deprecated |
| medialibrary | **interface** MediaAssetOption | Deprecated |
| medialibrary | **interface** MediaSelectOption | Deprecated |
| medialibrary | **interface** FileAsset | Deprecated |
**Adaptation Guide**
For example, refer to the code snippet below to call an API to select an image:
```js
import picker from '@ohos.file.picker';
async function example() {
try {
let PhotoSelectOptions = new picker.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoSelectOptions.maxSelectNumber = 1;
let photoPicker = new picker.PhotoViewPicker();
photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => {
if (PhotoSelectResult !== undefined) {
console.info("PhotoViewPicker.select pass, PhotoSelectResult uri: " + JSON.stringify(PhotoSelectResult));
} else {
console.error("PhotoViewPicker.select PhotoSelectResult is undefined");
}
}).catch((err) => {
console.error("PhotoViewPicker.select fail, err: " + err);
});
} catch (err) {
console.error("PhotoViewPicker fail, err: " + err);
}
}
```
## cl.multimedia.av_session.001 Change of All av_session APIs to System APIs
All av_session APIs are changed to system APIs.
**Change Impact**
Non-system applications and applications without system API permission cannot call system APIs.
**Key API/Component Changes**
All APIs are changed to system APIs. The table below describes the APIs.
| API/Enum/Variable| Type| Is System API|
| -------- | -------- | ------- |
| SessionToken | interface | Yes|
| AVMetadata | interface | Yes|
| AVPlaybackState | interface | Yes|
| PlaybackPosition | interface | Yes|
| OutputDeviceInfo | interface | Yes|
| AVSessionDescriptor | interface | Yes|
| AVSessionController | interface | Yes|
| AVControlCommand | interface | Yes|
| createAVSession | function | Yes|
| getAllSessionDescriptors | function | Yes|
| createController | function | Yes|
| castAudio | function | Yes|
| on | function | Yes|
| off | function | Yes|
| sendSystemAVKeyEvent | function | Yes|
| sendSystemControlCommand | function | Yes|
| sessionId | variable | Yes|
| setAVMetadata | function | Yes|
| setAVPlaybackState | function | Yes|
| setLaunchAbility | function | Yes|
| getController | function | Yes|
| getOutputDevice | function | Yes|
| activate | function | Yes|
| deactivate | function | Yes|
| destroy | function | Yes|
| getAVPlaybackState | function | Yes|
| getAVMetadata | function | Yes|
| getOutputDevice | function | Yes|
| sendAVKeyEvent | function | Yes|
| getLaunchAbility | function | Yes|
| getRealPlaybackPositionSync | function | Yes|
| isActive | function | Yes|
| getValidCommands | function | Yes|
| sendControlCommand | function | Yes|
| AVSessionType | type | Yes|
| AVControlCommandType | type | Yes|
| LoopMode | enum | Yes|
| PlaybackState | enum | Yes|
| AVSessionErrorCode | enum | Yes|
# Changelog of NFC JS APIs in the Communication Subsystem
## cl.nfc.1 API Change
Deprecated some NFC JS APIs in API versions 6 to 8 because the APIs cannot throw error codes, and added new APIs in API version 9 instead.
You need to adapt your application based on the following information.
**Change Impact**
The deprecated JS APIs in API versions 6 to 8 are affected. Your application needs to adapt new APIs so that it can properly implement functions in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type|
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| api/@ohos.nfc.cardEmulation.d.ts | cardEmulation | FeatureType | Deprecated |
| api/@ohos.nfc.cardEmulation.d.ts | cardEmulation | isSupported | Deprecated |
| api/@ohos.nfc.cardEmulation.d.ts | cardEmulation | hasHceCapability | Added |
| api/@ohos.nfc.controller.d.ts | nfcController | isNfcAvailable | Deprecated |
| api/@ohos.nfc.controller.d.ts | nfcController | openNfc | Deprecated |
| api/@ohos.nfc.controller.d.ts | nfcController | closeNfc | Deprecated |
| api/@ohos.nfc.controller.d.ts | nfcController | enableNfc | Added |
| api/@ohos.nfc.controller.d.ts | nfcController | disableNfc | Added |
| api/@ohos.nfc.tag.d.ts | tag | getNfcATag | Deprecated |
| api/@ohos.nfc.tag.d.ts | tag | getNfcBTag | Deprecated |
| api/@ohos.nfc.tag.d.ts | tag | getNfcFTag | Deprecated |
| api/@ohos.nfc.tag.d.ts | tag | getNfcVTag | Deprecated |
| api/@ohos.nfc.tag.d.ts | tag | getNfcA | Added |
| api/@ohos.nfc.tag.d.ts | tag | getNfcB | Added |
| api/@ohos.nfc.tag.d.ts | tag | getNfcF | Added |
| api/@ohos.nfc.tag.d.ts | tag | getNfcV | Added |
| api/tag/tagSession.d.ts | TagSession | getTagInfo | Deprecated |
| api/tag/tagSession.d.ts | TagSession | connectTag | Deprecated |
| api/tag/tagSession.d.ts | TagSession | reset | Deprecated |
| api/tag/tagSession.d.ts | TagSession | isTagConnected | Deprecated |
| api/tag/tagSession.d.ts | TagSession | setSendDataTimeout | Deprecated |
| api/tag/tagSession.d.ts | TagSession | getSendDataTimeout | Deprecated |
| api/tag/tagSession.d.ts | TagSession | sendData | Deprecated |
| api/tag/tagSession.d.ts | TagSession | getMaxSendLength | Deprecated |
| api/tag/tagSession.d.ts | TagSession | connect | Added |
| api/tag/tagSession.d.ts | TagSession | resetConnection | Added |
| api/tag/tagSession.d.ts | TagSession | isConnected | Added |
| api/tag/tagSession.d.ts | TagSession | setTimeout | Added |
| api/tag/tagSession.d.ts | TagSession | getTimeout | Added |
| api/tag/tagSession.d.ts | TagSession | transmit | Added |
| api/tag/tagSession.d.ts | TagSession | getMaxTransmitSize | Added |
**Adaptation Guide**
See the following:
[@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](../../../application-dev/reference/apis/js-apis-cardEmulation.md)
[@ohos.nfc.controller (Standard NFC)](../../../application-dev/reference/apis/js-apis-nfcController.md)
[@ohos.nfc.tag (Standard NFC Tags)](../../../application-dev/reference/apis/js-apis-nfcTag.md)
[tagSession (Standard NFC Tag Session)](../../../application-dev/reference/apis/js-apis-tagSession.md)
```
# Common Event and Notification Subsystem ChangeLog
## cl.notification.1 Deleting Deprecated APIs (Version 9)
In the event notification exception handling rectification, some APIs in API version 9 are marked as deprecated, and these APIs need to be deleted, according to OpenHarmony API specifications.
**Change Impacts**
The application developed based on earlier versions needs to use new APIs to replace the deleted ones. Otherwise, the application compilation will be affected.
**Key API/Component Changes**
Deprecated APIs in API version 9 will be deleted, and they will be replaced with new ones with same names.
| Original API | New API |
| ----------------------- | -------------------------------- |
| @ohos.commonEvent.d.ts | @ohos.commonEventManager.d.ts |
| @ohos.notification.d.ts | @ohos.notificationManager.d.ts |
| @ohos.notification.d.ts | @ohos.notificationSubscribe.d.ts |
APIs or attributes are deleted:
- @ohos.notification.d.ts
- The **publishAsBundle**, **cancelAsBundle**, **isNotificationSlotEnabled**, **setSyncNotificationEnabledWithoutApp**, and **getSyncNotificationEnabledWithoutApp** APIs are deleted. Replace them with APIs with same names in **api/@ohos.notificationManager.d.ts**.
- The **enableNotificationSlot** API is deleted. Replace it with **setNotificationEnableSlot** in **api/@ohos.notificationManager.d.ts**.
- The export classes **NotificationActionButton**, **NotificationBasicContent**, **NotificationContent**, **NotificationLongTextContent**, **NotificationMultiLineContent**, **NotificationPictureContent**, **NotificationFlags**, **NotificationFlagStatus**, **NotificationRequest**, **DistributedOptions**, **NotificationSlot**, **NotificationSorting**, **NotificationTemplate**, and **NotificationUserInput** are deleted. Replace them with the export classes with the same names in **api/@ohos.notificationManager.d.ts**.
- The export classes **NotificationSubscribeInfo**, **NotificationSubscriber**, **SubscribeCallbackData**, and **EnabledNotificationCallbackData** are deleted. Replace them with the export classes with the same names in **api/@ohos.notificationSubscribe.d.ts**.
**Adaptation Guide**
The original APIs are only migrated to the new namespace. Therefore, you can modify **import** to solve the adaptation problem.
If the original API uses **@ohos.commonEvent**:
```js
import commonEvent from '@ohos.commonEvent';
```
You can directly modify **import** to switch to the new namespace:
```js
import commonEvent from '@ohos.commonEventManager';
```
**@ohos.notification** is split into two namespaces. You need to select a new namespace for adaptation.
In addition, exception handling is needed. For details, see the API reference for the new APIs.
# Location Subsystem Changelog
## cl.location.1 API Migration from @ohos.geolocation.d.ts to @ohos.geoLocationManager.d.ts
APIs in **@ohos.geolocation.d.ts** do not support throwing error codes. To support this function, all APIs in **@ohos.geolocation.d.ts** are migrated to the newly added **@ohos.geoLocationManager.d.ts** file, and corresponding error code description is added.
To use APIs of the location subsystem, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Change Impact**
All APIs of the location subsystem are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Key API/Component Changes**
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
|geolocation| method | function on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'locationChange', callback?: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'locationServiceState', callback: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'locationServiceState'** to **type: 'locationEnabledChange'**.|
|geolocation| method | function off(type: 'locationServiceState', callback?: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'locationServiceState'** to **type: 'locationEnabledChange'**.|
|geolocation| method | function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'cachedGnssLocationsReporting'** to **type: 'cachedGnssLocationsChange'**.|
|geolocation| method | function off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'cachedGnssLocationsReporting'** to **type: 'cachedGnssLocationsChange'**.|
|geolocation| method | function on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'gnssStatusChange'** to **type: 'satelliteStatusChange'**.|
|geolocation| method | function off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'gnssStatusChange'** to **type: 'satelliteStatusChange'**.|
|geolocation| method | function on(type: 'nmeaMessageChange', callback: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'nmeaMessageChange'** to **type: 'nmeaMessage'**.|
|geolocation| method | function off(type: 'nmeaMessageChange', callback?: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'nmeaMessageChange'** to **type: 'nmeaMessage'**.|
|geolocation| method | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'fenceStatusChange'** to **type: 'gnssFenceStatusChange'**.|
|geolocation| method | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed **type: 'fenceStatusChange'** to **type: 'gnssFenceStatusChange'**.|
|geolocation| method | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getLastLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function getLastLocation(): Location**.|
|geolocation| method | function getLastLocation(): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function getLastLocation(): Location**.|
|geolocation| method | function isLocationEnabled(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationEnabled(): boolean**.|
|geolocation| method | function isLocationEnabled(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationEnabled(): boolean**.|
|geolocation| method | function requestEnableLocation(callback: AsyncCallback<boolean>): void; | Deleted.|
|geolocation| method | function requestEnableLocation(): Promise<boolean>; | Deleted.|
|geolocation| method | function enableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function disableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocation(): void**.|
|geolocation| method | function disableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocation(): void**.|
|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isGeoServiceAvailable(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isGeocoderAvailable(): boolean**.|
|geolocation| method | function isGeoServiceAvailable(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isGeocoderAvailable(): boolean**.|
|geolocation| method | function getCachedGnssLocationsSize(callback: AsyncCallback<number>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCachedGnssLocationsSize(): Promise<number>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function flushCachedGnssLocations(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function flushCachedGnssLocations(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function sendCommand(command: LocationCommand): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocationMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableLocationMock(): void**.|
|geolocation| method | function enableLocationMock(): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableLocationMock(): void**.|
|geolocation| method | function disableLocationMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocationMock(): void**.|
|geolocation| method | function disableLocationMock(): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableLocationMock(): void**.|
|geolocation| method | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setMockedLocations(config: LocationMockConfig): void**.|
|geolocation| method | function setMockedLocations(config: LocationMockConfig): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setMockedLocations(config: LocationMockConfig): void**.|
|geolocation| method | function enableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableReverseGeocodingMock(): void**.|
|geolocation| method | function enableReverseGeocodingMock(): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function enableReverseGeocodingMock(): void**.|
|geolocation| method | function disableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableReverseGeocodingMock(): void**.|
|geolocation| method | function disableReverseGeocodingMock(): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function disableReverseGeocodingMock(): void**.|
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>, callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): void**.|
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): void**.|
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean**.|
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType,): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean**.|
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback<void>): void; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void**.|
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise<void>; | Migrated to **@ohos.geoLocationManager.d.ts** and changed to **function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void**.|
|geolocation| interface | SatelliteStatusInfo | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | CachedGnssLocationsRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeofenceRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | Geofence | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | ReverseGeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeoAddress | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | LocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | CurrentLocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | Location | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationRequestPriority | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationRequestScenario | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | GeoLocationErrorCode | Deprecated.|
|geolocation| enum | LocationPrivacyType | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationCommand | Migrated to **@ohos.geoLocationManager.d.ts**.|
**(Optional) Adaptation Guide**
The following sample code shows how to call **enableLocation** in the new version:
```ts
import geoLocationManager from '@ohos.geoLocationManager';
try {
geoLocationManager.enableLocation((err, data) => {
if (err) {
console.log('enableLocation: err=' + JSON.stringify(err));
}
});
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
# Location Subsystem Changelog
## cl.location.1 API Migration from @ohos.geolocation.d.ts to @ohos.geoLocationManager.d.ts
APIs in **@ohos.geolocation.d.ts** do not support throwing error codes. To support this function, all APIs in **@ohos.geolocation.d.ts** are migrated to the newly added **@ohos.geoLocationManager.d.ts** file, and corresponding error code description is added.
To use APIs of the location subsystem, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Change Impact**
All APIs of the location subsystem are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Key API/Component Changes**
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
|geolocation| namespace | declare namespace geolocation| Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **namespace geoLocationManager**.|
|geolocation| method | function on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'locationChange', callback?: Callback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'locationServiceState', callback: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'locationServiceState', callback?: Callback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'nmeaMessageChange', callback: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'nmeaMessageChange', callback?: Callback<string>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getLastLocation(callback: AsyncCallback<Location>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getLastLocation(): Promise<Location>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isLocationEnabled(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isLocationEnabled(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function requestEnableLocation(callback: AsyncCallback<boolean>): void; | Deleted.|
|geolocation| method | function requestEnableLocation(): Promise<boolean>; | Deleted.|
|geolocation| method | function enableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function disableLocation(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function disableLocation(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isGeoServiceAvailable(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function isGeoServiceAvailable(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCachedGnssLocationsSize(callback: AsyncCallback<number>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCachedGnssLocationsSize(): Promise<number>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function flushCachedGnssLocations(callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function flushCachedGnssLocations(): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>): void; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function sendCommand(command: LocationCommand): Promise<boolean>; | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | SatelliteStatusInfo | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | CachedGnssLocationsRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeofenceRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | Geofence | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | ReverseGeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeoCodeRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | GeoAddress | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | LocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | CurrentLocationRequest | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| interface | Location | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationRequestPriority | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationRequestScenario | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | GeoLocationErrorCode | Deprecated.|
|geolocation| enum | LocationPrivacyType | Migrated to **@ohos.geoLocationManager.d.ts**.|
|geolocation| enum | LocationCommand | Migrated to **@ohos.geoLocationManager.d.ts**.|
**(Optional) Adaptation Guide**
The following sample code shows how to call **enableLocation** in the new version:
```ts
import geoLocationManager from '@ohos.geoLocationManager';
try {
geoLocationManager.enableLocation((err, data) => {
if (err) {
console.log('enableLocation: err=' + JSON.stringify(err));
}
});
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
# Upload and Download Subsystem Changelog
## cl.request.2 Upload and Download API Change
- Deleted the beta APIs in API version 9:
1. function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void;
2. function download(context: BaseContext, config: DownloadConfig): Promise<DownloadTask>;
3. function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void;
4. function upload(context: BaseContext, config: UploadConfig): Promise<UploadTask>;
**Change Impact**
The application developed based on the Stage mode of earlier versions needs to be adapted. Otherwise, the service logic will be affected.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type|
|--------------|--------------|-------------------------------------------------------------------------------------------------------------------|------|
| ohos.request | request | function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void; | Deleted. |
| ohos.request | request | function download(context: BaseContext, config: DownloadConfig): Promise<DownloadTask>; | Deleted. |
| ohos.request | request | function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void; | Deleted. |
| ohos.request | request | function upload(context: BaseContext, config: UploadConfig): Promise<UploadTask>; | Deleted. |
**Adaptation Guide**
The following sample code shows how to call **downloadFile** in the new version:
```ts
try {
request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxxx.hap',
filePath: 'xxx/xxxxx.hap'}, (err, data) => {
if (err) {
console.error('Failed to request the download. Cause: ' + JSON.stringify(err));
return;
}
});
} catch (err) {
console.log("downloadFile callback fail." + "errCode:" + err.code + ",errMessage:" + err.message);
}
```
# Resource Scheduler Subsystem Changelog
## cl.resourceschedule.backgroundTaskManager
Rectified the original APIs of **backgroundTaskManager** of the resource scheduler subsystem. All APIs of API version 9 in the **@ohos.backgroundTaskManager.d.ts** file are deleted, and the APIs of API version 9 in the **@ohos.resourceschedule.backgroundTaskManager.d.ts** file are used. The new APIs in API version 9 comply with the error code specifications.
**Change Impacts**
If your application is developed based on the SDK versions of OpenHarmony 3.2.10.5 and later, adapt to the modules and APIs in API version 9 and the pattern for returning error codes. Otherwise, the service logic will be affected.
**Key API/Component Changes**
The following methods, attributes, enums, and constants are changed in API version 9 and later versions. All the APIs in the **@ohos.backgroundTaskManager.d.ts** file are migrated to the **@ohos.resourceschedule.backgroundTaskManager.d.ts** file.
| Class| API Type| Declaration| Description|
| -- | -- | -- | -- |
| backgroundTaskManager | method | function resetAllEfficiencyResources(): void; | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager | method | function applyEfficiencyResources(request: EfficiencyResourcesRequest): bool; | Changed in API version 9 to **function applyEfficiencyResources(request: EfficiencyResourcesRequest): void;** and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.ResourceType | enum | export enum ResourceType | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.ResourceType | enum | CPU = 1 | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.ResourceType | enum | COMMON_EVENT = 1 << 1 | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.ResourceType | enum | TIMER = 1 << 2 | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.ResourceType | enum | WORK_SCHEDULER = 1 << 3 | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.ResourceType | enum | BLUETOOTH = 1 << 4 | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.ResourceType | enum | GPS = 1 << 5 | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.ResourceType | enum | AUDIO = 1 << 6 | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.EfficiencyResourcesRequest | interface | export interface EfficiencyResourcesRequest | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.EfficiencyResourcesRequest | field | reason: string | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.EfficiencyResourcesRequest | field | isProcess?: bool | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.EfficiencyResourcesRequest | field | isPersist?: bool | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.EfficiencyResourcesRequest | field | timeOut: number | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.EfficiencyResourcesRequest | field | isApply: bool | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
| backgroundTaskManager.EfficiencyResourcesRequest | field | resourceTypes: number | Deleted in API version 9 and moved to the **ohos.resourceschedule.backgroundTaskManager.d.ts** file.|
**Adaptation Guide**
Import the **backgroundTaskManager** module.
```
import bundle form '@ohos.resourceschedule.backgroundTaskManager'
```
Exception handling also needs to be adapted. For details, see the [backgroundTaskManager API reference](../../../application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md).
## c2.resourceschedule.workScheduler
Rectified the original APIs of **workScheduler** of the resource scheduler subsystem. All APIs of API version 9 in the **@ohos.workScheduler.d.ts** file are deleted, and the APIs of API version 9 in the **@ohos.resourceschedule.workScheduler.d.ts** file are used. The new APIs in API version 9 comply with the error code specifications.
**Change Impacts**
If your application is developed based on the SDK versions of OpenHarmony 3.2.10.5 and later, adapt to the modules and APIs in API version 9 and the pattern for returning error codes. Otherwise, the service logic will be affected.
**Key API/Component Changes**
The following methods, attributes, enums, and constants are changed in API version 9 and later versions. The **@ohos.workScheduler.d.ts** file is deleted, and all the APIs in it are moved to the **@ohos.resourceschedule.workScheduler.d.ts** file.
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
| workScheduler | namespace | declare namespace workScheduler | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | interface | export interface WorkInfo | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | parameters?: {[key: string]: any} | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | idleWaitTime?: number | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | isDeepIdle?: boolean | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | repeatCount?: number | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | isRepeat?: boolean | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | repeatCycleTime?: number | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | storageRequest?: StorageRequest | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | batteryStatus?: BatteryStatus | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | batteryLevel?: number | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | chargerType?: ChargingType | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | isCharging?: boolean | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | networkType?: NetworkType | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | isPersisted?: boolean | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | abilityName: string | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | bundleName: string | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.WorkInfo | field | workId: number | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler | method | function isLastWorkTimeOut(workId: number): Promise; | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler | method | function isLastWorkTimeOut(workId: number, callback: AsyncCallback<void>): boolean; | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler | method | function stopAndClearWorks(): boolean; | Changed in API version 8 to **function stopAndClearWorks(): boolean;** and moved to the **ohos.resourceschedule.workScheduler.d.ts** file|
| workScheduler | method | function obtainAllWorks(): Promise<Array<WorkInfo>>; | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler | method | function obtainAllWorks(callback: AsyncCallback<void>): Array<WorkInfo>; | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler | method | function getWorkStatus(workId: number): Promise<WorkInfo>; | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler | method | function getWorkStatus(workId: number, callback: AsyncCallback<WorkInfo>): void; | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler | method | function stopWork(work: WorkInfo, needCancel?: boolean): boolean; | Changed in API version 8 to **function stopWork(work: WorkInfo, needCancel?: boolean): void;** and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler | method | function startWork(work: WorkInfo): boolean; | Changed in API version 9 to **function startWork(work: WorkInfo): void;** and moved to the **ohos.resourceschedule.workScheduler.d.ts** file|
| workScheduler.NetworkType | enum | export enum NetworkType | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.NetworkType | enum | NETWORK_TYPE_ANY = 0 | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.NetworkType | enum | NETWORK_TYPE_MOBILE | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.NetworkType | enum | NETWORK_TYPE_BLUETOOTH | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.NetworkType | enum | NETWORK_TYPE_WIFI_P2P | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.NetworkType | enum | NETWORK_TYPE_ETHERNET | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.ChargingType | enum | export enum ChargingType | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.ChargingType | enum | CHARGING_PLUGGED_ANY = 0 | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.ChargingType | enum | CHARGING_PLUGGED_AC | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.ChargingType | enum | CHARGING_PLUGGED_USB | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.ChargingType | enum | CHARGING_PLUGGED_WIRELESS | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.BatteryStatus | enum | export enum BatteryStatus | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW = 0 | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.BatteryStatus | enum | BATTERY_STATUS_OKAY | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.BatteryStatus | enum | BATTERY_STATUS_LOW_OR_OKAY | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.StorageRequest | enum | export enum StorageRequest | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW = 0 | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_OKAY | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
| workScheduler.BatteryStatus | enum | STORAGE_LEVEL_LOW_OR_OKAY | Deleted in API version 9 and moved to the **ohos.resourceschedule.workScheduler.d.ts** file.|
**Adaptation Guide**
Import the **workScheduler** module.
```
import bundle form '@ohos.resourceschedule.workScheduler'
```
Exception handling also needs to be adapted. For details, see the [workScheduler API reference](../../../application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md).
# Security Subsystem Changelog
## cl.security.1 Change of setSeed() from Asynchronous to Synchronous
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API before the change:
setSeed(seed : DataBlob, callback : AsyncCallback\<void>) : void;
setSeed(seed : DataBlob) : Promise\<void>;
API after the change:
setSeed(seed : DataBlob) : void;
**Adaptation Guide**
See **setSeed()** in the following:
[Crypto Framework](../../../application-dev/reference/apis/js-apis-cryptoFramework.md)
## cl.security.2 Move of DataArray from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **DataArray** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.3 Move of EncodingFormat from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **EncodingFormat** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.4 Move of EncodingBlob from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **EncodingBlob** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.5 Move of CertChainData from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **interface CertChainData** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.6 Move of X509Cert from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **X509Cert** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.7 Move of createX509Cert from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **createX509Cert** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.8 Move of X509CrlEntry from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts.
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **X509CrlEntry** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.9 Move of X509Crl from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **X509Crl** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.10 Move of createX509Crl from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **createX509Crl** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.11 Move of CertChainValidator from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **CertChainValidator** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.12 Move of createCertChainValidator from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Moved **createCertChainValidator** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.13 Change of getPublicKey() of X509Cert from Asynchronous to Synchronous
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API before the change:
getPublicKey(callback : AsyncCallback\<PubKey>) : void;
getPublicKey() : Promise\<PubKey>;
API after the change:
getPublicKey() : cryptoFramework.PubKey;
**Adaptation Guide**
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.14 Change of checkValidityWithDate of X509Cert from Asynchronous to Synchronous
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API before the change:
checkValidityWithDate(date: string, callback : AsyncCallback\<void>) : void;
checkValidityWithDate(date: string) : Promise\<void>;
API after the change:
checkValidityWithDate(date: string) : void;
**Adaptation Guide**
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.15 Change of getCertIssuer of X509CrlEntry from Asynchronous to Synchronous
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API before the change:
getCertIssuer(callback : AsyncCallback\<DataBlob>) : void;
getCertIssuer() : Promise\<DataBlob>;
API after the change:
getCertIssuer() : DataBlob;
**Adaptation Guide**
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.16 Change of getRevocationDate of X509CrlEntry from Asynchronous to Synchronous
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API before the change:
getRevocationDate(callback : AsyncCallback\<string>) : void;
getRevocationDate() : Promise\<string>;
API after the change:
getRevocationDate() : string;
**Adaptation Guide**
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.17 Change of isRevoked of X509Crl from Asynchronous to Synchronous
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API before the change:
isRevoked(cert : X509Cert, callback : AsyncCallback\<boolean>) : void;
isRevoked(cert : X509Cert) : Promise\<boolean>;
API after the change:
isRevoked(cert : X509Cert) : boolean;
**Adaptation Guide**
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.18 Change of getRevokedCert of X509Crl from Asynchronous to Synchronous
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API before the change:
getRevokedCert(serialNumber : number, callback : AsyncCallback\<X509CrlEntry>) : void;
getRevokedCert(serialNumber : number) : Promise\<X509CrlEntry>;
API after the change:
getRevokedCert(serialNumber : number) : X509CrlEntry;
**Adaptation Guide**
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.19 Change of getRevokedCertWithCert of X509Crl from Asynchronous to Synchronous
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API before the change:
getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback\<X509CrlEntry>) : void;
getRevokedCertWithCert(cert : X509Cert) : Promise\<X509CrlEntry>;
API after the change:
getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry;
**Adaptation Guide**
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.20 Change of getTbsInfo of X509Crl from Asynchronous to Synchronous
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API before the change:
getTbsInfo(callback : AsyncCallback\<DataBlob>) : void;
getTbsInfo() : Promise\<DataBlob>;
API after the change:
getTbsInfo() : DataBlob;
**Adaptation Guide**
See the following API reference:
[Certificate](../../../application-dev/reference/apis/js-apis-cert.md)
## cl.security.21 Support of No-Hash Signing Mode for HUKS
Before the change, the application passes **huks.HuksTag.HUKS_TAG_DIGEST = huks.HuksKeyDigest.HUKS_DIGEST_NONE** and HUKS uses **huks.HuksKeyDigest.HUKS_DIGEST_SHA256** for processing by default. After the change, the application passes **huks.HuksTag.HUKS_TAG_DIGEST = huks.HuksKeyDigest.HUKS_DIGEST_NONE** and HUKS does not generate a digest by default. Instead, the service performs a hash operation on the original data and then passes a hashed digest to HUKS for signing or signature verification.
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that the signing or signature verification result can be passed before and after the change.
**Key API/Component Changes**
Released JavaScript APIs remain unchanged, but parameter sets passed to the APIs are changed.
The service uses the No-Hash signing mode, and hashes the original data and then passes a hashed digest to the signing or signature verification API of HUKS. In addition, the **huks.HuksTag.HUKS_TAG_DIGEST** parameter is set to **huks.HuksKeyDigest.HUKS_DIGEST_NONE**.
**Adaptation Guide**
The following uses signing as an example.
```js
import huks from '@ohos.security.huks';
let keyAlias = 'rsa_Key';
/* Digest value after SHA-256 encryption */
let inDataAfterSha256 = new Uint8Array(
0x4B, 0x1E, 0x22, 0x64, 0xA9, 0x89, 0x60, 0x1D, 0xEC, 0x78, 0xC0, 0x5D, 0xBE, 0x46, 0xAD, 0xCF,
0x1C, 0x35, 0x16, 0x11, 0x34, 0x01, 0x4E, 0x9B, 0x7C, 0x00, 0x66, 0x0E, 0xCA, 0x09, 0xC0, 0xF3,
);
/* Signing parameters */
let signProperties = new Array();
signProperties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_RSA,
}
signProperties[1] = {
tag: huks.HuksTag.HUKS_TAG_PURPOSE,
value:
huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN
}
signProperties[2] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048,
}
signProperties[3] = {
tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: huks.HuksKeyDigest.HUKS_DIGEST_NONE, // Set digest-none.
}
let signOptions = {
properties: signProperties,
inData: inDataAfterSha256 // Set the value after hashing.
}
huks.initSession(keyAlias, signOptions);
```
For for information about the sample code, see [HUKS Development](../../../application-dev/security/huks-guidelines.md) and [HUKS](../../../application-dev/reference/apis/js-apis-huks.md).
## cl.security.22 Support for Key Calculation Parameter Specifications During Key Usage
Before the change, all parameters for key calculation must be specified when the application generates a key. After the change, only mandatory parameters need to be specified when the application generates a key, and other parameters can be passed in when the key is used. The application can specify key calculation parameters more flexibly.
**Change Impact**
Behavior of released JavaScript APIs will be changed.
The application can specify only mandatory parameters when creating a key and specify other optional parameters when using the key.
**Key API/Component Changes**
Released JavaScript APIs remain unchanged, but parameter sets passed to the APIs are changed and parameters are classified into mandatory parameters and optional parameters. For details, see [HUKS Development](../../../application-dev/security/huks-guidelines.md).
huks.generateKeyItem
huks.importKeyItem
huks.importWrappedKeyItem
huks.initSession
huks.updateSession
huks.finishSession
**Adaptation Guide**
The following uses the key generation process as an example.
```js
let keyAlias = 'keyAlias';
let properties = new Array();
// Mandatory parameter.
properties[0] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_RSA
};
// Mandatory parameter.
properties[1] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048
};
// Mandatory parameter.
properties[2] = {
tag: huks.HuksTag.HUKS_TAG_PURPOSE,
value:
huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN |
huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY
};
// Optional parameter. If this parameter is not specified when a key is generated, it must be specified when the key is used.
properties[3] = {
tag: huks.HuksTag.HUKS_TAG_DIGEST,
value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256
};
let options = {
properties: properties
};
try {
huks.generateKeyItem(keyAlias, options, function (error, data) {
if (error) {
console.error(`callback: generateKeyItem failed, code: ${error.code}, msg: ${error.message}`);
} else {
console.info(`callback: generateKeyItem key success`);
}
});
} catch (error) {
console.error(`callback: generateKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`);
}
```
For for information about the sample code, see [HUKS Development](../../../application-dev/security/huks-guidelines.md) and [HUKS](../../../application-dev/reference/apis/js-apis-huks.md).
# Location Subsystem Changelog
## cl.location.1 API Migration from @system.geolocation.d.ts to @ohos.geoLocationManager.d.ts
APIs in **@system.geolocation.d.ts** do not support throwing error codes. To support this function, all APIs in **@system.geolocation.d.ts** are migrated to the newly added **@ohos.geoLocationManager.d.ts** file, and corresponding error code description is added.
To use APIs of the location subsystem, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Change Impact**
All APIs of the location subsystem are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Key API/Component Changes**
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
|Geolocation| class | Geolocation | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager**.|
|Geolocation| interface | static getLocation(options?: GetLocationOption): void; | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.getCurrentLocation**.|
|Geolocation| interface | static getLocationType(options?: GetLocationTypeOption): void; | Deprecated.|
|Geolocation| interface | static subscribe(options: SubscribeLocationOption): void; | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.on#event:locationChange**.|
|Geolocation| interface | static unsubscribe(): void; | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.off#event:locationChange**.|
|Geolocation| interface | static getSupportedCoordTypes(): Array<string>; | Deprecated.|
|| interface | GeolocationResponse| Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.Location**.|
|| interface | GetLocationOption | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest**.|
|| interface | GetLocationTypeResponse | Deprecated.|
|| interface | GetLocationTypeOption | Deprecated.|
|| interface | SubscribeLocationOption | Migrated to **@ohos.geoLocationManager.d.ts** and replaced by **ohos.geoLocationManager/geoLocationManager.LocationRequest**.|
**(Optional) Adaptation Guide**
The following sample code shows how to call **enableLocation** in the new version:
```ts
import geoLocationManager from '@ohos.geoLocationManager';
try {
geoLocationManager.enableLocation((err, data) => {
if (err) {
console.log('enableLocation: err=' + JSON.stringify(err));
}
});
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
# Telephony Subsystem Changelog
## cl.telephony.1 Radio Module API Change
### Changed the `isNrSupported` API in the radio module of the telephony subsystem:
NR is a proper noun and must be capitalized.
You need to adapt your application based on the following information.
**Change Impact**
The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected.
**Key API/Component Changes**
- Involved APIs:
isNrSupported(): boolean;
isNrSupported(slotId: number): boolean;
- Before change:
```js
function isNrSupported(): boolean;
function isNrSupported(slotId: number): boolean;
```
- After change:
```js
function isNRSupported(): boolean;
function isNRSupported(slotId: number): boolean;
```
**Adaptation Guide**
Use the new API. The sample code is as follows:
```js
let result = radio.isNrSupported();
console.log("Result: "+ result);
```
```js
let slotId = 0;
let result = radio.isNRSupported(slotId);
console.log("Result: "+ result);
```
# Time Subsystem ChangeLog
## cl.time.1 API Error Change
Errors thrown by timer APIs of the time subsystem: **202** (non-system application) and **401** (invalid parameters).
**Change Impacts**
The API change is forward compatible. Applications developed based on earlier versions can still use the APIs, and corresponding error handling is added. The original functions are not affected.
**Key API/Component Changes**
Before change:
- The API throws an error message without an error code.
After change:
- The API throws an error message with an error code. Error code **202** indicates that the application is not a system application, and error code **401** indicates that the parameters are invalid.
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type|
| ----------------- | ----------- | ------------------------------------------------------------ | -------- |
| @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions, callback: AsyncCallback\<number>): void | Changed |
| @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions): Promise\<number> | Changed |
| @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number, callback: AsyncCallback\<void>): void | Changed |
| @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number): Promise\<void> | Changed |
| @ohos.systemTimer | systemTimer | function stopTimer(timer: number, callback: AsyncCallback\<void>): void | Changed |
| @ohos.systemTimer | systemTimer | function stopTimer(timer: number): Promise\<void> | Changed |
| @ohos.systemTimer | systemTimer | function destroyTimer(timer: number, callback: AsyncCallback\<void>): void | Changed |
| @ohos.systemTimer | systemTimer | function destroyTimer(timer: number): Promise\<void> | Changed |
**Adaptation Guide**
Refer to the code below to capture errors when **systemTimer** APIs are called in applications.
createTimer callback mode:
**Example**
```js
export default {
systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false
};
try {
systemTimer.createTimer(options, (error, timerId) => {
if (error) {
// Capture the permission denial error.
console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`);
}
console.info(`Succeeded in creating timer. timerId: ${timerId}`);
});
} catch(e) {
// Capture the parameter verification error.
console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`);
}
}
}
```
createTimer promise mode:
**Example**
```js
export default {
systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false
};
try {
systemTimer.createTimer(options).then((timerId) => {
console.info(`Succeeded in creating timer. timerId: ${timerId}`);
}).catch((error) => {
// Capture the permission denial error.
console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`);
});
} catch(e) {
// Capture the parameter verification error.
console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`);
}
}
}
```
startTimer callback mode:
**Example**
```js
export default {
async systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
try {
systemTimer.startTimer(timerId, triggerTime, (error) => {
if (error) {
// Capture the permission denial error.
console.error(`Failed to start timer. message: ${error.message}, code: ${error.code}`);
}
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`);
}
}
}
```
startTimer promise mode:
**Example**
```js
export default {
async systemTimer (){
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
try {
systemTimer.startTimer(timerId, triggerTime).then((data) => {
console.log(`Succeeded in startting timer. Data:` + data);
}).catch((error) => {
// Capture the permission denial error.
console.info(`Failed to start timer. message: ${error.message}, code: ${error.code}`);
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`);
}
}
}
```
stopTimer callback mode:
**Example**
```js
export default {
async systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
systemTimer.startTimer(timerId, triggerTime);
try {
systemTimer.stopTimer(timerId, triggerTime, (error) => {
if (error) {
// Capture the permission denial error.
console.error(`Failed to stop timer. message: ${error.message}, code: ${error.code}`);
}
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`);
}
}
}git
```
stopTimer promise mode:
**Example**
```js
export default {
async systemTimer (){
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
systemTimer.startTimer(timerId, triggerTime);
try {
systemTimer.stopTimer(timerId, triggerTime).then((data) => {
console.log(`Succeeded in stop timer. Data:` + data);
}).catch((error) => {
// Capture the permission denial error.
console.info(`Failed to stop timer. message: ${error.message}, code: ${error.code}`);
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`);
}
}
}
```
destroyTimer callback mode:
**Example**
```js
export default {
async systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
systemTimer.startTimer(timerId, triggerTime);
systemTimer.stopTimer(timerId);
try {
systemTimer.destroyTimer(timerId, triggerTime, (error) => {
if (error) {
// Capture the permission denial error.
console.error(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`);
}
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to destroy timer. message: ${e.message}, code: ${e.code}`);
}
}
}
```
destroyTimer promise mode:
**Example**
```js
export default {
async systemTimer (){
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
systemTimer.startTimer(timerId, triggerTime);
systemTimer.stopTimer(timerId);
try {
systemTimer.destroyTimer(timerId, triggerTime).then((data) => {
console.log(`Succeeded in destroy timer. Data:` + data);
}).catch((error) => {
// Capture the permission denial error.
console.info(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`);
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to destroy timer. message: ${e.message}, code: ${e.code}`);
}
}
}
```
## cl.time.2 API Error Change
Errors thrown by timer APIs of the time subsystem: **201** (permission denied), **202** (non-system application), and **401** (invalid parameters).
**Change Impacts**
Applications developed based on earlier versions can still use the APIs. When new APIs are used, errors must be captured and processed.
**Key API/Component Changes**
Before change:
- The API throws an error message with error code **-1**.
After change:
- The API throws an error message with an error code. Error code **201** indicates that the permission is denied, error code **202** indicates that the application is not a system application, and error code **401** indicates that the parameters are invalid.
Deprecated APIs can be replaced with new ones with same names.
| Original API | New API |
| ---------------- | -------------------- |
| @ohos.systemTime | @ohos.systemDateTime |
**Adaptation Guide**
Refer to the code below to capture errors when **systemTime** APIs are called in applications. In the examples, the **setTime** API is invoked.
In callback mode:
**Example**
```js
import systemDateTime from @ohos.systemDateTime
// Set the system time to 2021-01-20 02:36:25.
let time = 1611081385000;
try {
systemDateTime.setTime(time, (error) => {
// Capture permission denial and non-system-application errors.
if (error) {
console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`);
return;
}
console.info(`Succeeded in setting time.`);
})
} catch(e) {
// Capture the parameter verification error.
console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`);
}
```
In promise mode:
**Example**
```js
import systemDateTime from @ohos.systemDateTime
// Set the system time to 2021-01-20 02:36:25.
let time = 1611081385000;
try {
systemDateTime.setTime(time).then(() => {
console.info(`Succeeded in setting time.`);
}).catch((error) => {
// Capture permission denial and non-system-application errors.
console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`);
});
} catch(e) {
// Capture the parameter verification error.
console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`);
}
```
# Common Library Subsystem Changelog
## cl.commonlibrary.1 URLParams Class Changes
The constructor function of the **URLParams** class in the URL module of the common library subsystem is changed.
Specifically, **constructor(init?: string[][] | Record<string, string> | string | URLSearchParams)** is changed to **constructor(init?: string[][] | Record<string, string> | string | URLParams)**, and the parameter type is changed from **URLSearchParams** to **URLParams**.
You need to adapt your application.
**Change Impacts**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| :------------------------ | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.url | URLParams | constructor(string[][] \| Record&lt;string, string&gt; \| string \| URLSearchParams) | Deleted |
| @ohos.url | URLParams | constructor(string[][] \| Record&lt;string, string&gt; \| string \| URLParams)| Changed |
**Adaptation Guide**
The following illustrates how to create a **URLParams** object in your application.
Example:
```ts
import url from '@ohos.url'
try {
let params1 = new Url.URLParams('?user=abc&query=xyz')
let params2 = new Url.URLParams(params1)
var result= params2.toString()
console.log(result) //"user=abc&query=xyz"
} catch (err) {
console.error(`Fail to ceate URLParams.codeis${err.code},message is ${err.message}`);
}
```
## cl.commonlibrary.2 URL Attribute Changes of URLParams Class APIs
The URL attributes of the URL module in the common library subsystem are changed.
Specifically, the **searchParams: URLSearchParams** attribute is deprecated, and the **params: URLParams** attribute is added.
You need to adapt your application.
**Change Impacts**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
| :------------------------ | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.url | URL | searchParams: URLSearchParams; |Deprecated (in API version 9)<br> |
| @ohos.url | URL | params: URLParams; | Added |
**Adaptation Guide**
The following illustrates how to create a **URLParams** object in your application.
Example:
```ts
import url from '@ohos.url'
let that = new Url.URL('http://username:password@host:8080/directory/file?Hello=china#qwer=da')
let params = that.URLParams
var result = params.toString()
console.log(result) //%E4%BD%A0%E5%A5%BD=china
```
# User IAM Subsystem Changelog
## cl.useriam.1 API9 Result Value Change
Changed the return value **ResultCodeV9** to **UserAuthResultCode** for API9.
**Change Impact**
Applications developed based on earlier versions are not affected. For the applications developed from this version, the class name of the error code needs to be adapted. Otherwise, the service logic is affected.
**Key API/Component Changes**
N/A
**Adaptation Guide**
Change the class name for invoking the authentication result code from **ResultCode** to **UserAuthResultCode**.
# Window Manager Subsystem Changelog
## cl.window.1 Change of Window Stage Lifecycle Listener Types
Changed the enumerated listener types of the window stage lifecycle in version 3.2.10.5 and later.
**Change Impacts**
Application lifecycle listeners developed using **FOREGROUND** and **BACKGROUND** in versions earlier than 3.2.10.5 will be invalidated in version 3.2.10.5 and later.
**Key API/Component Changes**
## WindowStageEventType<sup>9+</sup>
Before change
| Name | Value | Description |
| ---------- | ---- | ---------- |
| FOREGROUND | 1 | The window stage is running in the foreground.|
| BACKGROUND | 4 | The window stage is running in the background.|
After change
| Name | Value | Description |
| ------ | ---- | ---------- |
| SHOWN | 1 | The window stage is running in the foreground.|
| HIDDEN | 4 | The window stage is running in the background.|
**Adaptation Guide**
When registering lifecycle listeners, change the foreground and background event types to **SHOWN** and **HIDDEN**, respectively.
```
import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
try {
windowStage.on('windowStageEvent', (stageEventType) => {
switch (stageEventType) {
case window.WindowStageEventType.SHOWN:
console.log("windowStage shown");
break;
case window.WindowStageEventType.ACTIVE:
console.log("windowStage active");
break;
case window.WindowStageEventType.INACTIVE:
console.log("windowStage inActive");
break;
case window.WindowStageEventType.HIDDEN:
console.log("windowStage hidden");
break;
default:
break;
}
} )
} catch (exception) {
console.error('Failed to enable the listener for window stage event changes. Cause:' +
JSON.stringify(exception));
};
}
};
```
# OpenHarmony Third-Party Components
# Introduction to OpenHarmony Third-Party Components
OpenHarmony third-party components are verified software that work with the OpenHarmony system to facilitate your development of OpenHarmony devices or applications. Depending on the programming language they use, these components are classified as third-party JavaScript and TypeScript components or third-party C and C++ components. The third-party JavaScript and TypeScript components use the JavaScript or TypeScript programming language and are usually imported as source code or OpenHarmony HAR files. They are used in application development. The third-party C and C++ components use the C and C++ programming language and are usually imported as source code or OpenHarmony hpm packages. They are used as native APIs during application development or directly compiled in the OpenHarmony OS image during device development.
......
......@@ -3,7 +3,11 @@
- [OpenHarmony Project](OpenHarmony-Overview.md)
- [Glossary](glossary.md)
- Release Notes
- OpenHarmony 4.x Releases
- [OpenHarmony v4.0 Beta1 (2023-06-03)](release-notes/OpenHarmony-v4.0-beta1.md)
- OpenHarmony 3.x Releases
- [OpenHarmony v3.2 Release (2023-04-09)](release-notes/OpenHarmony-v3.2-release.md)
- [OpenHarmony v3.2.1 Release (2023-05-22)](release-notes/OpenHarmony-v3.2.1-release.md)
- [OpenHarmony v3.2 Beta5 (2023-01-30)](release-notes/OpenHarmony-v3.2-beta5.md)
- [OpenHarmony v3.2 Beta4 (2022-11-30)](release-notes/OpenHarmony-v3.2-beta4.md)
- [OpenHarmony v3.2 Beta3 (2022-09-30)](release-notes/OpenHarmony-v3.2-beta3.md)
......@@ -33,154 +37,290 @@
- [OpenHarmony v1.1.1 LTS (2021-06-22)](release-notes/OpenHarmony-1-1-1-LTS.md)
- [OpenHarmony v1.1.0 LTS (2021-04-01)](release-notes/OpenHarmony-1-1-0-LTS.md)
- API Differences
- OpenHarmony 4.0 Beta1
- JS API Differences
- [Ability](release-notes/api-diff/v4.0-beta1/js-apidiff-ability.md)
- [Accessibility](release-notes/api-diff/v4.0-beta1/js-apidiff-accessibility.md)
- [Account](release-notes/api-diff/v4.0-beta1/js-apidiff-account.md)
- [ArkUI](release-notes/api-diff/v4.0-beta1/js-apidiff-arkui.md)
- [Power Management](release-notes/api-diff/v4.0-beta1/js-apidiff-battery.md)
- [Bundle Management](release-notes/api-diff/v4.0-beta1/js-apidiff-bundle.md)
- [Communication](release-notes/api-diff/v4.0-beta1/js-apidiff-communication.md)
- [Compiler and Runtime](release-notes/api-diff/v4.0-beta1/js-apidiff-compiler-and-runtime.md)
- [Customization](release-notes/api-diff/v4.0-beta1/js-apidiff-customization.md)
- [Distributed Data Management](release-notes/api-diff/v4.0-beta1/js-apidiff-distributed-data.md)
- [Distributed Hardware](release-notes/api-diff/v4.0-beta1/js-apidiff-distributed-hardware.md)
- [File Management](release-notes/api-diff/v4.0-beta1/js-apidiff-file-management.md)
- [Location](release-notes/api-diff/v4.0-beta1/js-apidiff-geolocation.md)
- [Globalization](release-notes/api-diff/v4.0-beta1/js-apidiff-global.md)
- [Graphics](release-notes/api-diff/v4.0-beta1/js-apidiff-graphic.md)
- [Misc Software](release-notes/api-diff/v4.0-beta1/js-apidiff-misc.md)
- [MSDP](release-notes/api-diff/v4.0-beta1/js-apidiff-msdp.md)
- [Multimodal Input](release-notes/api-diff/v4.0-beta1/js-apidiff-multi-modal-input.md)
- [Multimedia](release-notes/api-diff/v4.0-beta1/js-apidiff-multimedia.md)
- [Common Event and Notification](release-notes/api-diff/v4.0-beta1/js-apidiff-notification.md)
- [Resource Scheduler](release-notes/api-diff/v4.0-beta1/js-apidiff-resource-scheduler.md)
- [Basic Security Service](release-notes/api-diff/v4.0-beta1/js-apidiff-security.md)
- [Pan-sensor](release-notes/api-diff/v4.0-beta1/js-apidiff-sensor.md)
- [Telephony](release-notes/api-diff/v4.0-beta1/js-apidiff-telephony.md)
- [Test](release-notes/api-diff/v4.0-beta1/js-apidiff-unitest.md)
- [Update](release-notes/api-diff/v4.0-beta1/js-apidiff-update.md)
- [User IAM](release-notes/api-diff/v4.0-beta1/js-apidiff-user-iam.md)
- [Web](release-notes/api-diff/v4.0-beta1/js-apidiff-web.md)
- [Window Manager](release-notes/api-diff/v4.0-beta1/js-apidiff-window.md)
- API Changelogs
- [Ability](release-notes/changelogs/v4.0-beta1/changelogs-ability.md)
- [Ability Access Control](release-notes/changelogs/v4.0-beta1/changelogs-accesstoken.md)
- [Account](release-notes/changelogs/v4.0-beta1/changelogs-account_os_account.md)
- [Notification](release-notes/changelogs/v4.0-beta1/changelogs-ans.md)
- [Compiler and Runtime](release-notes/changelogs/v4.0-beta1/changelogs-arkcompiler.md)
- [ArkUI](release-notes/changelogs/v4.0-beta1/changelogs-arkui.md)
- [Bluetooth](release-notes/changelogs/v4.0-beta1/changelogs-bluetooth.md)
- [Bundle Management](release-notes/changelogs/v4.0-beta1/changelogs-bundlemanager.md)
- [Common Event](release-notes/changelogs/v4.0-beta1/changelogs-ces.md)
- [Distributed Data Management](release-notes/changelogs/v4.0-beta1/changelogs-distributeddatamgr.md)
- [File Management](release-notes/changelogs/v4.0-beta1/changelogs-filemanagement.md)
- [Location](release-notes/changelogs/v4.0-beta1/changelogs-geoLocationManager.md)
- [Globalization](release-notes/changelogs/v4.0-beta1/changelogs-global.md)
- [Security - HUKS](release-notes/changelogs/v4.0-beta1/changelogs-huks.md)
- [Input Method Framework](release-notes/changelogs/v4.0-beta1/changelogs-imf.md)
- [Multimedia](release-notes/changelogs/v4.0-beta1/changelogs-media.md)
- [MISC Software](release-notes/changelogs/v4.0-beta1/changelogs-miscdevice.md)
- [Pasteboard](release-notes/changelogs/v4.0-beta1/changelogs-pasteboard.md)
- [Power Management](release-notes/changelogs/v4.0-beta1/changelogs-power.md)
- [Resource Scheduler](release-notes/changelogs/v4.0-beta1/changelogs-resourceschedule.md)
- [Theme Framework - Lock Screen](release-notes/changelogs/v4.0-beta1/changelogs-screenlock.md)
- [Basic Security Service](release-notes/changelogs/v4.0-beta1/changelogs-security.md)
- [Pan-sensor](release-notes/changelogs/v4.0-beta1/changelogs-sensor.md)
- [DSoftBus](release-notes/changelogs/v4.0-beta1/changelogs-softbus.md)
- [Startup Service](release-notes/changelogs/v4.0-beta1/changelogs-startup.md)
- [Telephony](release-notes/changelogs/v4.0-beta1/changelogs-telephony.md)
- [Test](release-notes/changelogs/v4.0-beta1/changelogs-testfwk_arkxtest.md)
- [USB](release-notes/changelogs/v4.0-beta1/changelogs-usb.md)
- [Theme Framework - Wallpaper](release-notes/changelogs/v4.0-beta1/changelogs-wallpaper.md)
- [Web](release-notes/changelogs/v4.0-beta1/changelogs-web.md)
- [WIFI](release-notes/changelogs/v4.0-beta1/changelogs-wifiManager.md)
- OpenHarmony 3.2 Release (Compared with OpenHarmony 3.1 Release)
- JS API Differences
- [Ability](release-notes/api-diff/v3.2-Release/js-apidiff-ability.md)
- [Accessibility](release-notes/api-diff/v3.2-Release/js-apidiff-accessibility.md)
- [Account](release-notes/api-diff/v3.2-Release/js-apidiff-account.md)
- [Application](release-notes/api-diff/v3.2-Release/js-apidiff-application.md)
- [ArkUI](release-notes/api-diff/v3.2-Release/js-apidiff-arkui.md)
- [Power Management](release-notes/api-diff/v3.2-Release/js-apidiff-battery.md)
- [Bundle Management](release-notes/api-diff/v3.2-Release/js-apidiff-bundle.md)
- [Communication](release-notes/api-diff/v3.2-Release/js-apidiff-communication.md)
- [Compiler and Runtime](release-notes/api-diff/v3.2-Release/js-apidiff-compiler-and-runtime.md)
- [Customization](release-notes/api-diff/v3.2-Release/js-apidiff-customization.md)
- [DFX](release-notes/api-diff/v3.2-Release/js-apidiff-dfx.md)
- [Distributed Data Management](release-notes/api-diff/v3.2-Release/js-apidiff-distributed-data.md)
- [Distributed Hardware](release-notes/api-diff/v3.2-Release/js-apidiff-distributed-hardware.md)
- [File Management](release-notes/api-diff/v3.2-Release/js-apidiff-file-management.md)
- [Location](release-notes/api-diff/v3.2-Release/js-apidiff-geolocation.md)
- [Globalization](release-notes/api-diff/v3.2-Release/js-apidiff-global.md)
- [Graphics](release-notes/api-diff/v3.2-Release/js-apidiff-graphic.md)
- [Misc Software](release-notes/api-diff/v3.2-Release/js-apidiff-misc.md)
- [MSDP](release-notes/api-diff/v3.2-Release/js-apidiff-msdp.md)
- [Multimodal Input](release-notes/api-diff/v3.2-Release/js-apidiff-multi-modal-input.md)
- [Multimedia](release-notes/api-diff/v3.2-Release/js-apidiff-multimedia.md)
- [Common Event and Notification](release-notes/api-diff/v3.2-Release/js-apidiff-notification.md)
- [Resource Scheduler](release-notes/api-diff/v3.2-Release/js-apidiff-resource-scheduler.md)
- [Security](release-notes/api-diff/v3.2-Release/js-apidiff-security.md)
- [Pan-sensor](release-notes/api-diff/v3.2-Release/js-apidiff-sensor.md)
- [Startup](release-notes/api-diff/v3.2-Release/js-apidiff-start-up.md)
- [Telephony ](release-notes/api-diff/v3.2-Release/js-apidiff-telephony.md)
- [Test](release-notes/api-diff/v3.2-Release/js-apidiff-unitest.md)
- [Update](release-notes/api-diff/v3.2-Release/js-apidiff-update.md)
- [USB](release-notes/api-diff/v3.2-Release/js-apidiff-usb.md)
- [User IAM](release-notes/api-diff/v3.2-Release/js-apidiff-user-iam.md)
- [Web](release-notes/api-diff/v3.2-Release/js-apidiff-web.md)
- [Window Manager](release-notes/api-diff/v3.2-Release/js-apidiff-window.md)
- OpenHarmony 3.2 Release (Compared with OpenHarmony 3.2 Beta 5)
- JS API Differences
- [Ability](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-ability.md)
- [Account](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-account.md)
- [Application](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-application.md)
- [ArkUI](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-arkui.md)
- [Power Management](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-battery.md)
- [Bundle Management](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-bundle.md)
- [Communication](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-communication.md)
- [Compiler and Runtime](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-compiler-and-runtime.md)
- [DFX](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-dfx.md)
- [Distributed Data Management](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-distributed-data.md)
- [File Management](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-file-management.md)
- [Misc Software](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-misc.md)
- [Multimedia](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-multimedia.md)
- [Common Event and Notification](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-notification.md)
- [Resource Scheduler](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-resource-scheduler.md)
- [Security](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-security.md)
- [Pan-sensor](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-sensor.md)
- [Startup](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-start-up.md)
- [Telephony](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-telephony.md)
- [Test](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-unitest.md)
- [Upgrade](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-update.md)
- [USB](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-usb.md)
- [User IAM](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-user-iam.md)
- [Web](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-web.md)
- [Window](release-notes/api-diff/Beta5-to-v3.2-Release/js-apidiff-window.md)
- Changelogs
- [Ability](release-notes/changelogs/v3.2-release/changelogs-ability.md)
- [ArkUI](release-notes/changelogs/v3.2-release/changelogs-arkui.md)
- [Bundle Management](release-notes/changelogs/v3.2-release/changelogs-bundlemanager.md)
- [Input Method Framework](release-notes/changelogs/v3.2-release/changelogs-imf.md)
- [Resource Scheduler](release-notes/changelogs/v3.2-release/changelogs-resourceschedule.md)
- [Theme Framework - Lock Screen](release-notes/changelogs/v3.2-release/changelogs-screenlock.md)
- [Telephony](release-notes/changelogs/v3.2-release/changelogs-telephony.md)
- [util](release-notes/changelogs/v3.2-release/changelogs-util.md)
- [Theme Framework - Wallpaper](release-notes/changelogs/v3.2-release/changelogs-wallpaper.md)
- [Web](release-notes/changelogs/v3.2-release/changelogs-web.md)
- OpenHarmony 3.2 Beta4
- JS API Differences
- [Ability framework](release-notes/api-diff/v3.2-beta4/js-apidiff-ability.md)
- [Accessibility subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-accessibility.md)
- [Account subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-account.md)
- [Application subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-application.md)
- [ArkUI development framework](release-notes/api-diff/v3.2-beta4/js-apidiff-arkui.md)
- [Power management subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-battery.md)
- [Bundle management framework](release-notes/api-diff/v3.2-beta4/js-apidiff-bundle.md)
- [Communication subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-communication.md)
- [Compiler and runtime subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-compiler-and-runtime.md)
- [Communication subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-customization.md)
- [DFX subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-dfx.md)
- [Distributed data management subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-distributed-data.md)
- [Distributed hardware subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-distributed-hardware.md)
- [File management subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-file-management.md)
- [Location subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-geolocation.md)
- [Globalization subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-global.md)
- [Misc services subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-misc.md)
- [MSDP subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-msdp.md)
- [Multimodal input subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-multi-modal-input.md)
- [Multimedia subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-multimedia.md)
- [Common event and notification subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-notification.md)
- [Resource scheduler subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-resource-scheduler.md)
- [Security subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-security.md)
- [Pan-sensor subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-sensor.md)
- [Startup subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-start-up.md)
- [Telephony subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-telephony.md)
- [Test subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-unitest.md)
- [Update subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-update.md)
- [USB subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-usb.md)
- [User IAM subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-user-iam.md)
- [Web subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-web.md)
- [Window manager subsystem](release-notes/api-diff/v3.2-beta4/js-apidiff-window.md)
- [Ability](release-notes/api-diff/v3.2-beta4/js-apidiff-ability.md)
- [Accessibility](release-notes/api-diff/v3.2-beta4/js-apidiff-accessibility.md)
- [Account](release-notes/api-diff/v3.2-beta4/js-apidiff-account.md)
- [Application](release-notes/api-diff/v3.2-beta4/js-apidiff-application.md)
- [ArkUI](release-notes/api-diff/v3.2-beta4/js-apidiff-arkui.md)
- [Power Management](release-notes/api-diff/v3.2-beta4/js-apidiff-battery.md)
- [Bundle Management](release-notes/api-diff/v3.2-beta4/js-apidiff-bundle.md)
- [Communication](release-notes/api-diff/v3.2-beta4/js-apidiff-communication.md)
- [Compiler and Runtime](release-notes/api-diff/v3.2-beta4/js-apidiff-compiler-and-runtime.md)
- [Customization](release-notes/api-diff/v3.2-beta4/js-apidiff-customization.md)
- [DFX](release-notes/api-diff/v3.2-beta4/js-apidiff-dfx.md)
- [Distributed Data Management](release-notes/api-diff/v3.2-beta4/js-apidiff-distributed-data.md)
- [Distributed Hardware](release-notes/api-diff/v3.2-beta4/js-apidiff-distributed-hardware.md)
- [File Management](release-notes/api-diff/v3.2-beta4/js-apidiff-file-management.md)
- [Location](release-notes/api-diff/v3.2-beta4/js-apidiff-geolocation.md)
- [Globalization](release-notes/api-diff/v3.2-beta4/js-apidiff-global.md)
- [Misc Software](release-notes/api-diff/v3.2-beta4/js-apidiff-misc.md)
- [MSDP](release-notes/api-diff/v3.2-beta4/js-apidiff-msdp.md)
- [Multimodal Input](release-notes/api-diff/v3.2-beta4/js-apidiff-multi-modal-input.md)
- [Multimedia](release-notes/api-diff/v3.2-beta4/js-apidiff-multimedia.md)
- [Common Event and Notification](release-notes/api-diff/v3.2-beta4/js-apidiff-notification.md)
- [Resource Scheduler](release-notes/api-diff/v3.2-beta4/js-apidiff-resource-scheduler.md)
- [Security](release-notes/api-diff/v3.2-beta4/js-apidiff-security.md)
- [Pan-sensor](release-notes/api-diff/v3.2-beta4/js-apidiff-sensor.md)
- [Startup](release-notes/api-diff/v3.2-beta4/js-apidiff-start-up.md)
- [Telephony](release-notes/api-diff/v3.2-beta4/js-apidiff-telephony.md)
- [Test](release-notes/api-diff/v3.2-beta4/js-apidiff-unitest.md)
- [Update](release-notes/api-diff/v3.2-beta4/js-apidiff-update.md)
- [USB](release-notes/api-diff/v3.2-beta4/js-apidiff-usb.md)
- [User IAM](release-notes/api-diff/v3.2-beta4/js-apidiff-user-iam.md)
- [Web](release-notes/api-diff/v3.2-beta4/js-apidiff-web.md)
- [Window Manager](release-notes/api-diff/v3.2-beta4/js-apidiff-window.md)
- OpenHarmony 3.2 Beta3
- JS API Differences
- [Ability framework](release-notes/api-diff/v3.2-beta3/js-apidiff-ability.md)
- [Accessibility subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-accessibility.md)
- [Account subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-account.md)
- [ArkUI development framework](release-notes/api-diff/v3.2-beta3/js-apidiff-arkui.md)
- [Power management subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-battery.md)
- [Bundle management framework](release-notes/api-diff/v3.2-beta3/js-apidiff-bundle.md)
- [Communication subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-communicate.md)
- [Compiler and runtime subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-compiler-and-runtime.md)
- [DFX subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-dfx.md)
- [Distributed data management subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-distributed-data.md)
- [Distributed hardware subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-distributed-hardware.md)
- [Common event and notification subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-event-and-notification.md)
- [File management subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-file-management.md)
- [Globalization subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-global.md)
- [Graphics subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-graphic.md)
- [Misc services subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-misc.md)
- [Multimodal input subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-multi-modal-input.md)
- [Multimedia subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-multimedia.md)
- [Resource scheduler subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-resource-scheduler.md)
- [Security subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-security.md)
- [Pan-sensor subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-sensor.md)
- [DSoftBus subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-soft-bus.md)
- [Telephony subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-telephony.md)
- [Test subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-unitest.md)
- [Update subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-update.md)
- [Web subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-web.md)
- [Window manager subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-window.md)
- [Ability](release-notes/api-diff/v3.2-beta3/js-apidiff-ability.md)
- [Accessibility](release-notes/api-diff/v3.2-beta3/js-apidiff-accessibility.md)
- [Account](release-notes/api-diff/v3.2-beta3/js-apidiff-account.md)
- [ArkUI](release-notes/api-diff/v3.2-beta3/js-apidiff-arkui.md)
- [Power Management](release-notes/api-diff/v3.2-beta3/js-apidiff-battery.md)
- [Bundle Management](release-notes/api-diff/v3.2-beta3/js-apidiff-bundle.md)
- [Communication](release-notes/api-diff/v3.2-beta3/js-apidiff-communicate.md)
- [Compiler and Runtime](release-notes/api-diff/v3.2-beta3/js-apidiff-compiler-and-runtime.md)
- [DFX](release-notes/api-diff/v3.2-beta3/js-apidiff-dfx.md)
- [Distributed Data Management](release-notes/api-diff/v3.2-beta3/js-apidiff-distributed-data.md)
- [Distributed Hardware](release-notes/api-diff/v3.2-beta3/js-apidiff-distributed-hardware.md)
- [Common Event and Notification](release-notes/api-diff/v3.2-beta3/js-apidiff-event-and-notification.md)
- [File Management](release-notes/api-diff/v3.2-beta3/js-apidiff-file-management.md)
- [Globalization](release-notes/api-diff/v3.2-beta3/js-apidiff-global.md)
- [Graphics](release-notes/api-diff/v3.2-beta3/js-apidiff-graphic.md)
- [Misc Software](release-notes/api-diff/v3.2-beta3/js-apidiff-misc.md)
- [Multimodal Input](release-notes/api-diff/v3.2-beta3/js-apidiff-multi-modal-input.md)
- [Multimedia](release-notes/api-diff/v3.2-beta3/js-apidiff-multimedia.md)
- [Resource Scheduler](release-notes/api-diff/v3.2-beta3/js-apidiff-resource-scheduler.md)
- [Security](release-notes/api-diff/v3.2-beta3/js-apidiff-security.md)
- [Pan-sensor](release-notes/api-diff/v3.2-beta3/js-apidiff-sensor.md)
- [DSoftBus](release-notes/api-diff/v3.2-beta3/js-apidiff-soft-bus.md)
- [Telephony](release-notes/api-diff/v3.2-beta3/js-apidiff-telephony.md)
- [Test](release-notes/api-diff/v3.2-beta3/js-apidiff-unitest.md)
- [Update](release-notes/api-diff/v3.2-beta3/js-apidiff-update.md)
- [Web](release-notes/api-diff/v3.2-beta3/js-apidiff-web.md)
- [Window Manager](release-notes/api-diff/v3.2-beta3/js-apidiff-window.md)
- [Updates (OpenHarmony 3.2 Beta2 -> OpenHarmony 3.2 Beta3)](release-notes/changelogs/v3.2-beta3/changelog-v3.2-beta3.md)
- OpenHarmony 3.2 Beta2
- JS API Differences
- [Ability framework](release-notes/api-diff/v3.2-beta2/js-apidiff-ability.md)
- [Accessibility subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-accessibility.md)
- [Account subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-account.md)
- [ArkUI development framework](release-notes/api-diff/v3.2-beta2/js-apidiff-arkui.md)
- [Bundle management framework](release-notes/api-diff/v3.2-beta2/js-apidiff-bundle.md)
- [Communication subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-communicate.md)
- [Compiler and runtime subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-compiler-and-runtime.md)
- [DFX subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-dfx.md)
- [Distributed data management subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-distributed-data.md)
- [Common event and notification subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-event-and-notification.md)
- [File management subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-file-management.md)
- [Location subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-geolocation.md)
- [Globalization subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-global.md)
- [Graphics subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-graphic.md)
- [Misc services subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-misc.md)
- [Multimodal input subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-multi-modal-input.md)
- [Multimedia subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-multimedia.md)
- [Resource scheduler subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-resource-scheduler.md)
- [Security subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-security.md)
- [Pan-sensor subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-sensor.md)
- [DSoftBus subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-soft-bus.md)
- [Test subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-unitest.md)
- [Update subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-update.md)
- [USB subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-usb.md)
- [User IAM subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-user-authentication.md)
- [Web subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-web.md)
- [Window manager subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-window.md)
- ChangeLog
- [Ability](release-notes/api-diff/v3.2-beta2/js-apidiff-ability.md)
- [Accessibility](release-notes/api-diff/v3.2-beta2/js-apidiff-accessibility.md)
- [Account](release-notes/api-diff/v3.2-beta2/js-apidiff-account.md)
- [ArkUI](release-notes/api-diff/v3.2-beta2/js-apidiff-arkui.md)
- [Bundle Management](release-notes/api-diff/v3.2-beta2/js-apidiff-bundle.md)
- [Communication](release-notes/api-diff/v3.2-beta2/js-apidiff-communicate.md)
- [Compiler and Runtime](release-notes/api-diff/v3.2-beta2/js-apidiff-compiler-and-runtime.md)
- [DFX](release-notes/api-diff/v3.2-beta2/js-apidiff-dfx.md)
- [Distributed Data Management](release-notes/api-diff/v3.2-beta2/js-apidiff-distributed-data.md)
- [Common Event and Notification](release-notes/api-diff/v3.2-beta2/js-apidiff-event-and-notification.md)
- [File Management](release-notes/api-diff/v3.2-beta2/js-apidiff-file-management.md)
- [Location](release-notes/api-diff/v3.2-beta2/js-apidiff-geolocation.md)
- [Globalization](release-notes/api-diff/v3.2-beta2/js-apidiff-global.md)
- [Graphics](release-notes/api-diff/v3.2-beta2/js-apidiff-graphic.md)
- [Misc](release-notes/api-diff/v3.2-beta2/js-apidiff-misc.md)
- [Multimodal Input](release-notes/api-diff/v3.2-beta2/js-apidiff-multi-modal-input.md)
- [Multimedia](release-notes/api-diff/v3.2-beta2/js-apidiff-multimedia.md)
- [Resource Scheduler](release-notes/api-diff/v3.2-beta2/js-apidiff-resource-scheduler.md)
- [Security](release-notes/api-diff/v3.2-beta2/js-apidiff-security.md)
- [Pan-sensor](release-notes/api-diff/v3.2-beta2/js-apidiff-sensor.md)
- [DSoftBus](release-notes/api-diff/v3.2-beta2/js-apidiff-soft-bus.md)
- [Test](release-notes/api-diff/v3.2-beta2/js-apidiff-unitest.md)
- [Update](release-notes/api-diff/v3.2-beta2/js-apidiff-update.md)
- [USB](release-notes/api-diff/v3.2-beta2/js-apidiff-usb.md)
- [User IAM](release-notes/api-diff/v3.2-beta2/js-apidiff-user-authentication.md)
- [Web](release-notes/api-diff/v3.2-beta2/js-apidiff-web.md)
- [Window Manager](release-notes/api-diff/v3.2-beta2/js-apidiff-window.md)
- Changelogs
- [Updates (OpenHarmony 3.2 Beta1 -> OpenHarmony 3.2 Beta2)](release-notes/changelogs/v3.2-beta2/changelog-v3.2-beta2.md)
- [Adaptation Guide for the Application Sandbox](release-notes/changelogs/v3.2-beta2/application-sandbox-adaptation-guide.md)
- OpenHarmony 3.2 Beta1
- JS API Differences
- [Ability framework](release-notes/api-diff/v3.2-beta1/js-apidiff-ability.md)
- [ArkUI development framework](release-notes/api-diff/v3.2-beta1/js-apidiff-arkui.md)
- [Power management subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-battery.md)
- [Bundle management framework](release-notes/api-diff/v3.2-beta1/js-apidiff-bundle.md)
- [Communication subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-communicate.md)
- [DFX subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-dfx.md)
- [Distributed data management subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-distributed-data.md)
- [Common event and notification subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-event-and-notification.md)
- [File management subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-file-management.md)
- [Globalization subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-global.md)
- [Startup subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-init.md)
- [Misc services subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-misc.md)
- [Multimodal input subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-multi-modal-input.md)
- [Multimedia subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-multimedia.md)
- [Distributed scheduler subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-resource-scheduler.md)
- [Test subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-unitest.md)
- [Web subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-web.md)
- [Window manager subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-window.md)
- [Ability](release-notes/api-diff/v3.2-beta1/js-apidiff-ability.md)
- [ArkUI](release-notes/api-diff/v3.2-beta1/js-apidiff-arkui.md)
- [Power Management](release-notes/api-diff/v3.2-beta1/js-apidiff-battery.md)
- [Bundle Management](release-notes/api-diff/v3.2-beta1/js-apidiff-bundle.md)
- [Communication](release-notes/api-diff/v3.2-beta1/js-apidiff-communicate.md)
- [DFX](release-notes/api-diff/v3.2-beta1/js-apidiff-dfx.md)
- [Distributed Data Management](release-notes/api-diff/v3.2-beta1/js-apidiff-distributed-data.md)
- [Common Event and Notification](release-notes/api-diff/v3.2-beta1/js-apidiff-event-and-notification.md)
- [File Management](release-notes/api-diff/v3.2-beta1/js-apidiff-file-management.md)
- [Globalization](release-notes/api-diff/v3.2-beta1/js-apidiff-global.md)
- [Startup](release-notes/api-diff/v3.2-beta1/js-apidiff-init.md)
- [Misc](release-notes/api-diff/v3.2-beta1/js-apidiff-misc.md)
- [Multimodal Input](release-notes/api-diff/v3.2-beta1/js-apidiff-multi-modal-input.md)
- [Multimedia](release-notes/api-diff/v3.2-beta1/js-apidiff-multimedia.md)
- [Resource Scheduler](release-notes/api-diff/v3.2-beta1/js-apidiff-resource-scheduler.md)
- [Test](release-notes/api-diff/v3.2-beta1/js-apidiff-unitest.md)
- [Web](release-notes/api-diff/v3.2-beta1/js-apidiff-web.md)
- [Window Manager](release-notes/api-diff/v3.2-beta1/js-apidiff-window.md)
- [Native API Differences](release-notes/api-diff/v3.2-beta1/native-apidiff-v3.2-beta.md)
- OpenHarmony 3.1 Release
- JS API Differences (API Version 8)
- [Ability framework](release-notes/api-diff/v3.1-Release/js-apidiff-ability.md)
- [Accessibility subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-accessibility.md)
- [Account subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-account.md)
- [ArkUI development framework](release-notes/api-diff/v3.1-Release/js-apidiff-ace.md)
- [Power management subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-battery.md)
- [Bundle management subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-bundle.md)
- [Communication subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-communicate.md)
- [Compiler and runtime subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-compiler-and-runtime.md)
- [DFX subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-dfx.md)
- [Distributed data management subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-distributed-data.md)
- [Distributed hardware subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-distributed-hardware.md)
- [Common event and notification subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-event-and-notification.md)
- [File management subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-file-management.md)
- [Location subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-geolocation.md)
- [Globalization subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-global.md)
- [Graphics subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-graphic.md)
- [Misc services subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-misc.md)
- [Multimodal input subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-multi-modal-input.md)
- [Multimedia subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-multimedia.md)
- [Network management subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-network.md)
- [Distributed scheduler subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-resource-scheduler.md)
- [Security subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-security.md)
- [Pan-sensor subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-sensor.md)
- [Application framework subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-settings.md)
- [DSoftBus subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-soft-bus.md)
- [Telephony subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-telephony.md)
- [USB subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-usb.md)
- [User IAM subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-user-authentication.md)
- [Window manager subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-window.md)
- [Ability](release-notes/api-diff/v3.1-Release/js-apidiff-ability.md)
- [Accessibility](release-notes/api-diff/v3.1-Release/js-apidiff-accessibility.md)
- [Account](release-notes/api-diff/v3.1-Release/js-apidiff-account.md)
- [ArkUI](release-notes/api-diff/v3.1-Release/js-apidiff-ace.md)
- [Power Management](release-notes/api-diff/v3.1-Release/js-apidiff-battery.md)
- [Bundle Management](release-notes/api-diff/v3.1-Release/js-apidiff-bundle.md)
- [Communication](release-notes/api-diff/v3.1-Release/js-apidiff-communicate.md)
- [Compiler and Runtime](release-notes/api-diff/v3.1-Release/js-apidiff-compiler-and-runtime.md)
- [DFX](release-notes/api-diff/v3.1-Release/js-apidiff-dfx.md)
- [Distributed Data Management](release-notes/api-diff/v3.1-Release/js-apidiff-distributed-data.md)
- [Distributed Hardware](release-notes/api-diff/v3.1-Release/js-apidiff-distributed-hardware.md)
- [Common Event and Notification](release-notes/api-diff/v3.1-Release/js-apidiff-event-and-notification.md)
- [File Management](release-notes/api-diff/v3.1-Release/js-apidiff-file-management.md)
- [Location](release-notes/api-diff/v3.1-Release/js-apidiff-geolocation.md)
- [Globalization](release-notes/api-diff/v3.1-Release/js-apidiff-global.md)
- [Graphics](release-notes/api-diff/v3.1-Release/js-apidiff-graphic.md)
- [Misc Software](release-notes/api-diff/v3.1-Release/js-apidiff-misc.md)
- [Multimodal Input](release-notes/api-diff/v3.1-Release/js-apidiff-multi-modal-input.md)
- [Multimedia](release-notes/api-diff/v3.1-Release/js-apidiff-multimedia.md)
- [Network Management](release-notes/api-diff/v3.1-Release/js-apidiff-network.md)
- [Resource Scheduler](release-notes/api-diff/v3.1-Release/js-apidiff-resource-scheduler.md)
- [Basic Security Service](release-notes/api-diff/v3.1-Release/js-apidiff-security.md)
- [Pan-sensor](release-notes/api-diff/v3.1-Release/js-apidiff-sensor.md)
- [Application](release-notes/api-diff/v3.1-Release/js-apidiff-settings.md)
- [DSoftBus](release-notes/api-diff/v3.1-Release/js-apidiff-soft-bus.md)
- [Telephony](release-notes/api-diff/v3.1-Release/js-apidiff-telephony.md)
- [USB](release-notes/api-diff/v3.1-Release/js-apidiff-usb.md)
- [User IAM](release-notes/api-diff/v3.1-Release/js-apidiff-user-authentication.md)
- [Window Manager](release-notes/api-diff/v3.1-Release/js-apidiff-window.md)
- [Native API Differences](release-notes/api-diff/v3.1-Release/native-apidiff-v3.1-release.md)
- [Updates (OpenHarmony 3.1 Beta -> OpenHarmony 3.1 Release)](release-notes/changelogs/v3.1-Release/changelog-v3.1-release.md)
- OpenHarmony 3.1 Beta
......@@ -194,7 +334,7 @@
- [Native API Differences](release-notes/api-diff/v2.2-beta2/native-apidiff-v2.2-beta2.md)
- OpenHarmony Third-Party Components
- [OpenHarmony Third-Party Components](third-party-components/third-party-components-introduction.md)
- [Introduction to OpenHarmony Third-Party Components](third-party-components/third-party-components-introduction.md)
- [Using OpenHarmony JS and TS Third-Party Components](third-party-components/ohpm-third-party-guide.md)
- Contribution
......@@ -207,3 +347,5 @@
- [Writing Instructions](contribute/writing-instructions.md)
- [Communication in Community](contribute/communication-in-community.md)
- [FAQs](contribute/FAQ.md)
<!--no_check-->
\ No newline at end of file
......@@ -3,7 +3,7 @@
## 概述
[Context](../reference/apis/js-apis-inner-application-context.md)是应用中对象的上下文,其提供了应用的一些基础信息,例如resourceManager(资源管理)、applicationInfo(当前应用信息)、dir(应用开发路径)、area(文件分区)等,以及应用的一些基本方法,例如createBundleContext()、getApplicationContext()等。UIAbility组件和各种ExtensionAbility派生类组件都有各自不同的Context类。分别有基类Context、ApplicationContext、AbilityStageContext、UIAbilityContext、ExtensionContext、ServiceExtensionContext等Context。
[Context](../reference/apis/js-apis-inner-application-context.md)是应用中对象的上下文,其提供了应用的一些基础信息,例如resourceManager(资源管理)、applicationInfo(当前应用信息)、dir(应用文件路径)、area(文件分区)等,以及应用的一些基本方法,例如createBundleContext()、getApplicationContext()等。UIAbility组件和各种ExtensionAbility派生类组件都有各自不同的Context类。分别有基类Context、ApplicationContext、AbilityStageContext、UIAbilityContext、ExtensionContext、ServiceExtensionContext等Context。
- 各类Context的继承关系
![context-inheritance](figures/context-inheritance.png)
......@@ -68,62 +68,68 @@
本章节通过如下典型场景来介绍Context的用法:
- [获取应用开发路径](#获取应用开发路径)
- [获取应用文件路径](#获取应用文件路径)
- [获取和修改加密分区](#获取和修改加密分区)
- [创建其他应用或其他Module的Context](#创建其他应用或其他module的context)
- [订阅进程内UIAbility生命周期变化](#订阅进程内uiability生命周期变化)
### 获取应用开发路径
### 获取应用文件路径
从Context中获取的应用开发路径如下表所示
[基类Context](../reference/apis/js-apis-inner-application-context.md)提供了获取应用文件路径的能力,ApplicationContext、AbilityStageContext、UIAbilityContext和ExtensionContext均继承该能力。应用文件路径属于应用沙箱路径,具体请参见[应用沙箱目录](../file-management/app-sandbox-directory.md)
**表1** 应用开发路径说明
上述各类Context获取的应用文件路径有所不同。
| 属性名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| bundleCodeDir | string | 是 | 否 | 安装文件路径。应用在内部存储上的安装路径。 |
| cacheDir | string | 是 | 否 | 缓存文件路径。应用在内部存储上的缓存路径。<br/>对应于“设置&nbsp;&gt;&nbsp;应用管理”,找到对应应用的“存储”中的缓存内容。 |
| filesDir | string | 是 | 否 | 通用文件路径。应用在内部存储上的文件路径。<br/>本目录下存放的文件可能会被应用迁移或者备份的时候同步到其他目录中。 |
| preferencesDir | string | 是 | 是 | 首选项文件路径。指示应用程序首选项目录。 |
| tempDir | string | 是 | 否 | 临时文件路径。<br/>在应用卸载后,系统会删除存储在此目录中的文件。 |
| databaseDir | string | 是 | 否 | 数据库路径。获取本地数据库存储路径。 |
| distributedFilesDir | string | 是 | 否 | 分布式文件路径。 |
- 通过ApplicationContext获取应用级别的应用文件路径,此路径是应用全局信息推荐的存放路径,这些文件会跟随应用的卸载而删除。
获取路径的能力是基类Context中提供的能力,因此在ApplicationContext、AbilityStageContext、UIAbilityContext和ExtensionContext中均可以获取,在各类Context中获取到的路径会有一些差别,具体差别如下图所示。
**图1** Context中获取的应用开发路径
![context-dir](figures/context-dir.png)
- 通过ApplicationContext获取的应用级别路径。应用全局信息建议存放的路径,存放在此路径的文件内容仅在应用卸载时会被删除。
| 属性 | 路径 |
| -------- | -------- |
| bundleCodeDir | {路径前缀}/el1/bundle/ |
| cacheDir | {路径前缀}/{加密等级}/base/cache/ |
| filesDir | {路径前缀}/{加密等级}/base/files/ |
| preferencesDir | {路径前缀}/{加密等级}/base/preferences/ |
| tempDir | {路径前缀}/{加密等级}/base/temp/ |
| databaseDir | {路径前缀}/{加密等级}/database/ |
| distributedFilesDir | {路径前缀}/el2/distributedFiles/ |
- 通过AbilityStageContext、UIAbilityContext、ExtensionContext获取的HAP级别路径。HAP对应的信息建议存放的路径,存放在此路径的文件内容会跟随HAP的卸载而删除,不会影响应用级别路径的文件内容,除非该应用的HAP已全部卸载。
| bundleCodeDir | <路径前缀>/el1/bundle/ |
| cacheDir | <路径前缀>/<加密等级>/base/cache/ |
| filesDir | <路径前缀>/<加密等级>/base/files/ |
| preferencesDir | <路径前缀>/<加密等级>/base/preferences/ |
| tempDir | <路径前缀>/<加密等级>/base/temp/ |
| databaseDir | <路径前缀>/<加密等级>/database/ |
| distributedFilesDir | <路径前缀>/el2/distributedFiles/ |
示例代码如下所示。
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
let applicationContext = this.context.getApplicationContext();
let cacheDir = applicationContext.cacheDir;
let tempDir = applicationContext.tempDir;
let filesDir = applicationContext.filesDir;
let databaseDir = applicationContext.databaseDir;
let bundleCodeDir = applicationContext.bundleCodeDir;
let distributedFilesDir = applicationContext.distributedFilesDir;
let preferencesDir = applicationContext.preferencesDir;
...
}
}
```
- 通过AbilityStageContext、UIAbilityContext、ExtensionContext获取HAP级别的应用文件路径。此路径是HAP相关信息推荐的存放路径,这些文件会跟随HAP的卸载而删除,但不会影响应用级别路径的文件,除非该应用的HAP已全部卸载。
| 属性 | 路径 |
| -------- | -------- |
| bundleCodeDir | {路径前缀}/el1/bundle/ |
| cacheDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}**/cache/ |
| filesDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}**/files/ |
| preferencesDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}**/preferences/ |
| tempDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}**/temp/ |
| databaseDir | {路径前缀}/{加密等级}/database/**{moduleName}**/ |
| distributedFilesDir | {路径前缀}/el2/distributedFiles/**{moduleName}**/ |
| bundleCodeDir | <路径前缀>/el1/bundle/ |
| cacheDir | <路径前缀>/<加密等级>/base/**haps/\<module-name>**/cache/ |
| filesDir | <路径前缀>/<加密等级>/base/**haps/\<module-name>**/files/ |
| preferencesDir | <路径前缀>/<加密等级>/base/**haps/\<module-name>**/preferences/ |
| tempDir | <路径前缀>/<加密等级>/base/**haps/\<module-name>**/temp/ |
| databaseDir | <路径前缀>/<加密等级>/database/**\<module-name>**/ |
| distributedFilesDir | <路径前缀>/el2/distributedFiles/**\<module-name>**/ |
获取应用开发路径的示例代码如下所示。
示例代码如下所示。
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
export default class EntryAbility extends UIAbility {
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
let cacheDir = this.context.cacheDir;
let tempDir = this.context.tempDir;
......@@ -134,12 +140,9 @@ export default class EntryAbility extends UIAbility {
let preferencesDir = this.context.preferencesDir;
...
}
}
```
}
```
> **说明:**
>
> 示例代码获取到的是应用开发路径的沙箱路径。其对应的绝对路径,在创建或者修改文件之后,可以在`hdc shell`中,通过`find / -name <文件名称>`命令查找获取。
### 获取和修改加密分区
......@@ -153,22 +156,23 @@ export default class EntryAbility extends UIAbility {
>
> - AreaMode.EL2:用户级加密区,设备开机,首次输入密码后才能够访问的数据区。
要实现获取和设置当前加密分区,可以通过读写[Context的area属性](../reference/apis/js-apis-inner-application-context.md)来实现。
要实现获取和设置当前加密分区,可以通过读写[Context](../reference/apis/js-apis-inner-application-context.md)`area`属性来实现。
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
import contextConstant from '@ohos.app.ability.contextConstant';
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
// 存储普通信息前,切换到EL1设备加密
if (this.context.area === 1) { // 获取area
this.context.area = 0; // 修改area
// 存储普通信息前,切换到EL1设备加密
if (this.context.area === contextConstant.AreaMode.EL2) { // 获取area
this.context.area = contextConstant.AreaMode.EL1; // 修改area
}
// 存储普通信息
// 存储敏感信息前,切换到EL2用户级加密
if (this.context.area === 0) { // 获取area
this.context.area = 1; // 修改area
if (this.context.area === contextConstant.AreaMode.EL1) { // 获取area
this.context.area = contextConstant.AreaMode.EL2; // 修改area
}
// 存储敏感信息
}
......@@ -178,13 +182,14 @@ export default class EntryAbility extends UIAbility {
### 创建其他应用或其他Module的Context
基类Context提供创建其他应用或其他Module的Context的方法有[createBundleContext(bundleName: string)](../reference/apis/js-apis-inner-application-context.md#contextcreatebundlecontext)[createModuleContext(moduleName: string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext)[createModuleContext(bundleName: string, moduleName: string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext-1)接口,创建其他应用或者其他Module的Context,从而通过该Context获取相应的资源信息(例如获取其他Module的[获取应用开发路径](#获取应用开发路径)信息)。
基类Context提供创建其他应用或其他Module的Context的方法有[createBundleContext(bundleName: string)](../reference/apis/js-apis-inner-application-context.md#contextcreatebundlecontext)[createModuleContext(moduleName: string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext)[createModuleContext(bundleName: string, moduleName: string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext-1)接口,创建其他应用或者其他Module的Context,从而通过该Context获取相应的资源信息(例如获取其他Module的[获取应用文件路径](#获取应用文件路径)信息)。
- 调用createBundleContext(bundleName:string)方法,创建其他应用的Context信息。
- 调用`createBundleContext(bundleName:string)`方法,创建其他应用的Context信息。
> **说明:**
>
> 当获取的是其他应用的Context时:
>
> - 申请`ohos.permission.GET_BUNDLE_INFO_PRIVILEGED`权限,配置方式请参见[访问控制授权申请](../security/accesstoken-guidelines.md#配置文件权限声明)。
> - 申请`ohos.permission.GET_BUNDLE_INFO_PRIVILEGED`权限,配置方式请参见[配置文件权限声明](../security/accesstoken-guidelines.md#配置文件权限声明)。
>
> - 接口为系统接口,三方应用不支持调用。
......@@ -203,7 +208,7 @@ export default class EntryAbility extends UIAbility {
}
```
- 调用createModuleContext(bundleName:string, moduleName:string)方法,获取指定应用指定Module的上下文信息。获取到指定应用指定Module的Context之后,即可获取到相应应用Module的资源信息。
- 调用`createModuleContext(bundleName:string, moduleName:string)`方法,获取指定应用指定Module的上下文信息。获取到指定应用指定Module的Context之后,即可获取到相应应用Module的资源信息。
> **说明:**
>
> 当获取的是其他应用的指定Module的Context时:
......@@ -225,7 +230,7 @@ export default class EntryAbility extends UIAbility {
}
```
- 调用createModuleContext(moduleName:string)方法,获取本应用中其他Module的Context。获取到其他Module的Context之后,即可获取到相应Module的资源信息。
- 调用`createModuleContext(moduleName:string)`方法,获取本应用中其他Module的Context。获取到其他Module的Context之后,即可获取到相应Module的资源信息。
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
......
......@@ -7,7 +7,7 @@
图1 UIAbility对应的任务快照
![](figures/mission-list-recent.png)
也可以使用[UIAbilityContext.setMissionIcon()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionicon)[UIAbilityContext.setMissionLabel()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionlabel)方法,根据需要自定义任务快照的图标和名称。例如,对于UIAbility的多实例启动模式,可以根据不同的功能配置相应的任务快照的图标和名称。
也可以使用[`UIAbilityContext.setMissionIcon()`](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionicon)[`UIAbilityContext.setMissionLabel()`](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionlabel)方法,根据需要自定义任务快照的图标和名称。例如,对于UIAbility的多实例启动模式,可以根据不同的功能配置相应的任务快照的图标和名称。
本文将从以下两个方面介绍。
......@@ -16,11 +16,15 @@
## 设置任务快照的图标(仅对系统应用开放)
通过调用[UIAbilityContext.setMissionIcon()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionicon)方法修改任务快照的图标。图片内容为[PixelMap](../reference/apis/js-apis-image.md#pixelmap7)类型对象。示例中的context的获取方式请参见[获取UIAbility的上下文信息](uiability-usage.md#获取uiability的上下文信息)
通过调用[`UIAbilityContext.setMissionIcon()`](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionicon)方法修改任务快照的图标。
示例中的context的获取方式请参见[获取UIAbility的上下文信息](uiability-usage.md#获取uiability的上下文信息)。示例中的`pixelMap`的获取方式请参见[图片解码](../media/image-decoding.md)
```ts
let imagePixelMap: PixelMap = undefined; // 需要获取图片PixelMap信息
let context = ...; // UIAbilityContext
let pixelMap: PixelMap = ...; // 图片的PixelMap信息
context.setMissionIcon(imagePixelMap, (err) => {
context.setMissionIcon(pixelMap, (err) => {
if (err.code) {
console.error(`Failed to set mission icon. Code is ${err.code}, message is ${err.message}`);
}
......@@ -34,10 +38,12 @@ context.setMissionIcon(imagePixelMap, (err) => {
## 设置任务快照的名称
通过调用[UIAbilityContext.setMissionLabel()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionlabel)方法修改任务快照的名称。
通过调用[`UIAbilityContext.setMissionLabel()`](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionlabel)方法修改任务快照的名称。
```ts
this.context.setMissionLabel('test').then(() => {
let context = ...; // UIAbilityContext
context.setMissionLabel('test').then(() => {
console.info('Succeeded in seting mission label.');
}).catch((err) => {
console.error(`Failed to set mission label. Code is ${err.code}, message is ${err.message}`);
......
......@@ -238,3 +238,9 @@
console.info(`dsHelper delete result:${data}`);
});
```
## 相关实例
针对数据共享开发,有以下相关实例可供参考:
- [`CrossAppDataShare`:系统应用跨应用数据共享(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/DataManagement/CrossAppDataShare)
\ No newline at end of file
# DFX
- [应用事件打点开发指导](hiappevent-guidelines.md)
- [性能打点跟踪开发指导](hitracemeter-guidelines.md)
- [分布式跟踪开发指导](hitracechain-guidelines.md)
- [HiLog开发指导(Native)](hilog-guidelines.md)
- [HitraceMeter开发指导(Native)](hitracemeter-native-guidelines.md)
- 性能打点跟踪
- [性能打点跟踪开发指导(ArkTS)](hitracemeter-guidelines.md)
- [性能打点跟踪开发指导(Native)](hitracemeter-native-guidelines.md)
- 错误管理
- [错误管理开发指导](errormanager-guidelines.md)
- [应用恢复开发指导](apprecovery-guidelines.md)
......
# 性能打点跟踪开发指导
# 性能打点跟踪开发指导(ArkTS)
## 简介
......
# 性能打点跟踪开发指导(Native)
## 概述
hiTraceMeter为开发者提供系统性能打点接口。开发者通过在自己的业务逻辑中的关键代码位置调用HiTraceMeter接口提供的API接口,能够有效跟踪进程轨迹、查看系统性能。
> **说明:**
> - 仅当开发者使用Native API开发应用时,可参考本开发指导。
> - 如需使用ArkTS API开发应用,请参考对应的[开发指导](hitracemeter-guidelines.md)和[API参考](../reference/apis/js-apis-hitracemeter.md)。
> - 仅当开发者使用Native API开发应用时,可参考本开发指导。相关接口的详细说明请查阅[API参考](../reference/native-apis/_hitrace.md)。
> - 如需使用ArkTS API开发应用,请查阅对应的[开发指导](hitracemeter-guidelines.md)和[API参考](../reference/apis/js-apis-hitracemeter.md)。
## 接口说明
| 方法 | 接口描述 |
| -------- | -------- |
| void OH_HiTrace_StartTrace(const char* name) | 开启一个同步时间片跟踪事件 |
......@@ -15,31 +19,34 @@ hiTraceMeter为开发者提供系统性能打点接口。开发者通过在自
| void OH_HiTrace_CountTrace(const char* name, int64_t count) | 整数跟踪事件 |
**参数解析**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| name | string | 否 | 要跟踪的数值变量名称。 |
| taskId | number | 否 | 用来表示关联的ID,如果有多个name相同的任务是并行执行的,则每次调用startTrace的taskId不同。 |
| count | number | 否 | 变量的值。 |
## 开发示例
1. 在CMakeLists.txt中新增libhitrace_ndk.z.so链接。
```
```
target_link_libraries(entry PUBLIC libhitrace_ndk.z.so)
```
```
2. 在源文件中引用hitrace头文件。
```c++
```c++
#include "hitrace/trace.h"
```
```
3. 打开hdc shell,使能trace,命令是:hitrace --trace_begin app。
```shell
```shell
capturing trace...
```
```
4. 进行性能打点,以异步打点为例。
```c++
```c++
OH_HiTrace_StartAsyncTrace("hitraceTest", 123);
OH_HiTrace_FinishAsyncTrace("hitraceTest", 123);
```
```
5. dump trace查看结果,命令是:hitrace --trace_dump | grep hitraceTest。
```shell
```shell
<...>-2477 (-------) [001] .... 396.427165: tracing_mark_write: S|2477|H:hitraceTest 123
<...>-2477 (-------) [001] .... 396.427196: tracing_mark_write: F|2477|H:hitraceTest 123
```
\ No newline at end of file
```
\ No newline at end of file
......@@ -11,7 +11,6 @@
下图展示了应用沙箱下,应用可访问的文件范围和方式。
**图1** 应用沙箱文件访问关系图
![Application sandbox file access relationship](figures/application-sandbox-file-access-relationship.png)
## 应用沙箱目录与应用沙箱路径
......@@ -25,7 +24,6 @@
- 从实际物理路径推导物理路径与沙箱路径并不是1:1的映射关系,沙箱路径总是少于系统进程视角可见的物理路径。有些调试进程视角下的物理路径在对应的应用沙箱目录是无法找到的,而沙箱路径总是能够找到其对应的物理路径。
**图2** 应用沙箱路径(不同权限与角色的进程下可见的文件路径不同)
  
![Application sandbox path](figures/application-sandbox-path.png)
## 应用文件目录与应用文件路径
......@@ -37,7 +35,6 @@
在此主要介绍应用文件目录,如下图所示。应用文件目录下某个文件或某个具体目录的路径称为应用文件路径。应用文件目录下的各个文件路径,具备不同的属性和特征。
**图3** 应用文件目录结构图
![Application file directory structure](figures/application-file-directory-structure.png)
1. 一级目录data/:代表应用文件目录。
......@@ -52,7 +49,7 @@
4. 四级、五级目录:
通过ApplicationContext可以获取base下的files、cache、preferences、temp、distributedfiles等目录的应用文件路径,应用全局信息可以存放在这些目录下。
通过UIAbilityContext、AbilityStageContext、ExtensionContext可以获取hap级别应用文件路径。HAP信息可以存放在这些目录下,存放在此目录的文件会跟随HAP的卸载而删除,不会影响app级别目录下的文件。在开发态,一个应用包含一个或者多个HAP,详见[Stage模型应用程序包结构](../quick-start/application-package-structure-stage.md)
通过UIAbilityContext、AbilityStageContext、ExtensionContext可以获取HAP级别应用文件路径。HAP信息可以存放在这些目录下,存放在此目录的文件会跟随HAP的卸载而删除,不会影响App级别目录下的文件。在开发态,一个应用包含一个或者多个HAP,详见[Stage模型应用程序包结构](../quick-start/application-package-structure-stage.md)
Context上下文获取及上述应用文件路径的获取,详见[应用上下文Context](../application-models/application-context-stage.md)
......@@ -67,7 +64,7 @@
| 目录名 | Context属性名称 | 类型 | 说明 |
| -------- | -------- | -------- | -------- |
| bundle | bundleCodeDir | 安装文件路径 | 应用安装后的app的hap资源包所在目录;随应用卸载而清理。不能拼接路径访问资源文件,请使用[资源管理接口](../reference/apis/js-apis-resource-manager.md)访问资源。 |
| bundle | bundleCodeDir | 安装文件路径 | 应用安装后的App的HAP资源包所在目录;随应用卸载而清理。不能拼接路径访问资源文件,请使用[资源管理接口](../reference/apis/js-apis-resource-manager.md)访问资源。 |
| base | NA | 本设备文件路径 | 应用在本设备上存放持久化数据的目录,子目录包含files/、cache/、temp/和haps/;随应用卸载而清理。 |
| database | databaseDir | 数据库路径 | 应用在el1加密条件下存放通过分布式数据库服务操作的文件目录;随应用卸载而清理。 |
| distributedfiles | distributedFilesDir | 分布式文件路径 | 应用在el2加密条件下存放分布式文件的目录,应用将文件放入该目录可分布式跨设备直接访问;随应用卸载而清理。 |
......
......@@ -109,7 +109,7 @@
```js
audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC, audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, audioEffectInfoArray) => {
if (err) {
console.error(`Failed to get effect info array`);
console.error('Failed to get effect info array');
return;
} else {
console.info(`getAudioEffectInfoArray: ${audioEffectInfoArray}`);
......
......@@ -315,4 +315,4 @@ Image($r('sys.media.ohos_app_icon'))
针对访问应用资源,有以下相关实例可供参考:
- [`ResourceManager`:资源管理器(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Internationalnation/ResourceManager)
- [`ResourceManager`:资源管理器(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Resource/ResourceManager)
......@@ -47,6 +47,7 @@
> 说明:
>
> 从API Version 10 开始废弃。
> 建议使用[COMMON_EVENT_SCREEN_UNLOCKED<sup>10+<sup>](./common_event/commonEvent-screenlock.md)替代。
## [COMMON_EVENT_TIME_TICK](./common_event/commonEvent-time.md)
表示系统时间更改的公共事件的动作。
......@@ -457,20 +458,14 @@ Wi-Fi P2P群组信息已更改。
- 值: usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE
- 订阅者所需权限: ohos.permission.USE_BLUETOOTH
## COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED
指示设备NFC适配器状态已更改的公共事件的操作。
- 值: usual.event.nfc.action.ADAPTER_STATE_CHANGED
- 订阅者所需权限: 无
## [COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED](./common_event/commonEvent-nfc.md)
指示设备NFC状态已更改的公共事件的操作。
## COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED
(预留事件,暂未支持)检测到NFC RF字段处于使能状态的公共事件的动作。
- 值: usual.event.nfc.action.RF_FIELD_ON_DETECTED
- 订阅者所需权限: ohos.permission.MANAGE_SECURE_SETTINGS
## [COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED](./common_event/commonEvent-nfc.md)
检测到NFC场强进入的公共事件。
## COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED
(预留事件,暂未支持)检测到NFC RF字段处于关闭状态的公共事件的动作。
- 值: usual.event.nfc.action.RF_FIELD_OFF_DETECTED
- 订阅者所需权限: ohos.permission.MANAGE_SECURE_SETTINGS
## [COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED](./common_event/commonEvent-nfc.md)
检测到NFC场强离开的公共事件。
## [COMMON_EVENT_DISCHARGING](./common_event/commonEvent-powermgr.md)
表示系统停止为电池充电的公共事件的动作。
......
......@@ -6,6 +6,7 @@
- [资源调度子系统公共事件定义](commonEvent-resourceschedule.md)
- [电话服务子系统公共事件定义](commonEvent-telephony.md)
- [电源管理子系统公共事件定义](commonEvent-powermgr.md)
- [NFC子系统公共事件定义](commonEvent-nfc.md)
- [USB子系统公共事件定义](commonEvent-usb.md)
- [Wifi子系统公共事件定义](commonEvent-wifi.md)
- [文件管理子系统公共事件定义](commonEvent-filemanagement.md)
......
# NFC子系统公共事件定义
NFC子系统面向应用发布如下系统公共事件,应用如需订阅系统公共事件,请参考公共事件[接口文档](../js-apis-commonEventManager.md)
## COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED
指示设备NFC状态已更改的公共事件的操作。
- 常量值:usual.event.nfc.action.ADAPTER_STATE_CHANGED
- 订阅者所需权限:无
指示设备NFC状态更改时,将会触发事件通知服务发布该系统公共事件。
## COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED
检测到NFC场强进入的公共事件。
- 常量值:usual.event.nfc.action.RF_FIELD_ON_DETECTED
- 订阅者所需权限:ohos.permission.MANAGE_SECURE_SETTINGS
当检测到NFC场强进入时,将会触发事件通知服务发布该系统公共事件。
## COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED
检测到NFC场强离开的公共事件。
- 常量值:usual.event.nfc.action.RF_FIELD_OFF_DETECTED
- 订阅者所需权限:ohos.permission.MANAGE_SECURE_SETTINGS
当检测到NFC场强离开时,将会触发事件通知服务发布该系统公共事件。
\ No newline at end of file
......@@ -3398,7 +3398,7 @@ audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC,
console.error(`getAudioEffectInfoArray :ERROR: ${err}`);
return;
} else {
console.info(`The contentType of ${CONTENT_TYPE_MUSIC} and the streamUsage of ${STREAM_USAGE_MEDIA} 's effect modes are: ${audioEffectInfoArray}`);
console.info(`The effect modes are: ${audioEffectInfoArray}`);
}
});
```
......@@ -3427,9 +3427,9 @@ getAudioEffectInfoArray(content: ContentType, usage: StreamUsage): Promise&lt;Au
**示例:**
```js
audioStreamManager.getAudioEffectInfoArray().then((audioEffectInfoArray) => {
console.info(`getAudioEffectInfoArray ######### Get Promise is called ##########`);
console.info(`The contentType of ${CONTENT_TYPE_MUSIC} and the streamUsage of ${STREAM_USAGE_MEDIA} 's effect modes are: ${audioEffectInfoArray}`);
audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC, audio.StreamUsage.STREAM_USAGE_MEDIA).then((audioEffectInfoArray) => {
console.info('getAudioEffectInfoArray ######### Get Promise is called ##########');
console.info(`The effect modes are: ${audioEffectInfoArray}`);
}).catch((err) => {
console.error(`getAudioEffectInfoArray :ERROR: ${err}`);
});
......@@ -4862,9 +4862,9 @@ async function getCacheDir(){
}
let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let stat = await fs.stat(path);
let currStat = await fs.stat(path);
let buf = new ArrayBuffer(bufferSize);
let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
let len = currStat.size % bufferSize == 0 ? Math.floor(currStat.size / bufferSize) : Math.floor(currStat.size / bufferSize + 1);
for (let i = 0;i < len; i++) {
let options = {
offset: i * bufferSize,
......@@ -4916,9 +4916,9 @@ async function getCacheDir(){
}
let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let stat = await fs.stat(path);
let currStat = await fs.stat(path);
let buf = new ArrayBuffer(bufferSize);
let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
let len = currStat.size % bufferSize == 0 ? Math.floor(currStat.size / bufferSize) : Math.floor(currStat.size / bufferSize + 1);
for (let i = 0;i < len; i++) {
let options = {
offset: i * bufferSize,
......
# BundlePackInfo
此接口为系统
> **说明:**
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......@@ -9,7 +9,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
......@@ -21,7 +21,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ |
......@@ -34,7 +34,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------- | --------------------------------------------- | ---- | ---- | -------------------- |
......@@ -45,7 +45,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------- | ------------------- | ---- | ---- | -------------------------------------- |
......@@ -56,7 +56,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------ | ------------------------------------------------- | ---- | ---- | ---------------------------------- |
......@@ -71,7 +71,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------- | ------- | ---- | ---- | ------------------------------------------------------------ |
......@@ -84,7 +84,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------- | ------------------------------------------- | ---- | ---- | ------------------------------------------------------------ |
......@@ -97,7 +97,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----- | ------------------------------------------- | ---- | ---- | ------------------------------------------------------------ |
......@@ -108,7 +108,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ |
......@@ -124,7 +124,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | ------ | ---- | ---- | -------------------- |
......@@ -136,7 +136,7 @@
**系统接口:** 此接口为系统接口。
**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------------ | ------ | ---- | ---- | ------------------------------------------------------------ |
......
......@@ -7,6 +7,8 @@
## BusinessAbilityInfo
**系统接口:** 此接口为系统接口。
**系统能力**: SystemCapability.BundleManager.BundleFramework.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
......
......@@ -7,7 +7,7 @@ OverlayModuleInfo信息,系统应用可以通过[overlay.getOverlayModuleInfoB
## OverlayModuleInfo
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Overlay
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| --------------------- | ---------------------------------------------------| ---- | ---- | ---------------------------------------------- |
......
......@@ -9,6 +9,8 @@
共享包信息。
**系统接口:** 此接口为系统接口。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。
| 名称 | 类型 | 可读 | 可写 | 说明 |
......@@ -21,6 +23,8 @@
共享模块信息。
**系统接口:** 此接口为系统接口。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。
| 名称 | 类型 | 可读 | 可写 | 说明 |
......
......@@ -114,6 +114,7 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。
| PRINT<sup>10+</sup> | 15 | PrintExtensionAbility:文件打印扩展能力,提供应用打印照片、文档等办公场景。当前支持图片打印,文档类型暂未支持。 |
| PUSH<sup>10+</sup> | 17 | PushExtensionAbility:推送扩展能力,提供推送场景化消息能力。预留能力,当前暂未支持。 |
| DRIVER<sup>10+</sup> | 18 | DriverExtensionAbility:驱动扩展能力,提供外设驱动扩展能力,当前暂未支持。 |
| APP_ACCOUNT_AUTHORIZATION<sup>10+</sup> | 19 | AuthorizationExtensionAbility:应用帐号认证扩展能力,用于处理帐号授权的请求,允许第三方(相对于操作系统厂商)生态平台的帐号授权。 |
| UNSPECIFIED | 255 | 不指定类型,配合queryExtensionAbilityInfo接口可以查询所有类型的ExtensionAbility。 |
......
......@@ -1088,7 +1088,7 @@ import cryptoFramework from "@ohos.security.cryptoFramework"
let asyKeyPairSpec; // asyKeyPairSpec为全量密钥参数,此处省略生成过程
let asyKeyGeneratorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(asyKeyPairSpec);
asyKeyGenerator.generateKeyPair((err, keyPair) => {
asyKeyGeneratorBySpec.generateKeyPair((err, keyPair) => {
if (err) {
console.error("generateKeyPair: error.");
return;
......@@ -1126,7 +1126,7 @@ import cryptoFramework from "@ohos.security.cryptoFramework"
let asyKeyPairSpec; // asyKeyPairSpec为全量密钥参数,此处省略生成过程
let asyKeyGeneratorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(asyKeyPairSpec);
let keyGenPromise = asyKeyGenerator.generateKeyPair();
let keyGenPromise = asyKeyGeneratorBySpec.generateKeyPair();
keyGenPromise.then( keyPair => {
console.info("generateKeyPair success.");
}).catch(error => {
......@@ -1163,7 +1163,7 @@ import cryptoFramework from "@ohos.security.cryptoFramework"
let asyKeyPairSpec; // asyKeyPairSpec为全量密钥参数
let asyKeyGeneratorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(asyKeyPairSpec);
asyKeyGenerator.generatePriKey((err, prikey) => {
asyKeyGeneratorBySpec.generatePriKey((err, prikey) => {
if (err) {
console.error("generatePriKey: error.");
return;
......@@ -1201,7 +1201,7 @@ import cryptoFramework from "@ohos.security.cryptoFramework"
let asyKeyPairSpec; // asyKeyPairSpec为全量密钥参数
let asyKeyGeneratorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(asyKeyPairSpec);
let keyGenPromise = asyKeyGenerator.generatePriKey();
let keyGenPromise = asyKeyGeneratorBySpec.generatePriKey();
keyGenPromise.then( priKey => {
console.info("generatePriKey success.");
}).catch(error => {
......@@ -1238,7 +1238,7 @@ import cryptoFramework from "@ohos.security.cryptoFramework"
let asyKeyPairSpec; // asyKeyPairSpec为全量密钥参数,此处省略生成过程
let asyKeyGeneratorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(asyKeyPairSpec);
asyKeyGenerator.generateKeyPair((err, pubKey) => {
asyKeyGeneratorBySpec.generateKeyPair((err, pubKey) => {
if (err) {
console.error("generatePubKey: error.");
return;
......@@ -1276,7 +1276,7 @@ import cryptoFramework from "@ohos.security.cryptoFramework"
let asyKeyPairSpec; // asyKeyPairSpec为全量密钥参数,此处省略生成过程
let asyKeyGeneratorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(asyKeyPairSpec);
let keyGenPromise = asyKeyGenerator.generatePubKey();
let keyGenPromise = asyKeyGeneratorBySpec.generatePubKey();
keyGenPromise.then( pubKey => {
console.info("generatePubKey success.");
}).catch(error => {
......@@ -3584,7 +3584,7 @@ try {
}
try {
let randData = random.generateRandomSync(12);
let randData = rand.generateRandomSync(12);
if (randData != null) {
console.info("[Sync]: rand result: " + randData.data);
} else {
......
......@@ -283,6 +283,46 @@ getTrustedDeviceListSync(): Array&lt;DeviceInfo&gt;
}
```
### getTrustedDeviceListSync<sup>10+</sup>
getTrustedDeviceListSync(isRefresh: boolean): Array&lt;DeviceInfo&gt;
打开软总线系统端的心跳模式,让周围处于下线状态的可信设备快速上线,同时刷新已上线的可信设备列表。
**需要权限**:ohos.permission.ACCESS_SERVICE_DM
**系统能力**:SystemCapability.DistributedHardware.DeviceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | --------------------------------- | ---- | ---------------------------------- |
| isRefresh | boolean | 是 | 是否打开心跳模式,刷新可信列表。 |
**返回值:**
| 名称 | 说明 |
| -------------------------------------- | ---------------- |
| Array&lt;[DeviceInfo](#deviceinfo)&gt; | 返回可信设备列表。 |
**错误码:**
以下的错误码的详细介绍请参见[设备管理错误码](../errorcodes/errorcode-device-manager.md)
| 错误码ID | 错误信息 |
| -------- | --------------------------------------------------------------- |
| 11600101 | Failed to execute the function. |
**示例:**
```js
try {
var deviceInfoList = dmInstance.getTrustedDeviceListSync(true);
} catch (err) {
console.error("getTrustedDeviceListSync errCode:" + err.code + ",errMessage:" + err.message);
}
```
### getTrustedDeviceList<sup>8+</sup>
getTrustedDeviceList(callback:AsyncCallback&lt;Array&lt;DeviceInfo&gt;&gt;): void
......@@ -331,14 +371,6 @@ getTrustedDeviceList(): Promise&lt;Array&lt;DeviceInfo&gt;&gt;
| ---------------------------------------- | --------------------- |
| Promise&lt;Array&lt;[DeviceInfo](#deviceinfo)&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**错误码:**
以下的错误码的详细介绍请参见[设备管理错误码](../errorcodes/errorcode-device-manager.md)
| 错误码ID | 错误信息 |
| -------- | --------------------------------------------------------------- |
| 11600101 | Failed to execute the function. |
**示例:**
```js
......@@ -431,14 +463,6 @@ getLocalDeviceInfo(): Promise&lt;DeviceInfo&gt;
| ---------------------------------------- | --------------------- |
| Promise&lt;[DeviceInfo](#deviceinfo)&gt; | Promise实例,用于获取异步返回结果。 |
**错误码:**
以下的错误码的详细介绍请参见[设备管理错误码](../errorcodes/errorcode-device-manager.md)
| 错误码ID | 错误信息 |
| ------- | --------------------------------------------------------------- |
| 11600101| Failed to execute the function. |
**示例:**
```js
......
......@@ -3867,7 +3867,7 @@ backup(file:string, callback: AsyncCallback&lt;void&gt;):void
```js
let file = "BK001";
try {
kvStore.backup(file, function(err) => {
kvStore.backup(file, (err) => {
if (err) {
console.error(`Failed to backup.code is ${err.code},message is ${err.message} `);
} else {
......
......@@ -251,7 +251,7 @@ accessSync(path: string): boolean
## fs.close
close(file: File|number): Promise&lt;void&gt;
close(file: number|File): Promise&lt;void&gt;
关闭文件,使用Promise异步回调。
......@@ -261,7 +261,7 @@ close(file: File|number): Promise&lt;void&gt;
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ------------ |
| file | [File](#file)\|number | 是 | 已打开的File对象或已打开的文件描述符fd。 |
| file | number\|[File](#file) | 是 | 已打开的File对象或已打开的文件描述符fd。 |
**返回值:**
......@@ -288,7 +288,7 @@ close(file: File|number): Promise&lt;void&gt;
## fs.close
close(file: File|number, callback: AsyncCallback&lt;void&gt;): void
close(file: number|File, callback: AsyncCallback&lt;void&gt;): void
关闭文件,使用callback异步回调。
......@@ -298,7 +298,7 @@ close(file: File|number, callback: AsyncCallback&lt;void&gt;): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------ |
| file | [File](#file)\|number | 是 | 已打开的File对象或已打开的文件描述符fd。 |
| file | number\|[File](#file) | 是 | 已打开的File对象或已打开的文件描述符fd。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 异步关闭文件之后的回调。 |
**错误码:**
......@@ -321,7 +321,7 @@ close(file: File|number, callback: AsyncCallback&lt;void&gt;): void
## fs.closeSync
closeSync(file: File|number): void
closeSync(file: number|File): void
以同步方法关闭文件。
......@@ -331,7 +331,7 @@ closeSync(file: File|number): void
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ------------ |
| file | [File](#file)\|number | 是 | 已打开的File对象或已打开的文件描述符fd。 |
| file | number\|[File](#file) | 是 | 已打开的File对象或已打开的文件描述符fd。 |
**错误码:**
......@@ -1898,6 +1898,8 @@ listFile(path: string, options?: {
列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤,使用Callback异步回调。
**系统能力**:SystemCapability.FileManagement.File.FileIO
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1953,6 +1955,8 @@ listFileSync(path: string, options?: {
以同步方式列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤。
**系统能力**:SystemCapability.FileManagement.File.FileIO
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2160,7 +2164,7 @@ moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback\<void
## fs.moveFileSync
moveFile(src: string, dest: string, mode?: number): void
moveFileSync(src: string, dest: string, mode?: number): void
以同步方式移动文件。
......
......@@ -17,7 +17,7 @@ import huks from '@ohos.security.huks'
调用接口使用的options中的properties数组中的param。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 类型 | 必填 | 说明 |
| ------ | ----------------------------------- | ---- | ------------ |
......@@ -28,7 +28,7 @@ import huks from '@ohos.security.huks'
调用接口使用的options。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 类型 | 必填 | 说明 |
| ---------- | ----------------- | ---- | ------------------------ |
......@@ -39,7 +39,7 @@ import huks from '@ohos.security.huks'
huks Handle结构体。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 类型 | 必填 | 说明 |
| --------- | ---------- | ---- | ---------------------------------------------------- |
......@@ -50,7 +50,7 @@ huks Handle结构体。
调用接口返回的result。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
......@@ -67,7 +67,7 @@ generateKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\
生成密钥,使用Callback回调异步返回结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
**参数:**
......@@ -142,7 +142,7 @@ generateKeyItem(keyAlias: string, options: HuksOptions) : Promise\<void>
生成密钥,使用Promise方式异步返回结果。基于密钥不出TEE原则,通过promise不会返回密钥材料内容,只用于表示此次调用是否成功。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -216,7 +216,7 @@ deleteKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<v
删除密钥,使用Callback回调异步返回结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
**参数:**
......@@ -267,7 +267,7 @@ deleteKeyItem(keyAlias: string, options: HuksOptions) : Promise\<void>
删除密钥,使用Promise方式异步返回结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -317,7 +317,7 @@ getSdkVersion(options: HuksOptions) : string
获取当前系统sdk版本。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -347,7 +347,7 @@ importKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<v
导入明文密钥,使用Callback方式回调异步返回结果 。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -435,7 +435,7 @@ importKeyItem(keyAlias: string, options: HuksOptions) : Promise\<void>
导入明文密钥,使用Promise方式异步返回结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -524,7 +524,7 @@ attestKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<H
获取密钥证书,使用Callback方式回调异步返回结果 。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -665,7 +665,7 @@ attestKeyItem(keyAlias: string, options: HuksOptions) : Promise\<HuksReturnResul
获取密钥证书,使用Promise方式异步返回结果 。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -811,7 +811,7 @@ importWrappedKeyItem(keyAlias: string, wrappingKeyAlias: string, options: HuksOp
导入加密密钥,使用Callback方式回调异步返回结果 。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1047,7 +1047,7 @@ importWrappedKeyItem(keyAlias: string, wrappingKeyAlias: string, options: HuksOp
导入加密密钥,使用Promise方式异步返回结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1102,7 +1102,7 @@ exportKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<H
导出密钥,使用Callback方式回调异步返回的结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1157,7 +1157,7 @@ exportKeyItem(keyAlias: string, options: HuksOptions) : Promise\<HuksReturnResul
导出密钥,使用Promise方式回调异步返回的结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1217,7 +1217,7 @@ getKeyItemProperties(keyAlias: string, options: HuksOptions, callback: AsyncCall
获取密钥属性,使用Callback回调异步返回结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1272,7 +1272,7 @@ getKeyItemProperties(keyAlias: string, options: HuksOptions) : Promise\<HuksRetu
获取密钥属性,使用Promise回调异步返回结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1332,7 +1332,7 @@ isKeyItemExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<
判断密钥是否存在,使用Callback回调异步返回结果 。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
**参数:**
......@@ -1390,7 +1390,7 @@ isKeyItemExist(keyAlias: string, options: HuksOptions) : Promise\<boolean>
判断密钥是否存在,使用Promise回调异步返回结果 。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1432,7 +1432,7 @@ let keyAlias = 'keyAlias';
let emptyOptions = {
properties: []
};
await huks.isKeyItemExist(keyAlias, emptyOptions).then((data) => {
huks.isKeyItemExist(keyAlias, emptyOptions).then((data) => {
promptAction.showToast({
message: "keyAlias: " + keyAlias +"is existed!",
duration: 500,
......@@ -1451,7 +1451,7 @@ initSession(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<Huk
initSession操作密钥接口,使用Callback回调异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
**参数:**
......@@ -1486,7 +1486,7 @@ initSession(keyAlias: string, options: HuksOptions) : Promise\<HuksSessionHandle
initSession操作密钥接口,使用Promise方式异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1526,7 +1526,7 @@ updateSession(handle: number, options: HuksOptions, callback: AsyncCallback\<Huk
updateSession操作密钥接口,使用Callback回调异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
**参数:**
......@@ -1563,7 +1563,7 @@ updateSession(handle: number, options: HuksOptions, token: Uint8Array, callback:
updateSession操作密钥接口,使用Callback回调异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1601,7 +1601,7 @@ updateSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promis
updateSession操作密钥接口,使用Promise方式异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1644,7 +1644,7 @@ finishSession(handle: number, options: HuksOptions, callback: AsyncCallback\<Huk
finishSession操作密钥接口,使用Callback回调异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
**参数:**
......@@ -1682,7 +1682,7 @@ finishSession(handle: number, options: HuksOptions, token: Uint8Array, callback:
finishSession操作密钥接口,使用Callback回调异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1720,7 +1720,7 @@ finishSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promis
finishSession操作密钥接口,使用Promise方式异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -1763,7 +1763,7 @@ abortSession(handle: number, options: HuksOptions, callback: AsyncCallback\<void
abortSession操作密钥接口,使用Callback回调异步返回结果 。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
**参数:**
......@@ -1922,7 +1922,7 @@ abortSession(handle: number, options: HuksOptions) : Promise\<void>;
abortSession操作密钥接口,使用Promise方式异步返回结果。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2087,7 +2087,7 @@ async function huksAbort() {
关于错误码的具体信息,可在[错误码参考文档](../errorcodes/errorcode-huks.md)中查看。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| ---------------------------------------------- | -------- |--------------------------- |
......@@ -2114,25 +2114,25 @@ async function huksAbort() {
表示密钥用途。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| ------------------------ | ---- | -------------------------------- |
| HUKS_KEY_PURPOSE_ENCRYPT | 1 | 表示密钥用于对明文进行加密操作。 |
| HUKS_KEY_PURPOSE_DECRYPT | 2 | 表示密钥用于对密文进行解密操作。 |
| HUKS_KEY_PURPOSE_SIGN | 4 | 表示密钥用于对数据进行签名。 |
| HUKS_KEY_PURPOSE_VERIFY | 8 | 表示密钥用于验证签名后的数据。 |
| HUKS_KEY_PURPOSE_DERIVE | 16 | 表示密钥用于派生密钥。 |
| HUKS_KEY_PURPOSE_WRAP | 32 | 表示密钥用于加密导出。 |
| HUKS_KEY_PURPOSE_UNWRAP | 64 | 表示密钥加密导入。 |
| HUKS_KEY_PURPOSE_MAC | 128 | 表示密钥用于生成mac消息验证码。 |
| HUKS_KEY_PURPOSE_AGREE | 256 | 表示密钥用于进行密钥协商。 |
| HUKS_KEY_PURPOSE_ENCRYPT | 1 | 表示密钥用于对明文进行加密操作。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_KEY_PURPOSE_DECRYPT | 2 | 表示密钥用于对密文进行解密操作。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_KEY_PURPOSE_SIGN | 4 | 表示密钥用于对数据进行签名。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_KEY_PURPOSE_VERIFY | 8 | 表示密钥用于验证签名后的数据。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_KEY_PURPOSE_DERIVE | 16 | 表示密钥用于派生密钥。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_KEY_PURPOSE_WRAP | 32 | 表示密钥用于加密导出。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_KEY_PURPOSE_UNWRAP | 64 | 表示密钥加密导入。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_KEY_PURPOSE_MAC | 128 | 表示密钥用于生成mac消息验证码。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_KEY_PURPOSE_AGREE | 256 | 表示密钥用于进行密钥协商。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
## HuksKeyDigest
表示摘要算法。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| ---------------------- | ---- | ---------------------------------------- |
......@@ -2149,89 +2149,89 @@ async function huksAbort() {
表示补齐算法。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| ---------------------- | ---- | ---------------------------------------- |
| HUKS_PADDING_NONE | 0 | 表示不使用补齐算法。 |
| HUKS_PADDING_OAEP | 1 | 表示使用OAEP补齐算法。 |
| HUKS_PADDING_PSS | 2 | 表示使用PSS补齐算法。 |
| HUKS_PADDING_PKCS1_V1_5 | 3 | 表示使用PKCS1_V1_5补齐算法。 |
| HUKS_PADDING_PKCS5 | 4 | 表示使用PKCS5补齐算法。 |
| HUKS_PADDING_PKCS7 | 5 | 表示使用PKCS7补齐算法。 |
| HUKS_PADDING_NONE | 0 | 表示不使用补齐算法。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_PADDING_OAEP | 1 | 表示使用OAEP补齐算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_PADDING_PSS | 2 | 表示使用PSS补齐算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_PADDING_PKCS1_V1_5 | 3 | 表示使用PKCS1_V1_5补齐算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_PADDING_PKCS5 | 4 | 表示使用PKCS5补齐算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_PADDING_PKCS7 | 5 | 表示使用PKCS7补齐算法。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
## HuksCipherMode
表示加密模式。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| ------------- | ---- | --------------------- |
| HUKS_MODE_ECB | 1 | 表示使用ECB加密模式。 |
| HUKS_MODE_CBC | 2 | 表示使用CBC加密模式。 |
| HUKS_MODE_CTR | 3 | 表示使用CTR加密模式。 |
| HUKS_MODE_OFB | 4 | 表示使用OFB加密模式。 |
| HUKS_MODE_CCM | 31 | 表示使用CCM加密模式。 |
| HUKS_MODE_GCM | 32 | 表示使用GCM加密模式。 |
| HUKS_MODE_ECB | 1 | 表示使用ECB加密模式。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_MODE_CBC | 2 | 表示使用CBC加密模式。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_MODE_CTR | 3 | 表示使用CTR加密模式。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_MODE_OFB | 4 | 表示使用OFB加密模式。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_MODE_CCM | 31 | 表示使用CCM加密模式。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_MODE_GCM | 32 | 表示使用GCM加密模式。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
## HuksKeySize
表示密钥长度。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| ---------------------------------- | ---- | ------------------------------------------ |
| HUKS_RSA_KEY_SIZE_512 | 512 | 表示使用RSA算法的密钥长度为512bit。 |
| HUKS_RSA_KEY_SIZE_768 | 768 | 表示使用RSA算法的密钥长度为768bit。 |
| HUKS_RSA_KEY_SIZE_1024 | 1024 | 表示使用RSA算法的密钥长度为1024bit。 |
| HUKS_RSA_KEY_SIZE_2048 | 2048 | 表示使用RSA算法的密钥长度为2048bit。 |
| HUKS_RSA_KEY_SIZE_3072 | 3072 | 表示使用RSA算法的密钥长度为3072bit。 |
| HUKS_RSA_KEY_SIZE_4096 | 4096 | 表示使用RSA算法的密钥长度为4096bit。 |
| HUKS_ECC_KEY_SIZE_224 | 224 | 表示使用ECC算法的密钥长度为224bit。 |
| HUKS_ECC_KEY_SIZE_256 | 256 | 表示使用ECC算法的密钥长度为256bit。 |
| HUKS_ECC_KEY_SIZE_384 | 384 | 表示使用ECC算法的密钥长度为384bit。 |
| HUKS_ECC_KEY_SIZE_521 | 521 | 表示使用ECC算法的密钥长度为521bit。 |
| HUKS_AES_KEY_SIZE_128 | 128 | 表示使用AES算法的密钥长度为128bit。 |
| HUKS_AES_KEY_SIZE_192 | 192 | 表示使用AES算法的密钥长度为192bit。 |
| HUKS_AES_KEY_SIZE_256 | 256 | 表示使用AES算法的密钥长度为256bit。 |
| HUKS_AES_KEY_SIZE_512 | 512 | 表示使用AES算法的密钥长度为512bit。 |
| HUKS_CURVE25519_KEY_SIZE_256 | 256 | 表示使用CURVE25519算法的密钥长度为256bit。 |
| HUKS_DH_KEY_SIZE_2048 | 2048 | 表示使用DH算法的密钥长度为2048bit。 |
| HUKS_DH_KEY_SIZE_3072 | 3072 | 表示使用DH算法的密钥长度为3072bit。 |
| HUKS_DH_KEY_SIZE_4096 | 4096 | 表示使用DH算法的密钥长度为4096bit。 |
| HUKS_SM2_KEY_SIZE_256<sup>9+</sup> | 256 | 表示SM2算法的密钥长度为256bit。 |
| HUKS_SM4_KEY_SIZE_128<sup>9+</sup> | 128 | 表示SM4算法的密钥长度为128bit。 |
| HUKS_RSA_KEY_SIZE_512 | 512 | 表示使用RSA算法的密钥长度为512bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_RSA_KEY_SIZE_768 | 768 | 表示使用RSA算法的密钥长度为768bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_RSA_KEY_SIZE_1024 | 1024 | 表示使用RSA算法的密钥长度为1024bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_RSA_KEY_SIZE_2048 | 2048 | 表示使用RSA算法的密钥长度为2048bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_RSA_KEY_SIZE_3072 | 3072 | 表示使用RSA算法的密钥长度为3072bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_RSA_KEY_SIZE_4096 | 4096 | 表示使用RSA算法的密钥长度为4096bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ECC_KEY_SIZE_224 | 224 | 表示使用ECC算法的密钥长度为224bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ECC_KEY_SIZE_256 | 256 | 表示使用ECC算法的密钥长度为256bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ECC_KEY_SIZE_384 | 384 | 表示使用ECC算法的密钥长度为384bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ECC_KEY_SIZE_521 | 521 | 表示使用ECC算法的密钥长度为521bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_AES_KEY_SIZE_128 | 128 | 表示使用AES算法的密钥长度为128bit。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_AES_KEY_SIZE_192 | 192 | 表示使用AES算法的密钥长度为192bit。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_AES_KEY_SIZE_256 | 256 | 表示使用AES算法的密钥长度为256bit。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_AES_KEY_SIZE_512 | 512 | 表示使用AES算法的密钥长度为512bit。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_CURVE25519_KEY_SIZE_256 | 256 | 表示使用CURVE25519算法的密钥长度为256bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_DH_KEY_SIZE_2048 | 2048 | 表示使用DH算法的密钥长度为2048bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_DH_KEY_SIZE_3072 | 3072 | 表示使用DH算法的密钥长度为3072bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_DH_KEY_SIZE_4096 | 4096 | 表示使用DH算法的密钥长度为4096bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_SM2_KEY_SIZE_256<sup>9+</sup> | 256 | 表示SM2算法的密钥长度为256bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_SM4_KEY_SIZE_128<sup>9+</sup> | 128 | 表示SM4算法的密钥长度为128bit。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
## HuksKeyAlg
表示密钥使用的算法。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| ------------------------- | ---- | --------------------- |
| HUKS_ALG_RSA | 1 | 表示使用RSA算法。 |
| HUKS_ALG_ECC | 2 | 表示使用ECC算法。 |
| HUKS_ALG_DSA | 3 | 表示使用DSA算法。 |
| HUKS_ALG_AES | 20 | 表示使用AES算法。 |
| HUKS_ALG_HMAC | 50 | 表示使用HMAC算法。 |
| HUKS_ALG_HKDF | 51 | 表示使用HKDF算法。 |
| HUKS_ALG_PBKDF2 | 52 | 表示使用PBKDF2算法。 |
| HUKS_ALG_ECDH | 100 | 表示使用ECDH算法。 |
| HUKS_ALG_X25519 | 101 | 表示使用X25519算法。 |
| HUKS_ALG_ED25519 | 102 | 表示使用ED25519算法。 |
| HUKS_ALG_DH | 103 | 表示使用DH算法。 |
| HUKS_ALG_SM2<sup>9+</sup> | 150 | 表示使用SM2算法。 |
| HUKS_ALG_SM3<sup>9+</sup> | 151 | 表示使用SM3算法。 |
| HUKS_ALG_SM4<sup>9+</sup> | 152 | 表示使用SM4算法。 |
| HUKS_ALG_RSA | 1 | 表示使用RSA算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_ECC | 2 | 表示使用ECC算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_DSA | 3 | 表示使用DSA算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_AES | 20 | 表示使用AES算法。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_ALG_HMAC | 50 | 表示使用HMAC算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_HKDF | 51 | 表示使用HKDF算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_PBKDF2 | 52 | 表示使用PBKDF2算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_ECDH | 100 | 表示使用ECDH算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_X25519 | 101 | 表示使用X25519算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_ED25519 | 102 | 表示使用ED25519算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_DH | 103 | 表示使用DH算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_SM2<sup>9+</sup> | 150 | 表示使用SM2算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_SM3<sup>9+</sup> | 151 | 表示使用SM3算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_ALG_SM4<sup>9+</sup> | 152 | 表示使用SM4算法。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
## HuksKeyGenerateType
表示生成密钥的类型。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| ------------------------------ | ---- | ---------------- |
......@@ -2243,7 +2243,7 @@ async function huksAbort() {
表示密钥的产生方式。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| -------------------------- | ---- | ------------------------------------ |
......@@ -2256,20 +2256,20 @@ async function huksAbort() {
表示密钥存储方式。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| -------------------------------------------- | ---- | ------------------------------ |
| HUKS_STORAGE_TEMP<sup>(deprecated)</sup> | 0 | 表示通过本地直接管理密钥。<br/>> **说明:** 从API version 10开始废弃,由于开发者正常使用密钥管理过程中并不需要使用此TAG,故无替代接口。针对针对密钥派生场景,可使用HUKS_STORAGE_ONLY_USED_IN_HUKS 与 HUKS_STORAGE_KEY_EXPORT_ALLOWED。 |
| HUKS_STORAGE_PERSISTENT<sup>(deprecated)</sup> | 1 | 表示通过HUKS service管理密钥。<br/>> **说明:** 从API version 10开始废弃,由于开发者正常使用密钥管理过程中并不需要使用此TAG,故无替代接口。针对密钥派生场景,可使用HUKS_STORAGE_ONLY_USED_IN_HUKS 与 HUKS_STORAGE_KEY_EXPORT_ALLOWED。 |
| HUKS_STORAGE_ONLY_USED_IN_HUKS<sup>10+</sup> | 2 | 表示主密钥派生的密钥存储于huks中,由HUKS进行托管 |
| HUKS_STORAGE_KEY_EXPORT_ALLOWED<sup>10+</sup> | 3 | 表示主密钥派生的密钥直接导出给业务方,HUKS不对其进行托管服务 |
| HUKS_STORAGE_TEMP<sup>(deprecated)</sup> | 0 | 表示通过本地直接管理密钥。<br/>> **说明:** 从API version 10开始废弃,由于开发者正常使用密钥管理过程中并不需要使用此TAG,故无替代接口。针对针对密钥派生场景,可使用HUKS_STORAGE_ONLY_USED_IN_HUKS 与 HUKS_STORAGE_KEY_EXPORT_ALLOWED。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_STORAGE_PERSISTENT<sup>(deprecated)</sup> | 1 | 表示通过HUKS service管理密钥。<br/>> **说明:** 从API version 10开始废弃,由于开发者正常使用密钥管理过程中并不需要使用此TAG,故无替代接口。针对密钥派生场景,可使用HUKS_STORAGE_ONLY_USED_IN_HUKS 与 HUKS_STORAGE_KEY_EXPORT_ALLOWED。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_STORAGE_ONLY_USED_IN_HUKS<sup>10+</sup> | 2 | 表示主密钥派生的密钥存储于huks中,由HUKS进行托管 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_STORAGE_KEY_EXPORT_ALLOWED<sup>10+</sup> | 3 | 表示主密钥派生的密钥直接导出给业务方,HUKS不对其进行托管服务 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
## HuksSendType
表示发送Tag的方式。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| -------------------- | ---- | ----------------- |
......@@ -2280,7 +2280,7 @@ async function huksAbort() {
表示导入加密密钥的算法套件。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| ---------------------------------------------- | ---- | ----------------------------------------------------- |
......@@ -2291,7 +2291,7 @@ async function huksAbort() {
表示导入密钥的密钥类型,默认为导入公钥,导入对称密钥时不需要该字段。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| ------------------------- | ---- | ------------------------------ |
......@@ -2303,7 +2303,7 @@ async function huksAbort() {
表示Rsa在签名验签、padding为pss时需指定的salt_len类型。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| ------------------------------------------ | ---- | ---------------------------- |
......@@ -2314,7 +2314,7 @@ async function huksAbort() {
表示用户认证类型。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| ------------------------------- | ---- | ------------------------- |
......@@ -2326,7 +2326,7 @@ async function huksAbort() {
表示安全访问控制类型。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| --------------------------------------- | ---- | ------------------------------------------------ |
......@@ -2337,7 +2337,7 @@ async function huksAbort() {
表示密钥使用时生成challenge的类型。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| ------------------------------- | ---- | ------------------------------ |
......@@ -2349,7 +2349,7 @@ async function huksAbort() {
表示challenge类型为用户自定义类型时,生成的challenge有效长度仅为8字节连续的数据,且仅支持4种位置 。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| ------------------------------- | ---- | ------------------------------ |
......@@ -2362,7 +2362,7 @@ async function huksAbort() {
表示生成或导入密钥时,指定该密钥的签名类型。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
| 名称 | 值 | 说明 |
| ------------------------------ | ---- | ------------------------------------------------------------ |
......@@ -2372,7 +2372,7 @@ async function huksAbort() {
表示Tag的数据类型。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| --------------------- | ------- | --------------------------------------- |
......@@ -2387,95 +2387,95 @@ async function huksAbort() {
表示调用参数的Tag。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Core
| 名称 | 值 | 说明 |
| -------------------------------------------- | ---------------------------------------- | -------------------------------------- |
| HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | 表示非法的Tag。 |
| HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | 表示算法的Tag。 |
| HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | 表示密钥用途的Tag。 |
| HUKS_TAG_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | 表示密钥长度的Tag。 |
| HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | 表示摘要算法的Tag。 |
| HUKS_TAG_PADDING | HuksTagType.HUKS_TAG_TYPE_UINT \| 5 | 表示补齐算法的Tag。 |
| HUKS_TAG_BLOCK_MODE | HuksTagType.HUKS_TAG_TYPE_UINT \| 6 | 表示加密模式的Tag。 |
| HUKS_TAG_KEY_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 7 | 表示密钥类型的Tag。 |
| HUKS_TAG_ASSOCIATED_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 8 | 表示附加身份验证数据的Tag。 |
| HUKS_TAG_NONCE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 9 | 表示密钥加解密的字段。 |
| HUKS_TAG_IV | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10 | 表示密钥初始化的向量。 |
| HUKS_TAG_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 11 | 表示密钥派生时的info。 |
| HUKS_TAG_SALT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 12 | 表示密钥派生时的盐值。 |
| HUKS_TAG_PWD | HuksTagType.HUKS_TAG_TYPE_BYTES \| 13 | 表示密钥派生时的password。 |
| HUKS_TAG_ITERATION | HuksTagType.HUKS_TAG_TYPE_UINT \| 14 | 表示密钥派生时的迭代次数。 |
| HUKS_TAG_KEY_GENERATE_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 15 | 表示生成密钥类型的Tag。 |
| HUKS_TAG_DERIVE_MAIN_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 16 | 表示密钥派生时的主密钥。 |
| HUKS_TAG_DERIVE_FACTOR | HuksTagType.HUKS_TAG_TYPE_BYTES \| 17 | 表示密钥派生时的派生因子。 |
| HUKS_TAG_DERIVE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 18 | 表示密钥派生时的算法类型。 |
| HUKS_TAG_AGREE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 19 | 表示密钥协商时的算法类型。 |
| HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 20 | 表示密钥协商时的公钥别名。 |
| HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 21 | 表示密钥协商时的私钥别名。 |
| HUKS_TAG_AGREE_PUBLIC_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 22 | 表示密钥协商时的公钥。 |
| HUKS_TAG_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 23 | 表示密钥别名。 |
| 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_DERIVED_AGREED_KEY_STORAGE_FLAG<sup>10+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \|29 | 表示派生密钥/协商密钥的存储类型。 |
| HUKS_TAG_RSA_PSS_SALT_LEN_TYPE<sup>10+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \|30 | 表示rsa_pss_salt_length的类型。 |
| 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_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)中选择 |
| HUKS_TAG_CHALLENGE_POS<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 310 | 表示challenge类型为用户自定义类型时,huks产生的challenge有效长度仅为8字节连续的数据。从[HuksChallengePosition](#hukschallengeposition9)中选择。 |
| HUKS_TAG_KEY_AUTH_PURPOSE<sup>10+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \|311 | 表示密钥认证用途的tag |
| HUKS_TAG_ATTESTATION_CHALLENGE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 501 | 表示attestation时的挑战值。 |
| HUKS_TAG_ATTESTATION_APPLICATION_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 502 | 表示attestation时拥有该密钥的application的Id。 |
| HUKS_TAG_ATTESTATION_ID_BRAND | HuksTagType.HUKS_TAG_TYPE_BYTES \| 503 | 表示设备的品牌。 |
| HUKS_TAG_ATTESTATION_ID_DEVICE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 504 | 表示设备的设备ID。 |
| HUKS_TAG_ATTESTATION_ID_PRODUCT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 505 | 表示设备的产品名。 |
| HUKS_TAG_ATTESTATION_ID_SERIAL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 506 | 表示设备的SN号。 |
| HUKS_TAG_ATTESTATION_ID_IMEI | HuksTagType.HUKS_TAG_TYPE_BYTES \| 507 | 表示设备的IMEI号。 |
| HUKS_TAG_ATTESTATION_ID_MEID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 508 | 表示设备的MEID号。 |
| HUKS_TAG_ATTESTATION_ID_MANUFACTURER | HuksTagType.HUKS_TAG_TYPE_BYTES \| 509 | 表示设备的制造商。 |
| HUKS_TAG_ATTESTATION_ID_MODEL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 510 | 表示设备的型号。 |
| HUKS_TAG_ATTESTATION_ID_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 511 | 表示attestation时的密钥别名。 |
| HUKS_TAG_ATTESTATION_ID_SOCID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 512 | 表示设备的SOCID。 |
| HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | 表示设备的UDID。 |
| HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | 表示attestation时的安全凭据。 |
| HUKS_TAG_ATTESTATION_ID_VERSION_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 515 | 表示attestation时的版本号。 |
| HUKS_TAG_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1001 | 表示是否使用生成key时传入的别名的Tag。 |
| HUKS_TAG_KEY_STORAGE_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1002 | 表示密钥存储方式的Tag。 |
| HUKS_TAG_IS_ALLOWED_WRAP | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1003 | 预留。 |
| HUKS_TAG_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | 预留。 |
| HUKS_TAG_KEY_AUTH_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1005 | 预留。 |
| HUKS_TAG_KEY_ROLE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1006 | 预留。 |
| HUKS_TAG_KEY_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1007 | 表示密钥标志的Tag。 |
| HUKS_TAG_IS_ASYNCHRONIZED | HuksTagType.HUKS_TAG_TYPE_UINT \| 1008 | 预留。 |
| HUKS_TAG_SECURE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009 | 预留。 |
| HUKS_TAG_SECURE_KEY_UUID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010 | 预留。 |
| HUKS_TAG_KEY_DOMAIN | HuksTagType.HUKS_TAG_TYPE_UINT \| 1011 | 预留。 |
| HUKS_TAG_PROCESS_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001 | 表示进程名称的Tag。 |
| HUKS_TAG_PACKAGE_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002 | 预留。 |
| HUKS_TAG_ACCESS_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10003 | 预留。 |
| HUKS_TAG_USES_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10004 | 预留。 |
| HUKS_TAG_CRYPTO_CTX | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005 | 预留。 |
| 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_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。 |
| HUKS_TAG_SYMMETRIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20001 | 预留。 |
| HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20002 | 预留。 |
| HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20003 | 预留。 |
| HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | 表示非法的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | 表示算法的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | 表示密钥用途的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | 表示密钥长度的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | 表示摘要算法的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_PADDING | HuksTagType.HUKS_TAG_TYPE_UINT \| 5 | 表示补齐算法的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_BLOCK_MODE | HuksTagType.HUKS_TAG_TYPE_UINT \| 6 | 表示加密模式的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_KEY_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 7 | 表示密钥类型的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_ASSOCIATED_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 8 | 表示附加身份验证数据的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_NONCE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 9 | 表示密钥加解密的字段。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_IV | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10 | 表示密钥初始化的向量。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 11 | 表示密钥派生时的info。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_SALT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 12 | 表示密钥派生时的盐值。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_PWD | HuksTagType.HUKS_TAG_TYPE_BYTES \| 13 | 表示密钥派生时的password。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_ITERATION | HuksTagType.HUKS_TAG_TYPE_UINT \| 14 | 表示密钥派生时的迭代次数。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_GENERATE_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 15 | 表示生成密钥类型的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_DERIVE_MAIN_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 16 | 表示密钥派生时的主密钥。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_DERIVE_FACTOR | HuksTagType.HUKS_TAG_TYPE_BYTES \| 17 | 表示密钥派生时的派生因子。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_DERIVE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 18 | 表示密钥派生时的算法类型。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_AGREE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 19 | 表示密钥协商时的算法类型。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 20 | 表示密钥协商时的公钥别名。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 21 | 表示密钥协商时的私钥别名。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_AGREE_PUBLIC_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 22 | 表示密钥协商时的公钥。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 23 | 表示密钥别名。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | 表示派生密钥的大小。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_IMPORT_KEY_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | 表示导入的密钥类型。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_UNWRAP_ALGORITHM_SUITE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | 表示导入加密密钥的套件。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_DERIVED_AGREED_KEY_STORAGE_FLAG<sup>10+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \|29 | 表示派生密钥/协商密钥的存储类型。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_RSA_PSS_SALT_LEN_TYPE<sup>10+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \|30 | 表示rsa_pss_salt_length的类型。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ACTIVE_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_USAGE_EXPIRE_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_CREATION_DATETIME<sup>(deprecated)</sup> | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | 预留 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | 表示当前密钥属于哪个userID <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| 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 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | 表示authtoken单次有效期。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | 用于传入authToken的字段 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_AUTH_ACCESS_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | 表示安全访问控制类型。从[HuksAuthAccessType](#huksauthaccesstype9)中选择,需要和用户认证类型同时设置。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_SECURE_SIGN_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | 表示生成或导入密钥时,指定该密钥的签名类型。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_CHALLENGE_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | 表示密钥使用时生成的challenge类型。从[HuksChallengeType](#hukschallengetype9)中选择 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_CHALLENGE_POS<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 310 | 表示challenge类型为用户自定义类型时,huks产生的challenge有效长度仅为8字节连续的数据。从[HuksChallengePosition](#hukschallengeposition9)中选择。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_AUTH_PURPOSE<sup>10+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \|311 | 表示密钥认证用途的tag <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_CHALLENGE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 501 | 表示attestation时的挑战值。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_APPLICATION_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 502 | 表示attestation时拥有该密钥的application的Id。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_BRAND | HuksTagType.HUKS_TAG_TYPE_BYTES \| 503 | 表示设备的品牌。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_DEVICE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 504 | 表示设备的设备ID。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_PRODUCT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 505 | 表示设备的产品名。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_SERIAL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 506 | 表示设备的SN号。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_IMEI | HuksTagType.HUKS_TAG_TYPE_BYTES \| 507 | 表示设备的IMEI号。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_MEID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 508 | 表示设备的MEID号。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_MANUFACTURER | HuksTagType.HUKS_TAG_TYPE_BYTES \| 509 | 表示设备的制造商。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_MODEL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 510 | 表示设备的型号。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 511 | 表示attestation时的密钥别名。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_SOCID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 512 | 表示设备的SOCID。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | 表示设备的UDID。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | 表示attestation时的安全凭据。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ATTESTATION_ID_VERSION_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 515 | 表示attestation时的版本号。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1001 | 表示是否使用生成key时传入的别名的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_KEY_STORAGE_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1002 | 表示密钥存储方式的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_IS_ALLOWED_WRAP | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1003 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_AUTH_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1005 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_ROLE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1006 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1007 | 表示密钥标志的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_IS_ASYNCHRONIZED | HuksTagType.HUKS_TAG_TYPE_UINT \| 1008 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_SECURE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_SECURE_KEY_UUID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY_DOMAIN | HuksTagType.HUKS_TAG_TYPE_UINT \| 1011 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_PROCESS_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001 | 表示进程名称的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_PACKAGE_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ACCESS_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10003 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_USES_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10004 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_CRYPTO_CTX | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | 表示密钥版本的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | 用于传入GCM模式中的AEAD数据的字段。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | 表示操作系统版本的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | 表示操作系统补丁级别的Tag。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_SYMMETRIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20001 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Core|
| HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20002 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
| HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20003 | 预留。 <br> **系统能力:** SystemCapability.Security.Huks.Extension|
## huks.generateKey<sup>(deprecated)</sup>
......@@ -2485,7 +2485,7 @@ generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<Huk
> **说明:** 从API Version 9开始废弃,建议使用[huks.generateKeyItem<sup>9+</sup>](#huksgeneratekeyitem9)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2537,7 +2537,7 @@ generateKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>
> **说明:** 从API Version 9开始废弃,建议使用[huks.generateKeyItem<sup>9+</sup>](#huksgeneratekeyitem9-1)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2590,7 +2590,7 @@ deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksR
> **说明:** 从API Version 9开始废弃,建议使用[huks.deleteKeyItem<sup>9+</sup>](#huksdeletekeyitem9)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2619,7 +2619,7 @@ deleteKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>
> **说明:** 从API Version 9开始废弃,建议使用[huks.deleteKeyItem<sup>9+</sup>](#huksdeletekeyitem9-1)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2653,7 +2653,7 @@ importKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksR
> **说明:** 从API Version 9开始废弃,建议使用[huks.importKeyItem<sup>9+</sup>](#huksimportkeyitem9)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2713,7 +2713,7 @@ importKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>
> **说明:** 从API Version 9开始废弃,建议使用[huks.importKeyItem<sup>9+</sup>](#huksimportkeyitem9-1)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2780,7 +2780,7 @@ exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksR
> **说明:** 从API Version 9开始废弃,建议使用[huks.exportKeyItem<sup>9+</sup>](#huksexportkeyitem9)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2809,7 +2809,7 @@ exportKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>
> **说明:** 从API Version 9开始废弃,建议使用[huks.exportKeyItem<sup>9+</sup>](#huksexportkeyitem9-1))替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2843,7 +2843,7 @@ getKeyProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback
> **说明:** 从API Version 9开始废弃,建议使用[huks.getKeyItemProperties<sup>9+</sup>](#huksgetkeyitemproperties9)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2872,7 +2872,7 @@ getKeyProperties(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>
> **说明:** 从API Version 9开始废弃,建议使用[huks.getKeyItemProperties<sup>9+</sup>](#huksgetkeyitemproperties9-1)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2906,7 +2906,7 @@ isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<bool
> **说明:** 从API Version 9开始废弃,建议使用[huks.isKeyItemExist<sup>9+</sup>](#huksiskeyitemexist9)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2935,7 +2935,7 @@ isKeyExist(keyAlias: string, options: HuksOptions) : Promise\<boolean>
> **说明:** 从API Version 9开始废弃,建议使用[huks.isKeyItemExist<sup>9+</sup>](#huksiskeyitemexist9-1)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2969,7 +2969,7 @@ init操作密钥接口,使用Callback回调异步返回结果。huks.init, huk
> **说明:** 从API Version 9开始废弃,建议使用[huks.initSession<sup>9+</sup>](#huksinitsession9-1)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -2987,7 +2987,7 @@ init操作密钥接口,使用Promise方式异步返回结果。huks.init, huks
> **说明:** 从API Version 9开始废弃,建议使用[huks.initSession<sup>9+</sup>](#huksinitsession9-1)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -3010,7 +3010,7 @@ update操作密钥接口,使用Callback回调异步返回结果。huks.init, h
> **说明:** 从API Version 9开始废弃,建议使用[huks.updateSession<sup>9+</sup>](#huksupdatesession9-1)替代。
**系统能力**: SystemCapability.Security.Huks
**系统能力**: SystemCapability.Security.Huks.Extension
**参数:**
......@@ -3029,7 +3029,7 @@ update操作密钥接口,使用Promise方式异步返回结果。huks.init, hu
> **说明:** 从API Version 9开始废弃,建议使用[huks.updateSession<sup>9+</sup>](#huksupdatesession9-2)替代。
**系统能力**: SystemCapability.Security.Huks
**系统能力**: SystemCapability.Security.Huks.Extension
**参数:**
......@@ -3053,7 +3053,7 @@ finish操作密钥接口,使用Callback回调异步返回结果。huks.init, h
> **说明:** 从API Version 9开始废弃,建议使用[huks.finishSession<sup>9+</sup>](#huksfinishsession9)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -3071,7 +3071,7 @@ finish操作密钥接口,使用Promise方式异步返回结果。huks.init, hu
> **说明:** 从API Version 9开始废弃,建议使用[huks.finishSession<sup>9+</sup>](#huksfinishsession9-1)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -3094,7 +3094,7 @@ abort操作密钥接口,使用Callback回调异步返回结果。
> **说明:** 从API Version 9开始废弃,建议使用[huks.abortSession<sup>9+</sup>](#huksabortsession9)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -3205,7 +3205,7 @@ abort操作密钥接口,使用Promise方式异步返回结果。
> **说明:** 从API Version 9开始废弃,建议使用[huks.abortSession<sup>9+</sup>](#huksabortsession9-1)替代。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
**参数:**
......@@ -3323,7 +3323,7 @@ function huksAbort() {
huks Handle结构体。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
> **说明:** 从API Version 9开始废弃,建议使用[HuksSessionHandle<sup>9+</sup>](#hukssessionhandle9)替代。
| 名称 | 类型 | 必填 | 说明 |
......@@ -3336,7 +3336,7 @@ huks Handle结构体。
调用接口返回的result。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
> **说明:** 从API Version 9开始废弃,建议使用[HuksReturnResult<sup>9+</sup>](#huksreturnresult9)替代。
......@@ -3352,7 +3352,7 @@ huks Handle结构体。
表示错误码的枚举。
**系统能力**:SystemCapability.Security.Huks
**系统能力**:SystemCapability.Security.Huks.Extension
> **说明:** 从API Version 9开始废弃,建议使用[HuksExceptionErrCode<sup>9+</sup>](#huksexceptionerrcode9)替代。
| 名称 | 值 | 说明 |
......
......@@ -2284,7 +2284,7 @@ var creator = image.createImageCreator(8192, 8, 4, 8);
## ImageCreator<sup>9+</sup>
图像创建模块,用于请求图像原生数据区域,并开放给应用编译原生图像数据的能力。
在调用以下方法前需要先创建ImageCreator实例。
在调用以下方法前需要先创建ImageCreator实例,ImageCreator不支持多线程
### 属性
......
......@@ -26,6 +26,7 @@ import missionManager from '@ohos.app.ability.missionManager';
| label | string | 是 | 是 | 表示任务的标签。 |
| iconPath | string | 是 | 是 | 表示任务的图标路径。 |
| continuable | boolean | 是 | 是 | 表示任务是否可以迁移。 |
| unclearable<sup>10+</sup> | boolean | 是 | 是 | 表示任务是否可以被用户手动删除。 |
**示例:**
```ts
......@@ -47,6 +48,7 @@ try {
console.log('getMissionInfo label is: ${JSON.stringify(data.label)}');
console.log('getMissionInfo iconPath is: ${JSON.stringify(data.iconPath)}');
console.log('getMissionInfo continuable is: ${JSON.stringify(data.continuable)}');
console.log('getMissionInfo unclearable is: ${JSON.stringify(data.unclearable)}');
});
} catch (paramError) {
console.error('error: ${paramError.code}, ${paramError.message}');
......
......@@ -705,7 +705,7 @@ try {
attach(showKeyboard: boolean, textConfig: TextConfig): Promise&lt;void&gt;
用于自绘控件绑定输入法应用。使用callback异步回调。
用于自绘控件绑定输入法应用。使用promise异步回调。
必须先调用此接口完成自绘控件与输入法应用的绑定,才可以使用输入法框架的以下功能:显示、隐藏键盘;更新光标信息;更改编辑框选中范围;保存配置信息;监听处理由输入法应用发送的信息或命令等。
......
......@@ -1018,7 +1018,7 @@ selectTrack(index: number): void
```js
let index = 2
avPlayer.setBitrate(index)
avPlayer.selectTrack(index)
```
### deselectTrack<sup>10+</sup><a name=avplayer_deselecttrack></a>
......@@ -1071,7 +1071,7 @@ getCurrentTrack(trackType: MediaType, callback: AsyncCallback\<number>): void
let mediaType = media.MediaType.MEDIA_TYPE_AUD;
let trackIndex = null;
avPlayer.getCurrentTrack(mediaType (err, index) => {
avPlayer.getCurrentTrack(mediaType, (err, index) => {
if (err == null) {
console.info('getCurrentTrack success');
trackIndex = index;
......
......@@ -147,7 +147,7 @@ try {
## power.suspend<sup>9+</sup>
suspend(): void
suspend(isImmediate?: boolean): void
休眠设备。
......@@ -155,6 +155,13 @@ suspend(): void
**系统能力:** SystemCapability.PowerManager.PowerManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------- |
| isImmediate<sup>10+</sup> | boolean | 否 | 是否直接休眠设备。不填该参数则默认为false由系统自动检测何时进入休眠。<br>**说明:** 从API version 10开始,支持该参数。|
**错误码:**
以下错误码的详细介绍请参见[系统电源管理错误码](../errorcodes/errorcode-power.md)
......
......@@ -105,6 +105,7 @@ uploadFile(context: BaseContext, config: UploadConfig): Promise&lt;UploadTask&gt
```js
let uploadTask;
let context;
let uploadConfig = {
url: 'http://patch',
header: { key1: "value1", key2: "value2" },
......@@ -113,16 +114,20 @@ uploadFile(context: BaseContext, config: UploadConfig): Promise&lt;UploadTask&gt
data: [{ name: "name123", value: "123" }],
};
try {
request.uploadFile(globalThis.abilityContext, uploadConfig).then((data) => {
request.uploadFile(context, uploadConfig).then((data) => {
uploadTask = data;
}).catch((err) => {
console.error('Failed to request the upload. Cause: ' + JSON.stringify(err));
console.error(`Failed to request the upload. Code: ${err.code}, message: ${err.message}`);
});
} catch (err) {
console.error('err.code : ' + err.code + ', err.message : ' + err.message);
console.error(`Failed to request the upload. Code: ${err.code}, message: ${err.message}`);
}
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
## request.uploadFile<sup>9+</sup>
......@@ -154,6 +159,7 @@ uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback&l
```js
let uploadTask;
let context;
let uploadConfig = {
url: 'http://patch',
header: { key1: "value1", key2: "value2" },
......@@ -162,18 +168,22 @@ uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback&l
data: [{ name: "name123", value: "123" }],
};
try {
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, data) => {
request.uploadFile(context, uploadConfig, (err, data) => {
if (err) {
console.error('Failed to request the upload. Cause: ' + JSON.stringify(err));
console.error(`Failed to request the upload. Code: ${err.code}, message: ${err.message}`);
return;
}
uploadTask = data;
});
} catch (err) {
console.error('err.code : ' + err.code + ', err.message : ' + err.message);
console.error(`Failed to request the upload. Code: ${err.code}, message: ${err.message}`);
}
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
## request.upload<sup>(deprecated)</sup>
upload(config: UploadConfig): Promise&lt;UploadTask&gt;
......@@ -214,7 +224,7 @@ upload(config: UploadConfig): Promise&lt;UploadTask&gt;
request.upload(uploadConfig).then((data) => {
uploadTask = data;
}).catch((err) => {
console.error('Failed to request the upload. Cause: ' + JSON.stringify(err));
console.error(`Failed to request the upload. Code: ${err.code}, message: ${err.message}`);
})
```
......@@ -253,7 +263,7 @@ upload(config: UploadConfig, callback: AsyncCallback&lt;UploadTask&gt;): void
};
request.upload(uploadConfig, (err, data) => {
if (err) {
console.error('Failed to request the upload. Cause: ' + JSON.stringify(err));
console.error(`Failed to request the upload. Code: ${err.code}, message: ${err.message}`);
return;
}
uploadTask = data;
......@@ -485,12 +495,12 @@ delete(): Promise&lt;boolean&gt;
```js
uploadTask.delete().then((result) => {
if (result) {
console.info('Upload task removed successfully. ');
console.info('Succeeded in deleting the upload task.');
} else {
console.error('Failed to remove the upload task. ');
console.error(`Failed to delete the upload task. Code: ${err.code}, message: ${err.message}`);
}
}).catch((err) => {
console.error('Failed to remove the upload task. Cause: ' + JSON.stringify(err));
console.error(`Failed to delete the upload task. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -516,13 +526,13 @@ delete(callback: AsyncCallback&lt;boolean&gt;): void
```js
uploadTask.delete((err, result) => {
if (err) {
console.error('Failed to remove the upload task. Cause: ' + JSON.stringify(err));
console.error(`Failed to delete the upload task. Code: ${err.code}, message: ${err.message}`);
return;
}
if (result) {
console.info('Upload task removed successfully.');
console.info('Succeeded in deleting the upload task.');
} else {
console.error('Failed to remove the upload task.');
console.error(`Failed to delete the upload task. Code: ${err.code}, message: ${err.message}`);
}
});
```
......@@ -551,12 +561,12 @@ remove(): Promise&lt;boolean&gt;
```js
uploadTask.remove().then((result) => {
if (result) {
console.info('Upload task removed successfully. ');
console.info('Succeeded in removing the upload task.');
} else {
console.error('Failed to remove the upload task. ');
console.error(`Failed to remove the upload task. Code: ${err.code}, message: ${err.message}`);
}
}).catch((err) => {
console.error('Failed to remove the upload task. Cause: ' + JSON.stringify(err));
console.error(`Failed to remove the upload task. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -584,13 +594,13 @@ remove(callback: AsyncCallback&lt;boolean&gt;): void
```js
uploadTask.remove((err, result) => {
if (err) {
console.error('Failed to remove the upload task. Cause: ' + JSON.stringify(err));
console.error(`Failed to remove the upload task. Code: ${err.code}, message: ${err.message}`);
return;
}
if (result) {
console.info('Upload task removed successfully.');
console.info('Succeeded in removing the upload task.');
} else {
console.error('Failed to remove the upload task.');
console.error(`Failed to remove the upload task. Code: ${err.code}, message: ${err.message}`);
}
});
```
......@@ -688,17 +698,22 @@ downloadFile(context: BaseContext, config: DownloadConfig): Promise&lt;DownloadT
```js
let downloadTask;
let context;
try {
request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxx.hap' }).then((data) => {
request.downloadFile(context, { url: 'https://xxxx/xxxx.hap' }).then((data) => {
downloadTask = data;
}).catch((err) => {
console.error('Failed to request the download. Cause: ' + JSON.stringify(err));
console.error(`Failed to request the download. Code: ${err.code}, message: ${err.message}`);
})
} catch (err) {
console.error('err.code : ' + err.code + ', err.message : ' + err.message);
console.error(`Failed to request the download. Code: ${err.code}, message: ${err.message}`);
}
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
## request.downloadFile<sup>9+</sup>
......@@ -733,20 +748,25 @@ downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallba
```js
let downloadTask;
let context;
try {
request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxxx.hap',
request.downloadFile(context, { url: 'https://xxxx/xxxxx.hap',
filePath: 'xxx/xxxxx.hap'}, (err, data) => {
if (err) {
console.error('Failed to request the download. Cause: ' + JSON.stringify(err));
console.error(`Failed to request the download. Code: ${err.code}, message: ${err.message}`);
return;
}
downloadTask = data;
});
} catch (err) {
console.error('err.code : ' + err.code + ', err.message : ' + err.message);
console.error(`Failed to request the download. Code: ${err.code}, message: ${err.message}`);
}
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
## request.download<sup>(deprecated)</sup>
download(config: DownloadConfig): Promise&lt;DownloadTask&gt;
......@@ -780,7 +800,7 @@ download(config: DownloadConfig): Promise&lt;DownloadTask&gt;
request.download({ url: 'https://xxxx/xxxx.hap' }).then((data) => {
downloadTask = data;
}).catch((err) => {
console.error('Failed to request the download. Cause: ' + JSON.stringify(err));
console.error(`Failed to request the download. Code: ${err.code}, message: ${err.message}`);
})
```
......@@ -813,7 +833,7 @@ download(config: DownloadConfig, callback: AsyncCallback&lt;DownloadTask&gt;): v
request.download({ url: 'https://xxxx/xxxxx.hap',
filePath: 'xxx/xxxxx.hap'}, (err, data) => {
if (err) {
console.error('Failed to request the download. Cause: ' + JSON.stringify(err));
console.error(`Failed to request the download. Code: ${err.code}, message: ${err.message}`);
return;
}
downloadTask = data;
......@@ -987,7 +1007,7 @@ on(type: 'fail', callback: (err: number) =&gt; void): void
```js
let failCallback = (err) => {
console.info('Download task failed. Cause:' + err);
console.error(`Failed to download the task. Code: ${err.code}, message: ${err.message}`);
};
downloadTask.on('fail', failCallback);
```
......@@ -1014,7 +1034,7 @@ off(type: 'fail', callback?: (err: number) =&gt; void): void
```js
let failCallback = (err) => {
console.info(`Download delete fail notification. err: ${err.message}`);
console.error(`Failed to download the task. Code: ${err.code}, message: ${err.message}`);
};
downloadTask.off('fail', failCallback);
```
......@@ -1040,12 +1060,12 @@ delete(): Promise&lt;boolean&gt;
```js
downloadTask.delete().then((result) => {
if (result) {
console.info('Download task removed.');
console.info('Succeeded in removing the download task.');
} else {
console.error('Failed to remove the download task.');
console.error(`Failed to remove the download task. Code: ${err.code}, message: ${err.message}`);
}
}).catch ((err) => {
console.error('Failed to remove the download task.');
console.error(`Failed to remove the download task. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -1071,13 +1091,13 @@ delete(callback: AsyncCallback&lt;boolean&gt;): void
```js
downloadTask.delete((err, result)=>{
if(err) {
console.error('Failed to remove the download task.');
console.error(`Failed to remove the download task. Code: ${err.code}, message: ${err.message}`);
return;
}
if (result) {
console.info('Download task removed.');
console.info('Succeeded in removing the download task.');
} else {
console.error('Failed to remove the download task.');
console.error(`Failed to remove the download task. Code: ${err.code}, message: ${err.message}`);
}
});
```
......@@ -1103,9 +1123,9 @@ getTaskInfo(): Promise&lt;DownloadInfo&gt;
```js
downloadTask.getTaskInfo().then((downloadInfo) => {
console.info('Download task queried. Data:' + JSON.stringify(downloadInfo))
console.info('Succeeded in querying the download task')
}) .catch((err) => {
console.error('Failed to query the download task. Cause:' + err)
console.error(`Failed to query the download task. Code: ${err.code}, message: ${err.message}`)
});
```
......@@ -1131,9 +1151,9 @@ getTaskInfo(callback: AsyncCallback&lt;DownloadInfo&gt;): void
```js
downloadTask.getTaskInfo((err, downloadInfo)=>{
if(err) {
console.error('Failed to query the download mimeType. Cause:' + JSON.stringify(err));
console.error(`Failed to query the download mimeType. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('download query success. data:'+ JSON.stringify(downloadInfo));
console.info('Succeeded in querying the download mimeType');
}
});
```
......@@ -1159,9 +1179,9 @@ getTaskMimeType(): Promise&lt;string&gt;
```js
downloadTask.getTaskMimeType().then((data) => {
console.info('Download task queried. Data:' + JSON.stringify(data));
console.info('Succeeded in querying the download MimeType');
}).catch((err) => {
console.error('Failed to query the download MimeType. Cause:' + JSON.stringify(err))
console.error(`Failed to query the download MimeType. Code: ${err.code}, message: ${err.message}`)
});
```
......@@ -1187,9 +1207,9 @@ getTaskMimeType(callback: AsyncCallback&lt;string&gt;): void;
```js
downloadTask.getTaskMimeType((err, data)=>{
if(err) {
console.error('Failed to query the download mimeType. Cause:' + JSON.stringify(err));
console.error(`Failed to query the download mimeType. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Download task queried. data:' + JSON.stringify(data));
console.info('Succeeded in querying the download mimeType');
}
});
```
......@@ -1216,12 +1236,12 @@ suspend(): Promise&lt;boolean&gt;
```js
downloadTask.suspend().then((result) => {
if (result) {
console.info('Download task paused. ');
console.info('Succeeded in pausing the download task.');
} else {
console.error('Failed to pause the download task. Cause:' + JSON.stringify(result));
console.error(`Failed to pause the download task. Code: ${err.code}, message: ${err.message}`);
}
}).catch((err) => {
console.error('Failed to pause the download task. Cause:' + JSON.stringify(err));
console.error(`Failed to pause the download task. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -1247,13 +1267,13 @@ suspend(callback: AsyncCallback&lt;boolean&gt;): void
```js
downloadTask.suspend((err, result)=>{
if(err) {
console.error('Failed to pause the download task. Cause:' + JSON.stringify(err));
console.error(`Failed to pause the download task. Code: ${err.code}, message: ${err.message}`);
return;
}
if (result) {
console.info('Download task paused. ');
console.info('Succeeded in pausing the download task.');
} else {
console.error('Failed to pause the download task. Cause:' + JSON.stringify(result));
console.error(`Failed to pause the download task. Code: ${err.code}, message: ${err.message}`);
}
});
```
......@@ -1280,13 +1300,13 @@ restore(): Promise&lt;boolean&gt;
```js
downloadTask.restore().then((result) => {
if (result) {
console.info('Download task resumed.')
console.info('Succeeded in resuming the download task.')
} else {
console.error('Failed to resume the download task. ');
console.error(`Failed to resume the download task. Code: ${err.code}, message: ${err.message}`);
}
console.info('Download task resumed.')
console.info('Succeeded in resuming the download task.')
}).catch((err) => {
console.error('Failed to resume the download task. Cause:' + err);
console.error(`Failed to resume the download task. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -1312,19 +1332,18 @@ restore(callback: AsyncCallback&lt;boolean&gt;): void
```js
downloadTask.restore((err, result)=>{
if (err) {
console.error('Failed to resume the download task. Cause:' + err);
console.error(`Failed to resume the download task. Code: ${err.code}, message: ${err.message}`);
return;
}
if (result) {
console.info('Download task resumed.');
console.info('Succeeded in resuming the download task.');
} else {
console.error('Failed to resume the download task.');
console.error(`Failed to resume the download task. Code: ${err.code}, message: ${err.message}`);
}
});
```
### remove<sup>(deprecated)</sup>
remove(): Promise&lt;boolean&gt;
......@@ -1348,12 +1367,12 @@ remove(): Promise&lt;boolean&gt;
```js
downloadTask.remove().then((result) => {
if (result) {
console.info('Download task removed.');
console.info('Succeeded in removing the download task.');
} else {
console.error('Failed to remove the download task.');
console.error(`Failed to remove the download task. Code: ${err.code}, message: ${err.message}`);
}
}).catch ((err) => {
console.error('Failed to remove the download task.');
console.error(`Failed to remove the download task. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -1381,13 +1400,13 @@ remove(callback: AsyncCallback&lt;boolean&gt;): void
```js
downloadTask.remove((err, result)=>{
if(err) {
console.error('Failed to remove the download task.');
console.error(`Failed to remove the download task. Code: ${err.code}, message: ${err.message}`);
return;
}
if (result) {
console.info('Download task removed.');
console.info('Succeeded in removing the download task.');
} else {
console.error('Failed to remove the download task.');
console.error(`Failed to remove the download task. Code: ${err.code}, message: ${err.message}`);
}
});
```
......@@ -1415,9 +1434,9 @@ query(): Promise&lt;DownloadInfo&gt;
```js
downloadTask.query().then((downloadInfo) => {
console.info('Download task queried. Data:' + JSON.stringify(downloadInfo))
console.info('Succeeded in querying the download task.')
}) .catch((err) => {
console.error('Failed to query the download task. Cause:' + err)
console.error(`Failed to query the download task. Code: ${err.code}, message: ${err.message}`)
});
```
......@@ -1445,9 +1464,9 @@ query(callback: AsyncCallback&lt;DownloadInfo&gt;): void
```js
downloadTask.query((err, downloadInfo)=>{
if(err) {
console.error('Failed to query the download mimeType. Cause:' + JSON.stringify(err));
console.error(`Failed to query the download mimeType. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('download query success. data:'+ JSON.stringify(downloadInfo));
console.info('Succeeded in querying the download task.');
}
});
```
......@@ -1475,9 +1494,9 @@ queryMimeType(): Promise&lt;string&gt;
```js
downloadTask.queryMimeType().then((data) => {
console.info('Download task queried. Data:' + JSON.stringify(data));
console.info('Succeededto in querying the download MimeType.');
}).catch((err) => {
console.error('Failed to query the download MimeType. Cause:' + JSON.stringify(err))
console.error(`Failed to query the download MimeType. Code: ${err.code}, message: ${err.message}`)
});
```
......@@ -1505,9 +1524,9 @@ queryMimeType(callback: AsyncCallback&lt;string&gt;): void;
```js
downloadTask.queryMimeType((err, data)=>{
if(err) {
console.error('Failed to query the download mimeType. Cause:' + JSON.stringify(err));
console.error(`Failed to query the download mimeType. Code: ${err.code}, message: ${err.message}`);
} else {
console.info('Download task queried. data:' + JSON.stringify(data));
console.info('Succeeded in querying the download mimeType.');
}
});
```
......@@ -1536,12 +1555,12 @@ pause(): Promise&lt;void&gt;
```js
downloadTask.pause().then((result) => {
if (result) {
console.info('Download task paused. ');
console.info('Succeeded in pausing the download task.');
} else {
console.error('Failed to pause the download task. Cause:' + JSON.stringify(result));
console.error(`Failed to pause the download task. Code: ${err.code}, message: ${err.message}`);
}
}).catch((err) => {
console.error('Failed to pause the download task. Cause:' + JSON.stringify(err));
console.error(`Failed to pause the download task. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -1569,13 +1588,13 @@ pause(callback: AsyncCallback&lt;void&gt;): void
```js
downloadTask.pause((err, result)=>{
if(err) {
console.error('Failed to pause the download task. Cause:' + JSON.stringify(err));
console.error(`Failed to pause the download task. Code: ${err.code}, message: ${err.message}`);
return;
}
if (result) {
console.info('Download task paused. ');
console.info('Succeeded in pausing the download task.');
} else {
console.error('Failed to pause the download task. Cause:' + JSON.stringify(result));
console.error(`Failed to pause the download task. Code: ${err.code}, message: ${err.message}`);
}
});
```
......@@ -1604,13 +1623,13 @@ resume(): Promise&lt;void&gt;
```js
downloadTask.resume().then((result) => {
if (result) {
console.info('Download task resumed.')
console.info('Succeeded in resuming the download task.')
} else {
console.error('Failed to resume the download task. ');
console.error(`Failed to resume the download task. Code: ${err.code}, message: ${err.message}`);
}
console.info('Download task resumed.')
console.info('Succeeded in resuming the download task.')
}).catch((err) => {
console.error('Failed to resume the download task. Cause:' + err);
console.error(`Failed to resume the download task. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -1638,13 +1657,13 @@ resume(callback: AsyncCallback&lt;void&gt;): void
```js
downloadTask.resume((err, result)=>{
if (err) {
console.error('Failed to resume the download task. Cause:' + err);
console.error(`Failed to resume the download task. Code: ${err.code}, message: ${err.message}`);
return;
}
if (result) {
console.info('Download task resumed.');
console.info('Succeeded in resuming the download task.');
} else {
console.error('Failed to resume the download task.');
console.error(`Failed to resume the download task. Code: ${err.code}, message: ${err.message}`);
}
});
```
......@@ -1895,6 +1914,7 @@ on(event: "progress" | "completed" | "failed", callback: (progress: Progress) =&
**示例:**
```js
let context;
let attachments = [{
name: "taskOnTest",
value: {
......@@ -1928,16 +1948,19 @@ on(event: "progress" | "completed" | "failed", callback: (progress: Progress) =&
let createOnCallback = (progress) => {
console.info('upload task completed.');
};
request.agent.create(globalThis.abilityContext, conf).then((task)=> {
request.agent.create(context, conf).then((task)=> {
task.on('progress', createOnCallback);
task.on('completed', createOnCallback);
task.on('failed', createOnCallback);
console.info(`create a upload task successfully. result: ${task.tid}`);
console.info(`Succeeded in creating a upload task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a upload task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a upload task, Code: ${err.code}, message: ${err.message}`);
});
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
### off('progress'|'completed'|'failed')<sup>10+</sup>
......@@ -1951,7 +1974,7 @@ off(event: "progress" | "completed" | "failed", callback?: (progress: Progress)
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| evt | string | 是 | 订阅的事件类型。<br>- 取值为'progress',表示任务进度;<br/>- 取值为'completed',表示任务已完成;<br/>- 取值为'failed',表示任务失败。 |
| event | string | 是 | 订阅的事件类型。<br>- 取值为'progress',表示任务进度;<br/>- 取值为'completed',表示任务已完成;<br/>- 取值为'failed',表示任务失败。 |
| callback | function | 否 | 发生相关的事件时触发该回调方法,返回任务进度的数据结构|
**错误码:**
......@@ -1965,6 +1988,7 @@ off(event: "progress" | "completed" | "failed", callback?: (progress: Progress)
**示例:**
```js
let context;
let attachments = [{
name: "taskOffTest",
value: {
......@@ -1998,19 +2022,22 @@ off(event: "progress" | "completed" | "failed", callback?: (progress: Progress)
let createOffCallback = (progress) => {
console.info('upload task completed.');
};
request.agent.create(globalThis.abilityContext, conf).then((task)=> {
request.agent.create(context, conf).then((task)=> {
task.on('progress', createOffCallback);
task.on('completed', createOffCallback);
task.on('failed', createOffCallback);
task.off('progress', createOffCallback);
task.off('completed', createOffCallback);
task.off('failed', createOffCallback);
console.info(`create a upload task successfully. result: ${task.tid}`);
console.info(`Succeeded in creating a upload task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a upload task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a upload task, Code: ${err.code}, message: ${err.message}`);
});
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
### start<sup>10+</sup>
......@@ -2040,6 +2067,7 @@ start(callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
let context;
let conf = {
action: request.agent.Action.DOWNLOAD,
url: 'http://127.0.0.1',
......@@ -2062,20 +2090,23 @@ start(callback: AsyncCallback&lt;void&gt;): void
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf).then((task) => {
request.agent.create(context, conf).then((task) => {
task.start((err) => {
if (err) {
console.error(`Failed to start the download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to start the download task, Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`start a download task successfully. `);
})
console.info(`create a download task successfully. result: ${task.tid}`);
console.info(`Succeeded in starting a download task.`);
});
console.info(`Succeeded in creating a download task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a download task, Code: ${err.code}, message: ${err.message}`);
});
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
### start<sup>10+</sup>
......@@ -2105,6 +2136,7 @@ start(): Promise&lt;void&gt;
**示例:**
```js
let context;
let conf = {
action: request.agent.Action.DOWNLOAD,
url: 'http://127.0.0.1',
......@@ -2127,18 +2159,21 @@ start(): Promise&lt;void&gt;
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf).then((task) => {
request.agent.create(context, conf).then((task) => {
task.start().then(() => {
console.info(`start a download task successfully. `);
console.info(`Succeeded in starting a download task.`);
}).catch((err) => {
console.error(`Failed to start the download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to start the download task, Code: ${err.code}, message: ${err.message}`);
});
console.info(`create a download task successfully. result: ${task.tid}`);
console.info(`Succeeded in creating a download task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a download task, Code: ${err.code}, message: ${err.message}`);
});
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
### pause<sup>10+</sup>
......@@ -2167,6 +2202,7 @@ pause(callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
let context;
let conf = {
action: request.agent.Action.DOWNLOAD,
url: 'http://127.0.0.1',
......@@ -2189,17 +2225,17 @@ pause(callback: AsyncCallback&lt;void&gt;): void
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf).then((task) => {
request.agent.create(context, conf).then((task) => {
task.pause((err) => {
if (err) {
console.error(`Failed to pause the download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to pause the download task, Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`pause a download task successfully. `);
})
console.info(`create a download task successfully. result: ${task.tid}`);
console.info(`Succeeded in pausing a download task. `);
});
console.info(`Succeeded in creating a download task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a download task, Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -2231,6 +2267,7 @@ pause(): Promise&lt;void&gt;
**示例:**
```js
let context;
let conf = {
action: request.agent.Action.DOWNLOAD,
url: 'http://127.0.0.1',
......@@ -2253,15 +2290,15 @@ pause(): Promise&lt;void&gt;
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf).then((task) => {
request.agent.create(context, conf).then((task) => {
task.pause().then(() => {
console.info(`pause a upload task successfully. `);
console.info(`Succeeded in pausing a download task. `);
}).catch((err) => {
console.error(`Failed to pause the upload task, because: ${JSON.stringify(err)}`);
console.error(`Failed to pause the upload task, Code: ${err.code}, message: ${err.message}`);
});
console.info(`create a upload task successfully. result: ${task.tid}`);
console.info(`Succeeded in creating a download task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a upload task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a upload task, Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -2295,6 +2332,7 @@ resume(callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
let context;
let conf = {
action: request.agent.Action.DOWNLOAD,
url: 'http://127.0.0.1',
......@@ -2317,15 +2355,17 @@ resume(callback: AsyncCallback&lt;void&gt;): void
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf).then((task) => {
task.resume().then(() => {
console.info(`resume a download task successfully. `);
}).catch((err) => {
console.error(`Failed to resume the download task, because: ${JSON.stringify(err)}`);
request.agent.create(context, conf).then((task) => {
task.resume((err) => {
if (err) {
console.error(`Failed to resume the download task, Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in resuming a download task. `);
});
console.info(`create a download task successfully. result: ${task.tid}`);
console.info(`Succeeded in creating a download task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a download task, Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -2359,6 +2399,7 @@ resume(): Promise&lt;void&gt;
**示例:**
```js
let context;
let conf = {
action: request.agent.Action.DOWNLOAD,
url: 'http://127.0.0.1',
......@@ -2381,17 +2422,15 @@ resume(): Promise&lt;void&gt;
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf).then((task) => {
task.resume((err) => {
if (err) {
console.error(`Failed to resume the download task, because: ${JSON.stringify(err)}`);
return;
}
console.info(`resume a download task successfully. `);
})
console.info(`create a download task successfully. result: ${task.tid}`);
request.agent.create(context, conf).then((task) => {
task.resume().then(() => {
console.info(`Succeeded in resuming a download task. `);
}).catch((err) => {
console.error(`Failed to resume the download task, Code: ${err.code}, message: ${err.message}`);
});
console.info(`Succeeded in creating a download task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a download task, Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -2422,6 +2461,7 @@ stop(callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
let context;
let conf = {
action: request.agent.Action.DOWNLOAD,
url: 'http://127.0.0.1',
......@@ -2444,15 +2484,17 @@ stop(callback: AsyncCallback&lt;void&gt;): void
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf).then((task) => {
task.stop().then(() => {
console.info(`stop a download task successfully. `);
}).catch((err) => {
console.error(`Failed to stop the download task, because: ${JSON.stringify(err)}`);
request.agent.create(context, conf).then((task) => {
task.stop((err) => {
if (err) {
console.error(`Failed to stop the download task, Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in stopping a download task. `);
});
console.info(`create a download task successfully. result: ${task.tid}`);
console.info(`Succeeded in creating a download task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a download task, Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -2483,6 +2525,7 @@ stop(): Promise&lt;void&gt;
**示例:**
```js
let context;
let conf = {
action: request.agent.Action.DOWNLOAD,
url: 'http://127.0.0.1',
......@@ -2505,17 +2548,15 @@ stop(): Promise&lt;void&gt;
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf).then((task) => {
task.stop((err) => {
if (err) {
console.error(`Failed to stop the download task, because: ${JSON.stringify(err)}`);
return;
}
console.info(`stop a download task successfully. `);
})
console.info(`create a download task successfully. result: ${task.tid}`);
request.agent.create(context, conf).then((task) => {
task.stop().then(() => {
console.info(`Succeeded in stopping a download task. `);
}).catch((err) => {
console.error(`Failed to stop the download task, Code: ${err.code}, message: ${err.message}`);
});
console.info(`Succeeded in creating a download task. result: ${task.tid}`);
}).catch((err) => {
console.error(`Failed to create a download task, because: ${JSON.stringify(err)}`);
console.error(`Failed to create a download task, Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -2552,6 +2593,7 @@ create(context: BaseContext, conf: Conf, callback: AsyncCallback&lt;Task&gt;): v
**示例:**
```js
let context;
let attachments = [{
name: "reeateTest",
value: {
......@@ -2582,15 +2624,18 @@ create(context: BaseContext, conf: Conf, callback: AsyncCallback&lt;Task&gt;): v
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf, (err, task) => {
request.agent.create(context, conf, (err, task) => {
if (err) {
console.error(`Failed to create a upload task, because: ${err.message}`);
console.error(`Failed to create a download task, Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`create a upload task successfully. result: ${task.conf}`);
console.info(`Succeeded in creating a download task. result: ${task.conf}`);
});
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
## request.agent.create<sup>10+</sup>
......@@ -2630,6 +2675,7 @@ create(context: BaseContext, conf: Conf): Promise&lt;Task&gt;
**示例:**
```js
let context;
let attachments = [{
name: "reeateTest",
value: {
......@@ -2660,13 +2706,16 @@ create(context: BaseContext, conf: Conf): Promise&lt;Task&gt;
precise: false,
token: "it is a secret"
};
request.agent.create(globalThis.abilityContext, conf).then((task)=> {
console.info(`create a upload task successfully. result: ${task.conf}`);
request.agent.create(context, conf).then((task)=> {
console.info(`Succeeded in creating a download task. result: ${task.conf}`);
}).catch((err) => {
console.error(`Failed to create a upload task, because: ${err.message}`);
console.error(`Failed to create a download task, Code: ${err.code}, message: ${err.message}`);
});
```
> **说明:**
>
> 示例中context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。
## request.agent.remove<sup>10+</sup>
......@@ -2697,10 +2746,10 @@ remove(id: string, callback: AsyncCallback&lt;void&gt;): void
```js
request.agent.remove("id", (err) => {
if (err) {
console.error(`Failed to remove a upload task, because: ${JSON.stringify(err)}`);
console.error(`Failed to removing a download task, Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`remove a upload task successfully.`);
console.info(`Succeeded in creating a download task.`);
});
```
......@@ -2738,9 +2787,9 @@ remove(id: string): Promise&lt;void&gt;
```js
request.agent.remove("id").then(() => {
console.info(`remove a upload task successfully. `);
console.info(`Succeeded in removing a download task. `);
}).catch((err) => {
console.error(`Failed to remove a upload task, because: ${JSON.stringify(err)}`);
console.error(`Failed to remove a download task, Code: ${err.code}, message: ${err.message}`);
});
```
......
......@@ -2434,6 +2434,14 @@ getUIContext(): UIContext
| ---------- | ---------------------- |
| [UIContext](./js-apis-arkui-UIContext.md#uicontext) | 返回UIContext实例对象。 |
**错误码:**
以下错误码的详细介绍请参见[窗口错误码](../errorcodes/errorcode-window.md)
| 错误码ID | 错误信息 |
| ------- | ------------------------------ |
| 1300002 | This window state is abnormal. |
**示例:**
```ts
......
......@@ -27,16 +27,16 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex
## 属性
除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性:
除支持[通用属性](ts-universal-attributes-size.md)[文本通用属性](ts-universal-attributes-text-style.md)的fontColor、fontSize、fontStyle、fontWeight、fontFamily外,还支持以下属性:
| 名称 | 参数类型 | 描述 |
| ------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | 设置placeholder文本颜色。 |
| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | 设置placeholder文本颜色。<br/>默认值跟随主题。 |
| placeholderFont | [Font](ts-types.md#font) | 设置placeholder文本样式,包括字体大小,字体粗细,字体族,字体风格。目前仅支持默认字体族。 |
| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本在输入框中的水平对齐式。<br/>默认值:TextAlign.Start |
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | 设置输入框光标颜色。 |
| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本在输入框中的水平对齐方式。<br/>默认值:TextAlign.Start<br/>说明:<br/>可通过[align](ts-universal-attributes-location.md)属性控制文本段落在垂直方向上的位置,此组件中不可通过align属性控制文本段落在水平方向上的位置,即align属性中Alignment.TopStart、Alignment.Top、Alignment.TopEnd效果相同,控制内容在顶部,Alignment.Start、Alignment.Center、Alignment.End效果相同,控制内容垂直居中,Alignment.BottomStart、Alignment.Bottom、Alignment.BottomEnd效果相同,控制内容在底部。 |
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | 设置输入框光标颜色。<br/>默认值:'#007DFF'。 |
| inputFilter<sup>8+</sup> | {<br/>value:&nbsp;[ResourceStr](ts-types.md#resourcestr),<br/>error?:&nbsp;(value:&nbsp;string) => void<br/>} | 通过正则表达式设置输入过滤器。匹配表达式的输入允许显示,不匹配的输入将被过滤。仅支持单个字符匹配,不支持字符串匹配。<br/>-&nbsp;value:设置正则表达式。<br/>-&nbsp;error:正则匹配失败时,返回被过滤的内容。 |
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。<br>设置CopyOptions.None时,当前TextArea中的文字无法被复制或剪切,仅支持粘贴。 |
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。<br/>默认值:CopyOptions.LocalDevice,支持设备内复制。 <br/>设置CopyOptions.None时,当前TextArea中的文字无法被复制或剪切,仅支持粘贴。 |
| maxLength<sup>10+</sup> | number | 设置文本的最大输入字符数。<br/>默认不设置最大输入字符数限制。 |
| showCounter<sup>10+</sup> | boolean | 设置文本最大输入字符数后,是否显示字数。<br/>默认值:false |
| style<sup>10+</sup> | [TextContentStyle](enums.d.ts#TextContentStyle) | 设置文本框多态样式。<br/>默认值:TextContentStyle.DEFAULT |
......
......@@ -27,27 +27,27 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te
## 属性
除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性:
除支持[通用属性](ts-universal-attributes-size.md)[文本通用属性](ts-universal-attributes-text-style.md)的fontColor、fontSize、fontStyle、fontWeight、fontFamily外,还支持以下属性:
| 名称 | 参数类型 | 描述 |
| ------------------------ | ---------------------------------------- | ---------------------------------------- |
| type | [InputType](#inputtype枚举说明) | 设置输入框类型。<br/>默认值:InputType.Normal |
| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | 设置placeholder文本颜色。|
| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | 设置placeholder文本颜色。<br/>默认值跟随主题。 |
| placeholderFont | [Font](ts-types.md#font) | 设置placeholder文本样式。 |
| enterKeyType | [EnterKeyType](#enterkeytype枚举说明) | 设置输入法回车键类型,目前仅支持默认类型显示。<br/>默认值:EnterKeyType.Done |
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | 设置输入框光标颜色。 |
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | 设置输入框光标颜色。<br/>默认值:'#007DFF'。 |
| maxLength | number | 设置文本的最大输入字符数。 |
| inputFilter<sup>8+</sup> | {<br/>value:&nbsp;[ResourceStr](ts-types.md#resourcestr),<br/>error?:&nbsp;(value:&nbsp;string)&nbsp;=&gt;&nbsp;void<br/>} | 正则表达式,匹配表达式的输入允许显示,不匹配的输入将被过滤。目前仅支持单个字符匹配,不支持字符串匹配。<br/>-&nbsp;value:设置正则表达式。<br/>-&nbsp;error:正则匹配失败时,返回被过滤的内容。 |
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。<br>设置CopyOptions.None时,当前TextInput中的文字无法被复制或剪切,仅支持粘贴。 |
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。<br/>默认值:CopyOptions.LocalDevice,支持设备内复制。<br/>设置CopyOptions.None时,当前TextInput中的文字无法被复制或剪切,仅支持粘贴。 |
| showPasswordIcon<sup>9+</sup> | boolean | 密码输入模式时,输入框末尾的图标是否显示。<br/>默认值:true |
| style<sup>9+</sup> | [TextInputStyle](#textinputstyle9枚举说明) \| [TextContentStyle](enums.d.ts#TextContentStyle) | 设置输入框为默认风格或内联输入风格。<br/>默认值:TextInputStyle.Default |
| textAlign<sup>9+</sup> | [TextAlign](ts-appendix-enums.md#textalign) | 设置输入文本在输入框中的对齐方式。<br/>默认值:TextAlign.Start |
| textAlign<sup>9+</sup> | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本在输入框中的水平对齐方式。<br/>默认值:TextAlign.Start<br/>说明:<br/>可通过[align](ts-universal-attributes-location.md)属性控制文本段落在垂直方向上的位置,此组件中不可通过align属性控制文本段落在水平方向上的位置,即align属性中Alignment.TopStart、Alignment.Top、Alignment.TopEnd效果相同,控制内容在顶部,Alignment.Start、Alignment.Center、Alignment.End效果相同,控制内容垂直居中,Alignment.BottomStart、Alignment.Bottom、Alignment.BottomEnd效果相同,控制内容在底部。 |
| selectedBackgroundColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | 设置文本选中底板颜色。<br/>如果未设置透明度,默认为不透明(例如:“0x80000000”为50%透明度黑色)。 |
| caretStyle<sup>10+</sup> | {<br/>width:&nbsp;[Length](ts-types.md#length)<br/>} | 设置光标风格。 |
| caretPosition<sup>10+</sup> | number | 设置光标位置。 |
| showUnit<sup>10+</sup> | &nbsp;[CustomBuilder](ts-types.md#CustomBuilder8) | 设置控件作为文本框单位。<br/>默认无单位。 |
| showError<sup>10+</sup> | string&nbsp;\|&nbsp;undefined | 设置错误状态下提示的错误文本或者不显示错误状态。<br/>默认不显示错误状态。 |
| showUnderLine<sup>10+</sup> | boolean | 设置是否开启下划线。<br/>默认值:false |
| showUnderline<sup>10+</sup> | boolean | 设置是否开启下划线。<br/>默认值:false |
| passwordIcon<sup>10+</sup> | [PasswordIcon](#passwordicon10对象说明) | 密码输入模式时,设置输入框末尾的图标。<br/>默认为系统提供的密码图标。 |
> **说明:**
......
......@@ -45,7 +45,7 @@ Swiper(controller?: SwiperController)
| cachedCount<sup>8+</sup> | number | 设置预加载子组件个数。<br/>默认值:1<br/>**说明:** <br/>cachedCount已经做了预加载的优化,不建议与[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)一起使用。 |
| disableSwipe<sup>8+</sup> | boolean | 禁用组件滑动切换功能。<br/>默认值:false |
| curve<sup>8+</sup> | [Curve](ts-appendix-enums.md#curve) \| string | 设置Swiper的动画曲线,默认为淡入淡出曲线,常用曲线参考[Curve枚举说明](ts-appendix-enums.md#curve),也可以通过[插值计算](../apis/js-apis-curve.md)模块提供的接口创建自定义的插值曲线对象。<br/>默认值:Curve.Linear |
| indicatorStyle<sup>8+</sup> | {<br/>left?:&nbsp;[Length](ts-types.md#length),<br/>top?:&nbsp;[Length](ts-types.md#length),<br/>right?:&nbsp;[Length](ts-types.md#length),<br/>bottom?:&nbsp;[Length](ts-types.md#length),<br/>size?:&nbsp;[Length](ts-types.md#length),<br/>mask?:&nbsp;boolean,<br/>color?:&nbsp;[ResourceColor](ts-types.md),<br/>selectedColor?:&nbsp;[ResourceColor](ts-types.md)<br/>} | 设置导航点样式:<br/>\- left: 设置导航点距离Swiper组件左边的距离。<br/>\- top: 设置导航点距离Swiper组件顶部的距离。<br/>\- right: 设置导航点距离Swiper组件右边的距离。<br/>\- bottom: 设置导航点距离Swiper组件底部的距离。<br/>\- size: 设置导航点的直径,不支持设置百分比。默认值:6vp。<br/>\- mask: 设置是否显示导航点蒙层样式。<br/>\- color: 设置导航点的颜色。<br/>\- selectedColor: 设置选中的导航点的颜色。 |
| indicatorStyle<sup>(deprecated)</sup> | {<br/>left?:&nbsp;[Length](ts-types.md#length),<br/>top?:&nbsp;[Length](ts-types.md#length),<br/>right?:&nbsp;[Length](ts-types.md#length),<br/>bottom?:&nbsp;[Length](ts-types.md#length),<br/>size?:&nbsp;[Length](ts-types.md#length),<br/>mask?:&nbsp;boolean,<br/>color?:&nbsp;[ResourceColor](ts-types.md),<br/>selectedColor?:&nbsp;[ResourceColor](ts-types.md)<br/>} | 设置导航点样式:<br/>\- left: 设置导航点距离Swiper组件左边的距离。<br/>\- top: 设置导航点距离Swiper组件顶部的距离。<br/>\- right: 设置导航点距离Swiper组件右边的距离。<br/>\- bottom: 设置导航点距离Swiper组件底部的距离。<br/>\- size: 设置导航点的直径,不支持设置百分比。默认值:6vp。<br/>\- mask: 设置是否显示导航点蒙层样式。<br/>\- color: 设置导航点的颜色。<br/>\- selectedColor: 设置选中的导航点的颜色。 <br/>从API version 8开始支持,从API version 10开始不再维护,建议使用[indicator](#indicator10对象说明)代替。|
| displayCount<sup>8+</sup> | number\|string | 设置一页内元素显示个数。<br/>默认值:1<br/>**说明:** <br/>字符串类型仅支持设置为'auto',显示效果同SwiperDisplayMode.AutoLinear。<br/>使用number类型时,子组件按照主轴均分Swiper宽度(减去displayCount-1的itemSpace)的方式进行主轴拉伸(收缩)布局。 |
| effectMode<sup>8+</sup> | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 滑动效果,目前支持的滑动效果参见EdgeEffect的枚举说明。<br/>默认值:EdgeEffect.Spring<br/>**说明:** <br/>控制器接口调用时不生效回弹。 |
| displayArrow<sup>10+</sup> | value:[ArrowStyle](#arrowstyle10) \| boolean,<br/>isHoverShow?: boolean | 设置导航点箭头样式。<br/>默认值:false<br/>isHoverShow:鼠标悬停时显示箭头 |
......
......@@ -63,7 +63,7 @@
| top | [Length](#length) | 否 | 上外边距,组件顶部距组件外元素的尺寸。 |
| right | [Length](#length) | 否 | 右外边距,组件右边界距组件外元素的尺寸。 |
| bottom | [Length](#length) | 否 | 下外边距,组件底部距组件外元素的尺寸。 |
| left | [Length](#length) | 否 | 外边距,组件左边界距组件外元素的尺寸。 |
| left | [Length](#length) | 否 | 外边距,组件左边界距组件外元素的尺寸。 |
## EdgeWidths<sup>9+</sup>
......
......@@ -17,7 +17,7 @@
| size | {<br/>width?:&nbsp;[Length](ts-types.md#length),<br/>height?:&nbsp;[Length](ts-types.md#length)<br/>} | 设置高宽尺寸。<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。<br />从API version 10开始,该接口支持calc计算特性。 |
| padding | [Padding](ts-types.md#padding)&nbsp;\|&nbsp;[Length](ts-types.md#length) | 设置内边距属性。<br/>参数为Length类型时,四个方向内边距同时生效。<br>默认值:0 <br>padding设置百分比时,上下左右内边距均以父容器的width作为基础值。<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。<br />从API version 10开始,该接口支持calc计算特性。 |
| margin | [Margin](ts-types.md#margin)&nbsp;\|&nbsp;[Length](ts-types.md#length) | 设置外边距属性。<br/>参数为Length类型时,四个方向外边距同时生效。<br>默认值:0 <br>margin设置百分比时,上下左右外边距均以父容器的width作为基础值。<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。<br />从API version 10开始,该接口支持calc计算特性。 |
| constraintSize | {<br/>minWidth?:&nbsp;[Length](ts-types.md#length),<br/>maxWidth?:&nbsp;[Length](ts-types.md#length),<br/>minHeight?:&nbsp;[Length](ts-types.md#length),<br/>maxHeight?:&nbsp;[Length](ts-types.md#length)<br/>} | 设置约束尺寸,组件布局时,进行尺寸范围限制。constraintSize的优先级高于Width和Height。取值结果[参考](ts-universal-attributes-size.md##constraintSize取值对width/height影响)<br>默认值:<br>{<br/>minWidth:&nbsp;0,<br/>maxWidth:&nbsp;Infinity,<br/>minHeight:&nbsp;0,<br/>maxHeight:&nbsp;Infinity<br/>}<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。<br />从API version 10开始,该接口支持calc计算特性。 |
| constraintSize | {<br/>minWidth?:&nbsp;[Length](ts-types.md#length),<br/>maxWidth?:&nbsp;[Length](ts-types.md#length),<br/>minHeight?:&nbsp;[Length](ts-types.md#length),<br/>maxHeight?:&nbsp;[Length](ts-types.md#length)<br/>} | 设置约束尺寸,组件布局时,进行尺寸范围限制。constraintSize的优先级高于Width和Height。取值结果参考[constraintSize取值对width/height影响](ts-universal-attributes-size.md#constraintsize取值对widthheight影响)<br>默认值:<br>{<br/>minWidth:&nbsp;0,<br/>maxWidth:&nbsp;Infinity,<br/>minHeight:&nbsp;0,<br/>maxHeight:&nbsp;Infinity<br/>}<br/>从API version 9开始,该接口支持在ArkTS卡片中使用。<br />从API version 10开始,该接口支持calc计算特性。 |
## constraintSize取值对width/height影响
......
......@@ -25,6 +25,7 @@
- [Init](init.md)
- [Memory](memory.md)
- [UsbDdk](_usb_ddk.md)
- [Hitrace](_hitrace.md)
- 头文件
- [drawing_bitmap.h](drawing__bitmap_8h.md)
- [drawing_brush.h](drawing__brush_8h.md)
......@@ -76,6 +77,7 @@
- [purgeable_memory.h](purgeable__memory_8h.md)
- [usb_ddk_api.h](usb__ddk__api_8h.md)
- [usb_ddk_types.h](usb__ddk__types_8h.md)
- [trace.h](trace_8h.md)
- 结构体
- [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)
- [OH_NativeBuffer_Config](_o_h___native_buffer___config.md)
......
# Hitrace
## 概述
hiTraceMeter为开发者提供系统性能打点接口。
开发者通过在自己的业务逻辑中的关键代码位置调用HiTraceMeter系统跟踪提供的API接口,能够有效进行关键执行流程耗时度量和问题定位。
\@syscap SystemCapability.HiviewDFX.HiTrace
**起始版本:**
10
## 汇总
### 文件
| 名称 | 描述 |
| -------- | -------- |
| [trace.h](trace_8h.md) | HiTraceMeterH模块打点接口定义,通过这些接口实现性能打点相关功能。 |
### 函数
| 名称 | 描述 |
| -------- | -------- |
| [OH_HiTrace_StartTrace](#oh_hitrace_starttrace) (const char \*name) | 标记一个同步跟踪耗时任务的开始。 |
| [OH_HiTrace_FinishTrace](#oh_hitrace_finishtrace) (void) | 标记一个同步跟踪耗时任务的结束。 |
| [OH_HiTrace_StartAsyncTrace](#oh_hitrace_startasynctrace) (const char \*name, int32_t taskId) | 标记一个异步跟踪耗时任务的开始。 |
| [OH_HiTrace_FinishAsyncTrace](#oh_hitrace_finishasynctrace) (const char \*name, int32_t taskId) | 标记一个异步跟踪耗时任务的结束。 |
| [OH_HiTrace_CountTrace](#oh_hitrace_counttrace) (const char \*name, int64_t count) | 用于跟踪给定整数变量名和整数值。 |
## 函数说明
### OH_HiTrace_CountTrace()
```
void OH_HiTrace_CountTrace (const char * name, int64_t count )
```
**描述:**
用于跟踪给定整数变量名和整数值。
多次执行该接口可以跟踪给定整数变量在不同时刻的数值变化。
**参数:**
| 名称 | 描述 |
| -------- | -------- |
| name | 整数变量跟踪的名字,不必与真实变量名相同。 |
| count | 整数数值,一般可以传入整数变量。 |
**起始版本:**
10
### OH_HiTrace_FinishAsyncTrace()
```
void OH_HiTrace_FinishAsyncTrace (const char * name, int32_t taskId )
```
**描述:**
标记一个异步跟踪耗时任务的结束。
在异步操作完成后如回调函数中调用,进行结束打点。 和OH_HiTrace_StartAsyncTrace配对使用,参数name和taskId必须与异步跟踪的开始打点接口OH_HiTrace_StartAsyncTrace的对应参数值一致。
**参数:**
| 名称 | 描述 |
| -------- | -------- |
| name | 异步跟踪的名字。 |
| taskId | 异步跟踪的ID。异步跟踪开始和结束由于不是顺序发生的,所以需要通过name和每次执行唯一的taskId进行开始和结束的匹配。 |
**起始版本:**
10
### OH_HiTrace_FinishTrace()
```
void OH_HiTrace_FinishTrace (void )
```
**描述:**
标记一个同步跟踪耗时任务的结束。
必须和OH_HiTrace_StartTrace配对使用。跟踪数据解析时,和其前执行流程中最近的OH_HiTrace_StartTrace进行匹配。
**起始版本:**
10
### OH_HiTrace_StartAsyncTrace()
```
void OH_HiTrace_StartAsyncTrace (const char * name, int32_t taskId )
```
**描述:**
标记一个异步跟踪耗时任务的开始。
用于在异步操作前调用进行开始打点,异步跟踪开始和结束数据由于不是顺序发生的,所以解析时需要通过一个唯一的taskId进行识别,这个taskId作为异步接口的参数传入。 和OH_HiTrace_FinishAsyncTrace配对使用,参数name和taskId相同的这两个接口调用匹配成一个异步跟踪耗时任务。 如果有多个相同name的任务需要跟踪或者对同一个任务跟踪多次,并且任务同时被执行,则每次调用startTrace的taskId不相同。 如果具有相同name的任务是串行执行的,则taskId可以相同。
**参数:**
| 名称 | 描述 |
| -------- | -------- |
| name | 异步跟踪的名字。 |
| taskId | 异步跟踪的ID。 异步跟踪开始和结束由于不是顺序发生的,所以需要通过name和每次执行唯一的taskId进行开始和结束的匹配。 |
**起始版本:**
10
### OH_HiTrace_StartTrace()
```
void OH_HiTrace_StartTrace (const char * name)
```
**描述:**
标记一个同步跟踪耗时任务的开始。
同步跟踪打点接口OH_HiTrace_StartTrace和OH_HiTrace_FinishTrace必须配对使用。 OH_HiTrace_StartTrace和OH_HiTrace_FinishTrace函数对可以以嵌套模式使用,跟踪数据解析时使用栈式数据结构进行匹配。
**参数:**
| 名称 | 描述 |
| -------- | -------- |
| name | 跟踪的名字。 |
**起始版本:**
10
# trace.h
## 概述
HiTraceMeterH模块打点接口定义,通过这些接口实现性能打点相关功能。
使用示例:
同步时间片跟踪事件:
```
OH_HiTrace_StartTrace("hitraceTest");
OH_HiTrace_FinishTrace();
```
结果输出:
```
<...>-1668 (----—) [003] .... 135.059377: tracing_mark_write: B|1668|H:hitraceTest
<...>-1668 (----—) [003] .... 135.059415: tracing_mark_write: E|1668|
```
异步时间片跟踪事件:
```
OH_HiTrace_StartAsyncTrace("hitraceTest", 123);
OH_HiTrace_FinishAsyncTrace("hitraceTest", 123);
```
结果输出:
```
<...>-2477 (----—) [001] .... 396.427165: tracing_mark_write: S|2477|H:hitraceTest 123
<...>-2477 (----—) [001] .... 396.427196: tracing_mark_write: F|2477|H:hitraceTest 123
```
整数值跟踪事件:
```
OH_HiTrace_CountTrace("hitraceTest", 500);
```
结果输出:
```
<...>-2638 (----—) [002] .... 458.904382: tracing_mark_write: C|2638|H:hitraceTest 500
```
**起始版本:**
10
**相关模块:**
[Hitrace](_hitrace.md)
## 汇总
### 函数
| 名称 | 描述 |
| -------- | -------- |
| [OH_HiTrace_StartTrace](_hitrace.md#oh_hitrace_starttrace) (const char \*name) | 标记一个同步跟踪耗时任务的开始。 |
| [OH_HiTrace_FinishTrace](_hitrace.md#oh_hitrace_finishtrace) (void) | 标记一个同步跟踪耗时任务的结束。 |
| [OH_HiTrace_StartAsyncTrace](_hitrace.md#oh_hitrace_startasynctrace) (const char \*name, int32_t taskId) | 标记一个异步跟踪耗时任务的开始。 |
| [OH_HiTrace_FinishAsyncTrace](_hitrace.md#oh_hitrace_finishasynctrace) (const char \*name, int32_t taskId) | 标记一个异步跟踪耗时任务的结束。 |
| [OH_HiTrace_CountTrace](_hitrace.md#oh_hitrace_counttrace) (const char \*name, int64_t count) | 用于跟踪给定整数变量名和整数值。 |
......@@ -137,3 +137,13 @@ OpenHarmony的N-API组件对Node-API的接口进行了重新实现,底层对
|FUNC|napi_get_value_bigint_int64|获取给定js `BigInt`对应的C int64值。|
|FUNC|napi_get_value_bigint_uint64|获取给定js `BigInt`对应的C uint64值。|
|FUNC|napi_get_value_bigint_words|获取给定js `BigInt`对应的信息,包括符号位、64位小端序数组和数组中的元素个数。|
|FUNC|napi_create_buffer|创建并获取一个指定大小的js `Buffer`。|
|FUNC|napi_create_buffer_copy|创建并获取一个指定大小的js `Buffer`,并以给定数据进行初始化。|
|FUNC|napi_create_external_buffer|创建并获取一个指定大小的js `Buffer`,并以给定数据进行初始化,该接口可为`Buffer`附带额外数据。|
|FUNC|napi_get_buffer_info|获取js `Buffer`底层data及其长度。|
|FUNC|napi_is_buffer|判断给定js value是否为`Buffer`对象。|
|FUNC|napi_object_freeze|冻结给定的对象。|
|FUNC|napi_object_seal|密封给定的对象。|
|FUNC|napi_get_all_property_names|获取一个数组,其中包含此对象过滤后的属性名称。|
|FUNC|napi_detach_arraybuffer|分离给定`ArrayBuffer`的底层数据。|
|FUNC|napi_is_detached_arraybuffe|判断给定的`ArrayBuffer`是否已被分离过。|
......@@ -2037,3 +2037,23 @@
**授权方式**:system_grant
**ACL使能**:TRUE
## ohos.permission.MANAGE_ECOLOGICAL_RULE
允许为管控服务设置场景值生成规则和配套的体验。
**权限级别**:system_basic
**授权方式**:system_grant
**ACL使能**:TRUE
## ohos.permission.GET_SCENE_CODE
允许应用获取指定应用当前的场景值。
**权限级别**:system_basic
**授权方式**:system_grant
**ACL使能**:TRUE
......@@ -10,14 +10,6 @@
> _3、所有斜体为写作指导,正式文档中注意全部删除。_
## xxx概述
_必选。根据具体**方案/特性/功能/模块**情况的场景划分情况,此处的“xxx概述”与具体任务场景下的“任务场景n概述”按需提供一处或共存,具体的:_
_1、此处的“xxx概述”:用于承载开发者需要了解的、本特性各任务场景通用的概述内容。如无,则删除。_
_2、“任务场景n概述”:用于承载任务场景n直接相关的概述内容,知识点构成及写作要点与“xxx概述”相同,包括任务场景n简介、任务场景n直接相关的基本概念、任务场景n直接相关的实现原理、任务场景n直接相关的约束与限制、任务场景n直接相关的相关实例。如无,则删除。_
**_【开发指南总体写作要求】_**
**_1、目标对象:_**_面向内、外部开发者(含产品经理、开发人员)。面向UX设计师的指导文档通常由专门的UX设计规范承载,不在开发指南范畴。本文如需提及,以超链接方式指向对应UX规范即可。_
......@@ -28,7 +20,16 @@ _2、“任务场景n概述”:用于承载任务场景n直接相关的概述
**_4、面向任务:_**_聚焦开发者实际任务,完整、正确、易用,具备权威指导性。_
_5、不要受限:模板只是基础框架,不要僵化。_
**_5、不要受限:_**_模板只是基础框架,不要僵化。_
## xxx概述
_必选。根据具体**方案/特性/功能/模块**情况的场景划分情况,此处的“xxx概述”与具体任务场景下的“任务场景n概述”按需提供一处或共存,具体的:_
_1、此处的“xxx概述”:用于承载开发者需要了解的、本特性各任务场景通用的概述内容。如无,则删除。_
_2、“任务场景n概述”:用于承载任务场景n直接相关的概述内容,知识点构成及写作要点与“xxx概述”相同,包括任务场景n简介、任务场景n直接相关的基本概念、任务场景n直接相关的实现原理、任务场景n直接相关的约束与限制、任务场景n直接相关的相关实例。如无,则删除。_
### xxx简介
......
# OpenHarmony应用UX设计规范发布版
# OpenHarmony应用UX设计规范
- [应用UX设计](app-ux-design.md)
- [应用UX设计原则](app-ux-design.md)
- 应用架构设计
- [应用导航结构设计要求](app-navigation-structure-design.md)
- [应用页面结构设计](app-page-structure-design.md)
......
# 应用UX设计
# 应用UX设计原则
## 设计原则
......
......@@ -293,8 +293,8 @@ OpenHarmony 4.0 Beta1版本开始提供首批API Level 10接口。
| -------- | -------- | -------- |
| OpenHarmony | 4.0&nbsp;Beta1 | NA |
| Public&nbsp;SDK | Ohos_sdk_public&nbsp;4.0.7.5&nbsp;(API&nbsp;Version&nbsp;10&nbsp;Beta1) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。通过DevEco&nbsp;Studio默认获取的SDK为Public&nbsp;SDK。 |
| HUAWEI&nbsp;DevEco&nbsp;Studio(可选) | 4.0&nbsp;Beta1 | OpenHarmony应用开发推荐使用。(*待发布*) |
| HUAWEI&nbsp;DevEco&nbsp;Device&nbsp;Tool(可选) | 3.1&nbsp;Release | OpenHarmony智能设备集成开发环境推荐使用。 |
| HUAWEI&nbsp;DevEco&nbsp;Studio(可选) | 4.0&nbsp;Beta1 | OpenHarmony应用开发推荐使用。获取方式:<br />[Windows(64-bit)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/38/v3/efALRNm3TJuKHfv-1xzjew/devecostudio-windows-4.0.0.201.zip?HW-CC-KV=V1&HW-CC-Date=20230613T085338Z&HW-CC-Expire=315360000&HW-CC-Sign=49E7D85C8A485D5D1F04944DFE1AFCFEE3F60E03D25A01BEFE12BA6CEADD19E0) <br />SHA256校验码:7d2885b052afb92af8eb2d28ce2704515cd5fdbe7dd01f874bcdd876e11b890a<br />[Mac(X86)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/71/v3/A3thi3-kRTSeO4Jp0DSigA/devecostudio-mac-4.0.0.201.zip?HW-CC-KV=V1&HW-CC-Date=20230613T085132Z&HW-CC-Expire=315360000&HW-CC-Sign=BA233FE054A7D07F4B1C3ED80C84F9DD29112E49BB6D5D1506C5A5A0238741AD) <br />SHA256校验码:ce2582eac70e8e15abcded00065ae0047f3815fe2b0c90d56c0bdbc5561a51c3<br />[Mac(ARM)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/ed/v3/IFYYMuT9SbCPCHZntvlrKQ/devecostudio-mac-arm-4.0.0.201.zip?HW-CC-KV=V1&HW-CC-Date=20230613T085231Z&HW-CC-Expire=315360000&HW-CC-Sign=8F98E23E393E3D0D104BDBF7F33684D36C48613303909E6D04D016DB0E7E8696) <br />SHA256校验码:5da2baad7475857a1c59315663b7dcdf85219ffd652d5a7be160c8d2225358a7 |
| HUAWEI&nbsp;DevEco&nbsp;Device&nbsp;Tool(可选) | 3.1&nbsp;Release | OpenHarmony智能设备集成开发环境推荐使用。获取方式:<br />[点击跳转至下载页面](https://device.harmonyos.com/cn/develop/ide#download) |
## 源码获取
......@@ -400,10 +400,9 @@ OpenHarmony 4.0 Beta1的API范围相比3.2 Release,API变更的清单请参见
| 子系统 | 名称 | 简介 | 开发语言 |
| -------- | -------- | -------- | -------- |
| 媒体 | [媒体会话——控制方](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-v4.0-Beta1/code/BasicFeature/Media/AVSession/MediaController)(仅对系统应用开放) | 本示例主要展示了媒体会话(媒体控制方,MediaController)的相关功能,使用\@ohos.multimedia.avsession等接口实现媒体提供方与媒体控制方自定义信息的交互功能。 | ArkTS |
| 媒体 | [媒体会话——提供方](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-v4.0-Beta1/code/BasicFeature/Media/AVSession/MediaProvider) | 本示例主要展示了媒体会话(媒体提供方,MediaProvider)的相关功能,使用\@ohos.multimedia.avsession等接口实现媒体提供方与媒体控制方自定义信息的交互功能。 | ArkTS |
| 媒体 | [音频管理](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-v4.0-Beta1/code/BasicFeature/Media/Audio) | 本示例主要展示了音频的相关功能,使用\@ohos.multimedia.audio等接口实现音频的发声设备的切换与查询和音频焦点功能。 | ArkTS |
| DFX | [应用故障恢复](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-v4.0-Beta1/code/BasicFeature/DFX/AppRecovery) | 本示例展示了在应用中如何适配故障恢复相关接口。 | ArkTS |
| 媒体 | [媒体会话——控制方](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-4.0-Beta1/code/BasicFeature/Media/AVSession/MediaController)(仅对系统应用开放) | 本示例主要展示了媒体会话(媒体控制方,MediaController)的相关功能,使用\@ohos.multimedia.avsession等接口实现媒体提供方与媒体控制方自定义信息的交互功能。 | ArkTS |
| 媒体 | [媒体会话——提供方](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-4.0-Beta1/code/BasicFeature/Media/AVSession/MediaProvider) | 本示例主要展示了媒体会话(媒体提供方,MediaProvider)的相关功能,使用\@ohos.multimedia.avsession等接口实现媒体提供方与媒体控制方自定义信息的交互功能。 | ArkTS |
| 媒体 | [音频管理](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-4.0-Beta1/code/BasicFeature/Media/Audio) | 本示例主要展示了音频的相关功能,使用\@ohos.multimedia.audio等接口实现音频的发声设备的切换与查询和音频焦点功能。 | ArkTS |
请访问[Samples](https://gitee.com/openharmony/applications_app_samples)仓了解更多信息。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册