File tree Expand file tree Collapse file tree
common/src/main/java/com/omarea/common/shell Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import android.content.Intent
1111import android.content.ComponentName
1212import android.net.Uri
1313import android.os.Build
14+ import android.content.ClipData
1415
1516// 从Resource解析字符串,实现输出内容多语言
1617class 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 }
You can’t perform that action at this time.
0 commit comments