diff --git a/android/src/cpp/main.cpp b/android/src/cpp/main.cpp index 962455f..ec29989 100644 --- a/android/src/cpp/main.cpp +++ b/android/src/cpp/main.cpp @@ -241,7 +241,7 @@ extern "C" #ifdef __FOCUS__ JNIEXPORT void JNICALL Java_com_omixlab_panopainter_MainActivity_init_vr(JNIEnv *env, jobject activity, jobject am) { - Asset::m_am = AAssetManager_fromJava(env, am); + Asset::set_android_asset_manager(AAssetManager_fromJava(env, am)); wave_init(0, 0, 0); } #endif @@ -700,7 +700,7 @@ static int engine_init_display(struct engine* engine) { LOG("PROP Maker: %s", os_props["ro.product.manufacturer"].c_str()); LOG("PROP Mode: %s", os_props["ro.product.model"].c_str()); - Asset::m_am = engine->app->activity->assetManager; + Asset::set_android_asset_manager(engine->app->activity->assetManager); App::I->and_app = engine->app; App::I->and_engine = engine; diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index 50c42ff..b536ffa 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -767,7 +767,12 @@ Known warnings after the current CMake app build: an SDK import target, or a documented permanent vendored target. - `pp_legacy_assets_io` is an object-library containment boundary for retained ABR, asset/file, binary stream, image, serializer, and settings code. It - should shrink as app I/O consumes `pp_assets` directly. + should shrink as app I/O consumes `pp_assets` directly. `src/asset.h` now + forward-declares Android asset-manager types and exposes + `Asset::set_android_asset_manager` instead of public mutable Android asset + manager state; concrete Android asset-manager headers remain in `asset.cpp` + and the retained Android entrypoint while DEBT-0056 tracks replacing the + static Android asset bridge with injected asset storage. - `pp_legacy_paint_document` is an object-library containment boundary for retained action, bezier, brush, canvas, canvas-layer, and event code. It should shrink as app painting and document behavior consume `pp_paint` and diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index d662a50..2478466 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -73,6 +73,7 @@ agent or engineer to remove them without reconstructing context from chat. | DEBT-0053 | Open | Modernization | Prepared-file writable target selection and prepared-file export-dialog policy now dispatch through `PlatformServices`, but iOS/Web target selection still lives in `src/platform_legacy/legacy_platform_services.*` | Preserve mobile/Web export handoff behavior while platform shells are extracted incrementally | `pp_platform_api_tests`; `ctest --preset desktop-fast --build-config Debug`; Windows app build; Apple/Web package smoke once root package builds exist | Prepared-file target selection, export-dialog policy, and save/download handoff are owned by injected platform services with no legacy adapter branch | | DEBT-0054 | Open | Modernization | Layout XML file read/reload decisions now consume `pp_platform_api::plan_asset_file_load`, but that helper still encodes the retained compile-time platform policy: Windows/macOS use `stat` mtime reload checks, while other platforms treat already-loaded layouts as successful no-op loads | Preserve current layout hot-reload and mobile/Web single-load behavior while removing platform guards from the shared `LayoutManager` parser | `pp_platform_api_tests`; `ctest --preset desktop-fast --build-config Debug -R pp_platform_api_tests`; Windows app build | Layout reload decisions are owned by injected platform storage/file-watch services or an asset manager boundary with platform-specific file watching removed from compile-time helpers | | DEBT-0055 | Open | Modernization | `src/app.h` now forward-declares retained iOS/macOS/Android/Linux/Web platform handles instead of including platform SDK headers, and full SDK includes are isolated in `src/platform_legacy/legacy_platform_services.cpp`, but the `App` singleton still stores those platform handles directly | Reduce central header platform coupling incrementally without rewriting non-Windows platform entrypoints before Phase 6 | Windows app build; Apple/Android/Linux/Web package smoke once platform root builds are active | Platform handles are owned by injected `pp_platform_*` shell state or services, and `App` has no platform SDK handle fields or platform conditional members | +| DEBT-0056 | Open | Modernization | `src/asset.h` now forward-declares Android asset-manager types and uses `Asset::set_android_asset_manager` instead of public mutable manager state, but retained `Asset` still stores Android asset handles and `src/asset.cpp` still performs Android `AAssetManager` reads directly; the current `android-arm64` root preset is headless and does not expose `pp_legacy_assets_io` | Reduce legacy asset I/O header coupling without rewriting Android asset loading before the asset manager/storage boundary exists | Windows app build; `cmake --build --preset android-arm64 --target pp_assets`; Android package smoke once package builds consume shared targets | Android asset loading is owned by injected asset storage/platform services or `pp_assets` file providers, with no static Android asset manager on `Asset` | ## Closed Debt diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index f11ca13..02e9699 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -662,6 +662,11 @@ The central `App` header now forward-declares retained platform handles instead of including Objective-C, Android, or GLFW SDK headers; the full platform headers live in the legacy platform adapter until those handles move out of `App` during Phase 6. +The retained `Asset` header now forward-declares Android asset-manager types, +hides the Android asset handles behind `Asset::set_android_asset_manager`, and +keeps concrete Android asset-manager headers in `asset.cpp`/the Android +entrypoint. This reduces legacy asset I/O header coupling while the actual +Android asset-reader implementation remains inside `pp_legacy_assets_io`. Prepared-file save/download handoff is now also part of the service contract, so iOS/Web export completion routes through `PlatformServices` after the app writes the temporary/exported payload. diff --git a/src/asset.cpp b/src/asset.cpp index 8e26517..bac0d88 100644 --- a/src/asset.cpp +++ b/src/asset.cpp @@ -9,9 +9,15 @@ #endif #ifdef __ANDROID__ +#include #include AAssetManager* Asset::m_am; bool android_create_dir(const std::string& path); + +void Asset::set_android_asset_manager(AAssetManager* asset_manager) +{ + m_am = asset_manager; +} #endif bool Asset::delete_file(const std::string& path) diff --git a/src/asset.h b/src/asset.h index 27e6ee1..b1c8a60 100644 --- a/src/asset.h +++ b/src/asset.h @@ -1,11 +1,21 @@ #pragma once +#ifdef __ANDROID__ +struct AAsset; +struct AAssetManager; +#endif + class Asset { public: #ifdef __ANDROID__ + static void set_android_asset_manager(AAssetManager* asset_manager); + +private: static AAssetManager* m_am; AAsset* m_asset = nullptr; + +public: #endif static std::vector list_files(std::string folder, const std::string& filter_regex); static bool exist(std::string path);