From b0cd85f53919b62424ae30704a1428627b5021bb Mon Sep 17 00:00:00 2001 From: wyuanchao Date: Wed, 2 Mar 2022 15:17:19 +0800 Subject: [PATCH 1/3] modify bundleState.d.ts Signed-off-by: wyuanchao --- BUILD.gn | 2 +- bundle.json | 2 +- .../bundlestats/js/@ohos.bundleState.d.ts | 66 ++++++++++++------- .../napi/include/bundle_state_init.h | 2 +- 4 files changed, 47 insertions(+), 25 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 5a54201..7a44408 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -52,7 +52,7 @@ ohos_prebuilt_etc("device_usage_statistics_service_init") { subsystem_name = "resourceschedule" } -ohos_shared_library("usagestatskit") { +ohos_shared_library("bundlestate") { sources = [ "frameworks/src/bundle_state_common.cpp", "frameworks/src/bundle_state_init.cpp", diff --git a/bundle.json b/bundle.json index 1dcaacc..014b937 100644 --- a/bundle.json +++ b/bundle.json @@ -52,7 +52,7 @@ "//foundation/resourceschedule/device_usage_statistics:usagestatservice", "//foundation/resourceschedule/device_usage_statistics:device_usage_statistics_sa_profile", "//foundation/resourceschedule/device_usage_statistics:device_usage_statistics_service_init", - "//foundation/resourceschedule/device_usage_statistics:usagestatskit" + "//foundation/resourceschedule/device_usage_statistics:bundlestate" ], "inner_kits": [ { diff --git a/interfaces/kits/bundlestats/js/@ohos.bundleState.d.ts b/interfaces/kits/bundlestats/js/@ohos.bundleState.d.ts index e28bf6c..9a5f353 100644 --- a/interfaces/kits/bundlestats/js/@ohos.bundleState.d.ts +++ b/interfaces/kits/bundlestats/js/@ohos.bundleState.d.ts @@ -31,8 +31,10 @@ declare namespace bundleState { /** * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.App - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. + * @devices phone, tablet, tv, wearable, car. + * @permission ohos.permission.BUNDLE_ACTIVE_INFO. + * @systemapi Hide this for inner system use. */ interface BundleStateInfo { /** @@ -83,8 +85,10 @@ declare namespace bundleState { * The bundle name of both objects must be the same. * * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.App - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. + * @devices phone, tablet, tv, wearable, car. + * @permission ohos.permission.BUNDLE_ACTIVE_INFO. + * @systemapi Hide this for inner system use. * @param toMerge Indicates the {@link BundleActiveInfo} object to merge. * if the bundle names of the two {@link BundleActiveInfo} objects are different. */ @@ -93,8 +97,10 @@ declare namespace bundleState { /** * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.App - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. + * @devices phone, tablet, tv, wearable, car. + * @permission ohos.permission.BUNDLE_ACTIVE_INFO. + * @systemapi Hide this for inner system use. */ interface BundleActiveState { /** @@ -127,8 +133,10 @@ declare namespace bundleState { * Checks whether the application with a specified bundle name is in the idle state. * * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup. + * @devices phone, tablet, tv, wearable, car. + * @permission ohos.permission.BUNDLE_ACTIVE_INFO. + * @systemapi Hide this for inner system use. * @param bundleName Indicates the bundle name of the application to query. * @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, @@ -144,8 +152,10 @@ declare namespace bundleState { * for example, restricting the running of background tasks.

* * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup. + * @devices phone, tablet, tv, wearable, car. + * @permission ohos.permission.BUNDLE_ACTIVE_INFO. + * @systemapi Hide this for inner system use. * @return Returns the usage priority group of the calling application. */ function queryAppUsagePriorityGroup(callback: AsyncCallback): void; @@ -153,8 +163,10 @@ declare namespace bundleState { /** * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.App - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. + * @devices phone, tablet, tv, wearable, car. + * @permission ohos.permission.BUNDLE_ACTIVE_INFO. + * @systemapi Hide this for inner system use. */ interface BundleActiveInfoResponse { [key: string]: BundleStateInfo; @@ -166,8 +178,10 @@ declare namespace bundleState { *

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

* * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.App - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. + * @devices phone, tablet, tv, wearable, car. + * @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. * @return Returns the {@link BundleActiveInfoResponse} objects containing the usage information about each bundle. @@ -179,8 +193,10 @@ declare namespace bundleState { * Declares interval type. * * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.App - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. + * @devices phone, tablet, tv, wearable, car. + * @permission ohos.permission.BUNDLE_ACTIVE_INFO. + * @systemapi Hide this for inner system use. */ export enum IntervalType { /** @@ -213,8 +229,10 @@ declare namespace bundleState { * Queries usage information about each bundle within a specified period at a specified interval. * * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.App - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. + * @devices phone, tablet, tv, wearable, car. + * @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. * The value can be {@link #BY_OPTIMIZED}, {@link #BY_DAILY}, * {@link #BY_WEEKLY}, {@link #BY_MONTHLY}, or {@link #BY_ANNUALLY}. @@ -229,8 +247,10 @@ declare namespace bundleState { * Queries state data of all bundles within a specified period identified by the start and end time. * * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.App - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. + * @devices phone, tablet, tv, wearable, car. + * @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. * @return Returns the list of {@link BundleActiveState} objects containing the state data of all bundles. @@ -242,8 +262,10 @@ declare namespace bundleState { * Queries state data of the current bundle within a specified period. * * @since 7 - * @sysCap SystemCapability.ResourceSchedule.UsageStatistics.App - * @devices phone, tablet, tv, wearable, car + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. + * @devices phone, tablet, tv, wearable, car. + * @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. * @return Returns the {@link BundleActiveState} object Array containing the state data of the current bundle. diff --git a/interfaces/kits/bundlestats/napi/include/bundle_state_init.h b/interfaces/kits/bundlestats/napi/include/bundle_state_init.h index 045d7bb..c05c8f5 100644 --- a/interfaces/kits/bundlestats/napi/include/bundle_state_init.h +++ b/interfaces/kits/bundlestats/napi/include/bundle_state_init.h @@ -40,7 +40,7 @@ napi_module _module = { .nm_flags = 0, .nm_filename = nullptr, .nm_register_func = BundleStateInit, - .nm_modname = "usagestatskit", + .nm_modname = "bundlestate", .nm_priv = ((void *)0), .reserved = {0} }; -- Gitee From 9c7ff8caf1f534b549f63ad5fec0d1e5b660d59e Mon Sep 17 00:00:00 2001 From: wyuanchao Date: Wed, 2 Mar 2022 17:46:04 +0800 Subject: [PATCH 2/3] modify @devices Signed-off-by: wyuanchao --- .../kits/bundlestats/js/@ohos.bundleState.d.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/interfaces/kits/bundlestats/js/@ohos.bundleState.d.ts b/interfaces/kits/bundlestats/js/@ohos.bundleState.d.ts index 9a5f353..eb724fd 100644 --- a/interfaces/kits/bundlestats/js/@ohos.bundleState.d.ts +++ b/interfaces/kits/bundlestats/js/@ohos.bundleState.d.ts @@ -25,14 +25,12 @@ import { AsyncCallback } from './basic'; * then returns it to you. * * @since 7 - * @devices phone, tablet, tv, wearable, car */ declare namespace bundleState { /** * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. - * @devices phone, tablet, tv, wearable, car. * @permission ohos.permission.BUNDLE_ACTIVE_INFO. * @systemapi Hide this for inner system use. */ @@ -86,7 +84,6 @@ declare namespace bundleState { * * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. - * @devices phone, tablet, tv, wearable, car. * @permission ohos.permission.BUNDLE_ACTIVE_INFO. * @systemapi Hide this for inner system use. * @param toMerge Indicates the {@link BundleActiveInfo} object to merge. @@ -98,7 +95,6 @@ declare namespace bundleState { /** * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. - * @devices phone, tablet, tv, wearable, car. * @permission ohos.permission.BUNDLE_ACTIVE_INFO. * @systemapi Hide this for inner system use. */ @@ -134,7 +130,6 @@ declare namespace bundleState { * * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup. - * @devices phone, tablet, tv, wearable, car. * @permission ohos.permission.BUNDLE_ACTIVE_INFO. * @systemapi Hide this for inner system use. * @param bundleName Indicates the bundle name of the application to query. @@ -153,7 +148,6 @@ declare namespace bundleState { * * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup. - * @devices phone, tablet, tv, wearable, car. * @permission ohos.permission.BUNDLE_ACTIVE_INFO. * @systemapi Hide this for inner system use. * @return Returns the usage priority group of the calling application. @@ -164,7 +158,6 @@ declare namespace bundleState { /** * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. - * @devices phone, tablet, tv, wearable, car. * @permission ohos.permission.BUNDLE_ACTIVE_INFO. * @systemapi Hide this for inner system use. */ @@ -179,7 +172,6 @@ declare namespace bundleState { * * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. - * @devices phone, tablet, tv, wearable, car. * @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. @@ -194,7 +186,6 @@ declare namespace bundleState { * * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. - * @devices phone, tablet, tv, wearable, car. * @permission ohos.permission.BUNDLE_ACTIVE_INFO. * @systemapi Hide this for inner system use. */ @@ -230,7 +221,6 @@ declare namespace bundleState { * * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. - * @devices phone, tablet, tv, wearable, car. * @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. @@ -248,7 +238,6 @@ declare namespace bundleState { * * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. - * @devices phone, tablet, tv, wearable, car. * @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. @@ -263,7 +252,6 @@ declare namespace bundleState { * * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App. - * @devices phone, tablet, tv, wearable, car. * @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. -- Gitee From cd97c8d7ea22ce0e824eb8a656c80a968d8e23ff Mon Sep 17 00:00:00 2001 From: wyuanchao Date: Thu, 3 Mar 2022 09:13:49 +0800 Subject: [PATCH 3/3] modify bundle_state_init.h Signed-off-by: wyuanchao --- interfaces/kits/bundlestats/napi/include/bundle_state_init.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/bundlestats/napi/include/bundle_state_init.h b/interfaces/kits/bundlestats/napi/include/bundle_state_init.h index c05c8f5..7547c2a 100644 --- a/interfaces/kits/bundlestats/napi/include/bundle_state_init.h +++ b/interfaces/kits/bundlestats/napi/include/bundle_state_init.h @@ -40,7 +40,7 @@ napi_module _module = { .nm_flags = 0, .nm_filename = nullptr, .nm_register_func = BundleStateInit, - .nm_modname = "bundlestate", + .nm_modname = "bundleState", .nm_priv = ((void *)0), .reserved = {0} }; -- Gitee