File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
core/java/android/content Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -6653,17 +6653,20 @@ public boolean migrateExtraStreamToClipData() {
66536653
66546654 final String action = getAction ();
66556655 if (ACTION_CHOOSER .equals (action )) {
6656- // Inspect target intent to see if we need to migrate
6657- final Intent target = getParcelableExtra (EXTRA_INTENT );
6658- if (target .migrateExtraStreamToClipData ()) {
6659- // Since we migrated in child, we need to promote ClipData and
6660- // flags to ourselves to grant.
6661- setClipData (target .getClipData ());
6662- addFlags (target .getFlags ()
6663- & (FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION ));
6664- return true ;
6665- } else {
6666- return false ;
6656+ try {
6657+ // Inspect target intent to see if we need to migrate
6658+ final Intent target = getParcelableExtra (EXTRA_INTENT );
6659+ if (target != null && target .migrateExtraStreamToClipData ()) {
6660+ // Since we migrated in child, we need to promote ClipData
6661+ // and flags to ourselves to grant.
6662+ setClipData (target .getClipData ());
6663+ addFlags (target .getFlags ()
6664+ & (FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION ));
6665+ return true ;
6666+ } else {
6667+ return false ;
6668+ }
6669+ } catch (ClassCastException e ) {
66676670 }
66686671
66696672 } else if (ACTION_SEND .equals (action )) {
You can’t perform that action at this time.
0 commit comments