policy: Init policy framework API 97/24197/4
authorMarius Vlad <marius.vlad@collabora.com>
Tue, 3 Mar 2020 12:25:25 +0000 (14:25 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 11 Mar 2020 14:44:10 +0000 (16:44 +0200)
commit98457c49f5d777e4023082363b814826c21092df
treedb4cfc6b901a801d6d9d9ae68e1494c4db83d61d
parentfe3358fa9b560a43ed9a46e50128ec99b2624ab5
policy: Init policy framework API

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/desining a policy engine.

Further more, it adds the posibility to further customize the policy
engine by adding new states, events and policy rules.
By default, the policy API is aware of known states like 'start' or
'stop', but also 'show' and 'hide' as events.

A policy rule would allow to define the setup in which an event can happen
based on the state of the rule compared to that of the system, 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 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, EVENT_SHOW, timeout, main_output)

Then, when a 'STATE_START' state is propagated to the compositor the
policy API will trigger a state change signal which in turn wil arm an
timer to execute the event handler after a timeout 'timeout'.

Bug-AGL: SPEC-3217

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ie03c5f9b1ddb964949e4f9797cbbe2dd2b32a6b6
meson.build
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]