1# bundlemanager_ecological_rule_manager
2
3### Introduction
4The ecological rule manager service provides a system extension capability, where device manufacturers can control the behavior of applications (such as jumping, adding desktop cards, and installing atomic services) on customized devices (such as 2B cooperation projects), thereby customizing user experiences that meet the manufacturer's control requirements.
5
6### Software Architecture
7![image](figures/architecture.jpg)
8
9The following describes the key fields in the preceding figure:
10
11- `App`: App will be managed by ecological rule manager service when opening atomic services.
12- `AbilityManagerService`: AbilityManagerService is a system service used to coordinate the operational relationships of various capabilities and schedule the lifecycle.
13- `FormManagerService`: FormManagerService is responsible for managing the lifecycle of cards, maintaining card information, and scheduling card events.
14- `BundleManagerService`: BundleManagerService is responsible for managing application installation packages, providing capabilities such as querying, installing, updating, uninstalling, and storing package information for installation packages.
15- `EcologicalRuleManagerService`: EcologicalRuleManagerService is responsible for managing behaviors such as pulling up and adding tables of atomic services.
16
17### Directory Structure
18
19```shell
20/foundation/bundlemanager/ecological_rule_mgr       # EcologicalRuleManagerService code
21├── etc
22│   └── init                                        # SA startup configuration file
23├── interfaces                                      # Interface Code
24│   └── innerkits                                   # Internal interface
25├── profile                                         # Service Profile
26├── services                                        # Service Code
27├── LICENSE                                         # Certificate file
28├── tests                                           # Developer test
29└── utils                                           # Tools
30```
31### build
32
33In the root directory of the OpenHarmony source code, invoke the following command to compile ecological_rule_manager:
34```shell
35./build.sh --product-name rk3568 --ccache --build-target ecological_rule_manager
36```
37> **Note:**
38--product-name: product name, for example, Hi3516D V300 or rk3568.
39--ccache: The cache function is used during compilation.
40--build-target: name of the compiled component.
41
42### Interface Usage Description
43The ecological rule manager service only opens internal interfaces to system services, and the system can expand the interface functions according to actual needs.
44|interface|description|
45|---|---|
46|QueryStartExperience(const Want &want, const CallerInfo &callerInfo, ExperienceRule &rule):int32_t|This interface is provided for AbilityManagerService and invoked when the atomic services is enabled. ExperienceRule is a return value, indicating whether the atomic services can be opened, the specific experience Want can be returned when the value is not allowed.|
47|QueryFreeInstallExperience(const Want &want, const CallerInfo &callerInfo ExperienceRule &rule):int32_t|This interface is provided for BundleManagerService and invoked when the atomic service is installation-free. This parameter is used to determine whether installation-free is allowed, the specific experience Want can be returned when installation-free is not allowed.|
48|IsSupportPublishForm(const vector<AAFwk::Want> &wants, const CallerInfo &callerInfo, bool &bSupport):int32_t|This interface is provided for FormManagerService and invoked when cards are added to tables, which is used to determine whether atomic services can be added to table.|
49|EvaluateResolveInfos(const Want &want, const CallerInfo &callerInfo, int32_t type,std::vector<AbilityInfo> &abilityInfos):int32_t|This interface is provided for AbilityManagerService to filter out prohibited providers.|