未验证 提交 28ea6c2a 编写于 作者: O openharmony_ci 提交者: Gitee

!3210 同步api评审意见修改

Merge pull request !3210 from Houdisheng/master
...@@ -21,7 +21,7 @@ import stats from '@ohos.bundleState'; ...@@ -21,7 +21,7 @@ import stats from '@ohos.bundleState';
| function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback<Array<BundleStateInfo>>): void | 通过指定时间段间隔(天、周、月、年)查询应用使用时长统计信息。 | | function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback<Array<BundleStateInfo>>): void | 通过指定时间段间隔(天、周、月、年)查询应用使用时长统计信息。 |
| function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | 查询(返回)当前调用者应用的使用优先级群组。 | | function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | 查询(返回)当前调用者应用的使用优先级群组。 |
| function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | 判断指定Bundle Name的应用当前是否是空闲状态。 | | function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | 判断指定Bundle Name的应用当前是否是空闲状态。 |
| function getRecentUsageModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录。 | | function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录。 |
## 开发步骤 ## 开发步骤
...@@ -213,25 +213,25 @@ import stats from '@ohos.bundleState'; ...@@ -213,25 +213,25 @@ import stats from '@ohos.bundleState';
import stats from '@ohos.bundleState' import stats from '@ohos.bundleState'
// 异步方法promise方式 // 异步方法promise方式
stats.getRecentUsageModules(this.maxNum).then( res => { stats.getRecentlyUsedModules(this.maxNum).then( res => {
console.log('BUNDLE_ACTIVE getRecentUsageModules promise succeeded'); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded');
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE getRecentUsageModules promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1));
console.log('BUNDLE_ACTIVE getRecentUsageModules promise result ' + JSON.stringify(res[i])); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise result ' + JSON.stringify(res[i]));
} }
}).catch( err=> { }).catch( err=> {
console.log('BUNDLE_ACTIVE getRecentUsageModules promise failed, because: ' + err.code); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise failed, because: ' + err.code);
}); });
// 异步方法callback方式 // 异步方法callback方式
stats.getRecentUsageModules(this.maxNum,(err, res) => { stats.getRecentlyUsedModules(this.maxNum,(err, res) => {
if(err) { if(err) {
console.log('BUNDLE_ACTIVE getRecentUsageModules callback failed, because: ' + err.code); console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else { } else {
console.log('BUNDLE_ACTIVE getRecentUsageModules callback succeeded.'); console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback succeeded.');
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE getRecentUsageModules callback number : ' + (i + 1)); console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE getRecentUsageModules callback result ' + JSON.stringify(res[i])); console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i]));
} }
} }
}); });
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
4. 根据interval(日、周、月、年)类型和起止时间查询应用的使用时长。 4. 根据interval(日、周、月、年)类型和起止时间查询应用的使用时长。
5. 查询调用者应用的优先级群组。 5. 查询调用者应用的优先级群组。
6. 判断指定应用当前是否是空闲状态。 6. 判断指定应用当前是否是空闲状态。
7. 查询FA使用记录。返回数量最大不超过maxNum设置的值,maxNum最大为1000。 7. 查询FA使用记录。返回数量最大不超过maxNum设置的值,FA使用记录由近及远排序,maxNum最大为1000。
### 设备使用信息统计使用权限 ### 设备使用信息统计使用权限
- 设备使用信息统计的queryBundleActiveStates、queryBundleStateInfos、queryBundleStateInfoByInterval接口为系统api,调用前需要申请ohos.permission.BUNDLE_ACTIVE_INFO权限。 - 设备使用信息统计的queryBundleActiveStates、queryBundleStateInfos、queryBundleStateInfoByInterval接口为系统api,调用前需要申请ohos.permission.BUNDLE_ACTIVE_INFO权限。
......
...@@ -403,11 +403,11 @@ queryCurrentBundleActiveStates(begin: number, end: number): Promise&lt;Array&lt; ...@@ -403,11 +403,11 @@ queryCurrentBundleActiveStates(begin: number, end: number): Promise&lt;Array&lt;
}); });
``` ```
## bundleState.getRecentUsageModules<sup>9+</sup> ## bundleState.getRecentlyUsedModules<sup>9+</sup>
getRecentUsageModules(maxNum: number): Promise&lt;Array&lt;BundleActiveModuleInfo&gt;&gt; getRecentlyUsedModules(maxNum: number): Promise&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;
据maxNum,查询FA使用记录,使用Promise形式返回不超过maxNum条FA使用记录,maxNum最大为1000。 据maxNum,查询FA使用记录,使用Promise形式返回不超过maxNum条FA使用记录,FA使用记录由近及远排序,maxNum最大为1000。
**需要权限**:ohos.permission.BUNDLE_ACTIVE_INFO **需要权限**:ohos.permission.BUNDLE_ACTIVE_INFO
...@@ -428,22 +428,22 @@ getRecentUsageModules(maxNum: number): Promise&lt;Array&lt;BundleActiveModuleInf ...@@ -428,22 +428,22 @@ getRecentUsageModules(maxNum: number): Promise&lt;Array&lt;BundleActiveModuleInf
**示例** **示例**
```js ```js
bundleState.getRecentUsageModules(this.maxNum).then( res => { bundleState.getRecentlyUsedModules(this.maxNum).then( res => {
console.log('BUNDLE_ACTIVE getRecentUsageModules promise succeeded'); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded');
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE getRecentUsageModules promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1));
console.log('BUNDLE_ACTIVE getRecentUsageModules promise result ' + JSON.stringify(res[i])); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise result ' + JSON.stringify(res[i]));
} }
}).catch( err=> { }).catch( err=> {
console.log('BUNDLE_ACTIVE getRecentUsageModules promise failed, because: ' + err.code); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise failed, because: ' + err.code);
}); });
``` ```
## bundleState.getRecentUsageModules<sup>9+</sup> ## bundleState.getRecentlyUsedModules<sup>9+</sup>
getRecentUsageModules(maxNum: number): Promise&lt;Array&lt;BundleActiveModuleInfo&gt;&gt; getRecentlyUsedModules(maxNum: number, callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
查询FA使用记录。使用callback形式返回数量最大不超过maxNum设置的值,maxNum最大为1000。 查询FA使用记录。使用CallBack形式返回数量最大不超过maxNum设置的值,FA使用记录由近及远排序,maxNum最大为1000。
**需要权限**:ohos.permission.BUNDLE_ACTIVE_INFO **需要权限**:ohos.permission.BUNDLE_ACTIVE_INFO
...@@ -459,14 +459,14 @@ getRecentUsageModules(maxNum: number): Promise&lt;Array&lt;BundleActiveModuleInf ...@@ -459,14 +459,14 @@ getRecentUsageModules(maxNum: number): Promise&lt;Array&lt;BundleActiveModuleInf
**示例** **示例**
```js ```js
bundleState.getRecentUsageModules(this.maxNum,(err, res) => { bundleState.getRecentlyUsedModules(this.maxNum,(err, res) => {
if(err) { if(err) {
console.log('BUNDLE_ACTIVE getRecentUsageModules callback failed, because: ' + err.code); console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else { } else {
console.log('BUNDLE_ACTIVE getRecentUsageModules callback succeeded.'); console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback succeeded.');
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE getRecentUsageModules callback number : ' + (i + 1)); console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE getRecentUsageModules callback result ' + JSON.stringify(res[i])); console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i]));
} }
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册