Various improvements (#614)
- Auto-select widgets in Launcher and apps with toolbars on devices without touch. - Improved USB HID input reliability, cleanup - Updated PSRAM settings to improve boot stability on supported devices. - Prevented duplicate Wi-Fi event subscriptions during screen rebuilds. - Updated docs - Fixes in WifiManage and WifiConnect - Reduced main task stack size - Moved USB HID stack size to PSRAM when available - app_manager_find_manifest() now returns a copy instead of a pointer
This commit is contained in:
committed by
GitHub
parent
cc8be3faef
commit
d6b1d15e56
@@ -27,8 +27,12 @@ error_t app_manager_add(const struct AppManifest* manifest);
|
||||
*/
|
||||
error_t app_manager_remove(const char* id);
|
||||
|
||||
/** @return the manifest, or NULL if not found. */
|
||||
const struct AppManifest* app_manager_find_manifest(const char* id);
|
||||
/**
|
||||
* @param[out] out_manifest set to a copy of the manifest on success
|
||||
* @retval ERROR_NOT_FOUND no manifest with this id is registered
|
||||
* @retval ERROR_NONE on success
|
||||
*/
|
||||
error_t app_manager_find_manifest(const char* id, struct AppManifest* out_manifest);
|
||||
|
||||
/**
|
||||
* Calls `@a` visitor once for every registered manifest. Iteration order is unspecified.
|
||||
|
||||
@@ -21,7 +21,7 @@ enum AppManifestFlags {
|
||||
/** Excluded from generic app-browsing UIs (AppList, Settings) - for apps only ever reached
|
||||
* by direct navigation (modal dialogs, detail views that require parameters, wizard/
|
||||
* bootstrap steps). */
|
||||
APP_MANIFEST_FLAG_HIDDEN = 0b00000001,
|
||||
APP_MANIFEST_FLAG_HIDDEN = 1 >> 0,
|
||||
};
|
||||
|
||||
/** Describes a registrable app. One manifest exists per app id. */
|
||||
|
||||
@@ -48,13 +48,17 @@ error_t app_manager_remove(const char* id) {
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
const AppManifest* app_manager_find_manifest(const char* id) {
|
||||
error_t app_manager_find_manifest(const char* id, AppManifest* out_manifest) {
|
||||
auto& ledger = app_ledger();
|
||||
mutex_lock(&ledger.mutex);
|
||||
auto iterator = ledger.manifests.find(id);
|
||||
const AppManifest* manifest = (iterator != ledger.manifests.end()) ? iterator->second : nullptr;
|
||||
if (iterator == ledger.manifests.end()) {
|
||||
mutex_unlock(&ledger.mutex);
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
*out_manifest = *iterator->second;
|
||||
mutex_unlock(&ledger.mutex);
|
||||
return manifest;
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
void app_manager_for_each_manifest(AppManifestVisitorFn visitor, void* context) {
|
||||
@@ -88,15 +92,17 @@ char** copy_arguments(int argc, const char* const argv[]) {
|
||||
// app_scheduler_start() frees it on any failure path, and the spawned task frees it once its
|
||||
// run() returns.
|
||||
error_t start_internal(const char* id, AppInstanceId parent_instance_id, int argc, char* argv[], AppInstanceId* out_app_instance_id) {
|
||||
const AppManifest* manifest = app_manager_find_manifest(id);
|
||||
if (manifest == nullptr) {
|
||||
app_ledger_free_arguments(argc, argv);
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
auto& ledger = app_ledger();
|
||||
|
||||
mutex_lock(&ledger.mutex);
|
||||
auto manifest_iterator = ledger.manifests.find(id);
|
||||
if (manifest_iterator == ledger.manifests.end()) {
|
||||
mutex_unlock(&ledger.mutex);
|
||||
app_ledger_free_arguments(argc, argv);
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
const AppManifest* manifest = manifest_iterator->second;
|
||||
|
||||
AppInstanceId target_id = ledger.next_instance_id++;
|
||||
AppInstanceRecord record { target_id, manifest, APP_INSTANCE_STATE_STARTING, nullptr };
|
||||
record.parent_id = parent_instance_id;
|
||||
|
||||
Reference in New Issue
Block a user