Receive shares and serve file requests, so other apps can reach this one

The manifest had nothing but a LAUNCHER filter, so no other app could hand Plain Files anything. It now registers for ACTION_SEND and SEND_MULTIPLE (a bar over the browser: navigate to the folder, then Save here) and for GET_CONTENT and OPEN_DOCUMENT, where tapping a file hands it back through the existing FileProvider.

Both reuse the browser instead of a second screen, because both are navigate-to-a-folder with a different verb at the end. data/ gains one port, IncomingSource, to keep a ContentResolver out of the ViewModel the way DeleteRequestFactory keeps one out of the delete path. Shared files are named from the sender OpenableColumns, allocated by the same NameAllocator a paste uses, and deleted again if they cannot be read rather than left as zero-byte stubs. While providing, a tap on a file chooses it but a tap on a folder still navigates, or the user could never reach the file.

ACTION_VIEW is deliberately not registered: the app already hands files out through the system chooser, and registering as a viewer would offer Plain Files back to itself. No new permissions - the merged release manifest still declares no INTERNET.
This commit is contained in:
2026-10-15 09:18:10 +02:00
parent ffed22c1da
commit cc085b43de
15 changed files with 583 additions and 29 deletions
+13
View File
@@ -55,6 +55,15 @@
<string name="browser_action_select_all">Select all</string>
<string name="browser_action_clear_selection">Clear selection</string>
<string name="browser_action_undo">Undo</string>
<!-- ===== Browser: files another app has handed over ===== -->
<plurals name="incoming_save_here">
<item quantity="one">Save %1$d file into this folder</item>
<item quantity="other">Save %1$d files into this folder</item>
</plurals>
<string name="incoming_save_action">Save here</string>
<string name="incoming_pick_hint">Navigate to a file and tap it to hand it back</string>
<string name="incoming_cancel">Cancel</string>
<string name="browser_action_more">More options</string>
<string name="browser_action_refresh">Refresh</string>
<string name="browser_action_cancel">Cancel</string>
@@ -140,6 +149,10 @@
<item quantity="one">Put %1$d item back</item>
<item quantity="other">Put %1$d items back</item>
</plurals>
<plurals name="message_received">
<item quantity="one">Saved %1$d shared file</item>
<item quantity="other">Saved %1$d shared files</item>
</plurals>
<plurals name="message_failed">
<item quantity="one">%1$d item could not be processed</item>
<item quantity="other">%1$d items could not be processed</item>