From b7408cb0252d584d244a2e767a36d491dd3f6c46 Mon Sep 17 00:00:00 2001 From: Andrey Oleynik Date: Wed, 1 Jul 2015 17:26:36 +0300 Subject: Removes explicit HMI level check within several commands. Affected commands: GetVehicleData, ReadDID, GetDTC, OnDriverDistraction Policy table will regulate if request is allowed to run in certain HMI level instead of explicit check. Closes-bug: APPLINK-13894, APPLINK-14187 --- .../commands/hmi/on_driver_distraction_notification.cc | 8 +++----- .../src/commands/mobile/get_dtcs_request.cc | 6 ------ .../src/commands/mobile/get_vehicle_data_request.cc | 15 ++------------- .../src/commands/mobile/read_did_request.cc | 6 ------ 4 files changed, 5 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc index fc9dcc6f8e..ceb6e1b586 100644 --- a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc @@ -81,11 +81,9 @@ void OnDriverDistractionNotification::Run() { for (; applications.end() != it; ++it) { const ApplicationSharedPtr app = *it; if (app) { - if (mobile_apis::HMILevel::eType::HMI_NONE != app->hmi_level()) { - (*on_driver_distraction)[strings::params] - [strings::connection_key] = app->app_id(); - SendNotificationToMobile(on_driver_distraction); - } + (*on_driver_distraction)[strings::params] + [strings::connection_key] = app->app_id(); + SendNotificationToMobile(on_driver_distraction); } } } diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc index 8e2a0222f7..f6791759a4 100644 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc @@ -59,12 +59,6 @@ void GetDTCsRequest::Run() { return; } - if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) { - LOG4CXX_ERROR(logger_, "App has not been activated"); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - smart_objects::SmartObject msg_params = smart_objects::SmartObject( smart_objects::SmartType_Map); diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc index 546b14853c..ed75e62c0c 100644 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc @@ -65,12 +65,6 @@ void GetVehicleDataRequest::Run() { return; } - if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) { - LOG4CXX_ERROR(logger_, "app in HMI level HMI_NONE"); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - const VehicleData& vehicle_data = MessageHelper::vehicle_data(); VehicleData::const_iterator it = vehicle_data.begin(); @@ -181,7 +175,7 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { } LOG4CXX_TRACE(logger_, "Status from HMI: " << it->status << ", so response status become " << status); } else { - any_arg_success = true; + any_arg_success = true; } } @@ -224,16 +218,11 @@ void GetVehicleDataRequest::Run() { return; } - if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) { - LOG4CXX_ERROR(logger_, "app in HMI level HMI_NONE."); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } if (app->IsCommandLimitsExceeded( static_cast(function_id()), application_manager::TLimitSource::CONFIG_FILE)) { LOG4CXX_ERROR(logger_, "GetVehicleData frequency is too high."); - SendResponse(false, mobile_apis::Result::REJECTED); + SendResponse(false, mobile_apis::Result::REJECTED); return; } const VehicleData& vehicle_data = MessageHelper::vehicle_data(); diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc index 5a066aab4d..18f43f12ca 100644 --- a/src/components/application_manager/src/commands/mobile/read_did_request.cc +++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc @@ -64,12 +64,6 @@ void ReadDIDRequest::Run() { return; } - if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) { - SendResponse(false, mobile_apis::Result::REJECTED); - LOG4CXX_ERROR(logger_, "Rejected"); - return; - } - if (app->IsCommandLimitsExceeded( static_cast(function_id()), application_manager::TLimitSource::CONFIG_FILE)) { -- cgit v1.2.1 From dae2d4f13b737feaac14928db1f6003040af448e Mon Sep 17 00:00:00 2001 From: dtrunov Date: Thu, 16 Jul 2015 15:24:43 +0300 Subject: Change sdl_activate_app_reques.cc in order to process OnAppRegistered Subscribed on OnAppRegistered notification for case when application has foreground mode. Closses-bug: APPLINK-13454 --- .../application_manager/src/commands/hmi/sdl_activate_app_request.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc index 5beefce944..af55040ad1 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc @@ -89,8 +89,8 @@ void SDLActivateAppRequest::Run() { app->SchemaUrl(), app->PackageName()); } - subscribe_on_event(BasicCommunication_OnAppRegistered); } + subscribe_on_event(BasicCommunication_OnAppRegistered); } else { policy::PolicyHandler::instance()->OnActivateApp(application_id, correlation_id()); -- cgit v1.2.1 From f6a30dda295c715c4b9180f3133f98302e4efd96 Mon Sep 17 00:00:00 2001 From: dtrunov Date: Thu, 28 May 2015 13:12:46 +0300 Subject: Fixed core crash after resuming audio/video streaming --- .../application_manager/application_manager_impl.h | 24 ++++++++++++++++++++++ .../include/application_manager/state_controller.h | 7 ++----- .../application_manager/src/state_controller.cc | 1 - 3 files changed, 26 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 1a82f53501..0046b4bf41 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -429,6 +429,10 @@ class ApplicationManagerImpl : public ApplicationManager, void SetState(uint32_t app_id, mobile_apis::AudioStreamingState::eType audio_state) { ApplicationSharedPtr app = application(app_id); + if (!app) { + LOG4CXX_ERROR(logger_, "Application with appID="<(app, new_state); } @@ -454,6 +462,10 @@ class ApplicationManagerImpl : public ApplicationManager, void SetState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level){ ApplicationSharedPtr app = application(app_id); + if (!app) { + LOG4CXX_ERROR(logger_, "Application with appID="<(app, hmi_level); } @@ -469,6 +481,10 @@ class ApplicationManagerImpl : public ApplicationManager, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state){ ApplicationSharedPtr app = application(app_id); + if (!app) { + LOG4CXX_ERROR(logger_, "Application with appID="<(app, hmi_level, audio_state); } @@ -484,6 +500,10 @@ class ApplicationManagerImpl : public ApplicationManager, mobile_apis::AudioStreamingState::eType audio_state, mobile_apis::SystemContext::eType system_context) { ApplicationSharedPtr app = application(app_id); + if (!app) { + LOG4CXX_ERROR(logger_, "Application with appID="<(app, hmi_level, audio_state, system_context); } @@ -496,6 +516,10 @@ class ApplicationManagerImpl : public ApplicationManager, void SetState(uint32_t app_id, mobile_apis::SystemContext::eType system_context) { ApplicationSharedPtr app = application(app_id); + if (!app) { + LOG4CXX_ERROR(logger_, "Application with appID="< void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state) { - DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR); @@ -90,7 +89,6 @@ class StateController : public event_engine::EventObserver { void SetRegularState(ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state) { - DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = CreateHmiState(app->app_id(), @@ -111,7 +109,6 @@ class StateController : public event_engine::EventObserver { template void SetRegularState(ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level) { - DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = CreateHmiState(app->app_id(), @@ -135,7 +132,7 @@ class StateController : public event_engine::EventObserver { const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::SystemContext::eType system_context) { - DCHECK_OR_RETURN_VOID(app); + HmiStatePtr hmi_state = CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); @@ -152,7 +149,7 @@ class StateController : public event_engine::EventObserver { */ void SetRegularState(ApplicationSharedPtr app, const mobile_apis::SystemContext::eType system_context) { - DCHECK_OR_RETURN_VOID(app); + HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = CreateHmiState(app->app_id(), diff --git a/src/components/application_manager/src/state_controller.cc b/src/components/application_manager/src/state_controller.cc index 0434e471fd..1c335d710d 100644 --- a/src/components/application_manager/src/state_controller.cc +++ b/src/components/application_manager/src/state_controller.cc @@ -60,7 +60,6 @@ StateController::StateController():EventObserver() { void StateController::SetRegularState(ApplicationSharedPtr app, const mobile_apis::AudioStreamingState::eType audio_state) { - DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_state = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_state); HmiStatePtr hmi_state = CreateHmiState(app->app_id(), -- cgit v1.2.1 From 914fe7958ef5e4ae1483070d5be3d38e142998f5 Mon Sep 17 00:00:00 2001 From: dtrunov Date: Fri, 29 May 2015 11:39:39 +0300 Subject: Fixed comments after review --- .../include/application_manager/state_controller.h | 16 +++++++++++++++- .../application_manager/src/state_controller.cc | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/application_manager/include/application_manager/state_controller.h b/src/components/application_manager/include/application_manager/state_controller.h index d4a2b9fc85..fc10597a6a 100644 --- a/src/components/application_manager/include/application_manager/state_controller.h +++ b/src/components/application_manager/include/application_manager/state_controller.h @@ -58,6 +58,9 @@ class StateController : public event_engine::EventObserver { template void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state) { + if (!app) { + return; + } DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR); @@ -89,6 +92,9 @@ class StateController : public event_engine::EventObserver { void SetRegularState(ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state) { + if (!app) { + return; + } HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = CreateHmiState(app->app_id(), @@ -109,6 +115,9 @@ class StateController : public event_engine::EventObserver { template void SetRegularState(ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level) { + if (!app) { + return; + } HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = CreateHmiState(app->app_id(), @@ -132,6 +141,9 @@ class StateController : public event_engine::EventObserver { const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::SystemContext::eType system_context) { + if (!app) { + return; + } HmiStatePtr hmi_state = CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); @@ -149,7 +161,9 @@ class StateController : public event_engine::EventObserver { */ void SetRegularState(ApplicationSharedPtr app, const mobile_apis::SystemContext::eType system_context) { - + if (!app) { + return; + } HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = CreateHmiState(app->app_id(), diff --git a/src/components/application_manager/src/state_controller.cc b/src/components/application_manager/src/state_controller.cc index 1c335d710d..720312adb3 100644 --- a/src/components/application_manager/src/state_controller.cc +++ b/src/components/application_manager/src/state_controller.cc @@ -60,6 +60,9 @@ StateController::StateController():EventObserver() { void StateController::SetRegularState(ApplicationSharedPtr app, const mobile_apis::AudioStreamingState::eType audio_state) { + if (!app) { + return; + } HmiStatePtr prev_state = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_state); HmiStatePtr hmi_state = CreateHmiState(app->app_id(), -- cgit v1.2.1 From d9ec8969102f02918bf97cb1f407a2c175f8cde0 Mon Sep 17 00:00:00 2001 From: dtrunov Date: Fri, 29 May 2015 15:28:40 +0300 Subject: Fixed sending OnAppUnregistered after wifi transport was disconnetcted --- src/components/transport_manager/src/tcp/tcp_transport_adapter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc index 21a3506da4..3998c02ab9 100644 --- a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc +++ b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc @@ -64,7 +64,7 @@ TcpTransportAdapter::TcpTransportAdapter(const uint16_t port) NULL, #endif new TcpConnectionFactory(this), - new TcpClientListener(this, port, false)) { + new TcpClientListener(this, port, true)) { } TcpTransportAdapter::~TcpTransportAdapter() { -- cgit v1.2.1