Repository navigation
Conversation
7 of 20 tasks
When the system file picker is unavailable, shareExport read the whole cached export into a String and wrote it back out on the UI thread, undoing the streaming the main save path gained in ActivityWatch#304. Copy the cache file as a stream on a background thread, then open the share sheet. The now-unused PendingExport.readContent() is removed.
|
0xbrayo
force-pushed
the
fix/share-export-stream
branch
from
October 8, 2026 19:37
f0b1c15 to
72818b9
Compare
The background copy raced a second export (same filename, overwrite) and was lost if the activity was recreated mid-copy. Move the cached export into its own directory under cacheDir/shared-exports instead: a rename within cacheDir is instant, so the share stays synchronous on the UI thread with no background work, and never reads the export into memory. Shared copies older than a day are removed on the next share.
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #333.
#304 made large exports stream to a cache file so they are never held in memory as a
String. The share-sheet fallback (used whenCreateDocumentcan't be launched) still didfile.writeText(pending.readContent()), which reads the entire export into aStringand writes it back out, on the UI thread. A large bucket export on that path could OOM or ANR.Change
cacheDir/shared-exports/<uuid>/<filename>(moveExportForSharing) and shares it from there throughFileProvider. A newcache-pathentry covers that directory.cacheDiris instant, so the share stays synchronous on the UI thread. There's no background work to race a second export or to be lost if the activity is recreated.PendingExport.readContent()had no remaining production caller, so it is removed. The one test that used it now readscacheFiledirectly.Testing
WebUIFragmentTestcases: two exports with the same filename are shared as separate files with their own contents, and old shared exports are pruned../gradlew :mobile:testStandardDebugUnitTestpasses.