Merge branch 'ofw-dev' into dev

This commit is contained in:
MX 2023-05-24 07:16:05 +03:00
commit 1e5a8f4391
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
8 changed files with 20 additions and 92 deletions

View File

@ -313,58 +313,6 @@ Desktop* desktop_alloc() {
return desktop;
}
void desktop_free(Desktop* desktop) {
furi_assert(desktop);
furi_check(furi_record_destroy(RECORD_DESKTOP));
furi_pubsub_unsubscribe(
loader_get_pubsub(desktop->loader), desktop->app_start_stop_subscription);
if(desktop->input_events_subscription) {
furi_pubsub_unsubscribe(desktop->input_events_pubsub, desktop->input_events_subscription);
desktop->input_events_subscription = NULL;
}
desktop->loader = NULL;
desktop->input_events_pubsub = NULL;
furi_record_close(RECORD_LOADER);
furi_record_close(RECORD_NOTIFICATION);
furi_record_close(RECORD_INPUT_EVENTS);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdMain);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdLockMenu);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdLocked);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdDebug);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdHwMismatch);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdPinInput);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdPinTimeout);
view_dispatcher_free(desktop->view_dispatcher);
scene_manager_free(desktop->scene_manager);
animation_manager_free(desktop->animation_manager);
view_stack_free(desktop->main_view_stack);
desktop_main_free(desktop->main_view);
view_stack_free(desktop->locked_view_stack);
desktop_view_locked_free(desktop->locked_view);
desktop_lock_menu_free(desktop->lock_menu);
desktop_view_locked_free(desktop->locked_view);
desktop_debug_free(desktop->debug_view);
popup_free(desktop->hw_mismatch_popup);
desktop_view_pin_timeout_free(desktop->pin_timeout_view);
furi_record_close(RECORD_GUI);
desktop->gui = NULL;
furi_thread_free(desktop->scene_thread);
furi_record_close("menu");
furi_timer_free(desktop->auto_lock_timer);
free(desktop);
}
static bool desktop_check_file_flag(const char* flag_path) {
Storage* storage = furi_record_open(RECORD_STORAGE);
bool exists = storage_common_stat(storage, flag_path, NULL) == FSE_OK;
@ -427,7 +375,8 @@ int32_t desktop_srv(void* p) {
}
view_dispatcher_run(desktop->view_dispatcher);
desktop_free(desktop);
furi_crash("That was unexpected");
return 0;
}

View File

@ -89,15 +89,6 @@ Dolphin* dolphin_alloc() {
return dolphin;
}
void dolphin_free(Dolphin* dolphin) {
furi_assert(dolphin);
dolphin_state_free(dolphin->state);
furi_message_queue_free(dolphin->event_queue);
free(dolphin);
}
void dolphin_event_send_async(Dolphin* dolphin, DolphinEvent* event) {
furi_assert(dolphin);
furi_assert(event);
@ -204,7 +195,7 @@ int32_t dolphin_srv(void* p) {
}
}
dolphin_free(dolphin);
furi_crash("That was unexpected");
return 0;
}

View File

@ -37,8 +37,6 @@ struct Dolphin {
Dolphin* dolphin_alloc();
void dolphin_free(Dolphin* dolphin);
void dolphin_event_send_async(Dolphin* dolphin, DolphinEvent* event);
void dolphin_event_send_wait(Dolphin* dolphin, DolphinEvent* event);

View File

@ -268,30 +268,6 @@ Power* power_alloc() {
return power;
}
void power_free(Power* power) {
furi_assert(power);
// Gui
view_dispatcher_remove_view(power->view_dispatcher, PowerViewOff);
power_off_free(power->power_off);
view_dispatcher_remove_view(power->view_dispatcher, PowerViewUnplugUsb);
power_unplug_usb_free(power->power_unplug_usb);
view_port_free(power->battery_view_port);
// State
furi_mutex_free(power->api_mtx);
// FuriPubSub
furi_pubsub_free(power->event_pubsub);
// Records
furi_record_close(RECORD_NOTIFICATION);
furi_record_close(RECORD_GUI);
free(power);
}
static void power_check_charging_state(Power* power) {
if(furi_hal_power_is_charging()) {
if((power->info.charge == 100) || (furi_hal_power_is_charging_done())) {
@ -454,7 +430,7 @@ int32_t power_srv(void* p) {
furi_delay_ms(1000);
}
power_free(power);
furi_crash("That was unexpected");
return 0;
}

View File

@ -226,7 +226,7 @@ FS_Error storage_common_stat(Storage* storage, const char* path, FileInfo* filei
*/
FS_Error storage_common_remove(Storage* storage, const char* path);
/** Renames file/directory, file/directory must not be open
/** Renames file/directory, file/directory must not be open. Will overwrite existing file.
* @param app pointer to the api
* @param old_path old path
* @param new_path new path

View File

@ -422,7 +422,16 @@ FS_Error storage_common_remove(Storage* storage, const char* path) {
}
FS_Error storage_common_rename(Storage* storage, const char* old_path, const char* new_path) {
FS_Error error = storage_common_copy(storage, old_path, new_path);
FS_Error error;
if(storage_file_exists(storage, new_path)) {
error = storage_common_remove(storage, new_path);
if(error != FSE_OK) {
return error;
}
}
error = storage_common_copy(storage, old_path, new_path);
if(error == FSE_OK) {
if(!storage_simply_remove_recursive(storage, old_path)) {
error = FSE_INTERNAL;

View File

@ -275,6 +275,8 @@ class Main(App):
# Strip uid and gid in case of overflow
def tar_filter(tarinfo):
tarinfo.uid = tarinfo.gid = 0
tarinfo.mtime = 0
tarinfo.uname = tarinfo.gname = "furippa"
return tarinfo
tar.add(bundle_dir, arcname=bundle_dir_name, filter=tar_filter)

View File

@ -211,6 +211,9 @@ class Main(App):
f"Cannot package resource: name '{tarinfo.name}' too long"
)
raise ValueError("Resource name too long")
tarinfo.gid = tarinfo.uid = 0
tarinfo.mtime = 0
tarinfo.uname = tarinfo.gname = "furippa"
return tarinfo
def package_resources(self, srcdir: str, dst_name: str):