diff options
36 files changed, 162 insertions, 22 deletions
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index 037a6efb14..b0513c076f 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -192,6 +192,8 @@ PathToSnapshot = sdl_snapshot.json AttemptsToOpenPolicyDB = 5 ; Timeout between attempts during opening DB in milliseconds OpenAttemptTimeoutMs = 500 +; Whether to use the fullAppID over the short-form appID in policy lookups +UseFullAppID = true [TransportManager] ; Listening port form incoming TCP mobile connection diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 539fa8823d..981da8e672 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -1021,6 +1021,8 @@ class ApplicationManagerImpl StateController& state_controller() OVERRIDE; const ApplicationManagerSettings& get_settings() const OVERRIDE; + std::string GetCorrectMobileIDFromMessage( + const commands::MessageSharedPtr& message) const OVERRIDE; virtual event_engine::EventDispatcher& event_dispatcher() OVERRIDE; app_launch::AppLaunchCtrl& app_launch_ctrl() OVERRIDE; 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 4646ef5e8f..1291829eb5 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 @@ -54,6 +54,7 @@ extern const char* msg_params; extern const char* method_name; extern const char* info; extern const char* app_id; +extern const char* full_app_id; extern const char* bundle_id; extern const char* app_info; extern const char* app_launch; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc index 4d1e4339f5..d5a13c99a0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc @@ -212,10 +212,9 @@ void PutFileRequest::Run() { return; } const std::string full_path = file_path + "/" + sync_file_name_; - const size_t bin_data_size = binary_data.size(); if ((*message_)[strings::msg_params].keyExists(strings::crc32_check_sum)) { - LOG4CXX_TRACE(logger_, "Binary Data Size: " << bin_data_size); + LOG4CXX_TRACE(logger_, "Binary Data Size: " << binary_data.size()); const uint32_t crc_received = (*message_)[strings::msg_params][strings::crc32_check_sum].asUInt(); LOG4CXX_TRACE(logger_, "CRC32 SUM Received: " << crc_received); @@ -232,7 +231,7 @@ void PutFileRequest::Run() { } LOG4CXX_DEBUG(logger_, - "Writing " << bin_data_size << " bytes to " << full_path + "Writing " << binary_data.size() << " bytes to " << full_path << " (current size is" << file_system::FileSize(full_path) << ")"); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 03dc43e6d0..70307b8da2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -228,9 +228,6 @@ void RegisterAppInterfaceRequest::Run() { return; } - const std::string mobile_app_id = - (*message_)[strings::msg_params][strings::app_id].asString(); - ApplicationSharedPtr application = application_manager_.application(connection_key()); @@ -238,18 +235,31 @@ void RegisterAppInterfaceRequest::Run() { SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY); return; } + // cache the original app ID (for legacy behavior) + const std::string policy_app_id = + application_manager_.GetCorrectMobileIDFromMessage(message_); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - const std::string policy_app_id = msg_params[strings::app_id].asString(); - std::string new_policy_app_id = policy_app_id; - std::transform(policy_app_id.begin(), - policy_app_id.end(), - new_policy_app_id.begin(), + // transform app IDs to lowercase for usage in policy checks later + const std::string app_id_short = msg_params[strings::app_id].asString(); + std::string new_app_id_short = app_id_short; + std::transform(app_id_short.begin(), + app_id_short.end(), + new_app_id_short.begin(), ::tolower); - (*message_)[strings::msg_params][strings::app_id] = new_policy_app_id; - + (*message_)[strings::msg_params][strings::app_id] = new_app_id_short; + // If full ID is present, shift that to lowercase too + if (msg_params.keyExists(strings::full_app_id)) { + const std::string app_id_full = msg_params[strings::full_app_id].asString(); + std::string new_app_id_full = app_id_full; + std::transform(app_id_full.begin(), + app_id_full.end(), + new_app_id_full.begin(), + ::tolower); + (*message_)[strings::msg_params][strings::full_app_id] = new_app_id_full; + } if (application_manager_.IsApplicationForbidden(connection_key(), policy_app_id)) { SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS); @@ -1067,7 +1077,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { policy::StringArray app_hmi_types; const std::string mobile_app_id = - message[strings::msg_params][strings::app_id].asString(); + application_manager_.GetCorrectMobileIDFromMessage(message_); const bool init_result = GetPolicyHandler().GetInitialAppData( mobile_app_id, &app_nicknames, &app_hmi_types); @@ -1171,8 +1181,8 @@ void RegisterAppInterfaceRequest::FillDeviceInfo( bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { LOG4CXX_AUTO_TRACE(logger_); - const custom_string::CustomString mobile_app_id = - (*message_)[strings::msg_params][strings::app_id].asCustomString(); + const custom_string::CustomString mobile_app_id( + application_manager_.GetCorrectMobileIDFromMessage(message_)); const ApplicationSet& applications = application_manager_.applications().GetData(); @@ -1314,6 +1324,17 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { } } + if (application_manager_.get_settings().use_full_app_id()) { + if ((*message_)[strings::msg_params].keyExists(strings::full_app_id)) { + str = + (*message_)[strings::msg_params][strings::full_app_id].asCharArray(); + if (!CheckSyntax(str)) { + LOG4CXX_ERROR(logger_, "Invalid app_id syntax check failed"); + return true; + } + } + } + return false; } @@ -1346,10 +1367,8 @@ void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() { } bool RegisterAppInterfaceRequest::IsApplicationSwitched() { - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - const std::string& policy_app_id = msg_params[strings::app_id].asString(); + const std::string& policy_app_id = + application_manager_.GetCorrectMobileIDFromMessage(message_); LOG4CXX_DEBUG(logger_, "Looking for application id " << policy_app_id); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc index 2518e9c7fd..7dab16fe35 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc @@ -81,6 +81,7 @@ const mobile_apis::Language::eType kMobileLanguage = mobile_apis::Language::EN_US; const std::string kMacAddress = "test_mac_address"; const std::string kAppId = "test_app_id"; +const std::string kFullAppId = "test_app_id_long"; const std::string kDummyString = "test_string"; const std::vector<uint32_t> kDummyDiagModes; const utils::SemanticVersion mock_semantic_version(1, 0, 0); @@ -112,6 +113,7 @@ class RegisterAppInterfaceRequestTest void InitBasicMessage() { (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey; (*msg_)[am::strings::msg_params][am::strings::app_id] = kAppId; + (*msg_)[am::strings::msg_params][am::strings::full_app_id] = kFullAppId; (*msg_)[am::strings::msg_params][am::strings::app_name] = app_name_; (*msg_)[am::strings::msg_params][am::strings::language_desired] = kHmiLanguage; @@ -151,6 +153,8 @@ class RegisterAppInterfaceRequestTest } void InitGetters() { + ON_CALL(app_mngr_, GetCorrectMobileIDFromMessage(msg_)) + .WillByDefault(Return(kAppId)); ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(true)); ON_CALL(app_mngr_, resume_controller()) .WillByDefault(ReturnRef(mock_resume_crt_)); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc index 3855d6733b..9311cea6d7 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc @@ -89,6 +89,7 @@ app_mngr::CommandSharedPtr VehicleInfoHmiCommandFactory::CreateCommand( message_type_str = "error response"; } + UNUSED(message_type_str); LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand function_id: " << function_id << ", message type: " << message_type_str); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc index caa832dde4..7600afa091 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc @@ -86,6 +86,7 @@ app_mngr::CommandSharedPtr VehicleInfoMobileCommandFactory::CreateCommand( message_type_str = "notification"; } + UNUSED(message_type_str); LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand function_id: " << function_id << ", message type: " << message_type_str); diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index f6960e5583..55112e153c 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -500,7 +500,8 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( } smart_objects::SmartObject& params = message[strings::msg_params]; - const std::string& policy_app_id = params[strings::app_id].asString(); + const std::string& policy_app_id = + GetCorrectMobileIDFromMessage(request_for_registration); const custom_str::CustomString& app_name = message[strings::msg_params][strings::app_name].asCustomString(); std::string device_mac; @@ -933,6 +934,22 @@ const ApplicationManagerSettings& ApplicationManagerImpl::get_settings() const { return settings_; } +// Extract the app ID to use for policy based on the UseFullAppID .ini setting +std::string ApplicationManagerImpl::GetCorrectMobileIDFromMessage( + const commands::MessageSharedPtr& message) const { + // If core is expecting a fullAppID + if (get_settings().use_full_app_id()) { + // fullAppID is present and core is configured to use it + if ((*message)[strings::msg_params].keyExists(strings::full_app_id)) { + return (*message)[strings::msg_params][strings::full_app_id].asString(); + } else { + LOG4CXX_DEBUG(logger_, "UseFullAppID is on but only short ID given!"); + } + } + // If core isn't using full or no full given, use regular appID + return (*message)[strings::msg_params][strings::app_id].asString(); +} + void application_manager::ApplicationManagerImpl::MarkAppsGreyOut( const connection_handler::DeviceHandle handle, bool is_greyed_out) { sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index 7f742fcd9b..ff9ebb6208 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -18,6 +18,7 @@ const char* msg_params = "msg_params"; const char* method_name = "methodName"; const char* info = "info"; const char* app_id = "appID"; +const char* full_app_id = "fullAppID"; const char* bundle_id = "appBundleID"; const char* app_info = "appInfo"; const char* app_launch = "app_launch"; diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc index 36cf890351..22ac534215 100644 --- a/src/components/application_manager/test/application_manager_impl_test.cc +++ b/src/components/application_manager/test/application_manager_impl_test.cc @@ -110,7 +110,9 @@ class ApplicationManagerImplTest : public ::testing::Test { application_manager::MockMessageHelper::message_helper_mock()) { +#ifdef ENABLE_LOG logger::create_log_message_loop_thread(); +#endif Mock::VerifyAndClearExpectations(mock_message_helper_); } ~ApplicationManagerImplTest() { diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index d7b1cbad4a..57e925cd43 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -384,6 +384,12 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, */ bool enable_policy() const; + /** + * @brief Should core use fullAppID internally instead of appID (Default true) + * @return Flag + */ + bool use_full_app_id() const; + // TransportManageSettings interface /* @@ -947,6 +953,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, std::string preloaded_pt_file_; std::string policy_snapshot_file_name_; bool enable_policy_; + bool use_full_app_id_; uint32_t transport_manager_disconnect_timeout_; bool use_last_state_; std::vector<uint32_t> supported_diag_modes_; diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index 931998732e..57984324aa 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -184,6 +184,7 @@ const char* kTTSDelimiterKey = "TTSDelimiter"; const char* kRecordingFileNameKey = "RecordingFileName"; const char* kRecordingFileSourceKey = "RecordingFileSource"; const char* kEnablePolicy = "EnablePolicy"; +const char* kUseFullAppID = "UseFullAppID"; const char* kEventMQKey = "EventMQ"; const char* kAckMQKey = "AckMQ"; const char* kApplicationListUpdateTimeoutKey = "ApplicationListUpdateTimeout"; @@ -444,6 +445,7 @@ Profile::Profile() , max_supported_protocol_version_(kDefaultMaxSupportedProtocolVersion) , policy_snapshot_file_name_(kDefaultPoliciesSnapshotFileName) , enable_policy_(false) + , use_full_app_id_(true) , transport_manager_disconnect_timeout_( kDefaultTransportManagerDisconnectTimeout) , use_last_state_(false) @@ -750,6 +752,10 @@ bool Profile::enable_policy() const { return enable_policy_; } +bool Profile::use_full_app_id() const { + return use_full_app_id_; +} + uint32_t Profile::transport_manager_disconnect_timeout() const { return transport_manager_disconnect_timeout_; } @@ -1854,6 +1860,15 @@ void Profile::UpdateValues() { enable_policy_ = false; } + // Use full app ID internally? + std::string use_full_id_string; + if (ReadValue(&use_full_id_string, kPolicySection, kUseFullAppID) && + 0 == strcmp("true", use_full_id_string.c_str())) { + use_full_app_id_ = true; + } else { + use_full_app_id_ = false; + } + // Max protocol version ReadUIntValue(&max_supported_protocol_version_, kDefaultMaxSupportedProtocolVersion, diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 98bad87bf0..bce2878f69 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -712,6 +712,9 @@ class ApplicationManager { std::vector<std::string>& rejected_params) = 0; virtual const ApplicationManagerSettings& get_settings() const = 0; + // Extract the app ID to use internally based on the UseFullAppID .ini setting + virtual std::string GetCorrectMobileIDFromMessage( + const commands::MessageSharedPtr& message) const = 0; virtual event_engine::EventDispatcher& event_dispatcher() = 0; diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h index 3c9e573c57..8fdca4125f 100644 --- a/src/components/include/application_manager/application_manager_settings.h +++ b/src/components/include/application_manager/application_manager_settings.h @@ -84,6 +84,7 @@ class ApplicationManagerSettings : public RequestControlerSettings, virtual const std::string& video_stream_file() const = 0; virtual const std::string& audio_stream_file() const = 0; + virtual bool use_full_app_id() const = 0; virtual bool use_db_for_resumption() const = 0; virtual const uint32_t& app_resumption_save_persistent_data_timeout() const = 0; diff --git a/src/components/include/policy/policy_external/policy/policy_settings.h b/src/components/include/policy/policy_external/policy/policy_settings.h index def9fca05a..7eca5129ad 100644 --- a/src/components/include/policy/policy_external/policy/policy_settings.h +++ b/src/components/include/policy/policy_external/policy/policy_settings.h @@ -31,6 +31,8 @@ class PolicySettings { */ virtual const std::string& policies_snapshot_file_name() const = 0; + virtual bool use_full_app_id() const = 0; + /** * @brief Returns system files folder path */ diff --git a/src/components/include/policy/policy_regular/policy/policy_settings.h b/src/components/include/policy/policy_regular/policy/policy_settings.h index def9fca05a..35a2d54c3a 100644 --- a/src/components/include/policy/policy_regular/policy/policy_settings.h +++ b/src/components/include/policy/policy_regular/policy/policy_settings.h @@ -36,6 +36,8 @@ class PolicySettings { */ virtual const std::string& system_files_path() const = 0; + virtual bool use_full_app_id() const = 0; + virtual ~PolicySettings() {} }; } // namespace policy diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 4b824d4ac8..c4405b0ffd 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -263,6 +263,10 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_METHOD1(ForbidStreaming, void(uint32_t app_id)); MOCK_CONST_METHOD0(get_settings, const application_manager::ApplicationManagerSettings&()); + MOCK_CONST_METHOD1( + GetCorrectMobileIDFromMessage, + std::string( + const application_manager::commands::MessageSharedPtr& message)); MOCK_METHOD0(event_dispatcher, application_manager::event_engine::EventDispatcher&()); diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h index e0c4a6b9c2..cfabf41b91 100644 --- a/src/components/include/test/application_manager/mock_application_manager_settings.h +++ b/src/components/include/test/application_manager/mock_application_manager_settings.h @@ -89,6 +89,7 @@ class MockApplicationManagerSettings MOCK_CONST_METHOD0(named_audio_pipe_path, const std::string&()); MOCK_CONST_METHOD0(video_stream_file, const std::string&()); MOCK_CONST_METHOD0(audio_stream_file, const std::string&()); + MOCK_CONST_METHOD0(use_full_app_id, bool()); MOCK_CONST_METHOD0(use_db_for_resumption, bool()); MOCK_CONST_METHOD0(app_resumption_save_persistent_data_timeout, const uint32_t&()); diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h b/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h index eafc1df4fe..fe051aaae0 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h +++ b/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h @@ -49,6 +49,7 @@ class MockPolicySettings : public ::policy::PolicySettings { MOCK_CONST_METHOD0(open_attempt_timeout_ms, uint16_t()); MOCK_CONST_METHOD0(policies_snapshot_file_name, const std::string&()); MOCK_CONST_METHOD0(system_files_path, const std::string&()); + MOCK_CONST_METHOD0(use_full_app_id, bool()); }; } // namespace policy_test diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h index 438e697c51..6e0acae33c 100644 --- a/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h @@ -49,6 +49,7 @@ class MockPolicySettings : public ::policy::PolicySettings { MOCK_CONST_METHOD0(open_attempt_timeout_ms, uint16_t()); MOCK_CONST_METHOD0(policies_snapshot_file_name, const std::string&()); MOCK_CONST_METHOD0(system_files_path, const std::string&()); + MOCK_CONST_METHOD0(use_full_app_id, bool()); }; } // namespace policy_test diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml index ca8bd55d63..272f801381 100644 --- a/src/components/interfaces/MOBILE_API.xml +++ b/src/components/interfaces/MOBILE_API.xml @@ -3770,6 +3770,9 @@ <param name="appID" type="String" maxlength="100" mandatory="true" since="2.0"> <description>ID used to validate app with policy table entries</description> </param> + <param name="fullAppID" type="String" maxlength="100" mandatory="false" since="5.0"> + <description>ID used to validate app with policy table entries</description> + </param> <param name="appInfo" type="AppInfo" mandatory="false" since="2.0"> <description> See AppInfo. diff --git a/src/components/policy/policy_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h index b062fa0966..68e29a97ee 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/types.h +++ b/src/components/policy/policy_external/include/policy/policy_table/types.h @@ -303,6 +303,7 @@ struct ModuleConfig : CompositeType { Optional<String<0, 10> > preloaded_date; Optional<String<0, 65535> > certificate; Optional<Boolean> preloaded_pt; + Optional<Boolean> full_app_id_supported; public: ModuleConfig(); diff --git a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml index 89788daf6a..26af165506 100644 --- a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml +++ b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml @@ -139,6 +139,7 @@ <struct name="ModuleConfig"> <param name="device_certificates" type="String" minlength="1" maxlength="100" mandatory="false" map="true" minsize="1" maxsize="255" /> <param name="preloaded_pt" type="Boolean" mandatory="false" /> + <param name="full_app_id_supported" type="Boolean" mandatory="false" /> <param name="exchange_after_x_ignition_cycles" type="Integer" maxvalue="255" /> <param name="exchange_after_x_kilometers" type="Integer" diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 717baa0443..5387a7700a 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -1517,6 +1517,9 @@ void CacheManager::CheckSnapshotInitialization() { *(snapshot_->policy_table.module_config.preloaded_pt) = false; + *(snapshot_->policy_table.module_config.full_app_id_supported) = + settings_->use_full_app_id(); + // SDL must not send certificate in snapshot snapshot_->policy_table.module_config.certificate = rpc::Optional<rpc::String<0, 65535> >(); diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc index 8c4f454dfa..5922a020e6 100644 --- a/src/components/policy/policy_external/src/policy_table/types.cc +++ b/src/components/policy/policy_external/src/policy_table/types.cc @@ -569,7 +569,9 @@ ModuleConfig::ModuleConfig(const Json::Value* value__) , vehicle_year(impl::ValueMember(value__, "vehicle_year")) , preloaded_date(impl::ValueMember(value__, "preloaded_date")) , certificate(impl::ValueMember(value__, "certificate")) - , preloaded_pt(impl::ValueMember(value__, "preloaded_pt")) {} + , preloaded_pt(impl::ValueMember(value__, "preloaded_pt")) + , full_app_id_supported( + impl::ValueMember(value__, "full_app_id_supported")) {} void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) { exchange_after_x_days = from.exchange_after_x_days; @@ -592,6 +594,8 @@ Json::Value ModuleConfig::ToJsonValue() const { Json::Value result__(Json::objectValue); impl::WriteJsonField("certificate", certificate, &result__); impl::WriteJsonField("preloaded_pt", preloaded_pt, &result__); + impl::WriteJsonField( + "full_app_id_supported", full_app_id_supported, &result__); impl::WriteJsonField("exchange_after_x_ignition_cycles", exchange_after_x_ignition_cycles, &result__); @@ -622,6 +626,9 @@ bool ModuleConfig::is_valid() const { if (!preloaded_pt.is_valid()) { return false; } + if (!full_app_id_supported.is_valid()) { + return false; + } if (!exchange_after_x_ignition_cycles.is_valid()) { return false; } @@ -672,6 +679,9 @@ bool ModuleConfig::struct_empty() const { if (preloaded_pt.is_initialized()) { return false; } + if (full_app_id_supported.is_initialized()) { + return false; + } if (exchange_after_x_ignition_cycles.is_initialized()) { return false; @@ -720,6 +730,10 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const { if (!preloaded_pt.is_valid()) { preloaded_pt.ReportErrors(&report__->ReportSubobject("preloaded_pt")); } + if (!full_app_id_supported.is_valid()) { + full_app_id_supported.ReportErrors( + &report__->ReportSubobject("full_app_id_supported")); + } if (!exchange_after_x_ignition_cycles.is_valid()) { exchange_after_x_ignition_cycles.ReportErrors( &report__->ReportSubobject("exchange_after_x_ignition_cycles")); @@ -797,6 +811,7 @@ void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) { CompositeType::SetPolicyTableType(pt_type); certificate.SetPolicyTableType(pt_type); preloaded_pt.SetPolicyTableType(pt_type); + full_app_id_supported.SetPolicyTableType(pt_type); exchange_after_x_ignition_cycles.SetPolicyTableType(pt_type); exchange_after_x_kilometers.SetPolicyTableType(pt_type); exchange_after_x_days.SetPolicyTableType(pt_type); diff --git a/src/components/policy/policy_regular/include/policy/policy_table/types.h b/src/components/policy/policy_regular/include/policy/policy_table/types.h index 4775f6f37e..e201251745 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table/types.h +++ b/src/components/policy/policy_regular/include/policy/policy_table/types.h @@ -230,6 +230,7 @@ struct ModuleConfig : CompositeType { public: Optional<Map<String<0, 100>, 0, 255> > device_certificates; Optional<Boolean> preloaded_pt; + Optional<Boolean> full_app_id_supported; Integer<uint8_t, 0, 255> exchange_after_x_ignition_cycles; Integer<int64_t, 0, 4294967296ll> exchange_after_x_kilometers; Integer<uint8_t, 0, 255> exchange_after_x_days; diff --git a/src/components/policy/policy_regular/policy_table_interface_ext.xml b/src/components/policy/policy_regular/policy_table_interface_ext.xml index 10996e88d1..7a751c0ea9 100644 --- a/src/components/policy/policy_regular/policy_table_interface_ext.xml +++ b/src/components/policy/policy_regular/policy_table_interface_ext.xml @@ -135,6 +135,7 @@ <struct name="ModuleConfig"> <param name="device_certificates" type="String" minlength="1" maxlength="100" mandatory="false" map="true" minsize="1" maxsize="255" /> <param name="preloaded_pt" type="Boolean" mandatory="false" /> + <param name="full_app_id_supported" type="Boolean" mandatory="false" /> <param name="exchange_after_x_ignition_cycles" type="Integer" maxvalue="255" /> <param name="exchange_after_x_kilometers" type="Integer" diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 2ae0f79f75..092fd5b9a4 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -825,6 +825,9 @@ void CacheManager::CheckSnapshotInitialization() { *(snapshot_->policy_table.module_config.preloaded_pt) = false; + *(snapshot_->policy_table.module_config.full_app_id_supported) = + settings_->use_full_app_id(); + // SDL must not send certificate in snapshot snapshot_->policy_table.module_config.certificate = rpc::Optional<rpc::String<0, 65535> >(); diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc index c983e4f12b..851ed1bd18 100644 --- a/src/components/policy/policy_regular/src/policy_table/types.cc +++ b/src/components/policy/policy_regular/src/policy_table/types.cc @@ -455,6 +455,7 @@ ModuleConfig::ModuleConfig(const Json::Value* value__) : CompositeType(InitHelper(value__, &Json::Value::isObject)) , device_certificates(impl::ValueMember(value__, "device_certificates")) , preloaded_pt(impl::ValueMember(value__, "preloaded_pt")) + , full_app_id_supported(impl::ValueMember(value__, "full_app_id_supported")) , exchange_after_x_ignition_cycles( impl::ValueMember(value__, "exchange_after_x_ignition_cycles")) , exchange_after_x_kilometers( @@ -494,6 +495,8 @@ void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) { Json::Value ModuleConfig::ToJsonValue() const { Json::Value result__(Json::objectValue); impl::WriteJsonField("preloaded_pt", preloaded_pt, &result__); + impl::WriteJsonField( + "full_app_id_supported", full_app_id_supported, &result__); impl::WriteJsonField("exchange_after_x_ignition_cycles", exchange_after_x_ignition_cycles, &result__); @@ -521,6 +524,9 @@ bool ModuleConfig::is_valid() const { if (!preloaded_pt.is_valid()) { return false; } + if (!full_app_id_supported.is_valid()) { + return false; + } if (!exchange_after_x_ignition_cycles.is_valid()) { return false; } @@ -568,6 +574,9 @@ bool ModuleConfig::struct_empty() const { if (preloaded_pt.is_initialized()) { return false; } + if (full_app_id_supported.is_initialized()) { + return false; + } if (exchange_after_x_ignition_cycles.is_initialized()) { return false; @@ -617,6 +626,10 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const { if (!preloaded_pt.is_valid()) { preloaded_pt.ReportErrors(&report__->ReportSubobject("preloaded_pt")); } + if (!full_app_id_supported.is_valid()) { + full_app_id_supported.ReportErrors( + &report__->ReportSubobject("full_app_id_supported")); + } if (!exchange_after_x_ignition_cycles.is_valid()) { exchange_after_x_ignition_cycles.ReportErrors( &report__->ReportSubobject("exchange_after_x_ignition_cycles")); @@ -675,6 +688,7 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const { void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) { CompositeType::SetPolicyTableType(pt_type); preloaded_pt.SetPolicyTableType(pt_type); + full_app_id_supported.SetPolicyTableType(pt_type); exchange_after_x_ignition_cycles.SetPolicyTableType(pt_type); exchange_after_x_kilometers.SetPolicyTableType(pt_type); exchange_after_x_days.SetPolicyTableType(pt_type); diff --git a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc index 86df87d534..9b38bc3be8 100644 --- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc +++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc @@ -202,6 +202,7 @@ class PolicyManagerImplTest2 : public ::testing::Test { manager = new PolicyManagerImpl(); ON_CALL(policy_settings_, app_storage_folder()) .WillByDefault(ReturnRef(kAppStorageFolder)); + ON_CALL(policy_settings_, use_full_app_id()).WillByDefault(Return(true)); manager->set_listener(&listener); const char* levels[] = {"BACKGROUND", "FULL", "LIMITED", "NONE"}; hmi_level.assign(levels, levels + sizeof(levels) / sizeof(levels[0])); @@ -238,6 +239,7 @@ class PolicyManagerImplTest2 : public ::testing::Test { file_system::remove_directory_content(kAppStorageFolder); ON_CALL(policy_settings_, app_storage_folder()) .WillByDefault(ReturnRef(kAppStorageFolder)); + ON_CALL(policy_settings_, use_full_app_id()).WillByDefault(Return(true)); ASSERT_TRUE(manager->InitPT(file_name, &policy_settings_)); } @@ -466,6 +468,7 @@ TEST_F(PolicyManagerImplTest, GetNotificationsNumber) { TEST_F(PolicyManagerImplTest2, GetNotificationsNumberAfterPTUpdate) { // Arrange + CreateLocalPT("sdl_preloaded_pt.json"); Json::Value table = CreatePTforLoad(); manager->ForcePTExchange(); manager->SetSendOnUpdateSentOut(false); @@ -504,6 +507,7 @@ TEST_F(PolicyManagerImplTest2, GetNotificationsNumberAfterPTUpdate) { } TEST_F(PolicyManagerImplTest2, IsAppRevoked_SetRevokedAppID_ExpectAppRevoked) { + CreateLocalPT("sdl_preloaded_pt.json"); // Arrange std::ifstream ifile("sdl_preloaded_pt.json"); Json::Reader reader; diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 7dcf4d97f7..b595c977aa 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -290,6 +290,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( static_cast<int64_t>( protocol_header_validator_.max_payload_size_by_service_type( serviceTypeValue))); + UNUSED(mtu_written) LOG4CXX_DEBUG(logger_, "MTU parameter was written to bson params: " << mtu_written << "; Value: " @@ -300,6 +301,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( // Hash ID is only used in RPC case const bool hash_written = bson_object_put_int32( ¶ms, strings::hash_id, static_cast<int32_t>(hash_id)); + UNUSED(hash_written); LOG4CXX_DEBUG(logger_, "Hash parameter was written to bson params: " << hash_written << "; Value: " @@ -317,6 +319,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( const bool protocol_ver_written = bson_object_put_string( ¶ms, strings::protocol_version, protocolVersionString); + UNUSED(protocol_ver_written); LOG4CXX_DEBUG( logger_, "Protocol version parameter was written to bson params: " diff --git a/src/components/smart_objects/include/smart_objects/schema_item.h b/src/components/smart_objects/include/smart_objects/schema_item.h index 2670e4a340..5626b0cf23 100644 --- a/src/components/smart_objects/include/smart_objects/schema_item.h +++ b/src/components/smart_objects/include/smart_objects/schema_item.h @@ -39,6 +39,7 @@ #include "smart_objects/errors.h" #include <memory> +#include <vector> #include "utils/macro.h" #include "utils/semantic_version.h" diff --git a/src/components/smart_objects/include/smart_objects/smart_object.h b/src/components/smart_objects/include/smart_objects/smart_object.h index 112f40b959..022dc6cb13 100644 --- a/src/components/smart_objects/include/smart_objects/smart_object.h +++ b/src/components/smart_objects/include/smart_objects/smart_object.h @@ -35,6 +35,7 @@ #include <set> #include <string> +#include <sstream> #include <vector> #include <map> diff --git a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc index 6b7d44ea8d..e2e5b98190 100644 --- a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc +++ b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc @@ -78,6 +78,7 @@ IAP2USBEmulationTransportAdapter::IAP2USBEmulationTransportAdapter( signal_handler_ = threads::CreateThread("iAP signal handler", delegate); signal_handler_->start(); const auto result = mkfifo(out_signals_channel, mode); + UNUSED(result); LOG4CXX_DEBUG(logger_, "Out signals channel creation result: " << result); } @@ -123,6 +124,7 @@ IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate:: IAPSignalHandlerDelegate(IAP2USBEmulationTransportAdapter& adapter) : adapter_(adapter), run_flag_(true), in_(0) { const auto result = mkfifo(in_signals_channel, mode); + UNUSED(result); LOG4CXX_DEBUG(logger_, "In signals channel creation result: " << result); } diff --git a/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc index 29e55b97dd..7f4562004f 100644 --- a/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc +++ b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc @@ -652,6 +652,7 @@ void PlatformSpecificNetworkInterfaceListener::DumpTable() const { for (auto it = status_table_.begin(); it != status_table_.end(); ++it) { const std::string ifname = it->first; const InterfaceStatus& status = it->second; + UNUSED(status); LOG4CXX_DEBUG( logger_, |