diff options
Diffstat (limited to 'src/components/policy/policy_regular/src')
11 files changed, 147 insertions, 78 deletions
diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc index f99b226f2e..f743a4d56e 100644 --- a/src/components/policy/policy_regular/src/access_remote_impl.cc +++ b/src/components/policy/policy_regular/src/access_remote_impl.cc @@ -89,7 +89,7 @@ struct ToModuleType { AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {} -AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache) +AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) : cache_(cache) {} bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 1d51b81af4..9accabf59b 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -103,8 +103,7 @@ CacheManager::CacheManager() : CacheManagerInterface() , pt_(new policy_table::Table) , backup_(new SQLPTRepresentation()) - , update_required(false) - , cache_lock_(true) { + , update_required(false) { LOG4CXX_AUTO_TRACE(logger_); backuper_ = new BackgroundBackuper(this); backup_thread_ = threads::CreateThread("Backup thread", backuper_); @@ -646,7 +645,7 @@ int CacheManager::TimeoutResponse() { CACHE_MANAGER_CHECK(0); sync_primitives::AutoLock auto_lock(cache_lock_); return pt_->policy_table.module_config.timeout_after_x_seconds * - date_time::DateTime::MILLISECONDS_IN_SECOND; + date_time::MILLISECONDS_IN_SECOND; } bool CacheManager::SecondsBetweenRetries(std::vector<int>& seconds) { @@ -826,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> >(); @@ -934,8 +936,8 @@ void CacheManager::CheckSnapshotInitialization() { void CacheManager::PersistData() { LOG4CXX_AUTO_TRACE(logger_); - if (backup_.valid()) { - if (pt_.valid()) { + if (backup_.use_count() != 0) { + if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor // call policy_table::Table copy_pt( @@ -1029,10 +1031,10 @@ bool CacheManager::IsPermissionsCalculated(const std::string& device_id, return false; } -utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() { +std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { CACHE_MANAGER_CHECK(snapshot_); - snapshot_ = new policy_table::Table(); + snapshot_ = std::make_shared<policy_table::Table>(); // Copy all members of policy table except messages in consumer friendly // messages @@ -1426,7 +1428,7 @@ bool CacheManager::Init(const std::string& file_name, result = LoadFromFile(file_name, *pt_); - utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); LOG4CXX_DEBUG(logger_, "Check if snapshot is valid: " << std::boolalpha << result); diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc index 796dd25ec4..bae9fceb49 100644 --- a/src/components/policy/policy_regular/src/policy_helper.cc +++ b/src/components/policy/policy_regular/src/policy_helper.cc @@ -121,8 +121,8 @@ bool operator!=(const policy_table::ApplicationParams& first, CheckAppPolicy::CheckAppPolicy( PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot) + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot) : pm_(pm), update_(update), snapshot_(snapshot) {} bool policy::CheckAppPolicy::HasRevokedGroups( diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index d01631a2a2..f4b6f0ae03 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -44,12 +44,12 @@ #include "utils/file_system.h" #include "utils/logger.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "policy/cache_manager.h" #include "policy/update_status_manager.h" #include "config_profile/profile.h" #include "utils/timer_task_impl.h" -#include "utils/make_shared.h" + #include "policy/access_remote.h" #include "policy/access_remote_impl.h" @@ -62,7 +62,7 @@ void DeleteManager(policy::PolicyManager* pm) { namespace { const uint32_t kDefaultRetryTimeoutInMSec = - 60u * date_time::DateTime::MILLISECONDS_IN_SECOND; + 60u * date_time::MILLISECONDS_IN_SECOND; } // namespace namespace policy { @@ -73,8 +73,8 @@ PolicyManagerImpl::PolicyManagerImpl() : PolicyManager() , listener_(NULL) , cache_(new CacheManager) - , access_remote_(new AccessRemoteImpl( - CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) + , access_remote_( + new AccessRemoteImpl(std::static_pointer_cast<CacheManager>(cache_))) , retry_sequence_timeout_(kDefaultRetryTimeoutInMSec) , retry_sequence_index_(0) , timer_retry_sequence_("Retry sequence timer", @@ -93,21 +93,21 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) { #ifdef USE_HMI_PTU_DECRYPTION -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; Json::Reader reader; if (reader.parse(json.c_str(), value)) { - return new policy_table::Table(&value); + return std::make_shared<policy_table::Table>(&value); } else { - return utils::SharedPtr<policy_table::Table>(); + return std::make_shared<policy_table::Table>(); } } #else -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; @@ -116,12 +116,12 @@ utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray( // For PT Update received from SDL Server. if (value["data"].size() != 0) { Json::Value data = value["data"]; - return new policy_table::Table(&data[0]); + return std::make_shared<policy_table::Table>(&data[0]); } else { - return new policy_table::Table(&value); + return std::make_shared<policy_table::Table>(&value); } } else { - return utils::SharedPtr<policy_table::Table>(); + return std::shared_ptr<policy_table::Table>(); } } @@ -154,11 +154,11 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, // Assuemes Policy Table was parsed, formatted, and/or decrypted by // the HMI after system request before calling OnReceivedPolicyUpdate // Parse message into table struct - utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content); + std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content); #else // Message Received from server unecnrypted with PTU in first element // of 'data' array. No Parsing was done by HMI. - utils::SharedPtr<policy_table::Table> pt_update = ParseArray(pt_content); + std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content); #endif if (!pt_update) { LOG4CXX_WARN(logger_, "Parsed table pointer is 0."); @@ -187,7 +187,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, sync_primitives::AutoLock lock(apps_registration_lock_); // Get current DB data, since it could be updated during awaiting of PTU - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR( @@ -238,8 +238,8 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, } void PolicyManagerImpl::CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> pt_update, - const utils::SharedPtr<policy_table::Table> snapshot) { + const std::shared_ptr<policy_table::Table> pt_update, + const std::shared_ptr<policy_table::Table> snapshot) { LOG4CXX_INFO(logger_, "Checking incoming permissions."); // Replace predefined policies with its actual setting, e.g. "123":"default" @@ -274,7 +274,7 @@ void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, bool PolicyManagerImpl::RequestPTUpdate() { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); @@ -806,7 +806,7 @@ bool PolicyManagerImpl::ExceededIgnitionCycles() { } bool PolicyManagerImpl::IsPTValid( - utils::SharedPtr<policy_table::Table> policy_table, + std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { @@ -827,9 +827,9 @@ const PolicySettings& PolicyManagerImpl::get_settings() const { bool PolicyManagerImpl::ExceededDays() { LOG4CXX_AUTO_TRACE(logger_); - TimevalStruct current_time = date_time::DateTime::getCurrentTime(); + date_time::TimeDuration current_time = date_time::getCurrentTime(); const int kSecondsInDay = 60 * 60 * 24; - const int days = current_time.tv_sec / kSecondsInDay; + const int days = date_time::getSecs(current_time) / kSecondsInDay; return 0 == cache_->DaysBeforeExchange(days); } @@ -879,8 +879,7 @@ uint32_t PolicyManagerImpl::NextRetryTimeout() { } for (uint32_t i = 0u; i < retry_sequence_index_; ++i) { - next += retry_sequence_seconds_[i] * - date_time::DateTime::MILLISECONDS_IN_SECOND; + next += retry_sequence_seconds_[i] * date_time::MILLISECONDS_IN_SECOND; next += retry_sequence_timeout_; } ++retry_sequence_index_; @@ -1066,11 +1065,11 @@ StatusNotifier PolicyManagerImpl::AddApplication( sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { AddNewApplication(application_id, device_consent); - return utils::MakeShared<CallStatusChange>(update_status_manager_, - device_consent); + return std::make_shared<CallStatusChange>(update_status_manager_, + device_consent); } else { PromoteExistedApplication(application_id, device_consent); - return utils::MakeShared<utils::CallNothing>(); + return std::make_shared<utils::CallNothing>(); } } @@ -1165,7 +1164,7 @@ void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) { void PolicyManagerImpl::set_cache_manager( CacheManagerInterface* cache_manager) { - cache_ = cache_manager; + cache_ = std::shared_ptr<CacheManagerInterface>(cache_manager); } void PolicyManagerImpl::RetrySequence() { @@ -1287,7 +1286,7 @@ bool PolicyManagerImpl::GetModuleTypes( } void PolicyManagerImpl::set_access_remote( - utils::SharedPtr<AccessRemote> access_remote) { + std::shared_ptr<AccessRemote> access_remote) { access_remote_ = access_remote; } diff --git a/src/components/policy/policy_regular/src/policy_table.cc b/src/components/policy/policy_regular/src/policy_table.cc index c5c6e3e132..b0fa5739da 100644 --- a/src/components/policy/policy_regular/src/policy_table.cc +++ b/src/components/policy/policy_regular/src/policy_table.cc @@ -42,7 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTRepresentation()) {} -PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data) +PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc index e05ed8f064..138d866174 100644 --- a/src/components/policy/policy_regular/src/policy_table/enums.cc +++ b/src/components/policy/policy_regular/src/policy_table/enums.cc @@ -143,6 +143,8 @@ bool IsValidEnum(Parameter val) { return true; case P_BELTSTATUS: return true; + case P_ELECTRONICPARKBRAKESTATUS: + return true; case P_DRIVERBRAKING: return true; case P_PRNDL: @@ -207,6 +209,8 @@ const char* EnumToJsonString(Parameter val) { return "accPedalPosition"; case P_BELTSTATUS: return "beltStatus"; + case P_ELECTRONICPARKBRAKESTATUS: + return "electronicParkBrakeStatus"; case P_DRIVERBRAKING: return "driverBraking"; case P_PRNDL: @@ -287,6 +291,9 @@ bool EnumFromJsonString(const std::string& literal, Parameter* result) { } else if ("beltStatus" == literal) { *result = P_BELTSTATUS; return true; + } else if ("electronicParkBrakeStatus" == literal) { + *result = P_ELECTRONICPARKBRAKESTATUS; + return true; } else if ("driverBraking" == literal) { *result = P_DRIVERBRAKING; return true; @@ -634,6 +641,16 @@ bool IsValidEnum(ModuleType val) { return true; case MT_RADIO: return true; + case MT_SEAT: + return true; + case MT_AUDIO: + return true; + case MT_LIGHT: + return true; + case MT_HMI_SETTINGS: + return true; + case MT_EMPTY: + return true; default: return false; } @@ -644,6 +661,16 @@ const char* EnumToJsonString(ModuleType val) { return "CLIMATE"; case MT_RADIO: return "RADIO"; + case MT_SEAT: + return "SEAT"; + case MT_AUDIO: + return "AUDIO"; + case MT_LIGHT: + return "LIGHT"; + case MT_HMI_SETTINGS: + return "HMI_SETTINGS"; + case MT_EMPTY: + return "EMPTY"; default: return ""; } @@ -656,9 +683,23 @@ bool EnumFromJsonString(const std::string& literal, ModuleType* result) { } else if ("RADIO" == literal) { *result = MT_RADIO; return true; - } else { - return false; + } else if ("SEAT" == literal) { + *result = MT_SEAT; + return true; + } else if ("AUDIO" == literal) { + *result = MT_AUDIO; + return true; + } else if ("LIGHT" == literal) { + *result = MT_LIGHT; + return true; + } else if ("HMI_SETTINGS" == literal) { + *result = MT_HMI_SETTINGS; + return true; + } else if ("EMPTY" == literal) { + *result = MT_EMPTY; + return true; } + return false; } const std::string kDefaultApp = "default"; 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/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc index b1e574578e..d32ee7133d 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -187,10 +187,10 @@ int SQLPTRepresentation::TimeoutResponse() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) { LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence"); - const int defaultTimeout = 30 * date_time::DateTime::MILLISECONDS_IN_SECOND; + const int defaultTimeout = 30 * date_time::MILLISECONDS_IN_SECOND; return defaultTimeout; } - return query.GetInteger(0) * date_time::DateTime::MILLISECONDS_IN_SECOND; + return query.GetInteger(0) * date_time::MILLISECONDS_IN_SECOND; } bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) { @@ -483,10 +483,10 @@ bool SQLPTRepresentation::RefreshDB() { return true; } -utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() +std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> table = new policy_table::Table(); + auto table = std::make_shared<policy_table::Table>(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); GatherUsageAndErrorCounts(&*table->policy_table.usage_and_error_counts); @@ -1696,6 +1696,10 @@ bool SQLPTRepresentation::GatherModuleType( if (!policy_table::EnumFromJsonString(query.GetString(0), &type)) { return false; } + if (policy_table::ModuleType::MT_EMPTY == type) { + app_types->mark_initialized(); + continue; + } app_types->push_back(type); } return true; @@ -1728,18 +1732,30 @@ bool SQLPTRepresentation::SaveModuleType( } policy_table::ModuleTypes::const_iterator it; - for (it = types.begin(); it != types.end(); ++it) { + if (!types.empty()) { + for (it = types.begin(); it != types.end(); ++it) { + query.Bind(0, app_id); + std::string module(policy_table::EnumToJsonString(*it)); + query.Bind(1, module); + LOG4CXX_DEBUG(logger_, + "Module(app: " << app_id << ", type: " << module << ")"); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into module type."); + return false; + } + } + } else if (types.is_initialized()) { query.Bind(0, app_id); - std::string module(policy_table::EnumToJsonString(*it)); - query.Bind(1, module); - LOG4CXX_DEBUG(logger_, - "Module(app: " << app_id << ", type: " << module << ")"); + query.Bind(1, + std::string(policy_table::EnumToJsonString( + policy_table::ModuleType::MT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into module type."); + LOG4CXX_WARN(logger_, "Incorrect insert into module types."); return false; } + } else { + LOG4CXX_WARN(logger_, "Module Type omitted."); } - return true; } diff --git a/src/components/policy/policy_regular/src/status.cc b/src/components/policy/policy_regular/src/status.cc index 8d65c606d0..00a6a95af3 100644 --- a/src/components/policy/policy_regular/src/status.cc +++ b/src/components/policy/policy_regular/src/status.cc @@ -32,7 +32,6 @@ #include "policy/status.h" #include "policy/update_status_manager_interface.h" -#include "utils/make_shared.h" policy::UpToDateStatus::UpToDateStatus() : Status("UP_TO_DATE", policy::PolicyTableStatus::StatusUpToDate) {} @@ -44,7 +43,7 @@ void policy::UpToDateStatus::ProcessEvent(UpdateStatusManagerInterface* manager, case kOnResetPolicyTableRequireUpdate: case kScheduleUpdate: case kOnResetRetrySequence: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -59,17 +58,17 @@ void policy::UpdateNeededStatus::ProcessEvent( policy::UpdateStatusManagerInterface* manager, policy::UpdateEvent event) { switch (event) { case kOnUpdateSentOut: - manager->SetNextStatus(utils::MakeShared<UpdatingStatus>()); + manager->SetNextStatus(std::make_shared<UpdatingStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -88,22 +87,22 @@ void policy::UpdatingStatus::ProcessEvent( switch (event) { case kOnValidUpdateReceived: case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnWrongUpdateReceived: case kOnUpdateTimeout: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kScheduleUpdate: case kOnResetRetrySequence: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc index 941113c753..66d21dea54 100644 --- a/src/components/policy/policy_regular/src/update_status_manager.cc +++ b/src/components/policy/policy_regular/src/update_status_manager.cc @@ -33,7 +33,6 @@ #include "policy/update_status_manager.h" #include "policy/policy_listener.h" #include "utils/logger.h" -#include "utils/make_shared.h" namespace policy { @@ -41,7 +40,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) - , current_status_(utils::MakeShared<UpToDateStatus>()) + , current_status_(std::make_shared<UpToDateStatus>()) , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) , app_registered_from_non_consented_device_(true) {} @@ -55,11 +54,11 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) { DoTransition(); } -void UpdateStatusManager::SetNextStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetNextStatus(std::shared_ptr<Status> status) { next_status_ = status; } -void UpdateStatusManager::SetPostponedStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetPostponedStatus(std::shared_ptr<Status> status) { postponed_status_ = status; } diff --git a/src/components/policy/policy_regular/src/usage_statistics/counter.cc b/src/components/policy/policy_regular/src/usage_statistics/counter.cc index 60e34a929d..ed16fa3e8d 100644 --- a/src/components/policy/policy_regular/src/usage_statistics/counter.cc +++ b/src/components/policy/policy_regular/src/usage_statistics/counter.cc @@ -36,13 +36,13 @@ #include <cassert> #include "policy/usage_statistics/counter.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" namespace usage_statistics { GlobalCounter::GlobalCounter( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type) : counter_type_(counter_type), statistics_manager_(statistics_manager) {} @@ -52,7 +52,7 @@ void GlobalCounter::operator++() const { } } -AppCounter::AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, +AppCounter::AppCounter(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type) : app_id_(app_id) @@ -65,7 +65,7 @@ void AppCounter::operator++() const { } } -AppInfo::AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, +AppInfo::AppInfo(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type) : app_id_(app_id) @@ -79,7 +79,7 @@ void AppInfo::Update(const std::string& new_info) const { } AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id) : app_id_(app_id) , stopwatch_type_(SECONDS_HMI_NONE) @@ -90,7 +90,7 @@ AppStopwatchImpl::AppStopwatchImpl( , time_out_(60) {} AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, uint32_t timeout) : app_id_(app_id) @@ -103,8 +103,7 @@ AppStopwatchImpl::AppStopwatchImpl( void AppStopwatchImpl::Start(AppStopwatchId stopwatch_type) { stopwatch_type_ = stopwatch_type; - timer_.Start(time_out_ * date_time::DateTime::MILLISECONDS_IN_SECOND, - timer::kPeriodic); + timer_.Start(time_out_ * date_time::MILLISECONDS_IN_SECOND, timer::kPeriodic); } void AppStopwatchImpl::Switch(AppStopwatchId stopwatch_type) { |