~aleteoryx/muditaos

92940f0c196aa89955b5fb02955826a0a3edd597 — Maciej Gibowicz 3 years ago 3cf1d87
[MOS-453] Fix HF on Low Battery Notification

Fix in action handling in ApplicationManager
M module-services/service-appmgr/include/service-appmgr/model/ActionsRegistry.hpp => module-services/service-appmgr/include/service-appmgr/model/ActionsRegistry.hpp +2 -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


@@ 54,6 54,7 @@ namespace app::manager

        void enqueue(ActionEntry &&action);
        void finished();
        void process();

        [[nodiscard]] auto hasPendingAction() const noexcept -> bool;
        [[nodiscard]] auto getPendingAction() noexcept -> ActionEntry *;

M module-services/service-appmgr/model/ActionsRegistry.cpp => module-services/service-appmgr/model/ActionsRegistry.cpp +6 -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

#include "ActionsRegistry.hpp"


@@ 53,6 53,11 @@ namespace app::manager
        LOG_INFO("Enqueue action %s", magic_enum::enum_name(action.actionId).data());

        addAction(std::move(action));
        process();
    }

    void ActionsRegistry::process()
    {
        if (!isCurrentlyProcessing()) {
            notifyAboutNextAction();
        }

M module-services/service-appmgr/model/ApplicationManagerCommon.cpp => module-services/service-appmgr/model/ApplicationManagerCommon.cpp +4 -4
@@ 560,8 560,9 @@ namespace app::manager
                                       (actionParams && actionParams->disableAppClose));
        SwitchRequest switchRequest(
            service::name::appmgr, targetApp->name(), targetApp->switchWindow, std::move(targetApp->switchData));
        return handleSwitchApplication(&switchRequest, focusedAppClose) ? ActionProcessStatus::Accepted
                                                                        : ActionProcessStatus::Skipped;
        handleSwitchApplication(&switchRequest, focusedAppClose);

        return ActionProcessStatus::Skipped;
    }

    auto ApplicationManagerCommon::handleCustomActionOnBackgroundApp(ApplicationHandle *app, ActionEntry &action)


@@ 749,6 750,7 @@ namespace app::manager
        app.startupReason = StartupReason::Launch;

        if (!actionsRegistry.hasPendingAction()) {
            actionsRegistry.process();
            return;
        }



@@ 764,8 766,6 @@ namespace app::manager
            actionsRegistry.finished();
            break;
        default: {
            auto &params = action->params;
            app::ApplicationCommon::requestAction(this, app.name(), action->actionId, std::move(params));
            break;
        }
        }