Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7486ae20 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Make ChooserActivity intents doccentric and transitory"

parents 8f17b575 411d2aed
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -276,8 +276,13 @@ public class ShareActionProvider extends ActionProvider {
     * @see Intent#ACTION_SEND_MULTIPLE
     */
    public void setShareIntent(Intent shareIntent) {
        if (shareIntent != null) {
            final String action = shareIntent.getAction();
            if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) {
                shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
                        Intent.FLAG_ACTIVITY_AUTO_REMOVE_FROM_RECENTS);
            }
        }
        ActivityChooserModel dataModel = ActivityChooserModel.get(mContext,
            mShareHistoryFileName);
        dataModel.setIntent(shareIntent);
@@ -294,8 +299,12 @@ public class ShareActionProvider extends ActionProvider {
            final int itemId = item.getItemId();
            Intent launchIntent = dataModel.chooseActivity(itemId);
            if (launchIntent != null) {
                final String action = launchIntent.getAction();
                if (Intent.ACTION_SEND.equals(action) ||
                        Intent.ACTION_SEND_MULTIPLE.equals(action)) {
                    launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
                            Intent.FLAG_ACTIVITY_AUTO_REMOVE_FROM_RECENTS);
                }
                mContext.startActivity(launchIntent);
            }
            return true;
+17 −3
Original line number Diff line number Diff line
@@ -33,6 +33,14 @@ public class ChooserActivity extends ResolverActivity {
            return;
        }
        Intent target = (Intent)targetParcelable;
        if (target != null) {
            final String action = target.getAction();
            if (Intent.ACTION_SEND.equals(action) ||
                    Intent.ACTION_SEND_MULTIPLE.equals(action)) {
                target.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
                        Intent.FLAG_ACTIVITY_AUTO_REMOVE_FROM_RECENTS);
            }
        }
        CharSequence title = intent.getCharSequenceExtra(Intent.EXTRA_TITLE);
        if (title == null) {
            title = getResources().getText(com.android.internal.R.string.chooseActivity);
@@ -43,13 +51,19 @@ public class ChooserActivity extends ResolverActivity {
            initialIntents = new Intent[pa.length];
            for (int i=0; i<pa.length; i++) {
                if (!(pa[i] instanceof Intent)) {
                    Log.w("ChooserActivity", "Initial intent #" + i
                            + " not an Intent: " + pa[i]);
                    Log.w("ChooserActivity", "Initial intent #" + i + " not an Intent: " + pa[i]);
                    finish();
                    super.onCreate(null);
                    return;
                }
                initialIntents[i] = (Intent)pa[i];
                final Intent in = (Intent) pa[i];
                final String action = in.getAction();
                if (Intent.ACTION_SEND.equals(action) ||
                        Intent.ACTION_SEND_MULTIPLE.equals(action)) {
                    in.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
                            Intent.FLAG_ACTIVITY_AUTO_REMOVE_FROM_RECENTS);
                }
                initialIntents[i] = in;
            }
        }
        super.onCreate(savedInstanceState, target, title, initialIntents, null, false);