diff --git a/0017-add-eventhandler-config_policy-c_utils.patch b/0017-add-eventhandler-config_policy-c_utils.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8325210da1be1945ad58f84119f73f76e2c8a555
--- /dev/null
+++ b/0017-add-eventhandler-config_policy-c_utils.patch
@@ -0,0 +1,2565 @@
+diff --git a/commonlibrary/c_utils/LICENSE b/commonlibrary/c_utils/LICENSE
+new file mode 100644
+index 0000000..4947287
+--- /dev/null
++++ b/commonlibrary/c_utils/LICENSE
+@@ -0,0 +1,177 @@
++
++ Apache License
++ Version 2.0, January 2004
++ http://www.apache.org/licenses/
++
++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
++
++ 1. Definitions.
++
++ "License" shall mean the terms and conditions for use, reproduction,
++ and distribution as defined by Sections 1 through 9 of this document.
++
++ "Licensor" shall mean the copyright owner or entity authorized by
++ the copyright owner that is granting the License.
++
++ "Legal Entity" shall mean the union of the acting entity and all
++ other entities that control, are controlled by, or are under common
++ control with that entity. For the purposes of this definition,
++ "control" means (i) the power, direct or indirect, to cause the
++ direction or management of such entity, whether by contract or
++ otherwise, or (ii) ownership of fifty percent (50%) or more of the
++ outstanding shares, or (iii) beneficial ownership of such entity.
++
++ "You" (or "Your") shall mean an individual or Legal Entity
++ exercising permissions granted by this License.
++
++ "Source" form shall mean the preferred form for making modifications,
++ including but not limited to software source code, documentation
++ source, and configuration files.
++
++ "Object" form shall mean any form resulting from mechanical
++ transformation or translation of a Source form, including but
++ not limited to compiled object code, generated documentation,
++ and conversions to other media types.
++
++ "Work" shall mean the work of authorship, whether in Source or
++ Object form, made available under the License, as indicated by a
++ copyright notice that is included in or attached to the work
++ (an example is provided in the Appendix below).
++
++ "Derivative Works" shall mean any work, whether in Source or Object
++ form, that is based on (or derived from) the Work and for which the
++ editorial revisions, annotations, elaborations, or other modifications
++ represent, as a whole, an original work of authorship. For the purposes
++ of this License, Derivative Works shall not include works that remain
++ separable from, or merely link (or bind by name) to the interfaces of,
++ the Work and Derivative Works thereof.
++
++ "Contribution" shall mean any work of authorship, including
++ the original version of the Work and any modifications or additions
++ to that Work or Derivative Works thereof, that is intentionally
++ submitted to Licensor for inclusion in the Work by the copyright owner
++ or by an individual or Legal Entity authorized to submit on behalf of
++ the copyright owner. For the purposes of this definition, "submitted"
++ means any form of electronic, verbal, or written communication sent
++ to the Licensor or its representatives, including but not limited to
++ communication on electronic mailing lists, source code control systems,
++ and issue tracking systems that are managed by, or on behalf of, the
++ Licensor for the purpose of discussing and improving the Work, but
++ excluding communication that is conspicuously marked or otherwise
++ designated in writing by the copyright owner as "Not a Contribution."
++
++ "Contributor" shall mean Licensor and any individual or Legal Entity
++ on behalf of whom a Contribution has been received by Licensor and
++ subsequently incorporated within the Work.
++
++ 2. Grant of Copyright License. Subject to the terms and conditions of
++ this License, each Contributor hereby grants to You a perpetual,
++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
++ copyright license to reproduce, prepare Derivative Works of,
++ publicly display, publicly perform, sublicense, and distribute the
++ Work and such Derivative Works in Source or Object form.
++
++ 3. Grant of Patent License. Subject to the terms and conditions of
++ this License, each Contributor hereby grants to You a perpetual,
++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
++ (except as stated in this section) patent license to make, have made,
++ use, offer to sell, sell, import, and otherwise transfer the Work,
++ where such license applies only to those patent claims licensable
++ by such Contributor that are necessarily infringed by their
++ Contribution(s) alone or by combination of their Contribution(s)
++ with the Work to which such Contribution(s) was submitted. If You
++ institute patent litigation against any entity (including a
++ cross-claim or counterclaim in a lawsuit) alleging that the Work
++ or a Contribution incorporated within the Work constitutes direct
++ or contributory patent infringement, then any patent licenses
++ granted to You under this License for that Work shall terminate
++ as of the date such litigation is filed.
++
++ 4. Redistribution. You may reproduce and distribute copies of the
++ Work or Derivative Works thereof in any medium, with or without
++ modifications, and in Source or Object form, provided that You
++ meet the following conditions:
++
++ (a) You must give any other recipients of the Work or
++ Derivative Works a copy of this License; and
++
++ (b) You must cause any modified files to carry prominent notices
++ stating that You changed the files; and
++
++ (c) You must retain, in the Source form of any Derivative Works
++ that You distribute, all copyright, patent, trademark, and
++ attribution notices from the Source form of the Work,
++ excluding those notices that do not pertain to any part of
++ the Derivative Works; and
++
++ (d) If the Work includes a "NOTICE" text file as part of its
++ distribution, then any Derivative Works that You distribute must
++ include a readable copy of the attribution notices contained
++ within such NOTICE file, excluding those notices that do not
++ pertain to any part of the Derivative Works, in at least one
++ of the following places: within a NOTICE text file distributed
++ as part of the Derivative Works; within the Source form or
++ documentation, if provided along with the Derivative Works; or,
++ within a display generated by the Derivative Works, if and
++ wherever such third-party notices normally appear. The contents
++ of the NOTICE file are for informational purposes only and
++ do not modify the License. You may add Your own attribution
++ notices within Derivative Works that You distribute, alongside
++ or as an addendum to the NOTICE text from the Work, provided
++ that such additional attribution notices cannot be construed
++ as modifying the License.
++
++ You may add Your own copyright statement to Your modifications and
++ may provide additional or different license terms and conditions
++ for use, reproduction, or distribution of Your modifications, or
++ for any such Derivative Works as a whole, provided Your use,
++ reproduction, and distribution of the Work otherwise complies with
++ the conditions stated in this License.
++
++ 5. Submission of Contributions. Unless You explicitly state otherwise,
++ any Contribution intentionally submitted for inclusion in the Work
++ by You to the Licensor shall be under the terms and conditions of
++ this License, without any additional terms or conditions.
++ Notwithstanding the above, nothing herein shall supersede or modify
++ the terms of any separate license agreement you may have executed
++ with Licensor regarding such Contributions.
++
++ 6. Trademarks. This License does not grant permission to use the trade
++ names, trademarks, service marks, or product names of the Licensor,
++ except as required for reasonable and customary use in describing the
++ origin of the Work and reproducing the content of the NOTICE file.
++
++ 7. Disclaimer of Warranty. Unless required by applicable law or
++ agreed to in writing, Licensor provides the Work (and each
++ Contributor provides its Contributions) on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
++ implied, including, without limitation, any warranties or conditions
++ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
++ PARTICULAR PURPOSE. You are solely responsible for determining the
++ appropriateness of using or redistributing the Work and assume any
++ risks associated with Your exercise of permissions under this License.
++
++ 8. Limitation of Liability. In no event and under no legal theory,
++ whether in tort (including negligence), contract, or otherwise,
++ unless required by applicable law (such as deliberate and grossly
++ negligent acts) or agreed to in writing, shall any Contributor be
++ liable to You for damages, including any direct, indirect, special,
++ incidental, or consequential damages of any character arising as a
++ result of this License or out of the use or inability to use the
++ Work (including but not limited to damages for loss of goodwill,
++ work stoppage, computer failure or malfunction, or any and all
++ other commercial damages or losses), even if such Contributor
++ has been advised of the possibility of such damages.
++
++ 9. Accepting Warranty or Additional Liability. While redistributing
++ the Work or Derivative Works thereof, You may choose to offer,
++ and charge a fee for, acceptance of support, warranty, indemnity,
++ or other liability obligations and/or rights consistent with this
++ License. However, in accepting such obligations, You may act only
++ on Your own behalf and on Your sole responsibility, not on behalf
++ of any other Contributor, and only if You agree to indemnify,
++ defend, and hold each Contributor harmless for any liability
++ incurred by, or claims asserted against, such Contributor by reason
++ of your accepting any such warranty or additional liability.
++
++ END OF TERMS AND CONDITIONS
+\ No newline at end of file
+diff --git a/commonlibrary/c_utils/README.md b/commonlibrary/c_utils/README.md
+new file mode 100644
+index 0000000..b291124
+--- /dev/null
++++ b/commonlibrary/c_utils/README.md
+@@ -0,0 +1,157 @@
++# commonlibrary/c_utils
++
++## Introduction
++
++The **commonlibrary/c_utils** repository provides the following commonly used C++ utility classes for standard system:
++
++- Enhanced APIs for operations related to files, paths, and strings
++- APIs related to the read-write lock, semaphore, timer, thread, and thread pool
++- APIs related to the security data container and data serialization
++- Error codes for each subsystem
++
++## Directory Structure
++
++```
++commonlibrary/c_utils
++└─ base
++ ├── include # Header files of APIs open to other subsystems
++ ├── src # Source files
++ └── test # Test code
++```
++## Condition
++Suitable for standard system.
++
++## Build
++### Build Component
++```
++./build.sh --product-name rk3568 --build-target c_utils
++```
++
++### Build Shared Library
++```
++./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base:utils
++```
++
++### Build Static Library
++```
++./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base:utilsbase
++```
++## Coding Directions
++### ashmem
++```
++sptr ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE);
++if (ashmem != nullptr) {
++ bool ret = ashmem->MapAshmem(PROT_READ | PROT_WRITE);
++}
++
++...
++
++// Do not forget to unmap & close ashmem at the end
++ashmem->UnmapAshmem();
++ashmem->CloseAshmem();
++```
++
++### parcel
++```
++// Write data into parcel in some order at writing port
++struct TestData {
++ bool booltest;
++ int8_t int8test;
++ int16_t int16test;
++ int32_t int32test;
++ uint8_t uint8test;
++ uint16_t uint16test;
++ uint32_t uint32test;
++};
++
++...
++
++Parcel parcel(nullptr);
++struct TestData data = { true, -0x34, 0x5634, -0x12345678, 0x34, 0x5634, 0x12345678 };
++bool result = false;
++
++result = parcel.WriteBool(data.booltest);
++if (!result) {
++ // Deal with writing failure
++}
++
++result = parcel.WriteInt8(data.int8test);
++if (!result) {
++ // Deal with writing failure
++}
++
++result = parcel.WriteInt16(data.int16test);
++if (!result) {
++ // Deal with writing failure
++}
++
++result = parcel.WriteInt32(data.int32test);
++if (!result) {
++ // Deal with writing failure
++}
++
++result = parcel.WriteUint8(data.uint8test);
++if (!result) {
++ // Deal with writing failure
++}
++
++result = parcel.WriteUint16(data.uint16test);
++if (!result) {
++ // Deal with writing failure
++}
++
++result = parcel.WriteUint32(data.uint32test);
++if (!result) {
++ // Deal with writing failure
++}
++```
++```
++// Read data with the order writing in at reading port
++bool readbool = parcel.ReadBool();
++
++int8_t readint8 = parcel.ReadInt8();
++
++int16_t readint16 = parcel.ReadInt16();
++
++int32_t readint32 = parcel.ReadInt32();
++
++uint8_t readuint8 = parcel.ReadUint8();
++
++uint16_t readuint16 = parcel.ReadUint16();
++
++uint32_t readuint32 = parcel.ReadUint32();
++```
++### refbase
++```
++class TestRefBase : public RefBase {
++...
++};
++...
++sptr test(new TestRefBase());
++...
++```
++### timer
++```
++void TimeOutCallback()
++{
++ ...
++}
++...
++Utils::Timer timer("test_timer");
++uint32_t ret = timer.Setup();
++timer.Register(TimeOutCallback, 1, true);
++std::this_thread::sleep_for(std::chrono::milliseconds(15));
++timer.Shutdown();
++```
++
++## Changelog
++**2022/10/10**
++1. Move this repository from utils/native to commonlibrary/c_utils.
++2. Switch component name from utils_base to c_utils.
++3. Securec is not in this repository any more. Please use [third_party_bounds_checking_function](https://gitee.com/openharmony/third_party_bounds_checking_function).
++## Repositories Involved
++
++**[commonlibrary\_c\_utils](https://gitee.com/openharmony/commonlibrary_c_utils)**
++
++[commonlibrary\_utils\_lite](https://gitee.com/openharmony/commonlibrary_utils_lite)
++
+diff --git a/commonlibrary/c_utils/README_zh.md b/commonlibrary/c_utils/README_zh.md
+new file mode 100644
+index 0000000..02a6cdb
+--- /dev/null
++++ b/commonlibrary/c_utils/README_zh.md
+@@ -0,0 +1,159 @@
++# C++公共基础库
++
++
++## 简介
++
++C++公共基础类库为标准系统提供了一些常用的C++开发工具类,包括:
++
++- 文件、路径、字符串相关操作的能力增强接口
++- 读写锁、信号量、定时器、线程增强及线程池等接口
++- 安全数据容器、数据序列化等接口
++- 各子系统的错误码相关定义
++
++## 目录
++
++```
++commonlibrary/c_utils
++└─ base
++ ├── include # 对各子系统开放的接口头文件
++ ├── src # 源文件
++ └── test # 测试代码
++```
++
++## 约束
++
++适用于标准系统。
++## 编译构建
++### 编译部件
++```
++./build.sh --product-name rk3568 --build-target c_utils
++```
++
++### 编译动态库
++```
++./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base:utils
++```
++
++### 编译静态库
++```
++./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base:utilsbase
++```
++## 使用说明
++### ashmem
++```
++sptr ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE);
++if (ashmem != nullptr) {
++ bool ret = ashmem->MapAshmem(PROT_READ | PROT_WRITE);
++}
++
++...
++
++// 当使用结束时不要忘记解映射和关闭ashmem
++ashmem->UnmapAshmem();
++ashmem->CloseAshmem();
++```
++
++### parcel
++```
++// 写入端以某种顺序写入数据
++struct TestData {
++ bool booltest;
++ int8_t int8test;
++ int16_t int16test;
++ int32_t int32test;
++ uint8_t uint8test;
++ uint16_t uint16test;
++ uint32_t uint32test;
++};
++
++...
++
++Parcel parcel(nullptr);
++struct TestData data = { true, -0x34, 0x5634, -0x12345678, 0x34, 0x5634, 0x12345678 };
++bool result = false;
++
++result = parcel.WriteBool(data.booltest);
++if (!result) {
++ // 写失败处理
++}
++
++result = parcel.WriteInt8(data.int8test);
++if (!result) {
++ // 写失败处理
++}
++
++result = parcel.WriteInt16(data.int16test);
++if (!result) {
++ // 写失败处理
++}
++
++result = parcel.WriteInt32(data.int32test);
++if (!result) {
++ // 写失败处理
++}
++
++result = parcel.WriteUint8(data.uint8test);
++if (!result) {
++ // 写失败处理
++}
++
++result = parcel.WriteUint16(data.uint16test);
++if (!result) {
++ // 写失败处理
++}
++
++result = parcel.WriteUint32(data.uint32test);
++if (!result) {
++ // 写失败处理
++}
++```
++```
++// 接收端根据写入端写入顺序读取数据
++bool readbool = parcel.ReadBool();
++
++int8_t readint8 = parcel.ReadInt8();
++
++int16_t readint16 = parcel.ReadInt16();
++
++int32_t readint32 = parcel.ReadInt32();
++
++uint8_t readuint8 = parcel.ReadUint8();
++
++uint16_t readuint16 = parcel.ReadUint16();
++
++uint32_t readuint32 = parcel.ReadUint32();
++```
++### refbase
++```
++class TestRefBase : public RefBase {
++...
++};
++...
++sptr test(new TestRefBase());
++...
++```
++### timer
++```
++void TimeOutCallback()
++{
++ ...
++}
++...
++Utils::Timer timer("test_timer");
++uint32_t ret = timer.Setup();
++timer.Register(TimeOutCallback, 1, true);
++std::this_thread::sleep_for(std::chrono::milliseconds(15));
++timer.Shutdown();
++```
++
++## Changelog
++**2022/10/10**
++1. 路径变更。由utils/native移动至commonlibrary/c_utils;
++2. 部件名变更。由utils_base变更为c_utils;
++3. 不再提供安全C库能力。请使用[third_party_bounds_checking_function](https://gitee.com/openharmony/third_party_bounds_checking_function)。
++## 相关仓
++
++**[commonlibrary\_c\_utils](https://gitee.com/openharmony/commonlibrary_c_utils)**
++
++[commonlibrary\_utils\_lite](https://gitee.com/openharmony/commonlibrary_utils_lite)
++
+diff --git a/commonlibrary/c_utils/base/BUILD.gn b/commonlibrary/c_utils/base/BUILD.gn
+new file mode 100644
+index 0000000..b89a67b
+--- /dev/null
++++ b/commonlibrary/c_utils/base/BUILD.gn
+@@ -0,0 +1,23 @@
++# Copyright (c) 2021 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++import("//build/ohos.gni")
++
++config("utils_all_dependent_configs") {
++ include_dirs = [ "include" ]
++ libs = ["utils.z"]
++}
++
++ohos_shared_library("utils") {
++ all_dependent_configs = [ ":utils_all_dependent_configs" ]
++}
++###############################################################################
+diff --git a/commonlibrary/c_utils/base/include b/commonlibrary/c_utils/base/include
+new file mode 120000
+index 0000000..6ed1680
+--- /dev/null
++++ b/commonlibrary/c_utils/base/include
+@@ -0,0 +1 @@
++/usr/include/c_utils
+\ No newline at end of file
+diff --git a/commonlibrary/c_utils/bundle.json b/commonlibrary/c_utils/bundle.json
+new file mode 100644
+index 0000000..664ed34
+--- /dev/null
++++ b/commonlibrary/c_utils/bundle.json
+@@ -0,0 +1,71 @@
++{
++ "name": "@openharmony/c_utils",
++ "version": "3.1.0",
++ "description": "c_utils",
++ "publishAs": "code-segment",
++ "segment": {
++ "destPath": "commonlibrary/c_utils"
++ },
++ "scripts": {
++ "install": "DEST_PATH=${DEP_BUNDLE_BASE}/commonlibrary/c_utils/base && mkdir -p $DEST_PATH && cp -r ./* $DEST_PATH"
++ },
++ "author": {},
++ "repository": "",
++ "license": "Apache License 2.0",
++ "component": {
++ "name": "c_utils",
++ "subsystem": "commonlibrary",
++ "adapted_system_type": [ "standard" ],
++ "deps": {
++ "components": [
++ "hilog_native"
++ ],
++ "third_party": []
++ },
++ "build": {
++ "sub_component": [
++ "//commonlibrary/c_utils/base:utils"
++ ],
++ "inner_kits": [
++ {
++ "name": "//commonlibrary/c_utils/base:utils",
++ "header": {
++ "header_files": [
++ "ashmem.h",
++ "common_errors.h",
++ "common_timer_errors.h",
++ "datetime_ex.h",
++ "directory_ex.h",
++ "errors.h",
++ "file_ex.h",
++ "flat_obj.h",
++ "nocopyable.h",
++ "observer.h",
++ "parcel.h",
++ "pubdef.h",
++ "refbase.h",
++ "rwlock.h",
++ "safe_block_queue.h",
++ "safe_map.h",
++ "safe_queue.h",
++ "securec.h",
++ "securectype.h",
++ "semaphore_ex.h",
++ "singleton.h",
++ "sorted_vector.h",
++ "string_ex.h",
++ "thread_ex.h",
++ "thread_pool.h",
++ "timer.h",
++ "unique_fd.h"
++ ],
++ "header_base": "//commonlibrary/c_utils/base/include"
++ }
++ }
++ ],
++ "test": [
++ "//commonlibrary/c_utils/base/test:unittest"
++ ]
++ }
++ }
++}
+diff --git a/customization/config_policy/.gitee/ISSUE_TEMPLATE.zh-CN.md b/customization/config_policy/.gitee/ISSUE_TEMPLATE.zh-CN.md
+new file mode 100644
+index 0000000..651e02c
+--- /dev/null
++++ b/customization/config_policy/.gitee/ISSUE_TEMPLATE.zh-CN.md
+@@ -0,0 +1,11 @@
++### 该问题是怎么引起的?
++
++
++
++### 重现步骤
++
++
++
++### 报错信息
++
++
+diff --git a/customization/config_policy/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/customization/config_policy/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
+new file mode 100644
+index 0000000..86dd358
+--- /dev/null
++++ b/customization/config_policy/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
+@@ -0,0 +1,12 @@
++### 相关的Issue
++
++
++### 原因(目的、解决的问题等)
++
++
++### 描述(做了什么,变更了什么)
++
++
++### 测试用例(新增、改动、可能影响的功能)
++
++
+diff --git a/customization/config_policy/BUILD.gn b/customization/config_policy/BUILD.gn
+new file mode 100644
+index 0000000..7f574fb
+--- /dev/null
++++ b/customization/config_policy/BUILD.gn
+@@ -0,0 +1,24 @@
++# Copyright (c) 2022-2023 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++import("//base/customization/config_policy/config_policy.gni")
++
++group("config_policy_components") {
++ if (os_level == "standard" && support_config_policy_napi) {
++ deps = [
++ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util",
++ ]
++ } else {
++ deps = [ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util" ]
++ }
++}
+diff --git a/customization/config_policy/LICENSE b/customization/config_policy/LICENSE
+new file mode 100644
+index 0000000..4947287
+--- /dev/null
++++ b/customization/config_policy/LICENSE
+@@ -0,0 +1,177 @@
++
++ Apache License
++ Version 2.0, January 2004
++ http://www.apache.org/licenses/
++
++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
++
++ 1. Definitions.
++
++ "License" shall mean the terms and conditions for use, reproduction,
++ and distribution as defined by Sections 1 through 9 of this document.
++
++ "Licensor" shall mean the copyright owner or entity authorized by
++ the copyright owner that is granting the License.
++
++ "Legal Entity" shall mean the union of the acting entity and all
++ other entities that control, are controlled by, or are under common
++ control with that entity. For the purposes of this definition,
++ "control" means (i) the power, direct or indirect, to cause the
++ direction or management of such entity, whether by contract or
++ otherwise, or (ii) ownership of fifty percent (50%) or more of the
++ outstanding shares, or (iii) beneficial ownership of such entity.
++
++ "You" (or "Your") shall mean an individual or Legal Entity
++ exercising permissions granted by this License.
++
++ "Source" form shall mean the preferred form for making modifications,
++ including but not limited to software source code, documentation
++ source, and configuration files.
++
++ "Object" form shall mean any form resulting from mechanical
++ transformation or translation of a Source form, including but
++ not limited to compiled object code, generated documentation,
++ and conversions to other media types.
++
++ "Work" shall mean the work of authorship, whether in Source or
++ Object form, made available under the License, as indicated by a
++ copyright notice that is included in or attached to the work
++ (an example is provided in the Appendix below).
++
++ "Derivative Works" shall mean any work, whether in Source or Object
++ form, that is based on (or derived from) the Work and for which the
++ editorial revisions, annotations, elaborations, or other modifications
++ represent, as a whole, an original work of authorship. For the purposes
++ of this License, Derivative Works shall not include works that remain
++ separable from, or merely link (or bind by name) to the interfaces of,
++ the Work and Derivative Works thereof.
++
++ "Contribution" shall mean any work of authorship, including
++ the original version of the Work and any modifications or additions
++ to that Work or Derivative Works thereof, that is intentionally
++ submitted to Licensor for inclusion in the Work by the copyright owner
++ or by an individual or Legal Entity authorized to submit on behalf of
++ the copyright owner. For the purposes of this definition, "submitted"
++ means any form of electronic, verbal, or written communication sent
++ to the Licensor or its representatives, including but not limited to
++ communication on electronic mailing lists, source code control systems,
++ and issue tracking systems that are managed by, or on behalf of, the
++ Licensor for the purpose of discussing and improving the Work, but
++ excluding communication that is conspicuously marked or otherwise
++ designated in writing by the copyright owner as "Not a Contribution."
++
++ "Contributor" shall mean Licensor and any individual or Legal Entity
++ on behalf of whom a Contribution has been received by Licensor and
++ subsequently incorporated within the Work.
++
++ 2. Grant of Copyright License. Subject to the terms and conditions of
++ this License, each Contributor hereby grants to You a perpetual,
++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
++ copyright license to reproduce, prepare Derivative Works of,
++ publicly display, publicly perform, sublicense, and distribute the
++ Work and such Derivative Works in Source or Object form.
++
++ 3. Grant of Patent License. Subject to the terms and conditions of
++ this License, each Contributor hereby grants to You a perpetual,
++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
++ (except as stated in this section) patent license to make, have made,
++ use, offer to sell, sell, import, and otherwise transfer the Work,
++ where such license applies only to those patent claims licensable
++ by such Contributor that are necessarily infringed by their
++ Contribution(s) alone or by combination of their Contribution(s)
++ with the Work to which such Contribution(s) was submitted. If You
++ institute patent litigation against any entity (including a
++ cross-claim or counterclaim in a lawsuit) alleging that the Work
++ or a Contribution incorporated within the Work constitutes direct
++ or contributory patent infringement, then any patent licenses
++ granted to You under this License for that Work shall terminate
++ as of the date such litigation is filed.
++
++ 4. Redistribution. You may reproduce and distribute copies of the
++ Work or Derivative Works thereof in any medium, with or without
++ modifications, and in Source or Object form, provided that You
++ meet the following conditions:
++
++ (a) You must give any other recipients of the Work or
++ Derivative Works a copy of this License; and
++
++ (b) You must cause any modified files to carry prominent notices
++ stating that You changed the files; and
++
++ (c) You must retain, in the Source form of any Derivative Works
++ that You distribute, all copyright, patent, trademark, and
++ attribution notices from the Source form of the Work,
++ excluding those notices that do not pertain to any part of
++ the Derivative Works; and
++
++ (d) If the Work includes a "NOTICE" text file as part of its
++ distribution, then any Derivative Works that You distribute must
++ include a readable copy of the attribution notices contained
++ within such NOTICE file, excluding those notices that do not
++ pertain to any part of the Derivative Works, in at least one
++ of the following places: within a NOTICE text file distributed
++ as part of the Derivative Works; within the Source form or
++ documentation, if provided along with the Derivative Works; or,
++ within a display generated by the Derivative Works, if and
++ wherever such third-party notices normally appear. The contents
++ of the NOTICE file are for informational purposes only and
++ do not modify the License. You may add Your own attribution
++ notices within Derivative Works that You distribute, alongside
++ or as an addendum to the NOTICE text from the Work, provided
++ that such additional attribution notices cannot be construed
++ as modifying the License.
++
++ You may add Your own copyright statement to Your modifications and
++ may provide additional or different license terms and conditions
++ for use, reproduction, or distribution of Your modifications, or
++ for any such Derivative Works as a whole, provided Your use,
++ reproduction, and distribution of the Work otherwise complies with
++ the conditions stated in this License.
++
++ 5. Submission of Contributions. Unless You explicitly state otherwise,
++ any Contribution intentionally submitted for inclusion in the Work
++ by You to the Licensor shall be under the terms and conditions of
++ this License, without any additional terms or conditions.
++ Notwithstanding the above, nothing herein shall supersede or modify
++ the terms of any separate license agreement you may have executed
++ with Licensor regarding such Contributions.
++
++ 6. Trademarks. This License does not grant permission to use the trade
++ names, trademarks, service marks, or product names of the Licensor,
++ except as required for reasonable and customary use in describing the
++ origin of the Work and reproducing the content of the NOTICE file.
++
++ 7. Disclaimer of Warranty. Unless required by applicable law or
++ agreed to in writing, Licensor provides the Work (and each
++ Contributor provides its Contributions) on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
++ implied, including, without limitation, any warranties or conditions
++ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
++ PARTICULAR PURPOSE. You are solely responsible for determining the
++ appropriateness of using or redistributing the Work and assume any
++ risks associated with Your exercise of permissions under this License.
++
++ 8. Limitation of Liability. In no event and under no legal theory,
++ whether in tort (including negligence), contract, or otherwise,
++ unless required by applicable law (such as deliberate and grossly
++ negligent acts) or agreed to in writing, shall any Contributor be
++ liable to You for damages, including any direct, indirect, special,
++ incidental, or consequential damages of any character arising as a
++ result of this License or out of the use or inability to use the
++ Work (including but not limited to damages for loss of goodwill,
++ work stoppage, computer failure or malfunction, or any and all
++ other commercial damages or losses), even if such Contributor
++ has been advised of the possibility of such damages.
++
++ 9. Accepting Warranty or Additional Liability. While redistributing
++ the Work or Derivative Works thereof, You may choose to offer,
++ and charge a fee for, acceptance of support, warranty, indemnity,
++ or other liability obligations and/or rights consistent with this
++ License. However, in accepting such obligations, You may act only
++ on Your own behalf and on Your sole responsibility, not on behalf
++ of any other Contributor, and only if You agree to indemnify,
++ defend, and hold each Contributor harmless for any liability
++ incurred by, or claims asserted against, such Contributor by reason
++ of your accepting any such warranty or additional liability.
++
++ END OF TERMS AND CONDITIONS
+\ No newline at end of file
+diff --git a/customization/config_policy/README.md b/customization/config_policy/README.md
+new file mode 100644
+index 0000000..79663ff
+--- /dev/null
++++ b/customization/config_policy/README.md
+@@ -0,0 +1,42 @@
++# Config Policy
++
++## Introduction
++
++The config policy, namely, cust, provides APIs for each service module to obtain the configuration directories at different levels or the configuration file paths.
++
++## Directory Structure
++
++The directory structure for the config policy is as follows:
++
++```
++/base/customization/
++├── config_policy # Code repository for the config policy
++│ ├── frameworks # Core code of the config policy
++│ │ ├── config_policy # config policy
++│ │ │ └── src # Implementation code
++│ ├── interfaces # APIs of the config policy
++│ │ ├── inner_api # APIs of the config policy for internal subsystems
++│ │ └── kits # JavaScript APIs
++│ └── test # Test code
++```
++
++## Usage
++
++Call the APIs of the config policy to obtain the configuration directories at different levels or the configuration file paths.
++
++```
++#include "config_policy_utils.h"
++
++const char *testPathSuffix = "user.xml"; // Set the name of the configuration file.
++char buf[MAX_PATH_LEN] = {0};
++char *filePath = GetOneCfgFile(testPathSuffix, buf, MAX_PATH_LEN); // Obtain the path of the configuration file with the highest priority.
++```
++
++## Constraints
++
++**Programming language**: C/C++
++
++## Repositories Involved
++
++**customization\_config\_policy**
++
+diff --git a/customization/config_policy/README_zh.md b/customization/config_policy/README_zh.md
+new file mode 100644
+index 0000000..ae7d939
+--- /dev/null
++++ b/customization/config_policy/README_zh.md
+@@ -0,0 +1,53 @@
++# 配置策略组件介绍
++
++## 简介
++
++配置策略组件为各业务模块提供获取各配置层级的配置目录或配置文件路径的接口。
++
++## 系统架构
++
++**图 1** 配置策略组件架构图
++
++
++
++配置策略组件架构图说明:
++
++- interfaces对外提供指定文件的最高优先级文件路径以及指定文件所有层级路径。
++- frameworks实现配置层级目录的初始化与文件路径查询。
++
++## 目录
++
++配置策略组件源代码目录结构如下所示:
++
++```
++/base/customization/
++├── config_policy # 配置策略代码仓
++│ ├── frameworks # 配置策略核心代码
++│ │ ├── config_policy # 配置策略模块
++│ │ │ └── src # 实现代码
++│ ├── interfaces # 配置策略接口
++│ │ ├── inner_api # 子系统间接口
++│ │ └── kits # 配置策略JavaScript接口
++│ └── test # 测试代码
++```
++
++## 说明
++
++调用该组件中的接口获取各配置层级的配置目录或配置文件路径。
++
++```
++#include "config_policy_utils.h"
++
++const char *testPathSuffix = "user.xml"; //设置配置文件名称
++char buf[MAX_PATH_LEN] = {0};
++char *filePath = GetOneCfgFile(testPathSuffix, buf, MAX_PATH_LEN); //获取最高优先级的配置文件路径
++```
++
++## 约束
++
++**语言限制**:C/C++语言
++
++## 相关仓
++
++**customization\_config\_policy**
++
+diff --git a/customization/config_policy/bundle.json b/customization/config_policy/bundle.json
+new file mode 100644
+index 0000000..380e9d0
+--- /dev/null
++++ b/customization/config_policy/bundle.json
+@@ -0,0 +1,55 @@
++{
++ "name": "@ohos/customization_config_policy",
++ "description": "The customization framework, namely, cust, provides APIs for each service module to obtain the configuration directories at different levels or the configuration file paths.",
++ "version": "3.1",
++ "license": "Apache License 2.0",
++ "publishAs": "code-segment",
++ "segment": {
++ "destPath": "base/customization/config_policy"
++ },
++ "dirs": {},
++ "scripts": {},
++ "component": {
++ "name": "config_policy",
++ "subsystem": "customization",
++ "syscap": [ "SystemCapability.Customization.ConfigPolicy" ],
++ "features": [],
++ "adapted_system_type": [ "standard", "small" ],
++ "hisysevent_config": [
++ "//base/customization/config_policy/frameworks/dfx/hisysevent.yaml"
++ ],
++ "rom": "",
++ "ram": "",
++ "deps": {
++ "components": [
++ "common",
++ "hisysevent_native",
++ "hiviewdfx_hilog_native",
++ "napi",
++ "init"
++ ],
++ "third_party": [
++ "bounds_checking_function"
++ ]
++ },
++ "build": {
++ "sub_component": [
++ "//base/customization/config_policy:config_policy_components"
++ ],
++ "inner_kits": [
++ {
++ "header": {
++ "header_base": "//base/customization/config_policy/interfaces/inner_api/include",
++ "header_files": [
++ "config_policy_utils.h"
++ ]
++ },
++ "name": "//base/customization/config_policy/frameworks/config_policy:configpolicy_util"
++ }
++ ],
++ "test": [
++ "//base/customization/config_policy/test/unittest:ConfigPolicyUtilsTest"
++ ]
++ }
++ }
++}
+diff --git a/customization/config_policy/config_policy.gni b/customization/config_policy/config_policy.gni
+new file mode 100644
+index 0000000..1d0388e
+--- /dev/null
++++ b/customization/config_policy/config_policy.gni
+@@ -0,0 +1,20 @@
++# Copyright (c) 2023 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++declare_args() {
++ # if fs has prefix before OH path, set it here
++ config_policy_fs_prefix = ""
++
++ # Whether support napi so
++ support_config_policy_napi = false
++}
+diff --git a/customization/config_policy/frameworks/config_policy/BUILD.gn b/customization/config_policy/frameworks/config_policy/BUILD.gn
+new file mode 100644
+index 0000000..443e068
+--- /dev/null
++++ b/customization/config_policy/frameworks/config_policy/BUILD.gn
+@@ -0,0 +1,30 @@
++# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++import("//base/customization/config_policy/config_policy.gni")
++if (defined(ohos_lite)) {
++ import("//build/lite/config/component/lite_component.gni")
++} else {
++ import("//build/ohos.gni")
++}
++
++config("config_policy_config") {
++ include_dirs = [ "include" ]
++ libs = [ "configpolicy_util.z" ]
++}
++
++ohos_shared_library("configpolicy_util") {
++ all_dependent_configs = [ ":config_policy_config" ]
++ subsystem_name = "customization"
++ part_name = "config_policy"
++}
+diff --git a/customization/config_policy/frameworks/config_policy/etc/BUILD.gn b/customization/config_policy/frameworks/config_policy/etc/BUILD.gn
+new file mode 100644
+index 0000000..73c9d6f
+--- /dev/null
++++ b/customization/config_policy/frameworks/config_policy/etc/BUILD.gn
+@@ -0,0 +1,25 @@
++# Copyright (c) 2022 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++import("//build/ohos.gni")
++
++group("customization_etc") {
++ deps = [ ":customization.para.dac" ]
++}
++
++ohos_prebuilt_etc("customization.para.dac") {
++ source = "customization.para.dac"
++ module_install_dir = "etc/param"
++ subsystem_name = "customization"
++ part_name = "config_policy"
++}
+diff --git a/customization/config_policy/frameworks/config_policy/etc/customization.para.dac b/customization/config_policy/frameworks/config_policy/etc/customization.para.dac
+new file mode 100644
+index 0000000..823c6fb
+--- /dev/null
++++ b/customization/config_policy/frameworks/config_policy/etc/customization.para.dac
+@@ -0,0 +1,15 @@
++# Copyright (c) 2022 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++const.cust.="root:root:774"
++
+diff --git a/customization/config_policy/frameworks/dfx/hisysevent.yaml b/customization/config_policy/frameworks/dfx/hisysevent.yaml
+new file mode 100644
+index 0000000..200d9e0
+--- /dev/null
++++ b/customization/config_policy/frameworks/dfx/hisysevent.yaml
+@@ -0,0 +1,27 @@
++# Copyright (c) 2022 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++domain: CUST_CONFIG
++
++# config_policy failed event
++
++CONFIG_POLICY_FAILED:
++ __BASE: {type: FAULT, level: CRITICAL, tag: cfgFail, desc: config policy failed}
++ APINAME: {type: STRING, desc: api name}
++ MSG: {type: STRING, desc: error message}
++
++# config_policy statistic event
++
++CONFIG_POLICY_EVENT:
++ __BASE: {type: STATISTIC, level: MINOR, tag: cfgEvent, desc: get config policy func}
++ APINAME: {type: STRING, desc: api name}
+diff --git a/customization/config_policy/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.cpp b/customization/config_policy/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.cpp
+new file mode 100644
+index 0000000..bd84ab0
+--- /dev/null
++++ b/customization/config_policy/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.cpp
+@@ -0,0 +1,46 @@
++/*
++ * Copyright (c) 2022 Huawei Device Co., Ltd.
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++#include "hisysevent_adapter.h"
++
++// #include "hisysevent.h"
++#include "hilog/log.h"
++
++namespace OHOS {
++namespace Customization {
++namespace ConfigPolicy {
++using namespace OHOS::HiviewDFX;
++static constexpr HiLogLabel LABEL = { LOG_CORE, 0xD001E00, "ReportConfigPolicyEvent" };
++// const std::string DOMAIN_STR = std::string(HiSysEvent::Domain::CUSTOMIZATION_CONFIG);
++
++void ReportConfigPolicyEvent(ReportType reportType, const std::string &apiName, const std::string &msgInfo)
++{
++ return;
++ // int ret;
++ // if (reportType == ReportType::CONFIG_POLICY_FAILED) {
++ // ret = HiSysEvent::Write(DOMAIN_STR, "CONFIG_POLICY_FAILED", HiSysEvent::EventType::FAULT, "APINAME", apiName,
++ // "MSG", msgInfo);
++ // } else {
++ // ret =
++ // HiSysEvent::Write(DOMAIN_STR, "CONFIG_POLICY_EVENT", HiSysEvent::EventType::STATISTIC, "APINAME", apiName);
++ // }
++
++ // if (ret != 0) {
++ // HiLog::Error(LABEL, "hisysevent write failed! ret %{public}d, apiName %{public}s, errMsg %{public}s", ret,
++ // apiName.c_str(), msgInfo.c_str());
++ // }
++}
++} // namespace ConfigPolicy
++} // namespace Customization
++} // namespace OHOS
+diff --git a/customization/config_policy/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.h b/customization/config_policy/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.h
+new file mode 100644
+index 0000000..ec9a1a2
+--- /dev/null
++++ b/customization/config_policy/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.h
+@@ -0,0 +1,32 @@
++/*
++ * Copyright (c) 2022 Huawei Device Co., Ltd.
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef OHOS_CONFIG_POLICY_DFX_HISYSEVENT_ADAPTER_H
++#define OHOS_CONFIG_POLICY_DFX_HISYSEVENT_ADAPTER_H
++
++#include
++
++namespace OHOS {
++namespace Customization {
++namespace ConfigPolicy {
++enum class ReportType {
++ CONFIG_POLICY_FAILED = 0,
++ CONFIG_POLICY_EVENT,
++};
++void ReportConfigPolicyEvent(ReportType reportType, const std::string &apiName, const std::string &msgInfo);
++} // namespace ConfigPolicy
++} // namespace Customization
++} // namespace OHOS
++#endif // OHOS_CONFIG_POLICY_DFX_HISYSEVENT_ADAPTER_H
+diff --git a/customization/config_policy/interfaces/inner_api/include b/customization/config_policy/interfaces/inner_api/include
+new file mode 120000
+index 0000000..170f6ab
+--- /dev/null
++++ b/customization/config_policy/interfaces/inner_api/include
+@@ -0,0 +1 @@
++/usr/include/config_policy
+\ No newline at end of file
+diff --git a/notification/eventhandler/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/notification/eventhandler/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
+new file mode 100644
+index 0000000..382a0ba
+--- /dev/null
++++ b/notification/eventhandler/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
+@@ -0,0 +1,7 @@
++**IssueNo**:
++**Description**:
++**Sig**: SIG_BscSoftSrv
++**Feature or Bugfix**:
++**Binary Source**:
++**TDD Result**:
++**XTS Result**:
+\ No newline at end of file
+diff --git a/notification/eventhandler/LICENSE b/notification/eventhandler/LICENSE
+new file mode 100644
+index 0000000..4a45986
+--- /dev/null
++++ b/notification/eventhandler/LICENSE
+@@ -0,0 +1,177 @@
++
++ Apache License
++ Version 2.0, January 2004
++ http://www.apache.org/licenses/
++
++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
++
++ 1. Definitions.
++
++ "License" shall mean the terms and conditions for use, reproduction,
++ and distribution as defined by Sections 1 through 9 of this document.
++
++ "Licensor" shall mean the copyright owner or entity authorized by
++ the copyright owner that is granting the License.
++
++ "Legal Entity" shall mean the union of the acting entity and all
++ other entities that control, are controlled by, or are under common
++ control with that entity. For the purposes of this definition,
++ "control" means (i) the power, direct or indirect, to cause the
++ direction or management of such entity, whether by contract or
++ otherwise, or (ii) ownership of fifty percent (50%) or more of the
++ outstanding shares, or (iii) beneficial ownership of such entity.
++
++ "You" (or "Your") shall mean an individual or Legal Entity
++ exercising permissions granted by this License.
++
++ "Source" form shall mean the preferred form for making modifications,
++ including but not limited to software source code, documentation
++ source, and configuration files.
++
++ "Object" form shall mean any form resulting from mechanical
++ transformation or translation of a Source form, including but
++ not limited to compiled object code, generated documentation,
++ and conversions to other media types.
++
++ "Work" shall mean the work of authorship, whether in Source or
++ Object form, made available under the License, as indicated by a
++ copyright notice that is included in or attached to the work
++ (an example is provided in the Appendix below).
++
++ "Derivative Works" shall mean any work, whether in Source or Object
++ form, that is based on (or derived from) the Work and for which the
++ editorial revisions, annotations, elaborations, or other modifications
++ represent, as a whole, an original work of authorship. For the purposes
++ of this License, Derivative Works shall not include works that remain
++ separable from, or merely link (or bind by name) to the interfaces of,
++ the Work and Derivative Works thereof.
++
++ "Contribution" shall mean any work of authorship, including
++ the original version of the Work and any modifications or additions
++ to that Work or Derivative Works thereof, that is intentionally
++ submitted to Licensor for inclusion in the Work by the copyright owner
++ or by an individual or Legal Entity authorized to submit on behalf of
++ the copyright owner. For the purposes of this definition, "submitted"
++ means any form of electronic, verbal, or written communication sent
++ to the Licensor or its representatives, including but not limited to
++ communication on electronic mailing lists, source code control systems,
++ and issue tracking systems that are managed by, or on behalf of, the
++ Licensor for the purpose of discussing and improving the Work, but
++ excluding communication that is conspicuously marked or otherwise
++ designated in writing by the copyright owner as "Not a Contribution."
++
++ "Contributor" shall mean Licensor and any individual or Legal Entity
++ on behalf of whom a Contribution has been received by Licensor and
++ subsequently incorporated within the Work.
++
++ 2. Grant of Copyright License. Subject to the terms and conditions of
++ this License, each Contributor hereby grants to You a perpetual,
++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
++ copyright license to reproduce, prepare Derivative Works of,
++ publicly display, publicly perform, sublicense, and distribute the
++ Work and such Derivative Works in Source or Object form.
++
++ 3. Grant of Patent License. Subject to the terms and conditions of
++ this License, each Contributor hereby grants to You a perpetual,
++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
++ (except as stated in this section) patent license to make, have made,
++ use, offer to sell, sell, import, and otherwise transfer the Work,
++ where such license applies only to those patent claims licensable
++ by such Contributor that are necessarily infringed by their
++ Contribution(s) alone or by combination of their Contribution(s)
++ with the Work to which such Contribution(s) was submitted. If You
++ institute patent litigation against any entity (including a
++ cross-claim or counterclaim in a lawsuit) alleging that the Work
++ or a Contribution incorporated within the Work constitutes direct
++ or contributory patent infringement, then any patent licenses
++ granted to You under this License for that Work shall terminate
++ as of the date such litigation is filed.
++
++ 4. Redistribution. You may reproduce and distribute copies of the
++ Work or Derivative Works thereof in any medium, with or without
++ modifications, and in Source or Object form, provided that You
++ meet the following conditions:
++
++ (a) You must give any other recipients of the Work or
++ Derivative Works a copy of this License; and
++
++ (b) You must cause any modified files to carry prominent notices
++ stating that You changed the files; and
++
++ (c) You must retain, in the Source form of any Derivative Works
++ that You distribute, all copyright, patent, trademark, and
++ attribution notices from the Source form of the Work,
++ excluding those notices that do not pertain to any part of
++ the Derivative Works; and
++
++ (d) If the Work includes a "NOTICE" text file as part of its
++ distribution, then any Derivative Works that You distribute must
++ include a readable copy of the attribution notices contained
++ within such NOTICE file, excluding those notices that do not
++ pertain to any part of the Derivative Works, in at least one
++ of the following places: within a NOTICE text file distributed
++ as part of the Derivative Works; within the Source form or
++ documentation, if provided along with the Derivative Works; or,
++ within a display generated by the Derivative Works, if and
++ wherever such third-party notices normally appear. The contents
++ of the NOTICE file are for informational purposes only and
++ do not modify the License. You may add Your own attribution
++ notices within Derivative Works that You distribute, alongside
++ or as an addendum to the NOTICE text from the Work, provided
++ that such additional attribution notices cannot be construed
++ as modifying the License.
++
++ You may add Your own copyright statement to Your modifications and
++ may provide additional or different license terms and conditions
++ for use, reproduction, or distribution of Your modifications, or
++ for any such Derivative Works as a whole, provided Your use,
++ reproduction, and distribution of the Work otherwise complies with
++ the conditions stated in this License.
++
++ 5. Submission of Contributions. Unless You explicitly state otherwise,
++ any Contribution intentionally submitted for inclusion in the Work
++ by You to the Licensor shall be under the terms and conditions of
++ this License, without any additional terms or conditions.
++ Notwithstanding the above, nothing herein shall supersede or modify
++ the terms of any separate license agreement you may have executed
++ with Licensor regarding such Contributions.
++
++ 6. Trademarks. This License does not grant permission to use the trade
++ names, trademarks, service marks, or product names of the Licensor,
++ except as required for reasonable and customary use in describing the
++ origin of the Work and reproducing the content of the NOTICE file.
++
++ 7. Disclaimer of Warranty. Unless required by applicable law or
++ agreed to in writing, Licensor provides the Work (and each
++ Contributor provides its Contributions) on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
++ implied, including, without limitation, any warranties or conditions
++ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
++ PARTICULAR PURPOSE. You are solely responsible for determining the
++ appropriateness of using or redistributing the Work and assume any
++ risks associated with Your exercise of permissions under this License.
++
++ 8. Limitation of Liability. In no event and under no legal theory,
++ whether in tort (including negligence), contract, or otherwise,
++ unless required by applicable law (such as deliberate and grossly
++ negligent acts) or agreed to in writing, shall any Contributor be
++ liable to You for damages, including any direct, indirect, special,
++ incidental, or consequential damages of any character arising as a
++ result of this License or out of the use or inability to use the
++ Work (including but not limited to damages for loss of goodwill,
++ work stoppage, computer failure or malfunction, or any and all
++ other commercial damages or losses), even if such Contributor
++ has been advised of the possibility of such damages.
++
++ 9. Accepting Warranty or Additional Liability. While redistributing
++ the Work or Derivative Works thereof, You may choose to offer,
++ and charge a fee for, acceptance of support, warranty, indemnity,
++ or other liability obligations and/or rights consistent with this
++ License. However, in accepting such obligations, You may act only
++ on Your own behalf and on Your sole responsibility, not on behalf
++ of any other Contributor, and only if You agree to indemnify,
++ defend, and hold each Contributor harmless for any liability
++ incurred by, or claims asserted against, such Contributor by reason
++ of your accepting any such warranty or additional liability.
++
++ END OF TERMS AND CONDITIONS
+\ No newline at end of file
+diff --git a/notification/eventhandler/OAT.xml b/notification/eventhandler/OAT.xml
+new file mode 100644
+index 0000000..a19c53c
+--- /dev/null
++++ b/notification/eventhandler/OAT.xml
+@@ -0,0 +1,69 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff --git a/notification/eventhandler/README_en.md b/notification/eventhandler/README_en.md
+new file mode 100644
+index 0000000..0b46588
+--- /dev/null
++++ b/notification/eventhandler/README_en.md
+@@ -0,0 +1,36 @@
++# eventhandler
++
++#### Description
++{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
++
++#### Software Architecture
++Software architecture description
++
++#### Installation
++
++1. xxxx
++2. xxxx
++3. xxxx
++
++#### Instructions
++
++1. xxxx
++2. xxxx
++3. xxxx
++
++#### Contribution
++
++1. Fork the repository
++2. Create Feat_xxx branch
++3. Commit your code
++4. Create Pull Request
++
++
++#### Gitee Feature
++
++1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
++2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
++3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
++4. The most valuable open source project [GVP](https://gitee.com/gvp)
++5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
++6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
+diff --git a/notification/eventhandler/README_zh.md b/notification/eventhandler/README_zh.md
+new file mode 100644
+index 0000000..4fba5bd
+--- /dev/null
++++ b/notification/eventhandler/README_zh.md
+@@ -0,0 +1,57 @@
++# Eventhandler部件
++
++## 简介
++ EventHandler提供了OpenHarmony线程间通信的基本能力,可以通过EventRunner创建新线程,将耗时的操作抛到新线程上执行,从而实现在不阻塞原来的线程的基础上合理地处理耗时任务。
++
++ EventHandler主要包括如下核心类:
++
++| 类 | 功能介绍 |
++| ------------ | ------------------------------------------------------------ |
++| EventRunner | 消息队列的循环分发器,每个线程只有一个EventRunner,主要用于管理消息队列EventQueue,不断地从队列中取出InnerEvent分发至对应的EventHandler处理。 |
++| InnerEvent | 线程之间消息传递的实体封装,EventHandler接收与处理的消息对象。EventHandler待处理的InnerEvent的优先级可在IMMEDIATE、HIGH、LOW、IDLE中选择,并设置合适的delayTime。 |
++| EventHandler | 发送和处理消息的核心类,通过绑定一个EventRunner实现对消息队列进行循环分发的功能。 |
++| EventQueue | 线程消息队列,管理InnerEvent,在初始化EventRunner对象时需要创建一个与之关联的EventQueue。 |
++
++
++### 架构图
++
++**图1** 子系统架构图
++
++
++
++
++
++## 目录
++
++```
++base/notification/eventhandler
++├── interfaces
++│ ├── inner_api # 内部接口存放目录
++│ └── kits # 外部接口存放目录
++│ └── native # C/C++接口
++├── frameworks # 包管理服务框架代码
++│ ├── eventhandler # 内部实现存放目录
++│ ├── napi # js接口实现存放目录
++│ └── native # C/C++接口实现存放目录
++└── test # 测试目录
++```
++
++
++
++## 编译构建
++
++ ./build.sh --product-name xxxx --build-target eventhandler
++
++
++
++## 接口说明
++
++详见[API接口说明文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-emitter.md)。
++
++
++
++## 相关仓
++
++[HiTrace组件](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/README_zh.md)
++
++[HiChecker组件](https://gitee.com/openharmony/hiviewdfx_hichecker/blob/master/README_zh.md)
+\ No newline at end of file
+diff --git a/notification/eventhandler/bundle.json b/notification/eventhandler/bundle.json
+new file mode 100644
+index 0000000..904cd7c
+--- /dev/null
++++ b/notification/eventhandler/bundle.json
+@@ -0,0 +1,77 @@
++{
++ "name": "@ohos/eventhandler",
++ "description": "事件处理服务",
++ "version": "3.1",
++ "license": "Apache 2.0",
++ "segment": {
++ "destPath": "base/notification/eventhandler/frameworks/eventhandler"
++ },
++ "component": {
++ "name": "eventhandler",
++ "subsystem": "notification",
++ "syscap": [
++ "SystemCapability.Notification.Emitter"
++ ],
++ "features": [],
++ "adapted_system_type": [
++ "standard"
++ ],
++ "rom": "500KB",
++ "ram": "1000KB",
++ "deps": {
++ "components": [
++ "hitrace_native",
++ "hiviewdfx_hilog_native",
++ "hichecker_native"
++ ],
++ "third_party": []
++ },
++ "build": {
++ "group_type": {
++ "base_group": [
++
++ ],
++ "fwk_group": [
++ "//base/notification/eventhandler/frameworks/eventhandler:libeventhandler",
++ "//base/notification/eventhandler/frameworks:eventhandler_native_target",
++ "//base/notification/eventhandler/frameworks:napi_packages"
++ ],
++ "service_group": [
++
++ ]
++ },
++ "inner_kits": [
++ {
++ "header": {
++ "header_base": "//base/notification/eventhandler/interfaces/inner_api",
++ "header_files": [
++ "event_handler_errors.h",
++ "event_handler.h",
++ "event_queue.h",
++ "event_runner.h",
++ "inner_event.h",
++ "file_descriptor_listener.h",
++ "native_implement_eventhandler.h"
++ ]
++ },
++ "name": "//base/notification/eventhandler/frameworks/eventhandler:libeventhandler"
++ },
++ {
++ "header": {
++ "header_base": "//base/notification/eventhandler/interfaces/kits/native",
++ "header_files": [
++ "native_interface_eventhandler.h"
++ ]
++ },
++ "name": "//base/notification/eventhandler/frameworks/native:eventhandler_native"
++ }
++ ],
++ "test": [
++ "//base/notification/eventhandler/frameworks/eventhandler/test:unittest",
++ "//base/notification/eventhandler/frameworks/test/moduletest:moduletest",
++ "//base/notification/eventhandler/test/fuzztest:fuzztest",
++ "//base/notification/eventhandler/test/systemtest:systemtest"
++ ]
++ }
++ }
++}
+diff --git a/notification/eventhandler/eventhandler.gni b/notification/eventhandler/eventhandler.gni
+new file mode 100644
+index 0000000..4a248ed
+--- /dev/null
++++ b/notification/eventhandler/eventhandler.gni
+@@ -0,0 +1,23 @@
++# Copyright (c) 2022 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++frameworks_path = "//base/notification/eventhandler/frameworks"
++inner_api_path = "//base/notification/eventhandler/interfaces/inner_api"
++kits_path = "//base/notification/eventhandler/interfaces/kits"
++
++if (!defined(global_parts_info) ||
++ defined(global_parts_info.hiviewdfx_hichecker_native)) {
++ has_hichecker_native_part = true
++} else {
++ has_hichecker_native_part = false
++}
+diff --git a/notification/eventhandler/frameworks/BUILD.gn b/notification/eventhandler/frameworks/BUILD.gn
+new file mode 100644
+index 0000000..6e381e5
+--- /dev/null
++++ b/notification/eventhandler/frameworks/BUILD.gn
+@@ -0,0 +1,23 @@
++# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++group("napi_packages") {
++ deps = []
++ if (support_jsapi) {
++ deps += [ "napi:emitter" ]
++ }
++}
++
++group("eventhandler_native_target") {
++ deps = [ "native:eventhandler_native" ]
++}
+diff --git a/notification/eventhandler/frameworks/eventhandler/BUILD.gn b/notification/eventhandler/frameworks/eventhandler/BUILD.gn
+new file mode 100644
+index 0000000..41098b2
+--- /dev/null
++++ b/notification/eventhandler/frameworks/eventhandler/BUILD.gn
+@@ -0,0 +1,27 @@
++# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++import("//build/ohos.gni")
++import("../../eventhandler.gni")
++import("inner_api_sources.gni")
++
++config("libeventhandler_config") {
++ include_dirs = [ "include" ]
++ libs = [ "eventhandler.z" ]
++}
++
++ohos_shared_library("libeventhandler") {
++ all_dependent_configs = [ ":libeventhandler_config" ]
++ subsystem_name = "notification"
++ part_name = "eventhandler"
++}
+diff --git a/notification/eventhandler/frameworks/eventhandler/include/epoll_io_waiter.h b/notification/eventhandler/frameworks/eventhandler/include/epoll_io_waiter.h
+new file mode 100644
+index 0000000..73150db
+--- /dev/null
++++ b/notification/eventhandler/frameworks/eventhandler/include/epoll_io_waiter.h
+@@ -0,0 +1,67 @@
++/*
++ * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_EPOLL_IO_WAITER_H
++#define BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_EPOLL_IO_WAITER_H
++
++#include
++#include
++
++#include "io_waiter.h"
++#include "nocopyable.h"
++
++namespace OHOS {
++namespace AppExecFwk {
++// Use epoll to listen file descriptor.
++class EpollIoWaiter final : public IoWaiter {
++public:
++ EpollIoWaiter() = default;
++ ~EpollIoWaiter() final;
++ DISALLOW_COPY_AND_MOVE(EpollIoWaiter);
++
++ /**
++ * Initialize epoll.
++ *
++ * @return True if succeeded.
++ */
++ bool Init();
++
++ bool WaitFor(std::unique_lock &lock, int64_t nanoseconds) final;
++
++ void NotifyOne() final;
++ void NotifyAll() final;
++
++ bool SupportListeningFileDescriptor() const final;
++
++ bool AddFileDescriptor(int32_t fileDescriptor, uint32_t events) final;
++ void RemoveFileDescriptor(int32_t fileDescriptor) final;
++
++ void SetFileDescriptorEventCallback(const FileDescriptorEventCallback &callback) final;
++
++private:
++ void DrainAwakenPipe() const;
++
++ // File descriptor for epoll.
++ int32_t epollFd_{-1};
++ // File descriptor used to wake up epoll.
++ int32_t awakenFd_{-1};
++
++ FileDescriptorEventCallback callback_;
++ std::atomic waitingCount_{0};
++};
++} // namespace AppExecFwk
++} // namespace OHOS
++
++#endif // #ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_EPOLL_IO_WAITER_H
+diff --git a/notification/eventhandler/frameworks/eventhandler/include/event_handler_utils.h b/notification/eventhandler/frameworks/eventhandler/include/event_handler_utils.h
+new file mode 100644
+index 0000000..37e862f
+--- /dev/null
++++ b/notification/eventhandler/frameworks/eventhandler/include/event_handler_utils.h
+@@ -0,0 +1,102 @@
++/*
++ * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_EVENT_HANDLER_UTILS_H
++#define BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_EVENT_HANDLER_UTILS_H
++
++#include
++#include
++#include
++#include
++
++#include "hilog/log.h"
++// #include "hitrace/trace.h"
++#include "inner_event.h"
++
++#define DEFINE_HILOG_LABEL(name) \
++static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = {LOG_CORE, LOG_DOMAIN, name}
++
++#define HILOGE(...) OHOS::HiviewDFX::HiLog::Error(LOG_LABEL, ##__VA_ARGS__)
++#define HILOGW(...) OHOS::HiviewDFX::HiLog::Warn(LOG_LABEL, ##__VA_ARGS__)
++#define HILOGI(...) OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, ##__VA_ARGS__)
++#define HILOGD(...) OHOS::HiviewDFX::HiLog::Debug(LOG_LABEL, ##__VA_ARGS__)
++
++namespace OHOS {
++namespace AppExecFwk {
++inline const int64_t NANOSECONDS_PER_ONE_MILLISECOND = 1000000;
++inline const int64_t NANOSECONDS_PER_ONE_SECOND = 1000000000;
++inline const int32_t INFINITE_TIMEOUT = -1;
++inline const uint8_t MAX_ERRORMSG_LEN = 128;
++
++// Help to convert time point into delay time from now.
++static inline int64_t TimePointToTimeOut(const InnerEvent::TimePoint &when)
++{
++ InnerEvent::TimePoint now = InnerEvent::Clock::now();
++ if (when <= now) {
++ return 0;
++ }
++
++ auto duration = when - now;
++ return std::chrono::duration_cast(duration).count();
++}
++
++static inline int32_t NanosecondsToTimeout(int64_t nanoseconds)
++{
++ if (nanoseconds < 0) {
++ return INFINITE_TIMEOUT;
++ }
++
++ int64_t milliseconds = nanoseconds / NANOSECONDS_PER_ONE_MILLISECOND;
++ if ((nanoseconds % NANOSECONDS_PER_ONE_MILLISECOND) > 0) {
++ milliseconds += 1;
++ }
++
++ return (milliseconds > INT32_MAX) ? INT32_MAX : static_cast(milliseconds);
++}
++
++// using HiTraceChain = OHOS::HiviewDFX::HiTraceChain;
++
++static inline bool AllowHiTraceOutPut(const std::shared_ptr& traceId, bool isSyncEvent)
++{
++ // if ((!traceId) || (!traceId->IsValid())) {
++ // return false;
++ // }
++ // if ((!isSyncEvent) && (!traceId->IsFlagEnabled(HITRACE_FLAG_INCLUDE_ASYNC))) {
++ // return false;
++ // }
++ return true;
++}
++
++// static inline void HiTracePointerOutPut(const std::shared_ptr& spanId,
++// const InnerEvent::Pointer& event, const char* action, HiTraceTracepointType type)
++// {
++// if (!event->HasTask()) {
++// HiTraceChain::Tracepoint(type, *spanId, "%s event, event id: %d", action, event->GetInnerEventId());
++// } else if (!event->GetTaskName().empty()) {
++// HiTraceChain::Tracepoint(type, *spanId, "%s task with name, name: %s", action, event->GetTaskName().c_str());
++// } else {
++// HiTraceChain::Tracepoint(type, *spanId, "%s UnNamed Task", action);
++// }
++// }
++
++static inline void GetLastErr(char *errmsg, size_t size = MAX_ERRORMSG_LEN)
++{
++ size = size > MAX_ERRORMSG_LEN ? MAX_ERRORMSG_LEN : size;
++ strerror_r(errno, errmsg, size);
++}
++} // namespace AppExecFwk
++} // namespace OHOS
++
++#endif // #ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_EVENT_HANDLER_UTILS_H
+diff --git a/notification/eventhandler/frameworks/eventhandler/include/event_inner_runner.h b/notification/eventhandler/frameworks/eventhandler/include/event_inner_runner.h
+new file mode 100644
+index 0000000..1e212a9
+--- /dev/null
++++ b/notification/eventhandler/frameworks/eventhandler/include/event_inner_runner.h
+@@ -0,0 +1,69 @@
++/*
++ * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_EVENT_INNER_RUNNER_H
++#define BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_EVENT_INNER_RUNNER_H
++
++#include "event_handler_utils.h"
++#include "event_queue.h"
++#include "event_runner.h"
++#include "nocopyable.h"
++#include "thread_local_data.h"
++
++namespace OHOS {
++namespace AppExecFwk {
++class EventInnerRunner {
++public:
++ explicit EventInnerRunner(const std::shared_ptr &runner);
++ virtual ~EventInnerRunner() = default;
++ DISALLOW_COPY_AND_MOVE(EventInnerRunner);
++
++ static std::shared_ptr GetCurrentEventRunner();
++
++ virtual void Run() = 0;
++ virtual void Stop() = 0;
++
++ const std::shared_ptr &GetEventQueue() const
++ {
++ return queue_;
++ }
++
++ void SetLogger(const std::shared_ptr &logger)
++ {
++ logger_ = logger;
++ }
++
++ const std::string &GetThreadName()
++ {
++ return threadName_;
++ }
++
++ const std::thread::id &GetThreadId()
++ {
++ return threadId_;
++ }
++
++protected:
++ std::shared_ptr queue_;
++ std::weak_ptr owner_;
++ std::shared_ptr logger_;
++ static ThreadLocalData> currentEventRunner;
++ std::string threadName_;
++ std::thread::id threadId_;
++};
++} // namespace AppExecFwk
++} // namespace OHOS
++
++#endif // #ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_EVENT_INNER_RUNNER_H
+diff --git a/notification/eventhandler/frameworks/eventhandler/include/io_waiter.h b/notification/eventhandler/frameworks/eventhandler/include/io_waiter.h
+new file mode 100644
+index 0000000..f356772
+--- /dev/null
++++ b/notification/eventhandler/frameworks/eventhandler/include/io_waiter.h
+@@ -0,0 +1,89 @@
++/*
++ * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_IO_WAITER_H
++#define BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_IO_WAITER_H
++
++#include
++#include
++#include
++#include
++
++#include "nocopyable.h"
++
++namespace OHOS {
++namespace AppExecFwk {
++// Interface of IO waiter
++class IoWaiter {
++public:
++ using FileDescriptorEventCallback = std::function;
++
++ IoWaiter() = default;
++ virtual ~IoWaiter() = default;
++ DISALLOW_COPY_AND_MOVE(IoWaiter);
++
++ /**
++ * Wait until IO event coming or timed out.
++ *
++ * @param lock An unique lock which must be locked by the current thread.
++ * @param nanoseconds Nanoseconds for time out, negative value indicate waiting forever.
++ * @return True if succeeded.
++ */
++ virtual bool WaitFor(std::unique_lock &lock, int64_t nanoseconds) = 0;
++
++ /**
++ * Unblocks one of the waiting threads.
++ */
++ virtual void NotifyOne() = 0;
++
++ /**
++ * Unblocks all of the waiting threads.
++ */
++ virtual void NotifyAll() = 0;
++
++ /**
++ * Check whether this waiter support listening file descriptor.
++ *
++ * @return True if supported.
++ */
++ virtual bool SupportListeningFileDescriptor() const = 0;
++
++ /**
++ * Add file descriptor.
++ *
++ * @param fileDescriptor File descriptor which need to listen.
++ * @param events Events from file descriptor, such as input, output.
++ * @return True if succeeded.
++ */
++ virtual bool AddFileDescriptor(int32_t fileDescriptor, uint32_t events) = 0;
++
++ /**
++ * Remove file descriptor.
++ *
++ * @param fileDescriptor File descriptor which need to remove.
++ */
++ virtual void RemoveFileDescriptor(int32_t fileDescriptor) = 0;
++
++ /**
++ * Set callback to handle events from file descriptors, such as readable, writable and so on.
++ *
++ * @param callback Callback function to handle events from file descriptors.
++ */
++ virtual void SetFileDescriptorEventCallback(const FileDescriptorEventCallback &callback) = 0;
++};
++} // namespace AppExecFwk
++} // namespace OHOS
++
++#endif // #ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_IO_WAITER_H
+diff --git a/notification/eventhandler/frameworks/eventhandler/include/none_io_waiter.h b/notification/eventhandler/frameworks/eventhandler/include/none_io_waiter.h
+new file mode 100644
+index 0000000..6458778
+--- /dev/null
++++ b/notification/eventhandler/frameworks/eventhandler/include/none_io_waiter.h
+@@ -0,0 +1,54 @@
++/*
++ * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_NONE_IO_WAITER_H
++#define BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_NONE_IO_WAITER_H
++
++#include
++#include
++
++#include "io_waiter.h"
++#include "nocopyable.h"
++
++namespace OHOS {
++namespace AppExecFwk {
++// Io waiter which does not support listening file descriptor.
++class NoneIoWaiter final : public IoWaiter {
++public:
++ NoneIoWaiter() = default;
++ ~NoneIoWaiter() final;
++ DISALLOW_COPY_AND_MOVE(NoneIoWaiter);
++
++ bool WaitFor(std::unique_lock &lock, int64_t nanoseconds) final;
++
++ void NotifyOne() final;
++ void NotifyAll() final;
++
++ bool SupportListeningFileDescriptor() const final;
++
++ bool AddFileDescriptor(int32_t fileDescriptor, uint32_t events) final;
++ void RemoveFileDescriptor(int32_t fileDescriptor) final;
++
++ void SetFileDescriptorEventCallback(const FileDescriptorEventCallback &callback) final;
++
++private:
++ std::condition_variable condition_;
++ uint32_t waitingCount_ {0};
++ bool pred_ {false};
++};
++} // namespace AppExecFwk
++} // namespace OHOS
++
++#endif // #ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_NONE_IO_WAITER_H
+diff --git a/notification/eventhandler/frameworks/eventhandler/include/thread_local_data.h b/notification/eventhandler/frameworks/eventhandler/include/thread_local_data.h
+new file mode 100644
+index 0000000..6921a55
+--- /dev/null
++++ b/notification/eventhandler/frameworks/eventhandler/include/thread_local_data.h
+@@ -0,0 +1,93 @@
++/*
++ * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_THREAD_LOCAL_DATA_H
++#define BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_THREAD_LOCAL_DATA_H
++
++#include
++#include
++#include
++
++#include "nocopyable.h"
++
++namespace OHOS {
++namespace AppExecFwk {
++/*
++ * Tool class, used to save thread local data.
++ */
++template
++class ThreadLocalData {
++public:
++ ThreadLocalData() = default;
++ ~ThreadLocalData() = default;
++ DISALLOW_COPY_AND_MOVE(ThreadLocalData);
++
++ /*
++ * Override type conversion method.
++ */
++ inline operator T() const
++ {
++ return Current();
++ }
++
++ /*
++ * Override operator equal to save data.
++ */
++ inline const ThreadLocalData &operator=(const T &data)
++ {
++ Save(data);
++ return *this;
++ }
++
++ /*
++ * Override operator equal to nullptr, which can used to discard the saved data.
++ */
++ inline const ThreadLocalData &operator=(std::nullptr_t)
++ {
++ Discard();
++ return *this;
++ }
++
++private:
++ inline T Current() const
++ {
++ std::lock_guard lock(mapLock_);
++ auto it = dataMap_.find(std::this_thread::get_id());
++ if (it == dataMap_.end()) {
++ return T();
++ } else {
++ return it->second;
++ }
++ }
++
++ inline void Save(const T &data)
++ {
++ std::lock_guard lock(mapLock_);
++ dataMap_[std::this_thread::get_id()] = data;
++ }
++
++ inline void Discard()
++ {
++ std::lock_guard lock(mapLock_);
++ (void)dataMap_.erase(std::this_thread::get_id());
++ }
++
++ mutable std::mutex mapLock_;
++ std::unordered_map dataMap_;
++};
++} // namespace AppExecFwk
++} // namespace OHOS
++
++#endif // #ifndef BASE_EVENTHANDLER_FRAMEWORKS_EVENTHANDLER_INCLUDE_THREAD_LOCAL_DATA_H
+diff --git a/notification/eventhandler/frameworks/eventhandler/inner_api_sources.gni b/notification/eventhandler/frameworks/eventhandler/inner_api_sources.gni
+new file mode 100644
+index 0000000..dab3ade
+--- /dev/null
++++ b/notification/eventhandler/frameworks/eventhandler/inner_api_sources.gni
+@@ -0,0 +1,26 @@
++# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++import("../../eventhandler.gni")
++
++inner_api_sources = [
++ "${frameworks_path}/eventhandler/src/epoll_io_waiter.cpp",
++ "${frameworks_path}/eventhandler/src/event_handler.cpp",
++ "${frameworks_path}/eventhandler/src/event_queue.cpp",
++ "${frameworks_path}/eventhandler/src/event_runner.cpp",
++ "${frameworks_path}/eventhandler/src/file_descriptor_listener.cpp",
++ "${frameworks_path}/eventhandler/src/inner_event.cpp",
++ "${frameworks_path}/eventhandler/src/native_implement_eventhandler.cpp",
++ "${frameworks_path}/eventhandler/src/none_io_waiter.cpp",
++]
++
++event_handler_log_domain_defines = [ "LOG_DOMAIN=0xD001200" ]
+diff --git a/notification/eventhandler/frameworks/napi/BUILD.gn b/notification/eventhandler/frameworks/napi/BUILD.gn
+new file mode 100644
+index 0000000..0861a03
+--- /dev/null
++++ b/notification/eventhandler/frameworks/napi/BUILD.gn
+@@ -0,0 +1,27 @@
++# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++import("//build/ohos.gni")
++import("//build/ohos/ace/ace.gni")
++import("../../eventhandler.gni")
++
++config("emitter_config") {
++ include_dirs = [ "include" ]
++ libs = [ "emitter" ]
++}
++
++ohos_shared_library("emitter") {
++ all_dependent_configs = [ ":emitter_config" ]
++ subsystem_name = "notification"
++ part_name = "eventhandler"
++}
+diff --git a/notification/eventhandler/frameworks/napi/include/events_emitter.h b/notification/eventhandler/frameworks/napi/include/events_emitter.h
+new file mode 100644
+index 0000000..765a4db
+--- /dev/null
++++ b/notification/eventhandler/frameworks/napi/include/events_emitter.h
+@@ -0,0 +1,82 @@
++/*
++ * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++#ifndef BASE_EVENTHANDLER_FRAMEWORKS_NAPI_INCLUDE_JS_EMITTER_H
++#define BASE_EVENTHANDLER_FRAMEWORKS_NAPI_INCLUDE_JS_EMITTER_H
++
++#include