~aleteoryx/muditaos

376bbf3df7e883a4ff6170befaae5943d88e5121 — Przemyslaw Brudny 4 years ago 7f9bc6b
[EGD-7922] Added InputEvents Debug option

Added Debug flag for InputEvents in EvtManager and Application.
M module-apps/apps-common/ApplicationCommon.cpp => module-apps/apps-common/ApplicationCommon.cpp +19 -0
@@ 62,6 62,12 @@
#include <popups/data/BluetoothModeParams.hpp>
#include <locks/data/LockData.hpp>

#if DEBUG_INPUT_EVENTS == 1
#define debug_input_events(...) LOG_DEBUG(__VA_ARGS__)
#else
#define debug_input_events(...)
#endif

namespace gui
{
    class DrawCommand;


@@ 201,6 207,12 @@ namespace app
            messageInputEventApplication(this, this->GetName(), iev);
            keyTranslator->resetPreviousKeyPress();
            longPressTimer.stop();

            debug_input_events("AppInput -> K:|%s|, S:|%s|, App:|%s|, W:|%s|",
                               magic_enum::enum_name(iev.getKeyCode()).data(),
                               magic_enum::enum_name(iev.getState()).data(),
                               GetName().c_str(),
                               getCurrentWindow()->getName().c_str());
        }
    }



@@ 412,6 424,13 @@ namespace app
        if (!iev.is(gui::KeyCode::KEY_UNDEFINED)) {
            messageInputEventApplication(this, this->GetName(), iev);
        }

        debug_input_events("AppInput -> K:|%s|, S:|%s|, App:|%s|, W:|%s|",
                           magic_enum::enum_name(iev.getKeyCode()).data(),
                           magic_enum::enum_name(iev.getState()).data(),
                           GetName().c_str(),
                           getCurrentWindow()->getName().c_str());

        return sys::msgHandled();
    }


M module-services/service-evtmgr/EventManager.cpp => module-services/service-evtmgr/EventManager.cpp +16 -0
@@ 44,6 44,12 @@
#include <purefs/filesystem_paths.hpp>
#include <Constants.hpp>

#if DEBUG_INPUT_EVENTS == 1
#define debug_input_events(...) LOG_DEBUG(__VA_ARGS__)
#else
#define debug_input_events(...)
#endif

namespace
{
    constexpr auto loggerDelayMs   = 1000 * 60 * 5;


@@ 284,10 290,20 @@ void EventManagerCommon::handleKeyEvent(sys::Message *msg)
    auto message    = std::make_shared<sevm::KbdMessage>();
    message->key    = kbdMessage->key;

    debug_input_events("EVInput -> K:|%s|, S:|%s|, TP:|%d|, TR:|%d|, App:|%s|",
                       magic_enum::enum_name(message->key.keyCode).data(),
                       magic_enum::enum_name(message->key.state).data(),
                       message->key.timePress,
                       message->key.timeRelease,
                       targetApplication.c_str());

    // send key to focused application
    if (!targetApplication.empty()) {
        bus.sendUnicast(message, targetApplication);
    }
    else {
        debug_input_events("EventManagerInput -> No target Application!");
    }
    // notify application manager to prevent screen locking
    app::manager::Controller::preventBlockingDevice(this);
}

M module-utils/log/api/log/debug.hpp => module-utils/log/api/log/debug.hpp +1 -0
@@ 15,6 15,7 @@
#define DEBUG_GUI_TEXT               0 /// show basic debug messages for gui::Text - warning this can be hard on cpu
#define DEBUG_GUI_TEXT_LINES         0 /// show extended debug messages for gui::Text - lines building
#define DEBUG_GUI_TEXT_CURSOR        0 /// show extended debug messages for gui::Text - cursor handling
#define DEBUG_INPUT_EVENTS           0 /// show input events prints in system
#define DEBUG_TIMER                  0 /// debug timers system utility
#define DEBUG_SETTINGS_DB            0 /// show extensive settings logs for all applications
#define DEBUG_SERVICE_CELLULAR       0 /// show various logs in cellular service