diff options
15 files changed, 110 insertions, 85 deletions
diff --git a/customer-specific/pasa/src/appMain/smartDeviceLink.ini b/customer-specific/pasa/src/appMain/smartDeviceLink.ini index 2df6647a47..52f94dfeae 100755 --- a/customer-specific/pasa/src/appMain/smartDeviceLink.ini +++ b/customer-specific/pasa/src/appMain/smartDeviceLink.ini @@ -108,7 +108,7 @@ HelpCommand = Help AppInfoStorage = app_info.dat [Policy] -PolicySwitchOff = false +EnablePolicy = true PreloadedPT = sdl_preloaded_pt.json PathToSnapshot = sdl_snapshot.json diff --git a/src/appMain/main.cc b/src/appMain/main.cc index 37bd1da47b..87dba3ae74 100644 --- a/src/appMain/main.cc +++ b/src/appMain/main.cc @@ -161,7 +161,7 @@ int32_t main(int32_t argc, char** argv) { } #ifdef __QNX__ - if (!profile::Profile::instance()->policy_turn_off()) { + if (profile::Profile::instance()->enable_policy()) { if (!utils::System("./init_policy.sh").Execute(true)) { LOG4CXX_ERROR(logger, "Failed initialization of policy database"); DEINIT_LOGGER(); diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index ab343338f1..eef9c174f0 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -123,7 +123,7 @@ ForceProtectedService = Non ForceUnprotectedService = Non [Policy] -PolicySwitchOff = false +EnablePolicy = false PreloadedPT = sdl_preloaded_pt.json PathToSnapshot = sdl_snapshot.json diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index 2c851f775d..0c3141c9b3 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -60,6 +60,7 @@ class PolicyHandler : PolicyManager* policy_manager() const { return policy_manager_; } + bool PolicyEnabled(); bool InitPolicyTable(); bool ResetPolicyTable(); bool ClearUserConsent(); @@ -293,7 +294,7 @@ protected: * @param status Internal policy update status * @return Converted status for sending to HMI */ - const std::string ConvertUpdateStatus(policy::PolicyTableStatus status); + const std::string ConvertUpdateStatus(policy::PolicyTableStatus status); private: PolicyHandler(); diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 8d6c0869bb..6269ca5fa9 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -1127,11 +1127,14 @@ void ApplicationManagerImpl::SendMessageToMobile( mobile_apis::FunctionID::eType function_id = static_cast<mobile_apis::FunctionID::eType>( (*message)[strings::params][strings::function_id].asUInt()); - mobile_apis::Result::eType check_result = CheckPolicyPermissions( - app->mobile_app_id()->asString(), - app->hmi_level(), - function_id); + const mobile_apis::Result::eType check_result = + CheckPolicyPermissions( app->mobile_app_id()->asString(), + app->hmi_level(), function_id); if (mobile_apis::Result::SUCCESS != check_result) { + const std::string string_functionID = + MessageHelper::StringifiedFunctionID(function_id); + LOG4CXX_WARN(logger_, "Function \"" << string_functionID << "\" (#" + << function_id << ") not allowed by policy"); return; } @@ -1141,7 +1144,7 @@ void ApplicationManagerImpl::SendMessageToMobile( } messages_to_mobile_.PostMessage(impl::MessageToMobile(message_to_send, - final_message)); + final_message)); } bool ApplicationManagerImpl::ManageMobileCommand( @@ -1353,14 +1356,14 @@ bool ApplicationManagerImpl::Init() { LOG4CXX_TRACE(logger_, "Init application manager"); bool init_result = true; do { - if (policy_manager_) { + if (policy::PolicyHandler::instance()->PolicyEnabled() && policy_manager_) { LOG4CXX_INFO(logger_, "Policy library is loaded, now initing PT"); if (!policy::PolicyHandler::instance()->InitPolicyTable()) { init_result = false; break; } } - const std::string app_storage_folder = + const std::string app_storage_folder = profile::Profile::instance()->app_storage_folder(); if (!file_system::DirectoryExists(app_storage_folder)) { LOG4CXX_WARN(logger_, "Storage directory doesn't exist"); @@ -1380,7 +1383,7 @@ bool ApplicationManagerImpl::Init() { break; } - const std::string system_files_path = + const std::string system_files_path = profile::Profile::instance()->system_files_path(); if (!file_system::DirectoryExists(system_files_path)) { LOG4CXX_WARN(logger_, "System files directory doesn't exist"); @@ -2043,15 +2046,14 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( mobile_apis::FunctionID::eType function_id, CommandParametersPermissions* params_permissions) { LOG4CXX_INFO(logger_, "CheckPolicyPermissions"); - // TODO(AOleynik): Remove check of policy_turn_off, when this flag will be + // TODO(AOleynik): Remove check of policy_enable, when this flag will be // unused in config file - if (profile::Profile::instance()->policy_turn_off()) { + if (!policy::PolicyHandler::instance()->PolicyEnabled()) { return mobile_apis::Result::SUCCESS; } - mobile_apis::Result::eType check_result = mobile_apis::Result::DISALLOWED; - if (!policy_manager_) { + if (!policy_manager_ ) { LOG4CXX_WARN(logger_, "Policy library is not loaded."); - return check_result; + return mobile_apis::Result::DISALLOWED; } const std::string stringified_functionID = MessageHelper::StringifiedFunctionID(function_id); @@ -2106,11 +2108,11 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( switch (result.hmi_level_permitted) { case policy::kRpcDisallowed: - return check_result = mobile_apis::Result::DISALLOWED; + return mobile_apis::Result::DISALLOWED; case policy::kRpcUserDisallowed: - return check_result = mobile_apis::Result::USER_DISALLOWED; + return mobile_apis::Result::USER_DISALLOWED; default: - return check_result = mobile_apis::Result::INVALID_ENUM; + return mobile_apis::Result::INVALID_ENUM; } } LOG4CXX_INFO(logger_, "Request is allowed by policies. "+log_msg); diff --git a/src/components/application_manager/src/commands/hmi/get_urls.cc b/src/components/application_manager/src/commands/hmi/get_urls.cc index 8bddd9e6ac..8337bb4568 100644 --- a/src/components/application_manager/src/commands/hmi/get_urls.cc +++ b/src/components/application_manager/src/commands/hmi/get_urls.cc @@ -47,13 +47,13 @@ GetUrls::~GetUrls() { void GetUrls::Run() { LOG4CXX_INFO(logger_, "GetUrls::Run"); - policy::PolicyManager* manager = + policy::PolicyManager* policy_manager = policy::PolicyHandler::instance()->policy_manager(); smart_objects::SmartObject& object = *message_; object[strings::params][strings::message_type] = MessageType::kResponse; - if (manager) { + if (policy_manager) { policy::EndpointUrls endpoints = - manager->GetUpdateUrls( + policy_manager->GetUpdateUrls( object[strings::msg_params][hmi_request::service].asInt()); object[strings::msg_params].erase(hmi_request::service); object[strings::msg_params][hmi_response::urls] = diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index d4c0e7afdb..50dde63c76 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -175,22 +175,14 @@ void RegisterAppInterfaceRequest::Run() { SendResponse(false, policy_result); return; } - policy::PolicyManager* policy_manager = - policy::PolicyHandler::instance()->policy_manager(); - if (!policy_manager) { - LOG4CXX_WARN(logger_, "The shared library of policy is not loaded"); - SendResponse(false, mobile_apis::Result::DISALLOWED); - return; - } - mobile_apis::Result::eType coincidence_result = - CheckCoincidence(); + mobile_apis::Result::eType coincidence_result = CheckCoincidence(); if (mobile_apis::Result::SUCCESS != coincidence_result) { LOG4CXX_ERROR_EXT(logger_, "Coincidence check failed."); if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) { usage_statistics::AppCounter count_of_rejections_duplicate_name( - policy_manager, mobile_app_id, + policy::PolicyHandler::instance()->policy_manager(), mobile_app_id, usage_statistics::REJECTIONS_DUPLICATE_NAME); ++count_of_rejections_duplicate_name; } @@ -577,21 +569,26 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { // TODO(AOleynik): Check is necessary to allow register application in case // of disabled policy // Remove this check, when HMI will support policy - if (profile::Profile::instance()->policy_turn_off()) { + if (policy::PolicyHandler::instance()->PolicyEnabled()) { return mobile_apis::Result::WARNINGS; } smart_objects::SmartObject& message = *message_; policy::StringArray app_nicknames; - policy::StringArray app_hmi_types; + policy::StringArray app_hmi_types; + + if(!policy::PolicyHandler::instance()->PolicyEnabled()) { + return mobile_apis::Result::WARNINGS; + } // TODO(KKolodiy): need remove method policy_manager policy::PolicyManager* policy_manager = - policy::PolicyHandler::instance()->policy_manager(); + policy::PolicyHandler::instance()->policy_manager(); if (!policy_manager) { LOG4CXX_WARN(logger_, "The shared library of policy is not loaded"); return mobile_apis::Result::DISALLOWED; } + std::string mobile_app_id = message[strings::msg_params][strings::app_id].asString(); const bool init_result = policy_manager->GetInitialAppData(mobile_app_id, &app_nicknames, &app_hmi_types); diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index b211361a32..5b6dd4fa19 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -251,11 +251,15 @@ std::string MessageHelper::CommonLanguageToString( } uint32_t MessageHelper::GetAppCommandLimit(const std::string& policy_app_id) { + policy::PolicyManager* policy_manager = + policy::PolicyHandler::instance()->policy_manager(); + if(!policy_manager) { + LOG4CXX_WARN(logger_, "The shared library of policy is not loaded"); + return 0; + } std::string priority; - policy::PolicyHandler::instance()->policy_manager()->GetPriority( - policy_app_id, &priority); - return policy::PolicyHandler::instance()->policy_manager()-> - GetNotificationsNumber(priority); + policy_manager->GetPriority(policy_app_id, &priority); + return policy_manager-> GetNotificationsNumber(priority); } void MessageHelper::SendHMIStatusNotification( @@ -570,18 +574,27 @@ smart_objects::SmartObject* MessageHelper::CreateDeviceListSO( (*device_list_so)[strings::device_list] = smart_objects::SmartObject( smart_objects::SmartType_Array); smart_objects::SmartObject& list_so = (*device_list_so)[strings::device_list]; + policy::PolicyManager* policy_manager = + policy::PolicyHandler::instance()->policy_manager(); + if(!policy_manager) { + LOG4CXX_WARN(logger_, "The shared library of policy is not loaded"); + } int32_t index = 0; for (connection_handler::DeviceMap::const_iterator it = devices.begin(); devices.end() != it; ++it) { const connection_handler::Device& d = static_cast<connection_handler::Device>(it->second); - list_so[index][strings::name] = d.user_friendly_name(); + list_so[index][strings::name] = d.user_friendly_name(); list_so[index][strings::id] = it->second.device_handle(); - policy::DeviceConsent device_consent = - policy::PolicyHandler::instance()->policy_manager()-> - GetUserConsentForDevice(it->second.mac_address()); - list_so[index][strings::isSDLAllowed] = - policy::DeviceConsent::kDeviceAllowed == device_consent ? true : false; + + if(policy_manager) { + const policy::DeviceConsent device_consent = + policy_manager->GetUserConsentForDevice(it->second.mac_address()); + list_so[index][strings::isSDLAllowed] = + policy::DeviceConsent::kDeviceAllowed == device_consent; + } else { + list_so[index][strings::isSDLAllowed] = true; + } ++index; } return device_list_so; diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc index a6930c4059..f49ef2ecea 100644 --- a/src/components/application_manager/src/policies/policy_event_observer.cc +++ b/src/components/application_manager/src/policies/policy_event_observer.cc @@ -73,7 +73,7 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) { } default: { break; - } + } #endif } } @@ -88,9 +88,11 @@ void PolicyEventObserver::ProcessOdometerEvent(const smart_objects::SmartObject& const int kSecondsInDay = 60 * 60 * 24; int days_after_epoch = current_time.tv_sec / kSecondsInDay; - policy_manager_->PTUpdatedAt( - message[strings::msg_params][strings::odometer].asInt(), - days_after_epoch); + if(policy_manager_) { + policy_manager_->PTUpdatedAt( + message[strings::msg_params][strings::odometer].asInt(), + days_after_epoch); + } } } } diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index 20a36cf13c..55b9efb694 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -182,7 +182,7 @@ PolicyHandler::~PolicyHandler() { } PolicyManager* PolicyHandler::LoadPolicyLibrary() { - if (profile::Profile::instance()->policy_turn_off()) { + if (PolicyEnabled()) { LOG4CXX_WARN(logger_, "System is configured to work without policy " "functionality."); policy_manager_ = NULL; @@ -202,6 +202,10 @@ PolicyManager* PolicyHandler::LoadPolicyLibrary() { return policy_manager_; } +bool PolicyHandler::PolicyEnabled() { + return profile::Profile::instance()->enable_policy(); +} + PolicyManager* PolicyHandler::CreateManager() { typedef PolicyManager* (*CreateManager)(); CreateManager create_manager = reinterpret_cast<CreateManager>(dlsym(dl_handle_, "CreateManager")); @@ -232,7 +236,7 @@ bool PolicyHandler::InitPolicyTable() { bool PolicyHandler::ResetPolicyTable() { LOG4CXX_TRACE(logger_, "Reset policy table."); - POLICY_LIB_CHECK(false); + POLICY_LIB_CHECK(false); std::string preloaded_file = profile::Profile::instance()->preloaded_pt_file(); return policy_manager_->ResetPT(preloaded_file); @@ -389,7 +393,7 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id, } bool PolicyHandler::EnsureDeviceConsented() { - LOG4CXX_INFO(logger_, "PolicyHandler::EnsureDeviceConsented"); + LOG4CXX_INFO(logger_, "PolicyHandler::EnsureDeviceConsented"); DeviceParams device_params; DeviceConsent consent = GetDeviceForSending(device_params); @@ -405,7 +409,8 @@ bool PolicyHandler::EnsureDeviceConsented() { void PolicyHandler::AddApplication(const std::string& application_id) { // TODO (AGaliuzov): remove this workaround during refactoring. registration_in_progress = true; - policy_manager()->AddApplication(application_id); + POLICY_LIB_CHECK_VOID(); + policy_manager_->AddApplication(application_id); } void PolicyHandler::SetDeviceInfo(std::string& device_id, @@ -623,9 +628,10 @@ void PolicyHandler::OnVIIsReady() { void PolicyHandler::OnVehicleDataUpdated( const smart_objects::SmartObject& message) { #if defined (EXTENDED_POLICY) + POLICY_LIB_CHECK_VOID(); if (message[application_manager::strings::msg_params]. keyExists(application_manager::strings::vin)) { - policy_manager()->SetVINValue( + policy_manager_->SetVINValue( message[application_manager::strings::msg_params] [application_manager::strings::vin].asString()); } @@ -633,8 +639,7 @@ void PolicyHandler::OnVehicleDataUpdated( } void PolicyHandler::OnAppRevoked(const std::string& policy_app_id) { - LOG4CXX_INFO(logger_, "OnAppRevoked"); - LOG4CXX_INFO(logger_, "Application_id " << policy_app_id << " is revoked."); + LOG4CXX_TRACE(logger_, "OnAppRevoked with policy_app_id " << policy_app_id << " is revoked."); POLICY_LIB_CHECK_VOID(); application_manager::ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance() @@ -849,7 +854,7 @@ void PolicyHandler::StartPTExchange(bool skip_device_selection) { void PolicyHandler::OnAllowSDLFunctionalityNotification(bool is_allowed, uint32_t device_id) { LOG4CXX_INFO(logger_, "OnAllowSDLFunctionalityNotification"); - POLICY_LIB_CHECK_VOID(); + POLICY_LIB_CHECK_VOID(); // Device ids, need to be changed std::set<uint32_t> device_ids; @@ -977,7 +982,7 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, if (!policy_manager_) { LOG4CXX_WARN(logger_, "The shared library of policy is not loaded"); - if (profile::Profile::instance()->policy_turn_off()) { + if (PolicyEnabled()) { permissions.isSDLAllowed = true; } } else { @@ -1247,6 +1252,7 @@ bool PolicyHandler::IsApplicationRevoked(const std::string& app_id) { void PolicyHandler::OnUpdateRequestSentToMobile() { LOG4CXX_INFO(logger_, "OnUpdateRequestSentToMobile"); + POLICY_LIB_CHECK_VOID(); policy_manager_->OnUpdateStarted(); } diff --git a/src/components/application_manager/src/policies/policy_retry_sequence.cc b/src/components/application_manager/src/policies/policy_retry_sequence.cc index 48e6599f64..7ac19332b1 100644 --- a/src/components/application_manager/src/policies/policy_retry_sequence.cc +++ b/src/components/application_manager/src/policies/policy_retry_sequence.cc @@ -51,23 +51,25 @@ void RetrySequence::threadMain() { void RetrySequence::StartNextRetry() { LOG4CXX_TRACE(logger_, "Start next retry of exchanging PT"); DCHECK(policy_handler_); - if (!policy_handler_->policy_manager()) { + // TODO(Ezamakhov): inverstigate StartNextRetry on unload policy lib + PolicyManager* policy_manager = policy_handler_->policy_manager(); + if (!policy_manager) { LOG4CXX_WARN(logger_, "The shared library of policy is not loaded"); return; } - BinaryMessageSptr pt_snapshot = policy_handler_->policy_manager() + BinaryMessageSptr pt_snapshot = policy_manager ->RequestPTUpdate(); if (pt_snapshot) { policy_handler_->SendMessageToSDK(*pt_snapshot); - int timeout = policy_handler_->policy_manager()->TimeoutExchange(); - int seconds = policy_handler_->policy_manager()->NextRetryTimeout(); + const int timeout = policy_manager->TimeoutExchange(); + const int seconds = policy_manager->NextRetryTimeout(); LOG4CXX_DEBUG(logger_, "Timeout response: " << timeout << " Next try: " << seconds); if (timeout > 0) { sleep(timeout); - policy_handler_->policy_manager()->OnExceededTimeout(); + policy_manager->OnExceededTimeout(); } if (seconds > 0) { sleep(seconds); diff --git a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc index df5d90983f..8d92c78aac 100644 --- a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc +++ b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc @@ -54,8 +54,9 @@ PTExchangeHandlerImpl::~PTExchangeHandlerImpl() { void PTExchangeHandlerImpl::Start() { sync_primitives::AutoLock locker(retry_sequence_lock_); retry_sequence_.stop(); - if (policy_handler_->policy_manager()) { - policy_handler_->policy_manager()->ResetRetrySequence(); + PolicyManager* policy_manager = policy_handler_->policy_manager(); + if (policy_manager) { + policy_manager->ResetRetrySequence(); } retry_sequence_.start(); } diff --git a/src/components/application_manager/src/resume_ctrl.cpp b/src/components/application_manager/src/resume_ctrl.cpp index f470f43963..c7fc4a4cd1 100644 --- a/src/components/application_manager/src/resume_ctrl.cpp +++ b/src/components/application_manager/src/resume_ctrl.cpp @@ -30,10 +30,10 @@ void ResumeCtrl::SaveAllApplications() { LOG4CXX_INFO(logger_, "ResumeCtrl::SaveApplications()"); DCHECK(app_mngr_); - std::set<ApplicationSharedPtr>::iterator it = - app_mngr_->application_list_.begin(); + std::set<ApplicationSharedPtr>::iterator it = + app_mngr_->application_list_.begin(); std::set<ApplicationSharedPtr>::iterator it_end = - app_mngr_->application_list_.end(); + app_mngr_->application_list_.end(); for (; it != it_end; ++it) { SaveApplication(*it); } @@ -134,7 +134,7 @@ bool ResumeCtrl::SetupDefaultHMILevel(ApplicationSharedPtr application) { mobile_apis::HMILevel::eType default_hmi = mobile_apis::HMILevel::HMI_NONE; - if (false == profile::Profile::instance()->policy_turn_off()) { + if (!policy::PolicyHandler::instance()->PolicyEnabled()) { policy::PolicyManager* policy_manager = policy::PolicyHandler::instance()->policy_manager(); if (policy_manager) { @@ -185,8 +185,9 @@ bool ResumeCtrl::SetupHMILevel(ApplicationSharedPtr application, const std::string device_id = MessageHelper::GetDeviceMacAddressForHandle(application->device()); - if ((true == check_policy) && (policy::DeviceConsent::kDeviceAllowed != - policy_manager->GetUserConsentForDevice(device_id))) { + if (check_policy && policy_manager && + policy_manager->GetUserConsentForDevice(device_id) + != policy::DeviceConsent::kDeviceAllowed) { LOG4CXX_ERROR(logger_, "Resumption abort. Data consent wasn't allowed"); SetupDefaultHMILevel(application); return false; @@ -195,7 +196,7 @@ bool ResumeCtrl::SetupHMILevel(ApplicationSharedPtr application, if ((hmi_level == application->hmi_level()) && (hmi_level != mobile_apis::HMILevel::HMI_NONE)) { - LOG4CXX_INFO(logger_, "Hmi level " << hmi_level << " should not be set to " + LOG4CXX_WARN(logger_, "Hmi level " << hmi_level << " should not be set to " << application->mobile_app_id()->asString() << " " << application->hmi_level()); return false; diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index fe6badfb90..f926f2d0c7 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -328,7 +328,7 @@ class Profile : public utils::Singleton<Profile> { * @brief Should Policy be turned off? (Library not loaded) * @return Flag */ - bool policy_turn_off() const; + bool enable_policy() const; /* * @brief Timeout in transport manager before disconnect @@ -617,7 +617,7 @@ class Profile : public utils::Singleton<Profile> { uint32_t heart_beat_timeout_; std::string preloaded_pt_file_; std::string policy_snapshot_file_name_; - bool policy_turn_off_; + bool enable_policy_; 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 8d6895f881..0adeaddf47 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -134,7 +134,7 @@ const char* kTransportManagerDisconnectTimeoutKey = "DisconnectTimeout"; const char* kTTSDelimiterKey = "TTSDelimiter"; const char* kRecordingFileNameKey = "RecordingFileName"; const char* kRecordingFileSourceKey = "RecordingFileSource"; -const char* kPolicyOffKey = "PolicySwitchOff"; +const char* kEnablePolicy = "EnablePolicy"; const char* kMmeDatabaseNameKey = "MMEDatabase"; const char* kEventMQKey = "EventMQ"; const char* kAckMQKey = "AckMQ"; @@ -245,7 +245,7 @@ Profile::Profile() app_info_storage_(kDefaultAppInfoFileName), heart_beat_timeout_(kDefaultHeartBeatTimeout), policy_snapshot_file_name_(kDefaultPoliciesSnapshotFileName), - policy_turn_off_(false), + enable_policy_(false), transport_manager_disconnect_timeout_( kDefaultTransportManagerDisconnectTimeout), use_last_state_(false), @@ -488,8 +488,8 @@ const std::string& Profile::policies_snapshot_file_name() const { return policy_snapshot_file_name_; } -bool Profile::policy_turn_off() const { - return policy_turn_off_; +bool Profile::enable_policy() const { + return enable_policy_; } uint32_t Profile::transport_manager_disconnect_timeout() const { @@ -1132,15 +1132,15 @@ LOG_UPDATED_VALUE(event_mq_name_, kEventMQKey, kTransportManagerSection); kPolicySection); // Turn Policy Off? - std::string policy_off; - if (ReadValue(&policy_off, kPolicySection, kPolicyOffKey) && - 0 == strcmp("true", policy_off.c_str())) { - policy_turn_off_ = true; + std::string enable_policy_string; + if (ReadValue(&enable_policy_string, kPolicySection, kEnablePolicy) && + 0 == strcmp("true", enable_policy_string.c_str())) { + enable_policy_ = true; } else { - policy_turn_off_ = false; + enable_policy_ = false; } - LOG_UPDATED_BOOL_VALUE(policy_turn_off_, kPolicyOffKey, kPolicySection); + LOG_UPDATED_BOOL_VALUE(enable_policy_, kEnablePolicy, kPolicySection); ReadUIntValue(&application_list_update_timeout_, kDefaultApplicationListUpdateTimeout, |