summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 54649980c6..bdb648d815 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -248,6 +248,11 @@ void RegisterAppInterfaceRequest::Run() {
logger_,
"device_handle: " << device_handle_ << " device_id: " << device_id_);
+ if (IsApplicationWithSameAppIdOrAppNameRegistered()) {
+ SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
+ return;
+ }
+
if (IsApplicationSwitched()) {
return;
}
@@ -282,11 +287,6 @@ void RegisterAppInterfaceRequest::Run() {
(*message_)[strings::msg_params][strings::full_app_id] = new_app_id_full;
}
- if (IsApplicationWithSameAppIdRegistered()) {
- SendResponse(false, mobile_apis::Result::DISALLOWED);
- return;
- }
-
mobile_apis::Result::eType policy_result = CheckWithPolicyData();
if (Compare<mobile_apis::Result::eType, NEQ, ALL>(
@@ -1236,11 +1236,13 @@ void RegisterAppInterfaceRequest::FillDeviceInfo(
}
}
-bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
+bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdOrAppNameRegistered() {
LOG4CXX_AUTO_TRACE(logger_);
const custom_string::CustomString mobile_app_id(
application_manager_.GetCorrectMobileIDFromMessage(message_));
+ const custom_str::CustomString& app_name =
+ (*message_)[strings::msg_params][strings::app_name].asCustomString();
const auto& applications = application_manager_.applications().GetData();
@@ -1257,6 +1259,9 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
}
return true;
}
+ if (app_name.CompareIgnoreCase(app->name())) {
+ return true;
+ }
}
return false;