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 @@ -68,18 +68,21 @@ class ShellTranslation(val context: Context) {
6868 try {
6969 val intent = parseIntentArgs(subArgs)
7070
71- // emulate am for SEND (AOSP-compatible)
72- if ((intent.action == Intent .ACTION_SEND
73- || intent.action == Intent .ACTION_SEND_MULTIPLE )
74- && intent.data != null
71+ if (intent.action == Intent .ACTION_SEND
72+ || intent.action == Intent .ACTION_SEND_MULTIPLE
7573 ) {
76- val uri = intent.data!!
77- intent.putExtra(Intent .EXTRA_STREAM , uri)
78- intent.setClipData(
79- ClipData .newUri(ctx.contentResolver, null , uri)
80- )
81- intent.data = null
82- intent.addFlags(Intent .FLAG_GRANT_READ_URI_PERMISSION )
74+ val uri =
75+ intent.getParcelableExtra<Uri >(Intent .EXTRA_STREAM )
76+ ? : intent.data
77+
78+ if (uri != null ) {
79+ intent.setClipData(
80+ ClipData .newRawUri(null , uri)
81+ )
82+ intent.addFlags(Intent .FLAG_GRANT_READ_URI_PERMISSION )
83+ intent.removeExtra(Intent .EXTRA_STREAM )
84+ intent.data = null
85+ }
8386 }
8487
8588 when (cmd) {
You can’t perform that action at this time.
0 commit comments