diff options
author | jacobkeeler <jacob.keeler@livioradio.com> | 2019-03-06 13:20:21 -0500 |
---|---|---|
committer | jacobkeeler <jacob.keeler@livioradio.com> | 2019-03-06 13:20:21 -0500 |
commit | bcd314658814edf6b822b9a23267c0694865e06c (patch) | |
tree | 19a41eced6de792941d1d0ef6064ed9e243c6bd2 | |
parent | 7b2af762ed58252c2d01a6a3bc1dc4a8ec13f5da (diff) | |
download | sdl_core-bcd314658814edf6b822b9a23267c0694865e06c.tar.gz |
Implement cloud app properties revisionfeature/cloud_app_properties_revisions
22 files changed, 77 insertions, 86 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 2dc9f73373..691ac21040 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -1954,9 +1954,14 @@ void PolicyHandler::OnSetCloudAppProperties( policy_manager_->SetAppEndpoint(policy_app_id, properties[strings::endpoint].asString()); } - if (properties.keyExists(strings::app_name)) { - policy_manager_->SetAppName(policy_app_id, - properties[strings::app_name].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 c1c2b419a1..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,11 +600,11 @@ class PolicyManager : public usage_statistics::StatisticsManager { const std::string& endpoint) = 0; /** - * @brief Set a cloud app's name - * @param app_name Nickname for cloud app + * @brief Set a cloud app's nicknames + * @param nicknames Nicknames for cloud app */ - virtual void SetAppName(const std::string& policy_app_id, - const std::string& app_name) = 0; + 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 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 2a5a6c2239..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,11 +581,11 @@ class PolicyManager : public usage_statistics::StatisticsManager { const std::string& endpoint) = 0; /** - * @brief Set a cloud app's name - * @param app_name Nickname for cloud app + * @brief Set a cloud app's nicknames + * @param nicknames Nicknames for cloud app */ - virtual void SetAppName(const std::string& policy_app_id, - const std::string& app_name) = 0; + 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 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 04cc0347c3..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,9 +98,9 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface { MOCK_METHOD2(SetAppEndpoint, void(const std::string& policy_app_id, const std::string& endpoint)); - MOCK_METHOD2(SetAppName, + MOCK_METHOD2(SetAppNicknames, void(const std::string& policy_app_id, - const std::string& app_name)); + 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 f1abdc496e..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,9 +207,9 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD2(SetAppEndpoint, void(const std::string& policy_app_id, const std::string& endpoint)); - MOCK_METHOD2(SetAppName, + MOCK_METHOD2(SetAppNicknames, void(const std::string& policy_app_id, - const std::string& app_name)); + 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 0b6af6fd6f..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,9 +85,9 @@ class MockCacheManagerInterface : public CacheManagerInterface { MOCK_METHOD2(SetAppEndpoint, void(const std::string& policy_app_id, const std::string& endpoint)); - MOCK_METHOD2(SetAppName, + MOCK_METHOD2(SetAppNicknames, void(const std::string& policy_app_id, - const std::string& app_name)); + 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 de24b8b949..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,9 +203,9 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD2(SetAppEndpoint, void(const std::string& policy_app_id, const std::string& endpoint)); - MOCK_METHOD2(SetAppName, + MOCK_METHOD2(SetAppNicknames, void(const std::string& policy_app_id, - const std::string& app_name)); + 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 943bf1e743..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,11 +228,11 @@ class CacheManager : public CacheManagerInterface { const std::string& endpoint); /** - * @brief Set a cloud app's name - * @param app_name Nickname for cloud app + * @brief Set a cloud app's nicknames + * @param nicknames Nicknames for cloud app */ - virtual void SetAppName(const std::string& policy_app_id, - const std::string& app_name); + 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 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 bafc65e208..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,11 +236,11 @@ class CacheManagerInterface { const std::string& endpoint) = 0; /** - * @brief Set a cloud app's name - * @param app_name Nickname for cloud app + * @brief Set a cloud app's nicknames + * @param nicknames Nicknames for cloud app */ - virtual void SetAppName(const std::string& policy_app_id, - const std::string& app_name) = 0; + 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 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 d73409ec17..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,11 +647,11 @@ class PolicyManagerImpl : public PolicyManager { const std::string& endpoint) OVERRIDE; /** - * @brief Set a cloud app's name - * @param app_name Nickname for cloud app + * @brief Set a cloud app's nicknames + * @param nicknames Nicknames for cloud app */ - void SetAppName(const std::string& policy_app_id, - const std::string& app_name) OVERRIDE; + 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 diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 23bca24476..c105a9161d 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -1500,14 +1500,14 @@ void CacheManager::SetAppEndpoint(const std::string& policy_app_id, } } -void CacheManager::SetAppName(const std::string& policy_app_id, - const std::string& app_name) { +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->push_back(app_name); + (*(*policy_iter).second.nicknames) = nicknames; } } 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 6931ec87b8..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,9 +782,9 @@ void PolicyManagerImpl::SetAppEndpoint(const std::string& policy_app_id, cache_->SetAppEndpoint(policy_app_id, endpoint); } -void PolicyManagerImpl::SetAppName(const std::string& policy_app_id, - const std::string& app_name) { - cache_->SetAppName(policy_app_id, app_name); +void PolicyManagerImpl::SetAppNicknames(const std::string& policy_app_id, + const StringArray& nicknames) { + cache_->SetAppNicknames(policy_app_id, nicknames); } void PolicyManagerImpl::SetHybridAppPreference( 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 b6b6691985..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,11 +216,11 @@ class CacheManager : public CacheManagerInterface { const std::string& endpoint); /** - * @brief Set a cloud app's name - * @param app_name Nickname for cloud app + * @brief Set a cloud app's nicknames + * @param nicknames Nicknames for cloud app */ - virtual void SetAppName(const std::string& policy_app_id, - const std::string& app_name); + 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 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 13479f7595..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,11 +222,11 @@ class CacheManagerInterface { const std::string& endpoint) = 0; /** - * @brief Set a cloud app's name - * @param app_name Nickname for cloud app + * @brief Set a cloud app's nicknames + * @param nicknames Nicknames for cloud app */ - virtual void SetAppName(const std::string& policy_app_id, - const std::string& app_name) = 0; + 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 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 5e46ff9fa1..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,11 +642,11 @@ class PolicyManagerImpl : public PolicyManager { const std::string& endpoint) OVERRIDE; /** - * @brief Set a cloud app's name - * @param app_name Nickname for cloud app + * @brief Set a cloud app's nicknames + * @param nicknames Nicknames for cloud app */ - void SetAppName(const std::string& policy_app_id, - const std::string& app_name) OVERRIDE; + 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 diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 9407f28132..a8e033d505 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -795,14 +795,14 @@ void CacheManager::SetAppEndpoint(const std::string& policy_app_id, } } -void CacheManager::SetAppName(const std::string& policy_app_id, - const std::string& app_name) { +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->push_back(app_name); + (*(*policy_iter).second.nicknames) = nicknames; } } 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 12502bc6d4..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,9 +601,9 @@ void PolicyManagerImpl::SetAppEndpoint(const std::string& policy_app_id, cache_->SetAppEndpoint(policy_app_id, endpoint); } -void PolicyManagerImpl::SetAppName(const std::string& policy_app_id, - const std::string& app_name) { - cache_->SetAppName(policy_app_id, app_name); +void PolicyManagerImpl::SetAppNicknames(const std::string& policy_app_id, + const StringArray& nicknames) { + cache_->SetAppNicknames(policy_app_id, nicknames); } void PolicyManagerImpl::SetHybridAppPreference( |