~aleteoryx/muditaos

3e69b34d17e935fa2159bd2a7586bf80cfb0352b — Artur Śleszyński 4 years ago 99ae153
[CP-207] Add option to disable dev mode endpoint

We want to be able to disable dev mode endpoint in future releases.
M module-services/service-desktop/CMakeLists.txt => module-services/service-desktop/CMakeLists.txt +9 -0
@@ 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=$<BOOL:${ENABLE_DEVELOPER_MODE_ENDPOINT}>
)


if (${ENABLE_TESTS})
    add_subdirectory(tests)
endif ()

M module-services/service-desktop/endpoints/EndpointFactory.hpp => module-services/service-desktop/endpoints/EndpointFactory.hpp +2 -1
@@ 47,8 47,10 @@ class EndpointFactory
            return std::make_unique<FactoryResetEndpoint>(ownerServicePtr);
        case parserFSM::EndpointType::calllog:
            return std::make_unique<CalllogEndpoint>(ownerServicePtr);
#if ENABLE_DEVELOPER_MODE_ENDPOINT
        case parserFSM::EndpointType::developerMode:
            return std::make_unique<DeveloperModeEndpoint>(ownerServicePtr);
#endif
        case parserFSM::EndpointType::bluetooth:
            return std::make_unique<BluetoothEndpoint>(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};