From fa6193e61523e58c9793866f251558b24eaca384 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Tue, 11 Jan 2022 17:28:29 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= =?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: houdisheng --- interfaces/innerkits/src/bundle_active_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/innerkits/src/bundle_active_client.cpp b/interfaces/innerkits/src/bundle_active_client.cpp index 9f9d835..7ddb46d 100644 --- a/interfaces/innerkits/src/bundle_active_client.cpp +++ b/interfaces/innerkits/src/bundle_active_client.cpp @@ -31,7 +31,7 @@ bool BundleActiveClient::GetBundleActiveProxy() { sptr object = samgr->GetSystemAbility(BUNDLE_ACTIVE_SYS_ABILITY_ID); if (object == nullptr) { - BUNDLE_ACTIVE_LOGE("Failed to get SystemAbility[1910] ."); + BUNDLE_ACTIVE_LOGE("Failed to get SystemAbility[1906] ."); return false; } -- Gitee From 2e8a066498f1495442364953b5c842300136cfab Mon Sep 17 00:00:00 2001 From: houdisheng Date: Thu, 13 Jan 2022 16:51:43 +0800 Subject: [PATCH 2/6] =?UTF-8?q?readme=20=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- README_ZH.md | 99 ++++++++++++++++++++++++++++++++ README_zh.md => README_ZH.md.bak | 18 +++--- 2 files changed, 108 insertions(+), 9 deletions(-) create mode 100644 README_ZH.md rename README_zh.md => README_ZH.md.bak (86%) diff --git a/README_ZH.md b/README_ZH.md new file mode 100644 index 0000000..1c1986d --- /dev/null +++ b/README_ZH.md @@ -0,0 +1,99 @@ +# 设备使用信息统计 +- [简介](#section11660541593) +- [目录](#section161941989596) +- [说明](#section1312121216216) + - [接口说明](#section1551164914237) + - [使用说明](#section129654513264) + +- [相关仓](#section1371113476307) + +## 简介 + +设备使用信息统计,包括app usage/notification usage/system usage等使用统计。例如应用使用信息统计,用于保存和查询应用使用详情(app usage)、事件日志数据(event log)、应用分组(bundle group)情况。 +部件缓存的应用记录(使用历史统计和使用事件记录)会在事件上报后30分钟内刷新到数据库持久化保存。 + +## 目录 + +``` +/foundation/resourceschedule/device_usage_statistics +├── ohos.build # 编译脚本 +├── BUILD.gn # 模块编译脚本 +├── interfaces +│ ├── innerkits # 对内接口目录 +│ └── kits # 对外接口目录 +├── services # 服务层目录 +├── frameworks +│ ├── JS # 对外JS接口实现目录 +│ └── native # 对外Native接口实现目录 +├── adapter # 适配目录 +└── test # 测试用例目录 +``` + +## 说明 + +### 接口说明 + +设备使用信息统计接口,包括app usage/notification usage/system usage等接口,以app usage接口为例,对外提供主要接口如下。 + + + + + + + + + + + + + + + + + + + +

接口名

+

接口描述

+

queryBundleActiveStates(begin::number, end::number, callback:AsyncCallback<Array<BundleActiveState>>):void

+

通过指定起始和结束时间查询所有应用的事件集合。

+

queryBundleStateInfos(begin::number, end::number, callback:AsyncCallback<BundleStateInfoResponse>):void

+

使用起始和结束时间来查询应用使用时长统计信息。

+

queryCurrentBundleActiveStates(begin::number, end::number, callback:AsyncCallback<Array<BundleActiveState>>):void

+

通过时间段间隔(天、周、月、年)等查询当前应用的事件集合。

+

queryBundleStateInfoByInterval(byInterval:intervalType, begin::number, end::number, callback:AsyncCallback<Array<BundleStateInfo>>):void

+

通过时间段间隔(天、周、月、年)查询应用使用时长统计信息。

+

queryAppUsagePriorityGroup(callback:AsyncCallback<number>):void

+

查询(返回)当前调用者应用的使用优先级群组。

+

isIdleState(bundleName:string, callback:AsyncCallback<boolean>):void

+

判断指定Bundle Name的应用当前是否是空闲状态。

+
+ +### 使用说明 + +设备使用信息统计接口众多,以应用使用详情(app usage)接口为例,介绍接口逻辑。 + +- **运行进程**:设备使用信息统计服务在foundation进程启动和运行。 +- **应用使用统计信息落盘时机**: +>1. 每隔30分钟触发一次刷新; +>2. 系统时间变更触发一次刷新; +>3. 下一天开始触发一次刷新; +- **应用查询接口**: +>1. 根据起止时间查询所有应用的事件集合; +>2. 根据起止时间查询应用的使用时长; +>3. 根据起止时间查询当前应用的事件集合; +>4. 根据interval(日、周、月、年)类型和起止时间查询应用的使用时长; +>5. 查询调用者应用的优先级群组; +>5. 判断指定应用当前是否是空闲状态; + +## 相关仓 + +全局资源调度子系统 + +**device\_usage\_statistics** + +resource_schedule_service + +appexecfwk_standard + +native_appdatamgr \ No newline at end of file diff --git a/README_zh.md b/README_ZH.md.bak similarity index 86% rename from README_zh.md rename to README_ZH.md.bak index 26da369..94906f8 100644 --- a/README_zh.md +++ b/README_ZH.md.bak @@ -9,8 +9,8 @@ ## 简介 -设备使用信息统计,包括app usage/notification usage/system usage等使用统计。例如应用使用信息统计,用于保存和查询应用使用详情、事件日志数据、应用分组情况。 -部件缓存的应用记录(使用历史统计和使用事件记录)会定期刷新到数据库进行持久化保存。 +设备使用信息统计,包括app usage/notification usage/system usage等使用统计。例如应用使用信息统计,用于保存和查询应用使用详情(app usage)、事件日志数据(event log)、应用分组(bundle group)情况。 +部件缓存的应用记录(使用历史统计和使用事件记录)会在事件上报后30分钟内刷新到数据库持久化保存。 ## 目录 @@ -23,8 +23,8 @@ │ └── kits # 对外接口目录 ├── services # 服务层目录 ├── frameworks -│ ├── JS # 外部JS接口实现目录 -│ └── native # 外部native接口实现目录 +│ ├── JS # 对外JS接口实现目录 +│ └── native # 对外Native接口实现目录 ├── adapter # 适配目录 └── test # 测试用例目录 ``` @@ -33,7 +33,7 @@ ### 接口说明 -设备使用信息统计接口,包括app usage/notification usage/system usage等接口,以app usage接口为例,对外暴露的主要接口如下所示。 +设备使用信息统计接口,包括app usage/notification usage/system usage等接口,以app usage接口为例,对外提供主要接口如下。 - - - - - -

接口名

@@ -44,7 +44,7 @@

queryBundleActiveStates(begin::number, end::number, callback:AsyncCallback<Array<BundleActiveState>>):void

通过时间段间隔查询所有应用的事件集合。

+

通过指定起始和结束时间查询所有应用的事件集合。

queryBundleStateInfos(begin::number, end::number, callback:AsyncCallback<BundleStateInfoResponse>):void

@@ -54,10 +54,10 @@

queryCurrentBundleActiveStates(begin::number, end::number, callback:AsyncCallback<Array<BundleActiveState>>):void

通过时间段间隔查询当前应用的事件集合。

+

通过时间段间隔(天、周、月、年)等查询当前应用的事件集合。

queryBundleStateInfoByInterval(byInterval:intervalType, begin::number, end::number, callback:AsyncCallback<Array<BundleStateInfo>>):void

通过时间段间隔查询应用使用时长统计信息。

+

通过时间段间隔(天、周、月、年)查询应用使用时长统计信息。

queryAppUsagePriorityGroup(callback:AsyncCallback<number>):void

查询(返回)当前调用者应用的使用优先级群组。

@@ -71,7 +71,7 @@ ### 使用说明 -设备使用信息统计接口众多,以app usage接口为例,介绍下接口逻辑。 +设备使用信息统计接口众多,以app usage接口为例,介绍接口逻辑。 - **运行进程**:设备使用信息统计服务在foundation进程启动和运行。 - **应用使用统计信息落盘时机**: -- Gitee From eb253ba10352284eea7fc63ff4dff96dbdf9e33a Mon Sep 17 00:00:00 2001 From: houdisheng Date: Thu, 13 Jan 2022 17:03:03 +0800 Subject: [PATCH 3/6] =?UTF-8?q?readme=20=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- README_ZH.md | 6 +-- README_ZH.md.bak | 99 ------------------------------------------------ 2 files changed, 3 insertions(+), 102 deletions(-) delete mode 100644 README_ZH.md.bak diff --git a/README_ZH.md b/README_ZH.md index 1c1986d..8d12502 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -49,15 +49,15 @@

queryBundleStateInfos(begin::number, end::number, callback:AsyncCallback<BundleStateInfoResponse>):void

使用起始和结束时间来查询应用使用时长统计信息。

+

通过指定起始和结束时间查询应用使用时长统计信息。

queryCurrentBundleActiveStates(begin::number, end::number, callback:AsyncCallback<Array<BundleActiveState>>):void

通过时间段间隔(天、周、月、年)等查询当前应用的事件集合。

+

通过指定起始和结束时间查询当前应用的事件集合。

queryBundleStateInfoByInterval(byInterval:intervalType, begin::number, end::number, callback:AsyncCallback<Array<BundleStateInfo>>):void

通过时间段间隔(天、周、月、年)查询应用使用时长统计信息。

+

通过指定时间段间隔(天、周、月、年)查询应用使用时长统计信息。

queryAppUsagePriorityGroup(callback:AsyncCallback<number>):void

查询(返回)当前调用者应用的使用优先级群组。

diff --git a/README_ZH.md.bak b/README_ZH.md.bak deleted file mode 100644 index 94906f8..0000000 --- a/README_ZH.md.bak +++ /dev/null @@ -1,99 +0,0 @@ -# 设备使用信息统计 -- [简介](#section11660541593) -- [目录](#section161941989596) -- [说明](#section1312121216216) - - [接口说明](#section1551164914237) - - [使用说明](#section129654513264) - -- [相关仓](#section1371113476307) - -## 简介 - -设备使用信息统计,包括app usage/notification usage/system usage等使用统计。例如应用使用信息统计,用于保存和查询应用使用详情(app usage)、事件日志数据(event log)、应用分组(bundle group)情况。 -部件缓存的应用记录(使用历史统计和使用事件记录)会在事件上报后30分钟内刷新到数据库持久化保存。 - -## 目录 - -``` -/foundation/resourceschedule/device_usage_statistics -├── ohos.build # 编译脚本 -├── BUILD.gn # 模块编译脚本 -├── interfaces -│ ├── innerkits # 对内接口目录 -│ └── kits # 对外接口目录 -├── services # 服务层目录 -├── frameworks -│ ├── JS # 对外JS接口实现目录 -│ └── native # 对外Native接口实现目录 -├── adapter # 适配目录 -└── test # 测试用例目录 -``` - -## 说明 - -### 接口说明 - -设备使用信息统计接口,包括app usage/notification usage/system usage等接口,以app usage接口为例,对外提供主要接口如下。 - - - - - - - - - - - - - - - - - - - -

接口名

-

接口描述

-

queryBundleActiveStates(begin::number, end::number, callback:AsyncCallback<Array<BundleActiveState>>):void

-

通过指定起始和结束时间查询所有应用的事件集合。

-

queryBundleStateInfos(begin::number, end::number, callback:AsyncCallback<BundleStateInfoResponse>):void

-

使用起始和结束时间来查询应用使用时长统计信息。

-

queryCurrentBundleActiveStates(begin::number, end::number, callback:AsyncCallback<Array<BundleActiveState>>):void

-

通过时间段间隔(天、周、月、年)等查询当前应用的事件集合。

-

queryBundleStateInfoByInterval(byInterval:intervalType, begin::number, end::number, callback:AsyncCallback<Array<BundleStateInfo>>):void

-

通过时间段间隔(天、周、月、年)查询应用使用时长统计信息。

-

queryAppUsagePriorityGroup(callback:AsyncCallback<number>):void

-

查询(返回)当前调用者应用的使用优先级群组。

-

isIdleState(bundleName:string, callback:AsyncCallback<boolean>):void

-

判断指定Bundle Name的应用当前是否是空闲状态。

-
- -### 使用说明 - -设备使用信息统计接口众多,以app usage接口为例,介绍接口逻辑。 - -- **运行进程**:设备使用信息统计服务在foundation进程启动和运行。 -- **应用使用统计信息落盘时机**: ->1. 每隔30分钟触发一次刷新; ->2. 系统时间变更触发一次刷新; ->3. 下一天开始触发一次刷新; -- **应用查询接口**: ->1. 根据起止时间查询所有应用的事件集合; ->2. 根据起止时间查询应用的使用时长; ->3. 根据起止时间查询当前应用的事件集合; ->4. 根据interval(日、周、月、年)类型和起止时间查询应用的使用时长; ->5. 查询调用者应用的优先级群组; ->5. 判断指定应用当前是否是空闲状态; - -## 相关仓 - -全局资源调度子系统 - -**device\_usage\_statistics** - -resource_schedule_service - -appexecfwk_standard - -native_appdatamgr \ No newline at end of file -- Gitee From 41869ba0a4b6c38c8768b58d80225fac1225d0f6 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Thu, 13 Jan 2022 20:11:37 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9build.gn=E5=92=8Cohos.bui?= =?UTF-8?q?ld=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- BUILD.gn | 8 ++++---- ohos.build | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index fa3d6f6..9e9deb3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -6,7 +6,7 @@ ohos_sa_profile("bundleactive_sa_profile") { sources = [ "sa_profile/1906.xml" ] - part_name = "bundleactive" + part_name = "resourceschedule_device_usage_statistics" } ################################################## @@ -28,7 +28,7 @@ ohos_shared_library("bundleactiveinner") { "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy" ] - part_name = "bundleactive" + part_name = "resourceschedule_device_usage_statistics" subsystem_name = "resourceschedule" } ################################################## bundleactiveinner end @@ -41,7 +41,7 @@ ohos_prebuilt_etc("bundleactive_service_init") { source = "init/bundleactive_service.rc" } relative_install_dir = "init" - part_name = "bundleactive" + part_name = "resourceschedule_device_usage_statistics" subsystem_name = "resourceschedule" } ################################################## @@ -91,7 +91,7 @@ ohos_shared_library("bundleactiveservice") { "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy" ] - part_name = "bundleactive" + part_name = "resourceschedule_device_usage_statistics" subsystem_name = "resourceschedule" } ################################################## bundleactiveservice end diff --git a/ohos.build b/ohos.build index 6435cac..81d89ca 100644 --- a/ohos.build +++ b/ohos.build @@ -1,25 +1,25 @@ { "subsystem": "resourceschedule", "parts": { - "bundleactive": { + "resourceschedule_device_usage_statistics": { "variants": [ ], "module_list": [ - "//foundation/resourceschedule/bundleactive:bundleactiveinner", - "//foundation/resourceschedule/bundleactive:bundleactiveservice", - "//foundation/resourceschedule/bundleactive:bundleactive_sa_profile", - "//foundation/resourceschedule/bundleactive:bundleactive_service_init" + "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactiveinner", + "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactiveservice", + "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactive_sa_profile", + "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactive_service_init" ], "inner_kits": [ { "header": { - "header_base": "//foundation/resourceschedule/bundleactive/interfaces/innerkits/include", + "header_base": "//foundation/resourceschedule/resourceschedule_device_usage_statistics/interfaces/innerkits/include", "header_files": [ "bundle_active_proxy.h", "bundle_active_client.h" ] }, - "name": "//foundation/resourceschedule/bundleactive:bundleactiveinner" + "name": "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactiveinner" } ], "system_kits": [ -- Gitee From 8ef1256b7b68b51e3cae3288eccd994a5d3cb194 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Thu, 13 Jan 2022 20:33:25 +0800 Subject: [PATCH 5/6] =?UTF-8?q?build.gn=EF=BC=8Cohos.build=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- BUILD.gn | 8 ++++---- ohos.build | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 9e9deb3..7de14f6 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -6,7 +6,7 @@ ohos_sa_profile("bundleactive_sa_profile") { sources = [ "sa_profile/1906.xml" ] - part_name = "resourceschedule_device_usage_statistics" + part_name = "device_usage_statistics" } ################################################## @@ -28,7 +28,7 @@ ohos_shared_library("bundleactiveinner") { "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy" ] - part_name = "resourceschedule_device_usage_statistics" + part_name = "device_usage_statistics" subsystem_name = "resourceschedule" } ################################################## bundleactiveinner end @@ -41,7 +41,7 @@ ohos_prebuilt_etc("bundleactive_service_init") { source = "init/bundleactive_service.rc" } relative_install_dir = "init" - part_name = "resourceschedule_device_usage_statistics" + part_name = "device_usage_statistics" subsystem_name = "resourceschedule" } ################################################## @@ -91,7 +91,7 @@ ohos_shared_library("bundleactiveservice") { "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy" ] - part_name = "resourceschedule_device_usage_statistics" + part_name = "device_usage_statistics" subsystem_name = "resourceschedule" } ################################################## bundleactiveservice end diff --git a/ohos.build b/ohos.build index 81d89ca..722a3a5 100644 --- a/ohos.build +++ b/ohos.build @@ -1,25 +1,25 @@ { "subsystem": "resourceschedule", "parts": { - "resourceschedule_device_usage_statistics": { + "device_usage_statistics": { "variants": [ ], "module_list": [ - "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactiveinner", - "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactiveservice", - "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactive_sa_profile", - "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactive_service_init" + "//foundation/resourceschedule/device_usage_statistics:bundleactiveinner", + "//foundation/resourceschedule/device_usage_statistics:bundleactiveservice", + "//foundation/resourceschedule/device_usage_statistics:bundleactive_sa_profile", + "//foundation/resourceschedule/device_usage_statistics:bundleactive_service_init" ], "inner_kits": [ { "header": { - "header_base": "//foundation/resourceschedule/resourceschedule_device_usage_statistics/interfaces/innerkits/include", + "header_base": "//foundation/resourceschedule/device_usage_statistics/interfaces/innerkits/include", "header_files": [ "bundle_active_proxy.h", "bundle_active_client.h" ] }, - "name": "//foundation/resourceschedule/resourceschedule_device_usage_statistics:bundleactiveinner" + "name": "//foundation/resourceschedule/device_usage_statistics:bundleactiveinner" } ], "system_kits": [ -- Gitee From 130ba0d49af55e072d4fcff20e7b8db8fcae88bd Mon Sep 17 00:00:00 2001 From: houdisheng Date: Thu, 13 Jan 2022 20:44:33 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9ohos.build=E5=92=8Cbuild.?= =?UTF-8?q?gn=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- BUILD.gn | 8 ++++---- device_usage_statistics.gni | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 device_usage_statistics.gni diff --git a/BUILD.gn b/BUILD.gn index 7de14f6..2891dcc 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,4 +1,4 @@ -import("//build/ohos.gni") +import("device_usage_statistics.gni") import("//build/ohos/sa_profile/sa_profile.gni") ################################################## @@ -28,7 +28,7 @@ ohos_shared_library("bundleactiveinner") { "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy" ] - part_name = "device_usage_statistics" + part_name = "${device_usage_statistics_part_name}" subsystem_name = "resourceschedule" } ################################################## bundleactiveinner end @@ -41,7 +41,7 @@ ohos_prebuilt_etc("bundleactive_service_init") { source = "init/bundleactive_service.rc" } relative_install_dir = "init" - part_name = "device_usage_statistics" + part_name = "${device_usage_statistics_part_name}" subsystem_name = "resourceschedule" } ################################################## @@ -91,7 +91,7 @@ ohos_shared_library("bundleactiveservice") { "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy" ] - part_name = "device_usage_statistics" + part_name = "${device_usage_statistics_part_name}" subsystem_name = "resourceschedule" } ################################################## bundleactiveservice end diff --git a/device_usage_statistics.gni b/device_usage_statistics.gni new file mode 100644 index 0000000..a18fede --- /dev/null +++ b/device_usage_statistics.gni @@ -0,0 +1,3 @@ +import("//build/ohos.gni") + +device_usage_statistics_part_name = "device_usage_statistics" \ No newline at end of file -- Gitee