summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2021-07-27 17:13:22 -0400
committerGitHub <noreply@github.com>2021-07-27 17:13:22 -0400
commite9b3e093980444b57dc6c82d6f9661f965954ae1 (patch)
treea683cedffcf75b08cd6cc8ab7751d28d3fdba963
parent473400504342e0f4271e5bf187c66188eb13fe9f (diff)
downloadsdl_core-e9b3e093980444b57dc6c82d6f9661f965954ae1.tar.gz
Suspend notifications to mobile until HMI state is established (#3675)
* Suspend any notifications meant for mobile app until HMI state is properly established
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc1
-rw-r--r--src/components/application_manager/src/rpc_service_impl.cc14
2 files changed, 11 insertions, 4 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 884b5df0ee..f5dedc0e35 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -451,6 +451,7 @@ void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) {
sync_primitives::AutoLock lock(applications_list_lock_ptr_);
const mobile_apis::HMILevel::eType default_level = GetDefaultHmiLevel(app);
state_ctrl_.OnApplicationRegistered(app, default_level);
+ commands_holder_->Resume(app, CommandHolder::CommandType::kMobileCommand);
}
void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) {
diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc
index f0cd720e30..6cb03705ab 100644
--- a/src/components/application_manager/src/rpc_service_impl.cc
+++ b/src/components/application_manager/src/rpc_service_impl.cc
@@ -138,10 +138,18 @@ bool RPCServiceImpl::ManageMobileCommand(
const uint32_t connection_key = static_cast<uint32_t>(
(*message)[strings::params][strings::connection_key].asUInt());
+ const WindowID window_id = MessageHelper::ExtractWindowIdFromSmartObject(
+ (*message)[strings::msg_params]);
+ int32_t message_type =
+ (*message)[strings::params][strings::message_type].asInt();
auto app_ptr = app_manager_.application(connection_key);
- if (app_ptr && app_manager_.IsAppInReconnectMode(app_ptr->device(),
- app_ptr->policy_app_id())) {
+ if (app_ptr &&
+ (app_manager_.IsAppInReconnectMode(app_ptr->device(),
+ app_ptr->policy_app_id()) ||
+ (!app_ptr->WindowIdExists(window_id) &&
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id &&
+ mobile_apis::messageType::notification == message_type))) {
commands_holder_.Suspend(
app_ptr, CommandHolder::CommandType::kMobileCommand, source, message);
return true;
@@ -209,8 +217,6 @@ bool RPCServiceImpl::ManageMobileCommand(
return false;
}
- int32_t message_type =
- (*message)[strings::params][strings::message_type].asInt();
if (message_type == mobile_apis::messageType::response) {
if (command->Init() && command->CheckPermissions()) {
command->Run();