Skip to content

Commit

Permalink
Fix SendUpdateAppList and SendOnAppUnreg order
Browse files Browse the repository at this point in the history
  • Loading branch information
KVGrygoriev committed Aug 17, 2018
1 parent 946e25f commit 0899fa0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,14 @@ class ApplicationManagerImpl
static std::vector<std::string> ConvertRejectedParamList(
const std::vector<std::string>& input);

/**
* @brief Clears command list and send notification to HMI
* @param app_to_remove the application which should be removed
* @param is_unexpected_disconnect flag is that disconnect was unexpected
*/
void ClearCommandListAndSendOnAppUnregNotificationToHMI(
ApplicationSharedPtr& app_to_remove, bool is_unexpected_disconnect);

private:
const ApplicationManagerSettings& settings_;
/**
Expand Down
19 changes: 14 additions & 5 deletions src/components/application_manager/src/application_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2521,6 +2521,13 @@ void ApplicationManagerImpl::RemoveAppsWaitingForRegistration(
apps_to_register_list_lock_ptr_->Release();
}

void ApplicationManagerImpl::ClearCommandListAndSendOnAppUnregNotificationToHMI(
ApplicationSharedPtr& app_to_remove, bool is_unexpected_disconnect) {
commands_holder_->Clear(app_to_remove);
MessageHelper::SendOnAppUnregNotificationToHMI(
app_to_remove, is_unexpected_disconnect, *this);
}

void ApplicationManagerImpl::UnregisterApplication(
const uint32_t& app_id,
mobile_apis::Result::eType reason,
Expand Down Expand Up @@ -2623,12 +2630,15 @@ void ApplicationManagerImpl::UnregisterApplication(
logger_, "There is no more SDL4 apps with device handle: " << handle);

RemoveAppsWaitingForRegistration(handle);
ClearCommandListAndSendOnAppUnregNotificationToHMI(
app_to_remove, is_unexpected_disconnect);
SendUpdateAppList();
} else {
ClearCommandListAndSendOnAppUnregNotificationToHMI(
app_to_remove, is_unexpected_disconnect);
}
}

commands_holder_->Clear(app_to_remove);

if (EndAudioPassThru(app_id)) {
// May be better to put this code in MessageHelper?
StopAudioPassThru(app_id);
Expand All @@ -2639,11 +2649,10 @@ void ApplicationManagerImpl::UnregisterApplication(
plugin.OnApplicationEvent(plugin_manager::kApplicationUnregistered,
app_to_remove);
};
plugin_manager_->ForEachPlugin(on_app_unregistered);

MessageHelper::SendOnAppUnregNotificationToHMI(
app_to_remove, is_unexpected_disconnect, *this);
plugin_manager_->ForEachPlugin(on_app_unregistered);
request_ctrl_.terminateAppRequests(app_id);

return;
}

Expand Down

0 comments on commit 0899fa0

Please sign in to comment.