mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-05 03:20:46 -05:00
Tar firmware handling (e.g. Samsung AP tars) was entangled with MagiskInstallImpl: BootItem and processTar lived in the installer, and processFile set up the TarArchiveOutputStream, used a nullable BootItem as the tar flag, and reassigned its file to new-boot.img. Move all tar logic into a standalone TarProcessor next to OtaPayloadExtractor and ZipExtractor. Since the output tar has to stay open while the installer patches the image, it uses a two-phase API: consume() extracts the boot images, copies all other entries to the output tar, and returns the image to patch; finish() writes the patched image and finalizes the archive. The caller still owns and closes both raw streams, and MagiskInstallImpl no longer references any tar types. Additionally: - Pass through vbmeta.img smaller than 256 bytes unpatched instead of looping forever, as the loop continued without advancing the entry. - Close the output stream when patching fails instead of leaking it, ignoring close errors so that they cannot crash the app. Assisted-by: Claude Opus 5.5