Files
MuditaOS/module-apps/apps-common/locks/input/PhoneLockedKeysWhitelist.cpp
Lefucjusz b1ee717769 [MOS-37] Slider triggering unlock instructions popup fix
Fix of the issue that changing phone mode
using slider while the phone was locked
unnecessarily triggered the popup with
unlock instructions.
2022-06-02 10:13:23 +02:00

32 lines
1.1 KiB
C++

// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "PhoneLockedKeysWhitelist.hpp"
#include <array>
namespace locks::PhoneLockedKeysWhitelist
{
namespace
{
using namespace gui;
constexpr std::array keysWhitelist = {KeyCode::KEY_TORCH,
KeyCode::KEY_VOLDN,
KeyCode::HEADSET_VOLDN,
KeyCode::KEY_VOLUP,
KeyCode::HEADSET_VOLUP,
KeyCode::SWITCH_DN,
KeyCode::SWITCH_MID,
KeyCode::SWITCH_UP};
} // anonymous namespace
[[nodiscard]] bool isOnWhitelist(const gui::InputEvent &inputEvent)
{
for (const auto &key : keysWhitelist) {
if (inputEvent.is(key)) {
return true;
}
}
return false;
}
} // namespace locks::PhoneLockedKeysWhitelist