From 3e69b34d17e935fa2159bd2a7586bf80cfb0352b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20=C5=9Aleszy=C5=84ski?= Date: Mon, 26 Jul 2021 14:30:39 +0200 Subject: [PATCH] [CP-207] Add option to disable dev mode endpoint We want to be able to disable dev mode endpoint in future releases. --- module-services/service-desktop/CMakeLists.txt | 9 +++++++++ .../service-desktop/endpoints/EndpointFactory.hpp | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/module-services/service-desktop/CMakeLists.txt b/module-services/service-desktop/CMakeLists.txt index f626061e5502f58ecfea351f7738061af60dc02a..4d4614b1369441111a2dd445579a151d71c5abb1 100644 --- a/module-services/service-desktop/CMakeLists.txt +++ b/module-services/service-desktop/CMakeLists.txt @@ -1,6 +1,8 @@ project(service-desktop) message( "${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}" ) +option(ENABLE_DEVELOPER_MODE_ENDPOINT "Enable developer mode endpoint in service desktop" ON) + set(SOURCES endpoints/BaseHelper.cpp endpoints/backup/BackupEndpoint.cpp @@ -74,6 +76,13 @@ target_link_libraries(${PROJECT_NAME} hash-library::hash-library ) +target_compile_definitions( + ${PROJECT_NAME} + PRIVATE + ENABLE_DEVELOPER_MODE_ENDPOINT=$ +) + + if (${ENABLE_TESTS}) add_subdirectory(tests) endif () diff --git a/module-services/service-desktop/endpoints/EndpointFactory.hpp b/module-services/service-desktop/endpoints/EndpointFactory.hpp index adb7c39feac09486a5dd26b2671dd164705f1591..b1fbd97b5cf179e2763355ebf9ae9ac73ba0c4b1 100644 --- a/module-services/service-desktop/endpoints/EndpointFactory.hpp +++ b/module-services/service-desktop/endpoints/EndpointFactory.hpp @@ -47,8 +47,10 @@ class EndpointFactory return std::make_unique(ownerServicePtr); case parserFSM::EndpointType::calllog: return std::make_unique(ownerServicePtr); +#if ENABLE_DEVELOPER_MODE_ENDPOINT case parserFSM::EndpointType::developerMode: return std::make_unique(ownerServicePtr); +#endif case parserFSM::EndpointType::bluetooth: return std::make_unique(ownerServicePtr); case parserFSM::EndpointType::usbSecurity: @@ -58,7 +60,6 @@ class EndpointFactory } } }; - class SecuredEndpointFactory : public EndpointFactory { static constexpr auto Whitelist = {parserFSM::EndpointType::developerMode, parserFSM::EndpointType::usbSecurity};