summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2018-12-12 16:39:14 -0500
committerjacobkeeler <jacob.keeler@livioradio.com>2018-12-12 16:39:14 -0500
commit64047e5f7fbd07a2a332246dcf07a10f39361561 (patch)
tree8df377ab36bfbeff4cb167370cc993c4abc62035
parent94273e3fd8db6617983def5abd3658f5af8c2983 (diff)
downloadsdl_core-64047e5f7fbd07a2a332246dcf07a10f39361561.tar.gz
Refresh app list when an app is enabled or disabled
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h)6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h)6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc49
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc)2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc83
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc4
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc65
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc2
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_impl.h2
-rw-r--r--src/components/connection_handler/src/connection_handler_impl.cc4
-rw-r--r--src/components/include/application_manager/application_manager.h2
-rw-r--r--src/components/include/connection_handler/connection_handler.h2
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h1
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler.h1
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager.h1
-rw-r--r--src/components/include/transport_manager/transport_manager.h2
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_manager_impl.h2
-rw-r--r--src/components/transport_manager/src/cloud/websocket_client_connection.cc2
-rw-r--r--src/components/transport_manager/src/transport_manager_impl.cc5
20 files changed, 142 insertions, 101 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 a3e3cece72..08421615d4 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
@@ -360,7 +360,7 @@ class ApplicationManagerImpl
void ConnectToDevice(const std::string& device_mac) OVERRIDE;
void OnHMIStartedCooperation() OVERRIDE;
- void CollectCloudAppInformation();
+ void RefreshCloudAppInformation() OVERRIDE;
void CreatePendingApplication(
const transport_manager::ConnectionUID connection_id,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h
index 0c62b248b4..a3a3ea12f9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h
@@ -1,5 +1,5 @@
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_REQUEST_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_REQUEST_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_
#include "application_manager/commands/command_request_impl.h"
@@ -28,4 +28,4 @@ class SetCloudAppPropertiesRequest
} // namespace commands
} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_REQUEST_H_ \ No newline at end of file
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h
index 9037cb3b73..df71a2aaf5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h
@@ -1,5 +1,5 @@
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_RESPONSE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_RESPONSE_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_
#include "application_manager/commands/command_response_impl.h"
@@ -28,4 +28,4 @@ class SetCloudAppPropertiesResponse
} // namespace commands
} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUDAPP_PROPERTIES_RESPONSE_H_ \ No newline at end of file
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_ \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
new file mode 100644
index 0000000000..663881a2ea
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
@@ -0,0 +1,49 @@
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {}
+
+void SetCloudAppPropertiesRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ if ((*message_)[strings::msg_params].empty()) {
+ LOG4CXX_ERROR(logger_, strings::msg_params << " is empty.");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+
+ policy_handler_.OnSetCloudAppProperties(*message_);
+
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+}
+
+void SetCloudAppPropertiesRequest::on_event(
+ const app_mngr::event_engine::Event& event) {
+ LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event");
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc
index 6acfb2423d..6d27ce8b3e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc
@@ -1,6 +1,6 @@
#include "application_manager/application_manager.h"
#include "application_manager/rpc_service.h"
-#include "sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h"
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc
deleted file mode 100644
index 0beb7631c7..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloudapp_properties_request.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-#include "sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
-
-SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {}
-
-void SetCloudAppPropertiesRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = application_manager_.application(connection_key());
-
- if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
- SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- return;
- }
-
- if ((*message_)[strings::msg_params].empty()) {
- LOG4CXX_ERROR(logger_, strings::msg_params << " is empty.");
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
- }
-
- smart_objects::SmartObject cloud_app_properties(smart_objects::SmartType_Map);
-
- cloud_app_properties[strings::msg_params][strings::app_name] =
- (*message_)[strings::msg_params][strings::app_name];
- cloud_app_properties[strings::msg_params][strings::app_id] =
- (*message_)[strings::msg_params][strings::app_id];
-
- if ((*message_)[strings::msg_params].keyExists(strings::enabled)) {
- smart_objects::SmartObject enabled =
- (*message_)[strings::msg_params][strings::enabled];
- cloud_app_properties[strings::msg_params][strings::enabled] = enabled;
- }
- if ((*message_)[strings::msg_params].keyExists(
- strings::cloud_app_auth_token)) {
- smart_objects::SmartObject auth_token =
- (*message_)[strings::msg_params][strings::cloud_app_auth_token];
- cloud_app_properties[strings::msg_params][strings::cloud_app_auth_token] =
- auth_token;
- }
- if ((*message_)[strings::msg_params].keyExists(
- strings::cloud_transport_type)) {
- smart_objects::SmartObject transport_type =
- (*message_)[strings::msg_params][strings::cloud_transport_type];
- cloud_app_properties[strings::msg_params][strings::cloud_transport_type] =
- transport_type;
- }
- if ((*message_)[strings::msg_params].keyExists(
- strings::hybrid_app_preference)) {
- smart_objects::SmartObject hybrid_app_preference =
- (*message_)[strings::msg_params][strings::hybrid_app_preference];
- cloud_app_properties[strings::msg_params][strings::hybrid_app_preference] =
- hybrid_app_preference;
- }
-
- policy_handler_.OnSetCloudAppProperties(cloud_app_properties);
-
- SendResponse(true, mobile_apis::Result::SUCCESS);
-}
-
-void SetCloudAppPropertiesRequest::on_event(
- const app_mngr::event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event");
-}
-
-} // namespace commands
-} // namespace sdl_rpc_plugin \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index dc5298813b..8eab054be3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -124,8 +124,8 @@
#include "sdl_rpc_plugin/commands/mobile/dial_number_response.h"
#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h"
#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h"
-#include "sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_request.h"
-#include "sdl_rpc_plugin/commands/mobile/set_cloudapp_properties_response.h"
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h"
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h"
#include "interfaces/MOBILE_API.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index d188ed9724..97d5e66b6b 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -803,21 +803,25 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() {
rpc_service_->ManageHMICommand(mixing_audio_supported_request);
resume_controller().ResetLaunchTime();
- CollectCloudAppInformation();
+ RefreshCloudAppInformation();
}
-void ApplicationManagerImpl::CollectCloudAppInformation() {
+void ApplicationManagerImpl::RefreshCloudAppInformation() {
LOG4CXX_AUTO_TRACE(logger_);
- std::vector<std::string> cloud_app_id_vector;
- GetPolicyHandler().GetEnabledCloudApps(cloud_app_id_vector);
- std::vector<std::string>::iterator it = cloud_app_id_vector.begin();
- std::vector<std::string>::iterator end = cloud_app_id_vector.end();
+ std::vector<std::string> enabled_apps;
+ GetPolicyHandler().GetEnabledCloudApps(enabled_apps);
+ std::vector<std::string>::iterator it = enabled_apps.begin();
+ std::vector<std::string>::iterator end = enabled_apps.end();
std::string endpoint = "";
std::string certificate = "";
std::string auth_token = "";
std::string cloud_transport_type = "";
std::string hybrid_app_preference = "";
bool enabled = true;
+
+ // Store old device map and clear the current map
+ std::map<std::string, std::string> old_device_map = pending_device_map_;
+ pending_device_map_ = std::map<std::string, std::string>();
for (; it != end; ++it) {
GetPolicyHandler().GetCloudAppParameters(*it,
enabled,
@@ -829,9 +833,56 @@ void ApplicationManagerImpl::CollectCloudAppInformation() {
pending_device_map_.insert(
std::pair<std::string, std::string>(endpoint, *it));
+ auto old_device = old_device_map.find(endpoint);
+ if (old_device_map.find(endpoint) != old_device_map.end()) {
+ old_device_map.erase(old_device);
+ continue;
+ }
connection_handler().AddCloudAppDevice(*it, endpoint, cloud_transport_type);
}
+
+ int removed_app_count = 0;
+ // Clear out devices for existing cloud apps that were disabled
+ for (auto& device : old_device_map) {
+ std::string policy_app_id = device.second;
+ ApplicationSharedPtr app = application_by_policy_id(policy_app_id);
+ if (app.use_count() == 0) {
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ PolicyAppIdPredicate finder(policy_app_id);
+ ApplicationSet::iterator it = std::find_if(
+ apps_to_register_.begin(), apps_to_register_.end(), finder);
+ if (it == apps_to_register_.end()) {
+ continue;
+ }
+ app = *it;
+ apps_to_register_.erase(it);
+ }
+ if (app.use_count() == 0) {
+ LOG4CXX_DEBUG(logger_,
+ "Unable to find app to remove (" << policy_app_id
+ << "), skipping");
+ continue;
+ }
+ if (app->IsRegistered() && app->is_cloud_app()) {
+ LOG4CXX_DEBUG(logger_, "Disabled app is registered, unregistering now");
+ GetRPCService().ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED),
+ commands::Command::SOURCE_SDL);
+
+ OnAppUnauthorized(app->app_id());
+ }
+ connection_handler().RemoveCloudAppDevice(app->device());
+ removed_app_count++;
+ }
+
+ // Update app list if disabled apps were removed
+ if (removed_app_count > 0) {
+ LOG4CXX_DEBUG(logger_, "Removed " << removed_app_count << " disabled apps");
+ SendUpdateAppList();
+ }
}
void ApplicationManagerImpl::CreatePendingApplication(
@@ -3529,7 +3580,7 @@ void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) {
if (!ptu_result) {
return;
}
- CollectCloudAppInformation();
+ RefreshCloudAppInformation();
auto on_app_policy_updated = [](plugin_manager::RPCPlugin& plugin) {
plugin.OnPolicyEvent(plugin_manager::kApplicationPolicyUpdated);
};
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index c603659353..3be3ef0da7 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1912,6 +1912,8 @@ void PolicyHandler::OnSetCloudAppProperties(
if (msg_params.keyExists(strings::enabled)) {
policy_manager_->SetCloudAppEnabled(policy_app_id,
msg_params[strings::enabled].asBool());
+
+ application_manager_.RefreshCloudAppInformation();
}
if (msg_params.keyExists(strings::cloud_app_auth_token)) {
policy_manager_->SetAppAuthToken(
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
index b8153bcf42..e9e7ba47a3 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
@@ -134,6 +134,8 @@ class ConnectionHandlerImpl
const std::string& endpoint,
const std::string& cloud_transport_type) OVERRIDE;
+ void RemoveCloudAppDevice(const DeviceHandle device_id) OVERRIDE;
+
void StartTransportManager() OVERRIDE;
void OnDeviceListUpdated(
diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc
index f72cab61f3..679cbd1af0 100644
--- a/src/components/connection_handler/src/connection_handler_impl.cc
+++ b/src/components/connection_handler/src/connection_handler_impl.cc
@@ -1330,6 +1330,10 @@ void ConnectionHandlerImpl::AddCloudAppDevice(
transport_manager_.AddCloudDevice(endpoint, cloud_transport_type);
}
+void ConnectionHandlerImpl::RemoveCloudAppDevice(const DeviceHandle device_id) {
+ transport_manager_.RemoveCloudDevice(device_id);
+}
+
void ConnectionHandlerImpl::StartTransportManager() {
LOG4CXX_AUTO_TRACE(logger_);
transport_manager_.Visibility(true);
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index 9e979da08e..47b6bcbc9d 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -427,6 +427,8 @@ class ApplicationManager {
virtual void OnHMIStartedCooperation() = 0;
+ virtual void RefreshCloudAppInformation() = 0;
+
/**
* @brief Retrieve the current connection status of a cloud app
* @param app A cloud application
diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h
index eb41141842..a4058c7078 100644
--- a/src/components/include/connection_handler/connection_handler.h
+++ b/src/components/include/connection_handler/connection_handler.h
@@ -107,6 +107,8 @@ class ConnectionHandler {
const std::string& endpoint,
const std::string& cloud_transport_type) = 0;
+ virtual void RemoveCloudAppDevice(const DeviceHandle device_id) = 0;
+
/**
* @brief Close the connection revoked by Policy
* @param connection_key pair of connection and session id
diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h
index ca8aa2eb96..30a24ad9ce 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -166,6 +166,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD1(EndAudioPassThru, bool(uint32_t app_id));
MOCK_METHOD1(ConnectToDevice, void(const std::string& device_mac));
MOCK_METHOD0(OnHMIStartedCooperation, void());
+ MOCK_METHOD0(RefreshCloudAppInformation, void());
MOCK_CONST_METHOD1(GetCloudAppConnectionStatus,
hmi_apis::Common_CloudConnectionStatus::eType(
application_manager::ApplicationConstSharedPtr app));
diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h
index 5836626ae3..219ee7b561 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler.h
@@ -70,6 +70,7 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
void(const std::string& policy_app_id,
const std::string& endpoint,
const std::string& cloud_transport_type));
+ MOCK_METHOD1(RemoveCloudAppDevice, void(const DeviceHandle device_id));
MOCK_METHOD1(CloseRevokedConnection, void(uint32_t connection_key));
MOCK_METHOD1(CloseConnection, void(ConnectionHandle connection_handle));
MOCK_METHOD1(GetConnectionSessionsCount, uint32_t(uint32_t connection_key));
diff --git a/src/components/include/test/transport_manager/mock_transport_manager.h b/src/components/include/test/transport_manager/mock_transport_manager.h
index 555d51bf76..40168c9c37 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager.h
@@ -62,6 +62,7 @@ class MockTransportManager : public ::transport_manager::TransportManager,
MOCK_METHOD2(AddCloudDevice,
void(const std::string& endpoint,
const std::string& cloud_transport_type));
+ MOCK_METHOD1(RemoveCloudDevice, void(const DeviceHandle device_id));
MOCK_METHOD1(ConnectDevice, int(const DeviceHandle));
MOCK_CONST_METHOD1(
GetConnectionStatus,
diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h
index 3ecf815097..2596ba1b77 100644
--- a/src/components/include/transport_manager/transport_manager.h
+++ b/src/components/include/transport_manager/transport_manager.h
@@ -78,6 +78,8 @@ class TransportManager {
virtual void AddCloudDevice(const std::string& endpoint,
const std::string& cloud_transport_type) = 0;
+ virtual void RemoveCloudDevice(const DeviceHandle device_id) = 0;
+
/**
* @brief Connect to all applications discovered on device.
*
diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
index c84b1e9a39..4b75f4aaa8 100644
--- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
@@ -142,6 +142,8 @@ class TransportManagerImpl
void AddCloudDevice(const std::string& endpoint,
const std::string& cloud_transport_type) OVERRIDE;
+ void RemoveCloudDevice(const DeviceHandle device_id) OVERRIDE;
+
/**
* @brief Connect to all applications discovered on device.
*
diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
index 4f585c8efb..10a2b50baa 100644
--- a/src/components/transport_manager/src/cloud/websocket_client_connection.cc
+++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
@@ -241,4 +241,4 @@ void WebsocketClientConnection::LoopThreadDelegate::SetShutdown() {
}
} // namespace transport_adapter
-} // namespace transport_manager \ No newline at end of file
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc
index 518a5639db..5b4378efee 100644
--- a/src/components/transport_manager/src/transport_manager_impl.cc
+++ b/src/components/transport_manager/src/transport_manager_impl.cc
@@ -149,6 +149,11 @@ void TransportManagerImpl::AddCloudDevice(
return;
}
+void TransportManagerImpl::RemoveCloudDevice(const DeviceHandle device_handle) {
+ DisconnectDevice(device_handle);
+ RemoveDevice(device_handle);
+}
+
int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) {
LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
if (!this->is_initialized_) {