Skip to content

Commit aa1d310

Browse files
committed
test: target MainActivity for SAF intent flows
1 parent 80da5a1 commit aa1d310

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

app/src/androidTest/java/com/kyhsgeekcode/disassembler/DocumentIntentFixtures.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ fun createActionViewIntent(
3636
content: ByteArray
3737
): Intent {
3838
val uri = createIncomingContentUri(displayName, content)
39-
return Intent(Intent.ACTION_VIEW).apply {
39+
return Intent(
40+
ApplicationProvider.getApplicationContext(),
41+
MainActivity::class.java
42+
).apply {
43+
action = Intent.ACTION_VIEW
4044
data = uri
4145
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
4246
addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION)
@@ -48,7 +52,11 @@ fun createExtraStreamIntent(
4852
content: ByteArray
4953
): Intent {
5054
val uri = createIncomingContentUri(displayName, content)
51-
return Intent(Intent.ACTION_SEND).apply {
55+
return Intent(
56+
ApplicationProvider.getApplicationContext(),
57+
MainActivity::class.java
58+
).apply {
59+
action = Intent.ACTION_SEND
5260
type = "*/*"
5361
putExtra(Intent.EXTRA_STREAM, uri)
5462
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)

0 commit comments

Comments
 (0)