“8fca28579c59f45c83cdb77a27d9bad2a4225cf6”上不存在“mobile/test/net/test_net_performance.cpp”
未验证 提交 0f9e797c 编写于 作者: O openharmony_ci 提交者: Gitee

!17803 翻译完成:16927+17051+17293+17211+17389 去掉无意义的JSON.stringify

Merge pull request !17803 from wusongqing/TR16927
...@@ -122,6 +122,14 @@ Deregisters a mission status listener. ...@@ -122,6 +122,14 @@ Deregisters a mission status listener.
| listenerId | number | Yes| Index of the mission status listener to deregister. It is returned by **on()**.| | listenerId | number | Yes| Index of the mission status listener to deregister. It is returned by **on()**.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300002 | Input error. The specified mission listener does not exist. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
...@@ -209,6 +217,14 @@ Deregisters a mission status listener. This API uses a promise to return the res ...@@ -209,6 +217,14 @@ Deregisters a mission status listener. This API uses a promise to return the res
| -------- | -------- | | -------- | -------- |
| Promise<void> | Promise used to return the result.| | Promise<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300002 | Input error. The specified mission listener does not exist. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
...@@ -624,6 +640,14 @@ Locks a given mission. This API uses an asynchronous callback to return the resu ...@@ -624,6 +640,14 @@ Locks a given mission. This API uses an asynchronous callback to return the resu
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300001 | Mission not found. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
...@@ -667,6 +691,14 @@ Locks a given mission. This API uses a promise to return the result. ...@@ -667,6 +691,14 @@ Locks a given mission. This API uses a promise to return the result.
| -------- | -------- | | -------- | -------- |
| Promise<void> | Promise used to return the result.| | Promise<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300001 | Mission not found. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
import missionManager from '@ohos.app.ability.missionManager'; import missionManager from '@ohos.app.ability.missionManager';
...@@ -702,6 +734,14 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re ...@@ -702,6 +734,14 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300001 | Mission not found. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
import missionManager from '@ohos.app.ability.missionManager'; import missionManager from '@ohos.app.ability.missionManager';
...@@ -744,6 +784,14 @@ Unlocks a given mission. This API uses a promise to return the result. ...@@ -744,6 +784,14 @@ Unlocks a given mission. This API uses a promise to return the result.
| -------- | -------- | | -------- | -------- |
| Promise<void> | Promise used to return the result.| | Promise<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300001 | Mission not found. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
...@@ -924,6 +972,14 @@ Switches a given mission to the foreground. This API uses an asynchronous callba ...@@ -924,6 +972,14 @@ Switches a given mission to the foreground. This API uses an asynchronous callba
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
...@@ -963,6 +1019,14 @@ Switches a given mission to the foreground, with the startup parameters for the ...@@ -963,6 +1019,14 @@ Switches a given mission to the foreground, with the startup parameters for the
| options | [StartOptions](js-apis-app-ability-startOptions.md) | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| | options | [StartOptions](js-apis-app-ability-startOptions.md) | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
...@@ -1007,6 +1071,14 @@ Switches a given mission to the foreground, with the startup parameters for the ...@@ -1007,6 +1071,14 @@ Switches a given mission to the foreground, with the startup parameters for the
| -------- | -------- | | -------- | -------- |
| Promise<void> | Promise used to return the result.| | Promise<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
......
...@@ -32,12 +32,12 @@ import StartOptions from '@ohos.app.ability.StartOptions'; ...@@ -32,12 +32,12 @@ import StartOptions from '@ohos.app.ability.StartOptions';
try { try {
missionManager.getMissionInfos('', 10, (error, missions) => { missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) { if (error) {
console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); console.error(`getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}`);
return; return;
} }
console.log('size = ${missions.length}'); console.log(`size = ${missions.length}`);
console.log('missions = ${JSON.stringify(missions)}'); console.log(`missions = ${JSON.stringify(missions)}`);
let id = missions[0].missionId; let id = missions[0].missionId;
let startOptions = { let startOptions = {
...@@ -45,10 +45,10 @@ import StartOptions from '@ohos.app.ability.StartOptions'; ...@@ -45,10 +45,10 @@ import StartOptions from '@ohos.app.ability.StartOptions';
displayId: 0 displayId: 0
}; };
missionManager.moveMissionToFront(id, startOptions).then(() => { missionManager.moveMissionToFront(id, startOptions).then(() => {
console.log('moveMissionToFront is called '); console.log('moveMissionToFront is called');
}); });
}); });
} catch (paramError) { } catch (paramError) {
console.error('error: ${paramError.code}, ${paramError.message}'); console.error(`error: ${paramError.code}, ${paramError.message}`);
} }
``` ```
...@@ -28,31 +28,13 @@ Obtains a **WantAgent** object. This API uses an asynchronous callback to return ...@@ -28,31 +28,13 @@ Obtains a **WantAgent** object. This API uses an asynchronous callback to return
| callback | AsyncCallback\<WantAgent\> | Yes | Callback used to return the **WantAgent** object.| | callback | AsyncCallback\<WantAgent\> | Yes | Callback used to return the **WantAgent** object.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -125,31 +107,13 @@ Obtains a **WantAgent** object. This API uses a promise to return the result. If ...@@ -125,31 +107,13 @@ Obtains a **WantAgent** object. This API uses a promise to return the result. If
| Promise\<WantAgent\> | Promise used to return the **WantAgent** object.| | Promise\<WantAgent\> | Promise used to return the **WantAgent** object.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -211,31 +175,13 @@ Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous ...@@ -211,31 +175,13 @@ Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous
| callback | AsyncCallback\<string\> | Yes | Callback used to return the bundle name.| | callback | AsyncCallback\<string\> | Yes | Callback used to return the bundle name.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -321,31 +267,13 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re ...@@ -321,31 +267,13 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re
| Promise\<string\> | Promise used to return the bundle name.| | Promise\<string\> | Promise used to return the bundle name.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -422,31 +350,13 @@ Obtains the user ID of a **WantAgent** object. This API uses an asynchronous cal ...@@ -422,31 +350,13 @@ Obtains the user ID of a **WantAgent** object. This API uses an asynchronous cal
| callback | AsyncCallback\<number\> | Yes | Callback used to return the user ID.| | callback | AsyncCallback\<number\> | Yes | Callback used to return the user ID.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -533,31 +443,13 @@ Obtains the user ID of a **WantAgent** object. This API uses a promise to return ...@@ -533,31 +443,13 @@ Obtains the user ID of a **WantAgent** object. This API uses a promise to return
| Promise\<number\> | Promise used to return the user ID.| | Promise\<number\> | Promise used to return the user ID.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -635,31 +527,14 @@ Obtains the want in a **WantAgent** object. This API uses an asynchronous callba ...@@ -635,31 +527,14 @@ Obtains the want in a **WantAgent** object. This API uses an asynchronous callba
| callback | AsyncCallback\<[Want](js-apis-app-ability-want.md)\> | Yes | Callback used to return the want.| | callback | AsyncCallback\<[Want](js-apis-app-ability-want.md)\> | Yes | Callback used to return the want.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.| | 16000015 | Service timeout.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -747,31 +622,14 @@ Obtains the want in a **WantAgent** object. This API uses a promise to return th ...@@ -747,31 +622,14 @@ Obtains the want in a **WantAgent** object. This API uses a promise to return th
| Promise\<Want\> | Promise used to return the want.| | Promise\<Want\> | Promise used to return the want.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.| | 16000015 | Service timeout.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -826,7 +684,7 @@ function getWantAgentCallback(err, data) { ...@@ -826,7 +684,7 @@ function getWantAgentCallback(err, data) {
try { try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) { } catch(err) {
console.error('getWantAgent failed! ${err.code} ${err.message}'); console.error('getWantAgent failed! ${err.code} ${err.message}}');
} }
``` ```
...@@ -848,31 +706,13 @@ Cancels a **WantAgent** object. This API uses an asynchronous callback to return ...@@ -848,31 +706,13 @@ Cancels a **WantAgent** object. This API uses an asynchronous callback to return
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -958,31 +798,13 @@ Cancels a **WantAgent** object. This API uses a promise to return the result. ...@@ -958,31 +798,13 @@ Cancels a **WantAgent** object. This API uses a promise to return the result.
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -1057,33 +879,6 @@ Triggers a **WantAgent** object. This API uses an asynchronous callback to retur ...@@ -1057,33 +879,6 @@ Triggers a **WantAgent** object. This API uses an asynchronous callback to retur
| triggerInfo | [TriggerInfo](js-apis-inner-wantAgent-triggerInfo.md) | Yes | **TriggerInfo** object. | | triggerInfo | [TriggerInfo](js-apis-inner-wantAgent-triggerInfo.md) | Yes | **TriggerInfo** object. |
| callback | AsyncCallback\<[CompleteData](#completedata)\> | No | Callback used to return the result.| | callback | AsyncCallback\<[CompleteData](#completedata)\> | No | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
**Example** **Example**
```ts ```ts
...@@ -1167,33 +962,6 @@ Checks whether two **WantAgent** objects are equal to determine whether the same ...@@ -1167,33 +962,6 @@ Checks whether two **WantAgent** objects are equal to determine whether the same
| otherAgent | WantAgent | Yes | Target **WantAgent** object. | | otherAgent | WantAgent | Yes | Target **WantAgent** object. |
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
**Example** **Example**
```ts ```ts
...@@ -1280,33 +1048,6 @@ Checks whether two **WantAgent** objects are equal to determine whether the same ...@@ -1280,33 +1048,6 @@ Checks whether two **WantAgent** objects are equal to determine whether the same
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result.| | Promise\<boolean\> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
**Example** **Example**
```ts ```ts
...@@ -1382,31 +1123,14 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron ...@@ -1382,31 +1123,14 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron
| callback | AsyncCallback\<number> | Yes | Callback used to return the operation type.| | callback | AsyncCallback\<number> | Yes | Callback used to return the operation type.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.| | 16000015 | Service timeout.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
...@@ -1490,31 +1214,14 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to ...@@ -1490,31 +1214,14 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to
| Promise\<number> | Promise used to return the operation type.| | Promise\<number> | Promise used to return the operation type.|
**Error codes** **Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message | | ID | Error Message |
|-----------|--------------------| |-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.| | 16000015 | Service timeout.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.| | 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.| For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
The **AppStateData** module defines the application state data, which can be obtained through [getForegroundApplications](js-apis-app-ability-appManager.md#appmanagergetforegroundapplications). The **AppStateData** module defines the application state data, which can be obtained through [getForegroundApplications](js-apis-app-ability-appManager.md#appmanagergetforegroundapplications).
## Modules to Import
```ts
import appManager from '@ohos.app.ability.appManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This module is marked as @systemapi and not visible to third-party applications. **System API**: This module is marked as @systemapi and not visible to third-party applications.
...@@ -19,8 +25,8 @@ import appManager from '@ohos.app.ability.appManager'; ...@@ -19,8 +25,8 @@ import appManager from '@ohos.app.ability.appManager';
function getForegroundAppInfos() { function getForegroundAppInfos() {
appManager.getForegroundApplications((error, data) => { appManager.getForegroundApplications((error, data) => {
if (error && error.code) { if (error) {
console.log('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return; return;
} }
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
......
...@@ -7,6 +7,12 @@ The **Context** module provides context for abilities or applications. It allows ...@@ -7,6 +7,12 @@ The **Context** module provides context for abilities or applications. It allows
> - 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 used only in the stage model. > - The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -20,7 +26,7 @@ The **Context** module provides context for abilities or applications. It allows ...@@ -20,7 +26,7 @@ The **Context** module provides context for abilities or applications. It allows
| filesDir | string | Yes | No | File directory.| | filesDir | string | Yes | No | File directory.|
| databaseDir | string | Yes | No | Database directory.| | databaseDir | string | Yes | No | Database directory.|
| preferencesDir | string | Yes | No | Preferences directory.| | preferencesDir | string | Yes | No | Preferences directory.|
| bundleCodeDir | string | Yes | No | Bundle code directory.| | bundleCodeDir | string | Yes | No | Bundle code directory. Do not access resource files by concatenating paths. Use the [resourceManager API](js-apis-resource-manager.md) instead.|
| distributedFilesDir | string | Yes | No | Distributed file directory.| | distributedFilesDir | string | Yes | No | Distributed file directory.|
| eventHub | [EventHub](js-apis-inner-application-eventHub.md) | Yes | No | Event hub that implements event subscription, unsubscription, and triggering.| | eventHub | [EventHub](js-apis-inner-application-eventHub.md) | Yes | No | Event hub that implements event subscription, unsubscription, and triggering.|
| area | contextConstant.[AreaMode](js-apis-app-ability-contextConstant.md) | Yes | No | Area in which the file to be access is located.| | area | contextConstant.[AreaMode](js-apis-app-ability-contextConstant.md) | Yes | No | Area in which the file to be access is located.|
...@@ -47,18 +53,10 @@ Creates the context based on the bundle name. ...@@ -47,18 +53,10 @@ Creates the context based on the bundle name.
| -------- | -------- | | -------- | -------- |
| Context | Context created.| | Context | Context created.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
let bundleContext; let bundleContext: common.Context;
try { try {
bundleContext = this.context.createBundleContext('com.example.test'); bundleContext = this.context.createBundleContext('com.example.test');
} catch (error) { } catch (error) {
...@@ -86,18 +84,10 @@ Creates the context based on the module name. ...@@ -86,18 +84,10 @@ Creates the context based on the module name.
| -------- | -------- | | -------- | -------- |
| Context | Context created.| | Context | Context created.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
let moduleContext; let moduleContext: common.Context;
try { try {
moduleContext = this.context.createModuleContext('entry'); moduleContext = this.context.createModuleContext('entry');
} catch (error) { } catch (error) {
...@@ -126,18 +116,10 @@ Creates the context based on the bundle name and module name. ...@@ -126,18 +116,10 @@ Creates the context based on the bundle name and module name.
| -------- | -------- | | -------- | -------- |
| Context | Context created.| | Context | Context created.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
let moduleContext; let moduleContext: common.Context;
try { try {
moduleContext = this.context.createModuleContext('com.example.test', 'entry'); moduleContext = this.context.createModuleContext('com.example.test', 'entry');
} catch (error) { } catch (error) {
...@@ -162,7 +144,7 @@ Obtains the context of this application. ...@@ -162,7 +144,7 @@ Obtains the context of this application.
**Example** **Example**
```ts ```ts
let applicationContext; let applicationContext: common.Context;
try { try {
applicationContext = this.context.getApplicationContext(); applicationContext = this.context.getApplicationContext();
} catch (error) { } catch (error) {
......
...@@ -7,6 +7,12 @@ The **ExtensionRunningInfo** module encapsulates ExtensionAbility running inform ...@@ -7,6 +7,12 @@ The **ExtensionRunningInfo** module encapsulates ExtensionAbility running inform
> - 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.
> - This module is marked as @systemapi and not visible to third-party applications. > - This module is marked as @systemapi and not visible to third-party applications.
## Modules to Import
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
```
## Usage ## Usage
Import the **abilityManager** module and obtain the ExtensionAbility running information by calling the method in the **abilityManager** module. Import the **abilityManager** module and obtain the ExtensionAbility running information by calling the method in the **abilityManager** module.
...@@ -32,8 +38,8 @@ import abilityManager from '@ohos.app.ability.abilityManager'; ...@@ -32,8 +38,8 @@ import abilityManager from '@ohos.app.ability.abilityManager';
let upperLimit = 1; let upperLimit = 1;
function getExtensionInfos() { function getExtensionInfos() {
abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => { abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => {
if (error && error.code) { if (error) {
console.error('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); console.error('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return; return;
} }
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
The **MissionInfo** module defines detailed information about a mission. The information can be obtained through [getMissionInfo](js-apis-app-ability-missionManager.md#missionmanagergetmissioninfo). The **MissionInfo** module defines detailed information about a mission. The information can be obtained through [getMissionInfo](js-apis-app-ability-missionManager.md#missionmanagergetmissioninfo).
## Modules to Import
```ts
import missionManager from '@ohos.app.ability.missionManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission **System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
...@@ -23,7 +29,7 @@ import missionManager from '@ohos.app.ability.missionManager'; ...@@ -23,7 +29,7 @@ import missionManager from '@ohos.app.ability.missionManager';
try { try {
missionManager.getMissionInfo('', 1, (error, data) => { missionManager.getMissionInfo('', 1, (error, data) => {
if (error.code) { if (error) {
// Process service logic errors. // Process service logic errors.
console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}');
return; return;
......
...@@ -7,6 +7,12 @@ The **MissionSnapshot** module defines the snapshot of a mission. The snapshot c ...@@ -7,6 +7,12 @@ The **MissionSnapshot** module defines the snapshot of a mission. The snapshot c
> The initial APIs of this module are supported since API version 8. 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 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module are system APIs and cannot be called by third-party applications. > The APIs of this module are system APIs and cannot be called by third-party applications.
## Modules to Import
```ts
import missionManager from '@ohos.app.ability.missionManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission **System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
...@@ -26,8 +32,8 @@ The mission snapshot information can be obtained by using **getMissionSnapShot** ...@@ -26,8 +32,8 @@ The mission snapshot information can be obtained by using **getMissionSnapShot**
try { try {
missionManager.getMissionInfos('', 10, (error, missions) => { missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) { if (error) {
console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return; return;
} }
console.log('size = ${missions.length}'); console.log('size = ${missions.length}');
...@@ -35,8 +41,8 @@ The mission snapshot information can be obtained by using **getMissionSnapShot** ...@@ -35,8 +41,8 @@ The mission snapshot information can be obtained by using **getMissionSnapShot**
let id = missions[0].missionId; let id = missions[0].missionId;
missionManager.getMissionSnapShot('', id, (err, snapshot) => { missionManager.getMissionSnapShot('', id, (err, snapshot) => {
if (err.code) { if (err) {
console.error('getMissionInfos failed, err.code: ${err.code}, err.message: ${err.message}'); console.error('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}');
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册