summaryrefslogtreecommitdiff
path: root/src/components/application_manager
diff options
context:
space:
mode:
authorAndrey Oleynik (GitHub) <aoleynik@luxoft.com>2017-12-06 10:20:51 +0200
committerAndriy Byzhynar <AByzhynar@luxoft.com>2018-01-18 12:03:51 +0200
commitc4e771fb7d402157c5cbb5159c41e0a4553b8492 (patch)
tree80590c89fd5edf14c425fc92976be92236cff6a0 /src/components/application_manager
parent2c207377259ad01c7f231533ba7189008d03a898 (diff)
downloadsdl_core-c4e771fb7d402157c5cbb5159c41e0a4553b8492.tar.gz
Fixes coding style
Diffstat (limited to 'src/components/application_manager')
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h7
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h2
-rw-r--r--src/components/application_manager/src/application_impl.cc2
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc34
-rw-r--r--src/components/application_manager/src/command_holder_impl.cc47
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc45
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc2
-rw-r--r--src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc16
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc12
-rw-r--r--src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc4
11 files changed, 86 insertions, 90 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 280617c25f..89ed149add 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -896,8 +896,9 @@ class ApplicationManagerImpl
* @param device_from device params being switched to the new transport
* @param device_to device params on the new transport
*/
- void OnDeviceSwitchingStart(const connection_handler::Device& device_from,
- const connection_handler::Device& device_to) FINAL;
+ void OnDeviceSwitchingStart(
+ const connection_handler::Device& device_from,
+ const connection_handler::Device& device_to) FINAL;
/**
* @brief OnDeviceSwitchingFinish is invoked on device trasport switching end
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
index 3e5f9252de..5713e2e814 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
@@ -88,8 +88,11 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
* @brief The AppicationType enum defines whether application is newly
* registered or existing and being switched over another transport
*/
- enum class ApplicationType {
- kNewApplication, kSwitchedApplicationHashOk, kSwitchedApplicationWrongHashId };
+ enum class ApplicationType {
+ kNewApplication,
+ kSwitchedApplicationHashOk,
+ kSwitchedApplicationWrongHashId
+ };
/**
* @brief Prepares and sends RegisterAppInterface response to mobile
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index dff27cf7f1..ce5c0818f1 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -536,7 +536,7 @@ class PolicyHandler : public PolicyHandlerInterface,
/**
* @brief OnDeviceSwitching Notifies policy manager on device switch event so
* policy permissions should be processed accordingly
- * @param device_id_from Id of device being switched
+ * @param device_id_from Id of device being switched
* @param device_id_to Id of device on the new transport
*/
void OnDeviceSwitching(const std::string& device_id_from,
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index fcdbc25a3e..eaf097d43f 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -79,7 +79,7 @@ namespace application_manager {
void SwitchApplicationParameters(ApplicationSharedPtr app,
const uint32_t app_id,
- const size_t device_id,
+ const size_t device_id,
const std::string& mac_address) {
utils::SharedPtr<ApplicationImpl> application =
ApplicationSharedPtr::dynamic_pointer_cast<ApplicationImpl>(app);
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index b6ffc80ed4..d42d6d91b2 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -1079,19 +1079,19 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart(
{
auto apps_data_accessor = applications();
- std::copy_if(
- apps_data_accessor.GetData().begin(),
- apps_data_accessor.GetData().end(),
- std::back_inserter(reregister_wait_list_),
- std::bind1st(std::ptr_fun(&device_id_comparator),
- device_from.mac_address()));
+ std::copy_if(apps_data_accessor.GetData().begin(),
+ apps_data_accessor.GetData().end(),
+ std::back_inserter(reregister_wait_list_),
+ std::bind1st(std::ptr_fun(&device_id_comparator),
+ device_from.mac_address()));
}
{
// During sending of UpdateDeviceList this lock is acquired also so making
// it scoped
sync_primitives::AutoLock lock(reregister_wait_list_lock_);
- for (auto i = reregister_wait_list_.begin(); reregister_wait_list_.end() != i;
+ for (auto i = reregister_wait_list_.begin();
+ reregister_wait_list_.end() != i;
++i) {
auto app = *i;
request_ctrl_.terminateAppRequests(app->app_id());
@@ -1101,10 +1101,10 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart(
policy_handler_->OnDeviceSwitching(device_from.mac_address(),
device_to.mac_address());
-
+
connection_handler::DeviceMap device_list;
device_list.insert(std::make_pair(device_to.device_handle(), device_to));
-
+
smart_objects::SmartObjectSPtr msg_params =
MessageHelper::CreateDeviceListSO(device_list, GetPolicyHandler(), *this);
if (!msg_params) {
@@ -1136,7 +1136,7 @@ void ApplicationManagerImpl::OnDeviceSwitchingFinish(
for (auto app_it = reregister_wait_list_.begin();
app_it != reregister_wait_list_.end();
++app_it) {
- auto app = *app_it;
+ auto app = *app_it;
UnregisterApplication(app->app_id(),
mobile_apis::Result::INVALID_ENUM,
is_resuming,
@@ -1147,9 +1147,9 @@ void ApplicationManagerImpl::OnDeviceSwitchingFinish(
void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app,
const uint32_t connection_key,
- const size_t device_id,
+ const size_t device_id,
const std::string& mac_address) {
- LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(applications_list_lock_);
DCHECK_OR_RETURN_VOID(1 == applications_.erase(app));
@@ -1862,9 +1862,8 @@ bool ApplicationManagerImpl::ManageMobileCommand(
auto app_ptr = application(connection_key);
if (app_ptr && IsAppInReconnectMode(app_ptr->policy_app_id())) {
- commands_holder_->Suspend(app_ptr,
- CommandHolder::CommandType::kMobileCommand,
- message);
+ commands_holder_->Suspend(
+ app_ptr, CommandHolder::CommandType::kMobileCommand, message);
return true;
}
@@ -2101,9 +2100,8 @@ bool ApplicationManagerImpl::ManageHMICommand(
auto app = application(static_cast<uint32_t>(connection_key));
if (app && IsAppInReconnectMode(app->policy_app_id())) {
- commands_holder_->Suspend(app,
- CommandHolder::CommandType::kHmiCommand,
- message);
+ commands_holder_->Suspend(
+ app, CommandHolder::CommandType::kHmiCommand, message);
return true;
}
}
diff --git a/src/components/application_manager/src/command_holder_impl.cc b/src/components/application_manager/src/command_holder_impl.cc
index d5700f512e..82ba486913 100644
--- a/src/components/application_manager/src/command_holder_impl.cc
+++ b/src/components/application_manager/src/command_holder_impl.cc
@@ -45,26 +45,28 @@ void CommandHolderImpl::Suspend(
CommandType type,
utils::SharedPtr<smart_objects::SmartObject> command) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Suspending command(s) for application: "
- << application->policy_app_id());
+ LOG4CXX_DEBUG(logger_,
+ "Suspending command(s) for application: "
+ << application->policy_app_id());
sync_primitives::AutoLock lock(commands_lock_);
if (CommandType::kHmiCommand == type) {
app_hmi_commands_[application].push_back(command);
- LOG4CXX_DEBUG(logger_, "Suspended HMI command(s): "
- << app_hmi_commands_.size());
+ LOG4CXX_DEBUG(logger_,
+ "Suspended HMI command(s): " << app_hmi_commands_.size());
} else {
app_mobile_commands_[application].push_back(command);
- LOG4CXX_DEBUG(logger_, "Suspended mobile command(s): "
- << app_hmi_commands_.size());
+ LOG4CXX_DEBUG(logger_,
+ "Suspended mobile command(s): " << app_hmi_commands_.size());
}
}
void CommandHolderImpl::Resume(ApplicationSharedPtr application,
CommandType type) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Resuming command(s) for application: "
- << application->policy_app_id());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Resuming command(s) for application: " << application->policy_app_id());
if (CommandType::kHmiCommand == type) {
ResumeHmiCommand(application);
} else {
@@ -74,20 +76,23 @@ void CommandHolderImpl::Resume(ApplicationSharedPtr application,
void CommandHolderImpl::Clear(ApplicationSharedPtr application) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Clearing command(s) for application: "
- << application->policy_app_id());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Clearing command(s) for application: " << application->policy_app_id());
sync_primitives::AutoLock lock(commands_lock_);
auto app_hmi_commands = app_hmi_commands_.find(application);
if (app_hmi_commands_.end() != app_hmi_commands) {
- LOG4CXX_DEBUG(logger_, "Clearing HMI command(s): "
- << app_hmi_commands->second.size());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Clearing HMI command(s): " << app_hmi_commands->second.size());
app_hmi_commands_.erase(app_hmi_commands);
}
auto app_mobile_commands = app_mobile_commands_.find(application);
if (app_mobile_commands_.end() != app_mobile_commands) {
- LOG4CXX_DEBUG(logger_, "Clearing mobile command(s): "
- << app_mobile_commands->second.size());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Clearing mobile command(s): " << app_mobile_commands->second.size());
app_mobile_commands_.erase(app_mobile_commands);
}
}
@@ -99,8 +104,8 @@ void CommandHolderImpl::ResumeHmiCommand(ApplicationSharedPtr application) {
return;
}
- LOG4CXX_DEBUG(logger_, "Resuming HMI command(s): "
- << app_hmi_commands_.size());
+ LOG4CXX_DEBUG(logger_,
+ "Resuming HMI command(s): " << app_hmi_commands_.size());
for (auto cmd : app_commands->second) {
(*cmd)[strings::msg_params][strings::app_id] = application->hmi_app_id();
@@ -117,15 +122,13 @@ void CommandHolderImpl::ResumeMobileCommand(ApplicationSharedPtr application) {
return;
}
- LOG4CXX_DEBUG(logger_, "Resuming mobile command(s): "
- << app_mobile_commands_.size());
+ LOG4CXX_DEBUG(logger_,
+ "Resuming mobile command(s): " << app_mobile_commands_.size());
for (auto cmd : app_commands->second) {
- (*cmd)[strings::params][strings::connection_key] =
- application->app_id();
+ (*cmd)[strings::params][strings::connection_key] = application->app_id();
app_manager_.ManageMobileCommand(
- cmd,
- commands::Command::CommandOrigin::ORIGIN_MOBILE);
+ cmd, commands::Command::CommandOrigin::ORIGIN_MOBILE);
}
app_mobile_commands_.erase(app_commands);
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
index fda4d09de2..cb6534dd2d 100644
--- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
@@ -641,26 +641,25 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
}
if (ApplicationType::kSwitchedApplicationWrongHashId == app_type) {
- LOG4CXX_DEBUG(logger_,
- "Application has been switched from another transport, "
- "but doesn't have correct hashID.");
-
- application_manager::RecallApplicationData(application,
- application_manager_);
-
- SendResponse(true, mobile_apis::Result::RESUME_FAILED, NULL,
- &response_params);
- return;
- }
-
- if (ApplicationType::kSwitchedApplicationHashOk == app_type) {
- LOG4CXX_DEBUG(logger_,
- "Application has been switched from another transport "
- "and has correct hashID.");
- SendResponse(true, mobile_apis::Result::SUCCESS, NULL,
- &response_params);
- return;
- }
+ LOG4CXX_DEBUG(logger_,
+ "Application has been switched from another transport, "
+ "but doesn't have correct hashID.");
+
+ application_manager::RecallApplicationData(application,
+ application_manager_);
+
+ SendResponse(
+ true, mobile_apis::Result::RESUME_FAILED, NULL, &response_params);
+ return;
+ }
+
+ if (ApplicationType::kSwitchedApplicationHashOk == app_type) {
+ LOG4CXX_DEBUG(logger_,
+ "Application has been switched from another transport "
+ "and has correct hashID.");
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
+ return;
+ }
bool resumption =
(*message_)[strings::msg_params].keyExists(strings::hash_id);
@@ -1469,10 +1468,10 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
auto app_type = ApplicationType::kSwitchedApplicationWrongHashId;
if ((*message_)[strings::msg_params].keyExists(strings::hash_id)) {
- const auto hash_id =
+ const auto hash_id =
(*message_)[strings::msg_params][strings::hash_id].asString();
-
- auto& resume_ctrl = application_manager_.resume_controller();
+
+ auto& resume_ctrl = application_manager_.resume_controller();
if (resume_ctrl.CheckApplicationHash(app, hash_id)) {
app_type = ApplicationType::kSwitchedApplicationHashOk;
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index e5bf7a2a7c..41e7990e43 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -852,7 +852,7 @@ uint32_t PolicyHandler::ChooseRandomAppForPolicyUpdate(
return 0;
}
-void PolicyHandler::OnDeviceSwitching(const std::string& device_id_from,
+void PolicyHandler::OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
diff --git a/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc b/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc
index 471270f9b8..b9437d55e0 100644
--- a/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc
@@ -172,15 +172,11 @@ TEST_F(ApplicationManagerImplMockHmiTest,
app_manager_impl_->AddMockApplication(app_impl);
- const connection_handler::Device bt(device_id,
- "BT_device",
- mac_address,
- "BLUETOOTH");
+ const connection_handler::Device bt(
+ device_id, "BT_device", mac_address, "BLUETOOTH");
- const connection_handler::Device usb(device_id + 1,
- "USB_device",
- "USB_serial",
- "USB_IOS");
+ const connection_handler::Device usb(
+ device_id + 1, "USB_device", "USB_serial", "USB_IOS");
MockHMICommandFactory* mock_hmi_factory =
MockHMICommandFactory::mock_hmi_command_factory();
@@ -218,8 +214,8 @@ TEST_F(ApplicationManagerImplMockHmiTest,
utils::MakeShared<smart_objects::SmartObject>();
(*hmi_msg_1)[strings::msg_params][strings::app_id] =
- (*hmi_msg_2)[strings::msg_params][strings::app_id] =
- (*hmi_msg_3)[strings::msg_params][strings::app_id] = application_id;
+ (*hmi_msg_2)[strings::msg_params][strings::app_id] =
+ (*hmi_msg_3)[strings::msg_params][strings::app_id] = application_id;
EXPECT_CALL(*cmd_1, Init()).Times(0);
EXPECT_CALL(*cmd_2, Init()).Times(0);
diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc
index 4398952237..4ebbbe7141 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -715,10 +715,8 @@ TEST_F(ApplicationManagerImplTest,
// Act
const connection_handler::DeviceHandle switching_handle = 1;
- const connection_handler::Device switching_device(switching_handle,
- "switching_device",
- switching_device_id,
- "BLUETOOTH");
+ const connection_handler::Device switching_device(
+ switching_handle, "switching_device", switching_device_id, "BLUETOOTH");
const connection_handler::DeviceHandle non_switching_handle = 2;
const connection_handler::Device non_switching_device(non_switching_handle,
@@ -775,10 +773,8 @@ TEST_F(ApplicationManagerImplTest,
// Act
const connection_handler::DeviceHandle switching_handle = 1;
- const connection_handler::Device switching_device(switching_handle,
- "switching_device",
- switching_device_id,
- "BLUETOOTH");
+ const connection_handler::Device switching_device(
+ switching_handle, "switching_device", switching_device_id, "BLUETOOTH");
const connection_handler::DeviceHandle non_switching_handle = 2;
const connection_handler::Device non_switching_device(non_switching_handle,
diff --git a/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc
index bf619e5229..b7a004f199 100644
--- a/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc
@@ -432,7 +432,7 @@ TEST_F(RegisterAppInterfaceRequestTest,
mock_app),
request_hash_id)).WillOnce(Return(true));
- EXPECT_CALL(mock_resume_crt_, RemoveApplicationFromSaved(_)).Times(0);
+ EXPECT_CALL(mock_resume_crt_, RemoveApplicationFromSaved(_)).Times(0);
EXPECT_CALL(mock_application_helper_, RecallApplicationData(_, _)).Times(0);
@@ -467,7 +467,7 @@ TEST_F(RegisterAppInterfaceRequestTest,
mock_app),
request_hash_id)).WillOnce(Return(false));
- EXPECT_CALL(
+ EXPECT_CALL(
mock_application_helper_,
RecallApplicationData(
MockAppPtr::static_pointer_cast<application_manager::Application>(