From 80b1c5608ec9cbb43c696d772eb69a2e220ef819 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 9 Dec 2014 20:22:08 -0800 Subject: Fix issue #18665625 CTS:android.app.cts.InstrumentationTest#... ...testCallActivityOnNewIntent test fails with LMP-MR1 Release. Check for null. Also fix some small issues with converting intents to/from intents. Change-Id: Ic391cc57552635935af9a271b2d09353257f6d14 --- core/java/android/content/Intent.java | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'core/java/android/content') diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index de7fbab..5ebbf16 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -4391,7 +4391,7 @@ public class Intent implements Parcelable, Cloneable { // scheme else if (uri.startsWith("scheme=", i)) { if (inSelector) { - intent.mData = Uri.parse(value); + intent.mData = Uri.parse(value + ":"); } else { scheme = value; } @@ -4461,14 +4461,19 @@ public class Intent implements Parcelable, Cloneable { String authority = null; intent.mPackage = data.substring(14, end); int newEnd; - if (end < data.length() && (newEnd=data.indexOf('/', end+1)) >= 0) { - // Found a scheme, remember it. - scheme = data.substring(end+1, newEnd); - end = newEnd; - if (end < data.length() && (newEnd=data.indexOf('/', end+1)) >= 0) { - // Found a authority, remember it. - authority = data.substring(end+1, newEnd); + if ((end+1) < data.length()) { + if ((newEnd=data.indexOf('/', end+1)) >= 0) { + // Found a scheme, remember it. + scheme = data.substring(end+1, newEnd); end = newEnd; + if (end < data.length() && (newEnd=data.indexOf('/', end+1)) >= 0) { + // Found a authority, remember it. + authority = data.substring(end+1, newEnd); + end = newEnd; + } + } else { + // All we have is a scheme. + scheme = data.substring(end+1); } } if (scheme == null) { @@ -7355,7 +7360,7 @@ public class Intent implements Parcelable, Cloneable { toUriInner(frag, scheme, defAction, defPackage, flags); if (mSelector != null) { - uri.append("SEL;"); + frag.append("SEL;"); // Note that for now we are not going to try to handle the // data part; not clear how to represent this as a URI, and // not much utility in it. -- cgit v1.1