diff options
Diffstat (limited to 'src/components/application_manager/src')
10 files changed, 67 insertions, 35 deletions
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 1168d94245..8a611195c7 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -116,6 +116,7 @@ ApplicationImpl::ApplicationImpl( , has_been_activated_(false) , tts_properties_in_none_(false) , tts_properties_in_full_(false) + , keep_context_(false) , is_foreground_(false) , is_application_data_changed_(false) , put_file_in_none_count_(0) @@ -438,6 +439,14 @@ bool ApplicationImpl::tts_properties_in_full() { return tts_properties_in_full_; } +void ApplicationImpl::set_keep_context(bool keep_context) { + keep_context_ = keep_context; +} + +bool ApplicationImpl::keep_context() { + return keep_context_; +} + void ApplicationImpl::set_video_streaming_approved(bool state) { video_streaming_approved_ = state; } diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index eaac84dcf2..24f27af2e2 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -1126,7 +1126,14 @@ void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app, << ". Changing device id to " << device_id); + bool is_subscribed_to_way_points = IsAppSubscribedForWayPoints(app); + if (is_subscribed_to_way_points) { + UnsubscribeAppFromWayPoints(app); + } SwitchApplicationParameters(app, connection_key, device_id, mac_address); + if (is_subscribed_to_way_points) { + SubscribeAppForWayPoints(app); + } // Normally this is done during registration, however since switched apps are // not being registered again need to set protocol version on session. @@ -1691,10 +1698,21 @@ void ApplicationManagerImpl::TerminateRequest(const uint32_t connection_key, } void ApplicationManagerImpl::RemoveHMIFakeParameters( - application_manager::commands::MessageSharedPtr& message) { + application_manager::commands::MessageSharedPtr& message, + const hmi_apis::FunctionID::eType& function_id) { LOG4CXX_AUTO_TRACE(logger_); hmi_apis::HMI_API factory; + if (!(*message)[jhs::S_PARAMS].keyExists(jhs::S_FUNCTION_ID)) { + LOG4CXX_ERROR(logger_, + "RemoveHMIFakeParameters message missing function id"); + return; + } + mobile_apis::FunctionID::eType mobile_function_id = + static_cast<mobile_apis::FunctionID::eType>( + (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); + (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = function_id; factory.attachSchema(*message, true); + (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = mobile_function_id; } bool ApplicationManagerImpl::Init(resumption::LastState& last_state, @@ -2685,7 +2703,7 @@ void ApplicationManagerImpl::OnAppStreaming( media_manager_->StartStreaming(app_id, service_type); } else { media_manager_->StopStreaming(app_id, service_type); - state_ctrl_.OnVideoStreamingStarted(app); + state_ctrl_.OnVideoStreamingStopped(app); } } @@ -3471,6 +3489,7 @@ void ApplicationManagerImpl::SubscribeAppForWayPoints( ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); + LOG4CXX_DEBUG(logger_, "Subscribing " << app->app_id()); subscribed_way_points_apps_list_.insert(app->app_id()); LOG4CXX_DEBUG(logger_, "There are applications subscribed: " @@ -3481,6 +3500,7 @@ void ApplicationManagerImpl::UnsubscribeAppFromWayPoints( ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); + LOG4CXX_DEBUG(logger_, "Unsubscribing " << app->app_id()); subscribed_way_points_apps_list_.erase(app->app_id()); LOG4CXX_DEBUG(logger_, "There are applications subscribed: " @@ -3496,7 +3516,7 @@ bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const { return !subscribed_way_points_apps_list_.empty(); } -const std::set<int32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints() +const std::set<uint32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints() const { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index aa4c979ae7..7be9668543 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -199,16 +199,17 @@ mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const { AudioSource::AudioSource(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) - : HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE) {} + : HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE) + , keep_context_(app->keep_context()) { + app_->set_keep_context(false); +} mobile_apis::HMILevel::eType AudioSource::hmi_level() const { // Checking for NONE is necessary to avoid issue during // calculation of HMI level during setting default HMI level - if (mobile_apis::HMILevel::HMI_NONE == parent()->hmi_level()) { - return mobile_apis::HMILevel::HMI_NONE; - } - if (mobile_apis::HMILevel::HMI_FULL == parent()->hmi_level()) { - return mobile_apis::HMILevel::HMI_FULL; + if (keep_context_ || + mobile_apis::HMILevel::HMI_NONE == parent()->hmi_level()) { + return parent()->hmi_level(); } return mobile_apis::HMILevel::HMI_BACKGROUND; diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index a52cb52fbe..e99db3bece 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -2521,6 +2521,7 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result, void MessageHelper::SendOnStatusUpdate(const std::string& status, ApplicationManager& app_mngr) { + LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr message = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -2533,6 +2534,7 @@ void MessageHelper::SendOnStatusUpdate(const std::string& status, (*message)[strings::params][strings::message_type] = MessageType::kNotification; + LOG4CXX_DEBUG(logger_, "Sending new status:" << status); (*message)[strings::msg_params]["status"] = status; app_mngr.GetRPCService().ManageHMICommand(message); diff --git a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc index bbd0011298..712b91afe7 100644 --- a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc +++ b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc @@ -54,6 +54,7 @@ RPCPluginPtr LoadPlugin(const std::string& full_plugin_path) { return RPCPluginPtr(); } RPCPlugin* plugin = create_plugin(); + dlclose(plugin_dll); return RPCPluginPtr(plugin); } diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index cbc434a485..1b64c5d7b4 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -951,6 +951,7 @@ void PolicyHandler::OnVehicleDataUpdated( void PolicyHandler::OnPendingPermissionChange( const std::string& policy_app_id) { + LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "PolicyHandler::OnPendingPermissionChange for " << policy_app_id); @@ -989,8 +990,6 @@ void PolicyHandler::OnPendingPermissionChange( if (permissions.appPermissionsConsentNeeded) { MessageHelper::SendOnAppPermissionsChangedNotification( app->app_id(), permissions, application_manager_); - - policy_manager_->RemovePendingPermissionChanges(policy_app_id); // "Break" statement has to be here to continue processing in case of // there is another "true" flag in permissions struct break; @@ -1000,8 +999,6 @@ void PolicyHandler::OnPendingPermissionChange( if (permissions.isAppPermissionsRevoked) { MessageHelper::SendOnAppPermissionsChangedNotification( app->app_id(), permissions, application_manager_); - - policy_manager_->RemovePendingPermissionChanges(policy_app_id); } break; } @@ -1022,15 +1019,14 @@ void PolicyHandler::OnPendingPermissionChange( commands::Command::SOURCE_SDL); application_manager_.OnAppUnauthorized(app->app_id()); - - policy_manager_->RemovePendingPermissionChanges(policy_app_id); } if (permissions.requestTypeChanged || permissions.requestSubTypeChanged) { MessageHelper::SendOnAppPermissionsChangedNotification( app->app_id(), permissions, application_manager_); - policy_manager_->RemovePendingPermissionChanges(policy_app_id); } + + policy_manager_->RemovePendingPermissionChanges(policy_app_id); } bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string, diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc index 28c773ffcb..111a95f7fb 100644 --- a/src/components/application_manager/src/request_controller.cc +++ b/src/components/application_manager/src/request_controller.cc @@ -274,7 +274,7 @@ void RequestController::OnMobileResponse(const uint32_t mobile_correlation_id, void RequestController::OnHMIResponse(const uint32_t correlation_id, const int32_t function_id) { LOG4CXX_AUTO_TRACE(logger_); - TerminateRequest(correlation_id, RequestInfo::HmiConnectoinKey, function_id); + TerminateRequest(correlation_id, RequestInfo::HmiConnectionKey, function_id); } void RequestController::terminateWaitingForExecutionAppRequests( @@ -321,7 +321,7 @@ void RequestController::terminateAppRequests(const uint32_t& app_id) { void RequestController::terminateAllHMIRequests() { LOG4CXX_AUTO_TRACE(logger_); - terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectoinKey); + terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectionKey); } void RequestController::terminateAllMobileRequests() { @@ -401,7 +401,7 @@ void RequestController::TimeoutThread() { LOG4CXX_DEBUG(logger_, "Timeout for " << (RequestInfo::HMIRequest == - probably_expired->requst_type() + probably_expired->request_type() ? "HMI" : "Mobile") << " request id: " << probably_expired->requestId() @@ -420,7 +420,7 @@ void RequestController::TimeoutThread() { LOG4CXX_INFO(logger_, "Timeout for " << (RequestInfo::HMIRequest == - probably_expired->requst_type() + probably_expired->request_type() ? "HMI" : "Mobile") << " request id: " << probably_expired->requestId() @@ -430,7 +430,7 @@ void RequestController::TimeoutThread() { const uint32_t experied_app_id = probably_expired->app_id(); probably_expired->request()->onTimeOut(); - if (RequestInfo::HmiConnectoinKey == probably_expired->app_id()) { + if (RequestInfo::HmiConnectionKey == probably_expired->app_id()) { LOG4CXX_DEBUG(logger_, "Erase HMI request: " << probably_expired->requestId()); waiting_for_response_.RemoveRequest(probably_expired); diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index 45e56c5f9e..4f1e0a8f07 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -42,12 +42,12 @@ namespace request_controller { CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController") -uint32_t RequestInfo::HmiConnectoinKey = 0; +uint32_t RequestInfo::HmiConnectionKey = 0; HMIRequestInfo::HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec) : RequestInfo(request, HMIRequest, timeout_msec) { correlation_id_ = request_->correlation_id(); - app_id_ = RequestInfo::HmiConnectoinKey; + app_id_ = RequestInfo::HmiConnectionKey; } HMIRequestInfo::HMIRequestInfo(RequestPtr request, @@ -55,7 +55,7 @@ HMIRequestInfo::HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec) : RequestInfo(request, HMIRequest, start_time, timeout_msec) { correlation_id_ = request_->correlation_id(); - app_id_ = RequestInfo::HmiConnectoinKey; + app_id_ = RequestInfo::HmiConnectionKey; } MobileRequestInfo::MobileRequestInfo(RequestPtr request, @@ -74,12 +74,12 @@ MobileRequestInfo::MobileRequestInfo(RequestPtr request, } RequestInfo::RequestInfo(RequestPtr request, - const RequestInfo::RequestType requst_type, + const RequestInfo::RequestType request_type, const date_time::TimeDuration& start_time, const uint64_t timeout_msec) : request_(request), start_time_(start_time), timeout_msec_(timeout_msec) { updateEndTime(); - requst_type_ = requst_type; + request_type_ = request_type; correlation_id_ = request_->correlation_id(); app_id_ = request_->connection_key(); } @@ -122,7 +122,7 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) { logger_, "Add request app_id = " << request_info->app_id() << "; corr_id = " << request_info->requestId()); - sync_primitives::AutoLock lock(this_lock_); + sync_primitives::AutoLock lock(pending_requests_lock_); CheckSetSizes(); const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_resilt = hash_sorted_pending_requests_.insert(request_info); @@ -153,7 +153,7 @@ RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key, std::shared_ptr<FakeRequestInfo> request_info_for_search( new FakeRequestInfo(connection_key, correlation_id)); - sync_primitives::AutoLock lock(this_lock_); + sync_primitives::AutoLock lock(pending_requests_lock_); HashSortedRequestInfoSet::iterator it = hash_sorted_pending_requests_.find(request_info_for_search); if (it != hash_sorted_pending_requests_.end()) { @@ -165,7 +165,7 @@ RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key, RequestInfoPtr RequestInfoSet::Front() { RequestInfoPtr result; - sync_primitives::AutoLock lock(this_lock_); + sync_primitives::AutoLock lock(pending_requests_lock_); TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin(); if (it != time_sorted_pending_requests_.end()) { result = *it; @@ -175,7 +175,7 @@ RequestInfoPtr RequestInfoSet::Front() { RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() { LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock lock(this_lock_); + sync_primitives::AutoLock lock(pending_requests_lock_); RequestInfoPtr result; TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin(); while (it != time_sorted_pending_requests_.end()) { @@ -219,7 +219,7 @@ bool RequestInfoSet::Erase(const RequestInfoPtr request_info) { } bool RequestInfoSet::RemoveRequest(const RequestInfoPtr request_info) { - sync_primitives::AutoLock lock(this_lock_); + sync_primitives::AutoLock lock(pending_requests_lock_); return Erase(request_info); } @@ -228,7 +228,7 @@ uint32_t RequestInfoSet::RemoveRequests( LOG4CXX_AUTO_TRACE(logger_); uint32_t erased = 0; - sync_primitives::AutoLock lock(this_lock_); + sync_primitives::AutoLock lock(pending_requests_lock_); HashSortedRequestInfoSet::iterator it = std::find_if(hash_sorted_pending_requests_.begin(), hash_sorted_pending_requests_.end(), @@ -252,10 +252,11 @@ uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) { uint32_t RequestInfoSet::RemoveMobileRequests() { LOG4CXX_AUTO_TRACE(logger_); return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual, - RequestInfo::HmiConnectoinKey)); + RequestInfo::HmiConnectionKey)); } const size_t RequestInfoSet::Size() { + sync_primitives::AutoLock lock(pending_requests_lock_); CheckSetSizes(); return time_sorted_pending_requests_.size(); } diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc index 0ccdf8b758..939b3d1ce6 100644 --- a/src/components/application_manager/src/rpc_handler_impl.cc +++ b/src/components/application_manager/src/rpc_handler_impl.cc @@ -219,8 +219,9 @@ void RPCHandlerImpl::GetMessageVersion( } utils::SemanticVersion temp_version(major, minor, patch); if (temp_version.isValid()) { - utils::SemanticVersion ver_4_5(4, 5, 0); - message_version = (temp_version > ver_4_5) ? temp_version : ver_4_5; + message_version = (temp_version >= utils::rpc_version_5) + ? temp_version + : utils::base_rpc_version; } } } diff --git a/src/components/application_manager/src/system_time/system_time_handler_impl.cc b/src/components/application_manager/src/system_time/system_time_handler_impl.cc index 6ae6d3e901..27f0972c01 100644 --- a/src/components/application_manager/src/system_time/system_time_handler_impl.cc +++ b/src/components/application_manager/src/system_time/system_time_handler_impl.cc @@ -46,6 +46,7 @@ SystemTimeHandlerImpl::SystemTimeHandlerImpl( : event_engine::EventObserver(application_manager.event_dispatcher()) , utc_time_can_be_received_(false) , awaiting_get_system_time_(false) + , last_time_(0) , system_time_listener_(NULL) , app_manager_(application_manager) { LOG4CXX_AUTO_TRACE(logger_); |