summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLitvinenkoIra <ilytvynenko@luxoft.com>2020-03-25 13:25:06 +0200
committerLitvinenkoIra <ilytvynenko@luxoft.com>2020-03-25 13:25:06 +0200
commit98586b586c4a8e2d7245ea1ef32145a2c2c56d4c (patch)
tree4739ef9a99a58f8de2873e34494cc61482cc7b36
parent38459c0b52f6351d4cbbcf219c19f5e81cce23eb (diff)
downloadsdl_core-fix/sdl_sends_get_system_info_twice.tar.gz
Remove redundant GetSystemInfo sendingfix/sdl_sends_get_system_info_twice
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h6
-rw-r--r--src/components/application_manager/src/policies/policy_event_observer.cc5
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc15
-rw-r--r--src/components/application_manager/test/policy_event_observer_test.cc11
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc18
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h6
-rw-r--r--src/components/include/policy/policy_external/policy/policy_listener.h1
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h7
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_listener.h1
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h7
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h2
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_listener.h1
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h1
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h1
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h1
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h7
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc7
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_test.cc8
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h7
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc8
-rw-r--r--src/components/policy/policy_regular/test/policy_manager_impl_test.cc8
21 files changed, 0 insertions, 128 deletions
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 daf87f3c36..4525433b8b 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
@@ -222,7 +222,6 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
uint32_t TimeoutExchangeMSec() const OVERRIDE;
void OnExceededTimeout() OVERRIDE;
- void OnSystemReady() OVERRIDE;
const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
const boost::optional<std::string> LockScreenDismissalWarningMessage(
const std::string& language) const OVERRIDE;
@@ -383,11 +382,6 @@ class PolicyHandler : public PolicyHandlerInterface,
const std::string& language) OVERRIDE;
/**
- * @brief Send request to HMI to get update on system parameters
- */
- virtual void OnSystemInfoUpdateRequired() OVERRIDE;
-
- /**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
*/
virtual void OnVIIsReady() OVERRIDE;
diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc
index afe909fee4..7ca4d7b5b8 100644
--- a/src/components/application_manager/src/policies/policy_event_observer.cc
+++ b/src/components/application_manager/src/policies/policy_event_observer.cc
@@ -70,11 +70,6 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) {
unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
break;
}
- case hmi_apis::FunctionID::BasicCommunication_OnReady: {
- policy_handler_->OnSystemReady();
- unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
- break;
- }
default: { break; }
}
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 9c0f5da73c..f41bb45dbf 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -376,10 +376,6 @@ const PolicySettings& PolicyHandler::get_settings() const {
bool PolicyHandler::InitPolicyTable() {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_OR_RETURN(false);
- // Subscribing to notification for system readiness to be able to get system
- // info necessary for policy table
- event_observer_->subscribe_on_event(
- hmi_apis::FunctionID::BasicCommunication_OnReady);
std::string preloaded_file = get_settings().preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
const bool pt_inited =
@@ -987,12 +983,6 @@ void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version,
policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language);
}
-void PolicyHandler::OnSystemInfoUpdateRequired() {
- LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK_VOID();
- MessageHelper::SendGetSystemInfoRequest(application_manager_);
-}
-
void PolicyHandler::OnVIIsReady() {
LOG4CXX_AUTO_TRACE(logger_);
const uint32_t correlation_id =
@@ -1765,11 +1755,6 @@ void PolicyHandler::OnExceededTimeout() {
policy_manager_->OnExceededTimeout();
}
-void PolicyHandler::OnSystemReady() {
- POLICY_LIB_CHECK_VOID();
- policy_manager_->OnSystemReady();
-}
-
const boost::optional<bool> PolicyHandler::LockScreenDismissalEnabledState()
const {
POLICY_LIB_CHECK_OR_RETURN(boost::optional<bool>());
diff --git a/src/components/application_manager/test/policy_event_observer_test.cc b/src/components/application_manager/test/policy_event_observer_test.cc
index a74b12071c..22d7a8cfa0 100644
--- a/src/components/application_manager/test/policy_event_observer_test.cc
+++ b/src/components/application_manager/test/policy_event_observer_test.cc
@@ -89,8 +89,6 @@ class PolicyEventObserverTest : public ::testing::Test {
EXPECT_CALL(policy_handler_mock_,
PTUpdatedAt(Counters::KILOMETERS, field_value))
.Times(pt_updated_calls_number);
- EXPECT_CALL(policy_handler_mock_, OnSystemReady())
- .Times(on_system_ready_calls_number);
policy_event_observer_->on_event(*event_);
}
@@ -125,15 +123,6 @@ TEST_F(PolicyEventObserverTest,
CheckResultsOnEvent(1u, 0u);
}
-TEST_F(PolicyEventObserverTest,
- OnEvent_EventBasicCommunication_OnReady_ExpectOnSystemReady) {
- // Arrange
- CreateEvent(Event::EventID::BasicCommunication_OnReady);
- CookSmartObject(hmi_apis::Common_Result::SUCCESS, field_name, field_value);
- // Check
- CheckResultsOnEvent(0u, 1u);
-}
-
} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
index 2b1fc6de1d..7a49431440 100644
--- a/src/components/application_manager/test/policy_handler_test.cc
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -811,15 +811,6 @@ TEST_F(PolicyHandlerTest, OnExceededTimeout) {
policy_handler_.OnExceededTimeout();
}
-TEST_F(PolicyHandlerTest, OnSystemReady) {
- // Arrange
- EnablePolicyAndPolicyManagerMock();
- // Check expectations
- EXPECT_CALL(*mock_policy_manager_, OnSystemReady());
- // Act
- policy_handler_.OnSystemReady();
-}
-
TEST_F(PolicyHandlerTest, PTUpdatedAt_method_UseCounter_KILOMETERS) {
// Arrange
EnablePolicyAndPolicyManagerMock();
@@ -1366,15 +1357,6 @@ TEST_F(PolicyHandlerTest, IsApplicationRevoked) {
policy_handler_.IsApplicationRevoked(kPolicyAppId_);
}
-TEST_F(PolicyHandlerTest, OnSystemInfoUpdateRequired) {
- // Arrange
- ChangePolicyManagerToMock();
- // Check expectations
- EXPECT_CALL(mock_message_helper_, SendGetSystemInfoRequest(_));
- // Act
- policy_handler_.OnSystemInfoUpdateRequired();
-}
-
TEST_F(PolicyHandlerTest, GetAppRequestTypes) {
// Arrange
EnablePolicy();
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index 46bc835036..3210d05ae8 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -149,7 +149,6 @@ class PolicyHandlerInterface : public VehicleDataItemProvider {
*/
virtual uint32_t TimeoutExchangeMSec() const = 0;
virtual void OnExceededTimeout() = 0;
- virtual void OnSystemReady() = 0;
virtual const boost::optional<bool> LockScreenDismissalEnabledState()
const = 0;
virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
@@ -314,11 +313,6 @@ class PolicyHandlerInterface : public VehicleDataItemProvider {
const std::string& language) = 0;
/**
- * @brief Send request to HMI to get update on system parameters
- */
- virtual void OnSystemInfoUpdateRequired() = 0;
-
- /**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
*/
virtual void OnVIIsReady() = 0;
diff --git a/src/components/include/policy/policy_external/policy/policy_listener.h b/src/components/include/policy/policy_external/policy/policy_listener.h
index c613fdd091..0ad695f2c0 100644
--- a/src/components/include/policy/policy_external/policy/policy_listener.h
+++ b/src/components/include/policy/policy_external/policy/policy_listener.h
@@ -60,7 +60,6 @@ class PolicyListener {
virtual std::string OnCurrentDeviceIdUpdateRequired(
const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) = 0;
- virtual void OnSystemInfoUpdateRequired() = 0;
virtual custom_str::CustomString GetAppName(
const std::string& policy_app_id) = 0;
virtual void OnUpdateHMIAppType(
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 9ba5de4973..4a96fdf3b8 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -474,13 +474,6 @@ class PolicyManager : public usage_statistics::StatisticsManager,
virtual bool CanAppStealFocus(const std::string& app_id) const = 0;
/**
- * @brief Runs necessary operations, which is depends on external system
- * state, e.g. getting system-specific parameters which are need to be
- * filled into policy table
- */
- virtual void OnSystemReady() = 0;
-
- /**
* @brief Get number of notification by priority
* @param priority Specified priority
* @return notification number
diff --git a/src/components/include/policy/policy_regular/policy/policy_listener.h b/src/components/include/policy/policy_regular/policy/policy_listener.h
index 192244bb09..729eda0a95 100644
--- a/src/components/include/policy/policy_regular/policy/policy_listener.h
+++ b/src/components/include/policy/policy_regular/policy/policy_listener.h
@@ -58,7 +58,6 @@ class PolicyListener {
virtual std::string OnCurrentDeviceIdUpdateRequired(
const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) = 0;
- virtual void OnSystemInfoUpdateRequired() = 0;
virtual custom_str::CustomString GetAppName(
const std::string& policy_app_id) = 0;
virtual void OnUpdateHMIAppType(
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index 7ba9a77a6c..0689a5b768 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -465,13 +465,6 @@ class PolicyManager : public usage_statistics::StatisticsManager,
virtual bool CanAppStealFocus(const std::string& app_id) const = 0;
/**
- * @brief Runs necessary operations, which is depends on external system
- * state, e.g. getting system-specific parameters which are need to be
- * filled into policy table
- */
- virtual void OnSystemReady() = 0;
-
- /**
* @brief Get number of notification by priority
* @param priority Specified priority
* @return notification number
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index cd99157319..4eaae1d53a 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -125,7 +125,6 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_CONST_METHOD0(TimeoutExchangeSec, uint32_t());
MOCK_CONST_METHOD0(TimeoutExchangeMSec, uint32_t());
MOCK_METHOD0(OnExceededTimeout, void());
- MOCK_METHOD0(OnSystemReady, void());
MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
const boost::optional<bool>());
MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
@@ -182,7 +181,6 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
- MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
MOCK_METHOD0(OnVIIsReady, void());
MOCK_METHOD1(OnVehicleDataUpdated,
void(const smart_objects::SmartObject& message));
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
index 0060d2299f..62dfdf4058 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
@@ -71,7 +71,6 @@ class MockPolicyListener : public ::policy::PolicyListener {
MOCK_METHOD2(OnCurrentDeviceIdUpdateRequired,
std::string(const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id));
- MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
MOCK_METHOD1(GetAppName,
custom_str::CustomString(const std::string& policy_app_id));
MOCK_METHOD0(OnUserRequestedUpdateCheckRequired, void());
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index da3f130077..bf092d38e8 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -206,7 +206,6 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(CleanupUnpairedDevices, bool());
MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
- MOCK_METHOD0(OnSystemReady, void());
MOCK_CONST_METHOD1(GetNotificationsNumber,
uint32_t(const std::string& priority));
MOCK_METHOD1(SetVINValue, void(const std::string& value));
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
index e5f2321217..f12358396b 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
@@ -68,7 +68,6 @@ class MockPolicyListener : public ::policy::PolicyListener {
MOCK_METHOD2(OnCurrentDeviceIdUpdateRequired,
std::string(const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id));
- MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
MOCK_METHOD1(GetAppName,
custom_str::CustomString(const std::string& policy_app_id));
MOCK_METHOD0(OnUserRequestedUpdateCheckRequired, void());
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index b328306134..c803f63c9d 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -204,7 +204,6 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(CleanupUnpairedDevices, bool());
MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
- MOCK_METHOD0(OnSystemReady, void());
MOCK_CONST_METHOD1(GetNotificationsNumber,
uint32_t(const std::string& priority));
MOCK_METHOD1(SetVINValue, void(const std::string& value));
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index 2fd58d3a07..e9fd2e0256 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -436,13 +436,6 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& language) OVERRIDE;
/**
- * @brief Runs necessary operations, which is depends on external system
- * state, e.g. getting system-specific parameters which are need to be
- * filled into policy table
- */
- void OnSystemReady() OVERRIDE;
-
- /**
* @brief Get number of notification by priority
* @param priority Specified priority
* @return notification number
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 35dcd2a272..082d4a37ba 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -1630,13 +1630,6 @@ void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
}
-void PolicyManagerImpl::OnSystemReady() {
- // Update policy table for the first time with system information
- if (!cache_->IsMetaInfoPresent()) {
- listener()->OnSystemInfoUpdateRequired();
- }
-}
-
uint32_t PolicyManagerImpl::GetNotificationsNumber(
const std::string& priority) const {
LOG4CXX_AUTO_TRACE(logger_);
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 388630a68f..9e0b61c2dd 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
@@ -174,14 +174,6 @@ TEST_F(PolicyManagerImplTest2, ForcePTExchange_ExpectUpdateNeeded) {
EXPECT_EQ("UPDATE_NEEDED", policy_manager_->GetPolicyTableStatus());
}
-TEST_F(PolicyManagerImplTest2, OnSystemReady) {
- // Arrange
- CreateLocalPT(preloaded_pt_filename_);
- // Check
- EXPECT_CALL(listener_, OnSystemInfoUpdateRequired());
- policy_manager_->OnSystemReady();
-}
-
TEST_F(PolicyManagerImplTest2, ResetRetrySequence) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
index d29852b279..b608c6f7ec 100644
--- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
@@ -452,13 +452,6 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& language) OVERRIDE;
/**
- * @brief Runs necessary operations, which is depends on external system
- * state, e.g. getting system-specific parameters which are need to be
- * filled into policy table
- */
- void OnSystemReady() OVERRIDE;
-
- /**
* @brief Get number of notification by priority
* @param priority Specified priority
* @return notification number
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index 8d4db9e675..efe5e113a1 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -1212,14 +1212,6 @@ void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
LOG4CXX_AUTO_TRACE(logger_);
}
-void PolicyManagerImpl::OnSystemReady() {
- // Update policy table for the first time with system information
- if (cache_->IsPTPreloaded()) {
- listener()->OnSystemInfoUpdateRequired();
- return;
- }
-}
-
uint32_t PolicyManagerImpl::GetNotificationsNumber(
const std::string& priority) const {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
index abf9a2ec14..37ef1afc0c 100644
--- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
+++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
@@ -1428,14 +1428,6 @@ TEST_F(PolicyManagerImplTest2, ForcePTExchange_ExpectUpdateNeeded) {
EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
}
-TEST_F(PolicyManagerImplTest2, OnSystemReady) {
- // Arrange
- CreateLocalPT("sdl_preloaded_pt.json");
- // Check
- EXPECT_CALL(listener, OnSystemInfoUpdateRequired());
- manager->OnSystemReady();
-}
-
TEST_F(PolicyManagerImplTest2, ResetRetrySequence) {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");