Skip to content

Commit c3cc748

Browse files
committed
Upload file
1 parent 9d1af20 commit c3cc748

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

common/src/main/java/com/omarea/common/shell/ShellTranslation.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import android.content.Intent
1111
import android.content.ComponentName
1212
import android.net.Uri
1313
import android.os.Build
14+
import android.content.ClipData
1415

1516
// 从Resource解析字符串,实现输出内容多语言
1617
class ShellTranslation(val context: Context) {
@@ -66,12 +67,17 @@ class ShellTranslation(val context: Context) {
6667

6768
try {
6869
val intent = parseIntentArgs(subArgs)
69-
// emulate am for SEND
70+
71+
// emulate am for SEND (AOSP-compatible)
7072
if ((intent.action == Intent.ACTION_SEND
7173
|| intent.action == Intent.ACTION_SEND_MULTIPLE)
7274
&& intent.data != null
7375
) {
74-
intent.putExtra(Intent.EXTRA_STREAM, intent.data)
76+
val uri = intent.data!!
77+
intent.putExtra(Intent.EXTRA_STREAM, uri)
78+
intent.setClipData(
79+
ClipData.newUri(ctx.contentResolver, null, uri)
80+
)
7581
intent.data = null
7682
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
7783
}

0 commit comments

Comments
 (0)