summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Kalinich <AKalinich@luxoft.com>2019-10-15 22:24:28 -0400
committerAndrii Kalinich <AKalinich@luxoft.com>2019-10-15 22:24:28 -0400
commit178a3b43c78afdf5b227779bbe2c416ac349240e (patch)
tree48b3f1f1965e48ee29886e512bba7692b726f5da
parent2b09ea3adf962e25717b6b4cd751173f0aa40d02 (diff)
downloadsdl_core-fix/fix_revoked_vd_items_unsubscribe.tar.gz
Fix revoked VD items subscription after PTUfix/fix_revoked_vd_items_unsubscribe
There was found an issue that SDL is still keeping subscriptions for a custom vehicle data items even for case when they was revoked by PTU. By that reason, SDL was crashing with DCHECK on attempt to unsubscribe from not existing custom data. Was added missing logic of internal unsubscribe in case if some custom vehicle data was revoked by policies.
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h1
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc24
2 files changed, 25 insertions, 0 deletions
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
index 3f6c078522..8d51b40a0d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
@@ -72,6 +72,7 @@ class VehicleInfoPlugin : public plugins::RPCPlugin {
VehicleInfoAppExtension& ext);
private:
+ void UnsubscribeFromRevokedVDItems();
smart_objects::SmartObjectSPtr GetUnsubscribeIVIRequest(
const std::vector<std::string>& ivi_names);
void DeleteSubscriptions(app_mngr::ApplicationSharedPtr app);
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
index d6d1c69461..53b39ab6e1 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
@@ -82,6 +82,7 @@ app_mngr::CommandFactory& VehicleInfoPlugin::GetCommandFactory() {
void VehicleInfoPlugin::OnPolicyEvent(plugins::PolicyEvent event) {
custom_vehicle_data_manager_->OnPolicyEvent(event);
+ UnsubscribeFromRevokedVDItems();
}
void VehicleInfoPlugin::OnApplicationEvent(
@@ -96,6 +97,29 @@ void VehicleInfoPlugin::OnApplicationEvent(
}
}
+void VehicleInfoPlugin::UnsubscribeFromRevokedVDItems() {
+ auto applications = application_manager_->applications();
+ auto& std_vehicle_data = application_manager::MessageHelper::vehicle_data();
+
+ for (auto& app : applications.GetData()) {
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
+ auto subscription_names = ext.Subscriptions();
+ for (auto& subscription_name : subscription_names) {
+ const bool is_std_vd_name =
+ std_vehicle_data.end() != std_vehicle_data.find(subscription_name);
+ const bool is_valid_custom_vd_name =
+ custom_vehicle_data_manager_->IsValidCustomVehicleDataName(
+ subscription_name);
+ if (!is_std_vd_name && !is_valid_custom_vd_name) {
+ LOG4CXX_DEBUG(logger_,
+ "Vehicle data item " << subscription_name
+ << " has been revoked by policy");
+ ext.unsubscribeFromVehicleInfo(subscription_name);
+ }
+ }
+ }
+}
+
void VehicleInfoPlugin::ProcessResumptionSubscription(
application_manager::Application& app, VehicleInfoAppExtension& ext) {
LOG4CXX_AUTO_TRACE(logger_);