diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index cb9b7df3e1b..890dd5b57a8 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -1380,7 +1380,6 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( } #ifdef EXTERNAL_PROPRIETARY_MODE - ApplicationSet applications; { DataAccessor accessor = @@ -1426,7 +1425,6 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( } #ifdef EXTERNAL_PROPRIETARY_MODE - if (last_activated_app_id_) { ApplicationSharedPtr app = application_manager_.application(last_activated_app_id_); @@ -1437,7 +1435,14 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( << "' not found among registered applications."); return; } - if (is_allowed) { + + bool is_allowed_by_policies = true; + if (PolicyEnabled()) { + is_allowed_by_policies = + !policy_manager->IsApplicationRevoked(app->policy_app_id()); + } + + if (is_allowed && is_allowed_by_policies) { // Send HMI status notification to mobile // Put application in full AudioStreamingState::eType audio_state = @@ -1510,7 +1515,9 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, // is not allowed. if (!permissions.isSDLAllowed) { permissions.priority.clear(); - last_activated_app_id_ = connection_key; + if (!permissions.appRevoked) { + last_activated_app_id_ = connection_key; + } } if (permissions.appRevoked) { diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index a66cff17270..f566bed9340 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -926,8 +926,8 @@ void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key, _, _)); #endif // EXTERNAL_PROPRIETARY_MODE - - EXPECT_CALL(*application1, policy_app_id()).WillOnce(Return(kPolicyAppId_)); + EXPECT_CALL(*application1, policy_app_id()) + .WillRepeatedly(Return(kPolicyAppId_)); EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(kMacAddr_, kPolicyAppId_)) .WillOnce(Return(permissions)); diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_test.cc index 4d39e699b52..95fc783b2d4 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_test.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_test.cc @@ -66,6 +66,7 @@ const int kServiceTypeInt = 0; const std::string kDeviceNumber = "XXX123456789ZZZ"; const std::string kAppStorageFolder = "app_storage_folder"; const std::string kValidAppId = "1234"; +const std::vector kDevices{kDeviceNumber}; } // namespace class PolicyManagerImplTest : public ::testing::Test { @@ -88,6 +89,7 @@ class PolicyManagerImplTest : public ::testing::Test { ON_CALL(policy_settings_, app_storage_folder()) .WillByDefault(ReturnRef(kAppStorageFolder)); + ON_CALL(listener_, GetDevicesIds(_)).WillByDefault(Return(kDevices)); } ::testing::AssertionResult IsValid(const policy_table::Table& table) {