summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadym Luchko (GitHub) <76956836+VadymLuchko@users.noreply.github.com>2021-02-03 19:55:02 +0200
committerGitHub <noreply@github.com>2021-02-03 12:55:02 -0500
commit16323b0915775a42b81d2ad92d5bdcfafcdf61e4 (patch)
tree104067fd21e05c89cf8084becb3b9d9e5a21813a
parent30f55878dfefbdd2cdaccffb8fb73ad0c106f1c0 (diff)
downloadsdl_core-16323b0915775a42b81d2ad92d5bdcfafcdf61e4.tar.gz
Fix RC.SetGlobalProperties during resumption (#3622)
* Fix RC.SetGlobalProperties during resumption * Changes by review Co-authored-by: Vadym Luchko (gitHub) <vluchko@.luxoft.com>
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h32
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h4
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc103
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc138
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc4
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_processor_impl.cc4
-rw-r--r--src/components/application_manager/src/resumption/resumption_sql_queries.cc44
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_test.h1
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc13
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc2
-rw-r--r--src/components/application_manager/test/resumption_sql_queries_test.cc2
11 files changed, 305 insertions, 42 deletions
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 a667dbf8e2..a4614d4f2c 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
@@ -353,6 +353,16 @@ class ResumptionDataDB : public ResumptionData {
const std::string& device_id);
/**
+ * @brief Deletes userLocation from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data was deleted otherwise returns
+ * false
+ */
+ bool DeleteUserLocation(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
* @brief Deletes commands from saved application
* @param policy_app_id - mobile application id
* @param device_id - contains id of device on which is running application
@@ -442,6 +452,16 @@ class ResumptionDataDB : public ResumptionData {
int64_t application_primary_key) const;
/**
+ * @brief Saves user location data to DB
+ * @param user_location contains data for saving
+ * @param application_primary_key - primary key from DB table application
+ * @return true if data was saved successfully otherwise returns
+ * false
+ */
+ bool InsertUserLocationData(const smart_objects::SmartObject& user_location,
+ int64_t application_primary_key) const;
+
+ /**
* @brief Saves globalProperties data to DB
* @param global_properties contains data for saving
* @param global_properties_key - will contain primary key from global
@@ -690,6 +710,18 @@ class ResumptionDataDB : public ResumptionData {
smart_objects::SmartObject& saved_app) const;
/**
+ * @brief Selects data from applicationUserLocation 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 contains userLocation
+ * @return true if query has been executed successfully otherwise returns
+ * false
+ */
+ bool SelectUserLocationData(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
* @brief Selects choice set data from DB
* @param policy_app_id contains mobile application id of application
* @param device_id contains id of device on which is running application
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 eee7650697..c62d115448 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
@@ -66,6 +66,7 @@ extern const std::string kDeleteApplicationFilesArray;
extern const std::string kDeleteSubMenu;
extern const std::string kDeleteApplicationSubMenuArray;
extern const std::string kDeleteApplicationSubscriptionsArray;
+extern const std::string kDeleteApplicationUserLocation;
extern const std::string kDeleteImageFromCommands;
extern const std::string kDeleteVrCommands;
extern const std::string kDeleteCommands;
@@ -97,6 +98,7 @@ extern const std::string kInsertToCommand;
extern const std::string kInsertApplicationCommandArray;
extern const std::string kInsertVrCommand;
extern const std::string kInsertSubscriptions;
+extern const std::string kInsertUserLocation;
extern const std::string kInsertChoice;
extern const std::string kInsertApplicationChoiceSet;
extern const std::string kInsertChoiceArray;
@@ -117,6 +119,8 @@ extern const std::string kSelectCountCommands;
extern const std::string kSelectCommands;
extern const std::string kSelectCountSubscriptions;
extern const std::string kSelectSubscriptions;
+extern const std::string kSelectCountUserLocation;
+extern const std::string kSelectUserLocation;
extern const std::string kSelectCountChoiceSet;
extern const std::string kSelectChoiceSets;
extern const std::string kSelectImage;
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 4ad39a147d..9bf623d343 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -1246,38 +1246,38 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
// UI global properties
- if (can_send_ui && (app->vr_help_title() || app->vr_help())) {
+ if (can_send_ui &&
+ (app->vr_help_title() || app->vr_help() || app->keyboard_props() ||
+ app->menu_title() || app->menu_icon())) {
smart_objects::SmartObjectSPtr ui_global_properties = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
- if (!ui_global_properties) {
- return requests;
- }
-
- (*ui_global_properties)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::UI_SetGlobalProperties);
+ if (ui_global_properties) {
+ (*ui_global_properties)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_SetGlobalProperties);
- smart_objects::SmartObject ui_msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- if (app->vr_help_title()) {
- ui_msg_params[strings::vr_help_title] = (*app->vr_help_title());
- }
- if (app->vr_help()) {
- ui_msg_params[strings::vr_help] = (*app->vr_help());
- }
- if (app->keyboard_props()) {
- ui_msg_params[strings::keyboard_properties] = (*app->keyboard_props());
- }
- if (app->menu_title()) {
- ui_msg_params[strings::menu_title] = (*app->menu_title());
- }
- if (app->menu_icon()) {
- ui_msg_params[strings::menu_icon] = (*app->menu_icon());
- }
- ui_msg_params[strings::app_id] = app->app_id();
+ smart_objects::SmartObject ui_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (app->vr_help_title()) {
+ ui_msg_params[strings::vr_help_title] = (*app->vr_help_title());
+ }
+ if (app->vr_help()) {
+ ui_msg_params[strings::vr_help] = (*app->vr_help());
+ }
+ if (app->keyboard_props()) {
+ ui_msg_params[strings::keyboard_properties] = (*app->keyboard_props());
+ }
+ if (app->menu_title()) {
+ ui_msg_params[strings::menu_title] = (*app->menu_title());
+ }
+ if (app->menu_icon()) {
+ ui_msg_params[strings::menu_icon] = (*app->menu_icon());
+ }
+ ui_msg_params[strings::app_id] = app->app_id();
- (*ui_global_properties)[strings::msg_params] = ui_msg_params;
+ (*ui_global_properties)[strings::msg_params] = ui_msg_params;
- requests.push_back(ui_global_properties);
+ requests.push_back(ui_global_properties);
+ }
}
const bool can_send_vr = helpers::
@@ -1291,27 +1291,46 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
smart_objects::SmartObjectSPtr tts_global_properties =
CreateMessageForHMI(hmi_apis::messageType::request, correlation_id);
- if (!tts_global_properties) {
- return requests;
- }
+ if (tts_global_properties) {
+ (*tts_global_properties)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::TTS_SetGlobalProperties);
- (*tts_global_properties)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::TTS_SetGlobalProperties);
+ smart_objects::SmartObject tts_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (app->help_prompt()) {
+ tts_msg_params[strings::help_prompt] = (*app->help_prompt());
+ }
+ if (app->timeout_prompt()) {
+ tts_msg_params[strings::timeout_prompt] = (*app->timeout_prompt());
+ }
+ tts_msg_params[strings::app_id] = app->app_id();
- smart_objects::SmartObject tts_msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- if (app->help_prompt()) {
- tts_msg_params[strings::help_prompt] = (*app->help_prompt());
- }
- if (app->timeout_prompt()) {
- tts_msg_params[strings::timeout_prompt] = (*app->timeout_prompt());
+ (*tts_global_properties)[strings::msg_params] = tts_msg_params;
+
+ requests.push_back(tts_global_properties);
}
- tts_msg_params[strings::app_id] = app->app_id();
+ }
- (*tts_global_properties)[strings::msg_params] = tts_msg_params;
+ // RC global properties
+ if (!app->get_user_location().empty()) {
+ smart_objects::SmartObjectSPtr rc_global_properties = CreateMessageForHMI(
+ hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
+ if (rc_global_properties) {
+ (*rc_global_properties)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::RC_SetGlobalProperties);
+
+ smart_objects::SmartObject rc_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ rc_msg_params[strings::user_location] = (app->get_user_location());
+ rc_msg_params[strings::app_id] = app->app_id();
- requests.push_back(tts_global_properties);
+ (*rc_global_properties)[strings::msg_params] = rc_msg_params;
+
+ requests.push_back(rc_global_properties);
+ }
}
+
return requests;
}
diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc
index f00b100913..eedfc48b73 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -37,6 +37,7 @@
#include "application_manager/message_helper.h"
#include "application_manager/resumption/resumption_data_db.h"
#include "application_manager/resumption/resumption_sql_queries.h"
+#include "application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h"
#include "application_manager/smart_object_keys.h"
#include "utils/gen_hash.h"
#include "utils/helpers.h"
@@ -326,6 +327,12 @@ bool ResumptionDataDB::GetSavedApplication(
SDL_LOG_ERROR("Problem with restoring of global properties data");
return false;
}
+
+ if (!SelectUserLocationData(policy_app_id, device_id, saved_app)) {
+ SDL_LOG_ERROR("Problem with restoring of user location data");
+ return false;
+ }
+
SDL_LOG_INFO("Application data were successfully fetched from data base");
return true;
}
@@ -762,6 +769,9 @@ bool ResumptionDataDB::DropAppDataResumption(const std::string& device_id,
if (!DeleteSavedGlobalProperties(app_id, device_id)) {
return false;
}
+ if (!DeleteUserLocation(app_id, device_id)) {
+ return false;
+ }
if (!UpdateGrammarID(app_id, device_id, 0)) {
return false;
}
@@ -1006,6 +1016,58 @@ bool ResumptionDataDB::SelectSubscriptionsData(
return true;
}
+bool ResumptionDataDB::SelectUserLocationData(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ SDL_LOG_AUTO_TRACE();
+ using namespace app_mngr;
+ using namespace smart_objects;
+ uint32_t count_item = 0;
+ if (!SelectCountFromArray(
+ count_item, kSelectCountUserLocation, policy_app_id, device_id)) {
+ SDL_LOG_ERROR("Select query has been failed");
+ return false;
+ }
+
+ if (0 == count_item) {
+ SDL_LOG_DEBUG("Application does not contain user_location data");
+ return true;
+ }
+ utils::dbms::SQLQuery select_user_location(db());
+ if (!PrepareSelectQuery(select_user_location,
+ policy_app_id,
+ device_id,
+ kSelectUserLocation)) {
+ SDL_LOG_ERROR("Failed to prepare user location select query");
+ return false;
+ }
+
+ if (!select_user_location.Exec()) {
+ SDL_LOG_ERROR("Failed to execute user location select query");
+ return false;
+ }
+ /* Position of data in "select_user_location" :
+ field "col" from table "applicationUserLocation" = 0
+ field "colspan" from table "applicationUserLocation" = 1
+ field "level" from table "applicationUserLocation" = 2
+ field "levelspan" from table "applicationUserLocation" = 3
+ field "row" from table "applicationUserLocation" = 4
+ field "rowspan" from table "applicationUserLocation" = 5*/
+ smart_objects::SmartObject grid =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ grid[rc_rpc_plugin::strings::kCol] = select_user_location.GetInteger(0);
+ grid[rc_rpc_plugin::strings::kColspan] = select_user_location.GetInteger(1);
+ grid[rc_rpc_plugin::strings::kLevel] = select_user_location.GetInteger(2);
+ grid[rc_rpc_plugin::strings::kLevelspan] = select_user_location.GetInteger(3);
+ grid[rc_rpc_plugin::strings::kRow] = select_user_location.GetInteger(4);
+ grid[rc_rpc_plugin::strings::kRowspan] = select_user_location.GetInteger(5);
+
+ saved_app[strings::user_location][rc_rpc_plugin::strings::kGrid] = grid;
+
+ return true;
+}
+
bool ResumptionDataDB::SelectChoiceSetData(
const std::string& policy_app_id,
const std::string& device_id,
@@ -1519,6 +1581,18 @@ bool ResumptionDataDB::DeleteSavedSubscriptions(
return true;
}
+bool ResumptionDataDB::DeleteUserLocation(const std::string& policy_app_id,
+ const std::string& device_id) {
+ SDL_LOG_AUTO_TRACE();
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteApplicationUserLocation)) {
+ SDL_LOG_WARN("Incorrect delete from applicationUserLocation.");
+ return false;
+ }
+ return true;
+}
+
bool ResumptionDataDB::DeleteSavedCommands(const std::string& policy_app_id,
const std::string& device_id) {
SDL_LOG_AUTO_TRACE();
@@ -1914,6 +1988,12 @@ bool ResumptionDataDB::SaveApplicationToDB(
db_->RollbackTransaction();
return false;
}
+ if (!InsertUserLocationData(application->get_user_location(),
+ application_primary_key)) {
+ SDL_LOG_WARN("Incorrect insert user location to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
db_->CommitTransaction();
return true;
}
@@ -1973,6 +2053,12 @@ bool ResumptionDataDB::SaveApplicationToDB(
db_->RollbackTransaction();
return false;
}
+ if (!InsertUserLocationData(application["userLocation"],
+ application_primary_key)) {
+ SDL_LOG_WARN("Incorrect insert userLocation to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
db_->CommitTransaction();
return true;
}
@@ -2222,6 +2308,58 @@ bool ResumptionDataDB::InsertChoiceSetData(
return true;
}
+bool ResumptionDataDB::InsertUserLocationData(
+ const smart_objects::SmartObject& user_location,
+ int64_t application_primary_key) const {
+ SDL_LOG_AUTO_TRACE();
+ using namespace app_mngr;
+ using namespace smart_objects;
+
+ if (user_location.empty()) {
+ SDL_LOG_DEBUG("Application doesn't contain user location");
+ return true;
+ }
+
+ const auto grid = user_location[rc_rpc_plugin::strings::kGrid];
+ const int32_t col = grid[rc_rpc_plugin::strings::kCol].asInt();
+ const int32_t row = grid[rc_rpc_plugin::strings::kRow].asInt();
+ const int32_t level = grid[rc_rpc_plugin::strings::kLevel].asInt();
+ const int32_t colspan = grid[rc_rpc_plugin::strings::kColspan].asInt();
+ const int32_t rowspan = grid[rc_rpc_plugin::strings::kRowspan].asInt();
+ const int32_t levelspan = grid[rc_rpc_plugin::strings::kLevelspan].asInt();
+
+ utils::dbms::SQLQuery insert_application_user_location(db());
+ if (!insert_application_user_location.Prepare(kInsertUserLocation)) {
+ SDL_LOG_WARN(
+ "Problem with preparation insert "
+ "application user location query");
+ return false;
+ }
+
+ /* Positions of binding data for "insert_application_user_location":
+ field "idApplication" from table "applicationUserLocation" = 0
+ field "col" from table "applicationUserLocation" = 1
+ field "colspan" from table "applicationUserLocation" = 2
+ field "level" from table "applicationUserLocation" = 3
+ field "levelspan" from table "applicationUserLocation" = 4
+ field "row" from table "applicationUserLocation" = 5
+ field "rowspan" from table "applicationUserLocation" = 6*/
+ insert_application_user_location.Bind(0, application_primary_key);
+ insert_application_user_location.Bind(1, col);
+ insert_application_user_location.Bind(2, colspan);
+ insert_application_user_location.Bind(3, level);
+ insert_application_user_location.Bind(4, levelspan);
+ insert_application_user_location.Bind(5, row);
+ insert_application_user_location.Bind(6, rowspan);
+
+ if (!insert_application_user_location.Exec()) {
+ SDL_LOG_WARN("Incorrect insertion of user location");
+ return false;
+ }
+
+ return true;
+}
+
bool ResumptionDataDB::ExecInsertApplicationChoiceSet(
int64_t& choice_set_primary_key,
const smart_objects::SmartObject& choiceset) const {
diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc
index f3d417d128..1f2d0f116f 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -107,6 +107,9 @@ void ResumptionDataJson::SaveApplication(
json_app[strings::windows_info] = tmp;
json_app[strings::time_stamp] = time_stamp;
json_app[strings::subscribed_for_way_points] = is_subscribed_for_way_points;
+ formatters::CFormatterJsonBase::objToJsonValue(
+ application->get_user_location(), tmp);
+ json_app[strings::user_location] = tmp;
accessor.GetMutableData().set_dictionary(dictionary);
SDL_LOG_DEBUG("SaveApplication : " << json_app.toStyledString());
@@ -557,6 +560,7 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id,
application[strings::application_global_properties].clear();
application[strings::application_subscriptions].clear();
application[strings::application_files].clear();
+ application[strings::user_location].clear();
application.removeMember(strings::grammar_id);
accessor.GetMutableData().set_dictionary(dictionary);
SDL_LOG_DEBUG("Resumption data for application "
diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
index 3b091c74a8..504db76a82 100644
--- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
@@ -744,6 +744,10 @@ void ResumptionDataProcessorImpl::SetGlobalProperties(
saved_app[strings::application_global_properties];
application->load_global_properties(properties_so);
+ if (saved_app.keyExists(strings::user_location)) {
+ application->set_user_location(saved_app[strings::user_location]);
+ }
+
ProcessMessagesToHMI(MessageHelper::CreateGlobalPropertiesRequestsToHMI(
application, application_manager_));
}
diff --git a/src/components/application_manager/src/resumption/resumption_sql_queries.cc b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
index 4770bafef4..cfcac136aa 100644
--- a/src/components/application_manager/src/resumption/resumption_sql_queries.cc
+++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
@@ -314,6 +314,23 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `_internal_data`( "
" `db_version_hash` INTEGER "
" ); "
+ "CREATE TABLE IF NOT EXISTS `applicationUserLocation`( "
+ " `idLocation` INTEGER PRIMARY KEY NOT NULL, "
+ " `idApplication` INTEGER, "
+ " `col` INTEGER, "
+ " `colspan` INTEGER, "
+ " `level` INTEGER, "
+ " `levelspan` INTEGER, "
+ " `row` INTEGER, "
+ " `rowspan` INTEGER, "
+ " CONSTRAINT `fk_Application` "
+ " FOREIGN KEY(`idApplication`) "
+ " REFERENCES `application`(`idApplication`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationUserLocation.fk_Application_idx` "
+ " ON `applicationUserLocation`(`idApplication`); "
+
"COMMIT;";
const std::string kDropSchema =
@@ -369,6 +386,8 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `applicationSubscriptionsArray`; "
"DROP INDEX IF EXISTS `applicationSubscriptionsArray.fk_Application_idx`; "
"DROP TABLE IF EXISTS `_internal_data`; "
+ "DROP TABLE IF EXISTS `applicationUserLocation`; "
+ "DROP INDEX IF EXISTS `applicationUserLocation.fk_Application_idx`; "
"COMMIT; "
"VACUUM;";
@@ -497,6 +516,12 @@ const std::string kDeleteApplicationSubscriptionsArray =
"FROM `application` "
"WHERE `appID` = ? AND `deviceID` = ?)";
+const std::string kDeleteApplicationUserLocation =
+ "DELETE FROM `applicationUserLocation` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
const std::string kDeleteImageFromCommands =
"DELETE FROM `image` "
"WHERE `idimage` IN (SELECT `idimage` "
@@ -732,6 +757,13 @@ const std::string kInsertSubscriptions =
"VALUES "
"(?, ?, ?);";
+const std::string kInsertUserLocation =
+ "INSERT INTO `applicationUserLocation` "
+ "(`idApplication`, `col`, `colspan`, `level`, `levelspan`, `row`, "
+ "`rowspan`) "
+ "VALUES "
+ "(?, ?, ?, ?, ?, ?, ?);";
+
const std::string kInsertChoice =
"INSERT INTO `choice` "
"(`choiceID`, `menuName`, `secondaryText`, "
@@ -877,6 +909,18 @@ const std::string kSelectSubscriptions =
"FROM `application` "
"WHERE `appID` = ? AND `deviceID` = ?);";
+const std::string kSelectCountUserLocation =
+ "SELECT COUNT (*) "
+ "FROM `applicationUserLocation` INNER JOIN `application` ON "
+ "`applicationUserLocation`.`idApplication` = `application`.`idApplication` "
+ "WHERE `appID` = ? AND `deviceID` = ?";
+
+const std::string kSelectUserLocation =
+ "SELECT `col`, `colspan`, `level`, `levelspan`, `row`, `rowspan` "
+ "FROM `applicationUserLocation` INNER JOIN `application` ON "
+ "`applicationUserLocation`.`idApplication` = `application`.`idApplication` "
+ "WHERE `appID` = ? AND `deviceID` = ?";
+
const std::string kSelectCountChoiceSet =
"SELECT COUNT (`idApplication`) "
"FROM `applicationChoiceSetArray` "
diff --git a/src/components/application_manager/test/include/application_manager/resumption_data_test.h b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
index e38b428877..0596b4e500 100644
--- a/src/components/application_manager/test/include/application_manager/resumption_data_test.h
+++ b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
@@ -157,6 +157,7 @@ class ResumptionDataTest : public ::testing::Test {
am::SubMenuMap test_submenu_map;
am::ChoiceSetMap test_choiceset_map;
am::AppFilesMap app_files_map_;
+ smart_objects::SmartObject user_location_;
am::ButtonSubscriptions btn_subscr;
diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc
index 34d1e488b7..f6ee2b654a 100644
--- a/src/components/application_manager/test/message_helper/message_helper_test.cc
+++ b/src/components/application_manager/test/message_helper/message_helper_test.cc
@@ -46,6 +46,7 @@
#include "application_manager/mock_rpc_service.h"
#include "application_manager/policies/policy_handler.h"
#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h"
#include "application_manager/state_controller.h"
#include "policy/mock_policy_settings.h"
#include "smart_objects/enum_schema_item.h"
@@ -167,6 +168,12 @@ TEST(MessageHelperTestCreate,
EXPECT_CALL(*mock_help_prompt_manager, GetSendingType())
.WillRepeatedly(Return(HelpPromptManager::SendingType::kSendBoth));
+ smart_objects::SmartObject user_loc =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ EXPECT_CALL(*appSharedMock, get_user_location())
+ .WillRepeatedly(ReturnRef(user_loc));
+
application_manager_test::MockApplicationManager mock_application_manager;
smart_objects::SmartObjectList ptr =
MessageHelper::CreateGlobalPropertiesRequestsToHMI(
@@ -189,6 +196,10 @@ TEST(MessageHelperTestCreate,
(*objPtr)[5][strings::help_prompt] = "666";
(*objPtr)[6][strings::timeout_prompt] = "777";
+ smart_objects::SmartObject user_loc =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ user_loc[rc_rpc_plugin::strings::kGrid] = "[]";
+
EXPECT_CALL(*appSharedMock, vr_help_title())
.Times(AtLeast(3))
.WillRepeatedly(Return(&(*objPtr)[0]));
@@ -211,6 +222,8 @@ TEST(MessageHelperTestCreate,
.Times(AtLeast(2))
.WillRepeatedly(Return(&(*objPtr)[4]));
EXPECT_CALL(*appSharedMock, app_id()).WillRepeatedly(Return(0));
+ EXPECT_CALL(*appSharedMock, get_user_location())
+ .WillRepeatedly(ReturnRef(user_loc));
std::shared_ptr<MockHelpPromptManager> mock_help_prompt_manager =
std::make_shared<MockHelpPromptManager>();
diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc
index d5228934db..a416cbbad5 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -437,6 +437,8 @@ void ResumptionDataTest::PrepareData() {
ON_CALL(*app_mock, getAppFiles()).WillByDefault(ReturnRef(app_files_map_));
ON_CALL(*app_mock, window_optional_params_map())
.WillByDefault(Return(window_params_map));
+ ON_CALL(*app_mock, get_user_location())
+ .WillByDefault(ReturnRef(user_location_));
}
void ResumptionDataTest::SetDefaultCurrentHmiState() {
diff --git a/src/components/application_manager/test/resumption_sql_queries_test.cc b/src/components/application_manager/test/resumption_sql_queries_test.cc
index 61490ae4af..f31d8f8e28 100644
--- a/src/components/application_manager/test/resumption_sql_queries_test.cc
+++ b/src/components/application_manager/test/resumption_sql_queries_test.cc
@@ -81,6 +81,7 @@ const string kDeleteData =
"DELETE FROM `applicationSubMenuArray`; "
"DELETE FROM `applicationSubscriptionsArray`; "
"DELETE FROM `_internal_data`; "
+ "DELETE FROM `applicationUserLocation`;"
"COMMIT; "
"VACUUM;";
@@ -329,6 +330,7 @@ class ResumptionSqlQueriesTest : public ::testing::Test {
db_schema.push_back("applicationSubMenuArray");
db_schema.push_back("applicationSubscriptionsArray");
db_schema.push_back("_internal_data");
+ db_schema.push_back("applicationUserLocation");
std::sort(db_schema.begin(), db_schema.end());
}
};