summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc24
1 files changed, 24 insertions, 0 deletions
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_);