diff options
author | VladSemenyuk <VSemenyuk@luxoft.com> | 2021-02-11 18:58:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 11:58:04 -0500 |
commit | 2a0e2a27fc7beaad4af90ddc59e0ced47091fb83 (patch) | |
tree | 5597c5d6756873d4b34ed4da5dca734b18b341a0 | |
parent | 89278810d0e5657579457773f35be5aedb0eb29d (diff) | |
download | sdl_core-2a0e2a27fc7beaad4af90ddc59e0ced47091fb83.tar.gz |
Fix/ccb 3409 dummy icon remains (#3617)
* Added RemoveFromResumption call into the unregister procedure in application_manager_impl.cc
* Deadlock fixed
Co-authored-by: Dmitriy Boltovskiy <dboltovskyi@luxoft.com>
-rw-r--r-- | src/components/application_manager/src/application_manager_impl.cc | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index dc56a0f84b..8308a843b8 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -3203,6 +3203,7 @@ void ApplicationManagerImpl::UnregisterApplication( } ApplicationSharedPtr app_to_remove; connection_handler::DeviceHandle handle = 0; + { sync_primitives::AutoLock lock(applications_list_lock_ptr_); auto it_app = applications_.begin(); @@ -3215,64 +3216,65 @@ void ApplicationManagerImpl::UnregisterApplication( ++it_app; } } - if (!app_to_remove) { - SDL_LOG_ERROR("Cant find application with app_id = " << app_id); + } + if (!app_to_remove) { + SDL_LOG_ERROR("Cant find application with app_id = " << app_id); - // Just to terminate RAI in case of connection is dropped (rare case) - // App won't be unregistered since RAI has not been started yet - SDL_LOG_DEBUG("Trying to terminate possible RAI request."); - request_ctrl_.terminateAppRequests(app_id); + // Just to terminate RAI in case of connection is dropped (rare case) + // App won't be unregistered since RAI has not been started yet + SDL_LOG_DEBUG("Trying to terminate possible RAI request."); + request_ctrl_.terminateAppRequests(app_id); - return; - } - - if (is_resuming) { - resume_controller().SaveApplication(app_to_remove); - } else { - resume_controller().RemoveApplicationFromSaved(app_to_remove); - } - - if (IsAppSubscribedForWayPoints(app_id)) { - UnsubscribeAppFromWayPoints(app_id, true); - if (!IsAnyAppSubscribedForWayPoints()) { - SDL_LOG_DEBUG("Send UnsubscribeWayPoints"); - auto request = MessageHelper::CreateUnsubscribeWayPointsRequest( - GetNextHMICorrelationID()); - rpc_service_->ManageHMICommand(request); - } - } + return; + } - (hmi_capabilities_->get_hmi_language_handler()) - .OnUnregisterApplication(app_id); + resume_controller().RemoveFromResumption(app_id); - if (connection_handler().GetDeviceID(app_to_remove->mac_address(), - &handle)) { - AppV4DevicePredicate finder(handle); - ApplicationSharedPtr app = FindApp(applications(), finder); - if (!app) { - SDL_LOG_DEBUG( - "There is no more SDL4 apps with device handle: " << handle); + if (is_resuming) { + resume_controller().SaveApplication(app_to_remove); + } else { + resume_controller().RemoveApplicationFromSaved(app_to_remove); + } - RemoveAppsWaitingForRegistration(handle); - } + if (IsAppSubscribedForWayPoints(app_id)) { + UnsubscribeAppFromWayPoints(app_id, true); + if (!IsAnyAppSubscribedForWayPoints()) { + SDL_LOG_DEBUG("Send UnsubscribeWayPoints"); + auto request = MessageHelper::CreateUnsubscribeWayPointsRequest( + GetNextHMICorrelationID()); + rpc_service_->ManageHMICommand(request); } + } - MessageHelper::SendOnAppUnregNotificationToHMI( - app_to_remove, is_unexpected_disconnect, *this); - commands_holder_->Clear(app_to_remove); + (hmi_capabilities_->get_hmi_language_handler()) + .OnUnregisterApplication(app_id); - const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps(); - if (helpers::in_range(enabled_local_apps, app_to_remove->policy_app_id())) { + if (connection_handler().GetDeviceID(app_to_remove->mac_address(), &handle)) { + AppV4DevicePredicate finder(handle); + ApplicationSharedPtr app = FindApp(applications(), finder); + if (!app) { SDL_LOG_DEBUG( - "Enabled local app has been unregistered. Re-create " - "pending application"); - CreatePendingLocalApplication(app_to_remove->policy_app_id()); + "There is no more SDL4 apps with device handle: " << handle); + + RemoveAppsWaitingForRegistration(handle); } + } - RefreshCloudAppInformation(); - SendUpdateAppList(); + MessageHelper::SendOnAppUnregNotificationToHMI( + app_to_remove, is_unexpected_disconnect, *this); + commands_holder_->Clear(app_to_remove); + + const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps(); + if (helpers::in_range(enabled_local_apps, app_to_remove->policy_app_id())) { + SDL_LOG_DEBUG( + "Enabled local app has been unregistered. Re-create " + "pending application"); + CreatePendingLocalApplication(app_to_remove->policy_app_id()); } + RefreshCloudAppInformation(); + SendUpdateAppList(); + if (EndAudioPassThru(app_id)) { // May be better to put this code in MessageHelper? StopAudioPassThru(app_id); |