aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-07-09 17:23:31 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-08-15 10:46:04 +0900
commitc1d85371b1eb693128cf9553c356ea77e609d9a3 (patch)
treef4e69885b1c7c5e4116cf4eea7e5237412ce82c0 /src/main.cpp
parent38255dcda8e7e9462ed3b16ebe39c638bc9b349f (diff)
Readd Policy Manager as plugin
This patch reverts commit c6f9a9b8468b3746a3dec7ee2a0b7d84ec9fb44a and update it. Policy Manager decides next layout by inputed event and current state based on the policy table. And Policy Manager is plugin for Window Manager. Therefore the OEMs can replace it. This patch provides Policy Manager I/F as reference implementation and does not have policy table. Therefore Policy Manager updates each layers to draw the applications in requested area in accordance with just like activate/deactivate request. [APIs of Policy Manager class] - int initialize(void) Initialize Policy Manger. in: none out: 0(success), -1(error) - void registerCallback(CallbackTable callback_table) Register callback functions. in: the pointers of callback handlers out: none "CallbackTable" type is as follows: typedef struct { Handler onStateTransitioned; Handler onError; } CallbackTable; "Handler" type is as follows: using Handler = std::function<void(json_object *)>; - int setInputEventData(json_object *json_in) Set input event data for the policy table. in: input event data as json_object out: 0(success), -1(error) - int executeStateTransition(void) Execute state transition by using set input event data. in: none out: 0(success), -1(error) - void undoState(void) Undo state only once per once state transition. in: none out: none [Callbacks of Policy Manager class] - void onStateTransitioned(json_object *json_out) When state transition succeeds, this callback is called. The argument json_out has the state after transition. - void onError(json_object *json_out) When state transition fails, this callback is called. The argument json_out has the error information like message, inputed event datas and etc.. Bug-AGL: SPEC-1537 Change-Id: Ib8c71f2e544cb90b6763d07fad56dc1c453e9a97 Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 261df8b..0447f86 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -184,27 +184,19 @@ static void cbRemoveClientCtxt(void *data)
return;
}
HMI_DEBUG("wm", "remove app %s", ctxt->name.c_str());
- // Lookup surfaceID and remove it because App is dead.
- auto pSid = g_afb_instance->wmgr.id_alloc.lookup(ctxt->role.c_str());
- if (pSid)
- {
- auto sid = *pSid;
- auto o_state = *g_afb_instance->wmgr.layers.get_layout_state(sid);
- if (o_state != nullptr)
- {
- if (o_state->main == sid)
- {
- o_state->main = -1;
- }
- else if (o_state->sub == sid)
+
+ // Policy Manager does not know this app was killed,
+ // so notify it by deactivate request.
+ g_afb_instance->wmgr.api_deactivate_surface(
+ ctxt->name.c_str(), ctxt->role.c_str(),
+ [](const char *errmsg) {
+ if (errmsg != nullptr)
{
- o_state->sub = -1;
+ HMI_ERROR("wm", errmsg);
+ return;
}
- }
- g_afb_instance->wmgr.id_alloc.remove_id(sid);
- g_afb_instance->wmgr.layers.remove_surface(sid);
- HMI_DEBUG("wm", "delete surfaceID %d", sid);
- }
+ });
+
g_afb_instance->wmgr.removeClient(ctxt->name);
delete ctxt;
}