Relay share intents through a headless activity

This commit is contained in:
2026-09-16 17:17:10 +07:00
parent 78420002d1
commit a5e7162561
2 changed files with 44 additions and 11 deletions
+14 -11
View File
@@ -27,17 +27,6 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Share target. Without this filter the app never appears in the
system share sheet at all; image/* only, the editor takes photos.
Goes on the launcher activity: it is singleTask, so a share
re-delivered there replaces its intent (onNewIntent -> setIntent)
and the running app picks the photo up without a cold start. -->
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
@@ -45,5 +34,19 @@
<data android:scheme="exp+recipescamera"/>
</intent-filter>
</activity>
<!-- Share target. Without this filter the app never appears in the
system share sheet at all; image/* only, the editor takes photos.
A separate no-display relay, not MainActivity: a host app that starts
the target without FLAG_ACTIVITY_NEW_TASK would otherwise drop the
editor into its own task and the share would look like part of it.
ShareActivity relaunches MainActivity in our own task instead. -->
<activity android:name=".ShareActivity" android:theme="@android:style/Theme.NoDisplay" android:launchMode="standard" android:excludeFromRecents="true" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
</activity>
</application>
</manifest>