summaryrefslogtreecommitdiff
path: root/src/components/application_manager/include/application_manager/resumption
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/include/application_manager/resumption')
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl.h35
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h112
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h22
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h15
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_json.h18
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h7
6 files changed, 163 insertions, 46 deletions
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
index 0ec58f2419..f9a60c862b 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
@@ -34,14 +34,14 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUME_CTRL_H_
#include <stdint.h>
-#include "utils/shared_ptr.h"
+#include <time.h>
#include "application_manager/resumption/resumption_data.h"
namespace application_manager {
class ApplicationManager;
class Application;
-typedef utils::SharedPtr<Application> ApplicationSharedPtr;
-typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr;
+typedef std::shared_ptr<Application> ApplicationSharedPtr;
+typedef std::shared_ptr<const Application> ApplicationConstSharedPtr;
}
namespace app_mngr = application_manager;
@@ -125,6 +125,16 @@ class ResumeCtrl {
virtual void OnAwake() = 0;
/**
+ * @brief Saves Low Voltage signal timestamp
+ */
+ virtual void SaveLowVoltageTime() = 0;
+
+ /**
+ * @brief Saves Wake Up signal timestamp
+ */
+ virtual void SaveWakeUpTime() = 0;
+
+ /**
* @brief Checks if SDL has already received OnExitAllApplication notification
* with "SUSPEND" reason
*
@@ -134,13 +144,19 @@ class ResumeCtrl {
virtual bool is_suspended() const = 0;
/**
- * @brief Method stops timer "RsmCtrlPercist" when SDL
+ * @brief Method stops timer "RsmCtrlPersist" when SDL
* receives OnExitAllApplication notification
* with reason "SUSPEND"
*/
virtual void StopSavePersistentDataTimer() = 0;
/**
+ * @brief Method starts timer "RsmCtrlPersist" when
+ * SDL receives onAwakeSDL notification
+ */
+ virtual void StartSavePersistentDataTimer() = 0;
+
+ /**
* @brief Start timer for resumption applications
* Restore D1-D5 data
* @param application that is need to be restored
@@ -158,6 +174,13 @@ class ResumeCtrl {
app_mngr::ApplicationSharedPtr application) = 0;
/**
+ * @brief Retry resumption of an app if it has been disabled or limited
+ * due to absence of high-bandwidth transport.
+ * @param app_id ID of the app to resume
+ */
+ virtual void RetryResumption(const uint32_t app_id) = 0;
+
+ /**
* @brief Check if there are all files need for resumption
* @param application that is need to be restored
* @return true if it all files exist, otherwise return false
@@ -263,7 +286,9 @@ class ResumeCtrl {
#ifdef BUILD_TESTS
virtual void set_resumption_storage(
- utils::SharedPtr<ResumptionData> mock_storage) = 0;
+ std::shared_ptr<ResumptionData> mock_storage) = 0;
+
+ virtual bool get_resumption_active() const = 0;
#endif // BUILD_TESTS
};
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
index d7ff621c95..e749118140 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
@@ -33,6 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUME_CTRL_IMPL_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUME_CTRL_IMPL_H_
+#include "application_manager/resumption/resume_ctrl.h"
+
#include <stdint.h>
#include <vector>
#include <map>
@@ -46,7 +48,6 @@
#include "smart_objects/smart_object.h"
#include "application_manager/application.h"
#include "application_manager/resumption/resumption_data.h"
-#include "application_manager/resumption/resume_ctrl.h"
#include "utils/timer.h"
namespace resumption {
@@ -138,6 +139,10 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
void OnAwake() OVERRIDE;
+ void SaveLowVoltageTime() OVERRIDE;
+
+ void SaveWakeUpTime() OVERRIDE;
+
/**
* @brief Checks if SDL has already received OnExitAllApplication notification
* with "SUSPEND" reason
@@ -155,6 +160,13 @@ class ResumeCtrlImpl : public ResumeCtrl,
void StopSavePersistentDataTimer() OVERRIDE;
/**
+ * @brief Check if all IGNITION OFF and IGNITION ON records
+ * saved in resumption data base
+ * @return True if all records saved, otherwise False
+ */
+ bool CheckIgnCyclesData() const;
+
+ /**
* @brief Method stops restore_hmi_level_timer_ "RsmCtrlRstore" in OnSuspend()
*/
void StopRestoreHmiLevelTimer();
@@ -178,6 +190,13 @@ class ResumeCtrlImpl : public ResumeCtrl,
app_mngr::ApplicationSharedPtr application) OVERRIDE;
/**
+ * @brief Retry resumption of an app if it has been disabled or limited
+ * due to absence of high-bandwidth transport.
+ * @param app_id ID of the app to resume
+ */
+ void RetryResumption(const uint32_t app_id) OVERRIDE;
+
+ /**
* @brief Check if there are all files need for resumption
* @param application that is need to be restored
* @return true if it all files exist, otherwise return false
@@ -293,14 +312,30 @@ class ResumeCtrlImpl : public ResumeCtrl,
* @brief Method starts timer "RsmCtrlPercist" when
* SDL receives onAwakeSDL notification
*/
- void StartSavePersistentDataTimer();
+ void StartSavePersistentDataTimer() OVERRIDE;
#ifdef BUILD_TESTS
void set_resumption_storage(
- utils::SharedPtr<ResumptionData> mock_storage) OVERRIDE;
+ std::shared_ptr<ResumptionData> mock_storage) OVERRIDE;
+
+ bool get_resumption_active() const OVERRIDE;
#endif // BUILD_TESTS
private:
/**
+ * @brief Returns Low Voltage signal timestamp
+ * @return Low Voltage event timestamp if event LOW VOLTAGE event occures
+ * otherwise 0
+ */
+ time_t LowVoltageTime() const;
+
+ /**
+ * @brief Returns Wake Up signal timestamp
+ * @return Wake Up timestamp if Wake Up signal occures
+ * otherwise 0
+ */
+ time_t WakeUpTime() const;
+
+ /**
* @brief restores saved data of application
* @param application contains application for which restores data
* @return true if success, otherwise return false
@@ -381,11 +416,27 @@ class ResumeCtrlImpl : public ResumeCtrl,
void AddWayPointsSubscription(app_mngr::ApplicationSharedPtr application,
const smart_objects::SmartObject& saved_app);
+ /**
+ * @brief Checks if saved HMI level is allowed for resumption
+ * by Ignition Cycle restrictions
+ * @param saved_app application specific section from backup file
+ * @return True if allowed , otherwise - False
+ */
bool CheckIgnCycleRestrictions(const smart_objects::SmartObject& saved_app);
- bool DisconnectedJustBeforeIgnOff(
- const smart_objects::SmartObject& saved_app);
+ /**
+ * @brief Checks if saved HMI level is allowed for resumption
+ * by Low Voltage restrictions
+ * @param saved_app application specific section from backup file
+ * @return True if allowed , otherwise - False
+ */
+ bool CheckLowVoltageRestrictions(const smart_objects::SmartObject& saved_app);
+ /**
+ * @brief Checks if saved HMI level is applicable for resumption
+ * @param saved_app application specific section from backup file
+ * @return True fs allowed , otherwise - False
+ */
bool CheckAppRestrictions(app_mngr::ApplicationConstSharedPtr application,
const smart_objects::SmartObject& saved_app);
@@ -400,10 +451,38 @@ class ResumeCtrlImpl : public ResumeCtrl,
/**
* @brief CheckDelayAfterIgnOn should check if SDL was started less
- * then N seconds ago. N will be readed from profile.
+ * than N seconds ago. N will be read from profile.
* @return true if SDL started N seconds ago, otherwise return false
*/
- bool CheckDelayAfterIgnOn();
+ bool CheckDelayAfterIgnOn() const;
+
+ /**
+ * @brief CheckDelayBeforeIgnOff checks if app was unregistered less
+ * than N seconds before Ignition OFF. N will be read from profile.
+ * @return true if app was disconnected within timeframe of N seconds before
+ * Ignition Off,
+ * otherwise return false
+ */
+ bool CheckDelayBeforeIgnOff(
+ const smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief CheckDelayAfterWakeUp should check if app was registered
+ * during the first N seconds after WakeUp signal. N will be read from
+ * profile.
+ * @return true if app registered within N seconds after WakeUp, otherwise
+ * return false
+ */
+ bool CheckDelayAfterWakeUp() const;
+
+ /**
+ * @brief CheckDelayBeforeLowVoltage checks if app was unregistered within
+ * N seconds before Low Voltage signal. N will be read from profile.
+ * @return true if app was disconnected within timeframe of N seconds before
+ * Low Voltage , otherwise return false
+ */
+ bool CheckDelayBeforeLowVoltage(
+ const smart_objects::SmartObject& saved_app) const;
typedef std::pair<uint32_t, uint32_t> application_timestamp;
@@ -438,7 +517,7 @@ class ResumeCtrlImpl : public ResumeCtrl,
* @brief Get the last ignition off time from LastState
* @return the last ignition off time from LastState
*/
- time_t GetIgnOffTime();
+ time_t GetIgnOffTime() const;
/**
* @brief Setup IgnOff time to LastState
@@ -500,6 +579,19 @@ class ResumeCtrlImpl : public ResumeCtrl,
const application_manager::ApplicationSharedPtr application) const;
/**
+ * @brief Retrieve the HMI level of the app when high-bandwidth transport
+ *isn't available
+ *
+ * The value is configured through smartDeviceLink.ini file
+ *
+ * @param application an instance of the app
+ * @return HMI level that the app is allowed when high-bandwidth transport
+ *isn't available
+ */
+ mobile_apis::HMILevel::eType GetHmiLevelOnLowBandwidthTransport(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
*@brief Mapping applications to time_stamps
* wait for timer to resume HMI Level
*
@@ -513,7 +605,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
bool is_data_saved_;
bool is_suspended_;
time_t launch_time_;
- utils::SharedPtr<ResumptionData> resumption_storage_;
+ time_t low_voltage_time_;
+ time_t wake_up_time_;
+ std::shared_ptr<ResumptionData> resumption_storage_;
application_manager::ApplicationManager& application_manager_;
};
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data.h b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
index bee2bce570..c2634173a5 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
@@ -95,20 +95,26 @@ class ResumptionData {
virtual void IncrementIgnOffCount() = 0;
/**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
+ * @brief Decrements ignition counter for all registered applications
*/
- DEPRECATED virtual void OnSuspend() = 0;
+ virtual void DecrementIgnOffCount() = 0;
/**
- * @brief Decrements ignition counter for all registered applications
+ * @brief Increments global ignition on counter
+ * by 1
*/
- virtual void DecrementIgnOffCount() = 0;
+ virtual void IncrementGlobalIgnOnCounter() = 0;
/**
- * @brief Decrements ignition counter for all registered applications
+ * @brief Get the global ignition on counter
+ * @return the global ignition on counter
+ */
+ virtual uint32_t GetGlobalIgnOnCounter() const = 0;
+
+ /**
+ * @brief Resets global ignition on counter
*/
- DEPRECATED virtual void OnAwake() = 0;
+ virtual void ResetGlobalIgnOnCount() = 0;
/**
* @brief Retrieves hash ID for the given mobile app ID
@@ -276,7 +282,7 @@ class ResumptionData {
++first;
}
}
- mutable sync_primitives::Lock resumption_lock_;
+ mutable sync_primitives::RecursiveLock resumption_lock_;
const application_manager::ApplicationManager& application_manager_;
};
} // namespace resumption
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
index a8032d1f65..2b5a1fdcc9 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
@@ -110,16 +110,11 @@ class ResumptionDataDB : public ResumptionData {
virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id,
const std::string& device_id) const;
- /**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- DEPRECATED void OnSuspend() FINAL;
+ void IncrementGlobalIgnOnCounter() OVERRIDE;
- /**
- * @brief Decrements ignition counter for all registered applications
- */
- DEPRECATED void OnAwake() FINAL;
+ uint32_t GetGlobalIgnOnCounter() const OVERRIDE;
+
+ void ResetGlobalIgnOnCount() OVERRIDE;
/**
* @brief Increments ignition counter for all registered applications
@@ -683,7 +678,7 @@ class ResumptionDataDB : public ResumptionData {
smart_objects::SmartObject& saved_app) const;
/**
- * @brief Selects data from applicationSubscribtionsArray table
+ * @brief Selects data from applicationSubscriptionsArray table
* @param policy_app_id contains mobile application id of application
* @param device_id contains id of device on which is running application
* @param saved_app will contain subscriptions
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
index 82ec1d9e5c..e2418fd033 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
@@ -80,18 +80,6 @@ class ResumptionDataJson : public ResumptionData {
*/
virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id,
const std::string& device_id) const;
-
- /**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- DEPRECATED void OnSuspend() FINAL;
-
- /**
- * @brief Decrements ignition counter for all registered applications
- */
- DEPRECATED void OnAwake() FINAL;
-
/**
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
@@ -145,6 +133,12 @@ class ResumptionDataJson : public ResumptionData {
*/
virtual uint32_t GetIgnOffTime() const;
+ void IncrementGlobalIgnOnCounter() OVERRIDE;
+
+ uint32_t GetGlobalIgnOnCounter() const OVERRIDE;
+
+ void ResetGlobalIgnOnCount() OVERRIDE;
+
/**
* @brief Checks if saved data have application
* @param policy_app_id - mobile application id
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
index d61baff7d2..eee7650697 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
@@ -57,12 +57,15 @@ extern const std::string kUpdateIgnOffCount;
extern const std::string kCountApplicationsIgnOff;
extern const std::string kSelectApplicationsIgnOffCount;
extern const std::string kUpdateSuspendData;
-extern const std::string KUpdateLastIgnOffTime;
+extern const std::string kUpdateLastIgnOffTime;
+extern const std::string kUpdateGlobalIgnOnCount;
+extern const std::string kResetGlobalIgnOnCount;
+extern const std::string kSelectGlobalIgnOnCounter;
extern const std::string kDeleteFile;
extern const std::string kDeleteApplicationFilesArray;
extern const std::string kDeleteSubMenu;
extern const std::string kDeleteApplicationSubMenuArray;
-extern const std::string kDeleteApplicationSubscribtionsArray;
+extern const std::string kDeleteApplicationSubscriptionsArray;
extern const std::string kDeleteImageFromCommands;
extern const std::string kDeleteVrCommands;
extern const std::string kDeleteCommands;