summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 753a4f605f851cea169314a97c1ed92196b4b19f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# agl-compositor

## Policy

The compositor contains an API useful for defining policy rules.  It contains
the bare minimum and installs, by default, an allow-all kind of engine.

Users wanted to create their own policy engine should create a specialized
version and use `struct ivi_policy_api` where they can install their own
callbacks.

The default policy found in src/policy-default.c should more than sufficient to
get started. Users can either re-puporse the default policy or create a new one
entirely different, based on their needs.

### Hooks

These are hooks for allowing creation, committing and activation of surfaces
(and these are ivi_policy_api::surface_create, ivi_policy_api::surface_commited,
ivi_policy_api::surface_activate).

Another hook, ivi_policy_api::policy_rule_allow_to_add can be used to control
if policy rules (the next type) can be added or not. Finally, we have
ivi_policy_api::policy_rule_try_event which is executed in context of policy
rules.

The current, installed hooks, permit all the above, but users can customize
this behaviour by using some sort of database to retrieve the application name
to compare against, or incorporate some kind of policy rule engine.


### Policy rules

Policy (injection) rules can be added using the agl-shell-policy protocol.  The
protocol allows to define policy rules that should be executed by using the
ivi_policy_api::policy_rule_try_event callback. These are particularly useful
when handling state changes. The protocol supports adding new states and events
and the default implementation has code for handling events like showing or
hiding the application specified in the policy rule. The protocol XML file on
contains a few more details than written here.

ivi_policy_api::policy_rule_try_event callback should be adapted and correlated
with the client shell in case additional events and states are added.

By default the server side implementations adds the 'show', and 'hide' events
and the 'start', 'stop' and 'reverse' states. An special type, assigned by
default is 'invalid'. A state change has to be propaged from the client to the
compositor to signal the compositor the change itself, in order to apply the
policy rules.