未验证 提交 39eb968e 编写于 作者: O openharmony_ci 提交者: Gitee

!20914 翻译完成:19893+20141+18624+20267+20325+19098 modify taskpool and errorcode document+几个AP零散刷新

Merge pull request !20914 from wusongqing/TR19893
......@@ -64,8 +64,14 @@ Enumerates the reasons for the last exit. You can use it together with [onCreate
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason.|
| ABILITY_NOT_RESPONDING | 1 | The ability does not respond.|
| NORMAL | 2 | The ability exits normally.|
| ABILITY_NOT_RESPONDING | 1 | The ability does not respond. This enum is supported since API version 9 and deprecated since API version 10. You are advised to use **APP_FREEZE**.|
| NORMAL | 2 | The ability exits normally because the user closes the application.|
| CPP_CRASH<sup>10+</sup> | 3 | The ability exits due to abnormal signals on the local host.|
| JS_ERROR<sup>10+</sup> | 4 | The ability exits due to a JS_ERROR fault triggered when an application has a JS syntax error that is not captured by developers.|
| APP_FREEZE<sup>10+</sup> | 5 | The ability exits because watchdog detects that the application is frozen.|
| PERFORMANCE_CONTROL<sup>10+</sup> | 6 | The ability exits due to system performance problems, for example, insufficient device memory.|
| RESOURCE_CONTROL<sup>10+</sup> | 7 | The ability exits because the system resource usage (CPU, I/O, or memory usage) exceeds the upper limit.|
| UPGRADE<sup>10+</sup> | 8 | The ability exits due to an update.|
**Example**
......@@ -218,3 +224,24 @@ class MyAbility extends UIAbility {
}
}
```
## AbilityConstant.ContinueState<sup>10+</sup>
Enumerates the mission continuation states of the application. It is used in the [setMissionContinueState](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissioncontinuestate10) API of [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md).
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description |
| ------------- | --------- | ------------------------------------------------------------ |
| ACTIVE | 0 | Mission continuation is activated for the current application. |
| INACTIVE | 1 | Mission continuation is not activated for the current application. |
**Example**
```ts
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
this.context.setMissionContinueState(AbilityConstant.ContinueState.INACTIVE, (result) => {
console.info(`setMissionContinueState: ${JSON.stringify(result)}`);
});
```
......@@ -20,6 +20,7 @@ import bundleManager from '@ohos.bundle.bundleManager';
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all bundles.|
| ohos.permission.REMOVE_CACHE_FILES | system_basic | Permission to clear cache files of a bundle. |
|ohos.permission.CHANGE_ABILITY_ENABLED_STATE| system_basic | Permission to enable or disable an application or ability. |
| ohos.permission.GET_INSTALLED_BUNDLE_LIST | system_basic | Permission to read installed application list.|
For details, see [Permission Levels](../../security/accesstoken-overview.md#permission-levels).
......@@ -115,7 +116,7 @@ Enumerates the types of Extension abilities.
| PRINT<sup>10+</sup> | 15 | PrintExtensionAbility: provides APIs for printing images. Printing documents is not supported yet.|
| PUSH<sup>10+</sup> | 17 | PushExtensionAbility: provides APIs for pushing scenario-specific messages. This ability is reserved.|
| DRIVER<sup>10+</sup> | 18 | DriverExtensionAbility: provides APIs for the peripheral driver. This type of ability is not supported yet.|
| APP_ACCOUNT_AUTHORIZATION<sup>10+</sup> | 19 | AuthorizationExtensionAbility: provides APIs to process authorization requests for application accounts and allow account authorization from a third-party (relative to the operating system vendor) ecosystem platform.|
| APP_ACCOUNT_AUTHORIZATION<sup>10+</sup> | 19 | [AuthorizationExtensionAbility](js-apis-appAccount-authorizationExtensionAbility.md): provides APIs to process authorization requests for application accounts and allow account authorization from a third-party (relative to the operating system vendor) ecosystem platform.|
| UNSPECIFIED | 255 | No type is specified. It is used together with **queryExtensionAbilityInfo** to query all types of Extension abilities.|
......@@ -677,7 +678,7 @@ Obtains the information about all bundles based on the given bundle flags and us
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
......@@ -726,7 +727,7 @@ Obtains the information about all bundles based on the given bundle flags. This
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
......@@ -765,7 +766,7 @@ Obtains the information about all bundles based on the given bundle flags and us
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
......@@ -816,7 +817,7 @@ Obtains the information about all applications based on the given application fl
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
......@@ -865,7 +866,7 @@ Obtains the information about all applications based on the given application fl
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
......@@ -904,7 +905,7 @@ Obtains the information about all applications based on the given application fl
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
......@@ -1752,7 +1753,7 @@ Enables or disables an ability. This API uses an asynchronous callback to return
| Name | Type | Mandatory| Description |
| -------- | ----------- | ---- | ------------------------------------- |
| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | Yes | Information about the target ability. |
| isEnabled| boolean | Yes | Whether to enable the ability. The value **true** means to enable the ability, and **false** means to disable the ability.|
| isEnabled| boolean | Yes | Whether to enable the ability. The value **true** means to enable the ability, and **false** means to disable the 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.|
**Error codes**
......@@ -1814,7 +1815,7 @@ Enables or disables an ability. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| -------- | ----------- | ---- | ------------------------------------- |
| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | Yes | Information about the target ability. |
| isEnabled| boolean | Yes | Whether to enable the ability. The value **true** means to enable the ability, and **false** means to disable the ability.|
| isEnabled| boolean | Yes | Whether to enable the ability. The value **true** means to enable the ability, and **false** means to disable the application.|
**Return value**
......@@ -3213,3 +3214,129 @@ try {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message);
}
```
### bundleManager.getSpecifiedDistributionType<sup>10+</sup>
getSpecifiedDistributionType(bundleName: string): string;
Obtains the distribution type of a bundle in synchronous mode. The return value is the **specifiedDistributionType** field value in [InstallParam](./js-apis-installer.md#installparam) passed when **install** is called.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ----------------------------------- | ---- | ---------------------------- |
| bundleName | string | Yes | Bundle name.|
**Return value**
| Type | Description |
| ------------- | -------------------------------------- |
| string | Distribution type of the bundle.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | ------------------------------------------------------------ |
| 17700001 | The specified bundleName is not found. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
let bundleName = "com.example.myapplication";
try {
let type = bundleManager.getSpecifiedDistributionType(bundleName);
console.info('getSpecifiedDistributionType successfully, type:' + type);
} catch (error) {
console.error('getSpecifiedDistributionType failed. Cause: ' + error.message);
}
```
### bundleManager.getAdditionalInfo<sup>10+</sup>
getAdditionalInfo(bundleName: string): string;
Obtains additional information about a bundle in synchronous mode. The return value is the **additionalInfo** field value in [InstallParam](./js-apis-installer.md#installparam) passed when **install** is called.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ----------------------------------- | ---- | ---------------------------- |
| bundleName | string | Yes | Bundle name.|
**Return value**
| Type | Description |
| ------------- | -------------------------------------- |
| string | Additional information about the bundle.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | ------------------------------------------------------------ |
| 17700001 | The specified bundleName is not found. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
let bundleName = "com.example.myapplication";
try {
let info = bundleManager.getAdditionalInfo(bundleName);
console.info('getAdditionalInfo successfully, additionInfo:' + info);
} catch (error) {
console.error('getAdditionalInfo failed. Cause: ' + error.message);
}
```
### bundleManager.getBundleInfoForSelfSync<sup>10+</sup>
getBundleInfoForSelfSync(bundleFlags: number): BundleInfo;
Obtains the bundle information of this bundle based on the given bundle flags in synchronous mode.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | --------------------- |
| bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.|
**Return value**
| Type | Description |
| ------------------------------------------------- | -------------------- |
| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | Bundle information obtained.|
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION;
try {
let data = bundleManager.getBundleInfoForSelfSync(bundleFlags);
hilog.info(0x0000, 'testTag', 'getBundleInfoForSelfSync successfully: %{public}s', JSON.stringify(data));
} catch (err) {
hilog.error(0x0000, 'testTag', 'getBundleInfoForSelfSync failed: %{public}s', err.message);
}
```
......@@ -236,7 +236,7 @@ Decompresses a file. This API uses an asynchronous callback to return the result
| Name | Type | Mandatory| Description |
| ----------------------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | Yes | Path of the file to decompress. The file name extension must be .zip. The path must be an application sandbox path, which can be obtained from the context. For details about the context, see [FA Model](js-apis-inner-app-context.md) and [Stage Model](js-apis-inner-application-context.md).|
| outFile | string | Yes | Path of the decompressed file. The path must exist in the system. Otherwise, the decompression fails. The path must be an application sandbox path, which can be obtained from the context. For details about the context, see [FA Model](js-apis-inner-app-context.md) and [Stage Model](js-apis-inner-application-context.md).|
| outFile | string | Yes | Path of the decompressed file. The path must exist in the system. Otherwise, the decompression fails. The path must be an application sandbox path, which can be obtained from the context. For details about the context, see [FA Model](js-apis-inner-app-context.md) and [Stage Model](js-apis-inner-application-context.md). If a file or folder with the same name already exists in the path, they will be overwritten.|
| options | [Options](#options) | Yes | Decompression parameters. |
| AsyncCallback<**void**> | callback | No | Callback used to return the result. If the operation is successful, **null** is returned; otherwise, a specific error code is returned. |
......@@ -259,9 +259,7 @@ import zlib from '@ohos.zlib';
let inFile = '/xx/xxx.zip';
let outFileDir = '/xxx';
let options = {
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION,
memLevel: zlib.MemLevel.MEM_LEVEL_DEFAULT,
strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION
};
try {
......@@ -288,7 +286,7 @@ Decompresses a file. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | Yes | Path of the file to decompress. The file name extension must be .zip. The path must be an application sandbox path, which can be obtained from the context. For details about the context, see [FA Model](js-apis-inner-app-context.md) and [Stage Model](js-apis-inner-application-context.md).|
| outFile | string | Yes | Path of the decompressed file. The path must exist in the system. Otherwise, the decompression fails. The path must be an application sandbox path, which can be obtained from the context. For details about the context, see [FA Model](js-apis-inner-app-context.md) and [Stage Model](js-apis-inner-application-context.md).|
| outFile | string | Yes | Path of the decompressed file. The path must exist in the system. Otherwise, the decompression fails. The path must be an application sandbox path, which can be obtained from the context. For details about the context, see [FA Model](js-apis-inner-app-context.md) and [Stage Model](js-apis-inner-application-context.md). If a file or folder with the same name already exists in the path, they will be overwritten.|
| options | [Options](#options) | Yes | Decompression parameters. |
**Error codes**
......@@ -308,9 +306,7 @@ import zlib from '@ohos.zlib';
let inFile = '/xx/xxx.zip';
let outFileDir = '/xxx';
let options = {
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION,
memLevel: zlib.MemLevel.MEM_LEVEL_DEFAULT,
strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY
level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION
};
try {
......
......@@ -100,7 +100,7 @@ Use a supported API.
**Error Message**
Serializing an uncaught exception failed.
An exception occurred during serialization.
**Description**
......@@ -246,7 +246,7 @@ Check the functions required by the tasks executed by the task pool and add the
**Error Message**
The task is not exist when cancel it.
The task does not exist when it is canceled.
**Description**
......@@ -258,13 +258,13 @@ The task to cancel does not exist in the task pool.
**Solution**
Before canceling a task, ensure that the task is placed into the task pool by calling **taskpool.execute**.
Before canceling a task, ensure that the task has been placed in the task pool by calling **taskpool.execute** and is not finishing. If you are not sure, capture exceptions.
## 10200016 Failed to Cancel a Task Being Executed
**Error Message**
The task is running when cancel it.
The task is executing when it is canceled.
**Description**
......@@ -276,7 +276,7 @@ The task to cancel is being executed.
**Solution**
Before canceling a task, ensure that the task finishes execution.
Before canceling a task, ensure that the task has been placed in the task pool by calling **taskpool.execute** and has not started execution. If you are not sure, capture exceptions.
## 10200017 Failed to Delete an Element That Does Not Exist
......@@ -295,3 +295,21 @@ The element to delete does not exist in the container.
**Solution**
Before deleting an element, ensure that the element exists in this container.
## 10200018 Failed to Cancel a Task Group That Does Not Exist
**Error Message**
The task group does not exist when it is canceled.
**Description**
This error code is reported when you attempt to cancel a task group that does not exist.
**Possible Causes**
The task group to cancel does not exist in the task pool.
**Solution**
Before canceling a task group, ensure that the task group is placed in the task pool by calling **taskpool.execute** and is not finishing. If you are not sure, capture exceptions.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册