diff options
author | Artem Nosach <ANosach@luxoft.com> | 2015-06-30 11:51:50 +0300 |
---|---|---|
committer | Artem Nosach <ANosach@luxoft.com> | 2015-10-04 18:05:56 +0300 |
commit | f6469545b60953d1760fc839a575f88285293adf (patch) | |
tree | f607a75ec587d1d2c9368ebf39608fbb6330d91b /src/components | |
parent | 2e2a4c90cd619a29e61995534ec623620cfbbabf (diff) | |
download | sdl_core-f6469545b60953d1760fc839a575f88285293adf.tar.gz |
Do not change application hmi level from OnAppDeactivated notification
Raise BasicCommunication_OnAppDeactivated event from OnAppDeactivated
notification instead of change application hmi level directly
Closes-bug: APPLINK-14181
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc | 63 |
1 files changed, 3 insertions, 60 deletions
diff --git a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc index a146bdf3a0..899c29b369 100644 --- a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc @@ -51,68 +51,11 @@ OnAppDeactivatedNotification::~OnAppDeactivatedNotification() { void OnAppDeactivatedNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); - - uint32_t app_id = (*message_)[strings::msg_params][strings::app_id].asUInt(); - ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application(app_id); - - if (!app.valid()) { - LOG4CXX_ERROR(logger_, "Application with id " << app_id << " not found"); - return; - } - - using namespace hmi_apis; - using namespace mobile_apis; - using namespace helpers; - - Common_DeactivateReason::eType deactivate_reason = - static_cast<Common_DeactivateReason::eType> - ((*message_)[strings::msg_params][hmi_request::reason].asInt()); - - if (!((Common_DeactivateReason::AUDIO == deactivate_reason || - Common_DeactivateReason::PHONECALL == deactivate_reason) && - HMILevel::HMI_LIMITED == app->hmi_level())) { - app = ApplicationManagerImpl::instance()->active_application(); - - if (!app.valid()) { - LOG4CXX_ERROR(logger_, "No active application"); - return; - } - if (app_id != app->app_id()) { - LOG4CXX_ERROR(logger_, "Wrong application id"); - return; - } - } - - if (HMILevel::HMI_NONE == app->hmi_level()) { - return; - } - HmiStatePtr regular = app->RegularHmiState(); - DCHECK_OR_RETURN_VOID(regular); - HmiStatePtr new_regular(new HmiState(*regular)); - - switch ((*message_)[strings::msg_params][hmi_request::reason].asInt()) { - case hmi_apis::Common_DeactivateReason::AUDIO: { - new_regular->set_audio_streaming_state(mobile_api::AudioStreamingState::NOT_AUDIBLE); - new_regular->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND); - break; - } - case hmi_apis::Common_DeactivateReason::NAVIGATIONMAP: - case hmi_apis::Common_DeactivateReason::PHONEMENU: - case hmi_apis::Common_DeactivateReason::SYNCSETTINGS: - case hmi_apis::Common_DeactivateReason::GENERAL: { - if (app->IsAudioApplication()) { - new_regular->set_hmi_level(mobile_api::HMILevel::HMI_LIMITED); - } else { - new_regular->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND); - } - } - } - ApplicationManagerImpl::instance()->SetState<false>(app->app_id(), new_regular); - + event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated); + event.set_smart_object(*message_); + event.raise(); } } // namespace commands } // namespace application_manager - |