diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.cpp | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/src/app.cpp b/src/app.cpp index 831f13f..b029601 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -653,7 +653,7 @@ WMError App::startTransition(unsigned req_num) if (action.visible != TaskVisible::INVISIBLE) { sync_draw_happen = true; - this->emit_syncdraw(y.role, y.area); + this->emit_syncdraw(action.role, action.area); /* TODO: emit event for app not subscriber if(g_app_list.contains(y.appid)) g_app_list.lookUpClient(y.appid)->emit_syncdraw(y.role, y.area); */ @@ -670,7 +670,7 @@ WMError App::startTransition(unsigned req_num) // Make it deactivate here for (const auto &x : actions) { - if (g_app_list.contains(z.appid)) + if (g_app_list.contains(x.appid)) { auto client = g_app_list.lookUpClient(x.appid); this->deactivate(client->surfaceID(x.role)); @@ -939,8 +939,7 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char //this->emit_error() HMI_SEQ_ERROR(req_num, errorDescription(ret)); g_app_list.removeRequest(req_num); - g_app_list.next(); - g_app_list.reqDump(); + this->processNextRequest(); } } @@ -954,51 +953,38 @@ void App::api_deactivate_surface(char const *appid, char const *drawing_name, co std::string id = appid; std::string role = drawing_name; std::string area = ""; //drawing_area; + Task task = Task::TASK_RELEASE; + unsigned req_num = 0; + WMError ret = WMError::UNKNOWN; - if (!g_app_list.contains(id)) - { - reply("app doesn't request 'requestSurface' yet"); - return; - } - auto client = g_app_list.lookUpClient(id); + ret = this->setRequest(id, role, area, task, &req_num); - /* - * Queueing Phase - */ - unsigned current = g_app_list.currentRequestNumber(); - unsigned requested_num = g_app_list.getRequestNumber(id); - if (requested_num != 0) + if (ret != WMError::SUCCESS) { - HMI_SEQ_INFO(requested_num, "%s %s %s request is already queued", id.c_str(), role.c_str(), area.c_str()); - reply("already requested"); + HMI_ERROR("wm", errorDescription(ret)); + reply("Failed to set request"); return; } - WMRequest req = WMRequest(id, role, area, Task::TASK_RELEASE); - unsigned new_req = g_app_list.addAllocateRequest(req); - g_app_list.reqDump(); - - HMI_SEQ_DEBUG(current, "%s start sequence with %s, %s", id.c_str(), role.c_str(), area.c_str()); - reply(nullptr); - if (new_req != current) + if (req_num != g_app_list.currentRequestNumber()) { // Add request, then invoked after the previous task is finished - HMI_SEQ_DEBUG(new_req, "request is accepted"); + HMI_SEQ_DEBUG(req_num, "request is accepted"); return; } /* * Do allocate tasks */ - WMError ret = this->doTransition(new_req); + ret = this->doTransition(req_num); if (ret != WMError::SUCCESS) { - HMI_SEQ_ERROR(new_req, errorDescription(ret)); - g_app_list.removeRequest(new_req); - g_app_list.next(); //this->emit_error() + HMI_SEQ_ERROR(req_num, errorDescription(ret)); + g_app_list.removeRequest(req_num); + this->processNextRequest(); } } |