Avoid ClassCast when migrating ACTION_SEND extras.
Bug: 6231948
Change-Id: I008195fa973517446b2400ed3f59af0cbf0fc925
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 1c9ef38..a0d0271 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -6483,7 +6483,12 @@
final String action = getAction();
if (ACTION_SEND.equals(action)) {
- final Uri stream = getParcelableExtra(EXTRA_STREAM);
+ final Uri stream;
+ try {
+ stream = getParcelableExtra(EXTRA_STREAM);
+ } catch (ClassCastException e) {
+ return;
+ }
if (stream != null) {
final ClipData clipData = new ClipData(
null, new String[] { getType() }, new ClipData.Item(stream));
@@ -6493,7 +6498,12 @@
}
} else if (ACTION_SEND_MULTIPLE.equals(action)) {
- final ArrayList<Uri> streams = getParcelableArrayListExtra(EXTRA_STREAM);
+ final ArrayList<Uri> streams;
+ try {
+ streams = getParcelableArrayListExtra(EXTRA_STREAM);
+ } catch (ClassCastException e) {
+ return;
+ }
if (streams != null && streams.size() > 0) {
final Uri firstStream = streams.get(0);
final ClipData clipData = new ClipData(