1378b89b0Sopenharmony_ci# bundlemanager_ecological_rule_manager
2378b89b0Sopenharmony_ci
3378b89b0Sopenharmony_ci### 简介
4378b89b0Sopenharmony_ci生态规则管控服务提供一种系统的扩展能力,设备厂商可以在定制设备上(2B合作项目等),对应用的行为(跳转、添加桌面卡片、免安装元服务)进行管控,从而定制出满足厂商管控要求的用户体验。
5378b89b0Sopenharmony_ci
6378b89b0Sopenharmony_ci
7378b89b0Sopenharmony_ci### 软件架构
8378b89b0Sopenharmony_ci![image](figures/architecture_zh.jpg)
9378b89b0Sopenharmony_ci
10378b89b0Sopenharmony_ci以下是对于上图关键字段的描述信息:
11378b89b0Sopenharmony_ci
12378b89b0Sopenharmony_ci- `App`:App,在打开元服务时会受到生态规则服务的管控。
13378b89b0Sopenharmony_ci- `AbilityManagerService`:元能力管理服务,用于协调各Ability运行关系、及对生命周期进行调度的系统服务。 
14378b89b0Sopenharmony_ci- `FormManagerService`:卡片管理服务,管理卡片的生命周期,并维护卡片信息以及卡片事件的调度。
15378b89b0Sopenharmony_ci- `BundleManagerService`:包管理服务,负责应用安装包的管理,提供安装包的信息查询、安装、更新、卸载和包信息存储等能力。
16378b89b0Sopenharmony_ci- `EcologicalRuleManagerService`:生态规则管控服务,对元服务的拉起,加桌等行为进行管控。
17378b89b0Sopenharmony_ci
18378b89b0Sopenharmony_ci
19378b89b0Sopenharmony_ci### 目录结构
20378b89b0Sopenharmony_ci
21378b89b0Sopenharmony_ci```shell
22378b89b0Sopenharmony_ci/foundation/bundlemanager/ecological_rule_mgr       # 生态规则管控服务业务代码
23378b89b0Sopenharmony_ci├── etc                                             
24378b89b0Sopenharmony_ci│   └── init                                        # SA启动配置文件
25378b89b0Sopenharmony_ci├── interfaces                                      # 接口代码
26378b89b0Sopenharmony_ci│   └── innerkits                                   # 内部接口
27378b89b0Sopenharmony_ci├── profile                                         # 服务配置文件
28378b89b0Sopenharmony_ci├── services                                        # 服务代码
29378b89b0Sopenharmony_ci├── LICENSE                                         # 证书文件
30378b89b0Sopenharmony_ci├── tests                                           # 开发者测试
31378b89b0Sopenharmony_ci└── utils                                           # 工具类
32378b89b0Sopenharmony_ci```
33378b89b0Sopenharmony_ci### 编译构建
34378b89b0Sopenharmony_ci
35378b89b0Sopenharmony_ci在OpenHarmony源码根目录下,调用以下指令,单独编译ecological_rule_manager。
36378b89b0Sopenharmony_ci```shell
37378b89b0Sopenharmony_ci./build.sh --product-name rk3568 --ccache --build-target ecological_rule_manager
38378b89b0Sopenharmony_ci```
39378b89b0Sopenharmony_ci> **说明:**
40378b89b0Sopenharmony_ci--product-name:产品名称,例如Hi3516DV300、rk3568等。
41378b89b0Sopenharmony_ci--ccache:编译时使用缓存功能。
42378b89b0Sopenharmony_ci--build-target: 编译的部件名称。
43378b89b0Sopenharmony_ci
44378b89b0Sopenharmony_ci### 接口使用说明
45378b89b0Sopenharmony_ci生态规则管控服务只对系统服务开放内部接口,系统根据实际需要进行接口功能扩展。
46378b89b0Sopenharmony_ci|接口|说明|
47378b89b0Sopenharmony_ci|---|---|
48378b89b0Sopenharmony_ci|QueryStartExperience(const Want &want, const CallerInfo &callerInfo, ExperienceRule &rule):int32_t|提供给AbilityManagerService使用,在元服务打开时调用。ExperienceRule为返回值,返回是否允许打开;不允许时可以返回具体的体验Want。|
49378b89b0Sopenharmony_ci|QueryFreeInstallExperience(const Want &want, const CallerInfo &callerInfo ExperienceRule &rule):int32_t|提供给BundleManagerService使用,在元服务免安装时调用。用于判断是否允许免安装,不允许时可以返回具体的体验Want。|
50378b89b0Sopenharmony_ci|IsSupportPublishForm(const vector<AAFwk::Want> &wants, const CallerInfo &callerInfo, bool &bSupport):int32_t|提供给FormManagerService使用,在卡片加桌时调用。用于判断是否允许加桌|
51378b89b0Sopenharmony_ci|EvaluateResolveInfos(const Want &want, const CallerInfo &callerInfo, int32_t type,std::vector<AbilityInfo> &abilityInfos):int32_t|提供给AbilityManagerService使用,支持过滤掉禁止出现的提供者|
52378b89b0Sopenharmony_ci
53