fix: make saving state logs to a file on Android more performant#31595
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
911f223 to
b8189e9
Compare
Android shared state logs as a base64 data:text/plain URL via Share.open, which was slow to encode for large states and produced a text-only share intent with no way to save the file. Write the logs to a real file on both platforms and share it with a filename and application/json type (plain path, so react-native-share serves a content:// URI via its FileProvider). Faster, and Android now offers Save to Files/Drive.
303cf6a to
ca71c39
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
Description
On Android, Settings → Advanced → Download State Logs was slow to respond, and when the share window finally appeared it only offered "send to" targets (email/messaging/apps) with no way to actually save or download the logs file.
The cause was that Android shared the logs as a base64
data:text/plainURL viaShare.open. Encoding the entire state to base64 was slow for large states, and the result was a text-only share intent with no file to save.This PR makes state logs a real file download on both platforms:
filenameandapplication/jsonMIME type.react-native-sharecopies the file into its own FileProvider and shares acontent://URI, so Android's share sheet now offers "Save to Files"/Drive. (A rawfile://URI is intentionally avoided — it would crash Android withFileUriExposedException.)iOS behavior is unchanged in practice (it already wrote and shared the file); the share path is now unified across platforms.
Changelog
CHANGELOG entry: Fixed Download State Logs on Android so the logs can be saved/downloaded as a file, and removed the delay before the share sheet appears
Related issues
Fixes: #24359
Manual testing steps
Screenshots/Recordings
Before
Not applicable
After
Not applicable
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist