diff options
author | JackLivio <jack@livio.io> | 2020-10-26 07:27:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-26 10:27:16 -0400 |
commit | c0b7d17b2ee650d7a4d36341c123840e02110822 (patch) | |
tree | 2abf3280498487284a4f6ddefd15cd8a409b8871 | |
parent | 4f8359ff17308460f9c60314bc32178e5c96742b (diff) | |
download | sdl_core-c0b7d17b2ee650d7a4d36341c123840e02110822.tar.gz |
Bugfix 2808 copy (#3546)
* fix issue 2808:SDL Crash seen in SDL upon receiving rpc - OnEmergencyEvent with enabled:true
* change code stype
* Fix conflicts
* Fix log
* Fix crash
* Address comments
Co-authored-by: zhangwenqin <zhangwenqin@iauto.com>
-rw-r--r-- | src/components/application_manager/src/hmi_state.cc | 16 | ||||
-rw-r--r-- | src/components/application_manager/src/state_controller_impl.cc | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index fde2022364..3487116baf 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -242,6 +242,10 @@ PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app, : HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {} mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { + using namespace mobile_apis; + if (HMILevel::INVALID_ENUM == parent_hmi_level()) { + return parent_hmi_level(); + } return std::max(parent_hmi_level(), max_hmi_level()); } @@ -272,6 +276,10 @@ DeactivateHMI::DeactivateHMI(std::shared_ptr<Application> app, : HmiState(app, app_mngr, STATE_ID_DEACTIVATE_HMI) {} mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const { + using namespace mobile_apis; + if (HMILevel::INVALID_ENUM == parent_hmi_level()) { + return parent_hmi_level(); + } return std::max(parent_hmi_level(), max_hmi_level()); } @@ -296,6 +304,10 @@ AudioSource::AudioSource(std::shared_ptr<Application> app, mobile_apis::HMILevel::eType AudioSource::hmi_level() const { using namespace mobile_apis; + if (HMILevel::INVALID_ENUM == parent_hmi_level()) { + return parent_hmi_level(); + } + if (WindowType::WIDGET == window_type() || keep_context_) { return std::max(parent_hmi_level(), max_hmi_level()); } @@ -368,6 +380,10 @@ mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const { using namespace mobile_apis; using namespace helpers; + if (HMILevel::INVALID_ENUM == parent_hmi_level()) { + return parent_hmi_level(); + } + if (WindowType::WIDGET == window_type()) { return std::max(parent_hmi_level(), max_hmi_level()); } diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index a75345650f..7a231d4cfc 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -917,6 +917,12 @@ void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app, SDL_LOG_DEBUG("Window #" << window_id << " old state: " << *old_state); SDL_LOG_DEBUG("Window #" << window_id << " new state: " << *new_state); + if ((new_state->hmi_level() == mobile_apis::HMILevel::INVALID_ENUM) && + (old_state->hmi_level() == mobile_apis::HMILevel::INVALID_ENUM)) { + SDL_LOG_DEBUG("HMI level is invalid data."); + return; + } + if (!IsStateChanged(*old_state, *new_state)) { SDL_LOG_DEBUG("State has NOT been changed."); return; |