Files
MuditaOS/module-apps/apps-common/locks/input/PhoneLockedKeysWhitelist.cpp
Lefucjusz 773f2c7eb1 [BH-2069] Update license URL in headers
Update outdated license file URL in
license headers across all project.
2024-09-18 11:53:01 +02:00

31 lines
1.1 KiB
C++

// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md
#include "PhoneLockedKeysWhitelist.hpp"
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