summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--customer-specific/pasa/src/makefile3
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h18
-rw-r--r--src/components/application_manager/src/message_helper.cc12
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc35
-rw-r--r--src/components/policy/src/policy/include/policy/policy_manager.h7
-rw-r--r--src/components/policy/src/policy/include/policy/policy_manager_impl.h2
-rw-r--r--src/components/policy/src/policy/src/policy_manager_impl.cc15
7 files changed, 76 insertions, 16 deletions
diff --git a/customer-specific/pasa/src/makefile b/customer-specific/pasa/src/makefile
index 28450ccff3..4226633bc3 100644
--- a/customer-specific/pasa/src/makefile
+++ b/customer-specific/pasa/src/makefile
@@ -86,8 +86,7 @@ clean lint metrics:
$(MAKE) -C components/interfaces OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/utils/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/smart_objects/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
- $(MAKE) -C components/config_profile/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
- $(MAKE) -C components/request_watchdog/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
+ $(MAKE) -C components/config_profile/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/hmi_message_handler/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/formatters/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/connection_handler/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
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 f715a2c48c..6df598d025 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
@@ -74,6 +74,24 @@ class PolicyHandler :
const HMILevel& default_hmi);
/**
+ * Checks system action of application for permission of keep context
+ * @param system_action system action (see mobile api)
+ * @param policy_app_id unique application id
+ * @return false if system_action is KEEP_CONTEXT and it isn't allowed by policy
+ * otherwise true
+ */
+ bool CheckKeepContext(int system_action, const std::string& policy_app_id);
+
+ /**
+ * Checks system action of application for permission of steal focus
+ * @param system_action system action (see mobile api)
+ * @param policy_app_id unique application id
+ * @return false if system_action is STEAL_FOCUS and it isn't allowed by policy
+ * otherwise true
+ */
+ bool CheckStealFocus(int system_action, const std::string& policy_app_id);
+
+ /**
* Lets client to notify PolicyHandler that more kilometers expired
* @param kms New value of odometer
*/
diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc
index d5eef9a44d..231e18fcb8 100644
--- a/src/components/application_manager/src/message_helper.cc
+++ b/src/components/application_manager/src/message_helper.cc
@@ -2132,8 +2132,18 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
smart_objects::SmartObject soft_buttons = smart_objects::SmartObject(
smart_objects::SmartType_Array);
+ policy::PolicyHandler* policy_handler = policy::PolicyHandler::instance();
+ std::string app_mobile_id = app->mobile_app_id()->asString();
+
uint32_t j = 0;
- for (uint32_t i = 0; i < request_soft_buttons.length(); ++i) {
+ size_t size = request_soft_buttons.length();
+ for (uint32_t i = 0; i < size; ++i) {
+ int system_action = request_soft_buttons[i][strings::system_action].asInt();
+ if (!policy_handler->CheckKeepContext(system_action, app_mobile_id) ||
+ !policy_handler->CheckStealFocus(system_action, app_mobile_id)) {
+ return mobile_apis::Result::DISALLOWED;
+ }
+
switch (request_soft_buttons[i][strings::type].asInt()) {
case mobile_apis::SoftButtonType::SBT_IMAGE: {
if (!image_supported) {
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index f34026c3aa..35a651e951 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -420,12 +420,21 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
for (; it_app_list != it_app_list_end; ++it_app_list) {
if (device_handle == (*it_app_list).get()->device()) {
- policy_manager_->ReactOnUserDevConsentForApp(
- it_app_list->get()->mobile_app_id()->asString(),
- is_allowed);
+ const std::string policy_app_id =
+ (*it_app_list).get()->mobile_app_id()->asString();
+
+ // If app has predata policy, which is assigned without device consent or
+ // with negative data consent, there no necessity to change smth and send
+ // notification for such app in case of device consent is not allowed
+ if (policy_manager_->IsPredataPolicy(policy_app_id) &&
+ !is_allowed) {
+ continue;
+ }
+
+ policy_manager_->ReactOnUserDevConsentForApp(policy_app_id,
+ is_allowed);
- policy_manager_->SendNotificationOnPermissionsUpdated(
- (*it_app_list).get()->mobile_app_id()->asString());
+ policy_manager_->SendNotificationOnPermissionsUpdated(policy_app_id);
}
}
}
@@ -1297,5 +1306,21 @@ void PolicyHandler::OnUpdateRequestSentToMobile() {
policy_manager_->OnUpdateStarted();
}
+bool PolicyHandler::CheckKeepContext(int system_action,
+ const std::string& policy_app_id) {
+ const bool keep_context = system_action
+ == mobile_apis::SystemAction::KEEP_CONTEXT;
+ const bool allowed = policy_manager_->CanAppKeepContext(policy_app_id);
+ return !(keep_context && !allowed);
+}
+
+bool PolicyHandler::CheckStealFocus(int system_action,
+ const std::string& policy_app_id) {
+ const bool steal_focus = system_action
+ == mobile_apis::SystemAction::STEAL_FOCUS;
+ const bool allowed = policy_manager_->CanAppStealFocus(policy_app_id);
+ return !(steal_focus && !allowed);
+}
+
} // namespace policy
diff --git a/src/components/policy/src/policy/include/policy/policy_manager.h b/src/components/policy/src/policy/include/policy/policy_manager.h
index 36b771f90d..61f23aa239 100644
--- a/src/components/policy/src/policy/include/policy/policy_manager.h
+++ b/src/components/policy/src/policy/include/policy/policy_manager.h
@@ -395,6 +395,13 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @param new value for the parameter.
*/
virtual void SetVINValue(const std::string& value) = 0;
+
+ /**
+ * @brief Checks, if application has policy assigned w/o data consent
+ * @param policy_app_id Unique application id
+ * @return true, if policy assigned w/o data consent, otherwise -false
+ */
+ virtual bool IsPredataPolicy(const std::string& policy_app_id) = 0;
};
} // namespace policy
diff --git a/src/components/policy/src/policy/include/policy/policy_manager_impl.h b/src/components/policy/src/policy/include/policy/policy_manager_impl.h
index a7f1008c11..62e519ee63 100644
--- a/src/components/policy/src/policy/include/policy/policy_manager_impl.h
+++ b/src/components/policy/src/policy/include/policy/policy_manager_impl.h
@@ -167,6 +167,8 @@ class PolicyManagerImpl : public PolicyManager {
virtual void RemoveAppConsentForGroup(const std::string& app_id,
const std::string& group_name);
+ virtual bool IsPredataPolicy(const std::string& policy_app_id);
+
protected:
virtual utils::SharedPtr<policy_table::Table> Parse(
const BinaryMessage& pt_content);
diff --git a/src/components/policy/src/policy/src/policy_manager_impl.cc b/src/components/policy/src/policy/src/policy_manager_impl.cc
index 2dff109037..8e468fdd68 100644
--- a/src/components/policy/src/policy/src/policy_manager_impl.cc
+++ b/src/components/policy/src/policy/src/policy_manager_impl.cc
@@ -1093,17 +1093,11 @@ void PolicyManagerImpl::RemovePendingPermissionChanges(
}
bool PolicyManagerImpl::CanAppKeepContext(const std::string& app_id) {
-#ifdef EXTENDED_POLICY
return cache.CanAppKeepContext(app_id);
-#endif // EXTENDED_POLICY
- return false;
}
bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) {
-#ifdef EXTENDED_POLICY
- cache.CanAppStealFocus(app_id);
-#endif // EXTENDED_POLICY
- return false;
+ return cache.CanAppStealFocus(app_id);
}
void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {
@@ -1140,7 +1134,12 @@ bool PolicyManagerImpl::IsAppInUpdateList(const std::string& app_id) const {
void PolicyManagerImpl::RemoveAppConsentForGroup(const std::string& app_id,
const std::string& group_name) {
- cache.RemoveAppConsentForGroup(app_id, group_name);
+ cache.RemoveAppConsentForGroup(app_id, group_name);
+}
+
+bool PolicyManagerImpl::IsPredataPolicy(const std::string &policy_app_id) {
+ LOG4CXX_INFO(logger_, "IsPredataApp");
+ return cache.IsPredataPolicy(policy_app_id);
}
void PolicyManagerImpl::AddNewApplication(const std::string& application_id,