summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Lytvynenko <ilytvynenko@luxoft.com>2018-08-13 11:25:16 -0400
committerAlexander <akutsan@luxoft.com>2018-08-16 16:16:59 +0300
commite9136bfa464bc844b95f867dccbbed96d3c8ff38 (patch)
tree6927eaf4b50b03d4b9ffebbd0aa83a29496526e9
parent7d531ebc8d74e980d1d9b2ecfa1db7bd2a0f0bfc (diff)
downloadsdl_core-e9136bfa464bc844b95f867dccbbed96d3c8ff38.tar.gz
Fix audio source checking
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
index 3e34350711..ce449896f4 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
@@ -428,22 +428,23 @@ const smart_objects::SmartObject& SetInteriorVehicleDataRequest::ControlData(
void SetInteriorVehicleDataRequest::CheckAudioSource(
const smart_objects::SmartObject& audio_data) {
LOG4CXX_AUTO_TRACE(logger_);
- if (mobile_apis::PrimaryAudioSource::MOBILE_APP !=
- audio_data[message_params::kSource].asInt()) {
- if (!audio_data.keyExists(message_params::kKeepContext) ||
- !audio_data[message_params::kKeepContext].asBool()) {
- if (mobile_apis::PrimaryAudioSource::MOBILE_APP ==
- application_manager_.get_current_audio_source()) {
- app_mngr::ApplicationSharedPtr app =
- application_manager_.application(connection_key());
- if (app->mobile_projection_enabled()) {
- application_manager_.ChangeAppsHMILevel(
- app->app_id(), mobile_apis::HMILevel::eType::HMI_LIMITED);
- } else {
- application_manager_.ChangeAppsHMILevel(
- app->app_id(), mobile_apis::HMILevel::eType::HMI_BACKGROUND);
- }
- }
+ const bool should_keep_context =
+ audio_data.keyExists(message_params::kKeepContext) &&
+ audio_data[message_params::kKeepContext].asBool();
+ const bool switch_source_from_app =
+ mobile_apis::PrimaryAudioSource::MOBILE_APP ==
+ application_manager_.get_current_audio_source() &&
+ mobile_apis::PrimaryAudioSource::MOBILE_APP !=
+ audio_data[message_params::kSource].asInt();
+ if (!should_keep_context && switch_source_from_app) {
+ app_mngr::ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ if (app->mobile_projection_enabled()) {
+ application_manager_.ChangeAppsHMILevel(
+ app->app_id(), mobile_apis::HMILevel::eType::HMI_LIMITED);
+ } else {
+ application_manager_.ChangeAppsHMILevel(
+ app->app_id(), mobile_apis::HMILevel::eType::HMI_BACKGROUND);
}
}
application_manager_.set_current_audio_source(