M module-services/service-evtmgr/EventManager.cpp => module-services/service-evtmgr/EventManager.cpp +1 -4
@@ 99,9 99,7 @@ sys::MessagePointer EventManagerCommon::DataReceivedHandler(sys::DataMessage *ms
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);
}
// Invoked during initialization
@@ 206,7 204,6 @@ sys::ReturnCodes EventManagerCommon::DeinitHandler()
EventWorker->close();
EventWorker.reset();
- EventWorker = nullptr;
return sys::ReturnCodes::Success;
}
M module-services/service-evtmgr/backlight-handler/BacklightHandlerCommon.hpp => module-services/service-evtmgr/backlight-handler/BacklightHandlerCommon.hpp +1 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, 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
#pragma once
M products/PurePhone/services/evtmgr/EventManager.cpp => products/PurePhone/services/evtmgr/EventManager.cpp +3 -3
@@ 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 <evtmgr/EventManager.hpp>
@@ 130,7 130,7 @@ void EventManager::toggleTorchColor()
void EventManager::ProcessCloseReason([[maybe_unused]] sys::CloseReason closeReason)
{
- backlightHandler.turnOffScreenLight();
+ backlightHandler.deinit();
}
sys::MessagePointer EventManager::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
@@ 170,7 170,7 @@ void EventManager::handleKeyEvent(sys::Message *msg)
{
EventManagerCommon::handleKeyEvent(msg);
- auto kbdMessage = dynamic_cast<sevm::KbdMessage *>(msg);
+ const auto kbdMessage = dynamic_cast<sevm::KbdMessage *>(msg);
if (kbdMessage->key.state == RawKey::State::Pressed) {
if (kbdMessage->key.keyCode == bsp::KeyCodes::FnRight) {
// Power key notification
M products/PurePhone/services/evtmgr/backlight-handler/BacklightHandler.cpp => products/PurePhone/services/evtmgr/backlight-handler/BacklightHandler.cpp +18 -3
@@ 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 <evtmgr/BacklightHandler.hpp>
@@ 42,7 42,7 @@ namespace backlight
parent,
[this](sys::Timer &t) { handleScreenLightTimeout(); }),
keypadLightTimer{sys::TimerFactory::createSingleShotTimer(
- parent, timers::keypadLightTimerName, timers::lightTimerTimeoutUnlocked, [this](sys::Timer &) {
+ parent, timers::keypadLightTimerName, timers::lightTimerTimeoutUnlocked, [](sys::Timer &) {
bsp::keypad_backlight::shutdown();
})}
{
@@ 66,7 66,7 @@ namespace backlight
using namespace screen_light_control;
settings->registerValueChange(settings::Brightness::brightnessLevel, [&](const std::string &value) {
- ManualModeParameters params{utils::getNumericValue<float>(value)};
+ const ManualModeParameters params{utils::getNumericValue<float>(value)};
screenLightController->processRequest(Action::setManualModeBrightness, Parameters(params));
});
@@ 83,6 83,8 @@ namespace backlight
}
screenLightController->processRequest(action);
});
+
+ isInitialized = true;
}
void Handler::turnOffScreenLight()
@@ 92,6 94,9 @@ namespace backlight
void Handler::handleKeyPressed(bsp::KeyCodes key)
{
+ if (!isInitialized) {
+ return;
+ }
if (!isKeyOnExclusionList(key)) {
handleKeypadLightRefresh();
handleScreenLightRefresh();
@@ 233,4 238,14 @@ namespace backlight
}
}
+ void Handler::deinit()
+ {
+ keypadLightTimer.stop();
+ getScreenLightTimer()->stop();
+
+ turnOffScreenLight();
+ bsp::keypad_backlight::shutdown();
+
+ isInitialized = false;
+ }
} // namespace backlight
M products/PurePhone/services/evtmgr/include/evtmgr/BacklightHandler.hpp => products/PurePhone/services/evtmgr/include/evtmgr/BacklightHandler.hpp +3 -1
@@ 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
#pragma once
@@ 24,6 24,7 @@ namespace backlight
Handler(std::shared_ptr<settings::Settings> settings, sys::Service *parent);
void init() override;
+ void deinit();
void turnOffScreenLight();
void handleKeyPressed(bsp::KeyCodes key = bsp::KeyCodes::Undefined);
/// Process request of the keypad light control
@@ 42,6 43,7 @@ namespace backlight
bsp::keypad_backlight::State keypadLightState = bsp::keypad_backlight::State::off;
bool isKeypadLightInCallMode = false;
bool isPhoneLocked = false;
+ bool isInitialized = false;
void startKeypadLightTimer();
void stopKeypadTimer();
M products/PurePhone/services/evtmgr/screen-light-control/ScreenLightControl.cpp => products/PurePhone/services/evtmgr/screen-light-control/ScreenLightControl.cpp +2 -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 "ScreenLightControl.hpp"
@@ 87,7 87,7 @@ namespace pure::screen_light_control
return lightOn;
}
- bool ScreenLightController::isAutoModeOn() const noexcept
+ auto ScreenLightController::isAutoModeOn() const noexcept -> bool
{
return automaticMode == ScreenLightMode::Automatic;
}
M pure_changelog.md => pure_changelog.md +1 -0
@@ 79,6 79,7 @@
* Fixed misleading popup on SMS send when modem is rebooting
* Fixed window redirection when clicking SMS icon
* Fixed navigation through the ringtone preview list to automatically switch playback to the currently selected option
+* Fixed crash when pressing button after turning off the phone with USB cable connected
## [1.5.0 2022-12-20]