~aleteoryx/muditaos

d72743042bcd29e81f6f5e43e2b273f074cb96e5 — Dawid Wojtas 3 years ago c118677
[MOS-499] Turn off the one-minute screen refresh for quotes

Refresh lock screen only when clock wallpaper is set.
Remove unused items from status bar to avoid refresh
every minute.
M module-apps/apps-common/popups/lock-popups/PhoneLockedInfoWindow.cpp => module-apps/apps-common/popups/lock-popups/PhoneLockedInfoWindow.cpp +1 -1
@@ 94,11 94,11 @@ status_bar::Configuration PhoneLockedInfoWindow::configureStatusBar(status_bar::
{
    appConfiguration.disable(status_bar::Indicator::NetworkAccessTechnology);
    appConfiguration.disable(status_bar::Indicator::Time);
    appConfiguration.disable(status_bar::Indicator::SimCard);
    appConfiguration.enable(status_bar::Indicator::PhoneMode);
    appConfiguration.enable(status_bar::Indicator::Lock);
    appConfiguration.enable(status_bar::Indicator::Battery);
    appConfiguration.enable(status_bar::Indicator::Signal);
    appConfiguration.enable(status_bar::Indicator::SimCard);
    appConfiguration.enable(status_bar::Indicator::Bluetooth);
    appConfiguration.enable(status_bar::Indicator::AlarmClock);
    return appConfiguration;

M module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp => module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp +17 -18
@@ 22,7 22,7 @@ namespace gui

        preBuildDrawListHook = [this](std::list<Command> &cmd) {
            AppWindow::updateTime();
            wallpaperPresenter->updateTime();
            wallpaperPresenter->updateWallpaper();
        };
    }



@@ 74,24 74,31 @@ namespace gui

    RefreshModes PhoneLockedWindow::updateTime()
    {
        auto ret = AppWindow::updateTime();
        wallpaperPresenter->updateTime();
        updateStatusBar();
        RefreshModes mode;

        std::bitset<2> refresh;
        refresh[0] = AppWindow::updateTime() == RefreshModes::GUI_REFRESH_FAST;
        refresh[1] = wallpaperPresenter->updateWallpaper();

        deepRefreshCounter++;

        if (ret == RefreshModes::GUI_REFRESH_NONE) {
        if (refresh.none()) {
            LOG_DEBUG("Nothing to refresh on phone lock screen");
            return RefreshModes::GUI_REFRESH_NONE;
        }

        if (deepRefreshCounter.overflow()) {
            deepRefreshCounter.reset();
            LOG_DEBUG("Requesting deep refresh on phone lock screen");
            return RefreshModes::GUI_REFRESH_DEEP;
            mode = RefreshModes::GUI_REFRESH_DEEP;
        }
        else {
            mode = RefreshModes::GUI_REFRESH_FAST;
        }

        LOG_DEBUG("Requesting fast refresh on phone lock screen");
        return RefreshModes::GUI_REFRESH_FAST;
        LOG_DEBUG("Requesting %s refresh on phone lock screen (%s)",
                  mode == RefreshModes::GUI_REFRESH_FAST ? "fast" : "deep",
                  refresh.to_string().c_str());
        return mode;
    }

    bool PhoneLockedWindow::processLongReleaseEvent(const InputEvent &inputEvent)


@@ 140,7 147,7 @@ namespace gui
        appConfiguration.enable(status_bar::Indicator::Lock);
        appConfiguration.enable(status_bar::Indicator::Battery);
        appConfiguration.enable(status_bar::Indicator::Signal);
        appConfiguration.enable(status_bar::Indicator::SimCard);
        appConfiguration.disable(status_bar::Indicator::SimCard);
        appConfiguration.enable(status_bar::Indicator::Bluetooth);
        appConfiguration.enable(status_bar::Indicator::AlarmClock);



@@ 162,12 169,4 @@ namespace gui

        deepRefreshCounter.setReference(deepRefreshRate);
    }

    void PhoneLockedWindow::updateStatusBar()
    {
        updateSignalStrength();
        updateNetworkAccessTechnology();
        updateBatteryStatus();
        updateSim();
    }
} /* namespace gui */

M module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.hpp => module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.hpp +0 -2
@@ 64,8 64,6 @@ namespace gui
                return temp;
            }
        } deepRefreshCounter;

        void updateStatusBar();
    };

} /* namespace gui */

M module-apps/apps-common/popups/presenter/WallpaperPresenter.cpp => module-apps/apps-common/popups/presenter/WallpaperPresenter.cpp +15 -3
@@ 64,10 64,22 @@ namespace gui
        return notificationsModel;
    }

    void WallpaperPresenter::updateTime()
    bool WallpaperPresenter::updateWallpaper()
    {
        if (clockWallpaper) {
            clockWallpaper->updateTime();
        switch (selectedOption) {
        case WallpaperOption::Clock:
            if (clockWallpaper) {
                clockWallpaper->updateTime();
            }
            return true;
            break;
        case WallpaperOption::Quote:
            [[fallthrough]];
        case WallpaperOption::Logo:
            [[fallthrough]];
        default:
            return false;
            break;
        }
    }


M module-apps/apps-common/popups/presenter/WallpaperPresenter.hpp => module-apps/apps-common/popups/presenter/WallpaperPresenter.hpp +1 -1
@@ 18,7 18,7 @@ namespace gui
        WallpaperPresenter(app::ApplicationCommon *app);
        void setupWallpaper(Item *parent);
        std::shared_ptr<gui::NotificationsModel> getNotificationsModel();
        void updateTime();
        bool updateWallpaper();
        void forceClockWallpaper();
        /// returns true if actual switch back occured
        bool switchBackWallpaper();

M module-gui/gui/widgets/StatusBar.cpp => module-gui/gui/widgets/StatusBar.cpp +8 -5
@@ 380,17 380,21 @@ namespace gui::status_bar
        enabled ? networkAccessTechnology->show() : networkAccessTechnology->hide();
    }

    void StatusBar::showTime(bool enabled)
    bool StatusBar::showTime(bool enabled)
    {
        const auto visibilityChanged = time->isVisible() == enabled ? false : true;
        time->update();
        if (enabled) {
            centralBox->setMinimumSize(boxes::center::maxX, this->drawArea.h);
            time->show();
            lock->hide();
            centralBox->resizeItems();
            return;
        }
        time->hide();
        else {
            time->hide();
        }
        const auto refreshRequired = visibilityChanged || enabled;
        return refreshRequired;
    }

    void StatusBar::showLock(bool enabled)


@@ 409,8 413,7 @@ namespace gui::status_bar
        if (time == nullptr) {
            return false;
        }
        showTime(configuration.isEnabled(Indicator::Time));
        return true;
        return showTime(configuration.isEnabled(Indicator::Time));
    }

    void StatusBar::accept(GuiVisitor &visitor)

M module-gui/gui/widgets/StatusBar.hpp => module-gui/gui/widgets/StatusBar.hpp +1 -1
@@ 213,7 213,7 @@ namespace gui::status_bar

        /// Show/hide clock widget
        /// @param enabled true to show false to hide the widget
        void showTime(bool enabled);
        bool showTime(bool enabled);

        /// Show/hide lock status widget
        /// @param enabled true to show false to hide the widget