summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksym Ked <mked@luxoft.com>2019-06-06 14:36:31 +0300
committermked-luxoft <mked@luxoft.com>2019-08-27 16:28:10 +0300
commitbc97c209e7fce4d440617aed70245fd8c0bcec21 (patch)
tree28b9177b433b6ba5132596359690801d0a85d735
parentb2f9fd48c275e2cccf473ddd2e4639e8f2923708 (diff)
downloadsdl_core-bc97c209e7fce4d440617aed70245fd8c0bcec21.tar.gz
Added permission check of encryption required for EXT
-rw-r--r--src/components/policy/policy_external/include/policy/policy_helper.h9
-rw-r--r--src/components/policy/policy_external/include/policy/policy_types.h3
-rw-r--r--src/components/policy/policy_external/src/policy_helper.cc108
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc137
4 files changed, 160 insertions, 97 deletions
diff --git a/src/components/policy/policy_external/include/policy/policy_helper.h b/src/components/policy/policy_external/include/policy/policy_helper.h
index 2f05af7e63..6e981c880a 100644
--- a/src/components/policy/policy_external/include/policy/policy_helper.h
+++ b/src/components/policy/policy_external/include/policy/policy_helper.h
@@ -202,6 +202,15 @@ struct CheckAppPolicy {
bool IsRequestSubTypeChanged(const AppPoliciesValueType& app_policy) const;
/**
+ * @brief IsEncryptionRequiredFlagChanged check if encryption_needed flag was
+ * changed for application or application groups
+ * @param app_policy applicaiton policies
+ * @return true if encryption_needed state was changed otherwise - false
+ */
+ bool IsEncryptionRequiredFlagChanged(
+ const AppPoliciesValueType& app_policy) const;
+
+ /**
* @brief Helper function that inserts permissions into app_permissions_diff_
* map.
* udpated
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 4f486ffcd0..09b318a03f 100644
--- a/src/components/policy/policy_external/include/policy/policy_types.h
+++ b/src/components/policy/policy_external/include/policy/policy_types.h
@@ -511,7 +511,8 @@ enum PermissionsCheckResult {
RESULT_CONSENT_NOT_REQIURED,
RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED,
RESULT_REQUEST_TYPE_CHANGED,
- RESULT_REQUEST_SUBTYPE_CHANGED
+ RESULT_REQUEST_SUBTYPE_CHANGED,
+ RESULT_ENCRYPTION_REQUIRED_FLAG_CHANGED,
};
/**
diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc
index f81ce75d4c..2eb7e4c6f0 100644
--- a/src/components/policy/policy_external/src/policy_helper.cc
+++ b/src/components/policy/policy_external/src/policy_helper.cc
@@ -452,6 +452,8 @@ PermissionsCheckResult CheckAppPolicy::CheckPermissionsChanges(
bool has_new_groups = HasNewGroups(app_policy);
+ const bool encryption_required_flag_changed =
+ IsEncryptionRequiredFlagChanged(app_policy);
if (has_revoked_groups && has_consent_needed_groups) {
return RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED;
} else if (has_revoked_groups) {
@@ -460,6 +462,8 @@ PermissionsCheckResult CheckAppPolicy::CheckPermissionsChanges(
return RESULT_CONSENT_NEEDED;
} else if (has_new_groups) {
return RESULT_CONSENT_NOT_REQIURED;
+ } else if (encryption_required_flag_changed) {
+ return RESULT_ENCRYPTION_REQUIRED_FLAG_CHANGED;
}
return RESULT_NO_CHANGES;
@@ -540,11 +544,101 @@ bool CheckAppPolicy::IsRequestSubTypeChanged(
return diff.size();
}
+bool CheckAppPolicy::IsEncryptionRequiredFlagChanged(
+ const AppPoliciesValueType& app_policy) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto get_app_encryption_needed =
+ [](const std::string& policy_app_id,
+ policy_table::ApplicationPolicies& policies)
+ -> rpc::Optional<rpc::Boolean> {
+ auto it = policies.find(policy_app_id);
+ if (policies.end() == it) {
+ LOG4CXX_WARN(logger_,
+ "App is not present in policies" << policy_app_id);
+ return rpc::Optional<rpc::Boolean>(false);
+ }
+ return it->second.encryption_required;
+ };
+
+ auto get_app_groups =
+ [](const std::string& policy_app_id,
+ policy_table::ApplicationPolicies& policies) -> policy_table::Strings {
+ policy_table::Strings result;
+ auto it = policies.find(policy_app_id);
+ if (policies.end() == it) {
+ LOG4CXX_WARN(logger_,
+ "App is not present in policies" << policy_app_id);
+ return result;
+ }
+ auto& groups = it->second.groups;
+ std::copy(groups.begin(), groups.end(), std::back_inserter(result));
+ return result;
+ };
+
+ auto get_app_rpcs =
+ [](const std::string group_name, const FunctionalGroupings& groups)
+ -> rpc::Optional<policy_table::Rpcs> {
+ auto it = groups.find(group_name);
+ if (it == groups.end()) {
+ return rpc::Optional<policy_table::Rpcs>();
+ }
+ return rpc::Optional<policy_table::Rpcs>(it->second);
+ };
+
+ const auto snapshot_groups = get_app_groups(
+ app_policy.first, snapshot_->policy_table.app_policies_section.apps);
+ const auto update_groups = get_app_groups(
+ app_policy.first, update_->policy_table.app_policies_section.apps);
+
+ auto get_resulting_encryption_required_flag_for_app_groups =
+ [this, &get_app_rpcs](
+ const rpc::policy_table_interface_base::Strings& app_groups,
+ const std::shared_ptr<rpc::policy_table_interface_base::Table> pt) {
+
+ for (const auto& group : app_groups) {
+ const auto rpcs =
+ get_app_rpcs(group, pt->policy_table.functional_groupings);
+ if (*rpcs->encryption_required) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ auto group_res_en_flag_changed =
+ [this, &get_resulting_encryption_required_flag_for_app_groups](
+ const rpc::policy_table_interface_base::Strings& snapshot_groups,
+ const rpc::policy_table_interface_base::Strings& update_groups) {
+ return get_resulting_encryption_required_flag_for_app_groups(
+ snapshot_groups, snapshot_) !=
+ get_resulting_encryption_required_flag_for_app_groups(
+ update_groups, update_);
+ };
+
+ const auto snapshot_app_encryption_needed = get_app_encryption_needed(
+ app_policy.first, snapshot_->policy_table.app_policies_section.apps);
+ const auto update_app_encryption_needed = get_app_encryption_needed(
+ app_policy.first, update_->policy_table.app_policies_section.apps);
+
+ const bool app_encryption_needed_changed =
+ (snapshot_app_encryption_needed.is_initialized() !=
+ update_app_encryption_needed.is_initialized()) ||
+ (*snapshot_app_encryption_needed != *update_app_encryption_needed);
+
+ if ((!update_app_encryption_needed.is_initialized() ||
+ *update_app_encryption_needed) &&
+ group_res_en_flag_changed(snapshot_groups, update_groups)) {
+ return true;
+ }
+
+ return app_encryption_needed_changed;
+}
+
void FillActionsForAppPolicies::operator()(
const policy::CheckAppPolicyResults::value_type& value) {
const std::string app_id = value.first;
- const policy_table::ApplicationPolicies::const_iterator app_policy =
- app_policies_.find(app_id);
+ const auto app_policy = app_policies_.find(app_id);
if (app_policies_.end() == app_policy) {
return;
@@ -567,6 +661,7 @@ void FillActionsForAppPolicies::operator()(
case RESULT_PERMISSIONS_REVOKED:
case RESULT_REQUEST_TYPE_CHANGED:
case RESULT_REQUEST_SUBTYPE_CHANGED:
+ case RESULT_ENCRYPTION_REQUIRED_FLAG_CHANGED:
break;
case RESULT_NO_CHANGES:
default:
@@ -641,9 +736,11 @@ void FillNotificationData::UpdateParameters(
// particular parameters (if applicable), the system shall find all of the
// functional groups the RPC is included in. If user consent is needed as
// listed within the functional group in the policy table, the system shall
- // use a logical AND: backend permissions AND User permissions. If the RPC is
+ // use a logical AND: backend permissions AND User permissions. If the RPC
+ // is
// listed under more than one group, the system shall perform a logical OR
- // amongst all of the possible allowed permissions scenarios for the RPC (and
+ // among all of the possible allowed permissions scenarios for the RPC
+ // (and
// parameter/or HMI level) defined by each of the functional groups.
// Due to requirements SDL must consider cases when 'parameters' section is
@@ -734,7 +831,8 @@ void FillNotificationData::ExcludeSame(RpcPermissions& rpc) {
}
}
- // Removing disallowed parameters from allowed and undefined (by user consent)
+ // 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],
diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc
index 5ebe2adb2c..9c181f5e75 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -528,7 +528,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges(
const std::shared_ptr<policy_table::Table> pt_update,
const std::shared_ptr<policy_table::Table> snapshot) {
- LOG4CXX_INFO(logger_, "Checking incoming permissions.");
+ LOG4CXX_AUTO_TRACE(logger_);
// Replace predefined policies with its actual setting, e.g. "123":"default"
// to actual values of default section
@@ -719,11 +719,10 @@ void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) {
}
const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes(
- const transport_manager::DeviceHandle& device_handle,
const std::string policy_app_id) const {
std::vector<std::string> request_types;
- if (kDeviceAllowed != cache_->GetDeviceConsent(
- GetCurrentDeviceId(device_handle, policy_app_id))) {
+ if (kDeviceDisallowed ==
+ cache_->GetDeviceConsent(GetCurrentDeviceId(policy_app_id))) {
cache_->GetAppRequestTypes(kPreDataConsentId, request_types);
} else {
cache_->GetAppRequestTypes(policy_app_id, request_types);
@@ -823,8 +822,7 @@ bool PolicyManagerImpl::UnknownRPCPassthroughAllowed(
return cache_->UnknownRPCPassthroughAllowed(policy_app_id);
}
-void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
- const PTString& app_id,
+void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
const RPCParams& rpc_params,
@@ -833,6 +831,8 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
"CheckPermissions for " << app_id << " and rpc " << rpc
<< " for " << hmi_level << " level.");
+ const std::string device_id = GetCurrentDeviceId(app_id);
+
Permissions rpc_permissions;
// Check, if there are calculated permission present in cache
@@ -1002,8 +1002,9 @@ policy_table::Strings PolicyManagerImpl::GetGroupsNames(
}
void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
- const std::string& device_id, const std::string& application_id) {
+ const std::string& application_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ const std::string device_id = GetCurrentDeviceId(application_id);
if (device_id.empty()) {
LOG4CXX_WARN(logger_,
"Couldn't find device info for application id "
@@ -1031,16 +1032,15 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
const ApplicationOnDevice who = {device_id, application_id};
if (access_remote_->IsAppRemoteControl(who)) {
- listener()->OnPermissionsUpdated(
- device_id, application_id, notification_data);
+ listener()->OnPermissionsUpdated(application_id, notification_data);
return;
}
std::string default_hmi;
- GetDefaultHmi(device_id, application_id, &default_hmi);
+ GetDefaultHmi(application_id, &default_hmi);
listener()->OnPermissionsUpdated(
- device_id, application_id, notification_data, default_hmi);
+ application_id, notification_data, default_hmi);
}
bool PolicyManagerImpl::CleanupUnpairedDevices() {
@@ -1073,16 +1073,14 @@ void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id,
}
bool PolicyManagerImpl::ReactOnUserDevConsentForApp(
- const transport_manager::DeviceHandle& device_handle,
- const std::string& app_id,
- const bool is_device_allowed) {
- auto current_request_types = GetAppRequestTypes(device_handle, app_id);
+ const std::string& app_id, const bool is_device_allowed) {
+ std::vector<std::string> current_request_types = GetAppRequestTypes(app_id);
std::string current_priority, new_priority;
GetPriority(app_id, &current_priority);
bool result = cache_->ReactOnUserDevConsentForApp(app_id, is_device_allowed);
- auto new_request_types = GetAppRequestTypes(device_handle, app_id);
+ std::vector<std::string> new_request_types = GetAppRequestTypes(app_id);
GetPriority(app_id, &new_priority);
std::sort(current_request_types.begin(), current_request_types.end());
std::sort(new_request_types.begin(), new_request_types.end());
@@ -1107,8 +1105,7 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp(
}
if (permissions.requestTypeChanged || (!permissions.priority.empty())) {
- const auto& device_id = GetCurrentDeviceId(device_handle, app_id);
- listener_->SendOnAppPermissionsChanged(permissions, device_id, app_id);
+ listener_->SendOnAppPermissionsChanged(permissions, app_id);
}
return result;
}
@@ -1226,7 +1223,6 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges(
}
void PolicyManagerImpl::NotifyPermissionsChanges(
- const std::string& device_id,
const std::string& policy_app_id,
const std::vector<FunctionalGroupPermission>& app_group_permissions) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1242,7 +1238,7 @@ void PolicyManagerImpl::NotifyPermissionsChanges(
PrepareNotificationData(
functional_groups, app_groups, app_group_permissions, notification_data);
- listener()->OnPermissionsUpdated(device_id, policy_app_id, notification_data);
+ listener()->OnPermissionsUpdated(policy_app_id, notification_data);
}
void PolicyManagerImpl::SetUserConsentForApp(
@@ -1281,15 +1277,14 @@ void PolicyManagerImpl::SetUserConsentForApp(
CheckPendingPermissionsChanges(verified_permissions.policy_app_id,
updated_app_group_permissons);
- NotifyPermissionsChanges(verified_permissions.device_id,
- verified_permissions.policy_app_id,
+ NotifyPermissionsChanges(verified_permissions.policy_app_id,
updated_app_group_permissons);
}
-bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id,
- const std::string& policy_app_id,
+bool PolicyManagerImpl::GetDefaultHmi(const std::string& policy_app_id,
std::string* default_hmi) const {
LOG4CXX_AUTO_TRACE(logger_);
+ const std::string device_id = GetCurrentDeviceId(policy_app_id);
DeviceConsent device_consent = GetUserConsentForDevice(device_id);
const std::string app_id = policy::kDeviceAllowed != device_consent
? kPreDataConsentId
@@ -1394,13 +1389,11 @@ void PolicyManagerImpl::GetPermissionsForApp(
}
bool allowed_by_default = false;
- const auto device_consent = GetUserConsentForDevice(device_id);
- if ((policy::kDeviceAllowed == device_consent) &&
- cache_->IsDefaultPolicy(policy_app_id)) {
+ if (cache_->IsDefaultPolicy(policy_app_id)) {
app_id_to_check = kDefaultId;
allowed_by_default = true;
} else if (cache_->IsPredataPolicy(policy_app_id) ||
- policy::kDeviceAllowed != device_consent) {
+ policy::kDeviceDisallowed == GetUserConsentForDevice(device_id)) {
app_id_to_check = kPreDataConsentId;
allowed_by_default = true;
}
@@ -1484,11 +1477,9 @@ void PolicyManagerImpl::GetPermissionsForApp(
}
std::string& PolicyManagerImpl::GetCurrentDeviceId(
- const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const {
LOG4CXX_INFO(logger_, "GetDeviceInfo");
- last_device_id_ =
- listener()->OnCurrentDeviceIdUpdateRequired(device_handle, policy_app_id);
+ last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(policy_app_id);
return last_device_id_;
}
@@ -1592,16 +1583,15 @@ void PolicyManagerImpl::UpdateAppConsentWithExternalConsent(
}
void PolicyManagerImpl::NotifySystem(
- const std::string& device_id,
const PolicyManagerImpl::AppPoliciesValueType& app_policy) const {
- listener()->OnPendingPermissionChange(device_id, app_policy.first);
+ listener()->OnPendingPermissionChange(app_policy.first);
}
void PolicyManagerImpl::SendPermissionsToApp(
- const std::string& device_id,
const PolicyManagerImpl::AppPoliciesValueType& app_policy) {
const std::string app_id = app_policy.first;
+ const std::string device_id = GetCurrentDeviceId(app_id);
if (device_id.empty()) {
LOG4CXX_WARN(logger_,
"Couldn't find device info for application id: " << app_id);
@@ -1624,7 +1614,6 @@ void PolicyManagerImpl::SendPermissionsToApp(
LOG4CXX_INFO(logger_, "Send notification for application_id: " << app_id);
listener()->OnPermissionsUpdated(
- device_id,
app_id,
notification_data,
policy_table::EnumToJsonString(app_policy.second.default_hmi));
@@ -1766,19 +1755,6 @@ void PolicyManagerImpl::KmsChanged(int kilometers) {
}
}
-const boost::optional<bool> PolicyManagerImpl::LockScreenDismissalEnabledState()
- const {
- LOG4CXX_AUTO_TRACE(logger_);
- return cache_->LockScreenDismissalEnabledState();
-}
-
-const boost::optional<std::string>
-PolicyManagerImpl::LockScreenDismissalWarningMessage(
- const std::string& language) const {
- LOG4CXX_AUTO_TRACE(logger_);
- return cache_->LockScreenDismissalWarningMessage(language);
-}
-
void PolicyManagerImpl::IncrementIgnitionCycles() {
cache_->IncrementIgnitionCycles();
}
@@ -1885,10 +1861,10 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const {
return cache_->IsApplicationRevoked(app_id);
}
-bool PolicyManagerImpl::IsConsentNeeded(const std::string& device_id,
- const std::string& app_id) {
+bool PolicyManagerImpl::IsConsentNeeded(const std::string& app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- const int count = cache_->CountUnconsentedGroups(app_id, device_id);
+ const std::string device_id = GetCurrentDeviceId(app_id);
+ int count = cache_->CountUnconsentedGroups(app_id, device_id);
LOG4CXX_DEBUG(logger_, "There are: " << count << " unconsented groups.");
return count != 0;
}
@@ -1898,7 +1874,7 @@ void PolicyManagerImpl::SetVINValue(const std::string& value) {
}
AppPermissions PolicyManagerImpl::GetAppPermissionsChanges(
- const std::string& device_id, const std::string& policy_app_id) {
+ const std::string& policy_app_id) {
PendingPermissions::iterator app_id_diff =
app_permissions_diff_.find(policy_app_id);
@@ -1907,8 +1883,7 @@ AppPermissions PolicyManagerImpl::GetAppPermissionsChanges(
if (app_permissions_diff_.end() != app_id_diff) {
permissions = app_id_diff->second;
} else {
- permissions.appPermissionsConsentNeeded =
- IsConsentNeeded(device_id, policy_app_id);
+ permissions.appPermissionsConsentNeeded = IsConsentNeeded(policy_app_id);
permissions.appRevoked = IsApplicationRevoked(policy_app_id);
GetPriority(permissions.application_id, &permissions.priority);
}
@@ -1937,9 +1912,9 @@ void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {
}
void PolicyManagerImpl::OnAppRegisteredOnMobile(
- const std::string& device_id, const std::string& application_id) {
+ const std::string& application_id) {
StartPTExchange();
- SendNotificationOnPermissionsUpdated(device_id, application_id);
+ SendNotificationOnPermissionsUpdated(application_id);
}
void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from,
@@ -2028,23 +2003,20 @@ class CallStatusChange : public utils::Callable {
};
StatusNotifier PolicyManagerImpl::AddApplication(
- const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
- auto device_consent = GetUserConsentForDevice(device_id);
- LOG4CXX_DEBUG(logger_,
- "check_device_id: " << device_id << " check_device_consent: "
- << device_consent);
+ const std::string device_id = GetCurrentDeviceId(application_id);
+ DeviceConsent device_consent = GetUserConsentForDevice(device_id);
sync_primitives::AutoLock lock(apps_registration_lock_);
if (IsNewApplication(application_id)) {
LOG4CXX_DEBUG(logger_, "Adding new application");
- AddNewApplication(device_id, application_id, device_consent);
+ AddNewApplication(application_id, device_consent);
return std::make_shared<CallStatusChange>(update_status_manager_,
device_consent);
}
LOG4CXX_DEBUG(logger_, "Promote existed application");
- PromoteExistedApplication(device_id, application_id, device_consent);
+ PromoteExistedApplication(application_id, device_consent);
update_status_manager_.OnExistedApplicationAdded(cache_->UpdateRequired());
return std::make_shared<utils::CallNothing>();
}
@@ -2061,7 +2033,6 @@ bool PolicyManagerImpl::IsPredataPolicy(
}
void PolicyManagerImpl::ProcessExternalConsentStatusForApp(
- const std::string& device_id,
const std::string& application_id,
const ConsentProcessingPolicy processing_policy) {
ExternalConsentStatus status = cache_->GetExternalConsentStatus();
@@ -2073,7 +2044,7 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp(
CalculateGroupsConsentFromExternalConsent(
groups_by_status, allowed_groups, disallowed_groups);
- LOG4CXX_DEBUG(logger_, "check device_id: " << device_id);
+ const std::string device_id = GetCurrentDeviceId(application_id);
UpdateAppConsentWithExternalConsent(device_id,
application_id,
allowed_groups,
@@ -2081,8 +2052,7 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp(
processing_policy);
}
-void PolicyManagerImpl::AddNewApplication(const std::string& device_id,
- const std::string& application_id,
+void PolicyManagerImpl::AddNewApplication(const std::string& application_id,
DeviceConsent device_consent) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -2102,31 +2072,19 @@ void PolicyManagerImpl::AddNewApplication(const std::string& device_id,
}
ProcessExternalConsentStatusForApp(
- device_id,
- application_id,
- ConsentProcessingPolicy::kExternalConsentBased);
+ application_id, ConsentProcessingPolicy::kExternalConsentBased);
}
void PolicyManagerImpl::PromoteExistedApplication(
- const std::string& device_id,
- const std::string& application_id,
- DeviceConsent device_consent) {
+ const std::string& application_id, DeviceConsent device_consent) {
// If device consent changed to allowed during application being
// disconnected, app permissions should be changed also
- LOG4CXX_DEBUG(logger_,
- "kDeviceAllowed == device_consent: "
- << (kDeviceAllowed == device_consent)
- << " device_consent: " << device_consent);
if (kDeviceAllowed == device_consent &&
cache_->IsPredataPolicy(application_id)) {
- LOG4CXX_INFO(logger_,
- "Setting "
- << policy::kDefaultId
- << " permissions for application id: " << application_id);
cache_->SetDefaultPolicy(application_id);
}
- ProcessExternalConsentStatusForApp(
- device_id, application_id, ConsentProcessingPolicy::kTimestampBased);
+ ProcessExternalConsentStatusForApp(application_id,
+ ConsentProcessingPolicy::kTimestampBased);
}
bool PolicyManagerImpl::IsNewApplication(
@@ -2206,12 +2164,10 @@ std::ostream& operator<<(std::ostream& output,
return output;
}
-void PolicyManagerImpl::SetDefaultHmiTypes(
- const transport_manager::DeviceHandle& device_handle,
- const std::string& application_id,
- const std::vector<int>& hmi_types) {
+void PolicyManagerImpl::SetDefaultHmiTypes(const std::string& application_id,
+ const std::vector<int>& hmi_types) {
LOG4CXX_INFO(logger_, "SetDefaultHmiTypes");
- const auto device_id = GetCurrentDeviceId(device_handle, application_id);
+ const std::string device_id = GetCurrentDeviceId(application_id);
ApplicationOnDevice who = {device_id, application_id};
access_remote_->SetDefaultHmiTypes(who, hmi_types);
}
@@ -2249,7 +2205,7 @@ bool PolicyManagerImpl::CheckModule(const PTString& app_id,
void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) {
std::string default_hmi("NONE");
- if (GetDefaultHmi(who.dev_id, who.app_id, &default_hmi)) {
+ if (GetDefaultHmi(who.app_id, &default_hmi)) {
listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi);
} else {
LOG4CXX_WARN(
@@ -2286,8 +2242,7 @@ void PolicyManagerImpl::SendAppPermissionsChanged(
const std::string& device_id, const std::string& application_id) {
Permissions notification_data;
GetPermissions(device_id, application_id, &notification_data);
- listener()->OnPermissionsUpdated(
- device_id, application_id, notification_data);
+ listener()->OnPermissionsUpdated(application_id, notification_data);
}
void PolicyManagerImpl::SendAuthTokenUpdated(const std::string policy_app_id) {