Merge develop into main (#348)

## App state

Improved app state management in `LoaderService` and `GuiService`:

- Re-ordered some of the state transitions
- Hardened `GuiService` for repeated events (that might trigger a re-render of an app that's already rendered)
- Validate state transitions in `LoaderService` and crash if an app transitions from the wrong state to the next one.

## LoaderService

- Removed `tt::loader::` functions and expose `LoaderService` interface publicly.
- Implement `stopAll()` and `stopAll(id)` which stops all instances of an app, including any apps that were launched by it.
- Rename `stop()` functions to `stopTop()`
- Created `stopTop(id)` which only stops the top-most app when the app id matches.
- Moved `loader::LoaderEvent` to `loader::LoaderService::Event`
- Changed app instance `std::stack` to `std::vector`

## Improvements

- `ElfApp`: error 22 now shows a hint that `main()` might be missing
- Starting, installing and uninstalling apps now stops any running app (and its children) on the stack

## Bugfixes

- `HttpdReq` out of memory issue now shows an error message and doesn't crash anymore (this would happen on devices without PSRAM with WiFi active, when an app was installed)
- `GuiService::hideApp()` lock should not wait for timeout and now waits indefinitely
- `Buildscript/release-sdk-current.sh` deletes the previous local release before building a new one

## Code correctness

- App classes were made `final`
- Apps that had a `void start()` now have a `LaunchId start()`
- `tt::app::State`: renamed `Started` to `Created` and `Stopped` to `Destroyed` to properly reflect earlier name changes
This commit is contained in:
Ken Van Hoeylandt
2025-09-27 18:04:09 +02:00
committed by GitHub
parent dcf28d0868
commit f6cdabf3c0
48 changed files with 504 additions and 342 deletions
+31 -4
View File
@@ -3,20 +3,47 @@
namespace tt::app {
constexpr auto* TAG = "App";
LaunchId start(const std::string& id, std::shared_ptr<const Bundle> _Nullable parameters) {
return service::loader::startApp(id, std::move(parameters));
const auto service = service::loader::findLoaderService();
assert(service != nullptr);
return service->start(id, std::move(parameters));
}
void stop() {
service::loader::stopApp();
const auto service = service::loader::findLoaderService();
assert(service != nullptr);
service->stopTop();
}
void stop(const std::string& id) {
const auto service = service::loader::findLoaderService();
assert(service != nullptr);
service->stopTop(id);
}
void stopAll(const std::string& id) {
const auto service = service::loader::findLoaderService();
assert(service != nullptr);
service->stopAll(id);
}
bool isRunning(const std::string& id) {
const auto service = service::loader::findLoaderService();
assert(service != nullptr);
return service->isRunning(id);
}
std::shared_ptr<AppContext> _Nullable getCurrentAppContext() {
return service::loader::getCurrentAppContext();
const auto service = service::loader::findLoaderService();
assert(service != nullptr);
return service->getCurrentAppContext();
}
std::shared_ptr<App> _Nullable getCurrentApp() {
return service::loader::getCurrentApp();
const auto app_context = getCurrentAppContext();
return (app_context != nullptr) ? app_context->getApp() : nullptr;
}
}
+11
View File
@@ -174,6 +174,11 @@ bool install(const std::string& path) {
return false;
}
// If the app was already running, then stop it
if (isRunning(manifest.appId)) {
stopAll(manifest.appId);
}
target_path_lock.lock();
const std::string renamed_target_path = std::format("{}/{}", app_parent_path, manifest.appId);
if (file::isDirectory(renamed_target_path)) {
@@ -202,6 +207,12 @@ bool install(const std::string& path) {
bool uninstall(const std::string& appId) {
TT_LOG_I(TAG, "Uninstalling app %s", appId.c_str());
// If the app was running, then stop it
if (isRunning(appId)) {
stopAll(appId);
}
auto app_path = getAppInstallPath(appId);
return file::withLock<bool>(app_path, [&app_path, &appId] {
if (!file::isDirectory(app_path)) {
+4 -2
View File
@@ -23,6 +23,8 @@ static std::string getErrorCodeString(int error_code) {
return "out of memory";
case ENOSYS:
return "missing symbol";
case EINVAL:
return "invalid argument or main() missing";
default:
return std::format("code {}", error_code);
}
@@ -137,14 +139,14 @@ public:
staticParametersSetCount = 0;
if (!startElf()) {
service::loader::stopApp();
stop();
auto message = lastError.empty() ? "Application failed to start." : std::format("Application failed to start: {}", lastError);
alertdialog::start("Error", message);
return;
}
if (staticParametersSetCount == 0) {
service::loader::stopApp();
stop();
alertdialog::start("Error", "Application failed to start: application failed to register itself");
return;
}
@@ -28,7 +28,7 @@ LaunchId start(const std::string& title, const std::string& message, const std::
bundle->putString(PARAMETER_BUNDLE_KEY_TITLE, title);
bundle->putString(PARAMETER_BUNDLE_KEY_MESSAGE, message);
bundle->putString(PARAMETER_BUNDLE_KEY_BUTTON_LABELS, items_joined);
return service::loader::startApp(manifest.appId, bundle);
return app::start(manifest.appId, bundle);
}
LaunchId start(const std::string& title, const std::string& message) {
@@ -36,7 +36,7 @@ LaunchId start(const std::string& title, const std::string& message) {
bundle->putString(PARAMETER_BUNDLE_KEY_TITLE, title);
bundle->putString(PARAMETER_BUNDLE_KEY_MESSAGE, message);
bundle->putString(PARAMETER_BUNDLE_KEY_BUTTON_LABELS, "OK");
return service::loader::startApp(manifest.appId, bundle);
return app::start(manifest.appId, bundle);
}
int32_t getResultIndex(const Bundle& bundle) {
@@ -72,9 +72,9 @@ private:
auto bundle = std::make_unique<Bundle>();
bundle->putInt32(RESULT_BUNDLE_KEY_INDEX, (int32_t)index);
setResult(app::Result::Ok, std::move(bundle));
setResult(Result::Ok, std::move(bundle));
service::loader::stopApp();
stop(manifest.appId);
}
static void createButton(lv_obj_t* parent, const std::string& text, size_t index) {
+5 -5
View File
@@ -1,6 +1,6 @@
#include "Tactility/app/AppRegistration.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/lvgl/Toolbar.h"
#include <Tactility/app/AppRegistration.h>
#include <Tactility/service/loader/Loader.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/Assets.h>
@@ -9,11 +9,11 @@
namespace tt::app::applist {
class AppListApp : public App {
class AppListApp final : public App {
static void onAppPressed(lv_event_t* e) {
const auto* manifest = static_cast<const AppManifest*>(lv_event_get_user_data(e));
service::loader::startApp(manifest->appId);
start(manifest->appId);
}
static void createAppWidget(const std::shared_ptr<AppManifest>& manifest, lv_obj_t* list) {
+3 -2
View File
@@ -24,6 +24,7 @@
namespace tt::app::boot {
constexpr auto* TAG = "Boot";
extern const AppManifest manifest;
static std::shared_ptr<hal::display::DisplayDevice> getHalDisplay() {
return hal::findFirstDevice<hal::display::DisplayDevice>(hal::Device::Type::Display);
@@ -107,7 +108,7 @@ class BootApp : public App {
TT_LOG_I(TAG, "initFromBootApp");
initFromBootApp();
waitForMinimalSplashDuration(start_time);
service::loader::stopApp();
stop(manifest.appId);
startNextApp();
}
@@ -128,7 +129,7 @@ class BootApp : public App {
return;
}
service::loader::startApp(boot_properties.launcherAppId);
start(boot_properties.launcherAppId);
}
static int getSmallestDimension() {
@@ -15,8 +15,10 @@
namespace tt::app::crashdiagnostics {
extern const AppManifest manifest;
void onContinuePressed(TT_UNUSED lv_event_t* event) {
service::loader::stopApp();
stop(manifest.appId);
launcher::start();
}
@@ -48,7 +50,7 @@ public:
int qr_version;
if (!getQrVersionForBinaryDataLength(url_length, qr_version)) {
TT_LOG_E(TAG, "QR is too large");
service::loader::stopApp();
stop(manifest.appId);
return;
}
@@ -56,7 +58,7 @@ public:
auto qrcodeData = std::make_shared<uint8_t[]>(qrcode_getBufferSize(qr_version));
if (qrcodeData == nullptr) {
TT_LOG_E(TAG, "Failed to allocate QR buffer");
service::loader::stopApp();
stop();
return;
}
@@ -64,7 +66,7 @@ public:
TT_LOG_I(TAG, "QR init text");
if (qrcode_initText(&qrcode, qrcodeData.get(), qr_version, ECC_LOW, url.c_str()) != 0) {
TT_LOG_E(TAG, "QR init text failed");
service::loader::stopApp();
stop(manifest.appId);
return;
}
@@ -84,7 +86,7 @@ public:
pixel_size = 1;
} else {
TT_LOG_E(TAG, "QR code won't fit screen");
service::loader::stopApp();
stop(manifest.appId);
return;
}
@@ -99,7 +101,7 @@ public:
auto* draw_buf = lv_draw_buf_create(pixel_size * qrcode.size, pixel_size * qrcode.size, LV_COLOR_FORMAT_RGB565, LV_STRIDE_AUTO);
if (draw_buf == nullptr) {
TT_LOG_E(TAG, "Draw buffer alloc");
service::loader::stopApp();
stop(manifest.appId);
return;
}
@@ -130,7 +132,7 @@ extern const AppManifest manifest = {
};
void start() {
service::loader::startApp(manifest.appId);
app::start(manifest.appId);
}
} // namespace
@@ -1,10 +1,7 @@
#ifdef ESP_PLATFORM
#include "Tactility/lvgl/Lvgl.h"
#include <Tactility/Tactility.h>
#include <Tactility/app/AppManifest.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/lvgl/Style.h>
#include <Tactility/lvgl/Toolbar.h>
@@ -12,6 +9,7 @@
#include <Tactility/service/development/DevelopmentSettings.h>
#include <Tactility/service/loader/Loader.h>
#include <Tactility/service/wifi/Wifi.h>
#include <Tactility/Tactility.h>
#include <Tactility/Timer.h>
#include <cstring>
@@ -20,6 +18,7 @@
namespace tt::app::development {
constexpr const char* TAG = "Development";
extern const AppManifest manifest;
class DevelopmentApp final : public App {
@@ -85,7 +84,7 @@ public:
service = service::development::findService();
if (service == nullptr) {
TT_LOG_E(TAG, "Service not found");
service::loader::stopApp();
stop(manifest.appId);
}
}
+1 -1
View File
@@ -42,7 +42,7 @@ extern const AppManifest manifest = {
};
void start() {
service::loader::startApp(manifest.appId);
app::start(manifest.appId);
}
} // namespace
@@ -45,7 +45,7 @@ public:
auto bundle = std::make_unique<Bundle>();
bundle->putString("path", path);
setResult(Result::Ok, std::move(bundle));
service::loader::stopApp();
stop(manifest.appId);
});
}
@@ -67,13 +67,13 @@ extern const AppManifest manifest = {
LaunchId startForExistingFile() {
auto bundle = std::make_shared<Bundle>();
setMode(*bundle, Mode::Existing);
return service::loader::startApp(manifest.appId, bundle);
return start(manifest.appId, bundle);
}
LaunchId startForExistingOrNewFile() {
auto bundle = std::make_shared<Bundle>();
setMode(*bundle, Mode::ExistingOrNew);
return service::loader::startApp(manifest.appId, bundle);
return start(manifest.appId, bundle);
}
} // namespace
@@ -410,8 +410,8 @@ extern const AppManifest manifest = {
.createApp = create<I2cScannerApp>
};
void start() {
service::loader::startApp(manifest.appId);
LaunchId start() {
return app::start(manifest.appId);
}
} // namespace
@@ -1,7 +1,6 @@
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/lvgl/Style.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/service/loader/Loader.h>
#include <Tactility/TactilityCore.h>
#include <Tactility/StringUtils.h>
@@ -11,10 +10,10 @@ namespace tt::app::imageviewer {
extern const AppManifest manifest;
#define TAG "image_viewer"
#define IMAGE_VIEWER_FILE_ARGUMENT "file"
constexpr auto* TAG = "ImageViewer";
constexpr auto* IMAGE_VIEWER_FILE_ARGUMENT = "file";
class ImageViewerApp : public App {
class ImageViewerApp final : public App {
void onShow(AppContext& app, lv_obj_t* parent) override {
auto wrapper = lv_obj_create(parent);
@@ -67,10 +66,10 @@ extern const AppManifest manifest = {
.createApp = create<ImageViewerApp>
};
void start(const std::string& file) {
LaunchId start(const std::string& file) {
auto parameters = std::make_shared<Bundle>();
parameters->putString(IMAGE_VIEWER_FILE_ARGUMENT, file);
service::loader::startApp(manifest.appId, parameters);
return app::start(manifest.appId, parameters);
}
} // namespace
@@ -1,32 +1,31 @@
#include "Tactility/app/inputdialog/InputDialog.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/app/inputdialog/InputDialog.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/service/loader/Loader.h>
#include <Tactility/TactilityCore.h>
#include <lvgl.h>
namespace tt::app::inputdialog {
#define PARAMETER_BUNDLE_KEY_TITLE "title"
#define PARAMETER_BUNDLE_KEY_MESSAGE "message"
#define PARAMETER_BUNDLE_KEY_PREFILLED "prefilled"
#define RESULT_BUNDLE_KEY_RESULT "result"
constexpr auto* PARAMETER_BUNDLE_KEY_TITLE = "title";
constexpr auto* PARAMETER_BUNDLE_KEY_MESSAGE = "message";
constexpr auto* PARAMETER_BUNDLE_KEY_PREFILLED = "prefilled";
constexpr auto* RESULT_BUNDLE_KEY_RESULT = "result";
#define DEFAULT_TITLE "Input"
constexpr auto* DEFAULT_TITLE = "Input";
#define TAG "input_dialog"
constexpr auto* TAG = "InputDialog";
extern const AppManifest manifest;
class InputDialogApp;
void start(const std::string& title, const std::string& message, const std::string& prefilled) {
LaunchId start(const std::string& title, const std::string& message, const std::string& prefilled) {
auto bundle = std::make_shared<Bundle>();
bundle->putString(PARAMETER_BUNDLE_KEY_TITLE, title);
bundle->putString(PARAMETER_BUNDLE_KEY_MESSAGE, message);
bundle->putString(PARAMETER_BUNDLE_KEY_PREFILLED, prefilled);
service::loader::startApp(manifest.appId, bundle);
return app::start(manifest.appId, bundle);
}
std::string getResult(const Bundle& bundle) {
@@ -44,7 +43,7 @@ static std::string getTitleParameter(const std::shared_ptr<const Bundle>& bundle
}
}
class InputDialogApp : public App {
class InputDialogApp final : public App {
static void createButton(lv_obj_t* parent, const std::string& text, void* callbackContext) {
lv_obj_t* button = lv_button_create(parent);
@@ -73,7 +72,7 @@ class InputDialogApp : public App {
setResult(Result::Cancelled);
}
service::loader::stopApp();
stop(manifest.appId);
}
public:
+4 -4
View File
@@ -60,7 +60,7 @@ class LauncherApp final : public App {
static void onAppPressed(TT_UNUSED lv_event_t* e) {
auto* appId = static_cast<const char*>(lv_event_get_user_data(e));
service::loader::startApp(appId);
start(appId);
}
static void onPowerOffPressed(lv_event_t* e) {
@@ -76,7 +76,7 @@ public:
settings::BootSettings boot_properties;
if (settings::loadBootSettings(boot_properties) && !boot_properties.autoStartAppId.empty()) {
TT_LOG_I(TAG, "Starting %s", boot_properties.autoStartAppId.c_str());
service::loader::startApp(boot_properties.autoStartAppId);
start(boot_properties.autoStartAppId);
}
}
@@ -144,8 +144,8 @@ extern const AppManifest manifest = {
.createApp = create<LauncherApp>
};
void start() {
service::loader::startApp(manifest.appId);
LaunchId start() {
return app::start(manifest.appId);
}
} // namespace
@@ -5,12 +5,12 @@
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/service/loader/Loader.h>
#include <Tactility/settings/Time.h>
#include <Tactility/StringUtils.h>
#include <Tactility/settings/Language.h>
#include <lvgl.h>
#include <map>
#include <sstream>
#include <Tactility/StringUtils.h>
#include <Tactility/settings/Language.h>
namespace tt::app::localesettings {
@@ -18,7 +18,7 @@ constexpr auto* TAG = "LocaleSettings";
extern const AppManifest manifest;
class LocaleSettingsApp : public App {
class LocaleSettingsApp final : public App {
tt::i18n::TextResources textResources = tt::i18n::TextResources("/system/app/LocaleSettings/i18n");
Mutex mutex = Mutex(Mutex::Type::Recursive);
lv_obj_t* timeZoneLabel = nullptr;
@@ -169,8 +169,8 @@ extern const AppManifest manifest = {
.createApp = create<LocaleSettingsApp>
};
void start() {
service::loader::startApp(manifest.appId);
LaunchId start() {
return app::start(manifest.appId);
}
} // namespace
+11 -10
View File
@@ -1,10 +1,10 @@
#include "Tactility/app/AppManifest.h"
#include "Tactility/app/fileselection/FileSelection.h"
#include "Tactility/file/FileLock.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/Assets.h"
#include <Tactility/app/AppManifest.h>
#include <Tactility/app/fileselection/FileSelection.h>
#include <Tactility/file/FileLock.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/service/loader/Loader.h>
#include <Tactility/Assets.h>
#include <Tactility/file/File.h>
@@ -15,7 +15,7 @@ namespace tt::app::notes {
constexpr auto* TAG = "Notes";
constexpr auto* NOTES_FILE_ARGUMENT = "file";
class NotesApp : public App {
class NotesApp final : public App {
lv_obj_t* uiCurrentFileName;
lv_obj_t* uiDropDownMenu;
@@ -213,9 +213,10 @@ extern const AppManifest manifest = {
.createApp = create<NotesApp>
};
void start(const std::string& filePath) {
LaunchId start(const std::string& filePath) {
auto parameters = std::make_shared<Bundle>();
parameters->putString(NOTES_FILE_ARGUMENT, filePath);
service::loader::startApp(manifest.appId, parameters);
return app::start(manifest.appId, parameters);
}
} // namespace tt::app::notes
@@ -1,8 +1,7 @@
#include "Tactility/app/selectiondialog/SelectionDialog.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/app/selectiondialog/SelectionDialog.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/service/loader/Loader.h>
#include <Tactility/StringUtils.h>
#include <Tactility/TactilityCore.h>
@@ -10,23 +9,23 @@
namespace tt::app::selectiondialog {
#define PARAMETER_BUNDLE_KEY_TITLE "title"
#define PARAMETER_BUNDLE_KEY_ITEMS "items"
#define RESULT_BUNDLE_KEY_INDEX "index"
constexpr auto* PARAMETER_BUNDLE_KEY_TITLE = "title";
constexpr auto* PARAMETER_BUNDLE_KEY_ITEMS = "items";
constexpr auto* RESULT_BUNDLE_KEY_INDEX = "index";
#define PARAMETER_ITEM_CONCATENATION_TOKEN ";;"
#define DEFAULT_TITLE "Select..."
constexpr auto* PARAMETER_ITEM_CONCATENATION_TOKEN = ";;";
constexpr auto* DEFAULT_TITLE = "Select...";
#define TAG "selection_dialog"
constexpr auto* TAG = "SelectionDialog";
extern const AppManifest manifest;
void start(const std::string& title, const std::vector<std::string>& items) {
LaunchId start(const std::string& title, const std::vector<std::string>& items) {
std::string items_joined = string::join(items, PARAMETER_ITEM_CONCATENATION_TOKEN);
auto bundle = std::make_shared<Bundle>();
bundle->putString(PARAMETER_BUNDLE_KEY_TITLE, title);
bundle->putString(PARAMETER_BUNDLE_KEY_ITEMS, items_joined);
service::loader::startApp(manifest.appId, bundle);
return app::start(manifest.appId, bundle);
}
int32_t getResultIndex(const Bundle& bundle) {
@@ -44,9 +43,7 @@ static std::string getTitleParameter(std::shared_ptr<const Bundle> bundle) {
}
}
class SelectionDialogApp : public App {
private:
class SelectionDialogApp final : public App {
static void onListItemSelectedCallback(lv_event_t* e) {
auto app = std::static_pointer_cast<SelectionDialogApp>(getCurrentApp());
@@ -59,8 +56,8 @@ private:
TT_LOG_I(TAG, "Selected item at index %d", index);
auto bundle = std::make_unique<Bundle>();
bundle->putInt32(RESULT_BUNDLE_KEY_INDEX, (int32_t)index);
setResult(app::Result::Ok, std::move(bundle));
service::loader::stopApp();
setResult(Result::Ok, std::move(bundle));
stop(manifest.appId);
}
static void createChoiceItem(void* parent, const std::string& title, size_t index) {
@@ -90,12 +87,12 @@ public:
if (items.empty() || items.front().empty()) {
TT_LOG_E(TAG, "No items provided");
setResult(Result::Error);
service::loader::stopApp();
stop(manifest.appId);
} else if (items.size() == 1) {
auto result_bundle = std::make_unique<Bundle>();
result_bundle->putInt32(RESULT_BUNDLE_KEY_INDEX, 0);
setResult(Result::Ok, std::move(result_bundle));
service::loader::stopApp();
stop(manifest.appId);
TT_LOG_W(TAG, "Auto-selecting single item");
} else {
size_t index = 0;
@@ -106,7 +103,7 @@ public:
} else {
TT_LOG_E(TAG, "No items provided");
setResult(Result::Error);
service::loader::stopApp();
stop(manifest.appId);
}
}
};
+6 -6
View File
@@ -1,6 +1,6 @@
#include "Tactility/app/AppRegistration.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/app/AppRegistration.h>
#include <Tactility/lvgl/Toolbar.h>
#include <Tactility/service/loader/Loader.h>
#include <Tactility/Assets.h>
#include <Tactility/Check.h>
@@ -12,7 +12,7 @@ namespace tt::app::settings {
static void onAppPressed(lv_event_t* e) {
const auto* manifest = static_cast<const AppManifest*>(lv_event_get_user_data(e));
service::loader::startApp(manifest->appId);
start(manifest->appId);
}
static void createWidget(const std::shared_ptr<AppManifest>& manifest, void* parent) {
@@ -23,7 +23,7 @@ static void createWidget(const std::shared_ptr<AppManifest>& manifest, void* par
lv_obj_add_event_cb(btn, &onAppPressed, LV_EVENT_SHORT_CLICKED, (void*)manifest.get());
}
class SettingsApp : public App {
class SettingsApp final : public App {
void onShow(AppContext& app, lv_obj_t* parent) override {
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
@@ -36,7 +36,7 @@ class SettingsApp : public App {
lv_obj_set_flex_grow(list, 1);
auto manifests = getApps();
std::sort(manifests.begin(), manifests.end(), SortAppManifestByName);
std::ranges::sort(manifests, SortAppManifestByName);
for (const auto& manifest: manifests) {
if (manifest->appCategory == Category::Settings) {
createWidget(manifest, list);
@@ -12,7 +12,7 @@ constexpr auto* TAG = "TimeDate";
extern const AppManifest manifest;
class TimeDateSettingsApp : public App {
class TimeDateSettingsApp final : public App {
Mutex mutex = Mutex(Mutex::Type::Recursive);
@@ -64,8 +64,8 @@ extern const AppManifest manifest = {
.createApp = create<TimeDateSettingsApp>
};
void start() {
service::loader::startApp(manifest.appId);
LaunchId start() {
return app::start(manifest.appId);
}
} // namespace
+3 -4
View File
@@ -104,8 +104,7 @@ class TimeZoneApp final : public App {
setResultCode(*bundle, entry.code);
setResult(Result::Ok, std::move(bundle));
service::loader::stopApp();
stop(manifest.appId);
}
static void createListItem(lv_obj_t* list, const std::string& title, size_t index) {
@@ -234,8 +233,8 @@ extern const AppManifest manifest = {
.createApp = create<TimeZoneApp>
};
void start() {
service::loader::startApp(manifest.appId);
LaunchId start() {
return app::start(manifest.appId);
}
}
@@ -33,7 +33,7 @@ void WifiConnect::onWifiEvent(service::wifi::WifiEvent event) {
case service::wifi::WifiEvent::ConnectionSuccess:
if (getState().isConnecting()) {
state.setConnecting(false);
service::loader::stopApp();
stop(manifest.appId);
}
break;
default:
@@ -102,11 +102,11 @@ extern const AppManifest manifest = {
.createApp = create<WifiConnect>
};
void start(const std::string& ssid, const std::string& password) {
LaunchId start(const std::string& ssid, const std::string& password) {
auto parameters = std::make_shared<Bundle>();
parameters->putString(WIFI_CONNECT_PARAM_SSID, ssid);
parameters->putString(WIFI_CONNECT_PARAM_PASSWORD, password);
service::loader::startApp(manifest.appId, parameters);
return app::start(manifest.appId, parameters);
}
bool optSsidParameter(const std::shared_ptr<const Bundle>& bundle, std::string& ssid) {
@@ -140,8 +140,8 @@ extern const AppManifest manifest = {
.createApp = create<WifiManage>
};
void start() {
service::loader::startApp(manifest.appId);
LaunchId start() {
return app::start(manifest.appId);
}
} // namespace