summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-03-01 15:00:38 -0500
committerGitHub <noreply@github.com>2019-03-01 15:00:38 -0500
commitfc9f7d13c0e03caee9e196a636815e791213ad66 (patch)
tree1ab8631036aaa75a335797e9efae07eba0413e05 /src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands
parentbc6cec5d29ff36b7092112dc1ea69ccd4d92acc3 (diff)
downloadsdl_core-fc9f7d13c0e03caee9e196a636815e791213ad66.tar.gz
Get Icon URL Request (#2823)
* Fix regex command for reading paths post port number * Add Icon URL to policies * Create Icon Request and save to icon folder. * Fixes for get icon url * Fix unit tests * Send Icon_url request after PTU * Address comments * Address Comments
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc26
2 files changed, 26 insertions, 3 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 b346ee5798..6317d9b068 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
@@ -447,6 +447,9 @@ void RegisterAppInterfaceRequest::Run() {
GetLockScreenIconUrlNotification(connection_key(), application);
rpc_service_.ManageMobileCommand(so, SOURCE_SDL);
application_manager_.SendDriverDistractionState(application);
+ // Create onSystemRequest to mobile to obtain cloud app icons
+ application_manager_.SendGetIconUrlNotifications(connection_key(),
+ application);
}
smart_objects::SmartObjectSPtr
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
index cea00a9d5e..da39aefd6a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
@@ -511,7 +511,8 @@ void SystemRequest::Run() {
return;
}
- if (!file_system::IsFileNameValid(file_name)) {
+ if (!file_system::IsFileNameValid(file_name) &&
+ mobile_apis::RequestType::ICON_URL != request_type) {
const std::string err_msg = "Sync file name contains forbidden symbols.";
LOG4CXX_ERROR(logger_, err_msg);
SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
@@ -533,8 +534,21 @@ void SystemRequest::Run() {
std::string binary_data_folder;
if ((*message_)[strings::params].keyExists(strings::binary_data)) {
binary_data = (*message_)[strings::params][strings::binary_data].asBinary();
- binary_data_folder =
- application_manager_.get_settings().system_files_path();
+ if (mobile_apis::RequestType::ICON_URL == request_type) {
+ binary_data_folder =
+ application_manager_.get_settings().app_icons_folder();
+ // Use the URL file name to identify the policy id.
+ // Save the icon file with the policy id as the name.
+ file_name = application_manager_.PolicyIDByIconUrl(file_name);
+ if (file_name.empty()) {
+ const std::string err_msg = "Invalid file name";
+ SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
+ }
+ LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name);
+ } else {
+ binary_data_folder =
+ application_manager_.get_settings().system_files_path();
+ }
} else {
binary_data_folder =
application_manager_.get_settings().app_storage_folder();
@@ -581,6 +595,12 @@ void SystemRequest::Run() {
LOG4CXX_DEBUG(logger_, "Binary data ok.");
+ if (mobile_apis::RequestType::ICON_URL == request_type) {
+ application_manager_.SetIconFileFromSystemRequest(file_name);
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+ return;
+ }
+
if (mobile_apis::RequestType::HTTP == request_type &&
(*message_)[strings::msg_params].keyExists(strings::file_name)) {
const std::string& file =