~aleteoryx/muditaos

13269271e607be8f2df2b0480098d7e29879c064 — Lefucjusz 2 years ago 90d1458
[MOS-998] Provide additional info in crashdump filename

Added info about product, OS version and
commit hash to crashdump filename to
simplify analysis of the crashdumps
without corresponding logs available.
M board/linux/CMakeLists.txt => board/linux/CMakeLists.txt +0 -1
@@ 1,4 1,3 @@
add_library(board INTERFACE)
add_subdirectory(libiosyscalls)
add_subdirectory(crashdump-serial-number)
target_compile_definitions(board-config INTERFACE PROJECT_CONFIG_USER_DYNMEM_SIZE=0)

D board/linux/crashdump-serial-number/CMakeLists.txt => board/linux/crashdump-serial-number/CMakeLists.txt +0 -13
@@ 1,13 0,0 @@
add_library(crashdump-serial-number STATIC)

target_include_directories(crashdump-serial-number
    PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include
)

target_sources(crashdump-serial-number
    PUBLIC
        crashdump_serial_number.cpp
)



D board/linux/crashdump-serial-number/crashdump_serial_number.cpp => board/linux/crashdump-serial-number/crashdump_serial_number.cpp +0 -23
@@ 1,23 0,0 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <crashdump-serial-number/crashdump_serial_number.hpp>

namespace crashdump
{
    namespace
    {
        std::string serialNumber{};
    }

    void setSerialNumber(const std::string &sn)
    {
        serialNumber = sn;
    }

    const std::string &getSerialNumber()
    {
        return serialNumber;
    }

} // namespace crashdump

D board/linux/crashdump-serial-number/include/crashdump-serial-number/crashdump_serial_number.hpp => board/linux/crashdump-serial-number/include/crashdump-serial-number/crashdump_serial_number.hpp +0 -14
@@ 1,14 0,0 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

// Dummy file to keep linux variant compiling.

#pragma once

#include <string>

namespace crashdump
{
    void setSerialNumber(const std::string &sn);
    const std::string &getSerialNumber();
} // namespace crashdump

M board/rt1051/CMakeLists.txt => board/rt1051/CMakeLists.txt +1 -2
@@ 2,7 2,6 @@ add_library(board STATIC)

add_subdirectory(cmsis)
add_subdirectory(${BOARD})
add_subdirectory(crashdump-serial-number)

if (${MEMORY_LINKER_FILE_PATH} STREQUAL "")
    message(FATAL_ERROR "Linker RAM layout not provided")


@@ 43,7 42,7 @@ target_include_directories(board
target_link_libraries(board
    PRIVATE
        utils-rotator
        crashdump-serial-number
        crashdump-metadata-store
    PUBLIC
        fsl
        module-vfs

D board/rt1051/crashdump-serial-number/CMakeLists.txt => board/rt1051/crashdump-serial-number/CMakeLists.txt +0 -13
@@ 1,13 0,0 @@
add_library(crashdump-serial-number STATIC)

target_include_directories(crashdump-serial-number
    PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include
)

target_sources(crashdump-serial-number
    PUBLIC
        crashdump_serial_number.cpp
)



D board/rt1051/crashdump-serial-number/crashdump_serial_number.cpp => board/rt1051/crashdump-serial-number/crashdump_serial_number.cpp +0 -22
@@ 1,22 0,0 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <crashdump-serial-number/crashdump_serial_number.hpp>

namespace crashdump
{
    namespace
    {
        std::string serialNumber{};
    }

    void setSerialNumber(const std::string &sn)
    {
        serialNumber = sn;
    }

    const std::string &getSerialNumber()
    {
        return serialNumber;
    }
} // namespace crashdump

D board/rt1051/crashdump-serial-number/include/crashdump-serial-number/crashdump_serial_number.hpp => board/rt1051/crashdump-serial-number/include/crashdump-serial-number/crashdump_serial_number.hpp +0 -18
@@ 1,18 0,0 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

// The purpose of this file is to keep the devices serial number in the memory.
// In case of any crash, the serial number could be easily added to a crash dump filename.
// It will allow to identify the crash even after it is moved or copied from the device.
// setSerialNumber() should be called during system initialization.
// getSerialNumber() is called by the crash dump writer during file creation.

#pragma once

#include <string>

namespace crashdump
{
    void setSerialNumber(const std::string &sn);
    const std::string &getSerialNumber();
} // namespace crashdump

M board/rt1051/crashdump/crashcatcher_impl.cpp => board/rt1051/crashdump/crashcatcher_impl.cpp +6 -6
@@ 16,17 16,17 @@ namespace
    crashdump::CrashDumpWriterVFS cwrite;
}

const CrashCatcherMemoryRegion *CrashCatcher_GetMemoryRegions(void)
const CrashCatcherMemoryRegion *CrashCatcher_GetMemoryRegions()
{
    /* board/rt1051/ldscripts/memory.ld
     * NOTE: Text section and stacks sections are intentionally ommited
     * because can cause throubles in the running system
     * NOTE: Text section and stacks sections are intentionally omitted
     * because can cause troubles in the running system
     */
    static const CrashCatcherMemoryRegion regions[] = {
        // SRAM_OC
        {0x20200000, 0x20210000, CRASH_CATCHER_WORD},
        {0x20200000, 0x20200000 + 0x10000, CRASH_CATCHER_WORD},
        // SRAM_DTC
        {0x20000000, 0x20070000, CRASH_CATCHER_WORD},
        {0x20000000, 0x20000000 + 0x70000, CRASH_CATCHER_WORD},
        // intentionally skip text section
        // intentionally skip the heap section
        // end tag


@@ 57,7 57,7 @@ void CrashCatcher_DumpMemory(const void *pvMemory, CrashCatcherElementSizes elem
    }
}

CrashCatcherReturnCodes CrashCatcher_DumpEnd(void)
CrashCatcherReturnCodes CrashCatcher_DumpEnd()
{
    cwrite.saveDump();
    _exit_backtrace(-1, false);

M board/rt1051/crashdump/crashdumpwriter_vfs.cpp => board/rt1051/crashdump/crashdumpwriter_vfs.cpp +31 -35
@@ 2,90 2,86 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "crashdumpwriter_vfs.hpp"
#include <crashdump-serial-number/crashdump_serial_number.hpp>
#include <cstdio>
#include <fcntl.h>
#include "purefs/vfs_subsystem.hpp"
#include <purefs/filesystem_paths.hpp>
#include <exit_backtrace.h>
#include <CrashdumpMetadataStore.hpp>

#include <log/log.hpp>
#include <filesystem>
#include <stdint.h>
#include <unistd.h>
#include <chrono>
#include <set>

/* Crashdump filename pattern:
 * crashdump_[os-metadata]_[timestamp-in-seconds].hex.[index]
 * where [os-metadata] is in [product]_[os-version]_[commit-hash]-[serial-number] form.
 * [index] was added to ensure resistance to the device date retraction.
 */

namespace
{
    constexpr inline auto suffix     = "_crashdump.hex";
    constexpr inline auto file_index = ".1";

    // Crashdump filename pattern:
    // [serial-number]_[timestamp-in-seconds]_crashdump.hex.[index]
    // [index] was added to ensure resistance to the device date retraction
    inline constexpr auto prefix     = "crashdump";
    inline constexpr auto extension  = ".hex";
    inline constexpr auto file_index = ".1";
    inline constexpr auto separator  = "_";

    inline std::string generate_crashdump_filename()
    inline std::string generateCrashdumpFilename()
    {
        const auto crash_time =
            std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch())
                .count();
        auto filename =
            std::string("/") + crashdump::getSerialNumber() + "_" + std::to_string(crash_time) + suffix + file_index;
        return filename;
        const auto crashTime   = std::time(nullptr);
        const auto &osMetadata = Store::CrashdumpMetadata::getInstance().getMetadataString();
        return (std::string(prefix) + separator + osMetadata + separator + std::to_string(crashTime) + extension +
                file_index);
    }

} // namespace

namespace crashdump
{

    void CrashDumpWriterVFS::openDump()
    {
        const auto crashDumpFilePath = purefs::dir::getCrashDumpsPath().string() + generate_crashdump_filename();
        const auto crashdumpFilePath = purefs::dir::getCrashDumpsPath() / generateCrashdumpFilename();

        LOG_INFO("Crash dump %s preparing ...", crashDumpFilePath.c_str());
        LOG_INFO("Preparing crashdump '%s'...", crashdumpFilePath.c_str());
        if (!rotator.rotateFiles(purefs::dir::getCrashDumpsPath())) {
            LOG_FATAL("Failed to rotate crash dumps errno: %i", errno);
            LOG_FATAL("Failed to rotate crashdump, errno: %d", errno);
            _exit_backtrace(-1, false);
        }
        file = std::fopen(crashDumpFilePath.c_str(), "w");
        if (!file) {
            LOG_FATAL("Failed to open crash dump file errno %i", errno);

        file = std::fopen(crashdumpFilePath.c_str(), "w");
        if (file == nullptr) {
            LOG_FATAL("Failed to open crashdump file '%s', errno: %d", crashdumpFilePath.c_str(), errno);
            _exit_backtrace(-1, false);
        }
    }

    void CrashDumpWriterVFS::saveDump()
    {
        LOG_INFO("Crash dump create finished.");
        fflush(file);
        LOG_INFO("Crashdump created successfully!");
        std::fflush(file);
        fsync(fileno(file));
        std::fclose(file);
    }

    void CrashDumpWriterVFS::writeBytes(const uint8_t *buff, std::size_t size)
    void CrashDumpWriterVFS::writeBytes(const std::uint8_t *buff, std::size_t size)
    {
        if (std::fwrite(buff, sizeof(*buff), size, file) != size) {
            LOG_FATAL("Unable to write crash dump errno: %i", errno);
            LOG_FATAL("Unable to write crashdump, errno: %d", errno);
            _exit_backtrace(-1, false);
        }
    }

    void CrashDumpWriterVFS::writeHalfWords(const uint16_t *buff, std::size_t size)
    void CrashDumpWriterVFS::writeHalfWords(const std::uint16_t *buff, std::size_t size)
    {
        if (std::fwrite(buff, sizeof(*buff), size, file) != size) {
            LOG_FATAL("Unable to write crash dump errno: %i", errno);
            LOG_FATAL("Unable to write crashdump, errno: %d", errno);
            _exit_backtrace(-1, false);
        }
    }

    void CrashDumpWriterVFS::writeWords(const uint32_t *buff, std::size_t size)
    void CrashDumpWriterVFS::writeWords(const std::uint32_t *buff, std::size_t size)
    {
        if (std::fwrite(buff, sizeof(*buff), size, file) != size) {
            LOG_FATAL("Unable to write crash dump errno: %i", errno);
            LOG_FATAL("Unable to write crashdump, errno: %d", errno);
            _exit_backtrace(-1, false);
        }
    }

} // namespace crashdump

M board/rt1051/crashdump/crashdumpwriter_vfs.hpp => board/rt1051/crashdump/crashdumpwriter_vfs.hpp +1 -1
@@ 16,7 16,6 @@ namespace purefs::fs

namespace crashdump
{
    constexpr inline auto maxRotationFilesCount = 5;
    class CrashDumpWriterVFS
    {
      public:


@@ 30,6 29,7 @@ namespace crashdump
        void writeWords(const std::uint32_t *buff, std::size_t size);

      private:
        static constexpr auto maxRotationFilesCount = 5;
        utils::Rotator<maxRotationFilesCount> rotator;
        std::FILE *file{};
    };

M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 34,6 34,7 @@
* Added label informing about PC connection.
* Added serial number to About section
* Added possibility to detect device's case colour
* Added extended information to crashdump filename

### Changed / Improved


M module-bsp/board/rt1051/os/_exit.cpp => module-bsp/board/rt1051/os/_exit.cpp +1 -2
@@ 36,7 36,6 @@
#include <logdump/logdump.h>
#include <task.h>
#include <macros.h>
#include <stdbool.h>
#include <string.h>
#include <exit_backtrace.h>
#include <purefs/vfs_subsystem.hpp>


@@ 60,7 59,7 @@ static void __attribute__((noreturn)) stop_system(void)
    LOG_INFO("Restarting the system...");
    NVIC_SystemReset();
    // waiting for system reset
    while (1) {
    while (true) {
#ifndef DEBUG
        __asm volatile("wfi\n");
#endif

M module-utils/CMakeLists.txt => module-utils/CMakeLists.txt +1 -0
@@ 4,6 4,7 @@ add_library(module-utils INTERFACE)

add_subdirectory(tar)
add_subdirectory(Clipboard)
add_subdirectory(CrashdumpMetadataStore)
add_subdirectory(EventStore)
add_subdirectory(i18n)
add_subdirectory(locale)

M module-utils/Clipboard/test/unittest_clipboard.cpp => module-utils/Clipboard/test/unittest_clipboard.cpp +1 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <catch2/catch.hpp>


@@ 16,7 16,6 @@ TEST_CASE("Clipboard")
    SECTION("Single copy")
    {
        const std::string test1 = "test1";
        const std::string test2 = "test2";
        Clipboard::getInstance().copy(test1);
        REQUIRE(Clipboard::getInstance().gotData() == true);
        REQUIRE(Clipboard::getInstance().paste() == test1);

A module-utils/CrashdumpMetadataStore/CMakeLists.txt => module-utils/CrashdumpMetadataStore/CMakeLists.txt +15 -0
@@ 0,0 1,15 @@
add_library(crashdump-metadata-store STATIC)

target_include_directories(crashdump-metadata-store
        PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
        )

target_sources(crashdump-metadata-store
        PUBLIC
        CrashdumpMetadataStore.cpp
        )

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

A module-utils/CrashdumpMetadataStore/CrashdumpMetadataStore.cpp => module-utils/CrashdumpMetadataStore/CrashdumpMetadataStore.cpp +74 -0
@@ 0,0 1,74 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "CrashdumpMetadataStore.hpp"

namespace
{
    inline constexpr auto separator                 = "_";
    inline constexpr auto defaultSerialNumberLength = 13;
    inline constexpr auto defaultCommitHashLength   = 8;
    inline constexpr auto defaultProductName        = "unknown";
    inline constexpr auto defaultOsVersion          = "0.0.0";
    inline constexpr auto defaultFillValue          = '0';
} // namespace

namespace Store
{
    CrashdumpMetadata::CrashdumpMetadata() : productName(defaultProductName), osVersion(defaultOsVersion)
    {
        serialNumber.insert(0, defaultSerialNumberLength, defaultFillValue);
        commitHash.insert(0, defaultCommitHashLength, defaultFillValue);
    }

    CrashdumpMetadata &CrashdumpMetadata::getInstance()
    {
        static CrashdumpMetadata instance;
        return instance;
    }

    void CrashdumpMetadata::setSerialNumber(const std::string &sn)
    {
        serialNumber = sn;
    }

    const std::string &CrashdumpMetadata::getSerialNumber()
    {
        return serialNumber;
    }

    void CrashdumpMetadata::setProductName(const std::string &name)
    {
        productName = name;
    }

    const std::string &CrashdumpMetadata::getProductName()
    {
        return productName;
    }

    void CrashdumpMetadata::setOsVersion(const std::string &version)
    {
        osVersion = version;
    }

    const std::string &CrashdumpMetadata::getOsVersion()
    {
        return osVersion;
    }

    void CrashdumpMetadata::setCommitHash(const std::string &hash)
    {
        commitHash = hash;
    }

    const std::string &CrashdumpMetadata::getCommitHash()
    {
        return commitHash;
    }

    std::string CrashdumpMetadata::getMetadataString()
    {
        return productName + separator + osVersion + separator + commitHash + separator + serialNumber;
    }
} // namespace Store

A module-utils/CrashdumpMetadataStore/CrashdumpMetadataStore.hpp => module-utils/CrashdumpMetadataStore/CrashdumpMetadataStore.hpp +40 -0
@@ 0,0 1,40 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <string>

namespace Store
{
    struct CrashdumpMetadata
    {
      public:
        CrashdumpMetadata(const CrashdumpMetadata &) = delete;
        CrashdumpMetadata &operator=(const CrashdumpMetadata &) = delete;

        static CrashdumpMetadata &getInstance();

        void setSerialNumber(const std::string &serialNumber);
        const std::string &getSerialNumber();

        void setProductName(const std::string &product);
        const std::string &getProductName();

        void setOsVersion(const std::string &osVersion);
        const std::string &getOsVersion();

        void setCommitHash(const std::string &hash);
        const std::string &getCommitHash();

        std::string getMetadataString();

      private:
        CrashdumpMetadata();

        std::string serialNumber;
        std::string productName;
        std::string osVersion;
        std::string commitHash;
    };
} // namespace Store

A module-utils/CrashdumpMetadataStore/tests/CMakeLists.txt => module-utils/CrashdumpMetadataStore/tests/CMakeLists.txt +8 -0
@@ 0,0 1,8 @@
add_catch2_executable(
        NAME
        utils-crashdump-metadata-store
        SRCS
        unittest_crashdumpmetadatastore.cpp
        LIBS
        crashdump-metadata-store
)

A module-utils/CrashdumpMetadataStore/tests/unittest_crashdumpmetadatastore.cpp => module-utils/CrashdumpMetadataStore/tests/unittest_crashdumpmetadatastore.cpp +76 -0
@@ 0,0 1,76 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <catch2/catch.hpp>
#include <CrashdumpMetadataStore.hpp>

using namespace Store;

/* This has to be the first test case! */
TEST_CASE("Crashdump metadata store defaults")
{
    static constexpr auto defaultSerialNumber = "0000000000000";
    static constexpr auto defaultOsVersion    = "0.0.0";
    static constexpr auto defaultCommitHash   = "00000000";
    static constexpr auto defaultProductName  = "unknown";

    REQUIRE(CrashdumpMetadata::getInstance().getSerialNumber() == defaultSerialNumber);
    REQUIRE(CrashdumpMetadata::getInstance().getOsVersion() == defaultOsVersion);
    REQUIRE(CrashdumpMetadata::getInstance().getCommitHash() == defaultCommitHash);
    REQUIRE(CrashdumpMetadata::getInstance().getProductName() == defaultProductName);
}

TEST_CASE("Crashdump metadata store operations")
{
    static constexpr auto serialNumber1 = "1234567892137";
    static constexpr auto serialNumber2 = "2010307060900";

    static constexpr auto osVersion1 = "6.6.6";
    static constexpr auto osVersion2 = "9.9.9";

    static constexpr auto commitHash1 = "baadcafe";
    static constexpr auto commitHash2 = "c00lbabe";

    static constexpr auto productName1 = "pure";
    static constexpr auto productName2 = "bell";

    static constexpr auto separator = "_";

    SECTION("Setting values")
    {
        CrashdumpMetadata::getInstance().setSerialNumber(serialNumber1);
        REQUIRE(CrashdumpMetadata::getInstance().getSerialNumber() == serialNumber1);

        CrashdumpMetadata::getInstance().setOsVersion(osVersion1);
        REQUIRE(CrashdumpMetadata::getInstance().getOsVersion() == osVersion1);

        CrashdumpMetadata::getInstance().setCommitHash(commitHash1);
        REQUIRE(CrashdumpMetadata::getInstance().getCommitHash() == commitHash1);

        CrashdumpMetadata::getInstance().setProductName(productName1);
        REQUIRE(CrashdumpMetadata::getInstance().getProductName() == productName1);
    }

    SECTION("Updating values")
    {
        CrashdumpMetadata::getInstance().setSerialNumber(serialNumber2);
        REQUIRE(CrashdumpMetadata::getInstance().getSerialNumber() == serialNumber2);

        CrashdumpMetadata::getInstance().setOsVersion(osVersion2);
        REQUIRE(CrashdumpMetadata::getInstance().getOsVersion() == osVersion2);

        CrashdumpMetadata::getInstance().setCommitHash(commitHash2);
        REQUIRE(CrashdumpMetadata::getInstance().getCommitHash() == commitHash2);

        CrashdumpMetadata::getInstance().setProductName(productName2);
        REQUIRE(CrashdumpMetadata::getInstance().getProductName() == productName2);
    }

    SECTION("Stringifying values")
    {
        const auto realMetadataStringified = CrashdumpMetadata::getInstance().getMetadataString();
        const auto referenceMetadataStringified =
            std::string(productName2) + separator + osVersion2 + separator + commitHash2 + separator + serialNumber2;
        REQUIRE(realMetadataStringified == referenceMetadataStringified);
    }
}

M products/BellHybrid/services/db/CMakeLists.txt => products/BellHybrid/services/db/CMakeLists.txt +1 -1
@@ 24,7 24,7 @@ target_link_libraries(databases
        bell::db::meditation_stats
        service-db
        serial-number-parser
        crashdump-serial-number
        crashdump-metadata-store
)

if (${ENABLE_TESTS})

M products/BellHybrid/services/db/ServiceDB.cpp => products/BellHybrid/services/db/ServiceDB.cpp +8 -4
@@ 18,8 18,8 @@
#include <time/ScopedTime.hpp>

#include <purefs/filesystem_paths.hpp>

#include <crashdump-serial-number/crashdump_serial_number.hpp>
#include <CrashdumpMetadataStore.hpp>
#include <product/version.hpp>

ServiceDB::~ServiceDB()
{


@@ 70,10 70,14 @@ sys::ReturnCodes ServiceDB::InitHandler()
    const auto settings = std::make_unique<settings::Settings>();
    settings->init(service::ServiceProxy(shared_from_this()));

    // Save serial number for crashdump generation purpose
    /* Save metadata for crashdump generation purpose */
    const auto serialNumberPath =
        settings::factory::entry_key + std::string("/") + settings::factory::serial_number_key;
    crashdump::setSerialNumber(settings->getValue(serialNumberPath, settings::SettingsScope::Global));
    Store::CrashdumpMetadata::getInstance().setSerialNumber(
        settings->getValue(serialNumberPath, settings::SettingsScope::Global));
    Store::CrashdumpMetadata::getInstance().setCommitHash(GIT_REV);
    Store::CrashdumpMetadata::getInstance().setOsVersion(VERSION);
    Store::CrashdumpMetadata::getInstance().setProductName("BellHybrid");

    return sys::ReturnCodes::Success;
}

M products/PurePhone/services/db/CMakeLists.txt => products/PurePhone/services/db/CMakeLists.txt +1 -1
@@ 18,5 18,5 @@ target_link_libraries(db
   PRIVATE
        module-db
        service-db
        crashdump-serial-number
        crashdump-metadata-store
)

M products/PurePhone/services/db/ServiceDB.cpp => products/PurePhone/services/db/ServiceDB.cpp +8 -3
@@ 22,7 22,8 @@
#include <service-db/DBServiceMessage.hpp>
#include <service-db/QueryMessage.hpp>
#include <time/ScopedTime.hpp>
#include <crashdump-serial-number/crashdump_serial_number.hpp>
#include <CrashdumpMetadataStore.hpp>
#include <product/version.hpp>

ServiceDB::~ServiceDB()
{


@@ 275,10 276,14 @@ sys::ReturnCodes ServiceDB::InitHandler()
    auto settings = std::make_unique<settings::Settings>();
    settings->init(service::ServiceProxy(shared_from_this()));

    // Save serial number for crashdump generation purpose
    /* Save metadata for crashdump generation purpose */
    const auto serialNumberPath =
        settings::factory::entry_key + std::string("/") + settings::factory::serial_number_key;
    crashdump::setSerialNumber(settings->getValue(serialNumberPath, settings::SettingsScope::Global));
    Store::CrashdumpMetadata::getInstance().setSerialNumber(
        settings->getValue(serialNumberPath, settings::SettingsScope::Global));
    Store::CrashdumpMetadata::getInstance().setCommitHash(GIT_REV);
    Store::CrashdumpMetadata::getInstance().setOsVersion(VERSION);
    Store::CrashdumpMetadata::getInstance().setProductName("PurePhone");

    quotesRecordInterface =
        std::make_unique<Quotes::QuotesAgent>(predefinedQuotesDB.get(), customQuotesDB.get(), std::move(settings));

M products/PurePhone/services/evtmgr/EventManager.cpp => products/PurePhone/services/evtmgr/EventManager.cpp +6 -9
@@ 40,7 40,7 @@ void EventManager::initProductEvents()
    });

    connect(typeid(sevm::ScreenLightControlMessage), [&](sys::Message *msgl) {
        auto *m = dynamic_cast<sevm::ScreenLightControlMessage *>(msgl);
        auto *m = static_cast<sevm::ScreenLightControlMessage *>(msgl);
        backlightHandler.processScreenRequest(m->getAction(), screen_light_control::Parameters());
        return sys::msgHandled();
    });


@@ 57,8 57,8 @@ void EventManager::initProductEvents()
        return sys::msgHandled();
    });

    connect(sevm::ScreenLightControlRequestParameters(), [&](sys::Message *msgl) {
        screen_light_control::ManualModeParameters params = {backlightHandler.getScreenBrightnessValue()};
    connect(sevm::ScreenLightControlRequestParameters(), [&]([[maybe_unused]] sys::Message *msgl) {
        const screen_light_control::ManualModeParameters params = {backlightHandler.getScreenBrightnessValue()};
        auto msg = std::make_shared<sevm::ScreenLightControlParametersResponse>(
            backlightHandler.getScreenLightState(), backlightHandler.getScreenAutoModeState(), params);
        return msg;


@@ 76,7 76,7 @@ void EventManager::initProductEvents()
        return sys::msgHandled();
    });

    connect(typeid(sevm::SIMTrayMessage), [&](sys::Message *) {
    connect(typeid(sevm::SIMTrayMessage), [&]([[maybe_unused]] sys::Message *msg) {
        bus.sendUnicast(std::make_shared<sevm::SIMTrayMessage>(), ServiceCellular::serviceName);
        return sys::MessageNone{};
    });


@@ 99,7 99,7 @@ void EventManager::initProductEvents()
        return sys::MessageNone{};
    });

    connect(typeid(sevm::TurnOffTorchRequest), [&](sys::Message *msg) {
    connect(typeid(sevm::TurnOffTorchRequest), [&]([[maybe_unused]] sys::Message *msg) {
        toggleTorchOff();
        return sys::MessageNone{};
    });


@@ 135,7 135,6 @@ void EventManager::ProcessCloseReason([[maybe_unused]] sys::CloseReason closeRea

sys::MessagePointer EventManager::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
{

    auto responseMessage =
        std::static_pointer_cast<sys::ResponseMessage>(EventManagerCommon::DataReceivedHandler(msgl, resp));



@@ 161,9 160,7 @@ sys::MessagePointer EventManager::DataReceivedHandler(sys::DataMessage *msgl, sy
    if (handled) {
        return std::make_shared<sys::ResponseMessage>();
    }
    else {
        return std::make_shared<sys::ResponseMessage>(sys::ReturnCodes::Unresolved);
    }
    return std::make_shared<sys::ResponseMessage>(sys::ReturnCodes::Unresolved);
}

void EventManager::handleKeyEvent(sys::Message *msg)

M pure_changelog.md => pure_changelog.md +1 -0
@@ 8,6 8,7 @@
* Added VoLTE support in Poland, Germany, Denmark, United Kingdom, Netherlands, Canada and Austria
* Added translations for Bluetooth conenction status label
* Added WCDMA recognition as 3G in status bar
* Added extended information to crashdump filename

### Changed / Improved