Cleanup API symbols

Services expose same sdk_headers as OFW
Since settings apps use some of those symbols, need to include them
Workaround is mock imports by #include the .c code
Not ideal, but we only need access to basic load/save functions, and these apps are bundled with firmware anyway, so should be fine
Not exposing via API and instead bundling via FAP also means less flash used, and RAM is not a concern with settings apps
This commit is contained in:
Willy-JL
2024-08-10 03:01:40 +02:00
parent b430f82e44
commit 6acfd65697
21 changed files with 96 additions and 55 deletions

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// desktop_api_get_settings(), desktop_api_set_settings()
#include <applications/services/desktop/desktop.c>

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// DOLPHIN_LEVELS, DOLPHIN_LEVEL_COUNT
#include <applications/services/dolphin/helpers/dolphin_state.c>

View File

@@ -14,5 +14,4 @@ App(
conflicts=["updater"],
stack_size=2 * 1024,
order=60,
sdk_headers=["desktop.h"],
)

View File

@@ -5,7 +5,6 @@ App(
cdefines=["SRV_EXPANSION"],
sdk_headers=[
"expansion.h",
"expansion_settings.h",
],
requires=["rpc_start"],
provides=["expansion_settings"],

View File

@@ -8,5 +8,5 @@ App(
provides=["notification_settings"],
stack_size=int(1.5 * 1024),
order=100,
sdk_headers=["notification.h", "notification_messages.h", "notification_app.h"],
sdk_headers=["notification.h", "notification_messages.h"],
)

View File

@@ -14,7 +14,7 @@ App(
],
stack_size=1 * 1024,
order=110,
sdk_headers=["power_service/power.h", "power_settings.h"],
sdk_headers=["power_service/power.h"],
)
App(

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// bt_get_settings(), bt_set_settings()
#include <applications/services/bt/bt_service/bt_api.c>

View File

@@ -1,5 +0,0 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app too
// Instead of copying the file, can (ab)use preprocessor to copy source code here
#include <applications/services/desktop/helpers/pin_code.c>
// Then, we still use the Header from original code as if nothing happened

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// desktop_api_get_settings(), desktop_api_set_settings()
#include <applications/services/desktop/desktop.c>

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// desktop_keybinds_free(), desktop_keybinds_load(), desktop_keybinds_save()
#include <applications/services/desktop/desktop_keybinds.c>

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// desktop_view_pin_input_get_view(), desktop_view_pin_input_set_back_callback(), desktop_view_pin_input_set_label_secondary(), desktop_view_pin_input_set_pin(), desktop_view_pin_input_set_context(), desktop_view_pin_input_set_label_button(), desktop_view_pin_input_unlock_input(), desktop_view_pin_input_set_pin_position(), desktop_view_pin_input_set_label_primary(), desktop_view_pin_input_reset_pin(), desktop_view_pin_input_set_done_callback(), desktop_view_pin_input_lock_input(), desktop_view_pin_input_alloc(), desktop_view_pin_input_free()
#include <applications/services/desktop/views/desktop_view_pin_input.c>

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// furi_hal_rtc_get_pin_value(), furi_hal_rtc_set_pin_value()
#include <targets/f7/furi_hal/furi_hal_rtc.c>

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// desktop_pin_code_is_set(), desktop_pin_code_reset(), desktop_pin_code_check(), desktop_pin_code_is_equal(), desktop_pin_code_set(), desktop_pin_lock_error_notify()
#include <applications/services/desktop/helpers/pin_code.c>

View File

@@ -1,5 +0,0 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app too
// Instead of copying the file, can (ab)use preprocessor to copy source code here
#include <applications/services/desktop/views/desktop_view_pin_input.c>
// Then, we still use the Header from original code as if nothing happened

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// DOLPHIN_LEVELS, DOLPHIN_LEVEL_COUNT, dolphin_state_xp_to_levelup(), dolphin_state_xp_above_last_levelup()
#include <applications/services/dolphin/helpers/dolphin_state.c>

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// expansion_settings_load(), expansion_settings_save()
#include <applications/services/expansion/expansion_settings.c>

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// notification_message_save_settings()
#include <applications/services/notification/notification_app.c>

View File

@@ -1,5 +0,0 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app too
// Instead of copying the file, can (ab)use preprocessor to copy source code here
#include <applications/settings/about/about.c>
// Then, we still use the Header from original code as if nothing happened

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// about_settings_app()
#include <applications/settings/about/about.c>

View File

@@ -0,0 +1,7 @@
// Since settings app is external, it cannot access firmware functions
// For simple utils like this, easier to include C code in app rather than exposing to API
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
// Then, we still use the Header from original code as if nothing happened
// LOAD_POWER_SETTINGS(), SAVE_POWER_SETTINGS()
#include <applications/services/power/power_settings.c>