diff options
author | JackLivio <jack@livio.io> | 2018-08-23 09:58:04 -0400 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2018-08-23 09:58:04 -0400 |
commit | fb890127f47c300d80c76e0464ea0f041783deb2 (patch) | |
tree | 8b7785aa9dca98776a29fbe9acee90cc6df3493d /src/components/application_manager/src | |
parent | 997674798fbe6a6ed2dd579d0703aa8e22d8a643 (diff) | |
parent | 73e4f50de1b77e1c938f31226f180f3c63a566fc (diff) | |
download | sdl_core-fb890127f47c300d80c76e0464ea0f041783deb2.tar.gz |
Merge remote-tracking branch 'origin/develop' into feature/full_app_idfeature/full_app_id
# Conflicts:
# src/components/interfaces/MOBILE_API.xml
Diffstat (limited to 'src/components/application_manager/src')
13 files changed, 405 insertions, 368 deletions
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index a26418d917..8f76d81104 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -314,6 +314,13 @@ const HmiStatePtr ApplicationImpl::RegularHmiState() const { return state_.GetState(HmiState::STATE_ID_REGULAR); } +bool ApplicationImpl::IsAllowedToChangeAudioSource() const { + if (is_remote_control_supported() && is_media_application()) { + return true; + } + return false; +} + const HmiStatePtr ApplicationImpl::PostponedHmiState() const { return state_.GetState(HmiState::STATE_ID_POSTPONED); } @@ -664,10 +671,6 @@ void ApplicationImpl::set_app_allowed(const bool allowed) { is_app_allowed_ = allowed; } -void ApplicationImpl::set_device(connection_handler::DeviceHandle device) { - device_id_ = device; -} - void ApplicationImpl::set_secondary_device( connection_handler::DeviceHandle secondary_device) { secondary_device_id_ = secondary_device; diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index e7b518f0fd..55112e153c 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -178,7 +178,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( , is_low_voltage_(false) , apps_size_(0) , is_stopping_(false) { - std::srand(std::time(0)); + std::srand(std::time(nullptr)); AddPolicyObserver(this); dir_type_to_string_map_ = {{TYPE_STORAGE, "Storage"}, @@ -405,6 +405,7 @@ void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) { bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( ApplicationConstSharedPtr app) const { + LOG4CXX_AUTO_TRACE(logger_); bool voice_state = app->is_voice_communication_supported(); bool media_state = app->is_media_application(); bool navi_state = app->is_navi(); @@ -665,16 +666,6 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( return application; } -DEPRECATED bool ApplicationManagerImpl::RemoveAppDataFromHMI( - ApplicationSharedPtr app) { - return true; -} - -DEPRECATED bool ApplicationManagerImpl::LoadAppDataToHMI( - ApplicationSharedPtr app) { - return true; -} - bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) { using namespace mobile_api; LOG4CXX_AUTO_TRACE(logger_); @@ -801,16 +792,6 @@ uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() { return corelation_id_; } -bool ApplicationManagerImpl::BeginAudioPassThrough() { - sync_primitives::AutoLock lock(audio_pass_thru_lock_); - if (audio_pass_thru_active_) { - return false; - } else { - audio_pass_thru_active_ = true; - return true; - } -} - bool ApplicationManagerImpl::BeginAudioPassThru(uint32_t app_id) { sync_primitives::AutoLock lock(audio_pass_thru_lock_); if (audio_pass_thru_active_) { @@ -822,16 +803,6 @@ bool ApplicationManagerImpl::BeginAudioPassThru(uint32_t app_id) { } } -bool ApplicationManagerImpl::EndAudioPassThrough() { - sync_primitives::AutoLock lock(audio_pass_thru_lock_); - if (audio_pass_thru_active_) { - audio_pass_thru_active_ = false; - return true; - } else { - return false; - } -} - bool ApplicationManagerImpl::EndAudioPassThru(uint32_t app_id) { sync_primitives::AutoLock lock(audio_pass_thru_lock_); if (audio_pass_thru_active_ && audio_pass_thru_app_id_ == app_id) { @@ -853,11 +824,6 @@ void ApplicationManagerImpl::set_driver_distraction_state( driver_distraction_state_ = state; } -DEPRECATED void ApplicationManagerImpl::set_vr_session_started( - const bool state) { - is_vr_session_strated_ = state; -} - void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) { is_all_apps_allowed_ = allowed; } @@ -876,18 +842,6 @@ HmiStatePtr ApplicationManagerImpl::CreateRegularState( return state; } -HmiStatePtr ApplicationManagerImpl::CreateRegularState( - uint32_t app_id, - mobile_apis::HMILevel::eType hmi_level, - mobile_apis::AudioStreamingState::eType audio_state, - mobile_apis::SystemContext::eType system_context) const { - HmiStatePtr state(new HmiState(app_id, *this)); - state->set_hmi_level(hmi_level); - state->set_audio_streaming_state(audio_state); - state->set_system_context(system_context); - return state; -} - void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key, int32_t correlation_id, int32_t max_duration, @@ -1307,111 +1261,6 @@ uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() { return hmi_app_id; } -void ApplicationManagerImpl::ReplaceMobileByHMIAppId( - smart_objects::SmartObject& message) { - MessageHelper::PrintSmartObject(message); - if (message.keyExists(strings::app_id)) { - ApplicationSharedPtr application_ptr = - application(message[strings::app_id].asUInt()); - if (application_ptr.use_count() != 0) { - LOG4CXX_DEBUG(logger_, - "ReplaceMobileByHMIAppId from " - << message[strings::app_id].asInt() << " to " - << application_ptr->hmi_app_id()); - message[strings::app_id] = application_ptr->hmi_app_id(); - } - } else { - switch (message.getType()) { - case smart_objects::SmartType::SmartType_Array: { - smart_objects::SmartArray* message_array = message.asArray(); - smart_objects::SmartArray::iterator it = message_array->begin(); - for (; it != message_array->end(); ++it) { - ReplaceMobileByHMIAppId(*it); - } - break; - } - case smart_objects::SmartType::SmartType_Map: { - std::set<std::string> keys = message.enumerate(); - std::set<std::string>::const_iterator key = keys.begin(); - for (; key != keys.end(); ++key) { - std::string k = *key; - ReplaceMobileByHMIAppId(message[*key]); - } - break; - } - default: { break; } - } - } -} - -void ApplicationManagerImpl::ReplaceHMIByMobileAppId( - smart_objects::SmartObject& message) { - if (message.keyExists(strings::app_id)) { - ApplicationSharedPtr application = - application_by_hmi_app(message[strings::app_id].asUInt()); - - if (application.use_count() != 0) { - LOG4CXX_DEBUG(logger_, - "ReplaceHMIByMobileAppId from " - << message[strings::app_id].asInt() << " to " - << application->app_id()); - message[strings::app_id] = application->app_id(); - } - } else { - switch (message.getType()) { - case smart_objects::SmartType::SmartType_Array: { - smart_objects::SmartArray* message_array = message.asArray(); - smart_objects::SmartArray::iterator it = message_array->begin(); - for (; it != message_array->end(); ++it) { - ReplaceHMIByMobileAppId(*it); - } - break; - } - case smart_objects::SmartType::SmartType_Map: { - std::set<std::string> keys = message.enumerate(); - std::set<std::string>::const_iterator key = keys.begin(); - for (; key != keys.end(); ++key) { - ReplaceHMIByMobileAppId(message[*key]); - } - break; - } - default: { break; } - } - } -} - -bool ApplicationManagerImpl::StartNaviService( - uint32_t app_id, protocol_handler::ServiceType service_type) { - using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); - - if (HMILevelAllowsStreaming(app_id, service_type)) { - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() == it) { - std::pair<NaviServiceStatusMap::iterator, bool> res = - navi_service_status_.insert( - std::pair<uint32_t, std::pair<bool, bool> >( - app_id, std::make_pair(false, false))); - if (!res.second) { - LOG4CXX_WARN(logger_, "Navi service refused"); - return false; - } - it = res.first; - } - // Fill NaviServices map. Set true to first value of pair if - // we've started video service or to second value if we've - // started audio service - service_type == ServiceType::kMobileNav ? it->second.first = true - : it->second.second = true; - - application(app_id)->StartStreaming(service_type); - return true; - } else { - LOG4CXX_WARN(logger_, "Refused navi service by HMI level"); - } - return false; -} - bool ApplicationManagerImpl::StartNaviService( uint32_t app_id, protocol_handler::ServiceType service_type, @@ -1551,46 +1400,6 @@ void ApplicationManagerImpl::StopNaviService( app->StopStreaming(service_type); } -// Suppress warning for deprecated method used within another deprecated method -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -bool ApplicationManagerImpl::OnServiceStartedCallback( - const connection_handler::DeviceHandle& device_handle, - const int32_t& session_key, - const protocol_handler::ServiceType& type) { - using namespace helpers; - using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "ServiceType = " << type << ". Session = " << std::hex - << session_key); - - if (type == kRpc) { - LOG4CXX_DEBUG(logger_, "RPC service is about to be started."); - return true; - } - ApplicationSharedPtr app = application(session_key); - if (!app) { - LOG4CXX_WARN(logger_, - "The application with id:" << session_key - << " doesn't exists."); - return false; - } - - if (Compare<ServiceType, EQ, ONE>( - type, ServiceType::kMobileNav, ServiceType::kAudio)) { - if (app->is_navi()) { - return StartNaviService(session_key, type); - } else { - LOG4CXX_WARN(logger_, "Refuse not navi application"); - } - } else { - LOG4CXX_WARN(logger_, "Refuse unknown service"); - } - return false; -} -#pragma GCC diagnostic pop - void ApplicationManagerImpl::OnServiceStartedCallback( const connection_handler::DeviceHandle& device_handle, const int32_t& session_key, @@ -1965,6 +1774,8 @@ bool ApplicationManagerImpl::Stop() { stopping_application_mng_lock_.Release(); application_list_update_timer_.Stop(); try { + SetUnregisterAllApplicationsReason( + mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF); UnregisterAllApplications(); } catch (...) { LOG4CXX_ERROR(logger_, @@ -2344,6 +2155,14 @@ void ApplicationManagerImpl::set_application_id(const int32_t correlation_id, std::pair<const int32_t, const uint32_t>(correlation_id, app_id)); } +uint32_t ApplicationManagerImpl::get_current_audio_source() const { + return current_audio_source_; +} + +void ApplicationManagerImpl::set_current_audio_source(const uint32_t source) { + current_audio_source_ = source; +} + void ApplicationManagerImpl::AddPolicyObserver( policy::PolicyHandlerObserver* listener) { GetPolicyHandler().add_listener(listener); @@ -2436,7 +2255,10 @@ void ApplicationManagerImpl::ClearAppsPersistentData() { void ApplicationManagerImpl::SendOnSDLClose() { LOG4CXX_AUTO_TRACE(logger_); - + if (IsLowVoltage()) { + LOG4CXX_TRACE(logger_, "SDL is in Low Voltage State"); + return; + } // must be sent to PASA HMI on shutdown synchronously smart_objects::SmartObjectSPtr msg = std::make_shared<smart_objects::SmartObject>( @@ -2626,11 +2448,13 @@ void ApplicationManagerImpl::UnregisterApplication( return; } + if (is_resuming) { resume_controller().SaveApplication(app_to_remove); } else { resume_controller().RemoveApplicationFromSaved(app_to_remove); } + (hmi_capabilities_->get_hmi_language_handler()) .OnUnregisterApplication(app_id); AppV4DevicePredicate finder(handle); @@ -2734,14 +2558,24 @@ bool ApplicationManagerImpl::is_audio_pass_thru_active() const { void ApplicationManagerImpl::OnLowVoltage() { LOG4CXX_AUTO_TRACE(logger_); is_low_voltage_ = true; + resume_ctrl_->SaveLowVoltageTime(); + resume_ctrl_->StopSavePersistentDataTimer(); request_ctrl_.OnLowVoltage(); } -bool ApplicationManagerImpl::IsLowVoltage() { - LOG4CXX_TRACE(logger_, "result: " << is_low_voltage_); +bool ApplicationManagerImpl::IsLowVoltage() const { + LOG4CXX_TRACE(logger_, "Result: " << is_low_voltage_); return is_low_voltage_; } +void ApplicationManagerImpl::OnWakeUp() { + LOG4CXX_AUTO_TRACE(logger_); + is_low_voltage_ = false; + resume_ctrl_->SaveWakeUpTime(); + resume_ctrl_->StartSavePersistentDataTimer(); + request_ctrl_.OnWakeUp(); +} + std::string ApplicationManagerImpl::GetHashedAppID( uint32_t connection_key, const std::string& mobile_app_id) const { connection_handler::DeviceHandle device_id = 0; @@ -3160,12 +2994,6 @@ policy::DeviceConsent ApplicationManagerImpl::GetUserConsentForDevice( return GetPolicyHandler().GetUserConsentForDevice(device_id); } -void ApplicationManagerImpl::OnWakeUp() { - LOG4CXX_AUTO_TRACE(logger_); - is_low_voltage_ = false; - request_ctrl_.OnWakeUp(); -} - mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( const std::vector<uint8_t>& binary_data, const std::string& file_path, @@ -3629,30 +3457,6 @@ void ApplicationManagerImpl::ClearTTSGlobalPropertiesList() { } bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( - const uint32_t app_id) const { - LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - if (subscribed_way_points_apps_list_.find(app_id) == - subscribed_way_points_apps_list_.end()) { - return false; - } - return true; -} - -void ApplicationManagerImpl::SubscribeAppForWayPoints(const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - subscribed_way_points_apps_list_.insert(app_id); -} - -void ApplicationManagerImpl::UnsubscribeAppFromWayPoints( - const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - subscribed_way_points_apps_list_.erase(app_id); -} - -bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( ApplicationSharedPtr app) const { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index db78ad15f0..dcc521ae57 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -155,13 +155,6 @@ bool CommandImpl::ReplaceMobileWithHMIAppId( return true; } -DEPRECATED void CommandImpl::ReplaceMobileByHMIAppId( - NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { - if (!ReplaceMobileWithHMIAppId(message)) { - LOG4CXX_ERROR(logger_, "Substitution mobile --> HMI id is failed."); - } -} - bool CommandImpl::ReplaceHMIWithMobileAppId( NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { if (message.keyExists(strings::app_id)) { @@ -207,12 +200,5 @@ bool CommandImpl::ReplaceHMIWithMobileAppId( return true; } -DEPRECATED void CommandImpl::ReplaceHMIByMobileAppId( - NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { - if (!ReplaceHMIWithMobileAppId(message)) { - LOG4CXX_ERROR(logger_, "Substitution HMI --> mobile id is failed."); - } -} - } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index 0033fe4fb6..aa4c979ae7 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -67,27 +67,6 @@ HmiState::HmiState(std::shared_ptr<Application> app, LOG4CXX_DEBUG(logger_, *this); } -DEPRECATED HmiState::HmiState(uint32_t app_id, - const ApplicationManager& app_mngr, - StateID state_id) - : state_id_(state_id) - , app_mngr_(app_mngr) - , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) - , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) - , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { - app_ = app_mngr_.application(app_id); -} - -DEPRECATED HmiState::HmiState(uint32_t app_id, - const ApplicationManager& app_mngr) - : state_id_(STATE_ID_REGULAR) - , app_mngr_(app_mngr) - , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) - , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) - , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { - app_ = app_mngr_.application(app_id); -} - void HmiState::set_parent(HmiStatePtr parent) { DCHECK_OR_RETURN_VOID(parent); parent_ = parent; @@ -119,18 +98,10 @@ VRHmiState::VRHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_VR_SESSION) {} -DEPRECATED VRHmiState::VRHmiState(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_VR_SESSION) {} - TTSHmiState::TTSHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_TTS_SESSION) {} -DEPRECATED TTSHmiState::TTSHmiState(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_TTS_SESSION) {} - mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state() const { using namespace helpers; @@ -189,10 +160,6 @@ PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {} -DEPRECATED PhoneCallHmiState::PhoneCallHmiState( - uint32_t app_id, const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_PHONE_CALL) {} - mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { using namespace helpers; using namespace mobile_apis; @@ -214,18 +181,10 @@ SafetyModeHmiState::SafetyModeHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_SAFETY_MODE) {} -DEPRECATED SafetyModeHmiState::SafetyModeHmiState( - uint32_t app_id, const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_SAFETY_MODE) {} - DeactivateHMI::DeactivateHMI(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_DEACTIVATE_HMI) {} -DEPRECATED DeactivateHMI::DeactivateHMI(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_DEACTIVATE_HMI) {} - mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const { using namespace helpers; using namespace mobile_apis; @@ -242,16 +201,15 @@ AudioSource::AudioSource(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE) {} -DEPRECATED AudioSource::AudioSource(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_AUDIO_SOURCE) {} - 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; + } return mobile_apis::HMILevel::HMI_BACKGROUND; } @@ -260,10 +218,6 @@ EmbeddedNavi::EmbeddedNavi(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_EMBEDDED_NAVI) {} -DEPRECATED EmbeddedNavi::EmbeddedNavi(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_EMBEDDED_NAVI) {} - mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const { using namespace mobile_apis; using namespace helpers; diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc index b005af0fb5..332d68adbf 100644 --- a/src/components/application_manager/src/message.cc +++ b/src/components/application_manager/src/message.cc @@ -190,19 +190,6 @@ void Message::set_message_type(MessageType type) { type_ = type; } -void Message::set_binary_data(BinaryData* data) { - if (NULL == data) { - NOTREACHED(); - return; - } - - if (binary_data_) { - delete binary_data_; - } - - binary_data_ = new BinaryData(*data); -} - void Message::set_binary_data(const BinaryData* data) { if (NULL == data) { NOTREACHED(); 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 052d619fcc..0ad86b5541 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -2690,6 +2690,40 @@ mobile_apis::Result::eType MessageHelper::VerifyImage( return mobile_apis::Result::WARNINGS; } +MessageHelper::ChoiceSetVRCommandsStatus +MessageHelper::CheckChoiceSetVRCommands( + const smart_objects::SmartObject& choice_set) { + // if this is false, someone doesn't have vrCommands + bool all_have = true; + // if this is false, someone has vrCommands + bool none_have = true; + smart_objects::SmartArray::const_iterator current_choice_set_it = + choice_set.asArray()->begin(); + // Iterate through choices + for (; choice_set.asArray()->end() != current_choice_set_it; + ++current_choice_set_it) { + // if the vrCommands is present + if (current_choice_set_it->keyExists( + application_manager::strings::vr_commands)) { + // this one has the parameter + none_have = false; + } else { + // this one doesn't + all_have = false; + } + } + // everyone has it + if (all_have) { + return MessageHelper::ChoiceSetVRCommandsStatus::ALL; + } + // No one has it + if (none_have) { + return MessageHelper::ChoiceSetVRCommandsStatus::NONE; + } + // mix-and-match + return MessageHelper::ChoiceSetVRCommandsStatus::MIXED; +} + mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems( smart_objects::SmartObject& message, ApplicationConstSharedPtr app, diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc index 42dc335878..3e77078ee5 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -74,7 +74,9 @@ ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager) , is_resumption_active_(false) , is_data_saved_(false) , is_suspended_(false) - , launch_time_(time(NULL)) + , launch_time_(time(nullptr)) + , low_voltage_time_(0) + , wake_up_time_(0) , application_manager_(application_manager) {} #ifdef BUILD_TESTS void ResumeCtrlImpl::set_resumption_storage( @@ -128,6 +130,8 @@ bool ResumeCtrlImpl::Init(resumption::LastState& last_state) { application_manager_.get_settings() .app_resumption_save_persistent_data_timeout(), timer::kPeriodic); + + resumption_storage_->IncrementGlobalIgnOnCounter(); return true; } @@ -144,9 +148,13 @@ void ResumeCtrlImpl::SaveAllApplications() { void ResumeCtrlImpl::SaveApplication(ApplicationSharedPtr application) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(application); - LOG4CXX_INFO(logger_, - "application with appID " << application->app_id() - << " will be saved"); + if (application_manager_.IsLowVoltage()) { + LOG4CXX_DEBUG(logger_, "Low Voltage state is active"); + return; + } + LOG4CXX_DEBUG(logger_, + "application with appID " << application->app_id() + << " will be saved"); resumption_storage_->SaveApplication(application); } @@ -310,6 +318,10 @@ uint32_t ResumeCtrlImpl::GetHMIApplicationID( bool ResumeCtrlImpl::RemoveApplicationFromSaved( ApplicationConstSharedPtr application) { + if (application_manager_.IsLowVoltage()) { + LOG4CXX_DEBUG(logger_, "Low Voltage state is active"); + return false; + } const std::string& device_mac = application->mac_address(); return resumption_storage_->RemoveApplicationFromSaved( application->policy_app_id(), device_mac); @@ -323,8 +335,11 @@ void ResumeCtrlImpl::OnSuspend() { void ResumeCtrlImpl::OnIgnitionOff() { LOG4CXX_AUTO_TRACE(logger_); - resumption_storage_->IncrementIgnOffCount(); - FinalPersistData(); + if (!application_manager_.IsLowVoltage()) { + resumption_storage_->IncrementIgnOffCount(); + resumption_storage_->ResetGlobalIgnOnCount(); + FinalPersistData(); + } } void ResumeCtrlImpl::OnAwake() { @@ -334,6 +349,25 @@ void ResumeCtrlImpl::OnAwake() { StartSavePersistentDataTimer(); } +void ResumeCtrlImpl::SaveLowVoltageTime() { + low_voltage_time_ = time(nullptr); + LOG4CXX_DEBUG(logger_, + "Low Voltage timestamp : " << low_voltage_time_ << " saved"); +} + +void ResumeCtrlImpl::SaveWakeUpTime() { + wake_up_time_ = std::time(nullptr); + LOG4CXX_DEBUG(logger_, "Wake Up timestamp : " << wake_up_time_ << " saved"); +} + +time_t ResumeCtrlImpl::LowVoltageTime() const { + return low_voltage_time_; +} + +time_t ResumeCtrlImpl::WakeUpTime() const { + return wake_up_time_; +} + bool ResumeCtrlImpl::is_suspended() const { return is_suspended_; } @@ -440,12 +474,25 @@ void ResumeCtrlImpl::StartAppHmiStateResumption( LOG4CXX_ERROR(logger_, "Application was not saved"); return; } - const uint32_t ign_off_count = saved_app[strings::ign_off_count].asUInt(); - bool restore_data_allowed = false; - restore_data_allowed = - CheckAppRestrictions(application, saved_app) && - ((0 == ign_off_count) || CheckIgnCycleRestrictions(saved_app)); - if (restore_data_allowed) { + + const bool is_hmi_level_applicable_to_resume = + CheckAppRestrictions(application, saved_app); + + if (!is_hmi_level_applicable_to_resume) { + LOG4CXX_DEBUG(logger_, "No applicable HMI level found for resuming"); + return; + } + + const bool is_resume_allowed_by_low_voltage = + CheckLowVoltageRestrictions(saved_app); + + const bool is_hmi_level_allowed_by_ign_cycle = + CheckIgnCycleRestrictions(saved_app); + + const bool restore_hmi_level_allowed = + is_resume_allowed_by_low_voltage && is_hmi_level_allowed_by_ign_cycle; + + if (restore_hmi_level_allowed) { LOG4CXX_INFO(logger_, "Resume application " << application->policy_app_id()); RestoreAppHMIState(application); @@ -716,30 +763,62 @@ void ResumeCtrlImpl::AddSubscriptions( bool ResumeCtrlImpl::CheckIgnCycleRestrictions( const smart_objects::SmartObject& saved_app) { LOG4CXX_AUTO_TRACE(logger_); - bool result = true; if (!CheckDelayAfterIgnOn()) { - LOG4CXX_INFO(logger_, "Application was connected long after ign on"); - result = false; + LOG4CXX_DEBUG(logger_, "Application was connected long after ign on"); + return false; } - if (!DisconnectedJustBeforeIgnOff(saved_app)) { - LOG4CXX_INFO(logger_, "Application was dissconnected long before ign off"); - result = false; + if (!CheckDelayBeforeIgnOff(saved_app)) { + LOG4CXX_DEBUG(logger_, "Application was disconnected long before ign off"); + return false; } - return result; + return true; } -bool ResumeCtrlImpl::DisconnectedJustBeforeIgnOff( +bool ResumeCtrlImpl::CheckLowVoltageRestrictions( const smart_objects::SmartObject& saved_app) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!CheckDelayBeforeLowVoltage(saved_app)) { + LOG4CXX_DEBUG(logger_, + "Application was disconnected long before low voltage"); + return false; + } + + if (!CheckDelayAfterWakeUp()) { + LOG4CXX_DEBUG(logger_, "Application was connected long after wake up"); + return false; + } + + LOG4CXX_DEBUG(logger_, "HMI Level resuming in not restricted by Low Voltage"); + return true; +} + +bool ResumeCtrlImpl::CheckDelayBeforeIgnOff( + const smart_objects::SmartObject& saved_app) const { using namespace date_time; LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false); const time_t time_stamp = static_cast<time_t>(saved_app[strings::time_stamp].asInt()); - time_t ign_off_time = + const time_t ign_off_time = static_cast<time_t>(resumption_storage_->GetIgnOffTime()); + + if (CheckIgnCyclesData() && 0 == ign_off_time) { + LOG4CXX_DEBUG( + logger_, "No IGNITION OFF records found: This is first Ignition cycle"); + return true; + } + + // This means that ignition off timestamp was not saved + // Possible reasons: Low Voltage event, core crash etc. + if (ign_off_time < time_stamp) { + LOG4CXX_DEBUG(logger_, "Last IGNITION OFF record missed"); + return true; + } + const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp); LOG4CXX_DEBUG( logger_, @@ -752,6 +831,71 @@ bool ResumeCtrlImpl::DisconnectedJustBeforeIgnOff( application_manager_.get_settings().resumption_delay_before_ign(); } +bool ResumeCtrlImpl::CheckDelayBeforeLowVoltage( + const smart_objects::SmartObject& saved_app) const { + using namespace date_time; + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false); + + if (0 == LowVoltageTime()) { + LOG4CXX_DEBUG(logger_, "No Low Voltage signal timestamp saved"); + return true; + } + + const time_t unregistration_time_stamp = + static_cast<time_t>(saved_app[strings::time_stamp].asInt()); + const time_t low_voltage_timestamp = static_cast<time_t>(LowVoltageTime()); + const int32_t sec_spent_before_low_voltage = + (low_voltage_timestamp - unregistration_time_stamp); + if (0 > sec_spent_before_low_voltage) { + LOG4CXX_DEBUG(logger_, + "Low Voltage time: " + << low_voltage_timestamp + << "; App disconnect time: " << unregistration_time_stamp + << "; Secs between app disconnect and low voltage event " + << sec_spent_before_low_voltage); + return true; + } + + const uint32_t secs_between_app_disconnect_and_low_voltage = + static_cast<uint32_t>(sec_spent_before_low_voltage); + const uint32_t wait_time = + application_manager_.get_settings().resumption_delay_before_ign(); + LOG4CXX_DEBUG(logger_, + "Low Voltage time: " + << low_voltage_timestamp + << "; App disconnect time: " << unregistration_time_stamp + << "; Secs between app disconnect and low voltage event " + << secs_between_app_disconnect_and_low_voltage + << "; Timeout for HMI level resuming: " << wait_time); + return secs_between_app_disconnect_and_low_voltage <= wait_time; +} + +bool ResumeCtrlImpl::CheckDelayAfterWakeUp() const { + using namespace date_time; + LOG4CXX_AUTO_TRACE(logger_); + + if (0 == WakeUpTime()) { + LOG4CXX_DEBUG(logger_, "No WakeUp signal timestamp saved"); + return true; + } + + const time_t current_time = time(nullptr); + const time_t wake_up_timestamp = static_cast<time_t>(WakeUpTime()); + + const uint32_t seconds_from_wake_up_signal = + labs(current_time - wake_up_timestamp); + const uint32_t wait_time = + application_manager_.get_settings().resumption_delay_after_ign(); + LOG4CXX_DEBUG( + logger_, + "Current time: " << current_time << "; WakeUp Signal time: " + << wake_up_timestamp << "; Seconds passed from wake up: " + << seconds_from_wake_up_signal + << "; Timeout for HMI level resuming: " << wait_time); + return seconds_from_wake_up_signal <= wait_time; +} + bool ResumeCtrlImpl::CheckAppRestrictions( ApplicationConstSharedPtr application, const smart_objects::SmartObject& saved_app) { @@ -773,9 +917,10 @@ bool ResumeCtrlImpl::CheckAppRestrictions( ? true : false; LOG4CXX_DEBUG(logger_, - "is_media_app " << application->is_media_application() - << "; hmi_level " << hmi_level << " result " - << result); + "is_media_app: " << application->is_media_application() + << "; hmi_level: " << hmi_level << "; result: " + << (result ? "Applicable for resume" + : "Non-applicable for resume")); return result; } @@ -788,11 +933,36 @@ bool ResumeCtrlImpl::CheckIcons(ApplicationSharedPtr application, return mobile_apis::Result::INVALID_DATA != verify_images; } -bool ResumeCtrlImpl::CheckDelayAfterIgnOn() { +bool ResumeCtrlImpl::CheckIgnCyclesData() const { + LOG4CXX_AUTO_TRACE(logger_); + const uint32_t global_ign_on_count = + resumption_storage_->GetGlobalIgnOnCounter(); + const uint32_t the_first_ignition = 1; + const bool is_emergency_ign_off_occurred = + global_ign_on_count > the_first_ignition; + // global_ign_on_count is reseting to 0 at ignition off + // global_ign_on_count is incrementing at ignition on + // global_ign_on_count > 1 means that correct ignition off was not present. + if (is_emergency_ign_off_occurred) { + LOG4CXX_WARN(logger_, + "Emergency IGN OFF occurred. Possibly after Low Voltage"); + return false; + } + return true; +} + +bool ResumeCtrlImpl::CheckDelayAfterIgnOn() const { using namespace date_time; LOG4CXX_AUTO_TRACE(logger_); - const time_t curr_time = time(NULL); + const time_t ign_off_time = GetIgnOffTime(); + + if (CheckIgnCyclesData() && 0 == ign_off_time) { + LOG4CXX_DEBUG(logger_, "This is first Ignition cycle"); + return true; + } + const time_t curr_time = time(nullptr); const time_t sdl_launch_time = LaunchTime(); + const uint32_t seconds_from_sdl_start = labs(curr_time - sdl_launch_time); const uint32_t wait_time = application_manager_.get_settings().resumption_delay_after_ign(); @@ -808,7 +978,7 @@ time_t ResumeCtrlImpl::LaunchTime() const { return launch_time_; } -time_t ResumeCtrlImpl::GetIgnOffTime() { +time_t ResumeCtrlImpl::GetIgnOffTime() const { return resumption_storage_->GetIgnOffTime(); } @@ -856,6 +1026,8 @@ void ResumeCtrlImpl::AddToResumptionTimerQueue(const uint32_t app_id) { "Application ID " << app_id << " have been added" " to resumption queue."); if (run_resumption) { + LOG4CXX_DEBUG(logger_, + "Application ID " << app_id << " will be restored by timer"); restore_hmi_level_timer_.Start( application_manager_.get_settings().app_resuming_timeout(), timer::kSingleShot); diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc index 2fe7330a9c..1591ce566a 100644 --- a/src/components/application_manager/src/resumption/resumption_data_db.cc +++ b/src/components/application_manager/src/resumption/resumption_data_db.cc @@ -163,11 +163,10 @@ void ResumptionDataDB::SaveApplication( } if (application->is_application_data_changed()) { - if (application_exist) { - if (!DeleteSavedApplication(policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Deleting of application data is not finished"); - return; - } + if (application_exist && + !DeleteSavedApplication(policy_app_id, device_mac)) { + LOG4CXX_ERROR(logger_, "Deleting of application data is not finished"); + return; } if (!SaveApplicationToDB(application, policy_app_id, device_mac)) { @@ -176,23 +175,15 @@ void ResumptionDataDB::SaveApplication( } LOG4CXX_INFO(logger_, "All data from application were saved successfully"); application->set_is_application_data_changed(false); - } else { - if (application_exist) { - if (!UpdateApplicationData(application, policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Updating application data is failed"); - return; - } - LOG4CXX_INFO(logger_, "Application data were updated successfully"); - } else { - if (Compare<HMILevel::eType, EQ, ONE>(application->hmi_level(), - HMILevel::HMI_FULL, - HMILevel::HMI_LIMITED)) { - if (!InsertApplicationData(application, policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Saving data of application is failed"); - return; - } - } + } else if (application_exist) { + if (!UpdateApplicationData(application, policy_app_id, device_mac)) { + LOG4CXX_ERROR(logger_, "Updating application data is failed"); + return; } + LOG4CXX_INFO(logger_, "Application data were updated successfully"); + } else if (!InsertApplicationData(application, policy_app_id, device_mac)) { + LOG4CXX_ERROR(logger_, "Saving data of application is failed"); + return; } WriteDb(); } @@ -212,8 +203,6 @@ uint32_t ResumptionDataDB::GetHMIApplicationID( return hmi_app_id; } -DEPRECATED void ResumptionDataDB::OnSuspend() {} - void ResumptionDataDB::IncrementIgnOffCount() { LOG4CXX_AUTO_TRACE(logger_); @@ -240,7 +229,7 @@ void ResumptionDataDB::IncrementIgnOffCount() { } } - if (query_update_last_ign_off_time.Prepare(KUpdateLastIgnOffTime)) { + if (query_update_last_ign_off_time.Prepare(kUpdateLastIgnOffTime)) { query_update_last_ign_off_time.Bind(0, static_cast<int64_t>(time(NULL))); if (query_update_last_ign_off_time.Exec()) { LOG4CXX_INFO(logger_, "Data last_ign_off_time was updated"); @@ -293,8 +282,6 @@ bool ResumptionDataDB::GetHashId(const std::string& policy_app_id, return SelectHashId(policy_app_id, device_id, hash_id); } -DEPRECATED void ResumptionDataDB::OnAwake() {} - void ResumptionDataDB::DecrementIgnOffCount() { LOG4CXX_AUTO_TRACE(logger_); @@ -376,10 +363,61 @@ bool ResumptionDataDB::RemoveApplicationFromSaved( uint32_t ResumptionDataDB::GetIgnOffTime() const { LOG4CXX_AUTO_TRACE(logger_); - return SelectIgnOffTime(); } +uint32_t ResumptionDataDB::GetGlobalIgnOnCounter() const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(kSelectGlobalIgnOnCounter)) { + LOG4CXX_ERROR(logger_, + "Problem with prepare query : " << kSelectGlobalIgnOnCounter); + return 1; + } + + if (!query.Exec()) { + LOG4CXX_ERROR(logger_, + "Problem with exec query : " << kSelectGlobalIgnOnCounter); + return 1; + } + + const auto global_ign_on_counter = query.GetUInteger(0); + LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter); + return global_ign_on_counter; +} + +void ResumptionDataDB::IncrementGlobalIgnOnCounter() { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + + db_->BeginTransaction(); + utils::dbms::SQLQuery query_update_global_ign_on_count(db()); + if (query_update_global_ign_on_count.Prepare(kUpdateGlobalIgnOnCount)) { + if (query_update_global_ign_on_count.Exec()) { + LOG4CXX_DEBUG(logger_, + "Data query_update_global_ign_on_count was updated"); + } + } + db_->CommitTransaction(); + WriteDb(); +} + +void ResumptionDataDB::ResetGlobalIgnOnCount() { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + + LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting"); + + utils::dbms::SQLQuery query_update_global_ign_on_count(db()); + if (query_update_global_ign_on_count.Prepare(kResetGlobalIgnOnCount)) { + if (query_update_global_ign_on_count.Exec()) { + LOG4CXX_DEBUG(logger_, "Data was updated"); + } + } +} + ssize_t ResumptionDataDB::IsApplicationSaved( const std::string& policy_app_id, const std::string& device_id) const { LOG4CXX_AUTO_TRACE(logger_); @@ -557,7 +595,6 @@ void ResumptionDataDB::SelectDataForLoadResumeData( using namespace app_mngr; using namespace smart_objects; LOG4CXX_AUTO_TRACE(logger_); - utils::dbms::SQLQuery select_data(db()); utils::dbms::SQLQuery count_application(db()); if (!select_data.Prepare(kSelectDataForLoadResumeData) || diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc index b6a50fd5de..87241c883a 100644 --- a/src/components/application_manager/src/resumption/resumption_data_json.cc +++ b/src/components/application_manager/src/resumption/resumption_data_json.cc @@ -143,8 +143,6 @@ uint32_t ResumptionDataJson::GetHMIApplicationID( return hmi_app_id; } -DEPRECATED void ResumptionDataJson::OnSuspend() {} - void ResumptionDataJson::IncrementIgnOffCount() { using namespace app_mngr; LOG4CXX_AUTO_TRACE(logger_); @@ -169,8 +167,6 @@ void ResumptionDataJson::IncrementIgnOffCount() { LOG4CXX_DEBUG(logger_, GetResumptionData().toStyledString()); } -DEPRECATED void ResumptionDataJson::OnAwake() {} - void ResumptionDataJson::DecrementIgnOffCount() { using namespace app_mngr; LOG4CXX_AUTO_TRACE(logger_); @@ -283,6 +279,51 @@ uint32_t ResumptionDataJson::GetIgnOffTime() const { return resumption[strings::last_ign_off_time].asUInt(); } +uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const { + using namespace app_mngr; + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + Json::Value& resumption = GetResumptionData(); + if (resumption.isMember(strings::global_ign_on_counter)) { + const uint32_t global_ign_on_counter = + resumption[strings::global_ign_on_counter].asUInt(); + LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter); + return global_ign_on_counter; + } + return 1; +} + +void ResumptionDataJson::IncrementGlobalIgnOnCounter() { + using namespace app_mngr; + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + Json::Value& resumption = GetResumptionData(); + if (resumption.isMember(strings::global_ign_on_counter)) { + const uint32_t global_ign_on_counter = + resumption[strings::global_ign_on_counter].asUInt(); + LOG4CXX_DEBUG( + logger_, + "Global IGN ON counter in resumption data: " << global_ign_on_counter); + resumption[strings::global_ign_on_counter] = global_ign_on_counter + 1; + LOG4CXX_DEBUG(logger_, + "Global IGN ON counter new value: " + << resumption[strings::global_ign_on_counter].asUInt()); + } else { + resumption[strings::global_ign_on_counter] = 1; + } + last_state().SaveStateToFileSystem(); +} + +void ResumptionDataJson::ResetGlobalIgnOnCount() { + using namespace app_mngr; + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + Json::Value& resumption = GetResumptionData(); + + resumption[strings::global_ign_on_counter] = 0; + LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting"); +} + ssize_t ResumptionDataJson::IsApplicationSaved( const std::string& policy_app_id, const std::string& device_id) const { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/resumption/resumption_sql_queries.cc b/src/components/application_manager/src/resumption/resumption_sql_queries.cc index 9ca91e859a..4770bafef4 100644 --- a/src/components/application_manager/src/resumption/resumption_sql_queries.cc +++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc @@ -37,6 +37,7 @@ const std::string kCreateSchema = "BEGIN ; " "CREATE TABLE IF NOT EXISTS `resumption`( " " `idresumption` INTEGER PRIMARY KEY, " + " `global_ign_on_count` INTEGER, " " `last_ign_off_time` INTEGER " " ); " "CREATE TABLE IF NOT EXISTS `subscribedForWayPoints`( " @@ -372,7 +373,9 @@ const std::string kDropSchema = "VACUUM;"; const std::string kInsertInitData = - "INSERT OR IGNORE INTO `resumption` (`last_ign_off_time`) VALUES (0); " + "INSERT OR IGNORE INTO `resumption` " + "(`last_ign_off_time`, `global_ign_on_count`) " + "VALUES (0, 0); " "INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); "; const std::string kChecksResumptionData = @@ -410,6 +413,17 @@ const std::string kSelectHashId = const std::string kSelectIgnOffTime = "SELECT `last_ign_off_time` FROM `resumption`"; +const std::string kSelectGlobalIgnOnCounter = + "SELECT `global_ign_on_count` FROM `resumption`"; + +const std::string kResetGlobalIgnOnCount = + "UPDATE `resumption` " + "SET `global_ign_on_count` = 0"; + +const std::string kUpdateGlobalIgnOnCount = + "UPDATE `resumption` " + "SET `global_ign_on_count` = `global_ign_on_count` + 1 "; + const std::string kCheckApplication = "SELECT COUNT (`deviceID`) FROM `application` " "WHERE `deviceID` = ? AND `appID` = ?"; @@ -445,7 +459,7 @@ const std::string kUpdateSuspendData = "UPDATE `application` " "SET `ign_off_count` = `ign_off_count` + 1"; -const std::string KUpdateLastIgnOffTime = +const std::string kUpdateLastIgnOffTime = "UPDATE `resumption` " "SET `last_ign_off_time` = ?"; diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc index bf1ff78d36..9c2aa497d6 100644 --- a/src/components/application_manager/src/rpc_handler_impl.cc +++ b/src/components/application_manager/src/rpc_handler_impl.cc @@ -267,7 +267,8 @@ bool RPCHandlerImpl::ConvertMessageToSO( ((output.validate(&report, msg_version) != smart_objects::Errors::OK))) { LOG4CXX_WARN(logger_, - "Failed to parse string to smart object :" + "Failed to parse string to smart object with API version " + << msg_version.toString() << " : " << message.json_message()); std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index aab2042973..ff9ebb6208 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -277,6 +277,7 @@ const char* last_ign_off_time = "last_ign_off_time"; const char* resume_vr_grammars = "resumeVrGrammars"; const char* ign_off_count = "ign_off_count"; +const char* global_ign_on_counter = "global_ign_on_counter"; const char* suspend_count = "suspend_count"; const char* connection_info = "connection_info"; diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index f7a147d6df..3d44709657 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -458,6 +458,8 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( LOG4CXX_AUTO_TRACE(logger_); mobile_apis::HMILevel::eType result = hmi_level; + LOG4CXX_DEBUG(logger_, "HMI Level: " << hmi_level); + if (!IsStreamableHMILevel(hmi_level)) { return result; } @@ -465,6 +467,7 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( const bool is_audio_app = app->IsAudioApplication(); const bool does_audio_app_with_same_type_exist = app_mngr_.IsAppTypeExistsInFullOrLimited(app); + if (mobile_apis::HMILevel::HMI_LIMITED == hmi_level) { if (!is_audio_app || does_audio_app_with_same_type_exist) { result = app_mngr_.GetDefaultHmiLevel(app); |