M image/user/db/settings_v2_002-devel.sql => image/user/db/settings_v2_002-devel.sql +2 -1
@@ 43,6 43,7 @@ INSERT OR IGNORE INTO settings_tab (path, value) VALUES
('gs_current_timezone_name', ''),
('gs_current_timezone_rules', ''),
('\ServiceTime\\gs_automatic_date_and_time_is_on', '1'),
- ('\ServiceEink\\display_inverted_mode', '0');
+ ('\ServiceEink\\display_inverted_mode', '0'),
+ ('display_lock_screen_deep_refresh_rate', '30');
M image/user/db/settings_v2_002.sql => image/user/db/settings_v2_002.sql +2 -1
@@ 44,7 44,8 @@ INSERT OR IGNORE INTO settings_tab (path, value) VALUES
('gs_current_timezone_name', ''),
('gs_current_timezone_rules', ''),
('\ServiceTime\\gs_automatic_date_and_time_is_on', '1'),
- ('\ServiceEink\\display_inverted_mode', '0');
+ ('\ServiceEink\\display_inverted_mode', '0'),
+ ('display_lock_screen_deep_refresh_rate', '30');
M module-apps/application-desktop/windows/DesktopMainWindow.cpp => module-apps/application-desktop/windows/DesktopMainWindow.cpp +1 -1
@@ 211,7 211,7 @@ namespace gui
return app;
}
- bool DesktopMainWindow::updateTime()
+ RefreshModes DesktopMainWindow::updateTime()
{
auto ret = AppWindow::updateTime();
clockDate->setTime(std::time(nullptr));
M module-apps/application-desktop/windows/DesktopMainWindow.hpp => module-apps/application-desktop/windows/DesktopMainWindow.hpp +1 -1
@@ 46,7 46,7 @@ namespace gui
void destroyInterface() override;
status_bar::Configuration configureStatusBar(status_bar::Configuration appConfiguration) override;
- bool updateTime() override;
+ RefreshModes updateTime() override;
private:
bool resolveDialAction(const std::string &number);
M module-apps/apps-common/ApplicationCommon.cpp => module-apps/apps-common/ApplicationCommon.cpp +3 -15
@@ 467,13 467,9 @@ namespace app
sys::MessagePointer ApplicationCommon::handleMinuteUpdated(sys::Message *msgl)
{
- if (state == State::ACTIVE_FORGROUND && getCurrentWindow()->updateTime()) {
-
- if (isOnPhoneLockWindow()) {
- updateStatusBarOnPhoneLockWindow();
- }
-
- refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST);
+ if (state == State::ACTIVE_FORGROUND) {
+ auto requestedRefreshMode = getCurrentWindow()->updateTime();
+ refreshWindow(requestedRefreshMode);
}
return sys::msgHandled();
}
@@ 1050,12 1046,4 @@ namespace app
{
return getCurrentWindow()->getName() == gui::popup::window::phone_lock_window;
}
-
- void ApplicationCommon::updateStatusBarOnPhoneLockWindow()
- {
- getCurrentWindow()->updateSignalStrength();
- getCurrentWindow()->updateNetworkAccessTechnology();
- getCurrentWindow()->updateBatteryStatus();
- getCurrentWindow()->updateSim();
- }
} /* namespace app */
M module-apps/apps-common/ApplicationCommon.hpp => module-apps/apps-common/ApplicationCommon.hpp +0 -1
@@ 433,7 433,6 @@ namespace app
locks::SimLockSubject simLockSubject;
bool isOnPhoneLockWindow();
- void updateStatusBarOnPhoneLockWindow();
public:
[[nodiscard]] auto getPhoneLockSubject() noexcept -> locks::PhoneLockSubject &;
M => +49 -16
@@ 3,7 3,6 @@
#include "PhoneLockedWindow.hpp"
#include "PhoneLockedInfoData.hpp"
#include "Timers/TimerFactory.hpp"
#include <locks/input/PhoneLockedKeysWhitelist.hpp>
#include <service-appmgr/Controller.hpp>
@@ 14,18 13,17 @@ namespace gui
{
PhoneLockedWindow::PhoneLockedWindow(app::ApplicationCommon *app,
const std::string &name,
std::unique_ptr<WallpaperPresenter> &&presenter)
std::unique_ptr<WallpaperPresenter> &&presenter,
unsigned lockScreenDeepRefreshRate)
: AppWindow(app, name), wallpaperPresenter(std::move(presenter))
{
buildInterface();
initializeDeepRefreshCounter(lockScreenDeepRefreshRate);
preBuildDrawListHook = [this](std::list<Command> &cmd) { updateTime(); };
screenRefreshTimer =
sys::TimerFactory::createPeriodicTimer(application, refreshTimerName, refreshTimeout, [this](sys::Timer &) {
application->refreshWindow(RefreshModes::GUI_REFRESH_DEEP);
return;
});
preBuildDrawListHook = [this](std::list<Command> &cmd) {
AppWindow::updateTime();
wallpaperPresenter->updateTime();
};
}
void PhoneLockedWindow::buildInterface()
@@ 72,15 70,28 @@ namespace gui
navBar->setText(nav_bar::Side::Center, utils::translate("app_desktop_unlock"));
navBar->setActive(nav_bar::Side::Right, false);
}
screenRefreshTimer.start();
}
bool PhoneLockedWindow::updateTime()
RefreshModes PhoneLockedWindow::updateTime()
{
auto ret = AppWindow::updateTime();
wallpaperPresenter->updateTime();
return ret;
updateStatusBar();
deepRefreshCounter++;
if (ret == RefreshModes::GUI_REFRESH_NONE) {
return RefreshModes::GUI_REFRESH_NONE;
}
if (deepRefreshCounter.overflow()) {
deepRefreshCounter.reset();
LOG_DEBUG("Requesting deep refresh on phone lock screen");
return RefreshModes::GUI_REFRESH_DEEP;
}
LOG_DEBUG("Requesting fast refresh on phone lock screen");
return RefreshModes::GUI_REFRESH_FAST;
}
bool PhoneLockedWindow::processLongReleaseEvent(const InputEvent &inputEvent)
@@ 119,9 130,7 @@ namespace gui
}
void PhoneLockedWindow::onClose(Window::CloseReason reason)
{
screenRefreshTimer.stop();
}
{}
status_bar::Configuration PhoneLockedWindow::configureStatusBar(status_bar::Configuration appConfiguration)
{
@@ 137,4 146,28 @@ namespace gui
return appConfiguration;
}
void PhoneLockedWindow::initializeDeepRefreshCounter(unsigned deepRefreshRate)
{
constexpr auto fallbackDeepRefreshRate = 30;
deepRefreshCounter.reset(); // Clear the counter
if (deepRefreshRate == 0) {
LOG_ERROR("Invalid lock screen deep refresh value (%d) provided, fallback default (%d) loaded!",
deepRefreshRate,
fallbackDeepRefreshRate);
deepRefreshCounter.setReference(fallbackDeepRefreshRate);
return;
}
deepRefreshCounter.setReference(deepRefreshRate);
}
void PhoneLockedWindow::updateStatusBar()
{
updateSignalStrength();
updateNetworkAccessTechnology();
updateBatteryStatus();
updateSim();
}
} /* namespace gui */
M => +35 -5
@@ 18,7 18,8 @@ namespace gui
public:
PhoneLockedWindow(app::ApplicationCommon *app,
const std::string &name,
std::unique_ptr<WallpaperPresenter> &&presenter);
std::unique_ptr<WallpaperPresenter> &&presenter,
unsigned lockScreenDeepRefreshRate);
bool onInput(const InputEvent &inputEvent) override;
void onBeforeShow(ShowMode mode, SwitchData *data) override;
@@ 26,16 27,45 @@ namespace gui
void buildInterface() override;
status_bar::Configuration configureStatusBar(status_bar::Configuration appConfiguration) override;
bool updateTime() override;
RefreshModes updateTime() override;
private:
bool processLongReleaseEvent(const InputEvent &inputEvent);
static constexpr auto refreshTimerName = "PhoneLockRefreshTimer";
static constexpr auto refreshTimeout = std::chrono::hours(1);
sys::TimerHandle screenRefreshTimer;
std::unique_ptr<WallpaperPresenter> wallpaperPresenter;
bool refreshedOnPhoneLockTimeLock = false;
void initializeDeepRefreshCounter(unsigned deepRefreshRate);
struct
{
unsigned currentValue;
unsigned referenceValue;
[[nodiscard]] inline auto overflow() const noexcept -> bool
{
return currentValue >= referenceValue;
}
inline auto reset() noexcept -> void
{
currentValue = 0;
}
inline auto setReference(unsigned reference) noexcept -> void
{
referenceValue = reference;
}
inline auto operator++(int) noexcept -> unsigned
{
auto temp = currentValue;
currentValue++;
return temp;
}
} deepRefreshCounter;
void updateStatusBar();
};
} /* namespace gui */
M module-apps/apps-common/windows/AppWindow.cpp => module-apps/apps-common/windows/AppWindow.cpp +4 -4
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "AppWindow.hpp"
@@ 139,12 139,12 @@ namespace gui
return preventsAutoLock;
}
- bool AppWindow::updateTime()
+ RefreshModes AppWindow::updateTime()
{
if (statusBar == nullptr) {
- return false;
+ return RefreshModes::GUI_REFRESH_NONE;
}
- return statusBar->updateTime();
+ return statusBar->updateTime() ? RefreshModes::GUI_REFRESH_FAST : RefreshModes::GUI_REFRESH_NONE;
}
void AppWindow::setTitle(const UTF8 &text)
M module-apps/apps-common/windows/AppWindow.hpp => module-apps/apps-common/windows/AppWindow.hpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 73,7 73,7 @@ namespace gui
bool updateNetworkAccessTechnology();
void updatePhoneMode(sys::phone_modes::PhoneMode mode);
[[nodiscard]] bool preventsAutoLocking() const noexcept;
- virtual bool updateTime();
+ virtual RefreshModes updateTime();
void rebuild() override;
void buildInterface() override;
M module-gui/gui/Common.hpp => module-gui/gui/Common.hpp +4 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 62,6 62,7 @@ namespace gui
enum class RefreshModes
{
+ GUI_REFRESH_NONE,
GUI_REFRESH_FAST = 1,
GUI_REFRESH_DEEP
};
@@ 151,6 152,8 @@ namespace gui
inline const char *c_str(gui::RefreshModes refresh)
{
switch (refresh) {
+ case gui::RefreshModes::GUI_REFRESH_NONE:
+ return "GUI_REFRESH_NONE";
case gui::RefreshModes::GUI_REFRESH_FAST:
return "GUI_REFRESH_FAST";
case gui::RefreshModes::GUI_REFRESH_DEEP:
M module-services/service-db/agents/settings/SystemSettings.hpp => module-services/service-db/agents/settings/SystemSettings.hpp +1 -0
@@ 82,5 82,6 @@ namespace settings
namespace Display
{
constexpr inline auto invertedMode = "display_inverted_mode";
+ constexpr inline auto lockScreenDeepRefreshRate = "display_lock_screen_deep_refresh_rate";
} // namespace Display
}; // namespace settings
M products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsProgressWindow.cpp => products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsProgressWindow.cpp +3 -3
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "BGSoundsProgressWindow.hpp"
@@ 162,11 162,11 @@ namespace gui
time->setTimeFormat(fmt);
}
- bool BGSoundsProgressWindow::updateTime()
+ RefreshModes BGSoundsProgressWindow::updateTime()
{
if (presenter) {
presenter->handleUpdateTimeEvent();
}
- return true;
+ return RefreshModes::GUI_REFRESH_NONE;
}
} // namespace gui
M products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsProgressWindow.hpp => products/BellHybrid/apps/application-bell-background-sounds/windows/BGSoundsProgressWindow.hpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 27,7 27,7 @@ namespace gui
void setTime(std::time_t newTime) override;
void setTimeFormat(utils::time::Locale::TimeFormat fmt) override;
- bool updateTime() override;
+ RefreshModes updateTime() override;
void buildLayout();
void configureTimer();
M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp => products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp +2 -2
@@ 164,12 164,12 @@ namespace gui
presenter->handleAlarmRingingEvent();
}
}
- bool BellHomeScreenWindow::updateTime()
+ RefreshModes BellHomeScreenWindow::updateTime()
{
if (presenter) {
presenter->handleUpdateTimeEvent();
}
- return true;
+ return RefreshModes::GUI_REFRESH_NONE;
}
bool BellHomeScreenWindow::updateBatteryStatus()
M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp => products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.hpp +1 -1
@@ 22,7 22,7 @@ namespace gui
private:
void buildInterface() override;
void setLayout(LayoutGenerator layoutGenerator) override;
- bool updateTime() override;
+ RefreshModes updateTime() override;
bool onInput(const InputEvent &inputEvent) override;
void onBeforeShow(ShowMode mode, SwitchData *data) override;
bool onDatabaseMessage(sys::Message *msg) override;
M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp => products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.cpp +2 -2
@@ 164,12 164,12 @@ namespace gui
time->setTimeFormat(fmt);
}
- bool MeditationRunningWindow::updateTime()
+ RefreshModes MeditationRunningWindow::updateTime()
{
if (presenter != nullptr) {
presenter->handleUpdateTimeEvent();
}
- return true;
+ return RefreshModes::GUI_REFRESH_FAST;
}
void MeditationRunningWindow::intervalTimeout()
M products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.hpp => products/BellHybrid/apps/application-bell-meditation-timer/windows/MeditationRunningWindow.hpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 36,7 36,7 @@ namespace gui
void setTime(std::time_t newTime) override;
void setTimeFormat(utils::time::Locale::TimeFormat fmt) override;
- bool updateTime() override;
+ RefreshModes updateTime() override;
void buildLayout();
void configureTimer();
M products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp => products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.cpp +2 -2
@@ 138,12 138,12 @@ namespace gui
time->setTimeFormat(fmt);
}
- bool PowerNapProgressWindow::updateTime()
+ RefreshModes PowerNapProgressWindow::updateTime()
{
if (presenter) {
presenter->handleUpdateTimeEvent();
}
- return true;
+ return RefreshModes::GUI_REFRESH_NONE;
}
void PowerNapProgressWindow::onBeforeShow(ShowMode mode, SwitchData *data)
M products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp => products/BellHybrid/apps/application-bell-powernap/windows/PowerNapProgressWindow.hpp +2 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 23,7 23,7 @@ namespace gui
void setTime(std::time_t newTime);
void setTimeFormat(utils::time::Locale::TimeFormat fmt);
- bool updateTime() override;
+ RefreshModes updateTime() override;
void buildLayout();
void configureTimer();
M products/PurePhone/apps/Application.cpp => products/PurePhone/apps/Application.cpp +9 -6
@@ 19,6 19,7 @@
#include <popups/lock-popups/SimLockInputWindow.hpp>
#include <popups/lock-popups/SimInfoWindow.hpp>
#include <popups/lock-popups/SimNotReadyWindow.hpp>
+#include <service-db/agents/settings/SystemSettings.hpp>
namespace app
{
@@ 30,7 31,6 @@ namespace app
window->updateSim();
window->updateSignalStrength();
window->updateNetworkAccessTechnology();
- window->updateTime();
window->updatePhoneMode(statusIndicators.phoneMode);
}
@@ 78,11 78,14 @@ namespace app
case ID::PhoneLockInput:
case ID::PhoneLockInfo:
case ID::PhoneLockChangeInfo:
- windowsFactory.attach(window::phone_lock_window, [](ApplicationCommon *app, const std::string &name) {
- auto presenter = std::make_unique<gui::WallpaperPresenter>(app);
- return std::make_unique<gui::PhoneLockedWindow>(
- app, window::phone_lock_window, std::move(presenter));
- });
+ windowsFactory.attach(
+ window::phone_lock_window, [this](ApplicationCommon *app, const std::string &name) {
+ auto presenter = std::make_unique<gui::WallpaperPresenter>(app);
+ auto lockScreenDeepRefreshRate = utils::getNumericValue<unsigned>(settings->getValue(
+ settings::Display::lockScreenDeepRefreshRate, settings::SettingsScope::Global));
+ return std::make_unique<gui::PhoneLockedWindow>(
+ app, window::phone_lock_window, std::move(presenter), lockScreenDeepRefreshRate);
+ });
windowsFactory.attach(
window::phone_lock_info_window, [](ApplicationCommon *app, const std::string &name) {
return std::make_unique<gui::PhoneLockedInfoWindow>(app, window::phone_lock_info_window);