diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..bed0e84f9b4325fe97649789b71b203be9a6ef08
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,24 @@
+# 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")
+import("//foundation/resourceschedule/frame_aware_sched/frameaware.gni")
+
+
+group("libintellisensesched_intf") {
+ public_deps = [
+ "${innerkits_path}/frameintf:frame_msg_intf",
+ "${innerkits_path}/frameintf:frame_ui_intf",
+ ]
+}
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4909afd04fffa2413fb5ae911d24eb69ce3037d2
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,178 @@
+ 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
+
+
diff --git a/OAT.xml b/OAT.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7ece9618ad12da5515dfdfcd2b81b93b093e5ca9
--- /dev/null
+++ b/OAT.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.en.md b/README.en.md
deleted file mode 100644
index 21a74bc70ec2f190df12a543513434c04cdc6f56..0000000000000000000000000000000000000000
--- a/README.en.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# frame_aware_sched
-
-#### 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/README.md b/README.md
deleted file mode 100644
index 7611f38101e54f3250b51b7abcc09503c3fdd612..0000000000000000000000000000000000000000
--- a/README.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# frame_aware_sched
-
-#### 介绍
-{**以下是 Gitee 平台说明,您可以替换此简介**
-Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
-无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
-
-#### 软件架构
-软件架构说明
-
-
-#### 安装教程
-
-1. xxxx
-2. xxxx
-3. xxxx
-
-#### 使用说明
-
-1. xxxx
-2. xxxx
-3. xxxx
-
-#### 参与贡献
-
-1. Fork 本仓库
-2. 新建 Feat_xxx 分支
-3. 提交代码
-4. 新建 Pull Request
-
-
-#### 特技
-
-1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
-2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
-3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
-4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
-5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
-6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/README_ZH.md b/README_ZH.md
new file mode 100644
index 0000000000000000000000000000000000000000..b13bc5cb19a54efb3abff4e460e7934bb66a80b0
--- /dev/null
+++ b/README_ZH.md
@@ -0,0 +1,124 @@
+# 智能感知调度
+
+- [简介](#section_introduction)
+
+- [目录](#section_catalogue)
+
+- [框架](#section_framework)
+
+ - [绘帧信息收集](#section_strategy)
+
+ - [帧感知调度机制](#section_mechanism)
+
+- [相关仓](#related_repositories)
+
+
+
+## 简介
+
+智能感知调度部件位于全局资源调度管控子系统中,基于应用的生命周期状态、绘帧信息等,更新进程调度分组,通过设置进程组、线程优先级及其他内核调度参数等手段管理系统调度,保障系统进程调度供给。
+
+
+
+## 目录
+
+```
+//foundation/resourceschedule/plugins/frame_aware_sched
+├── common # 部件通用工具类
+│ └── include
+│ ├── frame_info_const.h # UI及render绘帧过程信息
+│ ├── frame_aware_constants.h # 通用参数配置
+│ ├── frame_aware_log_domain.h # 封装hilog,用于日志打印
+│ └── single_instance.h # 封装单例类,方便实现单例
+│
+├── interfaces
+│ └── innerkits # 对内接口目录
+│ └── frameintf # 感知调度专用接口
+│
+├── frameworks
+│ └── core
+│ ├── frame_aware_collector # 应用绘帧信息收集组件
+│ └── frame_aware_policy # 帧感知调度机制组件
+│
+├── profiles # 组件配置文件
+└── test # 自测试用例目录
+```
+
+
+## 框架
+
+智能感知调度部件根据执行时所属线程进行划分,可包含两大组件,即运行在App进程的绘帧信息收集器组件和运行在系统服务进程的帧感知调度机制组件,每个组件分为若干模块。
+
+- **绘帧信息收集组件**:主要分为绘帧事件处理模块、滑动场景策略模块以及模型处理模块,三者构成绘帧核心策略。其中:
+
+ 消息处理模块负责统筹JS-UI子系统及Graphic子系统的绘帧子过程的消息信息并分发;
+
+ 帧事件处理模块主要负责提供各个子过程的调节调度算法;
+
+ 滑动场景策略模块主要负责针对滑动场景,使用帧事件处理模块的算法接口提供应用主线程绘帧策略,进行场景化精细调度。
+
+- **帧感知调度机制组件**:主要分为场景处理模块、应用管控模块、调度参数管控模块和RTG(Related-Thread-Group)分组管理模块,四者构成应用线程调度机制。其中:
+
+ 场景处理模块主要负责注册接收来自全局资源管控子系统的消息,诸如应用前后台切换、窗口焦点变化等,并分发消息给应用管控模块和RTG分组模块;
+
+ 应用管控模块,主要负责把维护接收到的消息,形成应用消息管理;
+
+ RTG分组管理模块即调用内核接口设置,根据应用状态设置RTG分组实现线程调度管理;
+
+ 调度参数管控模块主要负责读取默认调度参数配置。
+
+两个组件中的事件处理模块,均统筹了智能感知调度部件所要对外相应的事件,而调度特性内核接口模块则负责将管控调度命令以帧的频率下发,两个组件相互合作,共同保障系统线程的性能供给。
+
+
+
+
+
+### 绘帧信息收集
+
+应用绘帧感知主要负责调节内核调度的参数,进行线程负载的缩放。当用户在APP界面滑动时,识别出应用的关键线程(诸如绘帧主线程、渲染线程),感知应用绘帧子过程的执行情况,根据是否超时来判断是否调整内核调度参数,进行实时的资源供给,进行优先调度。
+
+- 根据屏幕刷新率,判断当前帧率信息。根据越接近绘帧结束时刻,越加大关键线程的资源供给
+
+
+- 根据界面绘帧图形渲染过程中的各个子阶段的时长,调节资源供给。
+
+
+- 对可能发生丢帧卡顿的高概率事件,增加资源供给
+
+
+
+
+### 帧感知调度机制
+
+应用线程调度机制,作为应用绘帧感知实现的基础,主要负责管控线程组及线程优先级,实现应用线程的统一管理,保证整个系统性能。
+
+**核心思想**:分组,即根据不同线程组提供不同的供给能力。把用户敏感度线程添加进同一个线程组,在应用启动、前后台切换等多个应用变化场景,提供资源优先供给。
+
+
+
+### 使用说明
+
+系统开发者可以通过配置productdefine/common/products下的产品定义json文件,增加或移除本部件,来启用或停用本部件
+
+"resourceschedule:frame_aware_sched":{}
+
+
+
+### 相关仓
+
+- resource_schedule_service
+
+- ace_ace_engine
+
+- graphic_standard
+
+- aafwk_standard
+
+- **frame_aware_sched**
+
+
+
+
+
+
+
diff --git a/bundle.json b/bundle.json
new file mode 100644
index 0000000000000000000000000000000000000000..a51bb73cac267a3674f6d1e743875b85d3cf7c24
--- /dev/null
+++ b/bundle.json
@@ -0,0 +1,67 @@
+{
+ "name": "@ohos/resource_schedule_service",
+ "description": "resource_schedule_service",
+ "version": "3.1",
+ "license": "Apache License 2.0",
+ "publishAs": "code-segment",
+ "segment": {
+ "destPath": "foundation/resourceschedule/plugins/frame_aware_sched"
+ },
+ "dirs": {},
+ "scripts": {},
+ "component": {
+ "name": "frame_aware_sched",
+ "subsystem": "resourceschedule",
+ "syscap": [],
+ "features": [],
+ "adapted_system_type": [
+ "mini",
+ "small",
+ "standard"
+ ],
+ "rom": "2048KB",
+ "ram": "10240KB",
+ "deps": {
+ "components": [
+ "libeventhandler",
+ "ipc_core",
+ "samgr_proxy",
+ "system_ability_fwk"
+ ],
+ "third_party": [
+ "xml2"
+ ]
+ },
+ "build": {
+ "sub_component": [
+ "//foundation/resourceschedule/plugins/frame_aware_sched/interfaces/innerkits/frameintf:frame_ui_intf",
+ "//foundation/resourceschedule/plugins/frame_aware_sched/interfaces/innerkits/frameintf:frame_msg_intf",
+ "//foundation/resourceschedule/plugins/frame_aware_sched/interfaces/innerkits/frameintf:rtg_interface",
+ "//foundation/resourceschedule/plugins/frame_aware_sched/profiles:frame_aware_sched_config"
+ ],
+ "inner_kits": [
+ {
+ "header": {
+ "header_base": "//foundation/resourceschedule/plugins/frame_aware_sched/interfaces/innerkits/frameintf",
+ "header_files": [
+ "frame_ui_intf.h"
+ ]
+ },
+ "name": "//foundation/resourceschedule/plugins/frame_aware_sched/interfaces/innerkits/frameintf:frame_ui_intf"
+ },
+ {
+ "header": {
+ "header_base": "//foundation/resourceschedule/plugins/frame_aware_sched/interfaces/innerkits/frameintf",
+ "header_files": [
+ "frame_msg_intf.h"
+ ]
+ },
+ "name": "//foundation/resourceschedule/plugins/frame_aware_sched/interfaces/innerkits/frameintf:frame_msg_intf"
+ }
+ ],
+ "test": [
+ "//foundation/resourceschedule/plugins/frame_aware_sched/test:frame_unittest"
+ ]
+ }
+ }
+}
diff --git a/common/include/frame_info_const.h b/common/include/frame_info_const.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b941e6390eec362a3c6625b66e2d6c07200f22b
--- /dev/null
+++ b/common/include/frame_info_const.h
@@ -0,0 +1,59 @@
+/*
+ * 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 FRAME_INFO_CONST_H
+#define FRAME_INFO_CONST_H
+
+namespace OHOS {
+namespace RME {
+
+enum class FrameEvent {
+ FLUSH_ANIMATION,
+ FLUSH_BUILD,
+ FLUSH_LAYOUT,
+ FLUSH_RENDER,
+ FLUSH_RENDER_FINISH, // to add, do not realize
+ PROCESS_POST_FLUSH,
+ PROCESS_COMMANDS,
+ ANIMATE,
+ RENDER,
+ SEND_COMMANDS,
+ EVENT_SET_PARAM,
+ EVENT_RTG_ENABLE,
+ EVENT_BUFFER_COUNT,
+ UNKNOWN,
+};
+
+enum class EventState {
+ EVENT_ENTER,
+ EVENT_CONSUMED,
+ EVENT_EXIT,
+ ENABLE,
+ DISABLE,
+};
+
+enum class SceneEvent {
+ SCENE_INVALID = 0,
+ VIDEO,
+ SLIDE,
+ GAME,
+ CLICK,
+ SCENE_MAX,
+};
+
+} // namespace RME
+} // namespace OHOS
+
+#endif
diff --git a/common/include/rme_constants.h b/common/include/rme_constants.h
new file mode 100644
index 0000000000000000000000000000000000000000..d35086bc3234044e131540ac19b98c5df6663036
--- /dev/null
+++ b/common/include/rme_constants.h
@@ -0,0 +1,56 @@
+/*
+ * 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 RME_CONSTANTS_H
+#define RME_CONSTANTS_H
+
+namespace OHOS {
+namespace RME {
+
+enum class AppStateUpdateReason {
+ APP_FOREGROUND,
+ APP_BACKGROUND,
+ APP_TERMINATED,
+ PROCESS_CREATE,
+ PROCESS_READY,
+ PROCESS_SUSPEND,
+ PROCESS_DIED,
+ REASON_UNKNOWN,
+};
+
+enum class ThreadType {
+ UI,
+ RENDER,
+};
+
+enum class ThreadState {
+ CREATE = 0,
+ DIED,
+};
+
+enum class WindowState {
+ FOCUS_YES = 0,
+ FOCUS_NO,
+};
+
+enum class ErrorCode {
+ FAIL,
+ SUCC,
+};
+
+} // namespace RME
+} // namespace OHOS
+
+#endif
diff --git a/common/include/rme_log_domain.h b/common/include/rme_log_domain.h
new file mode 100644
index 0000000000000000000000000000000000000000..09b78d0f2d0aec6c9704fbf205c5adf6ef0323a3
--- /dev/null
+++ b/common/include/rme_log_domain.h
@@ -0,0 +1,72 @@
+/*
+ * 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 RME_LOG_DOMAIN_H
+#define RME_LOG_DOMAIN_H
+
+#include
+#include "hilog/log.h"
+
+namespace OHOS {
+namespace RmeLogDomain {
+
+constexpr uint32_t COMMON = 0xD006600;
+constexpr uint32_t RME_SERVICE = 0xD006601;
+constexpr uint32_t RME_TEST = 0xD006602;
+constexpr uint32_t RME_INTELLISENSE = 0xD006604;
+
+/*
+#ifdef RME_LOGF
+#undef RME_LOGF
+#endif
+
+#ifdef RME_LOGE
+#undef RME_LOGE
+#endif
+
+#ifdef RME_LOGW
+#undef RME_LOGW
+#endif
+
+#ifdef RME_LOGI
+#undef RME_LOGI
+#endif
+
+#ifdef RME_LOGD
+#undef RME_LOGD
+#endif
+*/
+
+#define DEFINE_RMELOG_LABEL(name) \
+ static constexpr OHOS::HiviewDFX::HiLogLabel RME_LOG_LABEL = {LOG_CORE, OHOS::RmeLogDomain::COMMON, name};
+#define DEFINE_RMELOG_INTELLISENSE(name) \
+ static constexpr OHOS::HiviewDFX::HiLogLabel RME_LOG_LABEL = {LOG_CORE, OHOS::RmeLogDomain::RME_INTELLISENSE, name};
+#define DEFINE_RMELOG_SERVICE(name) \
+ static constexpr OHOS::HiviewDFX::HiLogLabel RME_LOG_LABEL = {LOG_CORE, OHOS::RmeLogDomain::RME_SERVICE, name};
+#define DEFINE_RMELOG_TEST(name) \
+ static constexpr OHOS::HiviewDFX::HiLogLabel RME_LOG_LABEL = {LOG_CORE, OHOS::RmeLogDomain::RME_TEST, name};
+
+
+#define RME_LOGF(...) (void)OHOS::HiviewDFX::HiLog::Fatal(RME_LOG_LABEL, ##__VA_ARGS__)
+#define RME_LOGE(...) (void)OHOS::HiviewDFX::HiLog::Error(RME_LOG_LABEL, ##__VA_ARGS__)
+#define RME_LOGW(...) (void)OHOS::HiviewDFX::HiLog::Warn(RME_LOG_LABEL, ##__VA_ARGS__)
+#define RME_LOGI(...) (void)OHOS::HiviewDFX::HiLog::Info(RME_LOG_LABEL, ##__VA_ARGS__)
+#define RME_LOGD(...) (void)OHOS::HiviewDFX::HiLog::Debug(RME_LOG_LABEL, ##__VA_ARGS__)
+
+
+} // namespace RmeLogDomain
+} // namespace OHOS
+
+#endif // RME_LOG_DOMAIN_H
diff --git a/common/include/rtg_interface.h b/common/include/rtg_interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..f6e07d8a26a794cb5e6067c737e631fcd82c2390
--- /dev/null
+++ b/common/include/rtg_interface.h
@@ -0,0 +1,112 @@
+/*
+ * 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_FRAME_AWARE_SCHED_COMMON_INCLUDE_RTG_INTERFACE_H
+#define OHOS_FRAME_AWARE_SCHED_COMMON_INCLUDE_RTG_INTERFACE_H
+
+
+#include
+#include
+
+namespace OHOS {
+namespace RME {
+
+using namespace std;
+
+#define MAX_TID_NUM 5
+#define MAX_SUBPROCESS_NUM 8
+#define MULTI_FRAME_NUM 5
+
+typedef int pid_t;
+
+struct rtg_enable_data {
+ int enable;
+ int len;
+ char *data;
+};
+
+struct rtg_str_data {
+ int type;
+ int len;
+ char *data;
+};
+
+struct proc_state_data {
+ int grp_id;
+ int state_param;
+};
+
+enum grp_ctrl_cmd {
+ CMD_CREATE_RTG_GRP,
+ CMD_ADD_RTG_THREAD,
+ CMD_REMOVE_RTG_THREAD,
+ CMD_CLEAR_RTG_GRP,
+ CMD_DESTROY_RTG_GRP
+};
+
+struct rtg_grp_data {
+ int rtg_cmd;
+ int grp_id;
+ int prio_type;
+ int rt_cnt;
+ int tid_num;
+ int tids[MAX_TID_NUM];
+};
+
+struct rtg_info {
+ int rtg_num;
+ int rtgs[MULTI_FRAME_NUM];
+};
+
+enum rtg_sched_cmdid {
+ SET_ENABLE = 1,
+ SET_RTG,
+ SET_CONFIG,
+ SET_RTG_ATTR,
+ BEGIN_FRAME_FREQ = 5,
+ END_FRAME_FREQ,
+ END_SCENE,
+ SET_MIN_UTIL,
+ SET_MARGIN,
+ LIST_RTG,
+ LIST_RTG_THREAD,
+ SEARCH_RTG,
+ RTG_CTRL_MAX_NR,
+};
+
+extern "C"{
+ int EnableRtg(bool flag);
+ //-----for frame rtg-----//
+ int CreateNewRtgGrp(int prioType = 0, int rtNum = 0); // Return GrpId if success
+ int AddThreadToRtg(int tid, int grpId);
+ int AddThreadsToRtg(vector tids, int grpId);
+ int RemoveRtgThread(int tid);
+ int ClearRtgGrp(int grpId);
+ int DestroyRtgGrp(int grpId);
+ int SetFrameRateAndPrioType(int rtgId, int rate, int rtgType);
+ int SetMaxVipRtgs(int rtframe);
+ int BeginFrameFreq(int grpId, int stateParam);
+ int EndFrameFreq(int grpId, int stateParam);
+ int EndScene(int rtgId);
+ int SetMinUtil(int grpId, int stateParam);
+ int SetMargin(int grpId, int stateParam);
+ int ListRtgThread(int grpId, vector *rs); // list all tasks of grpId;
+ int ListRtgGroup(vector *rs);
+ int SearchRtgForTid(int stateParam);
+}
+
+} // namespace RME
+} // namespace OHOS
+#endif // OHOS_FRAME_AWARE_SCHED_COMMON_INCLUDE_RTG_INTERFACE_H
\ No newline at end of file
diff --git a/common/include/single_instance.h b/common/include/single_instance.h
new file mode 100644
index 0000000000000000000000000000000000000000..37d765f5596774959fd59768044bf5bd7f5e7418
--- /dev/null
+++ b/common/include/single_instance.h
@@ -0,0 +1,49 @@
+/*
+ * 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 SINGLE_INSTANCE_H
+#define SINGLE_INSTANCE_H
+
+namespace OHOS {
+namespace RME {
+
+#define DECLARE_SINGLE_INSTANCE_BASE(className) \
+public: \
+ static className& GetInstance(); \
+private: \
+ className(const className&) = delete; \
+ className& operator=(const className &) = delete; \
+ className(className&&) = delete; \
+ className& operator=(className&&) = delete; \
+
+
+#define DECLARE_SINGLE_INSTANCE(className) \
+ DECLARE_SINGLE_INSTANCE_BASE(className) \
+private: \
+ className() = default; \
+ ~className() = default; \
+
+
+#define IMPLEMENT_SINGLE_INSTANCE(className) \
+className& className::GetInstance() \
+{ \
+ static auto instance = new className(); \
+ return *instance; \
+}
+
+} // namespace RME
+} // namespace OHOS
+
+#endif // SINGLE_INSTANCE_H
diff --git a/figures/zh-cn_image_fwk.png b/figures/zh-cn_image_fwk.png
new file mode 100644
index 0000000000000000000000000000000000000000..c9fda7b34b8bc376d66ac03e7e69502218c43dc5
Binary files /dev/null and b/figures/zh-cn_image_fwk.png differ
diff --git a/frameaware.gni b/frameaware.gni
new file mode 100644
index 0000000000000000000000000000000000000000..b4eba4699387de3ef5267d0b6c88f35497de8173
--- /dev/null
+++ b/frameaware.gni
@@ -0,0 +1,18 @@
+# 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.
+
+frame_aware_path = "//foundation/resourceschedule/plugins/frame_aware_sched"
+service_path = "${frame_aware_path}/services"
+innerkits_path = "${frame_aware_path}/interfaces/innerkits"
+
+framework_path = "${frame_aware_path}/frameworks/core"
diff --git a/frameworks/core/frame_aware_collector/include/frame_msg_mgr.h b/frameworks/core/frame_aware_collector/include/frame_msg_mgr.h
new file mode 100644
index 0000000000000000000000000000000000000000..4d51e306348130b0f1249b258ab0bfea0d9dffbb
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/include/frame_msg_mgr.h
@@ -0,0 +1,53 @@
+/*
+ * 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 FRAME_MSG_MGR_H
+#define FRAME_MSG_MGR_H
+
+#include
+
+#include "rme_log_domain.h"
+#include "frame_info_const.h"
+#include "rme_scene_sched.h"
+
+namespace OHOS {
+namespace RME {
+
+class RmeSceneSched;
+
+class FrameMsgMgr {
+ DECLARE_SINGLE_INSTANCE_BASE(FrameMsgMgr);
+public:
+ FrameMsgMgr();
+ ~FrameMsgMgr();
+ bool Init();
+ void EventUpdate(FrameEvent eventType, EventState state);
+
+private:
+ void UpdateScene(SceneEvent scene);
+
+ void HandleDefaultEvent(FrameEvent event, EventState state);
+ void SetSchedParam();
+ FrameSceneSched *GetSceneHandler() const;
+
+ SceneEvent sceneType;
+ RmeSceneSched *rmeScene;
+
+};
+
+
+} // namespace RME
+} // namespace OHOS
+#endif
diff --git a/frameworks/core/frame_aware_collector/include/frame_scene_sched.h b/frameworks/core/frame_aware_collector/include/frame_scene_sched.h
new file mode 100644
index 0000000000000000000000000000000000000000..03398e364d8d98ea500ea2f203314637cf08f18f
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/include/frame_scene_sched.h
@@ -0,0 +1,50 @@
+/*
+ * 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 FRAME_SCENE_SCHED_H
+#define FRAME_SCENE_SCHED_H
+
+#include "rme_log_domain.h"
+
+namespace OHOS {
+namespace RME {
+
+class FrameSceneSched {
+public:
+ FrameSceneSched() {};
+ virtual ~FrameSceneSched() = default;
+
+// virtual void UpdateBufferCount(int count);
+ virtual void BeginFlushAnimation() = 0;
+ virtual void EndFlushAnimation() = 0;
+ virtual void BeginFlushBuild() = 0;
+ virtual void EndFlushBuild() = 0;
+ virtual void BeginFlushLayout() = 0;
+ virtual void EndFlushLayout() = 0;
+ virtual void BeginFlushRender() = 0;
+ virtual void EndFlushRender() = 0;
+ virtual void BeginProcessPostFlush() = 0;
+ virtual void ProcessCommandsStart() = 0;
+ virtual void AnimateStart() = 0;
+ virtual void RenderStart() = 0;
+ virtual void SendCommandsStart() = 0;
+
+};
+
+} // namespace RME
+
+} // namespace OHOS
+
+#endif
diff --git a/frameworks/core/frame_aware_collector/include/frame_window_mgr.h b/frameworks/core/frame_aware_collector/include/frame_window_mgr.h
new file mode 100644
index 0000000000000000000000000000000000000000..04fd7ecb7db7aba81c6924aa09be23cc78e34017
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/include/frame_window_mgr.h
@@ -0,0 +1,39 @@
+/*
+ * 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 FRAME_WINDOW_MGR_H
+#define FRAME_WINDOW_MGR_H
+
+#include
+#include "single_instance.h"
+
+namespace OHOS {
+namespace RME {
+
+class FrameWindowMgr {
+ DECLARE_SINGLE_INSTANCE(FrameWindowMgr);
+public:
+ int GetEnable();
+ void SetStartFlag(bool flag);
+ bool GetStartFlag();
+private:
+ int m_enable = -1;
+ bool m_startFlag;
+// static int m_propName;
+};
+
+} // namespace RME
+} // namespace OHOS
+#endif
diff --git a/frameworks/core/frame_aware_collector/include/intelli_sense_sched.h b/frameworks/core/frame_aware_collector/include/intelli_sense_sched.h
new file mode 100644
index 0000000000000000000000000000000000000000..a2cb0b45cc7c030a605d9f734d0fd980484408ad
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/include/intelli_sense_sched.h
@@ -0,0 +1,41 @@
+/*
+ * 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 INTELLI_SENSE_SCHED_H
+#define INTELLI_SENSE_SCHED_H
+
+#include
+#include
+
+
+namespace OHOS {
+
+namespace RME {
+
+class IntelliSenseSched {
+public:
+ IntelliSenseSched();
+ ~IntelliSenseSched();
+
+ static IntelliSenseSched &GetInstance();
+ static bool IsSoLoaded();
+
+
+}
+
+
+} // namespace RME
+} // namespace OHOS
+#endif
diff --git a/frameworks/core/frame_aware_collector/include/rme_core_sched.h b/frameworks/core/frame_aware_collector/include/rme_core_sched.h
new file mode 100644
index 0000000000000000000000000000000000000000..cec215a0231bc66d71e7eaceb1620a208659e78a
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/include/rme_core_sched.h
@@ -0,0 +1,59 @@
+/*
+ * 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 RME_CORE_SCHED_H
+#define RME_CORE_SCHED_H
+
+#include "rme_log_domain.h"
+
+namespace OHOS {
+namespace RME {
+
+class RmeCoreSched {
+public:
+ RmeCoreSched();
+ ~RmeCoreSched();
+
+ void Init();
+
+ void BeginFlushAnimation();
+ void EndFlushAnimation();
+
+ void BeginFlushBuild();
+ void EndFlushBuild();
+
+ void BeginFlushLayout();
+ void EndFlushLayout();
+
+ void BeginFlushRender();
+ void EndFlushRender();
+
+ void BeginProcessPostFlush();
+ void ProcessCommandsStart();
+ void AnimateStart();
+ void RenderStart();
+ void SendCommandsStart();
+
+ RmeCoreSched(const RmeCoreSched &) = delete;
+ RmeCoreSched &operator=(const RmeCoreSched &) = delete;
+
+private:
+ int m_flushAnimationPeriod = 3;
+
+};
+
+} // namespace RME
+} // namespace OHOS
+#endif
diff --git a/frameworks/core/frame_aware_collector/include/rme_scene_sched.h b/frameworks/core/frame_aware_collector/include/rme_scene_sched.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a301f0fdbdb1401e8a4003ea1ce2a1766998dcd
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/include/rme_scene_sched.h
@@ -0,0 +1,60 @@
+/*
+ * 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 RME_SCENE_SCHED_H
+#define RME_SCENE_SCHED_H
+
+#include "frame_scene_sched.h"
+#include "frame_window_mgr.h"
+#include "rme_core_sched.h"
+#include "rme_log_domain.h"
+
+namespace OHOS {
+namespace RME {
+
+class RmeSceneSched : public FrameSceneSched {
+public:
+ RmeSceneSched();
+ ~RmeSceneSched() override;
+
+ void BeginFlushAnimation() override;
+ void EndFlushAnimation() override;
+
+ void BeginFlushBuild() override;
+ void EndFlushBuild() override;
+
+ void BeginFlushLayout() override;
+ void EndFlushLayout() override;
+
+ void BeginFlushRender() override;
+ void EndFlushRender() override;
+
+ void BeginProcessPostFlush() override;
+ void ProcessCommandsStart() override;
+ void AnimateStart() override;
+ void RenderStart() override;
+ void SendCommandsStart() override;
+
+ bool Init();
+
+private:
+ int curWorkingStatus;
+ RmeCoreSched *rmeCoreSched;
+};
+
+
+} // namespace RME
+} // namespace OHOS
+#endif
diff --git a/frameworks/core/frame_aware_collector/src/frame_msg_mgr.cpp b/frameworks/core/frame_aware_collector/src/frame_msg_mgr.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..751f4953d9171c9fb0f00cc36d8e228725f3969b
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/src/frame_msg_mgr.cpp
@@ -0,0 +1,150 @@
+/*
+ * 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 "frame_msg_mgr.h"
+
+namespace OHOS {
+namespace RME {
+
+DEFINE_RMELOG_INTELLISENSE("ueaClient-FrameMsgMgr");
+IMPLEMENT_SINGLE_INSTANCE(FrameMsgMgr);
+
+FrameMsgMgr::FrameMsgMgr()
+ : sceneType(SceneEvent::SLIDE), rmeScene(nullptr)
+{
+}
+
+FrameMsgMgr::~FrameMsgMgr()
+{
+ if (rmeScene != nullptr) {
+ delete rmeScene;
+ }
+}
+
+bool FrameMsgMgr::Init()
+{
+ if (rmeScene == nullptr) {
+ rmeScene = new RmeSceneSched();
+ }
+
+ if (!rmeScene->Init()) {
+ RME_LOGE("[Init]:inited success!");
+ return false;
+ }
+ RME_LOGI("[Init]:inited success!");
+ return true;
+}
+
+void FrameMsgMgr::EventUpdate(FrameEvent event, EventState value)
+{
+ switch (event) {
+ case FrameEvent::EVENT_SET_PARAM:
+ SetSchedParam();
+ break;
+ case FrameEvent::EVENT_RTG_ENABLE:
+ RME_LOGI("[EventUpdate]:rtg enable!");
+ break;
+ default:
+ HandleDefaultEvent(event, value);
+ break;
+ }
+ return;
+}
+
+void FrameMsgMgr::UpdateScene(SceneEvent scene)
+{
+ if (scene < SceneEvent::SCENE_INVALID || scene >= SceneEvent::SCENE_MAX) {
+ scene = SceneEvent::SCENE_INVALID;
+ }
+
+ sceneType = scene;
+}
+
+void FrameMsgMgr::HandleDefaultEvent(FrameEvent event, EventState value)
+{
+ FrameSceneSched *scene = GetSceneHandler();
+ if (scene == nullptr) {
+ RME_LOGE("[HandleDefaultEvent]:scene nullptr");
+ return;
+ }
+
+ switch (event) {
+ case FrameEvent::FLUSH_ANIMATION:
+ if (value == EventState::EVENT_ENTER) {
+ scene->BeginFlushAnimation();
+ } else {
+ scene->EndFlushAnimation();
+ }
+ break;
+ case FrameEvent::FLUSH_BUILD:
+ if (value == EventState::EVENT_ENTER) {
+ scene->BeginFlushBuild();
+ } else {
+ scene->EndFlushBuild();
+ }
+ break;
+ case FrameEvent::FLUSH_LAYOUT:
+ if (value == EventState::EVENT_ENTER) {
+ scene->BeginFlushLayout();
+ } else {
+ scene->EndFlushLayout();
+ }
+ break;
+ case FrameEvent::FLUSH_RENDER:
+ if (value == EventState::EVENT_ENTER) {
+ scene->BeginFlushRender();
+ } else {
+ scene->EndFlushRender();
+ }
+ break;
+ case FrameEvent::PROCESS_POST_FLUSH:
+ scene->BeginProcessPostFlush();
+ break;
+ case FrameEvent::PROCESS_COMMANDS:
+ scene->ProcessCommandsStart();
+ break;
+ case FrameEvent::ANIMATE:
+ scene->AnimateStart();
+ break;
+ case FrameEvent::RENDER:
+ scene->RenderStart();
+ break;
+ case FrameEvent::SEND_COMMANDS:
+ scene->SendCommandsStart();
+ break;
+ default:
+ RME_LOGE("[HandleDefaultEvent]: unknown event id: %{public}d, event state:%{public}d\n", static_cast(event), static_cast(value));
+ return;
+ }
+}
+
+void FrameMsgMgr::SetSchedParam()
+{
+ RME_LOGI("[SetSchedParam]: set default sched param!");
+}
+
+FrameSceneSched *FrameMsgMgr::GetSceneHandler() const
+{
+
+ if (sceneType == SceneEvent::SCENE_INVALID) {
+ RME_LOGE("[GetSceneHandler]:get nullptr sceneType %{public}d,", static_cast(sceneType));
+ return nullptr;
+ }
+ return rmeScene;
+}
+
+
+} // namespace RME
+} // namespace OHOS
diff --git a/frameworks/core/frame_aware_collector/src/frame_window_mgr.cpp b/frameworks/core/frame_aware_collector/src/frame_window_mgr.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..87ce0ffe46f44f38fe644445ff19c5e70320499d
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/src/frame_window_mgr.cpp
@@ -0,0 +1,51 @@
+/*
+ * 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 "frame_window_mgr.h"
+
+namespace OHOS {
+namespace RME {
+namespace {
+
+const std::string SCHEME_SWITCH_PROP = ""; // to add prop
+}
+
+IMPLEMENT_SINGLE_INSTANCE(FrameWindowMgr);
+
+int FrameWindowMgr::GetEnable()
+{
+ if (m_enable == -1) {
+ bool prop = true;
+ if (prop) {
+ m_enable = 1;
+ } else {
+ m_enable = 0;
+ }
+ }
+ return m_enable;
+}
+
+void FrameWindowMgr::SetStartFlag(bool flag)
+{
+ m_startFlag = flag;
+}
+
+bool FrameWindowMgr::GetStartFlag()
+{
+ return m_startFlag;
+}
+
+} // namespace RME
+} // namespace OHOS
diff --git a/frameworks/core/frame_aware_collector/src/rme_core_sched.cpp b/frameworks/core/frame_aware_collector/src/rme_core_sched.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..573d716aaf82cece25c57c9f17334c2e9d6acaf7
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/src/rme_core_sched.cpp
@@ -0,0 +1,107 @@
+/*
+ * 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 "rme_core_sched.h"
+#include "rtg_interface.h"
+
+namespace OHOS {
+namespace RME {
+
+DEFINE_RMELOG_INTELLISENSE("ueaClient-RmeCoreSched");
+
+RmeCoreSched::RmeCoreSched()
+{
+ return;
+}
+
+RmeCoreSched::~RmeCoreSched()
+{
+ return;
+}
+
+void RmeCoreSched::Init()
+{
+ int ret = EnableRtg(true);
+ if (ret < 0) {
+ RME_LOGE("[Init]: enableRtg failed!");
+ }
+ return;
+}
+
+void RmeCoreSched::BeginFlushAnimation()
+{
+ int ret = BeginFrameFreq(2 ,0);
+ RME_LOGI("[BeginFlushAnimation]: set BeginFrameFreq(2, 0), ret: %{public}d!", ret);
+ int flushAnimationTime = 1; // TO DO
+ if (flushAnimationTime >= m_flushAnimationPeriod) {
+ flushAnimationTime = 2;
+ } else {
+ flushAnimationTime = 3;
+ }
+ return;
+}
+
+void RmeCoreSched::EndFlushAnimation()
+{
+}
+
+void RmeCoreSched::BeginFlushBuild()
+{
+}
+
+void RmeCoreSched::EndFlushBuild()
+{
+}
+
+void RmeCoreSched::BeginFlushLayout()
+{
+}
+
+void RmeCoreSched::EndFlushLayout()
+{
+}
+
+void RmeCoreSched::BeginFlushRender()
+{
+}
+
+void RmeCoreSched::EndFlushRender()
+{
+}
+
+void RmeCoreSched::BeginProcessPostFlush()
+{
+}
+
+void RmeCoreSched::ProcessCommandsStart()
+{
+}
+
+void RmeCoreSched::AnimateStart()
+{
+}
+
+void RmeCoreSched::RenderStart()
+{
+}
+
+void RmeCoreSched::SendCommandsStart()
+{
+ int ret = EndFrameFreq(2, 16);
+ RME_LOGI("[SendCommandsStart]: set EndFrameFreq(2, 16), ret: %{public}d!", ret);
+}
+
+} // namespace RME
+} // OHOS
diff --git a/frameworks/core/frame_aware_collector/src/rme_scene_sched.cpp b/frameworks/core/frame_aware_collector/src/rme_scene_sched.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3698942ec8d6053a919e0da12e604c6401712298
--- /dev/null
+++ b/frameworks/core/frame_aware_collector/src/rme_scene_sched.cpp
@@ -0,0 +1,146 @@
+/*
+ * 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 "rme_scene_sched.h"
+
+namespace OHOS {
+namespace RME {
+
+DEFINE_RMELOG_INTELLISENSE("ueaClient-RmeSceneSched");
+
+RmeSceneSched::RmeSceneSched()
+ :curWorkingStatus(0), rmeCoreSched(nullptr)
+{
+}
+
+RmeSceneSched::~RmeSceneSched()
+{
+ if (rmeCoreSched != nullptr) {
+ delete rmeCoreSched;
+ }
+}
+
+bool RmeSceneSched::Init()
+{
+ if (rmeCoreSched == nullptr) {
+ rmeCoreSched = new RmeCoreSched();
+ }
+
+ curWorkingStatus = 1;
+ if (rmeCoreSched == nullptr) {
+ return false;
+ }
+ RME_LOGI("[Init]:RmeSceneSched init success!");
+ return true;
+}
+
+void RmeSceneSched::BeginFlushAnimation()
+{
+ if (!FrameWindowMgr::GetInstance().GetEnable()) {
+ return;
+ }
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->BeginFlushAnimation();
+ RME_LOGI("[BeginFlushAnimation]:RmeSceneSched send msg success!");
+ }
+}
+
+void RmeSceneSched::EndFlushAnimation()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->EndFlushAnimation();
+ }
+}
+
+void RmeSceneSched::BeginFlushBuild()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->BeginFlushBuild();
+ }
+}
+
+void RmeSceneSched::EndFlushBuild()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->EndFlushBuild();
+ }
+}
+
+void RmeSceneSched::BeginFlushLayout()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->BeginFlushLayout();
+ }
+}
+
+void RmeSceneSched::EndFlushLayout()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->EndFlushLayout();
+ }
+}
+
+void RmeSceneSched::BeginFlushRender()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->BeginFlushRender();
+ }
+}
+
+void RmeSceneSched::EndFlushRender()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->EndFlushRender();
+ }
+}
+
+void RmeSceneSched::BeginProcessPostFlush()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->BeginProcessPostFlush();
+ }
+}
+
+void RmeSceneSched::ProcessCommandsStart()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->ProcessCommandsStart();
+ }
+}
+
+void RmeSceneSched::AnimateStart()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->AnimateStart();
+ }
+}
+
+void RmeSceneSched::RenderStart()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->RenderStart();
+ }
+}
+
+void RmeSceneSched::SendCommandsStart()
+{
+ if (curWorkingStatus == 1) {
+ rmeCoreSched->SendCommandsStart();
+ RME_LOGI("[SendCommandsStart]:RmeSceneSched send msg success!");
+ }
+}
+
+} // namespace RME
+} // namespace OHOS
diff --git a/frameworks/core/frame_aware_policy/include/app_info.h b/frameworks/core/frame_aware_policy/include/app_info.h
new file mode 100644
index 0000000000000000000000000000000000000000..c7eee02b6f582d955602391c7c5d331c833936e1
--- /dev/null
+++ b/frameworks/core/frame_aware_policy/include/app_info.h
@@ -0,0 +1,64 @@
+/*
+ * 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 APP_INFO_H
+#define APP_INFO_H
+
+#include
+
+namespace OHOS {
+namespace RME {
+
+enum class AppState {
+ APP_FOREGROUND,
+ APP_BACKGROUND,
+ APP_TERMINATED,
+ APP_UNKNOWN,
+};
+
+
+class AppInfo {
+public:
+ AppInfo(std::string appName, int pid, int uiTid, int renderTid, int isFocus, AppState state);
+ ~AppInfo() = default;
+
+ void SetRenderTid(const int tid);
+ int GetRenderTid();
+ void SetUiTid(const int tid);
+ int GetUiTid();
+ void SetAppName(const std::string appName);
+ void SetAppState(AppState appState);
+ AppState GetAppState();
+ void SetFocusState(const int isFocus);
+ int GetFocusState();
+ void SetAppPid(const int pid);
+ int GetAppPid();
+ void SetRtgrp(const int grpNum);
+ int GetRtgrp();
+
+private:
+ std::string m_appName;
+ int m_pid;
+ int m_uiTid;
+ int m_renderTid;
+ int m_isFocus;
+ int m_rtgrp;
+ AppState m_appState;
+};
+
+
+} // RME
+} // OHOS
+#endif
diff --git a/frameworks/core/frame_aware_policy/include/app_info_mgr.h b/frameworks/core/frame_aware_policy/include/app_info_mgr.h
new file mode 100644
index 0000000000000000000000000000000000000000..25b8778d014dab8627557edae678fa910301aacf
--- /dev/null
+++ b/frameworks/core/frame_aware_policy/include/app_info_mgr.h
@@ -0,0 +1,53 @@
+/*
+ * 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 APP_INFO_MGR_H
+#define APP_INFO_MGR_H
+
+#include