diff options
15 files changed, 86 insertions, 81 deletions
diff --git a/src/components/application_manager/src/app_launch/apps_launcher.cc b/src/components/application_manager/src/app_launch/apps_launcher.cc index 41465ae985..bf3ce1e0a9 100644 --- a/src/components/application_manager/src/app_launch/apps_launcher.cc +++ b/src/components/application_manager/src/app_launch/apps_launcher.cc @@ -95,7 +95,8 @@ AppsLauncher::Launcher::Launcher( connection_handler::ConnectionHandler& connection_handler, const uint16_t app_launch_max_retry_attempt, const uint16_t app_launch_retry_wait_time) - : retry_timer_( + : retry_index_(0) + , retry_timer_( "AppsLauncherTimer", new timer::TimerTaskImpl<Launcher>(this, &Launcher::LaunchNow)) , app_launch_max_retry_attempt_(app_launch_max_retry_attempt) diff --git a/src/components/application_manager/src/commands/mobile/system_request.cc b/src/components/application_manager/src/commands/mobile/system_request.cc index 74d25508e0..0d3334a1a1 100644 --- a/src/components/application_manager/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/src/commands/mobile/system_request.cc @@ -118,8 +118,7 @@ class QueryAppsDataValidator { smart_objects::SmartArray::iterator applications_iterator = objects_array->begin(); - for (; applications_iterator != objects_array->end(); - ++applications_iterator) { + for (; applications_iterator != objects_array->end();) { const smart_objects::SmartObject& app_data = *applications_iterator; if (!app_data.isValid()) { @@ -133,7 +132,8 @@ class QueryAppsDataValidator { LOG4CXX_WARN(logger_, "Application hasn`t some of mandatory parameters. " "Application will be skipped."); - objects_array->erase(applications_iterator); + + applications_iterator = objects_array->erase(applications_iterator); continue; } @@ -186,6 +186,7 @@ class QueryAppsDataValidator { return false; } has_response_valid_application = true; + ++applications_iterator; } return has_response_valid_application; } diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index 89ae6c2c4b..ec8b36477c 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -64,31 +64,32 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") namespace { using namespace mobile_apis; -typedef std::map<RequestType::eType, std::string> RequestTypeMap; +typedef std::map<mobile_apis::RequestType::eType, std::string> RequestTypeMap; RequestTypeMap TypeToString = { - {RequestType::INVALID_ENUM, "INVALID_ENUM"}, - {RequestType::HTTP, "HTTP"}, - {RequestType::FILE_RESUME, "FILE_RESUME"}, - {RequestType::AUTH_REQUEST, "AUTH_REQUEST"}, - {RequestType::AUTH_CHALLENGE, "AUTH_CHALLENGE"}, - {RequestType::AUTH_ACK, "AUTH_ACK"}, - {RequestType::PROPRIETARY, "PROPRIETARY"}, - {RequestType::QUERY_APPS, "QUERY_APPS"}, - {RequestType::LAUNCH_APP, "LAUNCH_APP"}, - {RequestType::LOCK_SCREEN_ICON_URL, "LOCK_SCREEN_ICON_URL"}, - {RequestType::TRAFFIC_MESSAGE_CHANNEL, "TRAFFIC_MESSAGE_CHANNEL"}, - {RequestType::DRIVER_PROFILE, "DRIVER_PROFILE"}, - {RequestType::VOICE_SEARCH, "VOICE_SEARCH"}, - {RequestType::NAVIGATION, "NAVIGATION"}, - {RequestType::PHONE, "PHONE"}, - {RequestType::CLIMATE, "CLIMATE"}, - {RequestType::SETTINGS, "SETTINGS"}, - {RequestType::VEHICLE_DIAGNOSTICS, "VEHICLE_DIAGNOSTICS"}, - {RequestType::EMERGENCY, "EMERGENCY"}, - {RequestType::MEDIA, "MEDIA"}, - {RequestType::FOTA, "FOTA"}}; - -const std::string RequestTypeToString(RequestType::eType type) { + {mobile_apis::RequestType::INVALID_ENUM, "INVALID_ENUM"}, + {mobile_apis::RequestType::HTTP, "HTTP"}, + {mobile_apis::RequestType::FILE_RESUME, "FILE_RESUME"}, + {mobile_apis::RequestType::AUTH_REQUEST, "AUTH_REQUEST"}, + {mobile_apis::RequestType::AUTH_CHALLENGE, "AUTH_CHALLENGE"}, + {mobile_apis::RequestType::AUTH_ACK, "AUTH_ACK"}, + {mobile_apis::RequestType::PROPRIETARY, "PROPRIETARY"}, + {mobile_apis::RequestType::QUERY_APPS, "QUERY_APPS"}, + {mobile_apis::RequestType::LAUNCH_APP, "LAUNCH_APP"}, + {mobile_apis::RequestType::LOCK_SCREEN_ICON_URL, "LOCK_SCREEN_ICON_URL"}, + {mobile_apis::RequestType::TRAFFIC_MESSAGE_CHANNEL, + "TRAFFIC_MESSAGE_CHANNEL"}, + {mobile_apis::RequestType::DRIVER_PROFILE, "DRIVER_PROFILE"}, + {mobile_apis::RequestType::VOICE_SEARCH, "VOICE_SEARCH"}, + {mobile_apis::RequestType::NAVIGATION, "NAVIGATION"}, + {mobile_apis::RequestType::PHONE, "PHONE"}, + {mobile_apis::RequestType::CLIMATE, "CLIMATE"}, + {mobile_apis::RequestType::SETTINGS, "SETTINGS"}, + {mobile_apis::RequestType::VEHICLE_DIAGNOSTICS, "VEHICLE_DIAGNOSTICS"}, + {mobile_apis::RequestType::EMERGENCY, "EMERGENCY"}, + {mobile_apis::RequestType::MEDIA, "MEDIA"}, + {mobile_apis::RequestType::FOTA, "FOTA"}}; + +const std::string RequestTypeToString(mobile_apis::RequestType::eType type) { RequestTypeMap::const_iterator it = TypeToString.find(type); if (TypeToString.end() != it) { return (*it).second; @@ -471,8 +472,12 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id, const bool is_allowed) { POLICY_LIB_CHECK_VOID(); connection_handler::DeviceHandle device_handle; - application_manager_.connection_handler().GetDeviceID(device_id, - &device_handle); + if (!application_manager_.connection_handler().GetDeviceID(device_id, + &device_handle)) { + LOG4CXX_ERROR(logger_, + "Unable to get device handle for device_id: " << device_id); + return; + } // In case of changed consent for device, related applications will be // limited to pre_DataConsent permissions, if device disallowed, or switch // back to their own permissions, if device allowed again, and must be @@ -536,12 +541,6 @@ void PolicyHandler::GetAvailableApps(std::queue<std::string>& apps) { } } -struct SmartObjectToInt { - int operator()(const smart_objects::SmartObject& item) const { - return item.asInt(); - } -}; - StatusNotifier PolicyHandler::AddApplication( const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) { diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc index ad50bbf104..e7788bf9ff 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -644,7 +644,7 @@ bool ResumeCtrlImpl::DisconnectedJustBeforeIgnOff( DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false); const time_t time_stamp = - static_cast<time_t>(saved_app[strings::time_stamp].asUInt()); + static_cast<time_t>(saved_app[strings::time_stamp].asInt()); time_t ign_off_time = static_cast<time_t>(resumption_storage_->GetIgnOffTime()); const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp); @@ -798,9 +798,13 @@ void ResumeCtrlImpl::OnAppRegistrationEnd() { int32_t ResumeCtrlImpl::GetSavedAppHmiLevel( const std::string& app_id, const std::string& device_id) const { + using namespace mobile_apis; smart_objects::SmartObject saved_app; if (resumption_storage_->GetSavedApplication(app_id, device_id, saved_app)) { - const int32_t saved_hmi_level = saved_app[strings::hmi_level].asInt(); + const HMILevel::eType saved_hmi_level = + static_cast<mobile_apis::HMILevel::eType>( + saved_app[strings::hmi_level].asInt()); + return saved_hmi_level; } return static_cast<int32_t>(mobile_apis::HMILevel::INVALID_ENUM); diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h index eff8cfdf7b..ab95659917 100644 --- a/src/components/policy/policy_external/include/policy/policy_types.h +++ b/src/components/policy/policy_external/include/policy/policy_types.h @@ -401,7 +401,8 @@ struct ExternalConsentStatusItem { const EntityStatus status) : entity_type_(type), entity_id_(id), status_(status) {} - ExternalConsentStatusItem() {} + ExternalConsentStatusItem() + : entity_type_(0), entity_id_(0), status_(kStatusOff) {} ExternalConsentStatusItem operator=(const ExternalConsentStatusItem& rhs) { this->entity_id_ = rhs.entity_id_; diff --git a/src/components/policy/policy_external/include/policy/status.h b/src/components/policy/policy_external/include/policy/status.h index 53925c599a..18789ecf99 100644 --- a/src/components/policy/policy_external/include/policy/status.h +++ b/src/components/policy/policy_external/include/policy/status.h @@ -53,7 +53,8 @@ enum UpdateEvent { kOnResetPolicyTableNoUpdate, kScheduleUpdate, kScheduleManualUpdate, - kOnResetRetrySequence + kOnResetRetrySequence, + kNoEvent }; const std::string kUpToDate = "UP_TO_DATE"; diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 7c247f1759..22040c88b2 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -1082,9 +1082,7 @@ bool CacheManager::SetUserPermissionsForApp( permissions.group_permissions.begin(); std::vector<FunctionalGroupPermission>::const_iterator iter_end = permissions.group_permissions.end(); - if (out_app_permissions_changed) { - *out_app_permissions_changed = false; - } + *out_app_permissions_changed = false; std::string group_name; for (; iter != iter_end; ++iter) { diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc index 12a02824f2..cb27e7f0b3 100644 --- a/src/components/policy/policy_external/src/policy_helper.cc +++ b/src/components/policy/policy_external/src/policy_helper.cc @@ -575,7 +575,6 @@ void FillNotificationData::UpdateParameters( } void FillNotificationData::ExcludeSame(RpcPermissions& rpc) { - HMIPermissions& rpc_hmi_permissions = rpc.hmi_permissions; HMIPermissions::const_iterator it_hmi_allowed = rpc.hmi_permissions.find(kAllowedKey); HMIPermissions::const_iterator it_hmi_undefined = @@ -586,29 +585,28 @@ void FillNotificationData::ExcludeSame(RpcPermissions& rpc) { // There is different logic of processing RPCs with and w/o 'parameters' if (RpcParametersEmpty(rpc)) { // First, remove disallowed from other types - if (rpc_hmi_permissions.end() != it_hmi_user_disallowed) { - if (rpc_hmi_permissions.end() != it_hmi_allowed) { - ExcludeSameHMILevels(rpc_hmi_permissions[kAllowedKey], - rpc_hmi_permissions[kUserDisallowedKey]); + if (rpc.hmi_permissions.end() != it_hmi_user_disallowed) { + if (rpc.hmi_permissions.end() != it_hmi_allowed) { + ExcludeSameHMILevels(rpc.hmi_permissions[kAllowedKey], + rpc.hmi_permissions[kUserDisallowedKey]); } - if (rpc_hmi_permissions.end() != it_hmi_undefined) { - ExcludeSameHMILevels(rpc_hmi_permissions[kUndefinedKey], - rpc_hmi_permissions[kUserDisallowedKey]); + if (rpc.hmi_permissions.end() != it_hmi_undefined) { + ExcludeSameHMILevels(rpc.hmi_permissions[kUndefinedKey], + rpc.hmi_permissions[kUserDisallowedKey]); } } // Then, remove undefined from allowed - if (rpc_hmi_permissions.end() != it_hmi_undefined) { - if (rpc_hmi_permissions.end() != it_hmi_allowed) { - ExcludeSameHMILevels(rpc_hmi_permissions[kAllowedKey], - rpc_hmi_permissions[kUndefinedKey]); + if (rpc.hmi_permissions.end() != it_hmi_undefined) { + if (rpc.hmi_permissions.end() != it_hmi_allowed) { + ExcludeSameHMILevels(rpc.hmi_permissions[kAllowedKey], + rpc.hmi_permissions[kUndefinedKey]); } } return; } - ParameterPermissions& rpc_parameter_permissions = rpc.parameter_permissions; ParameterPermissions::const_iterator it_parameter_allowed = rpc.parameter_permissions.find(kAllowedKey); ParameterPermissions::const_iterator it_parameter_undefined = @@ -619,34 +617,34 @@ void FillNotificationData::ExcludeSame(RpcPermissions& rpc) { // First, removing allowed HMI levels from other types, permissions will be // dependent on parameters instead of HMI levels since w/o parameters RPC // won't passed to HMI - if (rpc_hmi_permissions.end() != it_hmi_allowed) { - if (rpc_hmi_permissions.end() != it_hmi_user_disallowed) { - ExcludeSameHMILevels(rpc_hmi_permissions[kUserDisallowedKey], - rpc_hmi_permissions[kAllowedKey]); + if (rpc.hmi_permissions.end() != it_hmi_allowed) { + if (rpc.hmi_permissions.end() != it_hmi_user_disallowed) { + ExcludeSameHMILevels(rpc.hmi_permissions[kUserDisallowedKey], + rpc.hmi_permissions[kAllowedKey]); } if (rpc.hmi_permissions.end() != it_hmi_undefined) { - ExcludeSameHMILevels(rpc_hmi_permissions[kUndefinedKey], - rpc_hmi_permissions[kAllowedKey]); + ExcludeSameHMILevels(rpc.hmi_permissions[kUndefinedKey], + rpc.hmi_permissions[kAllowedKey]); } } // Removing disallowed parameters from allowed and undefined (by user consent) - if (rpc_parameter_permissions.end() != it_parameter_user_disallowed) { - if (rpc_parameter_permissions.end() != it_parameter_allowed) { - ExcludeSameParameters(rpc_parameter_permissions[kAllowedKey], - rpc_parameter_permissions[kUserDisallowedKey]); + if (rpc.parameter_permissions.end() != it_parameter_user_disallowed) { + if (rpc.parameter_permissions.end() != it_parameter_allowed) { + ExcludeSameParameters(rpc.parameter_permissions[kAllowedKey], + rpc.parameter_permissions[kUserDisallowedKey]); } - if (rpc_parameter_permissions.end() != it_parameter_undefined) { - ExcludeSameParameters(rpc_parameter_permissions[kUndefinedKey], - rpc_parameter_permissions[kUserDisallowedKey]); + if (rpc.parameter_permissions.end() != it_parameter_undefined) { + ExcludeSameParameters(rpc.parameter_permissions[kUndefinedKey], + rpc.parameter_permissions[kUserDisallowedKey]); } } // Removing undefined (by user consent) parameters from allowed - if (rpc_parameter_permissions.end() != it_parameter_undefined) { - if (rpc_parameter_permissions.end() != it_parameter_allowed) { - ExcludeSameParameters(rpc_parameter_permissions[kAllowedKey], - rpc_parameter_permissions[kUndefinedKey]); + if (rpc.parameter_permissions.end() != it_parameter_undefined) { + if (rpc.parameter_permissions.end() != it_parameter_allowed) { + ExcludeSameParameters(rpc.parameter_permissions[kAllowedKey], + rpc.parameter_permissions[kUndefinedKey]); } } } 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 d7dd986abc..528d70a426 100644 --- a/src/components/policy/policy_external/src/policy_table/types.cc +++ b/src/components/policy/policy_external/src/policy_table/types.cc @@ -1660,7 +1660,7 @@ void ConsentRecords::ReportErrors(rpc::ValidationReport* report__) const { if (!consent_groups.is_valid()) { consent_groups.ReportErrors(&report__->ReportSubobject("consent_groups")); } - if (!consent_groups.is_valid()) { + if (!external_consent_status_groups.is_valid()) { external_consent_status_groups.ReportErrors( &report__->ReportSubobject("external_consent_status_groups")); } diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index 48985fa835..1732f3c774 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -224,8 +224,7 @@ int SQLPTRepresentation::DaysBeforeExchange(uint16_t current) { return limit; } - if (limit < 0 || last < 0 || current < 0 || current < last || - limit < (current - last)) { + if (limit < 0 || last < 0 || current < last || limit < (current - last)) { return 0; } diff --git a/src/components/policy/policy_external/src/update_status_manager.cc b/src/components/policy/policy_external/src/update_status_manager.cc index 8b7635c25c..087db1149b 100644 --- a/src/components/policy/policy_external/src/update_status_manager.cc +++ b/src/components/policy/policy_external/src/update_status_manager.cc @@ -42,6 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) , current_status_(utils::MakeShared<UpToDateStatus>()) + , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) , app_registered_from_non_consented_device_(true) { update_status_thread_delegate_ = new UpdateThreadDelegate(this); @@ -62,6 +63,7 @@ UpdateStatusManager::~UpdateStatusManager() { void UpdateStatusManager::ProcessEvent(UpdateEvent event) { sync_primitives::AutoLock lock(status_lock_); current_status_->ProcessEvent(this, event); + last_processed_event_ = event; DoTransition(); } diff --git a/src/components/policy/policy_regular/include/policy/status.h b/src/components/policy/policy_regular/include/policy/status.h index 074e3c1eef..c1ea2de4c1 100644 --- a/src/components/policy/policy_regular/include/policy/status.h +++ b/src/components/policy/policy_regular/include/policy/status.h @@ -53,7 +53,8 @@ enum UpdateEvent { kOnResetPolicyTableNoUpdate, kScheduleUpdate, kScheduleManualUpdate, - kOnResetRetrySequence + kOnResetRetrySequence, + kNoEvent }; const std::string kUpToDate = "UP_TO_DATE"; 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 b1a8c82f89..f05ac9cb67 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -321,9 +321,9 @@ void PolicyManagerImpl::StartPTExchange() { // Start retry sequency const uint32_t timeout_msec = NextRetryTimeout(); - if(timeout_msec) { + if (timeout_msec) { LOG4CXX_DEBUG(logger_, - "Start retry sequence timeout = " << timeout_msec); + "Start retry sequence timeout = " << timeout_msec); timer_retry_sequence_.Start(timeout_msec, timer::kPeriodic); } } @@ -1117,7 +1117,7 @@ void PolicyManagerImpl::RetrySequence() { const uint32_t timeout_msec = NextRetryTimeout(); LOG4CXX_DEBUG(logger_, "New retry sequence timeout = " << timeout_msec); if (!timeout_msec) { - if(timer_retry_sequence_.is_running()) { + if (timer_retry_sequence_.is_running()) { timer_retry_sequence_.Stop(); } return; 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 89e44e90b6..941113c753 100644 --- a/src/components/policy/policy_regular/src/update_status_manager.cc +++ b/src/components/policy/policy_regular/src/update_status_manager.cc @@ -42,6 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) , current_status_(utils::MakeShared<UpToDateStatus>()) + , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) , app_registered_from_non_consented_device_(true) {} diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h index ba8cbceb23..80338804ee 100644 --- a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h +++ b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h @@ -95,7 +95,6 @@ class TelemetryMonitor { private: std::string server_address_; int16_t port_; - bool is_ready_; threads::Thread* thread_; Streamer* streamer_; ApplicationManagerObserver app_observer; |