d4rken-org / sdmaid-se

SD Maid 2/SE is Android's most thorough cleaning tool.
https://play.google.com/store/apps/details?id=eu.darken.sdmse
GNU General Public License v3.0
2.77k stars 432 forks source link

IO: Fix Root/Shizuku error when reading large directories #1360

Closed d4rken closed 3 months ago

d4rken commented 3 months ago

Fix services being destroyed before all data has been transferred Similar to LocalGateway.read(...): Source where we need to keep the source alive until consumed, we need to do the same when returning a Flow. It's up to the caller on when it's consumed.

Likely caused by #1345 Previously we had a constant lease on the Shizuku service resource so this never surfaced: https://github.com/d4rken-org/sdmaid-se/pull/1345/files#diff-3105723dbd44154e23041c05d9496670e61e15cbdcd00ea73c99d1984f577f76R135

Root will have the same issue as that changed in #1346

This fixes #1358