summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAKalinich-Luxoft <AKalinich@luxoft.com>2017-06-09 09:22:30 +0300
committerAKalinich-Luxoft <AKalinich@luxoft.com>2017-12-12 14:10:29 +0200
commite96f33b925b782cab8b515b7afd8d49965506010 (patch)
tree3326797b41d978d371c8402d3a9f62be7ab1a4c3
parent2f22052761aed0069b9a7fc99c0ffee1e60822c0 (diff)
downloadsdl_core-e96f33b925b782cab8b515b7afd8d49965506010.tar.gz
Added new bool flag to ApplicationImpl class
This flag is needed for checking, is SDL should send OnHashChange notification after OnAwake notification. During suspend state SDL must not send OnHashChange according to requirements. If some of RPC's triggers OnHashChange notification sending during suspend, this flag will be set to true and after OnAwake notification if this flag was set, SDL will send OnHashChange notification.
-rw-r--r--src/components/application_manager/include/application_manager/application.h14
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h30
-rw-r--r--src/components/application_manager/src/application_impl.cc16
3 files changed, 50 insertions, 10 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index fdb0c15922..f4f2f9779d 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -409,6 +409,20 @@ class Application : public virtual InitialApplicationData,
virtual void UpdateHash() = 0;
/**
+ * @brief Retrieves flag_sending_hash_change_after_awake_
+ * @return Returns TRUE if hashID was changed during suspended state
+ * otherwise returns FALSE.
+ */
+ virtual bool flag_sending_hash_change_after_awake() const = 0;
+
+ /**
+ * @brief Method is used when core receives OnAwakeSDL notification
+ * in order to change value of flag_sending_hash_change_after_awake_
+ * @param Contains FALSE
+ */
+ virtual void set_flag_sending_hash_change_after_awake(bool flag) = 0;
+
+ /**
* @brief method is called when SDL is saving application data for resumption
* @return TRUE if data of application need to save for resumption, otherwise
* return FALSE
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index 3304200372..3bca84e8bf 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -198,15 +198,26 @@ class ApplicationImpl : public virtual Application,
virtual DataAccessor<ButtonSubscriptions> SubscribedButtons() const OVERRIDE;
virtual const std::string& curHash() const;
-#ifdef CUSTOMER_PASA
- virtual bool flag_sending_hash_change_after_awake() const;
- virtual void set_flag_sending_hash_change_after_awake(bool flag);
-#endif // CUSTOMER_PASA
- /**
- * @brief Change Hash for current application
- * and send notification to mobile
- * @return updated_hash
- */
+
+ /**
+ * @brief Retrieves flag_sending_hash_change_after_awake_
+ * @return Returns TRUE if hashID was changed during suspended state
+ * otherwise returns FALSE.
+ */
+ bool flag_sending_hash_change_after_awake() const OVERRIDE;
+
+ /**
+ * @brief Method is used when core receives OnAwakeSDL notification
+ * in order to change value of flag_sending_hash_change_after_awake_
+ * @param Contains FALSE
+ */
+ void set_flag_sending_hash_change_after_awake(bool flag) OVERRIDE;
+
+ /**
+ * @brief Change Hash for current application
+ * and send notification to mobile
+ * @return updated_hash
+ */
virtual void UpdateHash();
UsageStatistics& usage_report();
@@ -432,6 +443,7 @@ class ApplicationImpl : public virtual Application,
protocol_handler::MajorProtocolVersion protocol_version_;
bool is_voice_communication_application_;
sync_primitives::atomic_bool is_resuming_;
+ bool flag_sending_hash_change_after_awake_;
uint32_t video_stream_retry_number_;
uint32_t audio_stream_retry_number_;
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 569880bb56..f9cbc72d50 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -44,6 +44,7 @@
#include "utils/make_shared.h"
#include "utils/timer_task_impl.h"
#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/resumption/resume_ctrl.h"
namespace {
@@ -111,6 +112,7 @@ ApplicationImpl::ApplicationImpl(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3)
, is_voice_communication_application_(false)
, is_resuming_(false)
+ , flag_sending_hash_change_after_awake_(false)
, video_stream_retry_number_(0)
, audio_stream_retry_number_(0)
, video_stream_suspend_timer_(
@@ -872,7 +874,19 @@ void ApplicationImpl::UpdateHash() {
utils::gen_hash(application_manager_.get_settings().hash_string_size());
set_is_application_data_changed(true);
- MessageHelper::SendHashUpdateNotification(app_id(), application_manager_);
+ if (!application_manager_.resume_controller().is_suspended()) {
+ MessageHelper::SendHashUpdateNotification(app_id(), application_manager_);
+ } else {
+ flag_sending_hash_change_after_awake_ = true;
+ }
+}
+
+bool ApplicationImpl::flag_sending_hash_change_after_awake() const {
+ return flag_sending_hash_change_after_awake_;
+}
+
+void ApplicationImpl::set_flag_sending_hash_change_after_awake(bool flag) {
+ flag_sending_hash_change_after_awake_ = flag;
}
void ApplicationImpl::CleanupFiles() {