~aleteoryx/muditaos

2d7f9ad5b7f149c4b9015b50e16e447ff051b3de — Maciej Gibowicz 3 years ago f69d950
[MOS-515] Fix freezing on the on-boarding screen

The synchronization of the application startup
has been improved.
M module-services/service-appmgr/include/service-appmgr/model/ApplicationManagerCommon.hpp => module-services/service-appmgr/include/service-appmgr/model/ApplicationManagerCommon.hpp +2 -0
@@ 108,6 108,7 @@ namespace app::manager
        virtual auto handleActionOnFocusedApp(ActionEntry &action) -> ActionProcessStatus;
        virtual auto handleDisplayLanguageChange(DisplayLanguageChangeRequest *msg) -> bool;
        void rebuildActiveApplications();
        auto isApplicationStarting(ApplicationHandle &app) const noexcept -> bool;

        ApplicationName rootApplicationName;
        ActionsRegistry actionsRegistry;


@@ 119,6 120,7 @@ namespace app::manager
        void closeNoLongerNeededApplications();
        auto closeApplications() -> bool;
        void closeApplication(ApplicationHandle *application);
        auto getStartingApplication() const noexcept -> ApplicationHandle *;

        // Message handlers
        void handleActionRequest(ActionRequest *actionMsg);

M module-services/service-appmgr/model/ApplicationManagerCommon.cpp => module-services/service-appmgr/model/ApplicationManagerCommon.cpp +20 -3
@@ 381,9 381,9 @@ namespace app::manager

        auto currentlyFocusedApp = getFocusedApplication();
        if (currentlyFocusedApp == nullptr) {
            if (auto appState = app->state(); appState == ApplicationCommon::State::INITIALIZING ||
                                              appState == ApplicationCommon::State::ACTIVATING) {
                LOG_INFO("No focused application at the moment, but %s is starting already...", app->name().c_str());
            if (auto startingApplication = getStartingApplication(); startingApplication != nullptr) {
                LOG_INFO("No focused application at the moment, but %s is starting already...",
                         startingApplication->name().c_str());
                return false;
            }
            LOG_INFO("No focused application at the moment. Starting new application...");


@@ 857,4 857,21 @@ namespace app::manager
    {
        return sys::msgNotHandled();
    }

    auto ApplicationManagerCommon::isApplicationStarting(ApplicationHandle &app) const noexcept -> bool
    {
        return (app.state() == app::ApplicationCommon::State::INITIALIZING ||
                app.state() == app::ApplicationCommon::State::ACTIVATING);
    }

    auto ApplicationManagerCommon::getStartingApplication() const noexcept -> ApplicationHandle *
    {
        for (const auto &item : stack) {
            if (auto app = getApplication(item.appName); app != nullptr && isApplicationStarting(*app)) {
                return app;
            }
        }
        return nullptr;
    }

} // namespace app::manager

M products/PurePhone/services/appmgr/ApplicationManager.cpp => products/PurePhone/services/appmgr/ApplicationManager.cpp +5 -0
@@ 521,6 521,11 @@ namespace app::manager
    auto ApplicationManager::startApplication(ApplicationHandle &app) -> bool
    {
        if (not ApplicationManagerCommon::startApplication(app)) {
            if (ApplicationManagerCommon::isApplicationStarting(app)) {
                LOG_INFO("%s is starting already...", app.name().c_str());
                return false;
            }

            LOG_INFO("Starting application %s", app.name().c_str());
            StatusIndicators statusIndicators;
            statusIndicators.phoneMode        = phoneModeObserver->getCurrentPhoneMode();