From b46cc8359c13fa79ede71280779915ef697d8693 Mon Sep 17 00:00:00 2001 From: lyujiayi <654765554@qq.com> Date: Mon, 21 Jul 2025 22:10:56 +0800 Subject: [PATCH] update: modify queryModuleUsageRecords declaration to adapt overload method Signed-off-by: lyujiayi <654765554@qq.com> --- ...ohos.resourceschedule.usageStatistics.d.ts | 124 ++++++++++++++++-- 1 file changed, 116 insertions(+), 8 deletions(-) diff --git a/api/@ohos.resourceschedule.usageStatistics.d.ts b/api/@ohos.resourceschedule.usageStatistics.d.ts index bb9b2ec3b8..1613b91741 100644 --- a/api/@ohos.resourceschedule.usageStatistics.d.ts +++ b/api/@ohos.resourceschedule.usageStatistics.d.ts @@ -1116,6 +1116,17 @@ declare namespace usageStatistics { */ function queryCurrentBundleEvents(begin: long, end: long): Promise>; + /** + * @since 20 + * @arkts 1.2 + */ + overload queryModuleUsageRecords { + queryModuleUsageRecordsWithMaxNumCallback, + queryModuleUsageRecordsWithMaxNumReturnsPromise, + queryModuleUsageRecordsWithCallback, + queryModuleUsageRecordsReturnsPromise, + }; + /** * Queries recently module usage records with maxNum. * @@ -1137,8 +1148,33 @@ declare namespace usageStatistics { * @throws { BusinessError } 10000007 - Failed to get the system time. * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. - * @since arkts{ '1.1':'9', '1.2':'20' } - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function queryModuleUsageRecordsWithMaxNumCallback(maxNum: int, callback: AsyncCallback>): void; + + /** + * Queries recently module usage records with maxNum. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { int } maxNum - Indicates max record number in result, max value is 1000, default value is 1000. + * @param { AsyncCallback> } callback - the callback of queryModuleUsageRecords. + *

the {@link HapModuleInfo} object Array containing the usage data of the modules.

+ * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameters types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Failed to write data into parcel. Possible reasons: 1. Invalid parameters; + *
2. Failed to apply for memory. + * @throws { BusinessError } 10000003 - Failed to get system ability manager. + * @throws { BusinessError } 10000004 - Failed to access the device usage service. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10000007 - Failed to get the system time. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + * @since 9 */ function queryModuleUsageRecords(maxNum: int, callback: AsyncCallback>): void; @@ -1163,8 +1199,33 @@ declare namespace usageStatistics { * @throws { BusinessError } 10000007 - Failed to get the system time. * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. - * @since arkts{ '1.1':'9', '1.2':'20' } - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function queryModuleUsageRecordsWithMaxNumReturnsPromise(maxNum: int): Promise>; + + /** + * Queries recently module usage records with maxNum. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { int } maxNum - Indicates max record number in result, max value is 1000, default value is 1000. + * @returns { Promise> } the promise returned by queryModuleUsageRecords. + *

the {@link HapModuleInfo} object Array containing the usage data of the modules.

+ * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameters types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Failed to write data into parcel. Possible reasons: 1. Invalid parameters; + *
2. Failed to apply for memory. + * @throws { BusinessError } 10000003 - Failed to get system ability manager. + * @throws { BusinessError } 10000004 - Failed to access the device usage service. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10000007 - Failed to get the system time. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + * @since 9 */ function queryModuleUsageRecords(maxNum: int): Promise>; @@ -1188,11 +1249,59 @@ declare namespace usageStatistics { * @throws { BusinessError } 10000007 - Failed to get the system time. * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. - * @since arkts{ '1.1':'9', '1.2':'20' } - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function queryModuleUsageRecordsWithCallback(callback: AsyncCallback>): void; + + /** + * Queries recently module usage records. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { AsyncCallback> } callback - the callback of queryModuleUsageRecords. + *

the {@link HapModuleInfo} object Array containing the usage data of the modules.

+ * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameters types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Failed to write data into parcel. Possible reasons: 1. Invalid parameters; + *
2. Failed to apply for memory. + * @throws { BusinessError } 10000003 - Failed to get system ability manager. + * @throws { BusinessError } 10000004 - Failed to access the device usage service. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10000007 - Failed to get the system time. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + * @since 9 */ function queryModuleUsageRecords(callback: AsyncCallback>): void; + /** + * Queries recently module usage records. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @returns { Promise> } the promise returned by queryModuleUsageRecords. + *

the {@link HapModuleInfo} object Array containing the usage data of the modules.

+ * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not System App. + *
2. Incorrect parameters types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Failed to write data into parcel. Possible reasons: 1. Invalid parameters; + *
2. Failed to apply for memory. + * @throws { BusinessError } 10000003 - Failed to get system ability manager. + * @throws { BusinessError } 10000004 - Failed to access the device usage service. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10000007 - Failed to get the system time. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function queryModuleUsageRecordsReturnsPromise(): Promise>; + /** * Queries recently module usage records. * @@ -1213,8 +1322,7 @@ declare namespace usageStatistics { * @throws { BusinessError } 10000007 - Failed to get the system time. * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. - * @since arkts{ '1.1':'9', '1.2':'20' } - * @arkts 1.1&1.2 + * @since 9 */ function queryModuleUsageRecords(): Promise>; -- Gitee