+void App::stop_timer()
+{
+ unsigned req_num = g_app_list.currentRequestNumber();
+ HMI_SEQ_DEBUG(req_num, "Timer stop");
+ int rc = sd_event_source_set_enabled(g_timer_ev_src, SD_EVENT_OFF);
+ if (rc < 0)
+ {
+ HMI_SEQ_ERROR(req_num, "Timer stop failed");
+ }
+}
+
+WMError App::lm_release(const struct WMAction &action)
+{
+ //auto const &surface_id = this->lookup_id(drawing_name);
+ WMError ret = WMError::LAYOUT_CHANGE_FAIL;
+ unsigned req_num = g_app_list.currentRequestNumber();
+ auto const &surface_id = this->lookup_id(action.role.c_str());
+ if (!surface_id)
+ {
+ HMI_SEQ_ERROR(req_num, "Surface does not exist");
+ return ret;
+ }
+
+ if (*surface_id == this->layers.main_surface)
+ {
+ HMI_SEQ_ERROR(req_num, "Cannot deactivate main_surface");
+ return ret;
+ }
+
+ auto o_state = *this->layers.get_layout_state(*surface_id);
+
+ if (o_state == nullptr)
+ {
+ HMI_SEQ_ERROR(req_num, "Could not find layer for surface");
+ return ret;
+ }
+
+ struct LayoutState &state = *o_state;
+
+ if (state.main == -1)
+ {
+ HMI_SEQ_ERROR(req_num, "No surface active");
+ return ret;
+ }
+
+ // Check against main_surface, main_surface_name is the configuration item.
+ if (*surface_id == this->layers.main_surface)
+ {
+ HMI_SEQ_DEBUG(req_num, "Refusing to deactivate main_surface %d", *surface_id);
+ //reply(nullptr);
+ return WMError::SUCCESS;
+ }
+ if ((state.main == *surface_id) && (state.sub == *surface_id))
+ {
+ HMI_SEQ_ERROR(req_num, "Surface is not active");
+ return ret;
+ }
+
+ if (state.main == *surface_id)
+ {
+ if (state.sub != -1)
+ {
+ this->try_layout(
+ state, LayoutState{state.sub, -1}, [&](LayoutState const &nl) {
+ std::string sub = std::move(*this->lookup_name(state.sub));
+
+ this->deactivate(*surface_id);
+ this->surface_set_layout(state.sub);
+ state = nl;
+
+ this->layout_commit();
+ std::string str_area = std::string(kNameLayoutNormal) + "." + std::string(kNameAreaFull);
+ compositor::rect area_rect = this->area_info[state.sub];
+ this->emit_syncdraw(sub.c_str(), str_area.c_str(),
+ area_rect.x, area_rect.y, area_rect.w, area_rect.h);
+ this->enqueue_flushdraw(state.sub);
+ });
+ }
+ else
+ {
+ this->try_layout(state, LayoutState{-1, -1}, [&](LayoutState const &nl) {
+ this->deactivate(*surface_id);
+ state = nl;
+ this->layout_commit();
+ });
+ }
+ }
+ else if (state.sub == *surface_id)
+ {
+ this->try_layout(
+ state, LayoutState{state.main, -1}, [&](LayoutState const &nl) {
+ std::string main = std::move(*this->lookup_name(state.main));
+
+ this->deactivate(*surface_id);
+ this->surface_set_layout(state.main);
+ state = nl;
+
+ this->layout_commit();
+ std::string str_area = std::string(kNameLayoutNormal) + "." + std::string(kNameAreaFull);
+ compositor::rect area_rect = this->area_info[state.main];
+ this->emit_syncdraw(main.c_str(), str_area.c_str(),
+ area_rect.x, area_rect.y, area_rect.w, area_rect.h);
+ this->enqueue_flushdraw(state.main);
+ });
+ }
+ return WMError::SUCCESS;
+}
+
+WMError App::lm_layout_change(const struct WMAction &action)
+{
+ const char *msg = this->check_surface_exist(action.role.c_str());
+
+ /*
+ lm_.updateLayout(action);
+ TODO: emit syncDraw with application*/
+ if (msg)
+ {
+ HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), msg);
+ return WMError::LAYOUT_CHANGE_FAIL;
+ }
+ this->lm_layout_change(action.role.c_str());
+ return WMError::SUCCESS;
+}
+
+WMError App::do_transition(unsigned req_num)