diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-10-15 19:27:28 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-10-15 19:27:28 +0900 |
commit | 7526846697e4485bca995f01a130f5e34a40b690 (patch) | |
tree | b29e459600864bbdec00e2a4f26326a3a35d5b68 /src | |
parent | 3621896847fba3b793b998262eb66ae43cee93ff (diff) |
Include WMClient into WMRequest
Policy Manager has to know
*who* requests *which role* with *which role*.
So for improvement of usability of WMRequest instead of appid.
Change-Id: I452b2995922e8e303732e8e79f4f06930553b3e7
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r-- | src/applist.cpp | 10 | ||||
-rw-r--r-- | src/applist.hpp | 2 | ||||
-rw-r--r-- | src/pm_wrapper.cpp | 9 | ||||
-rw-r--r-- | src/request.hpp | 6 | ||||
-rw-r--r-- | src/window_manager.cpp | 19 |
5 files changed, 28 insertions, 18 deletions
diff --git a/src/applist.cpp b/src/applist.cpp index f0dade0..79df62c 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -65,7 +65,7 @@ AppList::~AppList() {} * @attention This function should be called once for the app * Caller should take care not to be called more than once. */ -void AppList::addClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role) +void AppList::addClient(const string &appid, unsigned layer, unsigned surface, const string &role) { std::lock_guard<std::mutex> lock(this->mtx); shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, layer, surface, role); @@ -351,7 +351,7 @@ WMError AppList::setAction(unsigned req_num, const struct WMAction &action) * otherwise (visible is false) app should be invisible. Then enddraw_finished param is set to true. * This function doesn't support actions for focus yet. */ -WMError AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, TaskVisible visible) +WMError AppList::setAction(unsigned req_num, shared_ptr<WMClient> client, const string &role, const string &area, TaskVisible visible) { std::lock_guard<std::mutex> lock(this->mtx); WMError result = WMError::FAIL; @@ -363,7 +363,7 @@ WMError AppList::setAction(unsigned req_num, const string &appid, const string & } // If visible task is not invisible, redraw is required -> true bool edraw_f = (visible != TaskVisible::INVISIBLE) ? false : true; - WMAction action{appid, role, area, visible, edraw_f}; + WMAction action{req_num, client, role, area, visible, edraw_f}; x.sync_draw_req.push_back(action); result = WMError::SUCCESS; @@ -399,7 +399,7 @@ bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const st { for (auto &y : x.sync_draw_req) { - if (y.appid == appid && y.role == role) + if (y.client->appID() == appid && y.role == role) { HMI_SEQ_INFO(req_num, "Role %s finish redraw", y.role.c_str()); y.end_draw_finished = true; @@ -514,7 +514,7 @@ void AppList::reqDump() { DUMP( "Action : (APPID :%s, ROLE :%s, AREA :%s, VISIBLE : %s, END_DRAW_FINISHED: %d)", - y.appid.c_str(), + y.client->appID().c_str(), y.role.c_str(), y.area.c_str(), (y.visible == TaskVisible::INVISIBLE) ? "invisible" : "visible", diff --git a/src/applist.hpp b/src/applist.hpp index a794b53..54ccdd1 100644 --- a/src/applist.hpp +++ b/src/applist.hpp @@ -56,7 +56,7 @@ class AppList unsigned getRequestNumber(const std::string &appid) const; unsigned addRequest(WMRequest req); WMError setAction(unsigned req_num, const struct WMAction &action); - WMError setAction(unsigned req_num, const std::string &appid, + WMError setAction(unsigned req_num, std::shared_ptr<WMClient> client, const std::string &role, const std::string &area, TaskVisible visible); bool setEndDrawFinished(unsigned req_num, const std::string &appid, const std::string &role); bool endDrawFullfilled(unsigned req_num); diff --git a/src/pm_wrapper.cpp b/src/pm_wrapper.cpp index d71e91f..8706128 100644 --- a/src/pm_wrapper.cpp +++ b/src/pm_wrapper.cpp @@ -192,7 +192,8 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc bool end_draw_finished = false; WMAction act { - "", + 0, + nullptr, role_name, area_name, TaskVisible::VISIBLE, @@ -214,7 +215,8 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc bool end_draw_finished = false; WMAction act { - "", + 0, + nullptr, role_name, area_name, TaskVisible::VISIBLE, @@ -238,7 +240,8 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc bool end_draw_finished = true; WMAction act { - "", + 0, + nullptr, i_prv.first, "", TaskVisible::INVISIBLE, diff --git a/src/request.hpp b/src/request.hpp index 6b2bda1..073dd27 100644 --- a/src/request.hpp +++ b/src/request.hpp @@ -19,10 +19,13 @@ #include <string> #include <vector> +#include <memory> namespace wm { +class WMClient; + enum Task { TASK_ALLOCATE, @@ -47,7 +50,8 @@ struct WMTrigger struct WMAction { - std::string appid; + unsigned req_num; + std::shared_ptr<WMClient> client; std::string role; std::string area; TaskVisible visible; diff --git a/src/window_manager.cpp b/src/window_manager.cpp index fe8cdce..3e1a8bc 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -673,7 +673,9 @@ void WindowManager::startTransitionWrapper(vector<WMAction> &actions) goto error; } } - act.appid = appid; + auto client = g_app_list.lookUpClient(appid); + act.req_num = req_num; + act.client = client; } ret = g_app_list.setAction(req_num, act); @@ -1129,9 +1131,9 @@ WMError WindowManager::startTransition(unsigned req_num) // Make it deactivate here for (const auto &x : actions) { - if (g_app_list.contains(x.appid)) + if (g_app_list.contains(x.client->appID())) { - auto client = g_app_list.lookUpClient(x.appid); + auto client = g_app_list.lookUpClient(x.client->appID()); this->deactivate(client->surfaceID(x.role)); } } @@ -1160,7 +1162,7 @@ WMError WindowManager::doEndDraw(unsigned req_num) if(act.visible != TaskVisible::NO_CHANGE) { // layout change - if(!g_app_list.contains(act.appid)){ + if(!g_app_list.contains(act.client->appID())){ ret = WMError::NOT_REGISTERED; } ret = this->layoutChange(act); @@ -1207,7 +1209,7 @@ WMError WindowManager::layoutChange(const WMAction &action) // Visibility is not change -> no redraw is required return WMError::SUCCESS; } - auto client = g_app_list.lookUpClient(action.appid); + auto client = g_app_list.lookUpClient(action.client->appID()); unsigned surface = client->surfaceID(action.role); if (surface == 0) { @@ -1223,10 +1225,11 @@ WMError WindowManager::layoutChange(const WMAction &action) WMError WindowManager::visibilityChange(const WMAction &action) { HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), "Change visibility"); - if(!g_app_list.contains(action.appid)){ + if(!g_app_list.contains(action.client->appID())) + { return WMError::NOT_REGISTERED; } - auto client = g_app_list.lookUpClient(action.appid); + auto client = g_app_list.lookUpClient(action.client->appID()); unsigned surface = client->surfaceID(action.role); if(surface == 0) { @@ -1268,7 +1271,7 @@ void WindowManager::emitScreenUpdated(unsigned req_num) { if(action.visible != TaskVisible::INVISIBLE) { - json_object_array_add(jarray, json_object_new_string(action.appid.c_str())); + json_object_array_add(jarray, json_object_new_string(action.client->appID().c_str())); } } json_object_object_add(j, kKeyIds, jarray); |