- HMI_DEBUG("wm", "remove app %s", ctxt->name.c_str());
- // Lookup surfaceID and remove it because App is dead.
- auto pSid = g_afb_instance->app.id_alloc.lookup(ctxt->name.c_str());
- if (pSid)
+ HMI_DEBUG("remove app %s", ctxt->name.c_str());
+
+ // 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)
+ {
+ HMI_ERROR(errmsg);
+ return;
+ }
+ });
+
+ g_afb_instance->wmgr.removeClient(ctxt->name);
+ delete ctxt;
+}
+
+static void createSecurityContext(afb_req req, const char* appid, const char* role)
+{
+ WMClientCtxt *ctxt = (WMClientCtxt *)afb_req_context_get(req);
+ if (!ctxt)