summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-02-24 17:06:00 -0500
committerJackLivio <jack@livio.io>2019-02-24 17:06:00 -0500
commitf789a38996f767d95705f885434a6534a6e240c5 (patch)
tree6bec02b140275d7433da210b956c9601b8f20025
parent5a2bd2df26fb3895f76778490f0aa7974215a812 (diff)
downloadsdl_core-feature/icon_url.tar.gz
Add Icon URL to policiesfeature/icon_url
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h1
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc8
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h1
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h8
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h8
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h1
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h1
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h1
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h1
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h1
-rw-r--r--src/components/interfaces/HMI_API.xml1
-rw-r--r--src/components/interfaces/MOBILE_API.xml1
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h8
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h8
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h8
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/enums.h1
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/types.h1
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml2
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc14
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc4
-rw-r--r--src/components/policy/policy_external/src/policy_table/enums.cc8
-rw-r--r--src/components/policy/policy_external/src/policy_table/types.cc14
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_queries.cc6
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_representation.cc4
-rw-r--r--src/components/policy/policy_external/src/sql_pt_queries.cc13
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc6
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h8
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h8
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h8
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/types.h1
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc14
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc4
-rw-r--r--src/components/policy/policy_regular/src/policy_table/types.cc14
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc13
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc6
35 files changed, 188 insertions, 18 deletions
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 8ee5ff64f6..7643ad1ee2 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
@@ -187,6 +187,7 @@ class PolicyHandler : public PolicyHandlerInterface,
void GetUpdateUrls(const uint32_t service_type,
EndpointUrls& out_end_points) OVERRIDE;
virtual std::string GetLockScreenIconUrl() const OVERRIDE;
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const OVERRIDE;
uint32_t NextRetryTimeout() OVERRIDE;
/**
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 3be3ef0da7..3f16a637ed 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -91,7 +91,8 @@ RequestTypeMap TypeToString = {
{mobile_apis::RequestType::EMERGENCY, "EMERGENCY"},
{mobile_apis::RequestType::MEDIA, "MEDIA"},
{mobile_apis::RequestType::FOTA, "FOTA"},
- {mobile_apis::RequestType::OEM_SPECIFIC, "OEM_SPECIFIC"}};
+ {mobile_apis::RequestType::OEM_SPECIFIC, "OEM_SPECIFIC"},
+ {mobile_apis::RequestType::ICON_URL, "ICON_URL"}};
const std::string RequestTypeToString(mobile_apis::RequestType::eType type) {
RequestTypeMap::const_iterator it = TypeToString.find(type);
@@ -1576,6 +1577,11 @@ std::string PolicyHandler::GetLockScreenIconUrl() const {
return policy_manager_->GetLockScreenIconUrl();
}
+std::string PolicyHandler::GetIconUrl(const std::string& policy_app_id) const {
+ POLICY_LIB_CHECK(std::string(""));
+ return policy_manager_->GetIconUrl(policy_app_id);
+}
+
uint32_t PolicyHandler::NextRetryTimeout() {
POLICY_LIB_CHECK(0);
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index 8c8a12ced3..c9feacabd4 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -105,6 +105,7 @@ class PolicyHandlerInterface {
virtual void GetUpdateUrls(const uint32_t service_type,
EndpointUrls& out_end_points) = 0;
virtual std::string GetLockScreenIconUrl() const = 0;
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
virtual uint32_t NextRetryTimeout() = 0;
/**
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 92c0305279..616d265eaa 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -115,6 +115,14 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual std::string GetLockScreenIconUrl() const = 0;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
+
+ /**
* @brief PTU is needed, for this PTS has to be formed and sent.
*/
virtual void RequestPTUpdate() = 0;
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 b2d48585f4..078be8ef37 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -93,6 +93,14 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual std::string GetLockScreenIconUrl() const = 0;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
+
+ /**
* @brief Gets all URLs for sending PTS to from PT itself.
* @param service_type Service specifies user of URL
* @param out_end_points output vector of urls
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index 02a0d73086..3d3fb31af7 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -102,6 +102,7 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
void(const uint32_t service_type,
policy::EndpointUrls& end_points));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD0(ResetRetrySequence, void());
MOCK_METHOD0(NextRetryTimeout, uint32_t());
MOCK_CONST_METHOD0(TimeoutExchangeSec, uint32_t());
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 da2b4cc2a1..82d4a866c4 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
@@ -119,6 +119,7 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD2(GetUpdateUrls,
void(const uint32_t service_type, EndpointUrls& out_end_points));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD1(
GetNotificationsNumber,
policy_table::NumberOfNotificationsType(const std::string& priority));
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 72dcb147e3..9fe96e1544 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
@@ -180,6 +180,7 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD1(OnAppRegisteredOnMobile,
void(const std::string& application_id));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_CONST_METHOD1(
GetAppRequestTypes,
const std::vector<std::string>(const std::string policy_app_id));
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 24fe9b2393..e7c9502db9 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
@@ -103,6 +103,7 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD2(GetUpdateUrls,
void(const uint32_t service_type, EndpointUrls& out_end_points));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD2(Init,
bool(const std::string& file_name,
const PolicySettings* settings));
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 a5ce488e1a..7283397187 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
@@ -226,6 +226,7 @@ class MockPolicyManager : public PolicyManager {
MOCK_CONST_METHOD0(get_settings, const PolicySettings&());
MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD1(GetNextUpdateUrl, AppIdURL(const EndpointUrls& urls));
MOCK_CONST_METHOD2(RetrySequenceUrl,
AppIdURL(const struct RetrySequenceURL&,
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 7adb5fb51e..069482c145 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -1268,6 +1268,7 @@
<element name="MEDIA" />
<element name="FOTA" />
<element name="OEM_SPECIFIC"/>
+ <element name="ICON_URL"/>
</enum>
<enum name="ECallConfirmationStatus">
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 714399bce6..3bc7888e30 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -2419,6 +2419,7 @@
<element name="MEDIA" />
<element name="FOTA" />
<element name="OEM_SPECIFIC" since="5.0" />
+ <element name ="ICON_URL" />
</enum>
<enum name="AppHMIType" since="2.0">
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 3344b149e4..a3f4239f8f 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -262,6 +262,14 @@ class CacheManager : public CacheManagerInterface {
virtual std::string GetLockScreenIconUrl() const;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const;
+
+ /**
* @brief Gets list of URL to send PTS to
* @param service_type If URLs for specific service are preset,
* return them otherwise default URLs.
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 6a172e6f4b..fde63929d5 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
@@ -280,6 +280,14 @@ class CacheManagerInterface {
virtual std::string GetLockScreenIconUrl() const = 0;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
+
+ /**
* @brief Get allowed number of notifications
* depending on application priority.
* @param priority Priority of application
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 399c95170d..8cdcd1f5cf 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
@@ -209,6 +209,14 @@ class PolicyManagerImpl : public PolicyManager {
std::string GetLockScreenIconUrl() const OVERRIDE;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ std::string GetIconUrl(const std::string& policy_app_id) const OVERRIDE;
+
+ /**
* @brief Handler of PTS sending out
*/
void OnUpdateStarted() OVERRIDE;
diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h
index 5b494629bb..2477d7eb04 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h
@@ -154,6 +154,7 @@ enum RequestType {
RT_MEDIA,
RT_FOTA,
RT_OEM_SPECIFIC,
+ RT_ICON_URL,
RT_EMPTY // Added to allow empty Request Types handling
};
diff --git a/src/components/policy/policy_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h
index f37531eb63..e844381707 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/types.h
@@ -184,6 +184,7 @@ struct ApplicationParams : PolicyBase {
Optional<Boolean> enabled;
Optional<String<0, 65535> > auth_token;
Optional<String<0, 255> > cloud_transport_type;
+ Optional<String<0, 65535> > icon_url;
public:
ApplicationParams();
diff --git a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml
index 5ed852cf45..f90edca8aa 100644
--- a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml
+++ b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml
@@ -108,6 +108,8 @@
<param name="cloud_transport_type" type="String" minlength="0" maxlength="255"
mandatory="false" />
<param name="hybrid_app_preference" type="HybridAppPreference" mandatory="false" />
+ <param name="icon_url" type="String" minlength="0" maxlength="65535"
+ mandatory="false" />
</struct>
<typedef name="HmiLevels" type="HmiLevel" array="true"
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 8cec6ef91c..06633e6993 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1603,6 +1603,20 @@ std::string CacheManager::GetLockScreenIconUrl() const {
return std::string("");
}
+std::string CacheManager::GetIconUrl(const std::string& policy_app_id) const {
+ std::string url = "";
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ url = app_policy.icon_url.is_initialized() ? *app_policy.icon_url
+ : std::string();
+ }
+ return url;
+}
+
rpc::policy_table_interface_base::NumberOfNotificationsType
CacheManager::GetNotificationsNumber(const std::string& priority) {
CACHE_MANAGER_CHECK(0);
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 0844edd8eb..482163f3c8 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -271,6 +271,10 @@ std::string PolicyManagerImpl::GetLockScreenIconUrl() const {
return cache_->GetLockScreenIconUrl();
}
+std::string PolicyManagerImpl::GetIconUrl(const std::string& policy_app_id) const {
+ return cache_->GetIconUrl(policy_app_id);
+}
+
/**
* @brief FilterInvalidFunctions filter functions that are absent in schema
* @param rpcs list of functions to filter
diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc
index d7d5a241de..9cc838bd82 100644
--- a/src/components/policy/policy_external/src/policy_table/enums.cc
+++ b/src/components/policy/policy_external/src/policy_table/enums.cc
@@ -629,6 +629,8 @@ bool IsValidEnum(RequestType val) {
return true;
case RT_OEM_SPECIFIC:
return true;
+ case RT_ICON_URL:
+ return true;
case RT_EMPTY:
return true;
default:
@@ -680,6 +682,8 @@ const char* EnumToJsonString(RequestType val) {
return "FOTA";
case RT_OEM_SPECIFIC:
return "OEM_SPECIFIC";
+ case RT_ICON_URL:
+ return "ICON_URL";
case RT_EMPTY:
return "EMPTY";
default:
@@ -772,6 +776,10 @@ bool EnumFromJsonString(const std::string& literal, RequestType* result) {
*result = RT_OEM_SPECIFIC;
return true;
}
+ if ("ICON_URL" == literal) {
+ *result = RT_ICON_URL;
+ return true;
+ }
if ("EMPTY" == literal) {
*result = RT_EMPTY;
return true;
diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc
index 0fe54a683d..f3d3b0faa0 100644
--- a/src/components/policy/policy_external/src/policy_table/types.cc
+++ b/src/components/policy/policy_external/src/policy_table/types.cc
@@ -247,7 +247,8 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
, endpoint(impl::ValueMember(value__, "endpoint"))
, enabled(impl::ValueMember(value__, "enabled"))
, auth_token(impl::ValueMember(value__, "auth_token"))
- , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type")) {
+ , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type"))
+ , icon_url(impl::ValueMember(value__, "icon_url")) {
}
Json::Value ApplicationParams::ToJsonValue() const {
@@ -267,6 +268,7 @@ Json::Value ApplicationParams::ToJsonValue() const {
impl::WriteJsonField("enabled", enabled, &result__);
impl::WriteJsonField("auth_token", auth_token, &result__);
impl::WriteJsonField("cloud_transport_type", cloud_transport_type, &result__);
+ impl::WriteJsonField("icon_url", auth_token, &result__);
return result__;
}
@@ -309,6 +311,9 @@ bool ApplicationParams::is_valid() const {
if (!hybrid_app_preference.is_valid()) {
return false;
}
+ if (!icon_url.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -359,6 +364,9 @@ bool ApplicationParams::struct_empty() const {
if (hybrid_app_preference.is_initialized()) {
return false;
}
+ if (icon_url.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -426,6 +434,9 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
moduleType.ReportErrors(
&report__->ReportSubobject("hybrid_app_preference"));
}
+ if (!icon_url.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("icon_url"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -441,6 +452,7 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
enabled.SetPolicyTableType(pt_type);
cloud_transport_type.SetPolicyTableType(pt_type);
hybrid_app_preference.SetPolicyTableType(pt_type);
+ icon_url.SetPolicyTableType(pt_type);
}
// RpcParameters methods
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_queries.cc b/src/components/policy/policy_external/src/sql_pt_ext_queries.cc
index 32320b6d6c..58206e2c69 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_queries.cc
@@ -207,8 +207,8 @@ const std::string kInsertApplication =
" `default_hmi`, `priority_value`, `is_revoked`, `memory_kb`, "
" `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
" `endpoint`, `enabled`, `auth_token`, "
- " `cloud_transport_type`) VALUES "
- "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ " `cloud_transport_type`, `icon_url`) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -237,7 +237,7 @@ const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `default_hmi`, `keep_context`, "
" `steal_focus`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
" `hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token` "
- " `cloud_transport_type` FROM `application`";
+ " `cloud_transport_type`, `icon_url` FROM `application`";
const std::string kSelectFunctionalGroupNames =
"SELECT `id`, `user_consent_prompt`, `name`"
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
index 43961815d6..c81c99339e 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
@@ -771,6 +771,9 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
app.second.cloud_transport_type.is_initialized()
? app_query.Bind(13, *app.second.cloud_transport_type)
: app_query.Bind(13);
+ app.second.icon_url.is_initialized()
+ ? app_query.Bind(14, *app.second.icon_url)
+ : app_query.Bind(14);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -908,6 +911,7 @@ bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
}
*params.auth_token = query.GetString(11);
*params.cloud_transport_type = query.GetString(12);
+ *params.icon_url = query.GetString(13);
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc
index 162d6957e7..12b38634f1 100644
--- a/src/components/policy/policy_external/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_queries.cc
@@ -156,6 +156,7 @@ const std::string kCreateSchema =
" `enabled` BOOLEAN, "
" `auth_token` VARCHAR(65535), "
" `cloud_transport_type` VARCHAR(255), "
+ " `icon_url` VARCHAR(65535), "
" `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, "
" CONSTRAINT `fk_application_hmi_level1` "
" FOREIGN KEY(`default_hmi`) "
@@ -649,8 +650,8 @@ const std::string kInsertApplication =
"INSERT OR IGNORE INTO `application` (`id`, `priority_value`, "
"`is_revoked`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
"`hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, "
- "`cloud_transport_type`) VALUES "
- "(?,?,?,?,?,?,?,?,?,?,?)";
+ "`cloud_transport_type`, `icon_url`) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kInsertAppGroup =
"INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
@@ -774,7 +775,7 @@ const std::string kSelectUserMsgsVersion =
const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `memory_kb`, "
" `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
- " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type` FROM "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, `icon_url` FROM "
" `application`";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -875,14 +876,14 @@ const std::string kInsertApplicationFull =
" `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
" `is_predata`, `memory_kb`, `heart_beat_timeout_ms`, "
" `certificate`, `hybrid_app_preference_value`, `endpoint`, `enabled`, "
- " `auth_token`, `cloud_transport_type`) "
- " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " `auth_token`, `cloud_transport_type`, `icon_url`) "
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
const std::string kSelectApplicationFull =
"SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, "
" `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
" `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
- " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type` "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, `icon_url` "
"FROM `application` "
"WHERE `id` = ?";
diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc
index b794d4c3a6..f0b9985536 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -777,6 +777,7 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
}
*params.auth_token = query.GetString(8);
*params.cloud_transport_type = query.GetString(9);
+ *params.icon_url = query.GetString(10);
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
@@ -1070,6 +1071,9 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
app.second.cloud_transport_type.is_initialized()
? app_query.Bind(10, *app.second.cloud_transport_type)
: app_query.Bind(10);
+ app.second.icon_url.is_initialized()
+ ? app_query.Bind(10, *app.second.icon_url)
+ : app_query.Bind(10);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -2172,6 +2176,8 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
: query.Bind(14, source_app.GetString(13));
source_app.IsNull(14) ? query.Bind(15)
: query.Bind(15, source_app.GetString(14));
+ source_app.IsNull(15) ? query.Bind(16)
+ : query.Bind(16, source_app.GetString(15));
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Failed inserting into application.");
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 8c8f0c55c6..57d9cc9a57 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -256,6 +256,14 @@ class CacheManager : public CacheManagerInterface {
virtual std::string GetLockScreenIconUrl() const;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const;
+
+ /**
* @brief Get allowed number of notifications
* depending on application priority.
* @param priority Priority of application
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 50b546ecc5..aef1773cb9 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
@@ -264,6 +264,14 @@ class CacheManagerInterface {
virtual std::string GetLockScreenIconUrl() const = 0;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
+
+ /**
* @brief Get allowed number of notifications
* depending on application priority.
* @param priority Priority of application
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 20a37717a7..ae2e2802d3 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
@@ -117,6 +117,14 @@ class PolicyManagerImpl : public PolicyManager {
std::string GetLockScreenIconUrl() const OVERRIDE;
/**
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial registration
+ *
+ * @return url which point to the resourse where icon could be
+ *obtained.
+ */
+ std::string GetIconUrl(const std::string& policy_app_id) const OVERRIDE;
+
+ /**
* @brief PTU is needed, for this PTS has to be formed and sent.
*/
bool RequestPTUpdate() OVERRIDE;
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/types.h b/src/components/policy/policy_regular/include/policy/policy_table/types.h
index 18f909bb99..63058dee26 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/types.h
@@ -150,6 +150,7 @@ struct ApplicationParams : PolicyBase {
Optional<Boolean> enabled;
Optional<String<0, 65535> > auth_token;
Optional<String<0, 255> > cloud_transport_type;
+ Optional<String<0, 65535> > icon_url;
public:
ApplicationParams();
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index ca61a338f1..4f53ab5eae 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -892,6 +892,20 @@ std::string CacheManager::GetLockScreenIconUrl() const {
return std::string("");
}
+std::string CacheManager::GetIconUrl(const std::string& policy_app_id) const {
+ std::string url = "";
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ url = app_policy.icon_url.is_initialized() ? *app_policy.icon_url
+ : std::string();
+ }
+ return url;
+}
+
rpc::policy_table_interface_base::NumberOfNotificationsType
CacheManager::GetNotificationsNumber(const std::string& priority) {
CACHE_MANAGER_CHECK(0);
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 9b2392a015..6dda2690a4 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -443,6 +443,10 @@ std::string PolicyManagerImpl::GetLockScreenIconUrl() const {
return cache_->GetLockScreenIconUrl();
}
+std::string PolicyManagerImpl::GetIconUrl(const std::string& policy_app_id) const {
+ return cache_->GetIconUrl(policy_app_id);
+}
+
void PolicyManagerImpl::StartPTExchange() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc
index 5faf96a232..a2a2da0283 100644
--- a/src/components/policy/policy_regular/src/policy_table/types.cc
+++ b/src/components/policy/policy_regular/src/policy_table/types.cc
@@ -173,7 +173,8 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
, endpoint(impl::ValueMember(value__, "endpoint"))
, enabled(impl::ValueMember(value__, "enabled"))
, auth_token(impl::ValueMember(value__, "auth_token"))
- , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type")) {
+ , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type"))
+ , icon_url(impl::ValueMember(value__, "icon_url")) {
}
Json::Value ApplicationParams::ToJsonValue() const {
@@ -194,6 +195,7 @@ Json::Value ApplicationParams::ToJsonValue() const {
impl::WriteJsonField("enabled", enabled, &result__);
impl::WriteJsonField("auth_token", auth_token, &result__);
impl::WriteJsonField("cloud_transport_type", cloud_transport_type, &result__);
+ impl::WriteJsonField("icon_url", auth_token, &result__);
return result__;
}
@@ -240,6 +242,9 @@ bool ApplicationParams::is_valid() const {
if (!hybrid_app_preference.is_valid()) {
return false;
}
+ if (!icon_url.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -293,6 +298,9 @@ bool ApplicationParams::struct_empty() const {
if (hybrid_app_preference.is_initialized()) {
return false;
}
+ if (icon_url.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -347,6 +355,9 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
moduleType.ReportErrors(
&report__->ReportSubobject("hybrid_app_preference"));
}
+ if (!icon_url.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("icon_url"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -363,6 +374,7 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
enabled.SetPolicyTableType(pt_type);
cloud_transport_type.SetPolicyTableType(pt_type);
hybrid_app_preference.SetPolicyTableType(pt_type);
+ icon_url.SetPolicyTableType(pt_type);
}
// RpcParameters methods
diff --git a/src/components/policy/policy_regular/src/sql_pt_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc
index 297031d4c0..5f5d049a3a 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -142,6 +142,7 @@ const std::string kCreateSchema =
" `enabled` BOOLEAN, "
" `auth_token` VARCHAR(65535), "
" `cloud_transport_type` VARCHAR(255), "
+ " `icon_url` VARCHAR(65535), "
" `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, "
" CONSTRAINT `fk_application_hmi_level1` "
" FOREIGN KEY(`default_hmi`) "
@@ -598,8 +599,8 @@ const std::string kInsertApplication =
"INSERT OR IGNORE INTO `application` (`id`, `priority_value`, "
"`is_revoked`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
"`hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, "
- "`cloud_transport_type`) VALUES "
- "(?,?,?,?,?,?,?,?,?,?,?)";
+ "`cloud_transport_type`, `icon_url`) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kInsertAppGroup =
"INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
@@ -709,7 +710,7 @@ const std::string kSelectUserMsgsVersion =
const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `memory_kb`, "
" `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
- " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type` FROM "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, `icon_url` FROM "
" `application`";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -810,14 +811,14 @@ const std::string kInsertApplicationFull =
" `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
" `is_predata`, `memory_kb`, `heart_beat_timeout_ms`, "
" `certificate`, `hybrid_app_preference_value`, `endpoint`, `enabled`, "
- " `auth_token`, `cloud_transport_type`) "
- " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " `auth_token`, `cloud_transport_type`, `icon_url`) "
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
const std::string kSelectApplicationFull =
"SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, "
" `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
" `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
- " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type` "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, `icon_url` "
"FROM `application` "
"WHERE `id` = "
"?";
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index 9282caf535..7b1ea84f08 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -733,6 +733,7 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
}
*params.auth_token = query.GetString(8);
*params.cloud_transport_type = query.GetString(9);
+ *params.icon_url = query.GetString(9);
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
@@ -1011,6 +1012,9 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
app.second.cloud_transport_type.is_initialized()
? app_query.Bind(10, *app.second.cloud_transport_type)
: app_query.Bind(10);
+ app.second.icon_url.is_initialized()
+ ? app_query.Bind(11, *app.second.icon_url)
+ : app_query.Bind(11);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -2122,6 +2126,8 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
: query.Bind(14, source_app.GetString(13));
source_app.IsNull(14) ? query.Bind(15)
: query.Bind(15, source_app.GetString(14));
+ source_app.IsNull(15) ? query.Bind(16)
+ : query.Bind(16, source_app.GetString(15));
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Failed inserting into application.");