summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Kalinich <AKalinich@luxoft.com>2020-03-03 11:51:38 -0500
committerAndrii Kalinich <AKalinich@luxoft.com>2020-03-03 11:51:38 -0500
commit413bb5c23c333a80262c64d2b7e8bed9ee8351ce (patch)
tree41f311860e5275f0ce3a9d53c668906571a0f336
parentb0868c0a2de0d2210e7a8a7aa9e94f702fc5d01c (diff)
downloadsdl_core-fix/fix_lock_screen_icon_url_request_sending.tar.gz
Fix OnSystemRequest(LOCK_SCREEN_ICON_URL) sendingfix/fix_lock_screen_icon_url_request_sending
There was noticed an issue that sometimes Policy Manager component is returning an empty url for lock screen icon. The root cause of that is the data races between thread which is sending OnSystemRequest notification and backupper thread which overwrites data in the database. As these two threads may have an intersection, there could be a possible situation that backuper thread erased data from `endpoints` table and another thread is using SQL query to select the data from the same table. As a result, second thread receives an empty result as the data was erased and the new one was not inserted yet by backupper thread. After that, SDL just does not send OnSystemRequest as the URL is empty. To fix that issue, policy component has been updated to use internal policy cache instead of direct access to policy database each time to get URL. This will guarantee that a sending thread will get an up-to-date infromation required for OnSystemRequest notification. Also, code cleanup has been done in order to remove all functions which become unused after this fix.
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc2
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc40
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc21
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h14
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h11
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h11
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h15
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h12
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h12
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h12
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h12
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h16
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h12
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h11
-rw-r--r--src/components/policy/policy_external/include/policy/pt_representation.h8
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_queries.h1
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_representation.h1
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc11
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc8
-rw-r--r--src/components/policy/policy_external/src/sql_pt_queries.cc3
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc22
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h15
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h12
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h11
-rw-r--r--src/components/policy/policy_regular/include/policy/pt_representation.h8
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_queries.h1
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_representation.h1
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc11
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc9
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc3
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc22
32 files changed, 127 insertions, 228 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 eaba6fd5fc..b8f105380c 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
@@ -201,10 +201,11 @@ class PolicyHandler : public PolicyHandlerInterface,
StringArray* nicknames = NULL,
StringArray* app_hmi_types = NULL) OVERRIDE;
void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) OVERRIDE;
- virtual std::string GetLockScreenIconUrl() const OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
+ virtual std::string GetLockScreenIconUrl(
+ const std::string& policy_app_id) 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/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 cbdaa713b8..54649980c6 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
@@ -551,7 +551,7 @@ RegisterAppInterfaceRequest::GetLockScreenIconUrlNotification(
(*message)[strings::msg_params][strings::request_type] =
mobile_apis::RequestType::LOCK_SCREEN_ICON_URL;
(*message)[strings::msg_params][strings::url] =
- GetPolicyHandler().GetLockScreenIconUrl();
+ GetPolicyHandler().GetLockScreenIconUrl(app->policy_app_id());
return message;
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 4bbb33b504..1974c99d2c 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1680,20 +1680,50 @@ bool PolicyHandler::GetInitialAppData(const std::string& application_id,
}
void PolicyHandler::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
POLICY_LIB_CHECK_VOID();
policy_manager_->GetUpdateUrls(service_type, out_end_points);
}
void PolicyHandler::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
POLICY_LIB_CHECK_VOID();
policy_manager_->GetUpdateUrls(service_type, out_end_points);
}
-std::string PolicyHandler::GetLockScreenIconUrl() const {
- POLICY_LIB_CHECK(std::string(""));
- return policy_manager_->GetLockScreenIconUrl();
+std::string PolicyHandler::GetLockScreenIconUrl(
+ const std::string& policy_app_id) const {
+ const std::string default_url;
+ POLICY_LIB_CHECK(default_url);
+
+ EndpointUrls endpoints;
+ policy_manager_->GetUpdateUrls("lock_screen_icon_url", endpoints);
+
+ auto it_specific =
+ std::find_if(endpoints.begin(),
+ endpoints.end(),
+ [&policy_app_id](const EndpointData& endpoint) {
+ return endpoint.app_id == policy_app_id;
+ });
+
+ if (endpoints.end() != it_specific && !it_specific->url.empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "Specific app URL will be used for " << policy_app_id);
+ return it_specific->url.front();
+ }
+
+ auto it_default = std::find_if(
+ endpoints.begin(), endpoints.end(), [](const EndpointData& endpoint) {
+ return endpoint.app_id == kDefaultId;
+ });
+
+ if (endpoints.end() != it_default && !it_default->url.empty()) {
+ LOG4CXX_DEBUG(logger_, "Default URL will be used for " << policy_app_id);
+ return it_default->url.front();
+ }
+
+ LOG4CXX_ERROR(logger_, "Can't find URL for " << policy_app_id);
+ return std::string();
}
std::string PolicyHandler::GetIconUrl(const std::string& policy_app_id) const {
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
index 3f37cec657..1702497fec 100644
--- a/src/components/application_manager/test/policy_handler_test.cc
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -2590,11 +2590,24 @@ TEST_F(PolicyHandlerTest,
#endif
}
+ACTION_P(SetEndpoint, endpoint) {
+ arg1 = endpoint;
+}
+
TEST_F(PolicyHandlerTest, GetLockScreenIconUrl_SUCCESS) {
EnablePolicyAndPolicyManagerMock();
- EXPECT_CALL(*mock_policy_manager_, GetLockScreenIconUrl());
- policy_handler_.GetLockScreenIconUrl();
+ const std::string url_str = "test_icon_url";
+ EndpointData data(url_str);
+
+ EndpointUrls endpoints;
+ endpoints.push_back(data);
+
+ const std::string service_type = "lock_screen_icon_url";
+ EXPECT_CALL(*mock_policy_manager_, GetUpdateUrls(service_type, _))
+ .WillOnce(SetEndpoint(endpoints));
+
+ EXPECT_EQ(url_str, policy_handler_.GetLockScreenIconUrl(kPolicyAppId_));
}
TEST_F(PolicyHandlerTest, RemoveListener_SUCCESS) {
@@ -2657,10 +2670,6 @@ TEST_F(PolicyHandlerTest, OnSystemError_SUCCESS) {
EXPECT_TRUE(waiter1.Wait(auto_lock));
}
-ACTION_P(SetEndpoint, endpoint) {
- arg1 = endpoint;
-}
-
TEST_F(PolicyHandlerTest, RemoteAppsUrl_EndpointsEmpty_UNSUCCESS) {
EnablePolicyAndPolicyManagerMock();
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 8ac85b53b4..7f31c5834d 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -121,11 +121,19 @@ class PolicyHandlerInterface : public VehicleDataItemProvider {
StringArray* nicknames = NULL,
StringArray* app_hmi_types = NULL) = 0;
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual Json::Value GetPolicyTableData() const = 0;
- virtual std::string GetLockScreenIconUrl() const = 0;
+
+ /**
+ * @brief Gets lock screen icon URL for a requested application
+ * @param policy_app_id policy application id
+ * @return URL for a requested application
+ */
+ virtual std::string GetLockScreenIconUrl(
+ const std::string& policy_app_id) 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 16265ed7cc..9ba5de4973 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -117,16 +117,9 @@ class PolicyManager : public usage_statistics::StatisticsManager,
* @return vector of urls
*/
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
-
- /**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resource where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() const = 0;
+ EndpointUrls& out_end_points) const = 0;
/**
* @brief Get Icon Url used for showing a cloud apps icon before the initial
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 a2d3a0ce70..7ba9a77a6c 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -97,13 +97,6 @@ class PolicyManager : public usage_statistics::StatisticsManager,
virtual bool ResetPT(const std::string& file_name) = 0;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resource where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() const = 0;
-
- /**
* @brief Get Icon Url used for showing a cloud apps icon before the initial
*registration
*
@@ -118,9 +111,9 @@ class PolicyManager : public usage_statistics::StatisticsManager,
* @param out_end_points output vector of urls
*/
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
/**
* @brief PTU is needed, for this PTS has to be formed and sent.
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 6ac5ff5327..cd99157319 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
@@ -114,10 +114,11 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
bool(const std::string& application_id,
policy::StringArray* nicknames));
MOCK_METHOD1(GetInitialAppData, bool(const std::string& application_id));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type,
- policy::EndpointUrls& end_points));
- MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ policy::EndpointUrls& end_points));
+ MOCK_CONST_METHOD1(GetLockScreenIconUrl,
+ std::string(const std::string& policy_app_id));
MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD0(ResetRetrySequence, void());
MOCK_METHOD0(NextRetryTimeout, uint32_t());
@@ -301,9 +302,9 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
#endif // ENABLE_SECURITY
MOCK_CONST_METHOD0(get_settings, const policy::PolicySettings&());
MOCK_CONST_METHOD0(RemoteAppsUrl, const std::string());
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- policy::EndpointUrls& end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ policy::EndpointUrls& end_points));
MOCK_METHOD3(OnUpdateHMILevel,
void(const std::string& device_id,
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 c6eb3416da..c7a6e3d50a 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
@@ -130,12 +130,12 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
const std::vector<std::string>& msg_codes,
const std::string& language,
const std::string& active_hmi_language));
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- EndpointUrls& out_end_points));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type, EndpointUrls& out_end_points));
- MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ EndpointUrls& out_end_points));
MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD1(
GetNotificationsNumber,
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 3aaa62abf7..da3f130077 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
@@ -81,11 +81,12 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD1(OnPTUFinished, void(const PtProcessingResult ptu_result));
MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
MOCK_METHOD1(GetUpdateUrl, std::string(int service_type));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type, EndpointUrls& out_end_points));
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
MOCK_METHOD0(RequestPTUpdate, void());
MOCK_METHOD6(CheckPermissions,
void(const PTString& device_id,
@@ -218,7 +219,6 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(OnAppRegisteredOnMobile,
void(const std::string& device_id,
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_METHOD2(GetAppRequestTypes,
const std::vector<std::string>(
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 7c78eadfc8..d8e13b4b2e 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
@@ -112,12 +112,12 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_CONST_METHOD2(GetPriority,
bool(const std::string& policy_app_id,
std::string& priority));
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- EndpointUrls& out_end_points));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type, EndpointUrls& out_end_points));
- MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ EndpointUrls& out_end_points));
MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD2(Init,
bool(const std::string& file_name,
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 bf9cce180c..b328306134 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
@@ -82,11 +82,12 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD1(OnPTUFinished, void(const PtProcessingResult ptu_result));
MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type, EndpointUrls& out_end_points));
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
MOCK_METHOD1(RequestPTUpdate,
bool(const policy::PTUIterationType iteration_type));
MOCK_METHOD5(CheckPermissions,
@@ -278,7 +279,6 @@ class MockPolicyManager : public PolicyManager {
int32_t timespan_seconds));
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,
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 b24e05fb6d..b826f4e5ce 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -290,14 +290,6 @@ class CacheManager : public CacheManagerInterface {
const std::string& active_hmi_language) const;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- *
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() const;
-
- /**
* @brief Get Icon Url used for showing a cloud apps icon before the intial
*registration
*
@@ -311,11 +303,11 @@ class CacheManager : public CacheManagerInterface {
* @param service_type If URLs for specific service are preset,
* return them otherwise default URLs.
*/
- virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points);
+ void GetUpdateUrls(const std::string& service_type,
+ EndpointUrls& out_end_points) const OVERRIDE;
- virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points);
+ void GetUpdateUrls(const uint32_t service_type,
+ EndpointUrls& out_end_points) const OVERRIDE;
/**
* @brief Gets allowed number of notifications
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 8e3f90b64f..3e3de694d6 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
@@ -324,18 +324,10 @@ class CacheManagerInterface {
* return them otherwise default URLs.
*/
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
-
- /**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- *
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() const = 0;
+ EndpointUrls& out_end_points) const = 0;
/**
* @brief Get Icon Url used for showing a cloud apps icon before the intial
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 bf23429106..2fd58d3a07 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
@@ -152,9 +152,9 @@ class PolicyManagerImpl : public PolicyManager {
* @param out_end_points output vector of urls
*/
void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
/**
* @brief PTU is needed, for this PTS has to be formed and sent.
@@ -256,13 +256,6 @@ class PolicyManagerImpl : public PolicyManager {
void OnExceededTimeout() OVERRIDE;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- std::string GetLockScreenIconUrl() const OVERRIDE;
-
- /**
* @brief Get Icon Url used for showing a cloud apps icon before the intial
*registration
*
diff --git a/src/components/policy/policy_external/include/policy/pt_representation.h b/src/components/policy/policy_external/include/policy/pt_representation.h
index d233bbf268..459b689393 100644
--- a/src/components/policy/policy_external/include/policy/pt_representation.h
+++ b/src/components/policy/policy_external/include/policy/pt_representation.h
@@ -71,14 +71,6 @@ class PTRepresentation {
virtual bool IsPTPreloaded() = 0;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- *
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() const = 0;
-
- /**
* @brief Re-creates schema in DB, drops all data
* @return true, if succedeed, otherwise - false
*/
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
index c613cec0d6..8a3ad1f7df 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_queries.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
@@ -49,7 +49,6 @@ extern const std::string kSelectPreloaded;
extern const std::string kIsFirstRun;
extern const std::string kSetNotFirstRun;
extern const std::string kSelectEndpoint;
-extern const std::string kSelectLockScreenIcon;
extern const std::string kSelectModuleConfig;
extern const std::string kSelectEndpoints;
extern const std::string kSelectNotificationsPerMin;
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_representation.h
index 5d2d63a8bd..574806b3fb 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_representation.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_representation.h
@@ -185,7 +185,6 @@ class SQLPTRepresentation : public virtual PTRepresentation {
const policy_table::AppServiceParameters& app_service_parameters);
public:
- virtual std::string GetLockScreenIconUrl() const;
bool UpdateRequired() const;
void SaveUpdateRequired(bool value);
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 70129e16d9..d8819b6bad 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1737,7 +1737,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
}
void CacheManager::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
auto find_hexademical =
[service_type](policy_table::ServiceEndpoints::value_type end_point) {
uint32_t decimal;
@@ -1754,7 +1754,7 @@ void CacheManager::GetUpdateUrls(const uint32_t service_type,
}
void CacheManager::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
@@ -1781,13 +1781,6 @@ void CacheManager::GetUpdateUrls(const std::string& service_type,
}
}
-std::string CacheManager::GetLockScreenIconUrl() const {
- if (backup_) {
- return backup_->GetLockScreenIconUrl();
- }
- return std::string("");
-}
-
std::string CacheManager::GetIconUrl(const std::string& policy_app_id) const {
CACHE_MANAGER_CHECK(std::string());
std::string url;
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 81b3206093..5dea366e66 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -268,10 +268,6 @@ void PolicyManagerImpl::CheckTriggers() {
}
}
-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);
@@ -693,12 +689,12 @@ std::string PolicyManagerImpl::GetUpdateUrl(int service_type) {
}
void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
cache_->GetUpdateUrls(service_type, out_end_points);
}
void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
cache_->GetUpdateUrls(service_type, out_end_points);
}
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 e5fde1abf9..4f858637d7 100644
--- a/src/components/policy/policy_external/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_queries.cc
@@ -781,9 +781,6 @@ const std::string kSetNotFirstRun =
const std::string kSelectEndpoint =
"SELECT `url`, `application_id` FROM `endpoint` WHERE `service` = ? ";
-const std::string kSelectLockScreenIcon =
- "SELECT `url` FROM `endpoint` WHERE `service` = ? AND `application_id` = ?";
-
const std::string kInsertFunctionalGroup =
"INSERT INTO `functional_group` (`id`, `name`, `user_consent_prompt`, "
"`encryption_required`) "
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 5af4cc5440..5e96d0bde0 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -101,28 +101,6 @@ SQLPTRepresentation::~SQLPTRepresentation() {
delete db_;
}
-std::string SQLPTRepresentation::GetLockScreenIconUrl() const {
- utils::dbms::SQLQuery query(db());
- std::string ret;
- if (query.Prepare(sql_pt::kSelectLockScreenIcon)) {
- query.Bind(0, std::string("lock_screen_icon_url"));
- query.Bind(1, std::string("default"));
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority.");
- return ret;
- }
-
- if (!query.IsNull(0)) {
- ret = query.GetString(0);
- }
-
- } else {
- LOG4CXX_WARN(logger_, "Invalid select endpoints statement.");
- }
- return ret;
-}
-
void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
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 0ad7634382..00f0adab06 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -277,18 +277,11 @@ class CacheManager : public CacheManagerInterface {
* @param service_type If URLs for specific service are preset,
* return them otherwise default URLs.
*/
- virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points);
+ void GetUpdateUrls(const std::string& service_type,
+ EndpointUrls& out_end_points) const OVERRIDE;
- virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points);
- /**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- *
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() const;
+ void GetUpdateUrls(const uint32_t service_type,
+ EndpointUrls& out_end_points) const OVERRIDE;
/**
* @brief Get Icon Url used for showing a cloud apps icon before the intial
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 35a61f6597..fc1a6337aa 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
@@ -308,17 +308,9 @@ class CacheManagerInterface {
* return them otherwise default URLs.
*/
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
-
- /**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- *
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() const = 0;
+ EndpointUrls& out_end_points) const = 0;
/**
* @brief Get Icon Url used for showing a cloud apps icon before the intial
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 730346cc19..d29852b279 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
@@ -172,16 +172,9 @@ class PolicyManagerImpl : public PolicyManager {
* @param out_end_points output vector of urls
*/
void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) OVERRIDE;
-
- /**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- std::string GetLockScreenIconUrl() const OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
/**
* @brief Get Icon Url used for showing a cloud apps icon before the intial
diff --git a/src/components/policy/policy_regular/include/policy/pt_representation.h b/src/components/policy/policy_regular/include/policy/pt_representation.h
index 1adf24ed19..467fb4641f 100644
--- a/src/components/policy/policy_regular/include/policy/pt_representation.h
+++ b/src/components/policy/policy_regular/include/policy/pt_representation.h
@@ -152,14 +152,6 @@ class PTRepresentation {
virtual EndpointUrls GetUpdateUrls(int service_type) = 0;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- *
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() 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/sql_pt_queries.h b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
index 66637b7812..315c30b995 100644
--- a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
+++ b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
@@ -49,7 +49,6 @@ extern const std::string kSelectPreloaded;
extern const std::string kIsFirstRun;
extern const std::string kSetNotFirstRun;
extern const std::string kSelectEndpoint;
-extern const std::string kSelectLockScreenIcon;
extern const std::string kSelectModuleConfig;
extern const std::string kSelectEndpoints;
extern const std::string kSelectNotificationsPerMin;
diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h
index 216598850e..5bc49ee973 100644
--- a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h
+++ b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h
@@ -75,7 +75,6 @@ class SQLPTRepresentation : public virtual PTRepresentation {
const std::vector<std::string>& msg_codes, const std::string& language);
virtual EndpointUrls GetUpdateUrls(int service_type);
- virtual std::string GetLockScreenIconUrl() const;
virtual int GetNotificationsNumber(const std::string& priority);
virtual bool GetPriority(const std::string& policy_app_id,
std::string* priority);
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index 738e62f1dc..8227090f5f 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -1040,7 +1040,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
}
void CacheManager::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
auto find_hexademical =
[service_type](policy_table::ServiceEndpoints::value_type end_point) {
uint32_t decimal;
@@ -1057,7 +1057,7 @@ void CacheManager::GetUpdateUrls(const uint32_t service_type,
}
void CacheManager::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
@@ -1084,13 +1084,6 @@ void CacheManager::GetUpdateUrls(const std::string& service_type,
}
}
-std::string CacheManager::GetLockScreenIconUrl() const {
- if (backup_) {
- return backup_->GetLockScreenIconUrl();
- }
- return std::string("");
-}
-
std::string CacheManager::GetIconUrl(const std::string& policy_app_id) const {
CACHE_MANAGER_CHECK(std::string());
std::string url;
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 b2c7e61f98..296c778885 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -597,12 +597,13 @@ void PolicyManagerImpl::PrepareNotificationData(
}
void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
cache_->GetUpdateUrls(service_type, out_end_points);
}
+
void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
cache_->GetUpdateUrls(service_type, out_end_points);
}
@@ -630,10 +631,6 @@ bool PolicyManagerImpl::RequestPTUpdate(const PTUIterationType iteration_type) {
return true;
}
-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);
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 6c961a8db3..79eee10d43 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -739,9 +739,6 @@ const std::string kSetNotFirstRun =
const std::string kSelectEndpoint =
"SELECT `url`, `application_id` FROM `endpoint` WHERE `service` = ? ";
-const std::string kSelectLockScreenIcon =
- "SELECT `url` FROM `endpoint` WHERE `service` = ? AND `application_id` = ?";
-
const std::string kInsertFunctionalGroup =
"INSERT INTO `functional_group` (`id`, `name`, `user_consent_prompt`, "
"`encryption_required`) "
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 7b2d01ef53..c6d0b60f89 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -241,28 +241,6 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) {
return ret;
}
-std::string SQLPTRepresentation::GetLockScreenIconUrl() const {
- utils::dbms::SQLQuery query(db());
- std::string ret;
- if (query.Prepare(sql_pt::kSelectLockScreenIcon)) {
- query.Bind(0, std::string("lock_screen_icon_url"));
- query.Bind(1, std::string("default"));
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority.");
- return ret;
- }
-
- if (!query.IsNull(0)) {
- ret = query.GetString(0);
- }
-
- } else {
- LOG4CXX_WARN(logger_, "Invalid select endpoints statement.");
- }
- return ret;
-}
-
int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
LOG4CXX_AUTO_TRACE(logger_);
utils::dbms::SQLQuery query(db());