summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2019-03-07 21:18:18 -0500
committerGitHub <noreply@github.com>2019-03-07 21:18:18 -0500
commit3da1fc5cd3a1873400ea28cb9977926ffa56e34c (patch)
tree3093c515daf1fabb8b78d95a3233de70a2c1f8b6
parentda94380c916d22127da156bec2a753398f44b4db (diff)
parentbcd314658814edf6b822b9a23267c0694865e06c (diff)
downloadsdl_core-feature/cloud_app_transport.tar.gz
Merge pull request #2834 from smartdevicelink/feature/cloud_app_properties_revisionsfeature/cloud_app_transport
Implement cloud app properties revision
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc34
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc6
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc9
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc1
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h7
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h7
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h3
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h3
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h3
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h3
-rw-r--r--src/components/interfaces/MOBILE_API.xml6
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h7
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h7
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h7
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc11
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc5
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h7
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h6
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h7
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc11
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc5
22 files changed, 125 insertions, 31 deletions
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index aaca228eda..2e8b02d06b 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -188,6 +188,7 @@ extern const char* green;
extern const char* blue;
extern const char* display_layout;
extern const char* icon_resumed;
+extern const char* nicknames;
extern const char* enabled;
extern const char* auth_token;
extern const char* cloud_transport_type;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
index 62c91ff3d5..34ed30c243 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
@@ -54,32 +54,20 @@ void GetCloudAppPropertiesRequest::Run() {
return;
}
- ApplicationSharedPtr cloud_app =
- application_manager_.application_by_policy_id(policy_app_id);
- std::string cloud_name;
- if (cloud_app) {
- cloud_name = cloud_app->name().AsMBString();
- } else {
- policy::StringArray nicknames;
- policy::StringArray app_hmi_types;
-
- policy_handler_.GetInitialAppData(
- policy_app_id, &nicknames, &app_hmi_types);
-
- if (!nicknames.size()) {
- LOG4CXX_ERROR(logger_, "Cloud App missing nickname");
- SendResponse(false,
- mobile_apis::Result::DATA_NOT_AVAILABLE,
- "No available nick names for the requested app");
- return;
- }
- cloud_name = nicknames[0];
- }
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ policy_handler_.GetInitialAppData(policy_app_id, &nicknames, &app_hmi_types);
smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
smart_objects::SmartObject properties(smart_objects::SmartType_Map);
-
- properties[strings::app_name] = cloud_name;
+ smart_objects::SmartObject nicknames_array(smart_objects::SmartType_Array);
+ size_t i = 0;
+ for (std::string nickname : nicknames) {
+ nicknames_array[i] = nickname;
+ ++i;
+ }
+ properties[strings::nicknames] = nicknames_array;
properties[strings::app_id] = policy_app_id;
properties[strings::enabled] = enabled;
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
index 663881a2ea..5173be56d6 100644
--- 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
@@ -29,12 +29,6 @@ void SetCloudAppPropertiesRequest::Run() {
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);
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 7d94e19b12..691ac21040 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1954,6 +1954,15 @@ void PolicyHandler::OnSetCloudAppProperties(
policy_manager_->SetAppEndpoint(policy_app_id,
properties[strings::endpoint].asString());
}
+ if (properties.keyExists(strings::nicknames)) {
+ StringArray nicknames;
+ const smart_objects::SmartObject& nicknames_array =
+ properties[strings::nicknames];
+ for (size_t i = 0; i < nicknames_array.length(); ++i) {
+ nicknames.push_back(nicknames_array[i].asString());
+ }
+ policy_manager_->SetAppNicknames(policy_app_id, nicknames);
+ }
if (properties.keyExists(strings::hybrid_app_preference)) {
std::string hybrid_app_preference;
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 109739c359..485b59c520 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -155,6 +155,7 @@ const char* green = "green";
const char* blue = "blue";
const char* display_layout = "displayLayout";
const char* icon_resumed = "iconResumed";
+const char* nicknames = "nicknames";
const char* enabled = "enabled";
const char* auth_token = "authToken";
const char* cloud_transport_type = "cloudTransportType";
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 61ad6b9a91..64306d7e0a 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -600,6 +600,13 @@ class PolicyManager : public usage_statistics::StatisticsManager {
const std::string& endpoint) = 0;
/**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 0;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index 898c9ff2c6..0528dc9f36 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -581,6 +581,13 @@ class PolicyManager : public usage_statistics::StatisticsManager {
const std::string& endpoint) = 0;
/**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 0;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
index d47a88fe54..2885126fd1 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
@@ -98,6 +98,9 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD2(SetAppEndpoint,
void(const std::string& policy_app_id,
const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
MOCK_METHOD2(SetHybridAppPreference,
void(const std::string& policy_app_id,
const std::string& hybrid_app_preference));
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index 9b21d95f1b..d7d81b3476 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -207,6 +207,9 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(SetAppEndpoint,
void(const std::string& policy_app_id,
const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
MOCK_METHOD2(SetHybridAppPreference,
void(const std::string& policy_app_id,
const std::string& hybrid_app_preference));
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
index 83774ab7cd..ff186b5ab4 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
@@ -85,6 +85,9 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD2(SetAppEndpoint,
void(const std::string& policy_app_id,
const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
MOCK_METHOD2(SetHybridAppPreference,
void(const std::string& policy_app_id,
const std::string& hybrid_app_preference));
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index 401db5586f..4e3121397f 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -203,6 +203,9 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(SetAppEndpoint,
void(const std::string& policy_app_id,
const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
MOCK_METHOD2(SetHybridAppPreference,
void(const std::string& policy_app_id,
const std::string& hybrid_app_preference));
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 33613d2eca..e7dbc1e089 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -553,7 +553,9 @@
</enum>
<struct name="CloudAppProperties" since="5.1">
- <param name="appName" type="String" maxlength="100" mandatory="true"></param>
+ <param name="nicknames" type="String" minlength="0" maxlength="100" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>An array of app names a cloud app is allowed to register with. If included in a SetCloudAppProperties request, this value will overwrite the existing "nicknames" field in the app policies section of the policy table.</description>
+ </param>
<param name="appID" type="String" maxlength="100" mandatory="true"></param>
<param name="enabled" type="Boolean" mandatory="false">
<description>If true, cloud app will be included in HMI RPC UpdateAppList</description>
@@ -963,7 +965,7 @@
<description>Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video (UHD) and also enables lossless compression.</description>
</element>
</enum>
-
+
<enum name="AudioStreamingIndicator" since="5.0">
<element name="PLAY_PAUSE">
<description>
diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h
index 25adbe19f7..a1db3536c2 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -228,6 +228,13 @@ class CacheManager : public CacheManagerInterface {
const std::string& endpoint);
/**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames);
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
index 86b4373650..78546823c4 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
@@ -236,6 +236,13 @@ class CacheManagerInterface {
const std::string& endpoint) = 0;
/**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 0;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index 35fd3a1a7e..8ba0aafacc 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -647,6 +647,13 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& endpoint) OVERRIDE;
/**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) OVERRIDE;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index b0ff7f12d2..c105a9161d 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1500,6 +1500,17 @@ void CacheManager::SetAppEndpoint(const std::string& policy_app_id,
}
}
+void CacheManager::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ (*(*policy_iter).second.nicknames) = nicknames;
+ }
+}
+
void CacheManager::SetHybridAppPreference(
const std::string& policy_app_id,
const std::string& hybrid_app_preference) {
diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc
index 37f5ab666f..28e493c115 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -782,6 +782,11 @@ void PolicyManagerImpl::SetAppEndpoint(const std::string& policy_app_id,
cache_->SetAppEndpoint(policy_app_id, endpoint);
}
+void PolicyManagerImpl::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ cache_->SetAppNicknames(policy_app_id, nicknames);
+}
+
void PolicyManagerImpl::SetHybridAppPreference(
const std::string& policy_app_id,
const std::string& hybrid_app_preference) {
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h
index 3b3c941b20..b789c7252c 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -216,6 +216,13 @@ class CacheManager : public CacheManagerInterface {
const std::string& endpoint);
/**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames);
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
index a50127d141..4a59bfb8a9 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
@@ -222,6 +222,12 @@ class CacheManagerInterface {
const std::string& endpoint) = 0;
/**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 0;
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
index 357d3f1c87..1b5a78ed00 100644
--- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
@@ -642,6 +642,13 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& endpoint) OVERRIDE;
/**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) OVERRIDE;
+
+ /**
* @brief Set the user preference for how a hybrid (cloud and mobile) app
* should be used
* @param hybrid_app_preference Hybrid app user preference
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index 1a0a908f5d..a8e033d505 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -795,6 +795,17 @@ void CacheManager::SetAppEndpoint(const std::string& policy_app_id,
}
}
+void CacheManager::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ (*(*policy_iter).second.nicknames) = nicknames;
+ }
+}
+
void CacheManager::SetHybridAppPreference(
const std::string& policy_app_id,
const std::string& hybrid_app_preference) {
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index ae07b5529c..bbd843b7c2 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -601,6 +601,11 @@ void PolicyManagerImpl::SetAppEndpoint(const std::string& policy_app_id,
cache_->SetAppEndpoint(policy_app_id, endpoint);
}
+void PolicyManagerImpl::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ cache_->SetAppNicknames(policy_app_id, nicknames);
+}
+
void PolicyManagerImpl::SetHybridAppPreference(
const std::string& policy_app_id,
const std::string& hybrid_app_preference) {