diff options
author | Collin <iCollin@users.noreply.github.com> | 2020-03-16 16:38:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 16:38:16 -0400 |
commit | 9bc0cfd17259601f8e9eb71724b29cecf3d15be0 (patch) | |
tree | 9e656f8a42bbfdd4378d394fa293c468f391e621 /src/components/include/policy | |
parent | 445794d03f1d17eac21b86d29e74b857cda385c3 (diff) | |
download | sdl_core-9bc0cfd17259601f8e9eb71724b29cecf3d15be0.tar.gz |
Fix OnSystemRequest(LOCK_SCREEN_ICON_URL) sending (#3271) (#3289)
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.
Co-authored-by: Andrii Kalinich (GitHub) <AKalinich@luxoft.com>
Diffstat (limited to 'src/components/include/policy')
-rw-r--r-- | src/components/include/policy/policy_external/policy/policy_manager.h | 11 | ||||
-rw-r--r-- | src/components/include/policy/policy_regular/policy/policy_manager.h | 11 |
2 files changed, 4 insertions, 18 deletions
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. |