X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fapplist.cpp;h=67980f15ee0c92053d4fbfed35d03e1b33a4e7d2;hb=refs%2Fheads%2Fsandbox%2Fruke47%2Flifecycle;hp=79df62c3b3597de2c87d1566348be5818a311c65;hpb=7526846697e4485bca995f01a130f5e34a40b690;p=apps%2Fagl-service-windowmanager.git diff --git a/src/applist.cpp b/src/applist.cpp index 79df62c..67980f1 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -73,6 +73,14 @@ void AppList::addClient(const string &appid, unsigned layer, unsigned surface, c this->clientDump(); } +void AppList::addClient(const string &appid, unsigned layer, const string &role) +{ + std::lock_guard lock(this->mtx); + shared_ptr client = std::make_shared(appid, layer, role); + this->app2client[appid] = client; + this->clientDump(); +} + /** * Remove WMClient from the list * @@ -132,7 +140,14 @@ void AppList::removeSurface(unsigned surface){ */ shared_ptr AppList::lookUpClient(const string &appid) { - return this->app2client.at(appid); + if(this->app2client.count(appid) != 0) + { + return this->app2client.at(appid); + } + else + { + return nullptr; + } } /** @@ -154,17 +169,16 @@ int AppList::countClient() const * Returns AppID if found. * * @param unsigned[in] surfaceID - * @param string[in] role * @param bool[in,out] AppID is found or not * @return AppID * @attention If AppID is not found, param found will be false. */ -string AppList::getAppID(unsigned surface, const string& role, bool* found) const +string AppList::getAppID(unsigned surface, bool* found) const { *found = false; for (const auto &x : this->app2client) { - if(x.second->surfaceID(role) == surface){ + if(x.second->surfaceID() == surface){ *found = true; return x.second->appID(); } @@ -296,6 +310,10 @@ const vector &AppList::getActions(unsigned req_num, bool* found } } HMI_SEQ_ERROR(req_num, "Couldn't get action with the request : %d", req_num); + { + static vector empty; + return empty; + } } /**