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

Commit 9cb660fa authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Guard against apps breaking CHOOSER contract." into jb-dev

parents e312c61f 1c29700c
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -6653,11 +6653,12 @@ public class Intent implements Parcelable, Cloneable {

        final String action = getAction();
        if (ACTION_CHOOSER.equals(action)) {
            try {
                // Inspect target intent to see if we need to migrate
                final Intent target = getParcelableExtra(EXTRA_INTENT);
            if (target.migrateExtraStreamToClipData()) {
                // Since we migrated in child, we need to promote ClipData and
                // flags to ourselves to grant.
                if (target != null && target.migrateExtraStreamToClipData()) {
                    // Since we migrated in child, we need to promote ClipData
                    // and flags to ourselves to grant.
                    setClipData(target.getClipData());
                    addFlags(target.getFlags()
                            & (FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION));
@@ -6665,6 +6666,8 @@ public class Intent implements Parcelable, Cloneable {
                } else {
                    return false;
                }
            } catch (ClassCastException e) {
            }

        } else if (ACTION_SEND.equals(action)) {
            try {