@@ -6588,58 +6588,56 @@ public void migrateExtraStreamToClipData() {
65886588
65896589 final String action = getAction ();
65906590 if (ACTION_SEND .equals (action )) {
6591- Uri stream = null ;
65926591 try {
6593- stream = getParcelableExtra (EXTRA_STREAM );
6592+ final Uri stream = getParcelableExtra (EXTRA_STREAM );
6593+ final CharSequence text = getCharSequenceExtra (EXTRA_TEXT );
6594+ final String htmlText = getStringExtra (EXTRA_HTML_TEXT );
6595+ if (stream != null || text != null || htmlText != null ) {
6596+ final ClipData clipData = new ClipData (
6597+ null , new String [] { getType () },
6598+ new ClipData .Item (text , htmlText , null , stream ));
6599+ setClipData (clipData );
6600+ addFlags (FLAG_GRANT_READ_URI_PERMISSION );
6601+ }
65946602 } catch (ClassCastException e ) {
65956603 }
6596- final CharSequence text = getCharSequenceExtra (EXTRA_TEXT );
6597- final String htmlText = getStringExtra (EXTRA_HTML_TEXT );
6598- if (stream != null || text != null || htmlText != null ) {
6599- final ClipData clipData = new ClipData (
6600- null , new String [] { getType () },
6601- new ClipData .Item (text , htmlText , null , stream ));
6602- setClipData (clipData );
6603- addFlags (FLAG_GRANT_READ_URI_PERMISSION );
6604- }
66056604
66066605 } else if (ACTION_SEND_MULTIPLE .equals (action )) {
6607- ArrayList <Uri > streams = null ;
66086606 try {
6609- streams = getParcelableArrayListExtra (EXTRA_STREAM );
6610- } catch (ClassCastException e ) {
6611- }
6612- final ArrayList <CharSequence > texts = getCharSequenceArrayListExtra (EXTRA_TEXT );
6613- final ArrayList <String > htmlTexts = getStringArrayListExtra (EXTRA_HTML_TEXT );
6614- int num = -1 ;
6615- if (streams != null ) {
6616- num = streams .size ();
6617- }
6618- if (texts != null ) {
6619- if (num >= 0 && num != texts .size ()) {
6620- // Wha...! F- you.
6621- return ;
6607+ final ArrayList <Uri > streams = getParcelableArrayListExtra (EXTRA_STREAM );
6608+ final ArrayList <CharSequence > texts = getCharSequenceArrayListExtra (EXTRA_TEXT );
6609+ final ArrayList <String > htmlTexts = getStringArrayListExtra (EXTRA_HTML_TEXT );
6610+ int num = -1 ;
6611+ if (streams != null ) {
6612+ num = streams .size ();
66226613 }
6623- num = texts . size ();
6624- }
6625- if ( htmlTexts != null ) {
6626- if ( num >= 0 && num != htmlTexts . size ()) {
6627- // Wha...! F- you.
6628- return ;
6614+ if ( texts != null ) {
6615+ if ( num >= 0 && num != texts . size ()) {
6616+ // Wha...! F- you.
6617+ return ;
6618+ }
6619+ num = texts . size () ;
66296620 }
6630- num = htmlTexts .size ();
6631- }
6632- if (num > 0 ) {
6633- final ClipData clipData = new ClipData (
6634- null , new String [] { getType () },
6635- makeClipItem (streams , texts , htmlTexts , 0 ));
6636-
6637- for (int i = 1 ; i < num ; i ++) {
6638- clipData .addItem (makeClipItem (streams , texts , htmlTexts , i ));
6621+ if (htmlTexts != null ) {
6622+ if (num >= 0 && num != htmlTexts .size ()) {
6623+ // Wha...! F- you.
6624+ return ;
6625+ }
6626+ num = htmlTexts .size ();
66396627 }
6628+ if (num > 0 ) {
6629+ final ClipData clipData = new ClipData (
6630+ null , new String [] { getType () },
6631+ makeClipItem (streams , texts , htmlTexts , 0 ));
66406632
6641- setClipData (clipData );
6642- addFlags (FLAG_GRANT_READ_URI_PERMISSION );
6633+ for (int i = 1 ; i < num ; i ++) {
6634+ clipData .addItem (makeClipItem (streams , texts , htmlTexts , i ));
6635+ }
6636+
6637+ setClipData (clipData );
6638+ addFlags (FLAG_GRANT_READ_URI_PERMISSION );
6639+ }
6640+ } catch (ClassCastException e ) {
66436641 }
66446642 }
66456643 }
0 commit comments