loader: restored support for debug apps (#2993)

* fbt: restored loader support for debug apps (no GUI tho)
* desktop: fixed code for handling autorun apps
* loader: fixed autorun app messing up last update stage
* Loader: handle status without message

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2023-08-22 20:38:45 +03:00
committed by GitHub
parent 35cdefa1ca
commit 200c44bdca
3 changed files with 33 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
#include "loader.h"
#include "core/core_defines.h"
#include "loader_i.h"
#include <applications.h>
#include <storage/storage.h>
@@ -186,18 +187,24 @@ static FlipperInternalApplication const* loader_find_application_by_name_in_list
}
static const FlipperInternalApplication* loader_find_application_by_name(const char* name) {
const FlipperInternalApplication* application = NULL;
application = loader_find_application_by_name_in_list(name, FLIPPER_APPS, FLIPPER_APPS_COUNT);
if(!application) {
application = loader_find_application_by_name_in_list(
name, FLIPPER_SETTINGS_APPS, FLIPPER_SETTINGS_APPS_COUNT);
}
if(!application) {
application = loader_find_application_by_name_in_list(
name, FLIPPER_SYSTEM_APPS, FLIPPER_SYSTEM_APPS_COUNT);
const struct {
const FlipperInternalApplication* list;
const uint32_t count;
} lists[] = {
{FLIPPER_SETTINGS_APPS, FLIPPER_SETTINGS_APPS_COUNT},
{FLIPPER_SYSTEM_APPS, FLIPPER_SYSTEM_APPS_COUNT},
{FLIPPER_DEBUG_APPS, FLIPPER_DEBUG_APPS_COUNT},
};
for(size_t i = 0; i < COUNT_OF(lists); i++) {
const FlipperInternalApplication* application =
loader_find_application_by_name_in_list(name, lists[i].list, lists[i].count);
if(application) {
return application;
}
}
return application;
return NULL;
}
static void loader_start_app_thread(Loader* loader, FlipperInternalApplicationFlag flags) {
@@ -253,9 +260,7 @@ static void loader_log_status_error(
furi_string_vprintf(error_message, format, args);
FURI_LOG_E(TAG, "Status [%d]: %s", status, furi_string_get_cstr(error_message));
} else {
FuriString* tmp = furi_string_alloc();
FURI_LOG_E(TAG, "Status [%d]: %s", status, furi_string_get_cstr(tmp));
furi_string_free(tmp);
FURI_LOG_E(TAG, "Status [%d]", status);
}
}
@@ -490,7 +495,9 @@ int32_t loader_srv(void* p) {
FLIPPER_ON_SYSTEM_START[i]();
}
if(FLIPPER_AUTORUN_APP_NAME && strlen(FLIPPER_AUTORUN_APP_NAME)) {
if((furi_hal_rtc_get_boot_mode() == FuriHalRtcBootModeNormal) && FLIPPER_AUTORUN_APP_NAME &&
strlen(FLIPPER_AUTORUN_APP_NAME)) {
FURI_LOG_I(TAG, "Starting autorun app: %s", FLIPPER_AUTORUN_APP_NAME);
loader_do_start_by_name(loader, FLIPPER_AUTORUN_APP_NAME, NULL, NULL);
}