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

Commit 1c29700c authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Guard against apps breaking CHOOSER contract.

Bug: 6520937
Change-Id: I677a644cf7765bbb046f9c82e1ebd8a40968cee6
parent 559146fc
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 {