diff --git a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md index a7c47e93fd32f168a844c0f0a32aa16a922f8f83..c24e83427a937df698a03fe4966120048c456860 100644 --- a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md +++ b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md @@ -22,7 +22,7 @@ import stats from '@ohos.bundleState'; | function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | 查询当前应用的使用优先级群组。callback形式。 | | function queryAppUsagePriorityGroup(): Promise<number>; | 查询当前应用的使用优先级群组。promise形式。 | | function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | 判断指定Bundle Name的应用当前是否是空闲状态。 | -| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录。 | +| function getRecentlyUsedModules(maxNum? : number, callback: AsyncCallback<BundleActiveModuleInfo>): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录,若不填写maxNum参数,则默认maxNum值为1000。 | | function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | 通过指定起始和结束时间查询所有应用的通知次数。 | | function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | 通过指定起始和结束时间查询系统事件(休眠、唤醒、解锁、锁屏)统计信息。 | | function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void | 查询当前调用者应用或者指定应用的使用优先级群组。callback形式。 | @@ -178,14 +178,14 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // promise方式 stats.queryAppUsagePriorityGroup().then( res => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code); }); - + // callback方式 stats.queryAppUsagePriorityGroup((err, res) => { if (err) { @@ -195,7 +195,7 @@ import stats from '@ohos.bundleState'; } }); ``` - + 7. 判断指定Bundle Name的应用当前是否是空闲状态,config.json中不需要配置权限,三方应用只能查询自身的空闲状态。 ```js @@ -300,7 +300,7 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // 异步方法promise方式 stats.queryBundleActiveEventStates(0, 20000000000000).then( res => { console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise success.'); @@ -308,7 +308,7 @@ import stats from '@ohos.bundleState'; }).catch( err => { console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise failed, because: ' + err.code); }); - + // 异步方法callback方式 stats.queryBundleActiveEventStates(0, 20000000000000, (err, res) => { if (err) { @@ -324,14 +324,14 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // 无参异步方法promise方式 stats.queryAppUsagePriorityGroup().then( res => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code); }); - + // 无参异步方法callback方式 stats.queryAppUsagePriorityGroup((err, res) => { if (err) { @@ -340,14 +340,14 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res)); } }); - + //有参异步promise方式 stats.queryAppUsagePriorityGroup(this.bundleName).then( res => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code); }); - + //有参异步方法callback方式 stats.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { if(err) { @@ -362,7 +362,7 @@ import stats from '@ohos.bundleState'; ```javascript import stats from '@ohos.bundleState' - + //异步方法promise stats.setBundleGroup(this.bundleName, this.newGroup).then( () => { console.log('BUNDLE_ACTIVE SetBundleGroup promise succeeded.'); @@ -383,7 +383,7 @@ import stats from '@ohos.bundleState'; ```javascript import stats from '@ohos.bundleState' - + //异步方法promise形式 let onBundleGroupChanged = (err,res) =>{ console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); @@ -415,12 +415,12 @@ import stats from '@ohos.bundleState'; } }); ``` - + 13. 解除应用分组监听回调 ```javascript import stats from '@ohos.bundleState' - + //promise stats.unRegisterGroupCallBack().then( () => { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise succeeded.'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md index 1f96455ebe7b6eba3c83218d7810d57c5a32439b..bf0dedbdc4cc7aca6c758d95ac51ae46b913d290 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -982,7 +982,7 @@ FA卡片的使用信息的属性集合。 | 参数名 | 类型 | 必填 | 说明 | | ---------------- | ------ | ---- | ----------- | -| formName | number | 是 | 卡片名称。 | +| formName | string | 是 | 卡片名称。 | | formDimension | number | 是 | 卡片尺寸。 | | formId | number | 是 | 卡片Id。 | | formLastUsedTime | number | 是 | 卡片的上一次点击时间。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-cipher.md b/zh-cn/application-dev/reference/apis/js-apis-system-cipher.md index c1143f13a2d04f0f27e26a0fca90642960d5b9ef..4c744b59e82b85085d89e5c0f9c48316a6a4b01e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-cipher.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-cipher.md @@ -49,13 +49,15 @@ export default { '6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' + '+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' + 'jBpApTJ3TeneOo6Z5QIDAQAB', - success: function(data) { - console.log(data.data.text); - }, - fail: function(data, code) { - console.log(code.code); - console.log(data.data); - } + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); + }, + complete: function() { + console.log(`operation complete!`); + } }); cipher.rsa({ //解密: @@ -80,13 +82,15 @@ export default { 'RUGcm3ZGTnslduB0knNF+V2ndwzDUQ7P74UXT+PjurTPhujFYiuxCEd6ORVnEOzG\n' + 'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' + '8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==', - success: function(data) { - console.log(data.data.text); - }, - fail: function(data, code) { - console.log(code.code); - console.log(data.data); - }, + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); + }, + complete: function() { + console.log(`operation complete!`); + } }); } } @@ -131,13 +135,15 @@ export default { transformation: 'AES/CBC/PKCS5Padding', ivOffset: '0', ivLen: '16', - success: (data) => { - console.log(data.data.text); - }, - fail: (data, code) => { - console.log(code.code); - console.log(data.data); - } + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); + }, + complete: function() { + console.log(`operation complete!`); + } }); cipher.aes({ //解密: @@ -149,16 +155,19 @@ export default { transformation: 'AES/CBC/PKCS5Padding', ivOffset: '0', ivLen: '16', - success: (data) => { - console.log(data.data.text); - }, - fail: (data, code) => { - console.log(code.code); - console.log(data.data); - } + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); + }, + complete: function() { + console.log(`operation complete!`); + } }); }); } } -``` \ No newline at end of file +``` +