summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAGaliuzov <AGaliuzov@luxoft.com>2015-06-13 00:42:46 +0300
committerAGaliuzov <AGaliuzov@luxoft.com>2015-06-13 00:42:46 +0300
commit5a43356ce55fd2ebf125eaebd1db9ae141b5e855 (patch)
treeee3cf386a6b1e00af87128c51cc208820f7f94a5
parentbea1a8ac440f6877bae33b7656098178e62f9451 (diff)
parent78602638b569f6d9ab861edffeb4b40bf3d9f60b (diff)
downloadsmartdevicelink-5a43356ce55fd2ebf125eaebd1db9ae141b5e855.tar.gz
Merge pull request #129 from LuxoftSDL/hotfix/fixed_setting_preloaded_flag
Hotfix/fixed setting preloaded flag
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h1
-rw-r--r--src/components/application_manager/src/commands/hmi/get_system_info_response.cc7
-rw-r--r--src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc27
-rw-r--r--src/components/policy/src/policy/src/cache_manager.cc5
-rw-r--r--src/components/policy/src/policy/src/sql_pt_representation.cc6
5 files changed, 41 insertions, 5 deletions
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index 914137bee..cb19c66c3 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -280,6 +280,7 @@ const char address_lines[] = "addressLines";
const char phone_number[] = "phoneNumber";
const char location_image[] = "locationImage";
const char is_suscribed[] = "isSubscribed";
+const char message_data[] = "messageData";
} // namespace strings
namespace json {
diff --git a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/src/commands/hmi/get_system_info_response.cc
index 7cfd1b579..26b09d06d 100644
--- a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc
+++ b/src/components/application_manager/src/commands/hmi/get_system_info_response.cc
@@ -52,6 +52,13 @@ void GetSystemInfoResponse::Run() {
if (hmi_apis::Common_Result::SUCCESS != code) {
LOG4CXX_WARN(logger_, "GetSystemError returns an error code " << code);
+
+ // We have to set preloaded flag as false in policy table on any response
+ // of GetSystemInfo (SDLAQ-CRS-2365)
+ const std::string empty_value;
+ policy::PolicyHandler::instance()->OnGetSystemInfo(empty_value,
+ empty_value,
+ empty_value);
return;
}
const std::string ccpu_version =
diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
index 7b5cf5fd9..f5e8808d3 100644
--- a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
+++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc
@@ -31,9 +31,11 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
#include "application_manager/commands/mobile/diagnostic_message_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
+#include "config_profile/profile.h"
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -50,15 +52,34 @@ DiagnosticMessageRequest::~DiagnosticMessageRequest() {
void DiagnosticMessageRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- connection_key());
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "An application is not registered.");
+ LOG4CXX_ERROR(logger_, "Application is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
+ const std::vector<uint32_t>& supported_diag_modes =
+ profile::Profile::instance()->supported_diag_modes();
+
+ uint32_t message_data_length =
+ (*message_)[strings::msg_params][strings::message_data].length();
+ for (uint32_t i = 0; i < message_data_length; ++i) {
+ uint32_t message_data =
+ (*message_)[strings::msg_params][strings::message_data][i].asUInt();
+ if (supported_diag_modes.end() == std::find(supported_diag_modes.begin(),
+ supported_diag_modes.end(),
+ message_data)) {
+ LOG4CXX_ERROR(logger_, "Received message data " << message_data <<
+ " not supported");
+ SendResponse(false, mobile_apis::Result::REJECTED,
+ "Received message data not supported");
+ return;
+ }
+ }
+
// Add app_id for HMI request
(*message_)[strings::msg_params][strings::app_id] = app->app_id();
diff --git a/src/components/policy/src/policy/src/cache_manager.cc b/src/components/policy/src/policy/src/cache_manager.cc
index df6a73028..a145824a2 100644
--- a/src/components/policy/src/policy/src/cache_manager.cc
+++ b/src/components/policy/src/policy/src/cache_manager.cc
@@ -790,6 +790,11 @@ bool CacheManager::SetMetaInfo(const std::string &ccpu_version,
const std::string &wers_country_code,
const std::string &language) {
CACHE_MANAGER_CHECK(false);
+
+ // We have to set preloaded flag as false in policy table on any response
+ // of GetSystemInfo (SDLAQ-CRS-2365)
+ *pt_->policy_table.module_config.preloaded_pt = false;
+
Backup();
return true;
}
diff --git a/src/components/policy/src/policy/src/sql_pt_representation.cc b/src/components/policy/src/policy/src/sql_pt_representation.cc
index a00282ef0..47eae02dd 100644
--- a/src/components/policy/src/policy/src/sql_pt_representation.cc
+++ b/src/components/policy/src/policy/src/sql_pt_representation.cc
@@ -1039,8 +1039,10 @@ bool SQLPTRepresentation::SaveModuleConfig(
return false;
}
- config.preloaded_pt.is_initialized() ?
- query.Bind(0, config.preloaded_pt) : query.Bind(0, false);
+ bool is_preloaded = config.preloaded_pt.is_initialized() &&
+ *config.preloaded_pt;
+
+ query.Bind(0, is_preloaded);
query.Bind(1, config.exchange_after_x_ignition_cycles);
query.Bind(2, config.exchange_after_x_kilometers);
query.Bind(3, config.exchange_after_x_days);