Build twrp.cpp as libtwrp_main (main renamed twrp_main under PAWLET_TWRP_PLUGIN) and call it from PawletTwrpUI::Init(), so recovery gets TWRP's full startup: fstab processing, BCB clearing, recovery-mode command handling, language loading and its own reboot handling. Falls back to the stub UI if TWRP startup fails. Add tw_no_batt_percent / tw_use_legacy_battery_services soong config flags for boards without a battery or a health HAL in recovery.
recovery_ui
TWRP's GUI engine, packaged as a librecovery_ui_ext plugin instead of a
bootable/recovery fork. Stock AOSP recovery already dlopen()s
librecovery_ui_ext.so and dlsym()s make_device() out of it at runtime
(see recovery_main.cpp) — this module is what TARGET_RECOVERY_UI_LIB
(set in BoardConfig.mk) should point at. bootable/recovery itself stays
stock, unforked (see the main workspace's notes/ota-non-a-ab-research-work.md
for the full investigation behind this approach).
Status: first-draft scaffolding, not build-tested
This is real progress, not a finished module. What's solid vs. what's open:
Solid — copied verbatim from TeamWin's android_bootable_recovery
(android-14.1), self-contained:
gui/,minuitwrp/,libpixelflinger/— TWRP's actual GUI/graphics engine, unmodified exceptinclude_dirspath fixes (see below).soong/copy.go,soong/makevars.go— shared helpers all three of the above's custom Go Soong plugins depend on.
New — written from scratch for this port, not copied from anywhere
(TWRP's own bootable/recovery fork never ships a make_device() — every
real TWRP device provides its own, and PawletOS didn't have a reference
device tree to copy from):
device/pawlet_recovery_ui.h/device/pawlet_recovery_ui.cpp—PawletTwrpUI, aScreenRecoveryUIsubclass. OverridesInit()to callgui_init()/gui_loadResources()/gui_start()(TWRP's real entry points, confirmed viagui/gui.h), plusPrint()/PrintOnScreenOnly()/ShowFile()to route throughgui_print()/gui_startPage(). Everything else falls back toScreenRecoveryUI's stock behavior.device/make_device.cpp— the actualmake_device()factoryrecovery_main.cpplooks up.Android.bp(top-level) — defineslibrecovery_ui_pawlet_twrp, the moduleTARGET_RECOVERY_UI_LIBshould reference.
Adapted: gui/Android.bp and minuitwrp/Android.bp had their
include_dirs rewritten — paths that still genuinely live in stock
bootable/recovery (otautil, install, recovery_ui, fuse_sideload)
kept as-is; paths for things that moved (twrpinstall → now in
vendor/pawlet/recovery_toolkit, gui/minuitwrp/libpixelflinger → now
here) rewritten to their new locations. libpixelflinger/Android.bp needed
no changes — it only used relative include_dirs.
Known gap — this will not link yet
gui/Android.bp's libguitwrp depends on libaosprecovery (shared_libs).
TWRP builds that from top-level twrp.cpp via another custom Go Soong
plugin (libaosprecovery_defaults.go) that hasn't been ported yet.
twrp.cpp currently sits unbuilt in
vendor/pawlet/recovery_toolkit/helpers/. Until libaosprecovery gets a
real Android.bp, this module won't compile.
Also not yet done
- The three custom Go Soong plugins this depends on (
libguitwrp_defaults.go,libminuitwrp_defaults.go,libpixelflingertwrp_defaults— the last is plaincc_defaults, not Go) have not been checked for API compatibility against raspberry-vanilla's android-16.0 Soong the wayvendor_twrp'sgenerator.gowas (that check found one real incompatibility —PathForSourceRelaxed— seeexternal_update_binary's history). These three haven't had the same treatment yet. data.cpp/data.hpp,variables.h,twcommon.hare staged as loose files at this directory's top level —data.cppis wired into the new top-levelAndroid.bp'ssrcs, but hasn't been checked for its ownbootable/recovery-relative include assumptions.recovery_ui.h(top-level, copied from TWRP) is not used — it's a pre-2015 legacydevice_recovery_start()-style header TWRP still carries but doesn't actually reference from the modern GUI path. Left in the repo for now rather than silently dropped; safe to delete once confirmed genuinely dead.- A proper GPL-3.0 license file for
gui//minuitwrp//libpixelflinger/(TWRP's own code, GPL-3.0-licensed pergui/gui.h's header — distinct from the Apache-2.0device/glue) hasn't been added yet, just flagged here.
License
Mixed: device/*.cpp/.h and this Android.bp are Apache-2.0 (PawletOS,
2026). gui/, minuitwrp/, libpixelflinger/ are GPL-3.0 (TeamWin, see
gui/gui.h's header) — full license text not yet added to this repo, see
"Also not yet done" above.