summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/app_service_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/app_service_manager.cc')
-rw-r--r--src/components/application_manager/src/app_service_manager.cc28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
index c16311a087..1711180980 100644
--- a/src/components/application_manager/src/app_service_manager.cc
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -39,7 +39,6 @@
#include "application_manager/application_manager.h"
#include "application_manager/commands/command_impl.h"
#include "application_manager/message_helper.h"
-#include "application_manager/rpc_passing_handler.h"
#include "application_manager/smart_object_keys.h"
#include "encryption/hashing.h"
#include "resumption/last_state.h"
@@ -104,7 +103,8 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
}
}
}
- app_service.default_service = GetPolicyAppID(app_service) == default_app_id;
+ app_service.default_service =
+ !default_app_id.empty() && GetPolicyAppID(app_service) == default_app_id;
auto ret = published_services_.insert(
std::pair<std::string, AppService>(service_id, app_service));
@@ -376,7 +376,9 @@ bool AppServiceManager::DeactivateAppService(const std::string service_id) {
const std::string service_type =
service[strings::service_manifest][strings::service_type].asString();
auto embedded_service = EmbeddedServiceForType(service_type);
- if (embedded_service) {
+ if (embedded_service &&
+ embedded_service->record[strings::service_id].asString() !=
+ service[strings::service_id].asString()) {
embedded_service->record[strings::service_active] = true;
AppServiceUpdated(embedded_service->record,
mobile_apis::ServiceUpdateReason::ACTIVATED,
@@ -424,19 +426,6 @@ AppService* AppServiceManager::EmbeddedServiceForType(
return NULL;
}
-AppService* AppServiceManager::FindServiceByName(const std::string name) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(published_services_lock_);
- for (auto it = published_services_.begin(); it != published_services_.end();
- ++it) {
- if (it->second.record[strings::service_manifest][strings::service_name]
- .asString() == name) {
- return &(it->second);
- }
- }
- return NULL;
-}
-
AppService* AppServiceManager::FindServiceByPolicyAppID(
const std::string policy_app_id, const std::string type) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -548,13 +537,12 @@ void AppServiceManager::AppServiceUpdated(
services[-1] = service;
}
-std::vector<std::pair<std::string, AppService> >
-AppServiceManager::GetActiveServices() {
- std::vector<std::pair<std::string, AppService> > active_services;
+std::vector<AppService> AppServiceManager::GetActiveServices() {
+ std::vector<AppService> active_services;
for (auto it = published_services_.begin(); it != published_services_.end();
++it) {
if (it->second.record[strings::service_active].asBool()) {
- active_services.push_back(*it);
+ active_services.push_back(it->second);
}
}
return active_services;