Sharing intent with data starts Activity twice

I’m implementing receiving data from other apps with the following approach (code simplified):

@AndroidEntryPoint
abstract class SharingActivity(
    protected val sharingDeepLink: Uri
): ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val sharingIntent = Intent(intent).apply {
            setDataAndType(sharingDeepLink, intent.type)
            component = ComponentName(this@SharingActivity, MainActivity::class.java)
        }
        startActivity(sharingIntent)
        finish()
    }
}

Actual sharing Activities inherit from SharingActivity with an applicable deep link to the main app:

@AndroidEntryPoint
class ChatsShareActivity: SharingActivity(
    sharingDeepLink = Uri
        .parse("<scheme>://${AppScreen.Messages.withArgs(isSharing = true)}")
)
// And so on
<activity
    android:name=".presentation.screen.app.share.ChatsShareActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
    android:exported="true"
    android:windowSoftInputMode="adjustResize"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
    <intent-filter android:label="@string/tab_messages">
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="image/*" />
        <data android:mimeType="video/*" />
        <data android:mimeType="text/*" />
        <data android:mimeType="*/*" />
    </intent-filter>
    <intent-filter android:label="@string/tab_messages">
        <action android:name="android.intent.action.SEND_MULTIPLE" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="image/*" />
        <data android:mimeType="video/*" />
        <data android:mimeType="*/*" />
    </intent-filter>
</activity>

The idea here is to have multiple sharing targets in Android Sharesheet without having to re-implement navigation graphs for each one. So I just start MainActivity with a deep link to a particular screen, where Jetpack Navigation handles synthetic back stack.
But the problem I’m facing is MainActivity starts twice in different tasks, and I can’t figure out why. Here’s some additional info:

  1. Sharing an image from the Google Gallery without invoking a system Sharesheet, the intent received in SharingActivity is:
Action: android.intent.action.SEND,
flags: FLAG_GRANT_READ_URI_PERMISSION
data: null,
extras: content://media/external/images/media/1000015908

And in MainActivity:

flags: FLAG_GRANT_READ_URI_PERMISSION
Action: android.intent.action.SEND,
data: <scheme>://chats?isSharing=true,
type: image*,
extras: content://media/external/images/media/1000015908

Works as expected.

  1. Sharing an image from the Google Gallery via the Sharesheet, the intent is:
Action: android.intent.action.SEND,
flags: FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
       FLAG_ACTIVITY_FORWARD_RESULT
       FLAG_ACTIVITY_MULTIPLE_TASK
       FLAG_ACTIVITY_NEW_DOCUMENT
       FLAG_ACTIVITY_NEW_TASK
       FLAG_ACTIVITY_PREVIOUS_IS_TOP
       FLAG_GRANT_READ_URI_PERMISSION
       FLAG_RECEIVER_FOREGROUND
       FLAG_RECEIVER_INCLUDE_BACKGROUND
       FLAG_RECEIVER_NO_ABORT
data: null,
extras: content://media/external/images/media/1000015908

But here MainActivity starts twice:

Task: 23070
flags: FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
       FLAG_ACTIVITY_FORWARD_RESULT
       FLAG_ACTIVITY_MULTIPLE_TASK
       FLAG_ACTIVITY_NEW_DOCUMENT
       FLAG_ACTIVITY_NEW_TASK
       FLAG_ACTIVITY_PREVIOUS_IS_TOP
       FLAG_GRANT_READ_URI_PERMISSION
       FLAG_RECEIVER_FOREGROUND
       FLAG_RECEIVER_INCLUDE_BACKGROUND
       FLAG_RECEIVER_NO_ABORT
Action: android.intent.action.SEND,
data: <scheme>://chats?isSharing=true,
type: image*,
extras: content://media/external/images/media/1000015908

Task: 23071
flags: FLAG_ACTIVITY_CLEAR_TASK
       FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
       FLAG_ACTIVITY_FORWARD_RESULT
       FLAG_ACTIVITY_MULTIPLE_TASK
       FLAG_ACTIVITY_NEW_DOCUMENT
       FLAG_ACTIVITY_NEW_TASK
       FLAG_ACTIVITY_PREVIOUS_IS_TOP
       FLAG_ACTIVITY_TASK_ON_HOME
       FLAG_GRANT_READ_URI_PERMISSION
       FLAG_RECEIVER_FOREGROUND
       FLAG_RECEIVER_INCLUDE_BACKGROUND
       FLAG_RECEIVER_NO_ABORT
Action: android.intent.action.SEND,
data: <scheme>://chats?isSharing=true,
type: image*,
extras: content://media/external/images/media/1000015908

Note the additional flags. Where are they coming from?
My current thoughts is that this behavior has something to do with the flags that system Sharesheet adds to its intents in combination with my MainActivity intents containing data despite being sharing intents.

Why is this happening and what can I do to fix it?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật