From ad48b7f8fefeef8aaa6ecab5bcaeeea5e9b3ddc0 Mon Sep 17 00:00:00 2001 From: "yupeng74@huawei.com" Date: Thu, 19 Jan 2023 11:34:09 +0800 Subject: [PATCH] =?UTF-8?q?d.ts=E6=96=87=E4=BB=B6=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yupeng74@huawei.com --- ...ohos.resourceschedule.usageStatistics.d.ts | 619 ++++++++++++++---- .../napi/include/bundle_state_inner_errors.h | 24 +- 2 files changed, 489 insertions(+), 154 deletions(-) diff --git a/interfaces/kits/bundlestats/js/@ohos.resourceschedule.usageStatistics.d.ts b/interfaces/kits/bundlestats/js/@ohos.resourceschedule.usageStatistics.d.ts index 1349bc6..a876dcf 100644 --- a/interfaces/kits/bundlestats/js/@ohos.resourceschedule.usageStatistics.d.ts +++ b/interfaces/kits/bundlestats/js/@ohos.resourceschedule.usageStatistics.d.ts @@ -24,14 +24,18 @@ import { AsyncCallback , Callback} from './basic'; * The system stores the query result in a {@link BundleStatsInfo} instance and * then returns it to you. * + * @namespace usageStatistics + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup * @since 9 */ declare namespace usageStatistics { /** - * @since 9 + * @interface BundleStatsInfo * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. + * @since 9 */ interface BundleStatsInfo { /** @@ -79,9 +83,10 @@ declare namespace usageStatistics { } /** - * @since 9 + * @interface HapFormInfo * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. + * @since 9 */ interface HapFormInfo { /** @@ -107,9 +112,10 @@ declare namespace usageStatistics { } /** - * @since 9 + * @interface HapModuleInfo * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. + * @since 9 */ interface HapModuleInfo { /** @@ -167,9 +173,10 @@ declare namespace usageStatistics { } /** - * @since 9 + * @interface DeviceEventStats * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. + * @since 9 */ interface DeviceEventStats { /** @@ -189,8 +196,9 @@ declare namespace usageStatistics { } /** - * @since 9 + * @interface BundleEvents * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 9 */ interface BundleEvents { /** @@ -219,9 +227,10 @@ declare namespace usageStatistics { eventId?: number; } /** - * @since 9 + * @interface AppGroupCallbackInfo * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup * @systemapi Hide this for inner system use. + * @since 9 */ interface AppGroupCallbackInfo { /* @@ -248,78 +257,148 @@ declare namespace usageStatistics { /** * Checks whether the application with a specified bundle name is in the idle state. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - * @param bundleName Indicates the bundle name of the application to query. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to query. + * @param { AsyncCallback } callback - the callback of isIdleState, + * boolean value is true mean the application is idle in a particular period; false mean otherwise. + * The time range of the particular period is defined by the system, which may be hours or days. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @return Returns {@code true} if the application is idle in a particular period; - * returns {@code false} otherwise. The time range of the particular period is defined by the system, - * which may be hours or days. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + * @since 9 */ function isIdleState(bundleName: string, callback: AsyncCallback): void; + + /** + * Checks whether the application with a specified bundle name is in the idle state. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to query. + * @returns { Promise } the promise returned by queryAppGroup, + * boolean value is true mean the application is idle in a particular period; false mean otherwise. + * The time range of the particular period is defined by the system, which may be hours or days. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + * @since 9 + */ function isIdleState(bundleName: string): Promise; /** * Queries the app group of the calling application. - * *

The priority defined in a priority group restricts the resource usage of an application, * for example, restricting the running of background tasks.

* - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @param { AsyncCallback } callback - the callback of queryAppGroup. + * Returns the app group of the calling application. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000004 - IPC failed. * @throws { BusinessError } 10000005 - Application is not installed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10100002 - Get Application group info failed. - * @return Returns the app group of the calling application. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10100002 - Failed to get the application group information. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @since 9 */ function queryAppGroup(callback: AsyncCallback): void; - function queryAppGroup(): Promise; /** - * Queries the usage priority group of the calling application. - * + * Queries the app group of the calling application. *

The priority defined in a priority group restricts the resource usage of an application, * for example, restricting the running of background tasks.

* - * @since 9 + * @returns { Promise } the promise returned by queryAppGroup. + * Returns the app group of the calling application. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10000005 - Application is not installed. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10100002 - Failed to get the application group information. * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @since 9 + */ + function queryAppGroup(): Promise; + + /** + * Queries the usage priority group by bundleName. + *

The priority defined in a priority group restricts the resource usage of an application, + * for example, restricting the running of background tasks.

+ * * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param bundleName, name of the application. + * @param { string } bundleName - name of the application. + * @param { AsyncCallback } callback - the callback of queryAppGroup, + * the usage priority group of the calling application. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000004 - IPC failed. * @throws { BusinessError } 10000005 - Application is not installed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10100002 - Get Application group info failed. - * @return Returns the usage priority group of the calling application. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10100002 - Failed to get the application group information. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + * @since 9 */ function queryAppGroup(bundleName : string, callback: AsyncCallback): void; + + /** + * Queries the usage priority group by bundleName. + *

The priority defined in a priority group restricts the resource usage of an application, + * for example, restricting the running of background tasks.

+ * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { string } bundleName - name of the application. + * @returns { Promise } the promise returned by queryAppGroup, + * the usage priority group of the calling application. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10000005 - Application is not installed. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10100002 - Failed to get the application group information. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + * @since 9 + */ function queryAppGroup(bundleName : string): Promise; /** - * @since 9 + * @interface BundleStatsMap * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. + * @since 9 */ interface BundleStatsMap { [key: string]: BundleStatsInfo; @@ -327,35 +406,60 @@ declare namespace usageStatistics { /** * Queries usage information about each bundle within a specified period. - * *

This method queries usage information at the {@link #BY_OPTIMIZED} interval by default.

* - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param begin Indicates the start time of the query period, in milliseconds. - * @param end Indicates the end time of the query period, in milliseconds. + * @param {number} begin - Indicates the start time of the query period, in milliseconds. + * @param {number} end - Indicates the end time of the query period, in milliseconds. + * @param { AsyncCallback } callback - the callback of queryBundleStatsInfos, + * the {@link BundleStatsMap} objects containing the usage information about each bundle. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10000007 - Get system or actual time failed. - * @return Returns the {@link BundleStatsMap} objects containing the usage information about each bundle. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryBundleStatsInfos(begin: number, end: number, callback: AsyncCallback): void; - function queryBundleStatsInfos(begin: number, end: number): Promise; /** - * Declares interval type. + * Queries usage information about each bundle within a specified period. + *

This method queries usage information at the {@link #BY_OPTIMIZED} interval by default.

* + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param {number} begin - Indicates the start time of the query period, in milliseconds. + * @param {number} end - Indicates the end time of the query period, in milliseconds. + * @returns { Promise } the promise returned by queryBundleStatsInfos, + * the {@link BundleStatsMap} objects containing the usage information about each bundle. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryBundleStatsInfos(begin: number, end: number): Promise; + + /** + * Declares interval type. + * + * @enum { number } * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @systemapi Hide this for inner system use. + * @since 9 */ export enum IntervalType { /** @@ -386,123 +490,241 @@ declare namespace usageStatistics { /** * Queries usage information about each bundle within a specified period at a specified interval. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param byInterval Indicates the interval at which the usage statistics are queried. + * @param { IntervalType } byInterval - Indicates the interval at which the usage statistics are queried. * The value can be {@link #BY_OPTIMIZED}, {@link #BY_DAILY}, * {@link #BY_WEEKLY}, {@link #BY_MONTHLY}, or {@link #BY_ANNUALLY}. - * @param begin Indicates the start time of the query period, in milliseconds. - * @param end Indicates the end time of the query period, in milliseconds. + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @param { AsyncCallback> } callback - the callback of queryBundleStatsInfoByInterval, + * the list of {@link BundleStatsInfo} objects containing the usage information about each bundle. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10000007 - Get system or actual time failed. - * @return Returns the list of {@link BundleStatsInfo} objects containing the usage information about each bundle. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback>): void; + + /** + * Queries usage information about each bundle within a specified period at a specified interval. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { IntervalType } byInterval - Indicates the interval at which the usage statistics are queried. + * The value can be {@link #BY_OPTIMIZED}, {@link #BY_DAILY}, + * {@link #BY_WEEKLY}, {@link #BY_MONTHLY}, or {@link #BY_ANNUALLY}. + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @returns { Promise> } the promise returned by queryBundleStatsInfoByInterval, + * the list of {@link BundleStatsInfo} objects containing the usage information about each bundle. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise>; /** * Queries state data of all bundles within a specified period identified by the start and end time. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param begin Indicates the start time of the query period, in milliseconds. - * @param end Indicates the end time of the query period, in milliseconds. + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @param { AsyncCallback> } callback - the promise returned by queryBundleEvents, + * the list of {@link BundleEvents} objects containing the state data of all bundles. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10000007 - Get system or actual time failed. - * @return Returns the list of {@link BundleEvents} objects containing the state data of all bundles. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryBundleEvents(begin: number, end: number, callback: AsyncCallback>): void; + + /** + * Queries state data of all bundles within a specified period identified by the start and end time. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @returns { Promise> } the promise returned by queryBundleEvents, + * the list of {@link BundleEvents} objects containing the state data of all bundles. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryBundleEvents(begin: number, end: number): Promise>; /** * Queries state data of the current bundle within a specified period. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App - * @param begin Indicates the start time of the query period, in milliseconds. - * @param end Indicates the end time of the query period, in milliseconds. + * + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @param { AsyncCallback> } callback - the callback of queryCurrentBundleEvents, + * the {@link BundleEvents} object Array containing the state data of the current bundle. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10000007 - Get system or actual time failed. - * @return Returns the {@link BundleEvents} object Array containing the state data of the current bundle. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10000007 - Failed to get the system time. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 9 */ function queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback>): void; - function queryCurrentBundleEvents(begin: number, end: number): Promise>; /** - * Queries recently module usage records. - * - * @since 9 + * Queries state data of the current bundle within a specified period. + * + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @returns { Promise> } the promise returned by queryCurrentBundleEvents, + * the {@link BundleEvents} object Array containing the state data of the current bundle. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10000007 - Failed to get the system time. * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 9 + */ + function queryCurrentBundleEvents(begin: number, end: number): Promise>; + + /** + * Queries recently module usage records with maxNum. + * * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param maxNum Indicates max record number in result, max value is 1000, default value is 1000. + * @param { number } 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 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10000007 - Get system or actual time failed. - * @return Returns the {@link HapModuleInfo} object Array containing the usage data of the modules. + * @throws { BusinessError } 10000004 - IPC failed. + * @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: number, callback: AsyncCallback>): void; + + /** + * Queries recently module usage records with maxNum. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { number } 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 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @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: number): Promise>; /** * Queries recently module usage records. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. + * @param { AsyncCallback> } callback - the callback of queryModuleUsageRecords, + * the {@link HapModuleInfo} object Array containing the usage data of the modules. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10000007 - Get system or actual time failed. - * @return Returns the {@link HapModuleInfo} object Array containing the usage data of the modules. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @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(): Promise>; - /** + /** * Declares group type. - * - * @since 9 + * + * @enum { number } * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup * @systemapi Hide this for inner system use. + * @since 9 */ export enum GroupType { /** @@ -537,111 +759,224 @@ declare namespace usageStatistics { } /** - * Set app group by bundleName and number. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * Set app group by bundleName. + * * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param bundleName, name of the application. - * @param newGroup, the group of the application whose name is bundleName. + * @param { string } bundleName - name of the application. + * @param { GroupType } newGroup - the group of the application whose name is bundleName. + * @param { AsyncCallback } callback - the callback of setAppGroup. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10100001 - Application group operation repeated. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10100001 - Repeated operation on the application group. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + * @since 9 */ function setAppGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback): void; - function setAppGroup(bundleName: string, newGroup: GroupType): Promise; /** - * Register callback to service. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * Set app group by bundleName. + * * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { string } bundleName - name of the application. + * @param { GroupType } newGroup - the group of the application whose name is bundleName. + * @returns { Promise } the promise returned by setAppGroup. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10000006 - Failed to get the application information. + * @throws { BusinessError } 10100001 - Repeated operation on the application group. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup * @systemapi Hide this for inner system use. - * @param Callback, callback when application group change,return the AppGroupCallbackInfo. + * @since 9 + */ + function setAppGroup(bundleName: string, newGroup: GroupType): Promise; + + /** + * Register appGroup change callback to service. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { Callback } groupCallback - + * callback when AppGroupCallbackInfo when the group of app changed. + * @param { AsyncCallback } callback - the callback of registerAppGroupCallBack. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10100001 - Application group operation repeated. - * @return Returns AppGroupCallbackInfo when the group of bundle changed. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10100001 - Repeated operation on the application group. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + * @since 9 */ function registerAppGroupCallBack(groupCallback: Callback, callback: AsyncCallback): void; - function registerAppGroupCallBack(groupCallback: Callback): Promise; /** - * Unregister callback from service. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * Register appGroup change callback to service. + * * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { Callback } groupCallback - + * callback when AppGroupCallbackInfo when the group of app changed. + * @returns { Promise } the promise returned by registerAppGroupCallBack. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10100001 - Repeated operation on the application group. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup * @systemapi Hide this for inner system use. + * @since 9 + */ + function registerAppGroupCallBack(groupCallback: Callback): Promise; + + /** + * Unregister appGroup change callback from service. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { AsyncCallback } callback - the callback of unregisterAppGroupCallBack. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10100001 - Application group operation repeated. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10100001 - Repeated operation on the application group. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + * @since 9 */ function unregisterAppGroupCallBack(callback: AsyncCallback): void; + + /** + * Unregister appGroup change callback from service. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @returns { Promise } the promise returned by unregisterAppGroupCallBack. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @throws { BusinessError } 10100001 - Repeated operation on the application group. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + * @since 9 + */ function unregisterAppGroupCallBack(): Promise; /** * Queries device event states data within a specified period identified by the start and end time. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param begin Indicates the start time of the query period, in milliseconds. - * @param end Indicates the end time of the query period, in milliseconds. + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @param { AsyncCallback> } callback - the callback of queryDeviceEventStats, + * the {@link DeviceEventStats} object Array containing the event states data. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10000007 - Get system or actual time failed. - * @return Returns the {@link DeviceEventStats} object Array containing the event states data. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryDeviceEventStats(begin: number, end: number, callback: AsyncCallback>): void; + + /** + * Queries device event states data within a specified period identified by the start and end time. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @returns { Promise> } the promise returned by queryDeviceEventStats, + * the {@link DeviceEventStats} object Array containing the event states data. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryDeviceEventStats(begin: number, end: number): Promise>; /** * Queries app notification number within a specified period identified by the start and end time. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param begin Indicates the start time of the query period, in milliseconds. - * @param end Indicates the end time of the query period, in milliseconds. + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @param { AsyncCallback> } callback - the callback of queryNotificationEventStats, + * the {@link DeviceEventStats} object Array containing the event states data. * @throws { BusinessError } 201 - Parameter error. * @throws { BusinessError } 401 - Permission denied. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 10000001 - Memory operation failed. * @throws { BusinessError } 10000002 - Parcel operation failed. * @throws { BusinessError } 10000003 - System service operation failed. - * @throws { BusinessError } 10000004 - IPC Communication failed. - * @throws { BusinessError } 10000006 - Get application info failed. - * @throws { BusinessError } 10000007 - Get system or actual time failed. - * @return Returns the {@link NotificationEventStats} object Array containing the event states data. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryNotificationEventStats(begin: number, end: number, callback: AsyncCallback>): void; + + /** + * Queries app notification number within a specified period identified by the start and end time. + * + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @param { number } begin - Indicates the start time of the query period, in milliseconds. + * @param { number } end - Indicates the end time of the query period, in milliseconds. + * @returns { Promise> } the promise returned by queryNotificationEventStats, + * the {@link DeviceEventStats} object Array containing the event states data. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC failed. + * @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 queryNotificationEventStats(begin: number, end: number): Promise>; } diff --git a/interfaces/kits/bundlestats/napi/include/bundle_state_inner_errors.h b/interfaces/kits/bundlestats/napi/include/bundle_state_inner_errors.h index a709d3c..21908b6 100644 --- a/interfaces/kits/bundlestats/napi/include/bundle_state_inner_errors.h +++ b/interfaces/kits/bundlestats/napi/include/bundle_state_inner_errors.h @@ -115,22 +115,22 @@ static std::map saErrCodeMsgMap = { {ERR_SYSTEM_SERVICES_NOT_READY, "System service operation failed. The service is not ready."}, {ERR_REMOTE_OBJECT_IF_CAST_FAILED, "System service operation failed. The remote object if cast failed."}, {ERR_SYSTEM_ABILITY_SUPPORT_FAILED, "System service operation failed. System ability support failed."}, - {ERR_IPC_COMMUNICATION_FAILED, "IPC communication failed. Failed to access the system service."}, + {ERR_IPC_COMMUNICATION_FAILED, "IPC failed. Failed to access the system service."}, {ERR_APPLICATION_IS_NOT_INSTALLED, "The application is not installed. Failed to operation the application."}, - {ERR_FIND_APP_USAGE_RECORDS_FAILED, "Get application info failed. Cannot find app usage records."}, - {ERR_NO_RECORDS_INFO_BY_INTERVAL, - "Get application info failed. According to inetrvalType. no information is recorded in the related table."}, + {ERR_FIND_APP_USAGE_RECORDS_FAILED, "Failed to get the application information. Cannot find app usage records."}, + {ERR_NO_RECORDS_INFO_BY_INTERVAL, "Failed to get the application information." + "According to inetrvalType. no information is recorded in the related table."}, {ERR_QUERY_TIME_OUT_OF_RANGE, - "Get application info failed. According to beginTime and endTime. no information is recorded"}, + "Failed to get the application information. According to beginTime and endTime. no information is recorded"}, {ERR_GET_BUNDLE_USED_HISTORY_FAILED, - "Get application info failed. According to userId、bundleName, no information is recorded"}, - {ERR_TIME_OPERATION_FAILED, "Get system or actual time operation failed."}, - {ERR_REPEAT_REGISTER_OR_DEREGISTER_GROUP_CALLBACK, - "Application group operation failed. Repeat to register or deregister, an interception application group"}, - {ERR_REPEAT_SET_APP_GROUP, - "Application group operation failed. The application group are the the same and do not need te be updated."}, + "Failed to get the application information. According to userId、bundleName, no information is recorded"}, + {ERR_TIME_OPERATION_FAILED, "Failed to get the system time."}, + {ERR_REPEAT_REGISTER_OR_DEREGISTER_GROUP_CALLBACK, "Repeated operation on the application group." + "Repeat to register or deregister an interception application group"}, + {ERR_REPEAT_SET_APP_GROUP, "Repeated operation on the application group." + "The application group are the the same and do not need te be updated."}, {ERR_NO_APP_GROUP_INFO_IN_DATABASE, - "Get application group info failed. The application group infomation cannot be found."}, + "Failed to get the application group information. The application group infomation cannot be found."}, }; static std::map paramErrCodeMsgMap = { -- Gitee