diff options
author | Artem Nosach <ANosach@luxoft.com> | 2015-12-14 18:42:34 +0200 |
---|---|---|
committer | Artem Nosach <ANosach@luxoft.com> | 2015-12-14 18:42:34 +0200 |
commit | 01bfec94d2433631c8bc25c21f9bdbb4a65eeb2f (patch) | |
tree | 22313165a499280de45d8586b39be374aa274039 | |
parent | 06acf1252ffa101f83f04569c7c024017c6f0fb0 (diff) | |
parent | 7fd2f87c39749d7230e9276d3ec0efbfe018dc78 (diff) | |
download | smartdevicelink-01bfec94d2433631c8bc25c21f9bdbb4a65eeb2f.tar.gz |
Merge remote-tracking branch 'genivi-upstream/release/4.0.0'4.0.1
7 files changed, 43 insertions, 6 deletions
diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/serversocket.cpp b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/serversocket.cpp index 095fffc54..f2b5de61c 100644 --- a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/serversocket.cpp +++ b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/serversocket.cpp @@ -128,6 +128,13 @@ SocketPtr ServerSocket::accept() { throw SocketException(status); } + // Added 5 seconds timeout to fix endless blocking on write() when the client is not reading + status = apr_socket_timeout_set(newSocket, 5000000); + if (status != APR_SUCCESS) { + apr_pool_destroy(newPool); + throw SocketException(status); + } + return new Socket(newSocket, newPool); } 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 2961202bd..f75c40389 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 @@ -1381,6 +1381,7 @@ class ApplicationManagerImpl : public ApplicationManager, std::vector<ApplicationManagerTimerPtr> timer_pool_; sync_primitives::Lock timer_pool_lock_; + sync_primitives::Lock stopping_flag_lock_; StateController state_ctrl_; @@ -1401,8 +1402,7 @@ class ApplicationManagerImpl : public ApplicationManager, timer::TimerThread<ApplicationManagerImpl> tts_global_properties_timer_; bool is_low_voltage_; - - bool is_stopping_; + volatile bool is_stopping_; DISALLOW_COPY_AND_ASSIGN(ApplicationManagerImpl); diff --git a/src/components/application_manager/include/application_manager/resume_ctrl.h b/src/components/application_manager/include/application_manager/resume_ctrl.h index 99d694570..4d9031636 100644 --- a/src/components/application_manager/include/application_manager/resume_ctrl.h +++ b/src/components/application_manager/include/application_manager/resume_ctrl.h @@ -154,6 +154,11 @@ class ResumeCtrl: public event_engine::EventObserver { */ void StopSavePersistentDataTimer(); + /** + * @brief Method stops restore_hmi_level_timer_ "RsmCtrlRstore" in Suspend() + */ + void StopRestoreHmiLevelTimer(); + /** * @brief Start timer for resumption applications * Restore D1-D5 data diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 0c686c79a..296f1c0e3 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -102,6 +102,7 @@ ApplicationManagerImpl::ApplicationManagerImpl() resume_ctrl_(this), navi_close_app_timeout_(profile::Profile::instance()->stop_streaming_timeout()), navi_end_stream_timeout_(profile::Profile::instance()->stop_streaming_timeout()), + stopping_flag_lock_(true), #ifdef TIME_TESTER metric_observer_(NULL), #endif // TIME_TESTER @@ -160,7 +161,9 @@ ApplicationManagerImpl::~ApplicationManagerImpl() { bool ApplicationManagerImpl::Stop() { LOG4CXX_INFO(logger_, "Stop ApplicationManager."); + stopping_flag_lock_.Acquire(); is_stopping_ = true; + stopping_flag_lock_.Release(); application_list_update_timer_->stop(); try { UnregisterAllApplications(); @@ -2126,6 +2129,9 @@ void ApplicationManagerImpl::SetUnregisterAllApplicationsReason( void ApplicationManagerImpl::HeadUnitReset( mobile_api::AppInterfaceUnregisteredReason::eType reason) { + stopping_flag_lock_.Acquire(); + is_stopping_ = true; + stopping_flag_lock_.Release(); switch (reason) { case mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET: { UnregisterAllApplications(); @@ -2213,6 +2219,8 @@ void ApplicationManagerImpl::UnregisterAllApplications() { bool is_unexpected_disconnect = Compare<eType, NEQ, ALL>(unregister_reason_, IGNITION_OFF, MASTER_RESET, FACTORY_DEFAULTS); + + { // A local scope to limit accessor's lifetime and release app list lock. ApplicationListAccessor accessor; ApplictionSetConstIt it = accessor.begin(); while (it != accessor.end()) { @@ -2234,7 +2242,9 @@ void ApplicationManagerImpl::UnregisterAllApplications() { connection_handler::kCommon); it = accessor.begin(); } - if (is_ignition_off) { + } + + if (is_ignition_off) { // Move this block before unregistering apps? resume_controller().Suspend(); } request_ctrl_.terminateAllHMIRequests(); @@ -2355,6 +2365,12 @@ void ApplicationManagerImpl::Handle(const impl::MessageFromMobile message) { LOG4CXX_ERROR(logger_, "Null-pointer message received."); return; } + + sync_primitives::AutoLock lock(stopping_flag_lock_); + if (is_stopping_) { + LOG4CXX_INFO(logger_, "Application manager is stopping"); + return; + } ProcessMessageFromMobile(message); } diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index 43398acfc..1ec93f8ba 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -1101,11 +1101,11 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI( msg_params[strings::menu_params] = (*i->second)[strings::menu_params]; msg_params[strings::app_id] = app->app_id(); - if (((*i->second)[strings::cmd_icon].keyExists(strings::value)) + if (((*i->second).keyExists(strings::cmd_icon)) && (0 < (*i->second)[strings::cmd_icon][strings::value].length())) { msg_params[strings::cmd_icon] = (*i->second)[strings::cmd_icon]; msg_params[strings::cmd_icon][strings::value] = - (*i->second)[strings::cmd_icon][strings::value].asString(); + (*i->second)[strings::cmd_icon][strings::value].asString(); } (*ui_command)[strings::msg_params] = msg_params; requests.push_back(ui_command); diff --git a/src/components/application_manager/src/resume_ctrl.cpp b/src/components/application_manager/src/resume_ctrl.cpp index 19cad8013..983699e02 100644 --- a/src/components/application_manager/src/resume_ctrl.cpp +++ b/src/components/application_manager/src/resume_ctrl.cpp @@ -376,6 +376,7 @@ bool ResumeCtrl::RemoveApplicationFromSaved(const std::string& mobile_app_id) { void ResumeCtrl::Suspend() { LOG4CXX_AUTO_TRACE(logger_); + StopRestoreHmiLevelTimer(); StopSavePersistentDataTimer(); SaveAllApplications(); Json::Value to_save; @@ -443,6 +444,14 @@ void ResumeCtrl::StopSavePersistentDataTimer() { } +void ResumeCtrl::StopRestoreHmiLevelTimer() { + LOG4CXX_AUTO_TRACE(logger_); + if (restore_hmi_level_timer_.isRunning()) { + restore_hmi_level_timer_.stop(); + } +} + + bool ResumeCtrl::StartResumption(ApplicationSharedPtr application, const std::string& hash) { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index 0f00117b1..62f3d2a10 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1393,7 +1393,7 @@ </param> <param name="greyOut" type="Boolean" mandatory="false"> <description>Indicates whether application should be dimmed on the screen.</description> - <description>Applicable only for apps received through QueryApps and still not registered.</description> + <description>In case app is not in foreground SDL must notify HMI to grey out the corresponding apps-available-for-launching and currently not registered</description> </param> <param name="requestType" type="Common.RequestType" minsize="0" maxsize="100" array="true" mandatory="false"> <description>The list of SystemRequest's RequestTypes allowed by policies for the named application</description> |