~aleteoryx/muditaos

ref: 7188802f8e1bed65994ccf777407f88467bb2bb7 muditaos/module-services/service-appmgr/include/service-appmgr/model/ApplicationHandle.hpp -rw-r--r-- 2.0 KiB
7188802f — Mateusz Grzegorzek [BH-669] Fix CMake in service-appmgr 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <apps-common/Application.hpp>

#include <memory>
#include <string>

namespace app
{
    class ApplicationLauncher;
} // namespace app

namespace app::manager
{
    class ApplicationHandle
    {
      public:
        using State = app::Application::State;

        explicit ApplicationHandle(std::unique_ptr<app::ApplicationLauncher> &&_launcher);

        void setState(State state) noexcept;
        void run(sys::phone_modes::PhoneMode mode, sys::Service *caller);
        void runInBackground(sys::phone_modes::PhoneMode mode, sys::Service *caller);
        void close() noexcept;

        auto valid() const noexcept -> bool;
        auto name() const -> ApplicationName;
        auto state() const noexcept -> State;
        auto preventsAutoLocking() const noexcept -> bool;
        auto closeable() const noexcept -> bool;
        auto started() const noexcept -> bool;
        auto handles(actions::ActionId action) const noexcept -> bool;
        auto actionFlag(actions::ActionId action) const noexcept -> actions::ActionFlag;

        std::unique_ptr<app::ApplicationLauncher> launcher; // Handle to the application's start function.
        std::unique_ptr<gui::SwitchData> switchData;
        std::string switchWindow;
        bool blockClosing = false; //< Informs the application manager that this application mustn't be closed
                                   // temporarily. This flag is used to prevent application closing when application
                                   // is closeable and there is incoming call. This flag is also used when closeable
                                   // application is on front and there is a timeout to block the application.

        StartupReason startupReason = StartupReason::Launch; // Informs application about startup reason.

      private:
        auto getManifest() const -> const ApplicationManifest &;
    };
} // namespace app::manager