policy: Init policy framework
authorMarius Vlad <marius.vlad@collabora.com>
Tue, 3 Mar 2020 12:25:25 +0000 (14:25 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 4 Mar 2020 11:19:01 +0000 (13:19 +0200)
commit60e91c02c365355a94441eddc1851babeb440c73
tree9cb729f265263cef9e3bc8e272ad50171c920874
parent3b38187d416182306e0533f17a6129a45a168f14
policy: Init policy framework

This patch adds the policy framework, comprised from hooks which a
policy engine can further customize, and which are checked upon surface
creation, commit and activation. Users should create specialized
versions of these callbacks when creating a policy engine.

Further more, it adds a protocol to add states,  events and policy rules.
By default, the protocol has a few known states like 'start' or 'stop', but
also 'show' and 'hide' as events.

A policy rule allow to define the setup in which an event can happen
based on the state of the rule, the action event itself, the application and
(optional) an timeout.

The policy rules are there to specify the state, the event, and
application, but it is ultimately handled by a hook which will be called
to handle the event. The compositor will arrange to pass all that
information back to the handler, so the policy engine is in control to
check in what circumstances the policy rule can be satisfied.

These policy rules allow to handle transitional states which are common
in AGL. For instance:

If one would want to display the application 'navigation' in 3
seconds after and state has been changed to 'start', it should do
add the following rule:

('navigation', STATE_START, SHOW, 3000ms, main_output)

Then, when a 'start' state is propagated to the client shell and the
client shell will relay it back to the compositor (using  the 'apply' request),
will arm an timer to execute the event handler after a 3000ms timeout.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ie03c5f9b1ddb964949e4f9797cbbe2dd2b32a6b6
meson.build
protocol/agl-shell-policy.xml [new file with mode: 0644]
src/desktop.c
src/ivi-compositor.h
src/layout.c
src/policy.c [new file with mode: 0644]
src/policy.h [new file with mode: 0644]